LUADOC - Farming Simulator 17

Printable Version

Script v1.4.4.0

Engine v7.0.0.2

Foundation Reference

PloughRotationEvent

Description
Event for plough rotation
Functions

emptyNew

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

new

Description
Create new instance of event
Definition
new(table object, boolean rotationMax)
Arguments
tableobjectobject
booleanrotationMaxrotation max
Code
24function PloughRotationEvent:new(object, rotationMax)
25 local self = PloughRotationEvent:emptyNew()
26 self.object = object;
27 self.rotationMax = rotationMax;
28 return self;
29end;

readStream

Description
Called on client side on join
Definition
readStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
35function PloughRotationEvent:readStream(streamId, connection)
36 self.object = readNetworkNodeObject(streamId);
37 self.rotationMax = streamReadBool(streamId);
38 self:run(connection);
39end;

writeStream

Description
Called on server side on join
Definition
writeStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
45function PloughRotationEvent:writeStream(streamId, connection)
46 writeNetworkNodeObject(streamId, self.object);
47 streamWriteBool(streamId, self.rotationMax);
48end;

run

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