Fixed info not working in singleplayer. Fixes: #199

This commit is contained in:
Garrett Brown 2019-02-11 01:23:06 -05:00
parent 7fed519938
commit d58d2af950
2 changed files with 5 additions and 54 deletions

View File

@ -168,11 +168,7 @@ function BROWSER:DoNodeLeftClick(node)
node:SetExpanded() //It's a folder, expand/collapse it
end
else
if(game.SinglePlayer())then //It's a file, open it
RunConsoleCommand("AdvDupe2_OpenFile", GetNodePath(node))
else
AdvDupe2.InitializeUpload(GetNodePath(node))
end
AdvDupe2.InitializeUpload(GetNodePath(node))
end
else
self:SetSelected(node) //A node was clicked, select it
@ -387,12 +383,8 @@ function BROWSER:DoNodeRightClick(node)
local root = GetNodeRoot(node).Label:GetText()
if(node.Derma.ClassName=="advdupe2_browser_file")then
if(node.Control.Search)then
Menu:AddOption("Open", function()
if(game.SinglePlayer())then
RunConsoleCommand("AdvDupe2_OpenFile",GetNodePath(node.Ref))
else
AdvDupe2.InitializeUpload(GetNodePath(node.Ref))
end
Menu:AddOption("Open", function()
AdvDupe2.InitializeUpload(GetNodePath(node.Ref))
end)
Menu:AddOption("Preview", function()
local ReadPath, ReadArea = GetNodePath(node.Ref)
@ -413,12 +405,8 @@ function BROWSER:DoNodeRightClick(node)
if(success)then AdvDupe2.LoadGhosts(dupe, info, moreinfo, name, true) end
end)
else
Menu:AddOption("Open", function()
if(game.SinglePlayer())then
RunConsoleCommand("AdvDupe2_OpenFile",GetNodePath(node))
else
AdvDupe2.InitializeUpload(GetNodePath(node))
end
Menu:AddOption("Open", function()
AdvDupe2.InitializeUpload(GetNodePath(node))
end)
Menu:AddOption("Preview", function()
local ReadPath, ReadArea = GetNodePath(node)

View File

@ -630,43 +630,6 @@ if(SERVER)then
end
duplicator.RegisterEntityClass("gmod_contr_spawner", MakeContraptionSpawner, "Pos", "Ang", "HeadEnt", "EntityTable", "ConstraintTable", "delay", "undo_delay", "model", "key", "undo_key", "disgrav", "disdrag", "addvel", "hideprops")
--[[==============]]--
--[[FILE FUNCTIONS]]--
--[[==============]]--
if(game.SinglePlayer())then
//Open file in SinglePlayer
local function OpenFile(ply, cmd, args)
if(ply.AdvDupe2.Pasting || ply.AdvDupe2.Downloading)then
AdvDupe2.Notify(ply,"Advanced Duplicator 2 is busy.",NOTIFY_ERROR)
return false
end
local path, area = args[1], tonumber(args[2])
if(area==0)then
data = ply:ReadAdvDupe2File(path)
elseif(area==1)then
data = AdvDupe2.ReadFile(nil, "-Public-/"..path)
else
data = AdvDupe2.ReadFile(ply, path, "adv_duplicator")
end
if(data==false or data==nil)then
AdvDupe2.Notify(ply, "File contains incorrect data!", NOTIFY_ERROR)
return
end
local name = string.Explode("/", path)
ply.AdvDupe2.Name = name[#name]
AdvDupe2.LoadDupe(ply, AdvDupe2.Decode(data))
end
concommand.Add("AdvDupe2_OpenFile", OpenFile)
end
//Save a file to the client
local function SaveFile(ply, cmd, args)
if(not ply.AdvDupe2 or not ply.AdvDupe2.Entities or table.Count(ply.AdvDupe2.Entities)==0)then AdvDupe2.Notify(ply,"Duplicator is empty, nothing to save.", NOTIFY_ERROR) return end