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
PlaceableFarmhouse
DescriptionSpecialization for placeablesFunctions
- farmhouseSleepingTriggerCallback
- getSleepCamera
- getSpawnPoint
- getSpawnWorldPosition
- onDelete
- onFinalizePlacement
- onLoad
- prerequisitesPresent
- registerEventListeners
- registerFunctions
- registerXMLPaths
farmhouseSleepingTriggerCallback
DescriptionDefinitionfarmhouseSleepingTriggerCallback()Code
123 | function PlaceableFarmhouse:farmhouseSleepingTriggerCallback(triggerId, otherActorId, onEnter, onLeave, onStay, otherShapeId) |
124 | if onEnter or onLeave then |
125 | if g_currentMission.player ~= nil and otherActorId == g_currentMission.player.rootNode then |
126 | if onEnter then |
127 | g_currentMission.player:onEnterFarmhouse() |
128 | end |
129 | |
130 | local spec = self.spec_farmhouse |
131 | if onEnter then |
132 | g_currentMission.activatableObjectsSystem:addActivatable(spec.activatable) |
133 | else |
134 | g_currentMission.activatableObjectsSystem:removeActivatable(spec.activatable) |
135 | end |
136 | end |
137 | end |
138 | end |
getSleepCamera
DescriptionDefinitiongetSleepCamera()Code
117 | function PlaceableFarmhouse:getSleepCamera() |
118 | return self.spec_farmhouse.sleepingCamera |
119 | end |
getSpawnPoint
DescriptionDefinitiongetSpawnPoint()Code
105 | function PlaceableFarmhouse:getSpawnPoint() |
106 | return self.spec_farmhouse.spawnNode |
107 | end |
getSpawnWorldPosition
DescriptionDefinitiongetSpawnWorldPosition()Code
111 | function PlaceableFarmhouse:getSpawnWorldPosition() |
112 | return getWorldTranslation(self.spec_farmhouse.spawnNode) |
113 | end |
onDelete
DescriptionDefinitiononDelete()Code
91 | function PlaceableFarmhouse:onDelete() |
92 | local spec = self.spec_farmhouse |
93 | |
94 | g_currentMission.activatableObjectsSystem:removeActivatable(spec.activatable) |
95 | |
96 | g_currentMission.placeableSystem:removeFarmhouse(self) |
97 | |
98 | if spec.sleepingTrigger ~= nil then |
99 | removeTrigger(spec.sleepingTrigger) |
100 | end |
101 | end |
onFinalizePlacement
DescriptionDefinitiononFinalizePlacement()Code
85 | function PlaceableFarmhouse:onFinalizePlacement() |
86 | g_currentMission.placeableSystem:addFarmhouse(self) |
87 | end |
onLoad
DescriptionCalled on loadingDefinition
onLoad(table savegame)Arguments
table | savegame | savegame |
52 | function PlaceableFarmhouse:onLoad(savegame) |
53 | local spec = self.spec_farmhouse |
54 | |
55 | spec.activatable = PlaceableFarmhouseActivatable.new(self) |
56 | |
57 | spec.spawnNode = self.xmlFile:getValue("placeable.farmhouse#spawnNode", nil, self.components, self.i3dMappings) |
58 | if spec.spawnNode == nil then |
59 | Logging.xmlError(self.xmlFile, "No spawn node defined for farmhouse") |
60 | spec.spawnNode = self.rootNode |
61 | end |
62 | |
63 | local sleepingTriggerKey = "placeable.farmhouse.sleeping#triggerNode" |
64 | spec.sleepingTrigger = self.xmlFile:getValue(sleepingTriggerKey, nil, self.components, self.i3dMappings) |
65 | if spec.sleepingTrigger ~= nil then |
66 | if not CollisionFlag.getHasFlagSet(spec.sleepingTrigger, CollisionFlag.TRIGGER_PLAYER) then |
67 | Logging.warning("%s sleep trigger '%s' does not have 'TRIGGER_PLAYER' bit (%s) set", self.configFileName, sleepingTriggerKey, CollisionFlag.getBit(CollisionFlag.TRIGGER_PLAYER)) |
68 | end |
69 | addTrigger(spec.sleepingTrigger, "farmhouseSleepingTriggerCallback", self) |
70 | end |
71 | |
72 | local cameraKey = "placeable.farmhouse.sleeping#cameraNode" |
73 | local camera = self.xmlFile:getValue(cameraKey, nil, self.components, self.i3dMappings) |
74 | if camera then |
75 | if getHasClassId(camera, ClassIds.CAMERA) then |
76 | spec.sleepingCamera = camera |
77 | else |
78 | Logging.xmlError(self.xmlFile, "Sleeping camera node '%s' (%s) is not a camera!", getName(camera), cameraKey) |
79 | end |
80 | end |
81 | 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 |
18 | function PlaceableFarmhouse.prerequisitesPresent(specializations) |
19 | return true |
20 | end |
registerEventListeners
DescriptionDefinitionregisterEventListeners()Code
33 | function PlaceableFarmhouse.registerEventListeners(placeableType) |
34 | SpecializationUtil.registerEventListener(placeableType, "onLoad", PlaceableFarmhouse) |
35 | SpecializationUtil.registerEventListener(placeableType, "onDelete", PlaceableFarmhouse) |
36 | SpecializationUtil.registerEventListener(placeableType, "onFinalizePlacement", PlaceableFarmhouse) |
37 | end |
registerFunctions
DescriptionDefinitionregisterFunctions()Code
24 | function PlaceableFarmhouse.registerFunctions(placeableType) |
25 | SpecializationUtil.registerFunction(placeableType, "farmhouseSleepingTriggerCallback", PlaceableFarmhouse.farmhouseSleepingTriggerCallback) |
26 | SpecializationUtil.registerFunction(placeableType, "getSleepCamera", PlaceableFarmhouse.getSleepCamera) |
27 | SpecializationUtil.registerFunction(placeableType, "getSpawnWorldPosition", PlaceableFarmhouse.getSpawnWorldPosition) |
28 | SpecializationUtil.registerFunction(placeableType, "getSpawnPoint", PlaceableFarmhouse.getSpawnPoint) |
29 | end |
registerXMLPaths
DescriptionDefinitionregisterXMLPaths()Code
41 | function PlaceableFarmhouse.registerXMLPaths(schema, basePath) |
42 | schema:setXMLSpecializationType("Farmhouse") |
43 | schema:register(XMLValueType.NODE_INDEX, basePath .. ".farmhouse#spawnNode", "Player spawn node") |
44 | schema:register(XMLValueType.NODE_INDEX, basePath .. ".farmhouse.sleeping#triggerNode", "Sleeping trigger") |
45 | schema:register(XMLValueType.NODE_INDEX, basePath .. ".farmhouse.sleeping#cameraNode", "Camera while sleeping") |
46 | schema:setXMLSpecializationType() |
47 | end |