Below is a template for a HarvestableClass script, used for controlling harvestables such as trees and plants.
Harvestable = class()
-- Constants-- https://scrapmechanictools.com/lua/Game-Script-Environment/Constants#harvestableclass
Harvestable.poseWeightCount = 0
-- Serverside Callbacks
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#oncreatefunction Harvestable.server_onCreate( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onrefreshfunction Harvestable.server_onRefresh( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onfixedupdatefunction Harvestable.server_onFixedUpdate( self, dt )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#onreceiveupdatefunction Harvestable.server_onReceiveUpdate( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#onexplosionfunction Harvestable.server_onExplosion( self, center, destructionLevel )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#onprojectilefunction Harvestable.server_onProjectile( self, position, airTime, velocity, projectileName, shooter, damage, customData, normal, uuid )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#onmeleefunction Harvestable.server_onMelee( self, position, attacker, damage, power, direction, normal )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#oncollisionfunction Harvestable.server_onCollision( self, other, position, selfPointVelocity, otherPointVelocity, normal )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#canerasefunction Harvestable.server_canErase( self )
return trueend
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#onremovedfunction Harvestable.server_onRemoved( self, player )end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#onunloadfunction Harvestable.server_onUnload( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#ondestroyfunction Harvestable.server_onDestroy( self )
end
-- Clientside Callbacks
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#oncreatefunction Harvestable.client_onCreate( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onrefreshfunction Harvestable.client_onRefresh( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onfixedupdatefunction Harvestable.client_onFixedUpdate( self, dt )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onupdatefunction Harvestable.client_onUpdate( self, dt )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#onprojectilefunction Harvestable.client_onProjectile( self, position, airTime, velocity, projectileName, shooter, damage, customData, normal, uuid )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#onmeleefunction Harvestable.client_onMelee( self, position, attacker, damage, power, direction, normal )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#oncollisionfunction Harvestable.client_onCollision( self, other, position, selfPointVelocity, otherPointVelocity, normal )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#canerasefunction Harvestable.client_canErase( self )
return trueend
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#oninteractfunction Harvestable.client_onInteract( self, character, state )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#caninteractfunction Harvestable.client_canInteract( self, character )
return trueend
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/HarvestableClass#onactionfunction Harvestable.client_onAction( self, action, state )
return trueend
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onclientdataupdatefunction Harvestable.client_onClientDataUpdate( self, data, channel )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#ondestroyfunction Harvestable.client_onDestroy( self )
end