LUADOC - Farming Simulator 22

Script v1_7_1_0

Engine v1_7_1_0

Foundation Reference

PlaceableWeatherStation

Description
Specialization for placeables
Functions

onDelete

Description
Definition
onDelete()
Code
54function PlaceableWeatherStation:onDelete()
55 g_currentMission.placeableSystem:removeWeatherStation(self)
56
57 if self.isClient then
58 local spec = self.spec_weatherStation
59 if spec.sample ~= nil then
60 g_soundManager:deleteSample(spec.sample)
61 end
62 end
63end

onFinalizePlacement

Description
Definition
onFinalizePlacement()
Code
67function PlaceableWeatherStation:onFinalizePlacement()
68 g_currentMission.placeableSystem:addWeatherStation(self)
69
70 if self.isClient then
71 local spec = self.spec_weatherStation
72 if spec.sample ~= nil then
73 g_soundManager:playSample(spec.sample)
74 end
75 end
76end

onLoad

Description
Called on loading
Definition
onLoad(table savegame)
Arguments
tablesavegamesavegame
Code
43function PlaceableWeatherStation:onLoad(savegame)
44 local spec = self.spec_weatherStation
45
46 if self.isClient then
47 spec.sample = g_soundManager:loadSampleFromXML(self.xmlFile, "placeable.weatherStation.sounds", "idle", self.baseDirectory, self.components, 0, AudioGroup.ENVIRONMENT, self.i3dMappings, nil)
48 end
49end

prerequisitesPresent

Description
Checks if all prerequisite specializations are loaded
Definition
prerequisitesPresent(table specializations)
Arguments
tablespecializationsspecializations
Return Values
booleanhasPrerequisitetrue if all prerequisite specializations are loaded
Code
18function PlaceableWeatherStation.prerequisitesPresent(specializations)
19 return true
20end

registerEventListeners

Description
Definition
registerEventListeners()
Code
24function PlaceableWeatherStation.registerEventListeners(placeableType)
25 SpecializationUtil.registerEventListener(placeableType, "onLoad", PlaceableWeatherStation)
26 SpecializationUtil.registerEventListener(placeableType, "onDelete", PlaceableWeatherStation)
27 SpecializationUtil.registerEventListener(placeableType, "onFinalizePlacement", PlaceableWeatherStation)
28end

registerXMLPaths

Description
Definition
registerXMLPaths()
Code
32function PlaceableWeatherStation.registerXMLPaths(schema, basePath)
33 schema:setXMLSpecializationType("WeatherStation")
34
35 SoundManager.registerSampleXMLPaths(schema, basePath .. ".weatherStation.sounds", "idle")
36
37 schema:setXMLSpecializationType()
38end