LUADOC - Farming Simulator 22

Script v1_7_1_0

Engine v1_7_1_0

Foundation Reference

PlaceableSellingStation

Description
Specialization for placeables
Functions

collectPickObjects

Description
Definition
collectPickObjects()
Code
126function PlaceableSellingStation:collectPickObjects(superFunc, node)
127 local spec = self.spec_sellingStation
128
129 local foundNode = false
130 for _, unloadTrigger in ipairs(spec.sellingStation.unloadTriggers) do
131 if node == unloadTrigger.exactFillRootNode then
132 foundNode = true
133 break
134 end
135 end
136
137 if not foundNode then
138 superFunc(self, node)
139 end
140end

getSellingStation

Description
Definition
getSellingStation()
Code
120function PlaceableSellingStation:getSellingStation()
121 return self.spec_sellingStation.sellingStation
122end

initSpecialization

Description
Definition
initSpecialization()
Code
62function PlaceableSellingStation.initSpecialization()
63 g_storeManager:addSpecType("sellingStationFillTypes", "shopListAttributeIconInput", SellingStation.loadSpecValueFillTypes, SellingStation.getSpecValueFillTypes, "placeable")
64end

loadFromXMLFile

Description
Definition
loadFromXMLFile()
Code
144function PlaceableSellingStation:loadFromXMLFile(xmlFile, key)
145 local spec = self.spec_sellingStation
146 spec.sellingStation:loadFromXMLFile(xmlFile, key)
147end

onDelete

Description
Definition
onDelete()
Code
80function PlaceableSellingStation:onDelete()
81 local spec = self.spec_sellingStation
82 if spec.sellingStation ~= nil then
83 g_currentMission.storageSystem:removeUnloadingStation(spec.sellingStation, self)
84 g_currentMission.economyManager:removeSellingStation(spec.sellingStation)
85 spec.sellingStation:delete()
86 end
87end

onFinalizePlacement

Description
Definition
onFinalizePlacement()
Code
91function PlaceableSellingStation:onFinalizePlacement()
92 local spec = self.spec_sellingStation
93 spec.sellingStation:register(true)
94 g_currentMission.storageSystem:addUnloadingStation(spec.sellingStation, self)
95 g_currentMission.economyManager:addSellingStation(spec.sellingStation)
96end

onLoad

Description
Called on loading
Definition
onLoad(table savegame)
Arguments
tablesavegamesavegame
Code
69function PlaceableSellingStation:onLoad(savegame)
70 local spec = self.spec_sellingStation
71 local xmlFile = self.xmlFile
72
73 spec.sellingStation = SellingStation.new(self.isServer, self.isClient)
74 spec.sellingStation:load(self.components, xmlFile, "placeable.sellingStation", self.customEnvironment, self.i3dMappings, self.components[1].node)
75 spec.sellingStation.owningPlaceable = self
76end

onReadStream

Description
Definition
onReadStream()
Code
100function PlaceableSellingStation:onReadStream(streamId, connection)
101 local spec = self.spec_sellingStation
102
103 local sellingStationId = NetworkUtil.readNodeObjectId(streamId)
104 spec.sellingStation:readStream(streamId, connection)
105 g_client:finishRegisterObject(spec.sellingStation, sellingStationId)
106end

onWriteStream

Description
Definition
onWriteStream()
Code
110function PlaceableSellingStation:onWriteStream(streamId, connection)
111 local spec = self.spec_sellingStation
112
113 NetworkUtil.writeNodeObjectId(streamId, NetworkUtil.getObjectId(spec.sellingStation))
114 spec.sellingStation:writeStream(streamId, connection)
115 g_server:registerObjectInStream(connection, spec.sellingStation)
116end

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 PlaceableSellingStation.prerequisitesPresent(specializations)
19 return true
20end

registerEventListeners

Description
Definition
registerEventListeners()
Code
36function PlaceableSellingStation.registerEventListeners(placeableType)
37 SpecializationUtil.registerEventListener(placeableType, "onLoad", PlaceableSellingStation)
38 SpecializationUtil.registerEventListener(placeableType, "onDelete", PlaceableSellingStation)
39 SpecializationUtil.registerEventListener(placeableType, "onFinalizePlacement", PlaceableSellingStation)
40 SpecializationUtil.registerEventListener(placeableType, "onReadStream", PlaceableSellingStation)
41 SpecializationUtil.registerEventListener(placeableType, "onWriteStream", PlaceableSellingStation)
42end

registerFunctions

Description
Definition
registerFunctions()
Code
24function PlaceableSellingStation.registerFunctions(placeableType)
25 SpecializationUtil.registerFunction(placeableType, "getSellingStation", PlaceableSellingStation.getSellingStation)
26end

registerOverwrittenFunctions

Description
Definition
registerOverwrittenFunctions()
Code
30function PlaceableSellingStation.registerOverwrittenFunctions(placeableType)
31 SpecializationUtil.registerOverwrittenFunction(placeableType, "collectPickObjects", PlaceableSellingStation.collectPickObjects)
32end

registerSavegameXMLPaths

Description
Definition
registerSavegameXMLPaths()
Code
54function PlaceableSellingStation.registerSavegameXMLPaths(schema, basePath)
55 schema:setXMLSpecializationType("SellingStation")
56 SellingStation.registerSavegameXMLPaths(schema, basePath)
57 schema:setXMLSpecializationType()
58end

registerXMLPaths

Description
Definition
registerXMLPaths()
Code
46function PlaceableSellingStation.registerXMLPaths(schema, basePath)
47 schema:setXMLSpecializationType("SellingStation")
48 SellingStation.registerXMLPaths(schema, basePath .. ".sellingStation")
49 schema:setXMLSpecializationType()
50end

saveToXMLFile

Description
Definition
saveToXMLFile()
Code
151function PlaceableSellingStation:saveToXMLFile(xmlFile, key, usedModNames)
152 local spec = self.spec_sellingStation
153 spec.sellingStation:saveToXMLFile(xmlFile, key, usedModNames)
154end