summaryrefslogtreecommitdiff
path: root/gamemode/client
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-31 20:47:42 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-31 20:47:42 -0400
commitfc11516ad82ca9dea25cf71a665632319bd06b39 (patch)
treeff8487ce4dcd44129148a88a4d1bdd86aae735bf /gamemode/client
parent57581aecaba8105c0f8ed88c56d7f54e74123973 (diff)
downloadgmstranded-fc11516ad82ca9dea25cf71a665632319bd06b39.tar.gz
gmstranded-fc11516ad82ca9dea25cf71a665632319bd06b39.tar.bz2
gmstranded-fc11516ad82ca9dea25cf71a665632319bd06b39.zip
Structures now indicate if they can be built with resources currently in the inventory
Diffstat (limited to 'gamemode/client')
-rw-r--r--gamemode/client/cl_inventory.lua35
1 files changed, 27 insertions, 8 deletions
diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua
index dd1d3d0..13ee054 100644
--- a/gamemode/client/cl_inventory.lua
+++ b/gamemode/client/cl_inventory.lua
@@ -46,7 +46,7 @@ local buttons = {
txt = "Admin",
admin = true,
},
-
+
}
surface.CreateFont( "gmNameFont", {
@@ -178,7 +178,7 @@ function PANEL:Init()
surface.SetTextPos( (titlePanel:GetWide()/2) - ( surface.GetTextSize(gmod.GetGamemode().Name)/2 ), (titlePanel:GetTall()/2) - (select( 2, surface.GetTextSize( gmod.GetGamemode().Name ) )/2) )
surface.DrawText( gmod.GetGamemode().Name )
end
-
+
kk = 1
for k,v in pairs(buttons) do
@@ -327,6 +327,17 @@ function PANEL:Init()
i = 0
for k,v in SortedPairs(GMS.Combinations["Structures"]) do
+ local cancraft = true
+ for i,j in pairs(v.Req) do
+ if Resources[i] == nil then
+ cancraft = false
+ break
+ elseif(Resources[i] < j) then
+ cancraft = false
+ break
+ end
+ end
+
local slot = vgui.Create("DButton", dpnl)
slot:SetSize(dPanelWidth/5, 100)
slot:SetText("")
@@ -341,6 +352,14 @@ function PANEL:Init()
modelPanel.DoClick = function()
LocalPlayer():ConCommand("gms_MakeCombination Structures " .. k )
end
+ if(!cancraft) then
+ print("I don't have the resources to build a ")
+ PrintTable(v)
+ modelPanel:SetColor(Color(255,0,0))
+ else
+ print("I have the resource to build a ")
+ PrintTable(v)
+ end
if (i % 5 != 0 ) then
slot:SetPos(row*dPanelWidth/5, (col-1)*100)
@@ -509,10 +528,10 @@ local PANEL = {}
function PANEL:Init()
self.ActiveTool = "Weld"
-
+
self.pnl = vgui.Create("DPanel", self)
self.pnl:SetSize(dPanelWidth/3, dPanelHeight)
-
+
self.Tools = vgui.Create( "DListLayout", self.pnl )
self.Tools:SetPos(8,8)
self.Tools:SetSize(self.pnl:GetWide()-16, self:GetTall()-16)
@@ -713,9 +732,9 @@ function PANEL:EnableControlPanel( button )
LocalPlayer():ConCommand( button.Command )
end
]]
-
-
-
+
+
+
end
function PANEL:Paint()
@@ -1192,7 +1211,7 @@ vgui.Register( "Admin", PANEL, "DPanel" )
local PANEL = {}
function PANEL:Init()
-
+
local dpnl = vgui.Create( "DScrollPanel", self )
dpnl:SetSize( dPanelWidth, dPanelHeight )
dpnl:SetPos( 0, 0 )