This class is a wrapper for snipe.kit.room.data.RoomKit providing limited functionality to access room variables from within room scripts.

It is available only on Snipe Kit server.

Constructor

Fields

read only clientIDs:Array<Int>

List of room client IDs.

read only createTS:Float

Timestamp of room creation.

read only id:Int

Unique room ID.

isDead:Bool

List of room clients.

state:String

Room state. Empty string by default. If the room state does not change in 60 seconds, the room is destroyed.

read only stateTS:Float

Timestamp of last state change.

read only users:Array<RoomUserClass>

List of room users data. The data is set in the "matchmaking.init" script for this game type and can be changed in room scripts.

read only vars:RoomVariables

Global room variables accessible from script.

Methods

broadcast (type:String, msg:Dynamic):Void

Broadcasts the message to all clients in this room.

Parameters:

type

Message type.

msg

Message parameters.

error (s:String):Void

Adds a message to room error logs.

Parameters:

s

Log message.

event (userID:Int, actionID:String, params:Dynamic):Dynamic

Sends event to this room.

Parameters:

userID

User ID.

actioID

Room event action ID.

params

Event parameters.

Returns:

Return object. Has errorCode parameter. errorCode is set to "scriptException" in case of an error. In this case room will die after finishing the outer script.

getUser (userID:Int):RoomUserClass

Returns room user object with this ID. User object must have a unique "id" field set.

Parameters:

userID

User ID.

Returns:

User object.

isOnline (userID:Int):Bool

Returns true if client for this user is online.

Parameters:

userID

user ID.

Returns:

True, if client is online, false otherwise.

kick (clientID:Int):Void

Kicks a client from this room. Room user record will stay intact. First calls leave() then notifies the game server to return the client to default state.

Parameters:

clientID

Client ID.

log (s:String):Void

Adds a message to room logs.

Parameters:

s

Log message.

notify (clientID:Int, msg:Dynamic):Void

Sends client notification to the given room client. If the client is not in the room, nothing happens.

Parameters:

clientID

Client ID.

msg

Notification message.

notifyBroadcast (msg:Dynamic):Void

Broadcasts the notification to all clients in this room.

Parameters:

msg

Message parameters.

response (clientID:Int, type:String, msg:Dynamic):Void

Returns room client with this ID.

Parameters:

clientID

Client ID.

Returns:

Client instance. Returns null if client is not connected.