Skip to main content
Skip to main content

ProductionPointOutputModeEvent

ProductionPointOutputModeEvent

Description

Event for production point output mode changes

Parent

Event

Functions

emptyNew

Description

Create instance of Event class

Definition

emptyNew()

Return Values

anyselfinstance of class event

Code

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

new

Description

Create new instance of event

Definition

new()

Arguments

anyproductionPoint
anyoutputFillTypeId
anyoutputMode

Code

function ProductionPointOutputModeEvent.new(productionPoint, outputFillTypeId, outputMode)
local self = ProductionPointOutputModeEvent.emptyNew()
self.productionPoint = productionPoint
self.outputFillTypeId = outputFillTypeId
self.outputMode = outputMode
return self
end

readStream

Description

Called on client side on join

Definition

readStream()

Arguments

anystreamId
anyconnection

Code

function ProductionPointOutputModeEvent:readStream(streamId, connection)
self.productionPoint = NetworkUtil.readNodeObject(streamId)
self.outputFillTypeId = streamReadUIntN(streamId, FillTypeManager.SEND_NUM_BITS)
self.outputMode = streamReadUIntN(streamId, ProductionPoint.OUTPUT_MODE_NUM_BITS)
self:run(connection)
end

run

Description

Run action on receiving side

Definition

run()

Arguments

anyconnection

Code

function ProductionPointOutputModeEvent:run(connection)
if not connection:getIsServer() then
g_server:broadcastEvent( self , false , connection)
end

if self.productionPoint ~ = nil then
self.productionPoint:setOutputDistributionMode( self.outputFillTypeId, self.outputMode, true )
end
end

sendEvent

Description

Broadcast event from server to all clients, if called on client call function on server and broadcast it to all clients

Definition

sendEvent()

Arguments

anyproductionPoint
anyoutputFillTypeId
anyoutputMode
anynoEventSend

Code

function ProductionPointOutputModeEvent.sendEvent(productionPoint, outputFillTypeId, outputMode, noEventSend)
if noEventSend = = nil or noEventSend = = false then
if g_server ~ = nil then
g_server:broadcastEvent( ProductionPointOutputModeEvent.new(productionPoint, outputFillTypeId, outputMode))
else
g_client:getServerConnection():sendEvent( ProductionPointOutputModeEvent.new(productionPoint, outputFillTypeId, outputMode))
end
end
end

writeStream

Description

Called on server side on join

Definition

writeStream()

Arguments

anystreamId
anyconnection

Code

function ProductionPointOutputModeEvent:writeStream(streamId, connection)
NetworkUtil.writeNodeObject(streamId, self.productionPoint)
streamWriteUIntN(streamId, self.outputFillTypeId, FillTypeManager.SEND_NUM_BITS)
streamWriteUIntN(streamId, self.outputMode, ProductionPoint.OUTPUT_MODE_NUM_BITS)
end