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
Mountable
DescriptionThis is the specialization for all vehicles that may be mountedFunctions
- prerequisitesPresent
- load
- delete
- onEnter
- onAttach
- mountDynamic
- unmountDynamic
- getSupportsMountDynamic
- onDynamicMountJointBreak
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 Mountable.prerequisitesPresent(specializations) |
18 | return true; |
19 | end; |
load
DescriptionCalled on loadingDefinition
load(table savegame)Arguments
table | savegame | savegame |
24 | function Mountable:load(savegame) |
25 | |
26 | self.getSupportsMountDynamic = Mountable.getSupportsMountDynamic; |
27 | self.mountDynamic = Mountable.mountDynamic; |
28 | self.unmountDynamic = Mountable.unmountDynamic; |
29 | self.onDynamicMountJointBreak = Mountable.onDynamicMountJointBreak; |
30 | |
31 | self.dynamicMountJointIndex = nil; |
32 | self.dynamicMountObject = nil; |
33 | self.dynamicMountObjectActorId = nil; |
34 | self.dynamicMountForceLimitScale = Utils.getNoNil(getXMLFloat(self.xmlFile, "vehicle.dynamicMount#forceLimitScale"), 1); |
35 | end; |
delete
DescriptionCalled on deletingDefinition
delete()Code
39 | function Mountable:delete() |
40 | if self.dynamicMountJointIndex ~= nil then |
41 | removeJointBreakReport(self.dynamicMountJointIndex); |
42 | removeJoint(self.dynamicMountJointIndex); |
43 | end |
44 | if self.dynamicMountObject ~= nil then |
45 | self.dynamicMountObject:removeDynamicMountedObject(self, true); |
46 | end |
47 | end; |
onEnter
DescriptionCalled on enter vehicleDefinition
onEnter(boolean isControlling)Arguments
boolean | isControlling | is player controlling the vehicle |
67 | function Mountable:onEnter(isControlling) |
68 | self:unmountDynamic(); |
69 | end; |
onAttach
DescriptionCalled if vehicle gets attachedDefinition
onAttach(table attacherVehicle, integer jointDescIndex)Arguments
table | attacherVehicle | attacher vehicle |
integer | jointDescIndex | index of attacher joint it gets attached to |
75 | function Mountable:onAttach(attacherVehicle, jointDescIndex) |
76 | self:unmountDynamic(); |
77 | end; |
mountDynamic
DescriptionMount to objectDefinition
mountDynamic(table object, integer objectActorId, integer jointNode, integer mountType, float forceAcceleration, boolean isBreakable)Arguments
table | object | object to mount at |
integer | objectActorId | id of actor |
integer | jointNode | joint node |
integer | mountType | mount type |
float | forceAcceleration | acceleration force |
boolean | isBreakable | joint is brakeable |
boolean | success | success |
88 | function Mountable:mountDynamic(object, objectActorId, jointNode, mountType, forceAcceleration, isBreakable) |
89 | if not self:getSupportsMountDynamic() or self.mountObject ~= nil or self.attacherVehicle ~= nil or self.isControlled then |
90 | return false; |
91 | end |
92 | return DynamicMountUtil.mountDynamic(self, self.rootNode, object, objectActorId, jointNode, mountType, forceAcceleration*self.dynamicMountForceLimitScale, isBreakable); |
93 | end |
unmountDynamic
DescriptionUnmountDefinition
unmountDynamic()Code
97 | function Mountable:unmountDynamic() |
98 | DynamicMountUtil.unmountDynamic(self); |
99 | end |
getSupportsMountDynamic
DescriptionReturn if vehicle supports dynamic mountingDefinition
getSupportsMountDynamic()
onDynamicMountJointBreak
DescriptionCalled on dynamic mount joint breakDefinition
onDynamicMountJointBreak(integer jointIndex, float breakingImpulse)Arguments
integer | jointIndex | index of broken joint |
float | breakingImpulse | break impulse |
110 | function Mountable:onDynamicMountJointBreak(jointIndex, breakingImpulse) |
111 | if jointIndex == self.dynamicMountJointIndex then |
112 | self:unmountDynamic(); |
113 | end |
114 | -- Do not delete the joint internally, we already deleted it with unmountDynamic |
115 | return false; |
116 | end |