summaryrefslogtreecommitdiff
path: root/gamemode
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode')
-rw-r--r--gamemode/client/cl_inventory.lua45
-rw-r--r--gamemode/itemsystem/common.lua2
-rw-r--r--gamemode/itemsystem/items/berry.lua2
-rw-r--r--gamemode/itemsystem/items/orangeseeds.lua2
-rw-r--r--gamemode/itemsystem/items/sprout.lua11
-rw-r--r--gamemode/itemsystem/items/waterbottle.lua14
-rw-r--r--gamemode/itemsystem/items/wood.lua10
7 files changed, 72 insertions, 14 deletions
diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua
index 7578609..30dd74c 100644
--- a/gamemode/client/cl_inventory.lua
+++ b/gamemode/client/cl_inventory.lua
@@ -9,6 +9,8 @@ local invxsize = (scrx*0.40)-invxadj-38 --no idea why the 38 works, but it does
local invysize = scry
local function createMenuFor(menu, tbl)
+ print("Createing actions for:")
+ PrintTable(tbl)
for k,v in pairs(tbl) do
if(isfunction(v)) then --This is a dead-end, add the menu
local thisoption = menu:AddOption(k,v)
@@ -38,6 +40,10 @@ local function createPanel()
local invtab = vgui.Create("DPanel",tabsheet)
tabsheet:AddSheet( "Inventory", invtab, "icon16/database.png" )
+ local structtab = vgui.Create("DPanel",tabsheet)
+ tabsheet:AddSheet( "Structures", structtab, "icon16/bullet_blue.png")
+ local combitab = vgui.Create("DPanel",tabsheet)
+ tabsheet:AddSheet( "Combinations", combitab, "icon16/bullet_picture.png")
local equiptab = vgui.Create("DPanel",tabsheet)
tabsheet:AddSheet( "Equipment", equiptab, "icon16/user.png" )
local proptab = vgui.Create("DPanel",tabsheet)
@@ -47,14 +53,47 @@ local function createPanel()
tabsheet:AddSheet("Admin", admintab, "icon16/bullet_star.png")
end
- --Inventory
+ --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
+ print("Combinator a " .. v.Name)
+ local combipanel = vgui.Create("DButton", layout)
+ combipanel:SetSize(64,64)
+ combipanel:SetText(v.Name)
+ 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
layout:Dock( FILL )
layout:MakeDroppable( "unique_name" ) -- Allows us to rearrange children
- PrintTable(Resources)
for k, v in SortedPairs( Resources ) do
if(v == 0) then
continue
@@ -83,6 +122,8 @@ local function createPanel()
return
end
local menu = vgui.Create("DMenu")
+ print("makeing menu for " .. k)
+ PrintTable(GMS.Resources[k])
createMenuFor(menu,GMS.Resources[k].Actions)
menu:Open()
end
diff --git a/gamemode/itemsystem/common.lua b/gamemode/itemsystem/common.lua
index b002a43..114340b 100644
--- a/gamemode/itemsystem/common.lua
+++ b/gamemode/itemsystem/common.lua
@@ -13,7 +13,7 @@ function startProcessGeneric(player, string, time, ondone)
player:Freeze(false)
player.InProcess = false
player:StopProcessBar()
- ondone()
+ ondone(player)
end)
end
diff --git a/gamemode/itemsystem/items/berry.lua b/gamemode/itemsystem/items/berry.lua
index 77a3a35..734cb60 100644
--- a/gamemode/itemsystem/items/berry.lua
+++ b/gamemode/itemsystem/items/berry.lua
@@ -14,7 +14,7 @@ local eat_client = function(ln, player)
net.SendToServer()
end
-local finishedeating = function()
+local finishedeating = function(player)
player:DecResource( "Berries", 1 )
player:SendMessage( "You're a little less hungry and thirsty now.", 3, Color( 10, 200, 10, 255 ) )
--Set hunger and thirst
diff --git a/gamemode/itemsystem/items/orangeseeds.lua b/gamemode/itemsystem/items/orangeseeds.lua
index c9c3963..8f369b8 100644
--- a/gamemode/itemsystem/items/orangeseeds.lua
+++ b/gamemode/itemsystem/items/orangeseeds.lua
@@ -8,8 +8,6 @@ ITEM.UniqueData = false
--Things needed to make something plantable
ITEM.GrowTime = 1
ITEM.OnGrow = function(self, aor, owner)
- print("Owner:")
- print(owner)
local plant = GAMEMODE.MakeGenericPlant( owner, self:GetPos() + Vector( 0, 0, -12 ), "models/props/cs_office/plant01_p1.mdl" )
plant.Children = 0
diff --git a/gamemode/itemsystem/items/sprout.lua b/gamemode/itemsystem/items/sprout.lua
index 218ff2c..93d5646 100644
--- a/gamemode/itemsystem/items/sprout.lua
+++ b/gamemode/itemsystem/items/sprout.lua
@@ -1 +1,10 @@
-print("Hello from sprout.lua!")
+ITEM = {}
+
+ITEM.Name = "Sprouts"
+ITEM.Description = "Something you can craft with!"
+ITEM.Icon = "test.png"
+ITEM.UniqueData = false
+
+genericMakeDroppable(ITEM)
+
+GMS.RegisterResource(ITEM)
diff --git a/gamemode/itemsystem/items/waterbottle.lua b/gamemode/itemsystem/items/waterbottle.lua
index df43749..944d501 100644
--- a/gamemode/itemsystem/items/waterbottle.lua
+++ b/gamemode/itemsystem/items/waterbottle.lua
@@ -1,7 +1,7 @@
ITEM = {}
-ITEM.Name = "Water Bottle"
-ITEM.Description = "A delicious edible!"
+ITEM.Name = "Water Bottles"
+ITEM.Description = "Something you can drink!"
ITEM.Icon = "test.png"
ITEM.UniqueData = false
@@ -9,20 +9,20 @@ if(SERVER) then
util.AddNetworkString( "gms_drinkwaterbottle" )
end
-local eat_client = function(ln, player)
+local drink_client = function(ln, player)
net.Start("gms_drinkwaterbottle")
net.SendToServer()
end
-local finisheddrink = function()
- player:DecResource( "Water Bottle", 1 )
- player:SendMessage( "You're a little less hungry and thirsty now.", 3, Color( 10, 200, 10, 255 ) )
+local finisheddrink = function(player)
+ player:DecResource( "Water Bottles", 1 )
+ player:SendMessage( "You're a little less thirsty now.", 3, Color( 10, 200, 10, 255 ) )
--Set thirst
player:SetThirst(math.Clamp(player.Thirst+100,0,1000))
end
local drink = function(ln, player)
- if(player.Resources["Water Bottle"] <= 0) then
+ if(player.Resources["Water Bottles"] <= 0) then
player:SendMessage( "You don't have enough to do that!", 3, Color( 10, 200, 10, 255 ) )
return
end
diff --git a/gamemode/itemsystem/items/wood.lua b/gamemode/itemsystem/items/wood.lua
new file mode 100644
index 0000000..ec9c261
--- /dev/null
+++ b/gamemode/itemsystem/items/wood.lua
@@ -0,0 +1,10 @@
+ITEM = {}
+
+ITEM.Name = "Wood"
+ITEM.Description = "Something you can craft with!"
+ITEM.Icon = "test.png"
+ITEM.UniqueData = false
+
+genericMakeDroppable(ITEM)
+
+GMS.RegisterResource(ITEM)