From 050a8799a07e41c21c3f45f8865cadc1db80bf2f Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sun, 1 May 2016 15:52:16 -0400 Subject: Added tool menu --- gamemode/client/cl_inventory.lua | 42 ++++++++++++++++++++++++++++++++++++++++ gamemode/client/cl_keybinds.lua | 1 + 2 files changed, 43 insertions(+) create mode 100644 gamemode/client/cl_keybinds.lua diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua index 7359e86..80af83f 100644 --- a/gamemode/client/cl_inventory.lua +++ b/gamemode/client/cl_inventory.lua @@ -56,6 +56,8 @@ local function createPanel() tabsheet:AddSheet( "Equipment", equiptab, "icon16/user.png" ) local proptab = vgui.Create("DPanel",tabsheet) tabsheet:AddSheet( "Props", proptab, "icon16/wrench.png" ) + local tooltab = vgui.Create("DPanel", tabsheet) + tabsheet:AddSheet( "Tools", tooltab, "icon16/bullet_red.png") if(LocalPlayer():IsAdmin()) then local admintab = vgui.Create("DPanel",tabsheet) tabsheet:AddSheet("Admin", admintab, "icon16/bullet_star.png") @@ -172,6 +174,46 @@ local function createPanel() --layout:Add(combipanel) end + --Make the tools menu + local toollist = vgui.Create( "DPanelList", tooltab ) + toollist:Dock(FILL) + + local bAlt = true + local NumTools = 0 + PrintTable(spawnmenu.GetTools()[1]["Items"][1]) + for k, v in pairs( spawnmenu.GetTools()[1]["Items"][1] ) do + if(!isnumber(k)) then return end + local Item = vgui.Create( "DButton", toollist) + Item:SetSize(frame:GetWide(),20) + Item:SetText(v.Text) + Item.DoClick = function() + LocalPlayer():ConCommand( v.Command ) + end + --[[ + if ( table.HasValue( GMS.ProhibitedStools, v.ItemName ) ) then continue end + NumTools = NumTools + 1 + + local Item = vgui.Create( "DComboBox", toollist ) + Item:SetText( v.Text or "Test") + Item.OnSelect = function( button ) self:EnableControlPanel( button ) end + concommand.Add( Format( "tool_%s", v.ItemName ), function() Item:OnSelect() end ) + + if ( v.SwitchConVar ) then + Item:AddCheckBox( v.SwitchConVar ) + end + + Item.ControlPanelBuildFunction = v.CPanelFunction + Item.Command = v.Command + Item.Name = v.ItemName + Item.Controls = v.Controls + Item.Text = v.Text + + --Item:SetAlt( bAlt ) + bAlt = !bAlt + ]] + toollist:AddItem( Item ) + end + return frame end diff --git a/gamemode/client/cl_keybinds.lua b/gamemode/client/cl_keybinds.lua new file mode 100644 index 0000000..1a23a3c --- /dev/null +++ b/gamemode/client/cl_keybinds.lua @@ -0,0 +1 @@ +--This should be filled with keybinds to do things like createing and joining tribes. -- cgit v1.2.3-70-g09d2