LUADOC - Farming Simulator 19

BeehivePlaceable

Description
Class for placeable beehives
Parent
Placeable
Functions

delete

Description
Deleting placeable beehive
Definition
delete()
Code
31function BeehivePlaceable:delete()
32 unregisterObjectClassName(self)
33 g_currentMission.environment:removeHourChangeListener(self)
34 if self.particleSystem ~= nil then
35 ParticleUtil.deleteParticleSystem(self.particleSystem)
36 end
37 BeehivePlaceable:superClass().delete(self)
38end

hourChanged

Description
Called if hour changed
Definition
hourChanged()
Code
68function BeehivePlaceable:hourChanged()
69 if self.isServer then
70 g_currentMission:addMoney(self.incomePerHour, self:getOwnerFarmId(), MoneyType.PROPERTY_INCOME, true)
71 end
72end

load

Description
Load beehive
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
51function BeehivePlaceable:load(xmlFilename, x,y,z, rx,ry,rz, initRandom)
52 if not BeehivePlaceable:superClass().load(self, xmlFilename, x,y,z, rx,ry,rz, initRandom) then
53 return false
54 end
55
56 local xmlFile = loadXMLFile("TempXML", xmlFilename)
57
58 self.particleSystem = {}
59 ParticleUtil.loadParticleSystem(xmlFile, self.particleSystem, "placeable.particleSystem", self.nodeId, true, nil, self.baseDirectory)
60
61 delete(xmlFile)
62
63 return true
64end

new

Description
Creating placeable beehive
Definition
new(boolean isServer, boolean isClient, table customMt)
Arguments
booleanisServeris server
booleanisClientis client
tablecustomMtcustom metatable
Return Values
tableinstanceInstance of object
Code
16function BeehivePlaceable:new(isServer, isClient, customMt)
17 local mt = customMt
18 if mt == nil then
19 mt = BeehivePlaceable_mt
20 end
21
22 local self = Placeable:new(isServer, isClient, mt)
23
24 registerObjectClassName(self, "BeehivePlaceable")
25
26 return self
27end