Skip to main content
Skip to main content

PlaceableTrainSystemSellEvent

PlaceableTrainSystemSellEvent

Description

Event for selling train goods

Parent

Event

Functions

emptyNew

Description

Create instance of Event class

Definition

emptyNew()

Return Values

anyselfinstance of class event

Code

function PlaceableTrainSystemSellEvent.emptyNew()
return Event.new( PlaceableTrainSystemSellEvent _mt)
end

new

Description

Create new instance of event

Definition

new(table object)

Arguments

tableobjectobject

Return Values

tableinstance

Code

function PlaceableTrainSystemSellEvent.new(object)
local self = PlaceableTrainSystemSellEvent.emptyNew()
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 PlaceableTrainSystemSellEvent:readStream(streamId, connection)
self.object = NetworkUtil.readNodeObject(streamId)
self:run(connection)
end

run

Description

Run action on receiving side

Definition

run(Connection connection)

Arguments

Connectionconnectionconnection

Code

function PlaceableTrainSystemSellEvent:run(connection)
if not connection:getIsServer() then
if self.object ~ = nil and self.object:getIsSynchronized() then
self.object:sellGoods()
end
end
end

writeStream

Description

Called on server side on join

Definition

writeStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function PlaceableTrainSystemSellEvent:writeStream(streamId, connection)
NetworkUtil.writeNodeObject(streamId, self.object)
end