LUADOC - Farming Simulator 22

Script v1_7_1_0

Engine v1_7_1_0

Foundation Reference

PlaceableTrainSystemSellEvent

Description
Event for selling train goods
Parent
Event
Functions

emptyNew

Description
Create instance of Event class
Definition
emptyNew()
Return Values
tableselfinstance of class event
Code
13function PlaceableTrainSystemSellEvent.emptyNew()
14 return Event.new(PlaceableTrainSystemSellEvent_mt)
15end

new

Description
Create new instance of event
Definition
new(table object, boolean isBlocked)
Arguments
tableobjectobject
booleanisBlockedis blocked
Code
21function PlaceableTrainSystemSellEvent.new(object, isBlocked)
22 local self = PlaceableTrainSystemSellEvent.emptyNew()
23 self.object = object
24 return self
25end

readStream

Description
Called on client side on join
Definition
readStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
31function PlaceableTrainSystemSellEvent:readStream(streamId, connection)
32 self.object = NetworkUtil.readNodeObject(streamId)
33 self:run(connection)
34end

run

Description
Run action on receiving side
Definition
run(integer connection)
Arguments
integerconnectionconnection
Code
47function PlaceableTrainSystemSellEvent:run(connection)
48 if not connection:getIsServer() then
49 if self.object ~= nil and self.object:getIsSynchronized() then
50 self.object:sellGoods()
51 end
52 end
53end

writeStream

Description
Called on server side on join
Definition
writeStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
40function PlaceableTrainSystemSellEvent:writeStream(streamId, connection)
41 NetworkUtil.writeNodeObject(streamId, self.object)
42end