Skip to main content
Skip to main content

EnvironmentalScoreEvent

EnvironmentalScoreEvent

Description

Event for syncing the environmental score to the player

Parent

Event

Functions

emptyNew

Description

Create instance of Event class

Definition

emptyNew()

Return Values

anyselfinstance of class event

Code

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

new

Description

Create new instance of event

Definition

new(table object)

Arguments

tableobjectobject

Code

function EnvironmentalScoreEvent.new(farmId)
local self = EnvironmentalScoreEvent.emptyNew()
self.farmId = farmId
return self
end

readStream

Description

Called on client side on join

Definition

readStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function EnvironmentalScoreEvent:readStream(streamId, connection)
self.farmId = streamReadUIntN(streamId, FarmManager.FARM_ID_SEND_NUM_BITS)

local pfModule = g_precisionFarming
if pfModule ~ = nil then
if pfModule.environmentalScore ~ = nil then
pfModule.environmentalScore:readStream(streamId, connection, self.farmId)
end
end
end

writeStream

Description

Called on server side on join

Definition

writeStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function EnvironmentalScoreEvent:writeStream(streamId, connection)
streamWriteUIntN(streamId, self.farmId, FarmManager.FARM_ID_SEND_NUM_BITS)

local pfModule = g_precisionFarming
if pfModule ~ = nil then
if pfModule.environmentalScore ~ = nil then
pfModule.environmentalScore:writeStream(streamId, connection, self.farmId)
end
end
end