From b738117470b21fbc75f0c126ba7d70052176a2aa Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Thu, 5 May 2016 20:01:07 -0400 Subject: Added camp fire --- entities/entities/gms_campfire.lua | 32 ++++++++++++++++++++++++++++++++ gamemode/client/cl_inventory.lua | 31 ++++++++++++++++++++++++------- gamemode/craftablesystem/misc/stove.lua | 14 ++++++++++++++ 3 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 entities/entities/gms_campfire.lua diff --git a/entities/entities/gms_campfire.lua b/entities/entities/gms_campfire.lua new file mode 100644 index 0000000..a3c27b4 --- /dev/null +++ b/entities/entities/gms_campfire.lua @@ -0,0 +1,32 @@ + + +AddCSLuaFile() + +ENT.Base = "gms_base_entity" +ENT.PrintName = "Campfire" + +ENT.Model = "models/XQM/Rails/gumball_1.mdl" +ENT.Burnproxy = nil +if ( CLIENT ) then return end + +function ENT:OnInitialize() + self:SetModel( self.Model ) + self:PhysicsInit( SOLID_VPHYSICS ) + self:SetMoveType( MOVETYPE_NONE ) + self:SetSolid( SOLID_VPHYSICS ) + self.Burnproxy = ents.Create("prop_physics") + self.Burnproxy:SetModel("models/props_phx/construct/wood/wood_panel1x1.mdl") + self.Burnproxy:Ignite(9999999) + self.Burnproxy:SetPos(self:GetPos()) + self.Burnproxy:SetAngles(self:GetAngles()) + self.Burnproxy:SetColor(Color(0,0,0,0)) + --Removes everything after a little while + timer.Simple( 180, function() + self.Burnproxy:Remove() + self:Remove() + end ) +end + +function ENT:OnUse( ply ) + ply:OpenCombiMenu( "Cooking" ) +end diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua index 730ce78..076dd2a 100644 --- a/gamemode/client/cl_inventory.lua +++ b/gamemode/client/cl_inventory.lua @@ -539,17 +539,24 @@ function PANEL:Init() end return MatSelectPanel end + self.PanelProxy.ClearControls = function() + self.PanelProxy.cp:Clear() + end + self.PanelProxy.AddItem = function(self,item) + print("----------AddItem called!--------------") + print("Adding:") + print(item) + local output = self.cp:AddItem(item) + print("-----------AddItem finished!-----------") + return output + end self.PanelProxy.AddControl = function(self,type,table) print("Adding control...") print("Type:" .. type) - print("Table:") - PrintTable(table) - print("I am:") - PrintTable(self) if(type == "Header") then self.cp:ControlHelp(table.Description) elseif(type == "Slider") then - self.cp:NumSlider(table.Label,table.Command,table.Min,table.Max,0) + return self.cp:NumSlider(table.Label,table.Command,table.Min,table.Max,0) elseif(type == "Checkbox") then self.cp:CheckBox(table.Label,table.Command) elseif(type == "RopeMaterial") then @@ -585,8 +592,11 @@ function PANEL:Init() GetConVar(colorvars["Blue"]):SetInt(t.b) end self.cp:AddItem(color,color_cube) + --[[ elseif(type == "ComboBox") then - local DComboBox = vgui.Create( "DComboBox" ) + + print("Createing combo box!") + local DComboBox, label = self.cp:ComboBox(table.Label, nil) for k,v in pairs(table.Options) do DComboBox:AddChoice(k,v) end @@ -596,7 +606,9 @@ function PANEL:Init() GetConVar(k):SetInt(v) end end + print("Adding combo box to control") self.cp:AddItem(DComboBox) + print("Done!") elseif(type == "PropSelect") then local grid = vgui.Create( "DGrid" ) grid:SetPos( 10, 30 ) @@ -612,6 +624,11 @@ function PANEL:Init() grid:AddItem(icon) end self.cp:AddItem(grid) + ]] + elseif(type == "Label") then + self.cp:AddItem(vgui.Create("DLabel"):SetText(table.Text)) + elseif(type == "Button") then + self.cp:Button(table.Label,table.Command) else print("I wanted to add a control, but I haven't written it yet!") print("Type:" .. type) @@ -1121,7 +1138,7 @@ function PANEL:Init() end function PANEL:Paint() - + draw.RoundedBox(0,0,0,self:GetWide(), self:GetTall(), Color(48,48,48,125)) end diff --git a/gamemode/craftablesystem/misc/stove.lua b/gamemode/craftablesystem/misc/stove.lua index 3bf38f3..c93c433 100644 --- a/gamemode/craftablesystem/misc/stove.lua +++ b/gamemode/craftablesystem/misc/stove.lua @@ -15,6 +15,20 @@ COMBI.BuildSiteModel = "models/props_c17/furniturestove001a.mdl" GMS.RegisterCombi( COMBI, "Structures" ) +/* Campfire */ +COMBI.Name = "Campfire" +COMBI.Description = "A fire you can cook things over!" + +COMBI.Req = {} +COMBI.Req["Stone"] = 10 +COMBI.Req["Wood"] = 15 + +COMBI.Results = "gms_campfire" +COMBI.Texture = "gms_icons/gms_stove.png" +COMBI.BuildSiteModel = "models/XQM/Rails/gumball_1.mdl" + +GMS.RegisterCombi( COMBI, "Structures" ) + /* Casserole */ local COMBI = {} -- cgit v1.2.3-70-g09d2