LUADOC - Farming Simulator 19

Script v1.7.1.0

Engine v1.7.1.0

Foundation Reference

VehicleSetBeaconLightEvent

Description
Event for beacon light state
Parent
Event
Functions

emptyNew

Description
Create instance of Event class
Definition
emptyNew()
Return Values
tableselfinstance of class event
Code
13function VehicleSetBeaconLightEvent:emptyNew()
14 local self = Event:new(VehicleSetBeaconLightEvent_mt);
15 return self;
16end

new

Description
Create new instance of event
Definition
new(table object, boolean active)
Arguments
tableobjectobject
booleanactiveactive
Code
22function VehicleSetBeaconLightEvent:new(object, active)
23 local self = VehicleSetBeaconLightEvent:emptyNew()
24 self.active = active;
25 self.object = object;
26 return self;
27end

readStream

Description
Called on client side on join
Definition
readStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
33function VehicleSetBeaconLightEvent:readStream(streamId, connection)
34 self.object = NetworkUtil.readNodeObject(streamId);
35 self.active = streamReadBool(streamId);
36 self:run(connection);
37end

run

Description
Run action on receiving side
Definition
run(integer connection)
Arguments
integerconnectionconnection
Code
51function VehicleSetBeaconLightEvent:run(connection)
52 self.object:setBeaconLightsVisibility(self.active, true, true);
53 if not connection:getIsServer() then
54 g_server:broadcastEvent(VehicleSetBeaconLightEvent:new(self.object, self.active), nil, connection, self.object);
55 end;
56end

writeStream

Description
Called on server side on join
Definition
writeStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
43function VehicleSetBeaconLightEvent:writeStream(streamId, connection)
44 NetworkUtil.writeNodeObject(streamId, self.object);
45 streamWriteBool(streamId, self.active);
46end