Skip to main content
Skip to main content

VehicleSetBeaconLightEvent

VehicleSetBeaconLightEvent

Description

Event for beacon light state

Parent

Event

Functions

emptyNew

Description

Create instance of Event class

Definition

emptyNew()

Return Values

anyselfinstance of class event

Code

function VehicleSetBeaconLightEvent.emptyNew()
local self = Event.new( VehicleSetBeaconLightEvent _mt)
return self
end

new

Description

Create new instance of event

Definition

new(table object, boolean active)

Arguments

tableobjectobject
booleanactiveactive

Code

function VehicleSetBeaconLightEvent.new(object, active)
local self = VehicleSetBeaconLightEvent.emptyNew()
self.active = active
self.object = object
return self
end

readStream

Description

Called on client side on join

Definition

readStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function VehicleSetBeaconLightEvent:readStream(streamId, connection)
self.object = NetworkUtil.readNodeObject(streamId)
self.active = streamReadBool(streamId)
self:run(connection)
end

run

Description

Run action on receiving side

Definition

run(Connection connection)

Arguments

Connectionconnectionconnection

Code

function VehicleSetBeaconLightEvent:run(connection)
if self.object ~ = nil and self.object:getIsSynchronized() then
self.object:setBeaconLightsVisibility( self.active, true , true )
end

if not connection:getIsServer() then
g_server:broadcastEvent( VehicleSetBeaconLightEvent.new( self.object, self.active), nil , connection, self.object)
end
end

writeStream

Description

Called on server side on join

Definition

writeStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function VehicleSetBeaconLightEvent:writeStream(streamId, connection)
NetworkUtil.writeNodeObject(streamId, self.object)
streamWriteBool(streamId, self.active)
end