LUADOC - Farming Simulator 19

Script v1.7.1.0

Engine v1.7.1.0

Foundation Reference

HookLiftContainer

Description
Specialization for hooklift containers to be attached/loaded up on a hooklift trailer
Functions

getCanDischargeToGround

Description
Definition
getCanDischargeToGround()
Code
61function HookLiftContainer:getCanDischargeToGround(superFunc, dischargeNode)
62 local attacherVehicle = self:getAttacherVehicle()
63 if attacherVehicle ~= nil and attacherVehicle.getIsTippingAllowed ~= nil then
64 if not attacherVehicle:getIsTippingAllowed() then
65 return false
66 end
67 end
68
69 return superFunc(self, dischargeNode)
70end

getCanDischargeToObject

Description
Definition
getCanDischargeToObject()
Code
48function HookLiftContainer:getCanDischargeToObject(superFunc, dischargeNode)
49 local attacherVehicle = self:getAttacherVehicle()
50 if attacherVehicle ~= nil and attacherVehicle.getIsTippingAllowed ~= nil then
51 if not attacherVehicle:getIsTippingAllowed() then
52 return false
53 end
54 end
55
56 return superFunc(self, dischargeNode)
57end

isDetachAllowed

Description
Definition
isDetachAllowed()
Code
74function HookLiftContainer:isDetachAllowed(superFunc)
75 local attacherVehicle = self:getAttacherVehicle()
76 if attacherVehicle ~= nil and attacherVehicle.getCanDetachContainer ~= nil then
77 if not attacherVehicle:getCanDetachContainer() then
78 return false, nil
79 end
80 end
81
82 return superFunc(self)
83end

onLoad

Description
Called on loading
Definition
onLoad(table savegame)
Arguments
tablesavegamesavegame
Code
40function HookLiftContainer:onLoad(savegame)
41 local spec = self.spec_hookLiftContainer
42
43 spec.tiltContainerOnDischarge = Utils.getNoNil(getXMLBool(self.xmlFile, "vehicle.hookLiftContainer#tiltContainerOnDischarge"), true)
44end

onStartTipping

Description
Definition
onStartTipping()
Code
87function HookLiftContainer:onStartTipping(tipSideIndex)
88 local spec = self.spec_hookLiftContainer
89 local attacherVehicle = self:getAttacherVehicle()
90 if attacherVehicle ~= nil and attacherVehicle.startTipping ~= nil and spec.tiltContainerOnDischarge then
91 attacherVehicle:startTipping()
92 end
93end

onStopTipping

Description
Definition
onStopTipping()
Code
97function HookLiftContainer:onStopTipping()
98 local spec = self.spec_hookLiftContainer
99 local attacherVehicle = self:getAttacherVehicle()
100
101 if attacherVehicle ~= nil and attacherVehicle.stopTipping ~= nil and spec.tiltContainerOnDischarge then
102 attacherVehicle:stopTipping()
103 end
104end

prerequisitesPresent

Description
Checks if all prerequisite specializations are loaded
Definition
prerequisitesPresent(table specializations)
Arguments
tablespecializationsspecializations
Return Values
booleanhasPrerequisitetrue if all prerequisite specializations are loaded
Code
17function HookLiftContainer.prerequisitesPresent(specializations)
18 return SpecializationUtil.hasSpecialization(AnimatedVehicle, specializations) and SpecializationUtil.hasSpecialization(Attachable, specializations)
19end

registerEventListeners

Description
Definition
registerEventListeners()
Code
31function HookLiftContainer.registerEventListeners(vehicleType)
32 SpecializationUtil.registerEventListener(vehicleType, "onLoad", HookLiftContainer)
33 SpecializationUtil.registerEventListener(vehicleType, "onStartTipping", HookLiftContainer)
34 SpecializationUtil.registerEventListener(vehicleType, "onStopTipping", HookLiftContainer)
35end

registerOverwrittenFunctions

Description
Definition
registerOverwrittenFunctions()
Code
23function HookLiftContainer.registerOverwrittenFunctions(vehicleType)
24 SpecializationUtil.registerOverwrittenFunction(vehicleType, "getCanDischargeToObject", HookLiftContainer.getCanDischargeToObject)
25 SpecializationUtil.registerOverwrittenFunction(vehicleType, "getCanDischargeToGround", HookLiftContainer.getCanDischargeToGround)
26 SpecializationUtil.registerOverwrittenFunction(vehicleType, "isDetachAllowed", HookLiftContainer.isDetachAllowed)
27end