From 603b64b1a93b36f04d25018ec3f53b16dcd84019 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 30 Apr 2016 15:35:22 -0400 Subject: Fixed plant eating --- gamemode/itemsystem/items/bananaseeds.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gamemode/itemsystem/items/bananaseeds.lua') diff --git a/gamemode/itemsystem/items/bananaseeds.lua b/gamemode/itemsystem/items/bananaseeds.lua index 72e14b0..4a9d0c0 100644 --- a/gamemode/itemsystem/items/bananaseeds.lua +++ b/gamemode/itemsystem/items/bananaseeds.lua @@ -5,6 +5,21 @@ ITEM.Description = "Something you can plant!" ITEM.Icon = "test.png" ITEM.UniqueData = false + +--Things needed to make something plantable +ITEM.GrowTime = 1 +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 + + local num = 1 + if ( IsValid( ply ) && ply:HasUnlock( "Adept_Farmer" ) ) then num = num + math.random( 0, 1 ) end + if ( IsValid( ply ) && ply:HasUnlock( "Expert_Farmer" ) ) then num = num + math.random( 0, 2 ) end + + for i = 1, num do + GAMEMODE.MakeGenericPlantChild( owner, self:GetPos() + Vector( math.random( -7, 7 ), math.random( -7, 7 ), math.random( 48, 55 ) ), "models/props/cs_italy/bananna_bunch.mdl", plant ) + end +end genericMakePlantable(ITEM) genericMakeDroppable(ITEM) -- cgit v1.2.3-70-g09d2