LUADOC - Farming Simulator 19

Script v1.7.1.0

Engine v1.7.1.0

Foundation Reference

FillUnitUnloadEvent

Description
Event for turned on state
Parent
Event
Functions

emptyNew

Description
Create instance of Event class
Definition
emptyNew()
Return Values
tableselfinstance of class event
Code
13function FillUnitUnloadEvent:emptyNew()
14 local self = Event:new(FillUnitUnloadEvent_mt)
15 return self
16end

new

Description
Create new instance of event
Definition
new(table object)
Arguments
tableobjectobject
Code
21function FillUnitUnloadEvent:new(object)
22 local self = FillUnitUnloadEvent:emptyNew()
23 self.object = object
24 return self
25end

newServerToClient

Description
Definition
newServerToClient()
Code
29function FillUnitUnloadEvent:newServerToClient()
30 local self = FillUnitUnloadEvent:emptyNew()
31 return self
32end

readStream

Description
Called on client side on join
Definition
readStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
38function FillUnitUnloadEvent:readStream(streamId, connection)
39 if not connection:getIsServer() then
40 self.object = NetworkUtil.readNodeObject(streamId)
41 end
42 self:run(connection)
43end

run

Description
Run action on receiving side
Definition
run(integer connection)
Arguments
integerconnectionconnection
Code
58function FillUnitUnloadEvent:run(connection)
59 if not connection:getIsServer() then
60 if self.object ~= nil then
61 local success = self.object:unloadFillUnits(true)
62 if not success then
63 connection:sendEvent(FillUnitUnloadEvent:newServerToClient())
64 end
65 end
66 else
67 g_currentMission:addIngameNotification(FSBaseMission.INGAME_NOTIFICATION_INFO, g_i18n:getText("fillUnit_unload_nospace"))
68 end
69end

writeStream

Description
Called on server side on join
Definition
writeStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
49function FillUnitUnloadEvent:writeStream(streamId, connection)
50 if connection:getIsServer() then
51 NetworkUtil.writeNodeObject(streamId, self.object)
52 end
53end