LUADOC - Farming Simulator 19

Script v1.7.1.0

Engine v1.7.1.0

Foundation Reference

TensionBeltObject

Description
Specialization for vehicles which can be mounted by tension belts
Functions

getMeshNodes

Description
Definition
getMeshNodes()
Code
66function TensionBeltObject:getMeshNodes()
67 return self.spec_tensionBeltObject.meshNodes
68end

getSupportsTensionBelts

Description
Definition
getSupportsTensionBelts()
Code
60function TensionBeltObject:getSupportsTensionBelts()
61 return self.spec_tensionBeltObject.supportsTensionBelts
62end

getTensionBeltNodeId

Description
Definition
getTensionBeltNodeId()
Code
72function TensionBeltObject:getTensionBeltNodeId()
73 return self.components[1].node
74end

onLoad

Description
Called on loading
Definition
onLoad(table savegame)
Arguments
tablesavegamesavegame
Code
36function TensionBeltObject:onLoad(savegame)
37 local spec = self.spec_tensionBeltObject
38
39 spec.supportsTensionBelts = Utils.getNoNil(getXMLBool(self.xmlFile, "vehicle.tensionBeltObject#supportsTensionBelts"), true)
40
41 spec.meshNodes = {}
42 local i = 0
43 while true do
44 local baseKey = string.format("vehicle.tensionBeltObject.meshNodes.meshNode(%d)", i)
45 if not hasXMLProperty(self.xmlFile, baseKey) then
46 break
47 end
48
49 local node = I3DUtil.indexToObject(self.components, getXMLString(self.xmlFile, baseKey.."#node"), self.i3dMappings)
50 if node ~= nil then
51 table.insert(spec.meshNodes, node)
52 end
53
54 i = i + 1
55 end
56end

prerequisitesPresent

Description
Definition
prerequisitesPresent()
Code
15function TensionBeltObject.prerequisitesPresent(specializations)
16 return true
17end

registerEventListeners

Description
Definition
registerEventListeners()
Code
29function TensionBeltObject.registerEventListeners(vehicleType)
30 SpecializationUtil.registerEventListener(vehicleType, "onLoad", TensionBeltObject)
31end

registerFunctions

Description
Definition
registerFunctions()
Code
21function TensionBeltObject.registerFunctions(vehicleType)
22 SpecializationUtil.registerFunction(vehicleType, "getSupportsTensionBelts", TensionBeltObject.getSupportsTensionBelts)
23 SpecializationUtil.registerFunction(vehicleType, "getMeshNodes", TensionBeltObject.getMeshNodes)
24 SpecializationUtil.registerFunction(vehicleType, "getTensionBeltNodeId", TensionBeltObject.getTensionBeltNodeId)
25end