diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-04-30 15:35:22 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-04-30 15:35:22 -0400 |
| commit | 603b64b1a93b36f04d25018ec3f53b16dcd84019 (patch) | |
| tree | 0bd9df6581b745d30f354f12ef420165e57b6bb5 /gamemode/itemsystem/items/melonseeds.lua | |
| parent | 677682840305841d4538c6f5d5151f36959ae56f (diff) | |
| download | gmstranded-603b64b1a93b36f04d25018ec3f53b16dcd84019.tar.gz gmstranded-603b64b1a93b36f04d25018ec3f53b16dcd84019.tar.bz2 gmstranded-603b64b1a93b36f04d25018ec3f53b16dcd84019.zip | |
Fixed plant eating
Diffstat (limited to 'gamemode/itemsystem/items/melonseeds.lua')
| -rw-r--r-- | gamemode/itemsystem/items/melonseeds.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gamemode/itemsystem/items/melonseeds.lua b/gamemode/itemsystem/items/melonseeds.lua index 8ddaea5..8d82f7a 100644 --- a/gamemode/itemsystem/items/melonseeds.lua +++ b/gamemode/itemsystem/items/melonseeds.lua @@ -5,6 +5,19 @@ ITEM.Description = "Something you can plant!" ITEM.Icon = "test.png" ITEM.UniqueData = false +ITEM.GrowTime = 1 +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 + + 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( -25, 25 ), math.random( -25, 25 ), math.random( 5, 7 ) ), "models/props_junk/watermelon01.mdl", plant ) + end +end genericMakeDroppable(ITEM) genericMakePlantable(ITEM) |
