LUADOC - Farming Simulator 22

Script v1_7_1_0

Engine v1_7_1_0

Foundation Reference

AdditionalFieldBuyInfoEvent

Description
Event for syncing the field buy info to the player
Parent
Event
Functions

emptyNew

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

new

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

readStream

Description
Called on client side on join
Definition
readStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
31function AdditionalFieldBuyInfoEvent:readStream(streamId, connection)
32 self.farmlandId = streamReadUIntN(streamId, g_farmlandManager.numberOfBits)
33
34 local pfModule = g_precisionFarming
35 if pfModule ~= nil then
36 if pfModule.additionalFieldBuyInfo ~= nil then
37 pfModule.additionalFieldBuyInfo:readInfoFromStream(self.farmlandId, streamId, connection)
38 end
39 end
40end

writeStream

Description
Called on server side on join
Definition
writeStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
46function AdditionalFieldBuyInfoEvent:writeStream(streamId, connection)
47 streamWriteUIntN(streamId, self.farmlandId, g_farmlandManager.numberOfBits)
48
49 local pfModule = g_precisionFarming
50 if pfModule ~= nil then
51 if pfModule.additionalFieldBuyInfo ~= nil then
52 pfModule.additionalFieldBuyInfo:writeInfoToStream(self.farmlandId, streamId, connection)
53 end
54 end
55end