summaryrefslogtreecommitdiff
path: root/gamemode
diff options
context:
space:
mode:
authorScott <scotth0828@gmail.com>2016-05-20 18:59:36 -0400
committerScott <scotth0828@gmail.com>2016-05-20 18:59:36 -0400
commit127ae80dd100b348b95f6850e3854f6ab0de8323 (patch)
treeefaa6c7d35b55c27103f330ea58031b445827660 /gamemode
parentbff19ab32709fe1c19500d6ac72cfa805f023f98 (diff)
downloadgmstranded-127ae80dd100b348b95f6850e3854f6ab0de8323.tar.gz
gmstranded-127ae80dd100b348b95f6850e3854f6ab0de8323.tar.bz2
gmstranded-127ae80dd100b348b95f6850e3854f6ab0de8323.zip
1-3 minute growtime for seeds, seeds removed from inventory on spawn, limit to distance seeds can be planted
Diffstat (limited to 'gamemode')
-rw-r--r--gamemode/itemsystem/common_plantable.lua8
-rw-r--r--gamemode/itemsystem/items/bananaseeds.lua2
-rw-r--r--gamemode/itemsystem/items/berry.lua2
-rw-r--r--gamemode/itemsystem/items/grainseeds.lua2
-rw-r--r--gamemode/itemsystem/items/melonseeds.lua2
-rw-r--r--gamemode/itemsystem/items/orangeseeds.lua2
-rw-r--r--gamemode/itemsystem/items/sprout.lua2
7 files changed, 14 insertions, 6 deletions
diff --git a/gamemode/itemsystem/common_plantable.lua b/gamemode/itemsystem/common_plantable.lua
index 668ca74..067f464 100644
--- a/gamemode/itemsystem/common_plantable.lua
+++ b/gamemode/itemsystem/common_plantable.lua
@@ -9,6 +9,13 @@ if(SERVER) then
end
local function plant(player, resourcename)
if(CLIENT) then
+
+ if LocalPlayer():GetPos():Distance( LocalPlayer():GetEyeTrace().HitPos ) > 180 then
+
+ chat.AddText( Color( 200, 0, 0 ), "Too far away!" )
+ return false
+
+ end
net.Start("gms_plantseed")
net.WriteString(resourcename)
net.SendToServer()
@@ -25,6 +32,7 @@ local function plant(player, resourcename)
pent.OnGrow = tbl.OnGrow
pent:SetOwner(player)
pent:Spawn()
+ player:DecResource( resourcename, 1 )
end
end
net.Receive( "gms_plantseed", function(len,pl)
diff --git a/gamemode/itemsystem/items/bananaseeds.lua b/gamemode/itemsystem/items/bananaseeds.lua
index 5b692cf..80b8379 100644
--- a/gamemode/itemsystem/items/bananaseeds.lua
+++ b/gamemode/itemsystem/items/bananaseeds.lua
@@ -9,7 +9,7 @@ ITEM.UniqueData = false
--Things needed to make something plantable
-ITEM.GrowTime = 1
+ITEM.GrowTime = math.random( 60, 180 )
ITEM.OnGrow = function(self, aor, owner)
local plant = GAMEMODE.MakeGenericPlant( owner, self:GetPos() + Vector( 0, 0, -3 ), "models/props/de_dust/du_palm_tree01_skybx.mdl" )
plant.Children = 0
diff --git a/gamemode/itemsystem/items/berry.lua b/gamemode/itemsystem/items/berry.lua
index 2349145..9e8cdb2 100644
--- a/gamemode/itemsystem/items/berry.lua
+++ b/gamemode/itemsystem/items/berry.lua
@@ -36,7 +36,7 @@ net.Receive( "gms_eatberry", eat)
ITEM.Actions = {}
genericMakeDroppable(ITEM)
ITEM.Actions["Eat Berry"] = eat_client
-ITEM.GrowTime = 1
+ITEM.GrowTime = math.random( 60, 180 )
ITEM.OnGrow = function(self, aor, owner)
GAMEMODE.MakeGenericPlant( owner, self:GetPos() + Vector( math.random( -10, 10 ), math.random( -10, 10 ), 16 ), "models/props/pi_shrub.mdl" )
end
diff --git a/gamemode/itemsystem/items/grainseeds.lua b/gamemode/itemsystem/items/grainseeds.lua
index 1bb6001..0068f49 100644
--- a/gamemode/itemsystem/items/grainseeds.lua
+++ b/gamemode/itemsystem/items/grainseeds.lua
@@ -9,7 +9,7 @@ ITEM.UniqueData = false
--Things needed to make something plantable
-ITEM.GrowTime = 1
+ITEM.GrowTime = math.random( 60, 180 )
ITEM.OnGrow = function(self, aor, owner)
GAMEMODE.MakeGenericPlant( owner, self:GetPos() + Vector( math.random( -10, 10 ), math.random( -10, 10 ), 0 ), "models/props_foliage/cattails.mdl" )
end
diff --git a/gamemode/itemsystem/items/melonseeds.lua b/gamemode/itemsystem/items/melonseeds.lua
index e66b087..9a69205 100644
--- a/gamemode/itemsystem/items/melonseeds.lua
+++ b/gamemode/itemsystem/items/melonseeds.lua
@@ -7,7 +7,7 @@ ITEM.Description = "Something you can plant!"
ITEM.Icon = "items/seed_melon.png"
ITEM.UniqueData = false
-ITEM.GrowTime = 1
+ITEM.GrowTime = math.random( 60, 180 )
ITEM.OnGrow = function(self, aor, owner)
local plant = GAMEMODE.MakeGenericPlant( owner, self:GetPos() + Vector( 0, 0, 13 ), "models/props/CS_militia/fern01.mdl" )
plant.Children = 0
diff --git a/gamemode/itemsystem/items/orangeseeds.lua b/gamemode/itemsystem/items/orangeseeds.lua
index 65501d9..417b3c6 100644
--- a/gamemode/itemsystem/items/orangeseeds.lua
+++ b/gamemode/itemsystem/items/orangeseeds.lua
@@ -8,7 +8,7 @@ ITEM.Icon = "items/seed_orange.png"
ITEM.UniqueData = false
--Things needed to make something plantable
-ITEM.GrowTime = 1
+ITEM.GrowTime = math.random( 60, 180 )
ITEM.OnGrow = function(self, aor, 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 3afb731..3aab4c5 100644
--- a/gamemode/itemsystem/items/sprout.lua
+++ b/gamemode/itemsystem/items/sprout.lua
@@ -6,7 +6,7 @@ ITEM.Description = "Something you can craft with!"
ITEM.Icon = "test.png"
ITEM.UniqueData = false
-ITEM.GrowTime = 1
+ITEM.GrowTime = math.random( 60, 180 )
ITEM.OnGrow = function(self, aor, owner)
local ent = ents.Create( "gms_tree" )
ent:SetPos( self:GetPos() )