Skip to main content
Skip to main content

VehicleDetachEvent

VehicleDetachEvent

Description

Event for detaching

Parent

Event

Functions

emptyNew

Description

Create instance of Event class

Definition

emptyNew()

Return Values

anyselfinstance of class event

Code

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

new

Description

Create new instance of event

Definition

new(table vehicle, table implement)

Arguments

tablevehiclevehicle
tableimplementimplement

Return Values

tableinstanceinstance of event

Code

function VehicleDetachEvent.new(vehicle, implement)
local self = VehicleDetachEvent.emptyNew()
self.implement = implement
self.vehicle = vehicle
return self
end

readStream

Description

Called on client side on join

Definition

readStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function VehicleDetachEvent:readStream(streamId, connection)
self.vehicle = NetworkUtil.readNodeObject(streamId)
self.implement = NetworkUtil.readNodeObject(streamId)

if self.vehicle ~ = nil and self.vehicle:getIsSynchronized() then
if connection:getIsServer() then
self.vehicle:detachImplementByObject( self.implement, true )
else
self.vehicle:detachImplementByObject( self.implement)
end
end
end

run

Description

Definition

run()

Arguments

anyconnection

Code

function VehicleDetachEvent:run(connection)
end

writeStream

Description

Called on server side on join

Definition

writeStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function VehicleDetachEvent:writeStream(streamId, connection)
NetworkUtil.writeNodeObject(streamId, self.vehicle)
NetworkUtil.writeNodeObject(streamId, self.implement)
end