summaryrefslogtreecommitdiff
path: root/gamemode
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-06 20:32:19 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-06 20:32:19 -0400
commitd3612d8431de4eaa813d6571c368a0ce0679662c (patch)
tree00755567c6b87176edd851862bfcf1064f8f55ff /gamemode
parent5322c9c6534054c0e2da6441e477d0b2166fbe97 (diff)
downloadgmstranded-d3612d8431de4eaa813d6571c368a0ce0679662c.tar.gz
gmstranded-d3612d8431de4eaa813d6571c368a0ce0679662c.tar.bz2
gmstranded-d3612d8431de4eaa813d6571c368a0ce0679662c.zip
A little more refactoring in the itemsystem
Diffstat (limited to 'gamemode')
-rw-r--r--gamemode/itemsystem/common_plantable.lua17
1 files changed, 4 insertions, 13 deletions
diff --git a/gamemode/itemsystem/common_plantable.lua b/gamemode/itemsystem/common_plantable.lua
index 2728b9a..9c86491 100644
--- a/gamemode/itemsystem/common_plantable.lua
+++ b/gamemode/itemsystem/common_plantable.lua
@@ -14,18 +14,9 @@ local function plant(player, resourcename)
net.SendToServer()
end
if(SERVER) then
- print("Planting " .. resourcename)
local tbl = GMS.Resources[resourcename]
- print("Plant table:")
- PrintTable(tbl)
- if(tbl.GrowTime == nil) then
- print(tbl.Name .. " .GrowTime is nil, this might be a bug!")
- return
- end
- if(tbl.OnGrow == nil) then
- print(tbl.Name .. " .OnGrow is nil, this might be a bug!")
- return
- end
+ assert(tbl.GrowTime != nil,tbl.Name .. " .GrowTime is nil!")
+ assert(isfunction(tbl.OnGrow),tbl.Name .. " .OnGrow is not a table")
local tr = player:GetEyeTrace()
local pent = ents.Create("gms_generic_plantable")
@@ -83,7 +74,7 @@ function GAMEMODE.MakeGenericPlantChild( ply, pos, mdl, parent )
return ent
end
-function GAMEMODE.MakeGenericPlant( ply, pos, mdl, isTree )
+function GAMEMODE.MakeGenericPlant( ply, pos, mdl, isWorld )
local ent = ents.Create( "prop_dynamic" )
ent:SetAngles( Angle( 0, math.random( 0, 360 ), 0 ) )
ent:SetSolid( SOLID_VPHYSICS )
@@ -96,7 +87,7 @@ function GAMEMODE.MakeGenericPlant( ply, pos, mdl, isTree )
ent:Fadein()
ent:RiseFromGround( 1, 50 )
- if ( !isTree && IsValid( ply ) ) then
+ if ( !isWorld && IsValid( ply ) ) then
ent:SetNWEntity( "plantowner", ply )
SPropProtection.PlayerMakePropOwner( ply, ent )
else