Skip to main content
Skip to main content

BaleOpenEvent

BaleOpenEvent

Description

Event for bale opening

Parent

Event

Functions

emptyNew

Description

Create instance of Event class

Definition

emptyNew()

Return Values

anyselfinstance of class event

Code

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

new

Description

Create new instance of event

Definition

new(table bale, float x, float y, float z)

Arguments

tablebalebale
floatxx opening position
floatyy opening position
floatzz opening position

Return Values

floatinstanceinstance of event

Code

function BaleOpenEvent.new(bale)
local self = BaleOpenEvent.emptyNew()
self.bale = bale
return self
end

readStream

Description

Called on client side on join

Definition

readStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function BaleOpenEvent:readStream(streamId, connection)
if not connection:getIsServer() then
self.bale = NetworkUtil.readNodeObject(streamId)
end

self:run(connection)
end

run

Description

Run action on receiving side

Definition

run(Connection connection)

Arguments

Connectionconnectionconnection

Code

function BaleOpenEvent:run(connection)
if not connection:getIsServer() then
self.bale:open()
end
end

writeStream

Description

Called on server side on join

Definition

writeStream(integer streamId, Connection connection)

Arguments

integerstreamIdstreamId
Connectionconnectionconnection

Code

function BaleOpenEvent:writeStream(streamId, connection)
if connection:getIsServer() then
NetworkUtil.writeNodeObject(streamId, self.bale)
end
end