LUADOC - Farming Simulator 19

AnimatedObjectEvent

Description
Sets animatedObject directions Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved.
Parent
Event
Functions

emptyNew

Description
Definition
emptyNew()
Code
12function AnimatedObjectEvent:emptyNew()
13 local self = Event:new(AnimatedObjectEvent_mt)
14 return self
15end

new

Description
Definition
new()
Code
19function AnimatedObjectEvent:new(animatedObject, direction)
20 local self = AnimatedObjectEvent:emptyNew()
21
22 self.animatedObject = animatedObject
23 self.direction = direction
24
25 return self
26end

readStream

Description
Definition
readStream()
Code
30function AnimatedObjectEvent:readStream(streamId, connection)
31 assert(g_currentMission:getIsServer())
32 self.animatedObject = NetworkUtil.readNodeObject(streamId)
33 self.direction = streamReadUIntN(streamId, 2) - 1
34 self:run(connection)
35end

run

Description
Definition
run()
Code
47function AnimatedObjectEvent:run(connection)
48 self.animatedObject.animation.direction = self.direction
49 self.animatedObject:raiseActive()
50end

writeStream

Description
Definition
writeStream()
Code
39function AnimatedObjectEvent:writeStream(streamId, connection)
40 assert(connection:getIsServer())
41 NetworkUtil.writeNodeObject(streamId, self.animatedObject)
42 streamWriteUIntN(streamId, self.direction + 1, 2)
43end