Skip to main content
Skip to main content

BaleWrapperDropEvent

BaleWrapperDropEvent

Description

Event for bale wrapper drop

Parent

Event

Functions

emptyNew

Description

Create instance of Event class

Definition

emptyNew()

Return Values

anyselfinstance of class event

Code

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

new

Description

Create new instance of event

Definition

new(table object, integer dropAnimationIndex)

Arguments

tableobjectobject
integerdropAnimationIndexstate id

Return Values

integerself

Code

function BaleWrapperDropEvent.new(object, dropAnimationIndex)
local self = BaleWrapperDropEvent.emptyNew()
self.object = object
self.dropAnimationIndex = dropAnimationIndex

return self
end

readStream

Description

Called on client side on join

Definition

readStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function BaleWrapperDropEvent:readStream(streamId, connection)
self.object = NetworkUtil.readNodeObject(streamId)
self.dropAnimationIndex = streamReadUIntN(streamId, 4 )

self:run(connection)
end

run

Description

Run action on receiving side

Definition

run(Connection connection)

Arguments

Connectionconnectionconnection

Code

function BaleWrapperDropEvent:run(connection)
if not connection:getIsServer() then
g_server:broadcastEvent( self , false , nil , self.object)
end

if self.object ~ = nil and self.object:getIsSynchronized() then
self.object:setBaleWrapperDropAnimation( self.dropAnimationIndex)
self.object:doStateChange( BaleWrapper.CHANGE_WRAPPER_START_DROP_BALE, nil )
end
end

writeStream

Description

Called on server side on join

Definition

writeStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function BaleWrapperDropEvent:writeStream(streamId, connection)
NetworkUtil.writeNodeObject(streamId, self.object)
streamWriteUIntN(streamId, self.dropAnimationIndex, 4 )
end