Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- Player
- Shop
- Sounds
- Specializations
- Triggers
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
Foundation Reference
HookLiftContainer
DescriptionSpecialization for hooklift containers to be attached/loaded up on a hooklift trailerFunctions
- getCanDischargeToGround
- getCanDischargeToObject
- isDetachAllowed
- onLoad
- onStartTipping
- onStopTipping
- prerequisitesPresent
- registerEventListeners
- registerOverwrittenFunctions
getCanDischargeToGround
DescriptionDefinitiongetCanDischargeToGround()Code
61 | function 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) |
70 | end |
getCanDischargeToObject
DescriptionDefinitiongetCanDischargeToObject()Code
48 | function 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) |
57 | end |
isDetachAllowed
DescriptionDefinitionisDetachAllowed()Code
74 | function 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) |
83 | end |
onLoad
DescriptionCalled on loadingDefinition
onLoad(table savegame)Arguments
table | savegame | savegame |
40 | function HookLiftContainer:onLoad(savegame) |
41 | local spec = self.spec_hookLiftContainer |
42 | |
43 | spec.tiltContainerOnDischarge = Utils.getNoNil(getXMLBool(self.xmlFile, "vehicle.hookLiftContainer#tiltContainerOnDischarge"), true) |
44 | end |
onStartTipping
DescriptionDefinitiononStartTipping()Code
87 | function 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 |
93 | end |
onStopTipping
DescriptionDefinitiononStopTipping()Code
97 | function 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 |
104 | end |
prerequisitesPresent
DescriptionChecks if all prerequisite specializations are loadedDefinition
prerequisitesPresent(table specializations)Arguments
table | specializations | specializations |
boolean | hasPrerequisite | true if all prerequisite specializations are loaded |
17 | function HookLiftContainer.prerequisitesPresent(specializations) |
18 | return SpecializationUtil.hasSpecialization(AnimatedVehicle, specializations) and SpecializationUtil.hasSpecialization(Attachable, specializations) |
19 | end |
registerEventListeners
DescriptionDefinitionregisterEventListeners()Code
31 | function HookLiftContainer.registerEventListeners(vehicleType) |
32 | SpecializationUtil.registerEventListener(vehicleType, "onLoad", HookLiftContainer) |
33 | SpecializationUtil.registerEventListener(vehicleType, "onStartTipping", HookLiftContainer) |
34 | SpecializationUtil.registerEventListener(vehicleType, "onStopTipping", HookLiftContainer) |
35 | end |
registerOverwrittenFunctions
DescriptionDefinitionregisterOverwrittenFunctions()Code
23 | function HookLiftContainer.registerOverwrittenFunctions(vehicleType) |
24 | SpecializationUtil.registerOverwrittenFunction(vehicleType, "getCanDischargeToObject", HookLiftContainer.getCanDischargeToObject) |
25 | SpecializationUtil.registerOverwrittenFunction(vehicleType, "getCanDischargeToGround", HookLiftContainer.getCanDischargeToGround) |
26 | SpecializationUtil.registerOverwrittenFunction(vehicleType, "isDetachAllowed", HookLiftContainer.isDetachAllowed) |
27 | end |