diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-04-29 22:17:10 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-04-29 22:17:10 -0400 |
| commit | c90d4ae74d9a51249009ebac34d3627bc3812fa3 (patch) | |
| tree | f3e50280481e56bc87093490ea091bdd7a956223 /gamemode/client | |
| parent | 6f6cce0561c19e7af14bcc6e6b1c7de2d5efc530 (diff) | |
| download | gmstranded-c90d4ae74d9a51249009ebac34d3627bc3812fa3.tar.gz gmstranded-c90d4ae74d9a51249009ebac34d3627bc3812fa3.tar.bz2 gmstranded-c90d4ae74d9a51249009ebac34d3627bc3812fa3.zip | |
Fixed up inventory
Diffstat (limited to 'gamemode/client')
| -rw-r--r-- | gamemode/client/cl_inventory.lua | 30 | ||||
| -rw-r--r-- | gamemode/client/cl_syncronize.lua | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua index 94690ac..ab6f196 100644 --- a/gamemode/client/cl_inventory.lua +++ b/gamemode/client/cl_inventory.lua @@ -25,6 +25,13 @@ local function createPanel() frame:SetTitle( "Inventory" ) frame:MakePopup() frame:SetPos(scrx-invxsize,0) + frame:SetKeyboardInputEnabled(true) + frame:ShowCloseButton(false) + frame.OnKeyCodePressed = function(self, key) + if(key == KEY_Q) then + frame:Close() + end + end local tabsheet = vgui.Create("DPropertySheet", frame) tabsheet:Dock(FILL) @@ -41,6 +48,7 @@ local function createPanel() end --Inventory + local layout = vgui.Create( "DTileLayout", invtab ) layout:SetBaseSize( 64 ) -- Tile size layout:Dock( FILL ) @@ -48,6 +56,9 @@ local function createPanel() layout:MakeDroppable( "unique_name" ) -- Allows us to rearrange children PrintTable(Resources) for k, v in SortedPairs( Resources ) do + if(v == 0) then + continue + end local selection = vgui.Create("DImageButton") if(GMS.Resources[k] == nil) then --This resource is not registered! selection:SetImage("vgui/avatar_default") @@ -77,13 +88,32 @@ local function createPanel() end layout:Add( selection ) end + + return frame end local invpanel = nil function GM:OnSpawnMenuOpen() print("Spawn menu hooked correctly") + if(invpanel == nil) then invpanel = createPanel() + return + end + print("Not nil") + if(! invpanel:IsValid()) then + invpanel = createPanel() + return + end +end + +function GM:ReloadSpawnMenu() + if(!invpanel:IsValid()) then + return + end + if(invpanel != nil) then + invpanel:Close() + invpanel = createPanel() end end diff --git a/gamemode/client/cl_syncronize.lua b/gamemode/client/cl_syncronize.lua index 32d667c..189dd08 100644 --- a/gamemode/client/cl_syncronize.lua +++ b/gamemode/client/cl_syncronize.lua @@ -21,6 +21,7 @@ net.Receive( "gms_SetResource", function( length, pl) Resources[name] = num end print("Finished resource get") + GAMEMODE:ReloadSpawnMenu() end) concommand.Add("gms_cl_printresources",function(ply,cmd,args) |
