LUADOC - Farming Simulator 22

Script v1_7_1_0

Engine v1_7_1_0

Foundation Reference

PlaceableWorkshop

Description
Specialization for placeables
Functions

onDelete

Description
Definition
onDelete()
Code
57function PlaceableWorkshop:onDelete()
58 local spec = self.spec_workshop
59
60 if spec.sellingPoint ~= nil then
61 spec.sellingPoint:delete()
62 end
63end

onLoad

Description
Called on loading
Definition
onLoad(table savegame)
Arguments
tablesavegamesavegame
Code
46function PlaceableWorkshop:onLoad(savegame)
47 local spec = self.spec_workshop
48
49 spec.sellingPoint = VehicleSellingPoint.new()
50 spec.sellingPoint:load(self.components, self.xmlFile, "placeable.workshop.sellingPoint", self.i3dMappings)
51 spec.sellingPoint:setOwnerFarmId(self:getOwnerFarmId())
52 spec.sellingPoint.owningPlaceable = self
53end

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

registerEventListeners

Description
Definition
registerEventListeners()
Code
30function PlaceableWorkshop.registerEventListeners(placeableType)
31 SpecializationUtil.registerEventListener(placeableType, "onLoad", PlaceableWorkshop)
32 SpecializationUtil.registerEventListener(placeableType, "onDelete", PlaceableWorkshop)
33end

registerOverwrittenFunctions

Description
Definition
registerOverwrittenFunctions()
Code
24function PlaceableWorkshop.registerOverwrittenFunctions(placeableType)
25 SpecializationUtil.registerOverwrittenFunction(placeableType, "setOwnerFarmId", PlaceableWorkshop.setOwnerFarmId)
26end

registerXMLPaths

Description
Definition
registerXMLPaths()
Code
37function PlaceableWorkshop.registerXMLPaths(schema, basePath)
38 schema:setXMLSpecializationType("Workshop")
39 VehicleSellingPoint.registerXMLPaths(schema, basePath .. ".workshop.sellingPoint")
40 schema:setXMLSpecializationType()
41end

setOwnerFarmId

Description
Definition
setOwnerFarmId()
Code
67function PlaceableWorkshop:setOwnerFarmId(superFunc, ownerFarmId, noEventSend)
68 local spec = self.spec_workshop
69
70 superFunc(self, ownerFarmId, noEventSend)
71
72 if spec.sellingPoint ~= nil then
73 spec.sellingPoint:setOwnerFarmId(ownerFarmId)
74 end
75end