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
- AIConveyorBelt
- AIDrivable
- AIFieldWorker
- AIImplement
- AIJobVehicle
- AIVehicle
- AIVehicleObstacle
- AnimatedVehicle
- ArticulatedAxis
- Attachable
- AttacherJointControl
- AttacherJoints
- AutoLoader
- BaleGrab
- BaleLoader
- Baler
- BaleWrapper
- BaseMaterial
- BigBag
- BunkerSiloCompacter
- BunkerSiloInteractor
- CCTDrivable
- Combine
- ConnectionHoses
- ConveyorBelt
- Cover
- CrabSteering
- Crawlers
- CropSensor
- Cultivator
- Cutter
- Cylindered
- CylinderedFoldable
- Dashboard
- Dischargeable
- Drivable
- DynamicallyLoadedParts
- DynamicMountAttacher
- Enterable
- ExtendedAIVehicle
- ExtendedCombine
- ExtendedMotorized
- ExtendedMower
- ExtendedSowingMachine
- ExtendedSprayer
- ExtendedWearable
- FertilizingCultivator
- FertilizingSowingMachine
- FillTriggerVehicle
- FillUnit
- FillVolume
- Foldable
- FoliageBending
- ForageWagon
- FrontloaderAttacher
- FruitPreparer
- GroundAdjustedNodes
- GroundReference
- HeadlandAnimation
- Honk
- HookLiftContainer
- HookLiftTrailer
- IKChains
- InlineWrapper
- JigglingParts
- Leveler
- LicensePlates
- Lights
- LivestockTrailer
- Locomotive
- LogGrab
- ManureBarrel
- ManureSensor
- MixerWagon
- Motorized
- Mountable
- Mower
- Mulcher
- MultipleItemPurchase
- Pallet
- Pickup
- Pipe
- PlaceableAI
- PlaceableAnimatedObjects
- PlaceableBeehive
- PlaceableBeehivePalletSpa...
- PlaceableBunkerSilo
- PlaceableBuyingStation
- PlaceableCartridgePlayer
- PlaceableChargingStation
- PlaceableClearAreas
- PlaceableColorable
- PlaceableDeletedNodes
- PlaceableDoghouse
- PlaceableDynamicallyLoade...
- PlaceableFarmhouse
- PlaceableFence
- PlaceableFoliageAreas
- PlaceableGreenhouse
- PlaceableHighPressureWash...
- PlaceableHotspots
- PlaceableHusbandry
- PlaceableHusbandryAnimals
- PlaceableHusbandryFeeding...
- PlaceableHusbandryFence
- PlaceableHusbandryFood
- PlaceableHusbandryLiquidM...
- PlaceableHusbandryMilk
- PlaceableHusbandryPallets
- PlaceableHusbandryStraw
- PlaceableHusbandryWater
- PlaceableIncomePerHour
- PlaceableIndoorAreas
- PlaceableInfoTrigger
- PlaceableLeveling
- PlaceableLights
- PlaceableManureHeap
- PlaceablePlacement
- PlaceableProductionPoint
- PlaceableSellingStation
- PlaceableSilo
- PlaceableSiloExtension
- PlaceableSolarPanels
- PlaceableTipOcclusionArea...
- PlaceableTrainSystem
- PlaceableTriggerMarkers
- PlaceableVine
- PlaceableWardrobe
- PlaceableWeatherStation
- PlaceableWeighingStation
- PlaceableWindTurbine
- PlaceableWorkshop
- Plow
- PlowPacker
- PowerConsumer
- PowerTakeOffs
- PrecisionFarmingStatistic
- PushHandTool
- RandomlyMovingParts
- ReceivingHopper
- ReverseDriving
- Rideable
- RidgeMarker
- Roller
- Ropes
- RTKStation
- SaltSpreader
- SemiTrailerFront
- Shovel
- SlopeCompensation
- SmartAttach
- SoilSampler
- SowingMachine
- SpeedRotatingParts
- SplineVehicle
- Sprayer
- StonePicker
- StrawBlower
- StumpCutter
- SupportVehicle
- Suspensions
- Tedder
- TensionBeltObject
- TensionBelts
- TestAreas
- TipOccluder
- Trailer
- TreePlanter
- TreeSaplingPallet
- TreeSaw
- TurnOnVehicle
- VariableWorkWidth
- VehicleSettings
- VineCutter
- VineDetector
- VinePrepruner
- Washable
- WaterTrailer
- Wearable
- Weeder
- WeedSpotSpray
- Wheels
- WindBending
- Windrower
- Wipers
- WoodCrusher
- WoodHarvester
- WorkArea
- WorkMode
- WorkParticles
- 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
CylinderedFoldable
DescriptionSpecialization to repeat the loading of cylindered states after the folding state was loaded, in case the animation overlaps with the moving toolsFunctions
- initSpecialization
- onLoad
- onPostLoad
- onReadStream
- onWriteStream
- prerequisitesPresent
- registerEventListeners
initSpecialization
DescriptionDefinitioninitSpecialization()Code
23 | function CylinderedFoldable.initSpecialization() |
24 | local schema = Vehicle.xmlSchema |
25 | schema:setXMLSpecializationType("CylinderedFoldable") |
26 | |
27 | schema:register(XMLValueType.BOOL, "vehicle.cylindered#loadMovingToolStatesAfterFolding", "Load moving tool states after folding state was loaded", false) |
28 | schema:register(XMLValueType.FLOAT, "vehicle.cylindered#loadMovingToolStatesFoldTime", "Fold time in which moving tool states should be loaded") |
29 | |
30 | schema:setXMLSpecializationType() |
31 | end |
onLoad
DescriptionCalled on loadingDefinition
onLoad(table savegame)Arguments
table | savegame | savegame |
45 | function CylinderedFoldable:onLoad(savegame) |
46 | local spec = self.spec_cylinderedFoldable |
47 | |
48 | spec.loadMovingToolStatesAfterFolding = self.xmlFile:getValue("vehicle.cylindered#loadMovingToolStatesAfterFolding", false) |
49 | spec.loadMovingToolStatesFoldTime = self.xmlFile:getValue("vehicle.cylindered#loadMovingToolStatesFoldTime") |
50 | end |
onPostLoad
DescriptionDefinitiononPostLoad()Code
54 | function CylinderedFoldable:onPostLoad(savegame) |
55 | local spec = self.spec_cylinderedFoldable |
56 | if spec.loadMovingToolStatesAfterFolding then |
57 | local targetFoldTime = spec.loadMovingToolStatesFoldTime |
58 | if targetFoldTime == nil or self:getFoldAnimTime() == targetFoldTime then |
59 | Cylindered.onPostLoad(self, savegame) |
60 | end |
61 | end |
62 | end |
onReadStream
DescriptionDefinitiononReadStream()Code
66 | function CylinderedFoldable:onReadStream(streamId, connection) |
67 | -- update folding animation so it's finished and won't destroy the cylindered states in the first frame |
68 | AnimatedVehicle.updateAnimations(self, 9999999) |
69 | |
70 | -- rerun the sync of cylindered since it was overwritten by foldable |
71 | if streamReadBool(streamId) then |
72 | Cylindered.onReadStream(self, streamId, connection) |
73 | end |
74 | |
75 | -- update dependent animations initial |
76 | if connection:getIsServer() then |
77 | for i=1, #self.spec_cylindered.movingTools do |
78 | local tool = self.spec_cylindered.movingTools[i] |
79 | if tool.dirtyFlag ~= nil then |
80 | self:updateDependentAnimations(tool, 9999) |
81 | end |
82 | end |
83 | end |
84 | end |
onWriteStream
DescriptionDefinitiononWriteStream()Code
88 | function CylinderedFoldable:onWriteStream(streamId, connection) |
89 | local spec = self.spec_cylinderedFoldable |
90 | |
91 | if streamWriteBool(streamId, spec.loadMovingToolStatesFoldTime == nil or self:getFoldAnimTime() == spec.loadMovingToolStatesFoldTime) then |
92 | Cylindered.onWriteStream(self, streamId, connection) |
93 | end |
94 | 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 CylinderedFoldable.prerequisitesPresent(specializations) |
18 | return SpecializationUtil.hasSpecialization(Cylindered, specializations) and SpecializationUtil.hasSpecialization(Foldable, specializations) |
19 | end |
registerEventListeners
DescriptionDefinitionregisterEventListeners()Code
35 | function CylinderedFoldable.registerEventListeners(vehicleType) |
36 | SpecializationUtil.registerEventListener(vehicleType, "onLoad", CylinderedFoldable) |
37 | SpecializationUtil.registerEventListener(vehicleType, "onPostLoad", CylinderedFoldable) |
38 | SpecializationUtil.registerEventListener(vehicleType, "onReadStream", CylinderedFoldable) |
39 | SpecializationUtil.registerEventListener(vehicleType, "onWriteStream", CylinderedFoldable) |
40 | end |