LUADOC - Farming Simulator 19

GroundTypeManager

Description
This class handles the mapping of ground types (like dirt, grass, gravel) to the layers in the map's terrain.
Parent
AbstractManager
Functions

initDataStructures

Description
Initialize data structures
Definition
initDataStructures()
Code
23function GroundTypeManager:initDataStructures()
24 self.groundTypes = {} -- {type name = {fallbacks = {i = fallback layer name}}}
25 self.groundTypeMappings = {} -- {type name = layer name}
26 self.terrainLayerMapping = {} -- {layer name = layer ID}
27end

initTerrain

Description
Initialize the ground type manager with the data from the terrain
Definition
initTerrain(entity terrainRootNode)
Arguments
entityterrainRootNodethe root node of the terrain
Code
96function GroundTypeManager:initTerrain(terrainRootNode)
97 self.terrainLayerMapping = {}
98 local numLayers = getTerrainNumOfLayers(terrainRootNode)
99 for i = 0, numLayers - 1 do
100 local layerName = getTerrainLayerName(terrainRootNode, i)
101 self.terrainLayerMapping[layerName] = i
102 end
103end

loadMapData

Description
Load data on map load
Definition
loadMapData()
Return Values
booleantrueif loading was successful else false
Code
58function GroundTypeManager:loadMapData(xmlFile, missionInfo, baseDirectory)
59 GroundTypeManager:superClass().loadMapData(self)
60 self:loadGroundTypes()
61 return XMLUtil.loadDataFromMapXML(xmlFile, "groundTypeMappings", baseDirectory, self, self.loadGroundTypeMappings, missionInfo)
62end

new

Description
Creating manager
Definition
new()
Return Values
tableinstanceinstance of object
Code
16function GroundTypeManager:new(customMt)
17 local self = AbstractManager:new(customMt or GroundTypeManager_mt)
18 return self
19end