Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- AnimalHusbandry
- BeehivePlaceable
- BgaPlaceable
- BunkerSiloPlaceable
- BuyingStationPlaceable
- Doghouse
- FarmhousePlaceable
- GreenhousePlaceable
- HeatingPlantPlaceable
- HusbandryModuleWater
- Placeable
- SellingStationPlaceable
- SiloExtensionPlaceable
- SiloPlaceable
- SolarCollectorPlaceable
- WindTurbinePlaceable
- WoodSellStationPlaceable
- Player
- Shop
- Sounds
- Specializations
- Triggers
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
Foundation Reference
HeatingPlantPlaceable
DescriptionClass for placeable heating plantsParent
PlaceableFunctions
- collectPickObjects
- delete
- load
- new
- onUpdateEvent
- readStream
- readUpdateStream
- update
- updateTick
- writeStream
- writeUpdateStream
collectPickObjects
DescriptionCollect pick objectsDefinition
collectPickObjects(integer node)Arguments
integer | node | node id |
162 | function HeatingPlantPlaceable:collectPickObjects(node) |
163 | if self.tipTrigger == nil or self.tipTrigger.shovelTarget == nil or self.tipTrigger.shovelTarget.nodeId ~= node then |
164 | HeatingPlantPlaceable:superClass().collectPickObjects(self, node) |
165 | end |
166 | end |
delete
DescriptionDeleting heating plantDefinition
delete()Code
33 | function HeatingPlantPlaceable:delete() |
34 | if self.tipTrigger ~= nil then |
35 | self.tipTrigger:removeUpdateEventListener(self) |
36 | self.tipTrigger:delete() |
37 | end |
38 | |
39 | if self.exhaustEffect ~= nil then |
40 | g_i3DManager:releaseSharedI3DFile(self.exhaustEffect.filename, self.baseDirectory, true); |
41 | end |
42 | |
43 | g_animationManager:deleteAnimations(self.animationNodes) |
44 | |
45 | unregisterObjectClassName(self); |
46 | HeatingPlantPlaceable:superClass().delete(self); |
47 | end |
load
DescriptionLoad heating plantDefinition
load(string xmlFilename, float x, float y, float z, float rx, float ry, float rz, boolean initRandom)Arguments
string | xmlFilename | xml file name |
float | x | x world position |
float | y | z world position |
float | z | z world position |
float | rx | rx world rotation |
float | ry | ry world rotation |
float | rz | rz world rotation |
boolean | initRandom | initialize random |
boolean | success | success |
60 | function HeatingPlantPlaceable:load(xmlFilename, x,y,z, rx,ry,rz, initRandom) |
61 | if not HeatingPlantPlaceable:superClass().load(self, xmlFilename, x,y,z, rx,ry,rz, initRandom) then |
62 | return false; |
63 | end; |
64 | |
65 | local xmlFile = loadXMLFile("TempXML", xmlFilename); |
66 | |
67 | self.tipTrigger = TipTrigger:new(self.isServer, self.isClient) |
68 | if self.tipTrigger:load(I3DUtil.indexToObject(self.nodeId, getXMLString(xmlFile, "placeable.heatingPlant#tipTrigger"))) then |
69 | self.tipTrigger:register(true) |
70 | self.tipTrigger:addUpdateEventListener(self) |
71 | else |
72 | self.tipTrigger:delete() |
73 | self.tipTrigger = nil |
74 | end |
75 | |
76 | if self.isClient then |
77 | self.animationNodes = g_animationManager:loadAnimations(xmlFile, "placeable.animationNodes", self.nodeId, self, nil) |
78 | |
79 | local filename = getXMLString(xmlFile, "placeable.exhaust#filename"); |
80 | local node = I3DUtil.indexToObject(self.nodeId, getXMLString(xmlFile, "placeable.exhaust#index")); |
81 | if filename ~= nil then |
82 | local i3dNode = g_i3DManager:loadSharedI3DFile(filename, self.baseDirectory, false, false, false); |
83 | if i3dNode ~= 0 then |
84 | self.exhaustEffect = {} |
85 | self.exhaustEffect.node = getChildAt(i3dNode, 0); |
86 | self.exhaustEffect.filename = filename |
87 | link(Utils.getNoNil(node, self.nodeId), self.exhaustEffect.node); |
88 | setVisibility(self.exhaustEffect.node, false); |
89 | setShaderParameter(self.exhaustEffect.node, "param", 0, 0, 0, 0.4, false); |
90 | delete(i3dNode); |
91 | end |
92 | end |
93 | end |
94 | |
95 | self.workingTimeDuration = 120*1000 |
96 | self.workingTime = 0 |
97 | |
98 | delete(xmlFile); |
99 | |
100 | return true; |
101 | end |
new
DescriptionCreating placeable high pressure washerDefinition
new(boolean isServer, boolean isClient, table customMt)Arguments
boolean | isServer | is server |
boolean | isClient | is client |
table | customMt | custom metatable |
table | instance | Instance of object |
16 | function HeatingPlantPlaceable:new(isServer, isClient, customMt) |
17 | local mt = customMt; |
18 | if mt == nil then |
19 | mt = HeatingPlantPlaceable_mt; |
20 | end; |
21 | |
22 | local self = Placeable:new(isServer, isClient, mt); |
23 | |
24 | registerObjectClassName(self, "HeatingPlantPlaceable"); |
25 | |
26 | self.heatingPlantDirtyFlag = self:getNextDirtyFlag(); |
27 | |
28 | return self; |
29 | end |
onUpdateEvent
DescriptionCalled if someone filled in somethingDefinition
onUpdateEvent(table trigger, float fillDelta, integer fillType, table trailer, table tipTriggerTarget)Arguments
table | trigger | trigger |
float | fillDelta | delta filled in |
integer | fillType | fill type filled in |
table | trailer | object of trailer |
table | tipTriggerTarget | tip trigger target |
201 | function HeatingPlantPlaceable:onUpdateEvent(trigger, fillDelta, fillType, trailer, tipTriggerTarget) |
202 | if self.exhaustEffect ~= nil then |
203 | setVisibility(self.exhaustEffect.node, true); |
204 | end |
205 | if self.isServer then |
206 | self:raiseDirtyFlags(self.heatingPlantDirtyFlag); |
207 | end |
208 | self.workingTime = self.workingTimeDuration |
209 | |
210 | g_animationManager:startAnimations(self.animationNodes) |
211 | end |
readStream
DescriptionCalled on client side on joinDefinition
readStream(integer streamId, table connection)Arguments
integer | streamId | stream ID |
table | connection | connection |
107 | function HeatingPlantPlaceable:readStream(streamId, connection) |
108 | HeatingPlantPlaceable:superClass().readStream(self, streamId, connection); |
109 | if connection:getIsServer() then |
110 | local tipTriggerId = NetworkUtil.readNodeObjectId(streamId); |
111 | self.tipTrigger:readStream(streamId, connection); |
112 | g_client:finishRegisterObject(self.tipTrigger, tipTriggerId); |
113 | end |
114 | end |
readUpdateStream
DescriptionCalled on client side on updateDefinition
readUpdateStream(integer streamId, integer timestamp, table connection)Arguments
integer | streamId | stream ID |
integer | timestamp | timestamp |
table | connection | connection |
134 | function HeatingPlantPlaceable:readUpdateStream(streamId, timestamp, connection) |
135 | HeatingPlantPlaceable:superClass().readUpdateStream(self, streamId, timestamp, connection); |
136 | if connection:getIsServer() then |
137 | local workingTimeBiggerZero = streamReadBool(streamId) |
138 | if workingTimeBiggerZero then |
139 | self.workingTime = self.workingTimeDuration |
140 | if self.exhaustEffect ~= nil then |
141 | setVisibility(self.exhaustEffect.node, true); |
142 | end |
143 | end |
144 | end; |
145 | end |
update
DescriptionUpdateDefinition
update(float dt)Arguments
float | dt | time since last call in ms |
171 | function HeatingPlantPlaceable:update(dt) |
172 | HeatingPlantPlaceable:superClass().update(self, dt); |
173 | |
174 | if self.isClient then |
175 | if self.workingTime > 0 then |
176 | self.workingTime = self.workingTime - dt |
177 | if self.workingTime <= 0 then |
178 | if self.exhaustEffect ~= nil then |
179 | setVisibility(self.exhaustEffect.node, false); |
180 | end |
181 | g_animationManager:stopAnimations(self.animationNodes) |
182 | end |
183 | end |
184 | end |
185 | end |
updateTick
DescriptionUpdate tickDefinition
updateTick(float dt)Arguments
float | dt | time since last call in ms |
190 | function HeatingPlantPlaceable:updateTick(dt) |
191 | HeatingPlantPlaceable:superClass().updateTick(self, dt); |
192 | end |
writeStream
DescriptionCalled on server side on joinDefinition
writeStream(integer streamId, table connection)Arguments
integer | streamId | stream ID |
table | connection | connection |
120 | function HeatingPlantPlaceable:writeStream(streamId, connection) |
121 | HeatingPlantPlaceable:superClass().writeStream(self, streamId, connection); |
122 | if not connection:getIsServer() then |
123 | NetworkUtil.writeNodeObjectId(streamId, NetworkUtil.getObjectId(self.tipTrigger)); |
124 | self.tipTrigger:writeStream(streamId, connection); |
125 | g_server:registerObjectInStream(connection, self.tipTrigger); |
126 | end |
127 | end |
writeUpdateStream
DescriptionCalled on server side on updateDefinition
writeUpdateStream(integer streamId, table connection, integer dirtyMask)Arguments
integer | streamId | stream ID |
table | connection | connection |
integer | dirtyMask | dirty mask |
152 | function HeatingPlantPlaceable:writeUpdateStream(streamId, connection, dirtyMask) |
153 | HeatingPlantPlaceable:superClass().writeUpdateStream(self, streamId, connection, dirtyMask); |
154 | if not connection:getIsServer() then |
155 | streamWriteBool(streamId, self.workingTime > 0) |
156 | end; |
157 | end |