tec::user::User
Container used to store information about a logged in user. More...
#include <user.hpp>
Public Functions
Name | |
---|---|
User() =default | |
~User() | |
void | AddEntityToWorld() Add the user's entity to the world by emitting EntityCreated and ControllerAddedEvent events. |
void | RemoveEntityFromWorld() Add the user's entity to the world by emitting EntityDestroy and ControllerRemovedEvent events. |
uid | GetUserId() const Get the user's ID. |
void | SetUserId(uid user_id) |
eid | GetEntityId() const Get the underlying entity's ID. |
std::string | GetUsername() const Get the username associated with this user. |
void | SetUsername(std::string username) |
void | Out(proto::User * target) Serialize to a proto::User. |
void | In(const proto::User & source) Deserialize from a proto::User. |
void | RegisterLuaType(sol::state & ) |
Detailed Description
class tec::user::User;
Container used to store information about a logged in user.
Information such as the user's id, username, inventory, etc will be connect here.
Additionally users contain an Entity that can be used to access the user's state in the world for purposes of retrieving position, health, etc components.
Public Functions Documentation
function User
User() =default
function ~User
~User()
function AddEntityToWorld
void AddEntityToWorld()
Add the user's entity to the world by emitting EntityCreated and ControllerAddedEvent events.
Call this after all user entity state has been set.
function RemoveEntityFromWorld
void RemoveEntityFromWorld()
Add the user's entity to the world by emitting EntityDestroy and ControllerRemovedEvent events.
Call this when the user is no longer in the world e.g. disconnect.
function GetUserId
inline uid GetUserId() const
Get the user's ID.
Return: uid Users' ID.
This ID is different than an entity ID in that it is assign during registration and is not meant to vary whereas an entity is assigned at random when the user's entity is added to the world.
function SetUserId
inline void SetUserId(
uid user_id
)
function GetEntityId
inline eid GetEntityId() const
Get the underlying entity's ID.
Return: eid The underlying entity's ID.
function GetUsername
inline std::string GetUsername() const
Get the username associated with this user.
Return: string User's username.
function SetUsername
inline void SetUsername(
std::string username
)
function Out
void Out(
proto::User * target
)
Serialize to a proto::User.
Parameters:
- proto::User* target The proto::User to serialize to.
function In
void In(
const proto::User & source
)
Deserialize from a proto::User.
Parameters:
- const proto::User& source The proto::User to Deserialize from.
function RegisterLuaType
static void RegisterLuaType(
sol::state &
)
Updated on 2022-07-24 at 19:27:35 +0000