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
CCTDrivable
DescriptionSpecialization class for CCTDrivablesXML Configuration Parameters
vehicle.cctDrivable#cctRadius | radius of the CCT |
vehicle.cctDrivable#cctHeight | height of the CCT |
Functions
- getCCTCollisionMask
- getCCTWorldTranslation
- getIsCCTOnGround
- initSpecialization
- moveCCT
- onDelete
- onLoad
- prerequisitesPresent
- registerEventListeners
- registerFunctions
- registerOverwrittenFunctions
- setWorldPosition
- setWorldPositionQuaternion
getCCTCollisionMask
DescriptionDefinitiongetCCTCollisionMask()Return Values
int | returns | the collision mask |
126 | function CCTDrivable:getCCTCollisionMask() |
127 | local spec = self.spec_cctdrivable |
128 | return spec.kinematicCollisionMask |
129 | end |
getCCTWorldTranslation
DescriptionDefinitiongetCCTWorldTranslation()Return Values
float | x | position of center of CCT |
float | y | position of center of CCT |
float | z | position of center of CCT |
136 | function CCTDrivable:getCCTWorldTranslation() |
137 | local spec = self.spec_cctdrivable |
138 | local cctX, cctY, cctZ = getTranslation(spec.cctNode) |
139 | cctY = cctY-spec.cctCenterOffset |
140 | return cctX, cctY, cctZ |
141 | end |
getIsCCTOnGround
DescriptionDefinitiongetIsCCTOnGround()Return Values
int | returns | the CCT index |
114 | function CCTDrivable:getIsCCTOnGround() |
115 | local spec = self.spec_cctdrivable |
116 | if self.isServer then |
117 | local _, _, isOnGround = getCCTCollisionFlags(spec.controllerIndex) |
118 | return isOnGround |
119 | end |
120 | return false |
121 | end |
initSpecialization
DescriptionDefinitioninitSpecialization()Code
26 | function CCTDrivable.initSpecialization() |
27 | local schema = Vehicle.xmlSchema |
28 | schema:setXMLSpecializationType("CCTDrivable") |
29 | |
30 | schema:register(XMLValueType.FLOAT, "vehicle.cctDrivable#cctRadius", "CCT radius", 1.0) |
31 | schema:register(XMLValueType.FLOAT, "vehicle.cctDrivable#cctHeight", "CCT height", 1.0) |
32 | schema:register(XMLValueType.FLOAT, "vehicle.cctDrivable#cctSlopeLimit", "CCT slope limit", 25.0) |
33 | schema:register(XMLValueType.FLOAT, "vehicle.cctDrivable#cctStepOffset", "CCT step offset", 0.35) |
34 | schema:register(XMLValueType.FLOAT, "vehicle.cctDrivable#customOffset", "CCT custom offset", 0) |
35 | |
36 | schema:setXMLSpecializationType() |
37 | end |
moveCCT
DescriptionDefinitionmoveCCT()Code
101 | function CCTDrivable:moveCCT(moveX, moveY, moveZ) |
102 | if self.isServer then |
103 | local spec = self.spec_cctdrivable |
104 | -- move cct |
105 | -- print(string.format("-- [CCTDrivable:moveCCT][%d] physIndex(%d) move(%.6f, %.6f, %.6f) physDt(%.6f) physDtNoInterp(%.6f) physDtUnclamp(%.6f)", g_updateLoopIndex, getPhysicsUpdateIndex(), moveX, moveY, moveZ, g_physicsDt, g_physicsDtNonInterpolated, g_physicsDtUnclamped)) |
106 | moveCCT(spec.controllerIndex, moveX, moveY, moveZ, spec.movementCollisionMask) |
107 | self:raiseActive() |
108 | end |
109 | end |
onDelete
DescriptionCalled on deletingDefinition
onDelete()Code
90 | function CCTDrivable:onDelete() |
91 | local spec = self.spec_cctdrivable |
92 | |
93 | if spec.controllerIndex ~= nil then |
94 | removeCCT(spec.controllerIndex) |
95 | delete(spec.cctNode) |
96 | end |
97 | end |
onLoad
DescriptionCalled on loadingDefinition
onLoad(table savegame)Arguments
table | savegame | savegame |
67 | function CCTDrivable:onLoad(savegame) |
68 | local spec = self.spec_cctdrivable |
69 | |
70 | spec.cctRadius = self.xmlFile:getValue("vehicle.cctDrivable#cctRadius", 1.0) |
71 | spec.cctHeight = self.xmlFile:getValue("vehicle.cctDrivable#cctHeight", 1.0) |
72 | spec.cctSlopeLimit = self.xmlFile:getValue("vehicle.cctDrivable#cctSlopeLimit", 25) |
73 | spec.cctStepOffset = self.xmlFile:getValue("vehicle.cctDrivable#cctStepOffset", 0.3) |
74 | spec.customOffset = self.xmlFile:getValue("vehicle.cctDrivable#customOffset", 0) |
75 | spec.cctCenterOffset = spec.cctRadius + spec.cctHeight*0.5 |
76 | |
77 | spec.kinematicCollisionMask = 4 -- 2147483648 + 1048576 + 4 |
78 | spec.movementCollisionMask = 31 -- 2147483648 + 1048576 + 31 |
79 | if self.isServer then |
80 | -- CCT |
81 | local mass = self.components[1].defaultMass * 1000 |
82 | spec.cctNode = createTransformGroup("cctDrivable") |
83 | link(getRootNode(), spec.cctNode) |
84 | spec.controllerIndex = createCCT(spec.cctNode, spec.cctRadius, spec.cctHeight, spec.cctStepOffset, spec.cctSlopeLimit, 0.1, spec.kinematicCollisionMask, mass) |
85 | end |
86 | 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 |
20 | function CCTDrivable.prerequisitesPresent(specializations) |
21 | return SpecializationUtil.hasSpecialization(Enterable, specializations) |
22 | end |
registerEventListeners
DescriptionRegisters event listenersDefinition
registerEventListeners(string vehicleType)Arguments
string | vehicleType | type of vehicle |
59 | function CCTDrivable.registerEventListeners(vehicleType) |
60 | SpecializationUtil.registerEventListener(vehicleType, "onLoad", CCTDrivable) |
61 | SpecializationUtil.registerEventListener(vehicleType, "onDelete", CCTDrivable) |
62 | end |
registerFunctions
DescriptionRegisters functionsDefinition
registerFunctions(string vehicleType)Arguments
string | vehicleType | type of vehicle |
42 | function CCTDrivable.registerFunctions(vehicleType) |
43 | SpecializationUtil.registerFunction(vehicleType, "moveCCT", CCTDrivable.moveCCT) |
44 | SpecializationUtil.registerFunction(vehicleType, "getIsCCTOnGround", CCTDrivable.getIsCCTOnGround) |
45 | SpecializationUtil.registerFunction(vehicleType, "getCCTCollisionMask", CCTDrivable.getCCTCollisionMask) |
46 | SpecializationUtil.registerFunction(vehicleType, "getCCTWorldTranslation", CCTDrivable.getCCTWorldTranslation) |
47 | end |
registerOverwrittenFunctions
DescriptionDefinitionregisterOverwrittenFunctions()Code
51 | function CCTDrivable.registerOverwrittenFunctions(vehicleType) |
52 | SpecializationUtil.registerOverwrittenFunction(vehicleType, "setWorldPosition", CCTDrivable.setWorldPosition) |
53 | SpecializationUtil.registerOverwrittenFunction(vehicleType, "setWorldPositionQuaternion", CCTDrivable.setWorldPositionQuaternion) |
54 | end |
setWorldPosition
DescriptionSet world position and rotation of componentDefinition
setWorldPosition(float x, float y, float z, float xRot, float yRot, float zRot, integer i, boolean changeInterp)Arguments
float | x | x position |
float | y | y position |
float | z | z position |
float | xRot | x rotation |
float | yRot | y rotation |
float | zRot | z rotation |
integer | i | index if component |
boolean | changeInterp | change interpolation |
153 | function CCTDrivable:setWorldPosition(superFunc, x,y,z, xRot,yRot,zRot, i, changeInterp) |
154 | superFunc(self, x,y,z, xRot,yRot,zRot, i, changeInterp) |
155 | if self.isServer and i == 1 then |
156 | local spec = self.spec_cctdrivable |
157 | setTranslation(spec.cctNode, x, y + spec.cctCenterOffset, z) |
158 | end |
159 | end |
setWorldPositionQuaternion
DescriptionSet world position and quaternion rotation of componentDefinition
setWorldPositionQuaternion(float x, float y, float z, float qx, float qy, float qz, float qw, Integer i, boolean changeInterp)Arguments
float | x | x position |
float | y | y position |
float | z | z position |
float | qx | x rotation |
float | qy | y rotation |
float | qz | z rotation |
float | qw | w rotation |
Integer | i | index if component |
boolean | changeInterp | change interpolation |
172 | function CCTDrivable:setWorldPositionQuaternion(superFunc, x, y, z, qx, qy, qz, qw, i, changeInterp) |
173 | superFunc(self, x, y, z, qx, qy, qz, qw, i, changeInterp) |
174 | if self.isServer and i == 1 then |
175 | local spec = self.spec_cctdrivable |
176 | setTranslation(spec.cctNode, x, y + spec.cctCenterOffset, z) |
177 | end |
178 | end |