Script v1.4.4.0
- Handtools
- Events
- Objects
- Placeables
- Triggers
- Utils
- Vehicles
- Specializations
- AIVehicle
- AnimatedVehicle
- ArticulatedAxis
- Attachable
- AttacherJointControl
- AttacherJoints
- BaleGrab
- BaleLoader
- Baler
- BaleWrapper
- BuiltInCutterTrailer
- BunkerSiloCompacter
- Combine
- ConveyorBelt
- Cover
- CrabSteering
- Crawler
- Cultivator
- Cutter
- Cylindered
- Drivable
- DynamicMountAttacher
- Fillable
- FillActivatable
- FillVolume
- Foldable
- ForageWagon
- FrontloaderAttacher
- FruitPreparer
- FuelTrailer
- Honk
- HookLiftContainer
- HookLiftTrailer
- Leveler
- Lights
- LivestockTrailer
- ManureBarrel
- ManureSpreader
- MixerWagon
- Motorized
- Mountable
- Mower
- NonTabbable
- Overloading
- Pickup
- Pipe
- Plough
- PowerConsumer
- RandomlyMovingParts
- ReceivingHopper
- ReverseDriving
- RidgeMarker
- Roller
- Ropes
- RotorSpreader
- SemiTrailerFront
- Shovel
- SowingMachine
- SpeedRotatingParts
- Sprayer
- Steerable
- StrawBlower
- StumpCutter
- Tedder
- TensionBelts
- Trailer
- TreePlanter
- TreePlanterActivatable
- TreeSaw
- TurnOnVehicle
- Washable
- WaterTrailer
- Weeder
- WheelRotations
- Windrower
- WoodCrusher
- WoodHarvester
- WorkArea
- WorkParticles
Engine v7.0.0.2
- General
- Entity
- Node
- Scenegraph
- Lighting
- Camera
- Shape
- Particle System
- Physics
- Spline
- Animation
- Overlays
- Sound
- Input
- XML
- Network
- Callbacks
- Text Rendering
- Terrain Detail
- Tire Track
- Editor
- Rendering
- String
- Math
- I3D
- Fillplanes
Foundation Reference
HookLiftContainer
DescriptionClass for hooklift containersFunctions
- prerequisitesPresent
- load
- onStartTip
- onEndTip
- getAllowFillFromAir
- toggleTipState
- getCanTipToGround
- getCanTip
- getEndTipIfEmpty
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; |
load
DescriptionCalled on loadingDefinition
load(table savegame)Arguments
table | savegame | savegame |
24 | function HookLiftContainer:load(savegame) |
25 | self.toggleTipState = Utils.overwrittenFunction(self.toggleTipState, HookLiftContainer.toggleTipState); |
26 | self.getAllowFillFromAir = Utils.overwrittenFunction(self.getAllowFillFromAir, HookLiftContainer.getAllowFillFromAir); |
27 | self.getCanTipToGround = Utils.overwrittenFunction(self.getCanTipToGround, HookLiftContainer.getCanTipToGround); |
28 | self.getCanTip = Utils.overwrittenFunction(self.getCanTip, HookLiftContainer.getCanTip); |
29 | self.getEndTipIfEmpty = Utils.overwrittenFunction(self.getEndTipIfEmpty, HookLiftContainer.getEndTipIfEmpty); |
30 | |
31 | self.tiltContainerOnDischarge = Utils.getNoNil(getXMLBool(self.xmlFile, "vehicle.hookLiftContainer#tiltContainerOnDischarge"), true); |
32 | self.canBeTippedManually = Utils.getNoNil(getXMLBool(self.xmlFile, "vehicle.hookLiftContainer#canBeTippedManually"), false); |
33 | end; |
onStartTip
DescriptionCalled on start tippingDefinition
onStartTip(table tipTrigger, integer tipReferencePointIndex, boolean noEventSend, boolean isManuallyTipping)Arguments
table | tipTrigger | tip trigger |
integer | tipReferencePointIndex | index of tip reference point |
boolean | noEventSend | no event send |
boolean | isManuallyTipping | not used anymore |
59 | function HookLiftContainer:onStartTip(tipTrigger, tipReferencePointIndex, noEventSend, isManuallyTipping) |
60 | -- we can not start tipping while we are tipping with another animation |
61 | if self.isServer then |
62 | if self.currentTipReferencePointIndex ~= nil and self.currentTipReferencePointIndex ~= tipReferencePointIndex then |
63 | return; |
64 | end |
65 | end |
66 | self.isManuallyTipping = isManuallyTipping; |
67 | |
68 | if self.attacherVehicle ~= nil and self.attacherVehicle.startTipping ~= nil and self.tiltContainerOnDischarge then |
69 | self.attacherVehicle:startTipping(); |
70 | end; |
71 | end; |
onEndTip
DescriptionCalled at the end of tippingDefinition
onEndTip(boolean noEventSend)Arguments
boolean | noEventSend | no event send |
76 | function HookLiftContainer:onEndTip(noEventSend) |
77 | if self.attacherVehicle ~= nil and self.attacherVehicle.stopTipping ~= nil and self.tiltContainerOnDischarge then |
78 | self.attacherVehicle:stopTipping(); |
79 | self.isManuallyTipping = false; |
80 | end; |
81 | end; |
getAllowFillFromAir
DescriptionReturns if fill from air is allowedDefinition
getAllowFillFromAir()Return Values
boolean | isAllowed | fill from air is allowed |
86 | function HookLiftContainer:getAllowFillFromAir(superFunc) |
87 | if self.isManuallyTipping then |
88 | return false; |
89 | end |
90 | return superFunc(self); |
91 | end |
toggleTipState
DescriptionToggle tip stateDefinition
toggleTipState(table tipTrigger, integer tipReferencePointIndex, boolean isManuallyTipping)Arguments
table | tipTrigger | tip trigger |
integer | tipReferencePointIndex | index of tip reference point |
boolean | isManuallyTipping | not used anymore |
boolean | success | success |
99 | function HookLiftContainer:toggleTipState(superFunc, tipTrigger, tipReferencePointIndex, isManuallyTipping) |
100 | if self.attacherVehicle ~= nil and self.attacherVehicle.isTippingAllowed ~= nil then |
101 | if not self.attacherVehicle:isTippingAllowed() then |
102 | -- fold the arm if arm is not fully folded |
103 | local t = self.attacherVehicle:getAnimationTime("unfoldHand"); |
104 | if t ~= 0 then |
105 | self.attacherVehicle:setFoldDirection(-1); |
106 | end; |
107 | return; |
108 | end; |
109 | end; |
110 | |
111 | if self.isManuallyTipping and (self.tipState == Trailer.TIPSTATE_CLOSING or self.tipState == Trailer.TIPSTATE_CLOSED) then |
112 | return; |
113 | end; |
114 | |
115 | -- Set isManuallyTipping here, so that TrailerToggleTipEvent knows about the state when Trailer:onStartTip calls it |
116 | self.isManuallyTipping = isManuallyTipping; |
117 | |
118 | if superFunc ~= nil then |
119 | superFunc(self, tipTrigger, tipReferencePointIndex, isManuallyTipping); |
120 | end; |
121 | |
122 | -- Set isManuallyTipping again, since HookLiftContainer:onStartTip eventually has set it to nil |
123 | self.isManuallyTipping = isManuallyTipping and self.tipState == Trailer.TIPSTATE_OPENING; |
124 | |
125 | return true; |
126 | end; |
getCanTipToGround
DescriptionReturns if can be tipped to groundDefinition
getCanTipToGround()Return Values
boolean | canTipToGround | can tip to ground |
131 | function HookLiftContainer:getCanTipToGround(superFunc) |
132 | if self.attacherVehicle ~= nil and self.attacherVehicle.isTippingAllowed ~= nil then |
133 | if not self.attacherVehicle:isTippingAllowed() then |
134 | return false; |
135 | end; |
136 | end; |
137 | |
138 | if self.fillLevel == 0 and self.canBeTippedManually then |
139 | return true; |
140 | end; |
141 | |
142 | if superFunc ~= nil then |
143 | return superFunc(self); |
144 | end; |
145 | return true; |
146 | end; |
getCanTip
DescriptionReturns if trailer can tipDefinition
getCanTip()Return Values
boolean | canTip | can tip |
151 | function HookLiftContainer:getCanTip(superFunc) |
152 | if self.fillLevel == 0 and self.canBeTippedManually then |
153 | return true; |
154 | end; |
155 | |
156 | if superFunc ~= nil then |
157 | return superFunc(self); |
158 | end; |
159 | return true; |
160 | end; |
getEndTipIfEmpty
DescriptionReturns if tipping end when the trailer is emptyDefinition
getEndTipIfEmpty()Return Values
boolean | tipEndIfEmpty | tipping ends if trailer is empty |
165 | function HookLiftContainer:getEndTipIfEmpty(superFunc) |
166 | if self.isManuallyTipping then |
167 | return false; |
168 | end; |
169 | |
170 | if superFunc ~= nil then |
171 | return superFunc(self); |
172 | end; |
173 | return true; |
174 | end; |