Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
HookLiftContainer
DescriptionSpecialization for hooklift containers to be attached/loaded up on a hooklift trailerFunctions
- getCanDischargeToGround
- getCanDischargeToObject
- initSpecialization
- isDetachAllowed
- onLoad
- onStartTipping
- onStopTipping
- prerequisitesPresent
- registerEventListeners
- registerOverwrittenFunctions
getCanDischargeToGround
DescriptionDefinitiongetCanDischargeToGround()Code
72 | function HookLiftContainer:getCanDischargeToGround(superFunc, dischargeNode) |
73 | local attacherVehicle = self:getAttacherVehicle() |
74 | if attacherVehicle ~= nil and attacherVehicle.getIsTippingAllowed ~= nil then |
75 | if not attacherVehicle:getIsTippingAllowed() then |
76 | return false |
77 | end |
78 | end |
79 | |
80 | return superFunc(self, dischargeNode) |
81 | end |
getCanDischargeToObject
DescriptionDefinitiongetCanDischargeToObject()Code
59 | function HookLiftContainer:getCanDischargeToObject(superFunc, dischargeNode) |
60 | local attacherVehicle = self:getAttacherVehicle() |
61 | if attacherVehicle ~= nil and attacherVehicle.getIsTippingAllowed ~= nil then |
62 | if not attacherVehicle:getIsTippingAllowed() then |
63 | return false |
64 | end |
65 | end |
66 | |
67 | return superFunc(self, dischargeNode) |
68 | end |
initSpecialization
DescriptionCalled on specialization initializingDefinition
initSpecialization()Code
23 | function HookLiftContainer.initSpecialization() |
24 | local schema = Vehicle.xmlSchema |
25 | schema:setXMLSpecializationType("HookLiftContainer") |
26 | |
27 | schema:register(XMLValueType.BOOL, "vehicle.hookLiftContainer#tiltContainerOnDischarge", "Tilt container on discharge", true) |
28 | |
29 | schema:setXMLSpecializationType() |
30 | end |
isDetachAllowed
DescriptionDefinitionisDetachAllowed()Code
85 | function HookLiftContainer:isDetachAllowed(superFunc) |
86 | local attacherVehicle = self:getAttacherVehicle() |
87 | if attacherVehicle ~= nil and attacherVehicle.getCanDetachContainer ~= nil then |
88 | if not attacherVehicle:getCanDetachContainer() then |
89 | return false, nil |
90 | end |
91 | end |
92 | |
93 | return superFunc(self) |
94 | end |
onLoad
DescriptionCalled on loadingDefinition
onLoad(table savegame)Arguments
table | savegame | savegame |
51 | function HookLiftContainer:onLoad(savegame) |
52 | local spec = self.spec_hookLiftContainer |
53 | |
54 | spec.tiltContainerOnDischarge = self.xmlFile:getValue("vehicle.hookLiftContainer#tiltContainerOnDischarge", true) |
55 | end |
onStartTipping
DescriptionDefinitiononStartTipping()Code
98 | function HookLiftContainer:onStartTipping(tipSideIndex) |
99 | local spec = self.spec_hookLiftContainer |
100 | local attacherVehicle = self:getAttacherVehicle() |
101 | if attacherVehicle ~= nil and attacherVehicle.startTipping ~= nil and spec.tiltContainerOnDischarge then |
102 | attacherVehicle:startTipping() |
103 | end |
104 | end |
onStopTipping
DescriptionDefinitiononStopTipping()Code
108 | function HookLiftContainer:onStopTipping() |
109 | local spec = self.spec_hookLiftContainer |
110 | local attacherVehicle = self:getAttacherVehicle() |
111 | |
112 | if attacherVehicle ~= nil and attacherVehicle.stopTipping ~= nil and spec.tiltContainerOnDischarge then |
113 | attacherVehicle:stopTipping() |
114 | end |
115 | 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
42 | function HookLiftContainer.registerEventListeners(vehicleType) |
43 | SpecializationUtil.registerEventListener(vehicleType, "onLoad", HookLiftContainer) |
44 | SpecializationUtil.registerEventListener(vehicleType, "onStartTipping", HookLiftContainer) |
45 | SpecializationUtil.registerEventListener(vehicleType, "onStopTipping", HookLiftContainer) |
46 | end |
registerOverwrittenFunctions
DescriptionDefinitionregisterOverwrittenFunctions()Code
34 | function HookLiftContainer.registerOverwrittenFunctions(vehicleType) |
35 | SpecializationUtil.registerOverwrittenFunction(vehicleType, "getCanDischargeToObject", HookLiftContainer.getCanDischargeToObject) |
36 | SpecializationUtil.registerOverwrittenFunction(vehicleType, "getCanDischargeToGround", HookLiftContainer.getCanDischargeToGround) |
37 | SpecializationUtil.registerOverwrittenFunction(vehicleType, "isDetachAllowed", HookLiftContainer.isDetachAllowed) |
38 | end |