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
ManureSpreader
DescriptionClass for all sprayersFunctions
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 ManureSpreader.prerequisitesPresent(specializations) |
18 | return SpecializationUtil.hasSpecialization(Sprayer, specializations) and SpecializationUtil.hasSpecialization(AnimatedVehicle, specializations); |
19 | end; |
load
DescriptionCalled on loadingDefinition
load(table savegame)Arguments
table | savegame | savegame |
24 | function ManureSpreader:load(savegame) |
25 | |
26 | self.getTipScrollerSpeed = Utils.overwrittenFunction(self.getTipScrollerSpeed, ForageWagon.getTipScrollerSpeed); |
27 | |
28 | self.manureSpreaderTurnedOnRotationNodes = Utils.loadRotationNodes(self.xmlFile, {}, "vehicle.turnedOnRotationNodes.turnedOnRotationNode", "manureSpreader", self.components); |
29 | self.manureSpreaderScrollers = Utils.loadScrollers(self.components, self.xmlFile, "vehicle.manureSpreaderScrollers.scrollerNode", {}, false); |
30 | |
31 | self.turnedOnTipScrollerSpeedFactor = Utils.getNoNil(getXMLFloat(self.xmlFile, "vehicle.turnedOnTipScrollerSpeedFactor#value"), 0.25); |
32 | |
33 | local fillVolumeHeightRefNodeString = getXMLString(self.xmlFile, "vehicle.fillVolumeHeightRefNode#index"); |
34 | if fillVolumeHeightRefNodeString ~= nil then |
35 | self.fillVolumeHeightRefNode = Utils.indexToObject(self.components, fillVolumeHeightRefNodeString); |
36 | end; |
37 | end; |
update
DescriptionCalled on updateDefinition
update(float dt)Arguments
float | dt | time since last call in ms |
63 | function ManureSpreader:update(dt) |
64 | if self.isClient then |
65 | Utils.updateRotationNodes(self, self.manureSpreaderTurnedOnRotationNodes, dt, self:getIsActive() and self:getIsTurnedOn() ); |
66 | Utils.updateScrollers(self.manureSpreaderScrollers, dt, self:getIsActive() and self:getIsTurnedOn()); |
67 | |
68 | if self:getIsTurnedOn() then |
69 | if self.fillVolumeHeightRefNode ~= nil and self.fillVolumeHeightRefNodeToFillVolumeHeight[self.fillVolumeHeightRefNode] ~= nil then |
70 | self.fillVolumeHeightRefNodeToFillVolumeHeight[self.fillVolumeHeightRefNode].volumeHeightIsDirty = true; |
71 | end; |
72 | |
73 | if self.fillUnits ~= nil then |
74 | local fillUnit = self.fillUnits[self.sprayer.fillUnitIndex]; |
75 | if fillUnit ~= nil then |
76 | local fillVolume = self.fillVolumes[fillUnit.fillVolumeIndex]; |
77 | if fillVolume ~= nil then |
78 | if fillVolume.scrollSpeedDischarge[1] ~= 0 or fillVolume.scrollSpeedDischarge[2] ~= 0 or fillVolume.scrollSpeedDischarge[3] ~= 0 then |
79 | fillVolume.uvPosition[1] = fillVolume.uvPosition[1] + fillVolume.scrollSpeedDischarge[1]*dt; |
80 | fillVolume.uvPosition[2] = fillVolume.uvPosition[2] + fillVolume.scrollSpeedDischarge[2]*dt; |
81 | fillVolume.uvPosition[3] = fillVolume.uvPosition[3] + fillVolume.scrollSpeedDischarge[3]*dt; |
82 | setShaderParameter(fillVolume.volume, "uvOffset", fillVolume.uvPosition[1], fillVolume.uvPosition[2], fillVolume.uvPosition[3], 0, false); |
83 | end |
84 | end |
85 | end |
86 | end |
87 | end; |
88 | end; |
89 | end; |
getTipScrollerSpeed
DescriptionReturns tip scroller speedDefinition
getTipScrollerSpeed()Return Values
float | tipScrollerSpeed | tip scroller speed |
118 | function ManureSpreader:getTipScrollerSpeed(superFunc) |
119 | local value = 0; |
120 | if self:getIsTurnedOn() then |
121 | value = self.turnedOnTipScrollerSpeedFactor; |
122 | end; |
123 | value = math.max(value, superFunc(self)); |
124 | end; |