LUADOC - Farming Simulator 17

Printable Version

Script v1.4.4.0

Engine v7.0.0.2

Foundation Reference

TreePlanterActivatable

Description
This is the activable class for treeplanters
Functions

new

Description
Returns new instance of class
Definition
new(table treePlanter)
Arguments
tabletreePlanterobject of treePlanter
Return Values
tableselfnew instance
Code
19function TreePlanterActivatable:new(treePlanter)
20 local self = {};
21 setmetatable(self, TreePlanterActivatable_mt);
22
23 self.treePlanter = treePlanter;
24 self.activateText = string.format(g_i18n:getText("action_refillOBJECT"), self.treePlanter.typeDesc)
25
26 return self;
27end;

getIsActivatable

Description
Returns if is activateable
Definition
getIsActivatable()
Return Values
booleanisActivateableis activateable
Code
32function TreePlanterActivatable:getIsActivatable()
33 if self.treePlanter:getRootAttacherVehicle() ~= g_currentMission.controlledVehicle then
34 return false;
35 end;
36
37 if self.treePlanter.mountedSaplingPallet == nil and self.treePlanter.nearestSaplingPallet ~= nil then
38 return true;
39 end
40 return false;
41end;

onActivateObject

Description
Called on activate object
Definition
onActivateObject()
Code
45function TreePlanterActivatable:onActivateObject()
46 self.treePlanter:loadPallet(networkGetObjectId(self.treePlanter.nearestSaplingPallet));
47end;