LUADOC - Farming Simulator 17

Printable Version

Script v1.4.4.0

Engine v7.0.0.2

Foundation Reference

SetPipeStateEvent

Description
Event for pipe state
Functions

emptyNew

Description
Create instance of Event class
Definition
emptyNew()
Return Values
tableselfinstance of class event
Code
15function SetPipeStateEvent:emptyNew()
16 local self = Event:new(SetPipeStateEvent_mt);
17 return self;
18end;

new

Description
Create new instance of event
Definition
new(table object, integer pipeState)
Arguments
tableobjectobject
integerpipeStatepipe state
Code
24function SetPipeStateEvent:new(object, pipeState)
25 local self = SetPipeStateEvent:emptyNew()
26 self.object = object;
27 self.pipeState = pipeState;
28 assert(self.pipeState >= 0 and self.pipeState < 8);
29 return self;
30end;

readStream

Description
Called on client side on join
Definition
readStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
36function SetPipeStateEvent:readStream(streamId, connection)
37 self.object = readNetworkNodeObject(streamId);
38 self.pipeState = streamReadUIntN(streamId, 3);
39 self:run(connection);
40end;

writeStream

Description
Called on server side on join
Definition
writeStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
46function SetPipeStateEvent:writeStream(streamId, connection)
47 writeNetworkNodeObject(streamId, self.object);
48 streamWriteUIntN(streamId, self.pipeState, 3);
49end;

run

Description
Run action on receiving side
Definition
run(integer connection)
Arguments
integerconnectionconnection
Code
54function SetPipeStateEvent:run(connection)
55 self.object:setPipeState(self.pipeState, true);
56 if not connection:getIsServer() then
57 g_server:broadcastEvent(SetPipeStateEvent:new(self.object, self.pipeState), nil, connection, self.object);
58 end;
59end;