LUADOC - Farming Simulator 19

FarmhousePlaceable

Description
Player house with spawnpoint
Parent
Placeable
Functions

delete

Description
Deleting placeable farmhouse
Definition
delete()
Code
32function FarmhousePlaceable:delete()
33 unregisterObjectClassName(self)
34
35 if self.sleepingTrigger ~= nil then
36 removeTrigger(self.sleepingTrigger)
37 end
38
39 g_currentMission:removeActivatableObject(self)
40 self.objectActivated = false
41
42 FarmhousePlaceable:superClass().delete(self)
43end

getIsActivatable

Description
Get is activateable
Definition
getIsActivatable()
Return Values
booleanisActivateableis activateable
Code
134function FarmhousePlaceable:getIsActivatable()
135 return g_currentMission:getFarmId() == self:getOwnerFarmId()
136end

load

Description
Load farmhouse
Definition
load(string xmlFilename, float x, float y, float z, float rx, float ry, float rz, boolean initRandom)
Arguments
stringxmlFilenamexml file name
floatxx world position
floatyz world position
floatzz world position
floatrxrx world rotation
floatryry world rotation
floatrzrz world rotation
booleaninitRandominitialize random
Return Values
booleansuccesssuccess
Code
56function FarmhousePlaceable:load(xmlFilename, x,y,z, rx,ry,rz, initRandom)
57 if not FarmhousePlaceable:superClass().load(self, xmlFilename, x,y,z, rx,ry,rz, initRandom) then
58 return false
59 end
60
61 local xmlFile = loadXMLFile("TempXML", xmlFilename)
62
63 self.spawnNode = I3DUtil.indexToObject(self.nodeId, getXMLString(xmlFile, "placeable.farmhouse#spawnNode"))
64
65 self.sleepingTrigger = I3DUtil.indexToObject(self.nodeId, getXMLString(xmlFile, "placeable.farmhouse.sleeping#triggerNode"))
66 if self.sleepingTrigger ~= nil then
67 addTrigger(self.sleepingTrigger, "sleepingTriggerCallback", self)
68 end
69 self.sleepingCamera = I3DUtil.indexToObject(self.nodeId, getXMLString(xmlFile, "placeable.farmhouse.sleeping#cameraNode"))
70
71 self.activateText = g_i18n:getText("ui_inGameSleep")
72
73 self.isEnabled = true
74 self.objectActivated = false
75
76
77 delete(xmlFile)
78
79 return true
80end

new

Description
Creating placeable farmhouse
Definition
new(boolean isServer, boolean isClient, table customMt)
Arguments
booleanisServeris server
booleanisClientis client
tablecustomMtcustom metatable
Return Values
tableinstanceInstance of object
Code
22function FarmhousePlaceable:new(isServer, isClient, customMt)
23 local self = Placeable:new(isServer, isClient, customMt or FarmhousePlaceable_mt)
24
25 registerObjectClassName(self, "FarmhousePlaceable")
26
27 return self
28end

onActivateObject

Description
On activate object
Definition
onActivateObject()
Code
144function FarmhousePlaceable:onActivateObject()
145 g_sleepManager:showDialog()
146end