new MMOApi()
Methods
-
removeMMOItem(item)
-
Removes an MMOItem from an MMORoom.
The target MMORoom is not required by this method because the system already keeps track of which MMOItem belongs to which MMORoom.
Parameters:
Name Type Description itemMMOItem The MMOItem object representing the MMOItem to be removed from the MMORoom where it is located. -
sendObjectMessage(targetRoom, sender, message [, aoi])
-
Sends a data object from a user to all the other users in his Area of Interest (AOI).
This method sends a custom SFSObject that can contain any data. Typically this is used to send game moves to players or other game/app related updates.
The difference with the regular version of this method (see SFSApi#sendObjectMessage method) is that it works with the AOI set for the target MMORoom. Also, instead of using the default AOI, a custom AOI can be provided. This must be smaller than the default one; attempting to use a larger AOI is not possible.
The sender must be joined in the target MMORoom too.Parameters:
Name Type Argument Description targetRoomMMORoom The
MMORoom object representing the MMORoom to send the data to.senderSFSUser The
SFSUser object representing the user sending the data to the target MMORoom.messageSFSObject The data object to send. aoiVec3D <optional>
A
Vec3D instance representing a custom AOI.
Read the notes in the MMOApi class description. -
sendPublicMessage(targetRoom, sender, message [, params] [, aoi])
-
Sends a public chat message from user to all the other users in his Area of Interest (AOI).
The difference with the regular version of this method (see SFSApi#sendPublicMessage method) is that it works with the AOI set for the target MMORoom. Also, instead of using the default AOI, a custom AOI can be provided. This must be smaller than the default one; attempting to use a larger AOI is not possible.
The sender must be joined in the target MMORoom too.Parameters:
Name Type Argument Description targetRoomMMORoom The
MMORoom object representing the MMORoom to send the message to.senderSFSUser The
SFSUser object representing the user sending the message to the target MMORoom.messagestring The chat message to send. paramsSFSObject <optional>
A SFSObject containing custom parameters to be attached to the message (e.g. text color, font size, etc). aoiVec3D <optional>
A
Vec3D instance representing a custom AOI.
Read the notes in the MMOApi class description. -
setMMOItemPosition(item, pos, targetRoom)
-
Sets the position of an MMOItem inside an MMORoom.
Parameters:
Name Type Description itemMMOItem The MMOItem object representing the MMOItem to set the position of. posVec3D A
Vec3D instance representing the MMOItem position in the target MMORoom.
Read the notes in the MMOApi class description.targetRoomMMORoom The
MMORoom object representing the MMORoom where to set the MMOItem position. -
setMMOItemVariables(item, variables [, fireClientEvent])
-
Sets the MMOItem Variables for the passed MMOItem.
Only new/updated variables are broadcast to the users that are within the range defined by the MOORoom's Area of Interest from the target MMOItem. A variable can also be deleted by setting it to
null.Parameters:
Name Type Argument Default Description itemMMOItem The MMOItem object representing the MMOItem for which the MMOItem Variables are set. variablesArray.<MMOItemVariable> An array of MMOItemVariable objects to set. fireClientEventboolean <optional>
false If true, a client-side MMOITEM_VARIABLES_UPDATE event will be fired to notify the MMOItem Variables creation/update. -
setUserPosition(user, pos, targetRoom)
-
Sets the position of a user inside an MMORoom.
Parameters:
Name Type Description userSFSuser The
SFSUser object representing the user to set the position of.posVec3D A
Vec3D instance representing the user position in the target MMORoom.
Read the notes in the MMOApi class description.targetRoomMMORoom The
MMORoom object representing the MMORoom where to set the user position.