SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
Loading...
Searching...
No Matches
sfs3::entities::MMOItem Class Reference

An active non-player entity inside an MMORoom. More...

#include <MMOItem.h>

Public Member Functions

int32_t getId () const
std::shared_ptr< MMOItemVariablegetVariable (const std::string &name) const
 Retrieves a Variable of this item from its name.
std::vector< std::shared_ptr< MMOItemVariable > > getVariables () const
bool containsVariable (const std::string &name) const
std::optional< Vec3DgetAOIEntryPoint () const
 The point within the user's area of interest where this item "appeared" with the last proximity list update.
std::string toString () const

Detailed Description

An active non-player entity inside an MMORoom.

MMOItems can represent bonuses, triggers, bullets, or any other non-player entity handled with the MMORoom's rules of visibility: whenever one falls within the area of interest of a user, its presence is notified to that user with a event::SFSEvent::PROXIMITY_LIST_UPDATE event.

Items are identified by a unique id and can carry any number of MMOItem Variables holding custom data.

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

See also
MMORoom
MMOItemVariable

Member Function Documentation

◆ getId()

int32_t sfs3::entities::MMOItem::getId ( ) const
inline
Returns
the unique id of this item

◆ getVariable()

std::shared_ptr< MMOItemVariable > sfs3::entities::MMOItem::getVariable ( const std::string & name) const

Retrieves a Variable of this item from its name.

Parameters
namethe name of the Variable to be retrieved
Returns
the Variable, or nullptr if this item has none with that name

◆ getVariables()

std::vector< std::shared_ptr< MMOItemVariable > > sfs3::entities::MMOItem::getVariables ( ) const
Returns
all the Variables of this item

◆ containsVariable()

bool sfs3::entities::MMOItem::containsVariable ( const std::string & name) const
Parameters
namethe name of the Variable to look for
Returns
true if this item has a Variable with that name

◆ getAOIEntryPoint()

std::optional< Vec3D > sfs3::entities::MMOItem::getAOIEntryPoint ( ) const
inline

The point within the user's area of interest where this item "appeared" with the last proximity list update.

It is set only when the MMORoom is configured to send the entry points; otherwise the optional stays empty.

See also
requests::MMOSettings::sendAOIEntryPoint
SFSEvent::PROXIMITY_LIST_UPDATE

◆ toString()

std::string sfs3::entities::MMOItem::toString ( ) const
Returns
the id and the Variables of this item as text, for logging and debugging

The documentation for this class was generated from the following files:
  • entities/MMOItem.h
  • entities/MMOItem.cpp