MMOItem

Represents an active Non-Player entity inside an MMORoom.


MMOItems can be used to represent bonuses, triggers, bullets, etc, or any other Non-Player entities that should be managed through MMORoom's rules of visibility. This means that whenever one or more MMOItems fall within the Area of Interest of a User, their presence is notified to that User by means of the SFSEvent.PROXIMITY_LIST_UPDATE event.

MMOItems are identified by a unique id and can have one or more MMOItem Variables assigned, to store custom data.

Note that MMOItems can be created in a server-side Extension only; client-side creation is not allowed.

Members

(readonly) aoiEntryPoint :Vec3D

Entry point of this MMOItem in the current User's AoI.

The returned coordinates are those that the MMOItem had when its presence in the current User's Area of Interest was last notified by a SFSEvent.PROXIMITY_LIST_UPDATE event. This property is set if the MMORoom in which the MMOItem exists is configured to send such data; otherwise the value is set to null.

Type:

(readonly) id :number

Identifier of this MMOItem.

The id is unique and it is generated by the server when the item is created.

Type:
  • number

Methods

containsVariable(varName) → {boolean}

Indicates whether the MMOItem has the specified MMOItem Variable set.
Parameters:
NameTypeDescription
varNamestringThe name of the MMOItem Variable whose existance must be checked.
Returns:
true if an MMOItem Variable with the passed name is found.
Type: 
boolean

getVariable(varName) → {MMOItemVariable}

Retrieves an MMOItem Variable by its name.
Parameters:
NameTypeDescription
varNamestringThe name of the MMOItem Variable to be retrieved.
Returns:
The object representing the MMOItem Variable, or null if no MMOItem Variable with the passed name belongs to the MMOItem.
Type: 
MMOItemVariable

getVariables() → {Array.<MMOItemVariable>}

Returns all MMOItem Variables belonging to the MMOItem.
Returns:
A list of objects representing the MMOItem Variables.
Type: 
Array.<MMOItemVariable>

toString() → {string}

Returns a string containing the MMOItem id and variables count.
Returns:
The string representation of the MMOItem object.
Type: 
string