Skip to main content
Skip to main content

AIAutomaticSteeringCourseEvent

AIAutomaticSteeringCourseEvent

Description

Event for current automatic steering course

Parent

Event

Functions

emptyNew

Description

Create instance of Event class

Definition

emptyNew()

Return Values

anyselfinstance of class event

Code

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

new

Description

Create new instance of event

Definition

new(table vehicle, integer currentAngle)

Arguments

tablevehiclevehicle
integercurrentAnglecurrent angle

Code

function AIAutomaticSteeringCourseEvent.new(vehicle, steeringFieldCourse)
local self = AIAutomaticSteeringCourseEvent.emptyNew()
self.vehicle = vehicle
self.steeringFieldCourse = steeringFieldCourse

return self
end

readStream

Description

Called on client side on join

Definition

readStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function AIAutomaticSteeringCourseEvent:readStream(streamId, connection)
self.vehicle = NetworkUtil.readNodeObject(streamId)
if self.vehicle ~ = nil and self.vehicle:getIsSynchronized() then
self.vehicle:setAIAutomaticSteeringCourse( nil , true )
end

if streamReadBool(streamId) then
SteeringFieldCourse.readStream(streamId, connection, function (steeringFieldCourse)
if steeringFieldCourse ~ = nil then
if self.vehicle ~ = nil and self.vehicle:getIsSynchronized() then
self.vehicle:setAIAutomaticSteeringCourse(steeringFieldCourse, true )
end
end
end )
end
end

run

Description

Run action on receiving side

Definition

run(Connection connection)

Arguments

Connectionconnectionconnection

Code

function AIAutomaticSteeringCourseEvent:run(connection)
end

writeStream

Description

Called on server side on join

Definition

writeStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function AIAutomaticSteeringCourseEvent:writeStream(streamId, connection)
NetworkUtil.writeNodeObject(streamId, self.vehicle)

if streamWriteBool(streamId, self.steeringFieldCourse ~ = nil ) then
self.steeringFieldCourse:writeStream(streamId, connection)
end
end