summaryrefslogtreecommitdiff
path: root/gamemode
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-01 15:18:10 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-01 15:18:10 -0400
commitc58575e51357b4739b98cb737d9a21ef20ee42d6 (patch)
tree160b6bc73feddfcedf78e3474ee50bc7d909aeb0 /gamemode
parentebdcc3753246daf598cea3ec87eb4552380067c9 (diff)
downloadgmstranded-c58575e51357b4739b98cb737d9a21ef20ee42d6.tar.gz
gmstranded-c58575e51357b4739b98cb737d9a21ef20ee42d6.tar.bz2
gmstranded-c58575e51357b4739b98cb737d9a21ef20ee42d6.zip
Added prop spawn menu to q menu
Diffstat (limited to 'gamemode')
-rw-r--r--gamemode/client/cl_inventory.lua106
1 files changed, 69 insertions, 37 deletions
diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua
index 815d0d9..7359e86 100644
--- a/gamemode/client/cl_inventory.lua
+++ b/gamemode/client/cl_inventory.lua
@@ -61,42 +61,6 @@ local function createPanel()
tabsheet:AddSheet("Admin", admintab, "icon16/bullet_star.png")
end
- --Combinations in the combinations button
- local layout = vgui.Create( "DTileLayout", combitab)
- layout:SetBaseSize( 64 ) -- Tile size
- layout:Dock( FILL )
- layout:MakeDroppable( "unique_name" ) -- Allows us to rearrange children
- for k,v in pairs(GMS.Combinations["Combinations"]) do
- PrintTable(v)
- local combipanel = vgui.Create("DButton", layout)
- combipanel:SetSize(64,64)
- combipanel:SetText(v.Name)
- combipanel:SetTooltip(createTooltipTextFor(v.Req))
- combipanel.DoClick = function()
- print("I want to combine a " .. v.Name)
- LocalPlayer():ConCommand("gms_MakeCombination Combinations " .. v.Name)
- end
- layout:Add(combipanel)
- end
-
- --Structure building
- local layout = vgui.Create( "DTileLayout", structtab)
- layout:SetBaseSize( 64 ) -- Tile size
- layout:Dock( FILL )
- layout:MakeDroppable( "unique_name" ) -- Allows us to rearrange children
- for k,v in pairs(GMS.Combinations["Structures"]) do
- --print("Createing panel for " .. v.BuildSiteModel)
- local modelPanel = vgui.Create( "DModelPanel", layout )
- --modelPanel:SetPos( 0, 0 )
- modelPanel:SetSize( 64, 64 )
- modelPanel:SetModel( v.BuildSiteModel )
- modelPanel.DoClick = function()
- print("I want to construct a " .. k)
- LocalPlayer():ConCommand("gms_MakeCombination Structures " .. k )
- end
- layout:Add(modelPanel)
- end
-
--Inventory
local layout = vgui.Create( "DTileLayout", invtab )
layout:SetBaseSize( 64 ) -- Tile size
@@ -131,7 +95,7 @@ local function createPanel()
return
end
local menu = vgui.Create("DMenu")
- print("makeing menu for " .. k)
+ --print("makeing menu for " .. k)
PrintTable(GMS.Resources[k])
createMenuFor(menu,GMS.Resources[k].Actions)
menu:Open()
@@ -140,6 +104,74 @@ local function createPanel()
layout:Add( selection )
end
+ --Structure building
+ local layout = vgui.Create( "DTileLayout", structtab)
+ layout:SetBaseSize( 64 ) -- Tile size
+ layout:Dock( FILL )
+ layout:MakeDroppable( "unique_name" ) -- Allows us to rearrange children
+ for k,v in pairs(GMS.Combinations["Structures"]) do
+ --print("Createing panel for " .. v.BuildSiteModel)
+ local modelPanel = vgui.Create( "DModelPanel", layout )
+ --modelPanel:SetPos( 0, 0 )
+ modelPanel:SetSize( 64, 64 )
+ modelPanel:SetModel( v.BuildSiteModel )
+ modelPanel:SetCamPos( Vector( 50,50,50 ) )
+ modelPanel:SetLookAt( Vector( 0, 0, -40 ) )
+ modelPanel.DoClick = function()
+ --print("I want to construct a " .. k)
+ LocalPlayer():ConCommand("gms_MakeCombination Structures " .. k )
+ end
+ layout:Add(modelPanel)
+ end
+
+ --Combinations in the combinations button
+ local layout = vgui.Create( "DTileLayout", combitab)
+ layout:SetBaseSize( 64 ) -- Tile size
+ layout:Dock( FILL )
+ layout:MakeDroppable( "unique_name" ) -- Allows us to rearrange children
+ for k,v in pairs(GMS.Combinations["Combinations"]) do
+ --PrintTable(v)
+ local combipanel = vgui.Create("DButton", layout)
+ combipanel:SetSize(64,64)
+ combipanel:SetText(v.Name)
+ combipanel:SetTooltip(createTooltipTextFor(v.Req))
+ combipanel.DoClick = function()
+ --print("I want to combine a " .. v.Name)
+ LocalPlayer():ConCommand("gms_MakeCombination Combinations " .. v.Name)
+ end
+ layout:Add(combipanel)
+ end
+
+ --Make the prop spawn menu
+ local layout = vgui.Create( "DListLayout", proptab)
+ layout:Dock( FILL )
+ local labelnum = 0
+ for k,v in pairs(GMS_SpawnLists) do
+ local DCollapsible = vgui.Create( "DCollapsibleCategory" )
+ DCollapsible:SetLabel(k)
+ DCollapsible:SetSize(frame:GetWide(),200)
+ DCollapsible:SetPadding(5)
+ --DCollapsible:SetPos(0,labelnum)
+ DCollapsible:SetExpanded( 0 )
+ layout:Add(DCollapsible)
+ labelnum = labelnum + 20
+ local propgrid = vgui.Create("DTileLayout", DCollapsible)
+ propgrid:SetBaseSize( 64 ) -- Tile size
+ propgrid:Dock( FILL )
+ propgrid:MakeDroppable( "unique_name" ) -- Allows us to rearrange children
+ DCollapsible:SetContents(propgrid)
+ for i,j in pairs(v) do
+ local itm = vgui.Create("DModelPanel", propgrid)
+ itm:SetModel(j)
+ itm:SetSize( 64, 64 )
+ itm.DoClick = function()
+ RunConsoleCommand( "gm_spawn", j, 0 )
+ end
+ propgrid:Add(itm)
+ end
+ --layout:Add(combipanel)
+ end
+
return frame
end