Class SFS2X.Entities.MMOItem

The representation of an active non-player entity inside an MMORoom.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a new MMOItem instance.

Field Summary

Method Summary

Class Detail

SFS2X.Entities.MMOItem(id)
Creates a new MMOItem instance.

MMOItems can be used to represent bonuses, triggers, bullets, etc, or any other non-player entity that will be handled using the MMORoom's rules of visibility. This means that whenever one or more MMOItems fall within the Area of Interest of a user, their presence will be notified to that user by means of the proximityListUpdate event.

MMOItems are identified by a unique ID and can have one or more MMOItem Variables associated to store custom data.

NOTE: MMOItems can be created in a server side Extension only; client side creation is not allowed.

Parameters:
{Number} id
The item id.
See also:
SFS2X.Entities.MMORoom
SFS2X.Entities.Variables.MMOItemVariable

Field Detail

{Vec3D} aoiEntryPoint
Returns the entry point of this item in the current user's AoI.

The returned coordinates are those that the item had when its presence in the current user's Area of Interest was last notified by a proximityListUpdate event. This field is populated only if the MMORoom in which the item exists is configured to receive such data.

See also:
SFS2X.Requests.MMO.MMORoomSettings#sendAOIEntryPoint
SFS2X.SFSEvent.PROXIMITY_LIST_UPDATE
{Number} id
Indicates the id of this item.

NOTE: the id is unique and it is generated by the server when the MMOItem is created. Setting it manually has no effect on the server and can disrupt the API functioning.

Method Detail

  • {Boolean} containsVariable(varName)
    Indicates whether this item has the specified MMOItem Variable set or not.
    Parameters:
    {String} varName
    The name of the MMOItem Variable whose existance must be checked.
    Returns:
    {Boolean} true if an MMOItem Variable with the passed name is set for this item.
  • {MMOItemVariable} getVariable(varName)
    Retrieves an MMOItem Variable from its name.
    Parameters:
    {String} varName
    The name of the MMOItem Variable to be retrieved.
    Returns:
    {MMOItemVariable} The MMOItemVariable object, or null if no MMOItem Variable with the passed name is associated to this item.
    See also:
    SFS2X.Entities.Variables.MMOItemVariable
    SFS2X.Requests.MMO.SetMMOItemVariablesRequest
  • {Array} getVariables()
    Retrieves all the MMOItem Variables of this item.
    Returns:
    {Array} The list of MMOItemVariable objects associated to this item.
    See also:
    SFS2X.Entities.Variables.MMOItemVariable
  • {String} toString()
    Returns a string that contains the item id.
    Returns:
    {String} The string representation of the MMOItem object.