Tramway SDK
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
tram::Entity Class Referenceabstract

#include <entity.h>

Inheritance diagram for tram::Entity:
tram::Crate tram::Decoration tram::Ext::Design::Breakable tram::Ext::Design::Button tram::Ext::Design::DebugShape tram::Ext::Design::DebugText tram::Ext::Design::Decoration tram::Ext::Design::Pickup tram::Ext::Design::Train tram::Ext::Design::TriggerAutosave tram::Ext::Design::TriggerHurt tram::Ext::Design::TriggerMultiple tram::Ext::Design::TriggerOnce tram::Ext::Design::TriggerPlayerMovement tram::Ext::Design::TriggerPush tram::Ext::Design::TriggerRemove tram::Ext::Design::TriggerTeleport tram::Ext::Design::Water tram::Ext::Kitchensink::QuestEntity tram::Light tram::Marker tram::Player tram::Sound tram::StaticWorldObject tram::Trigger

Classes

struct  FieldInfo
 

Public Types

enum  : uint32_t { FIELD_SERIALIZE = 1 }
 

Public Member Functions

virtual void Load ()=0
 
virtual void Unload ()=0
 
virtual void Serialize ()=0
 
 Entity ()
 
 Entity (name_t name)
 
 Entity (const SharedEntityData &)
 
virtual ~Entity ()
 
name_t GetName () const
 
id_t GetID () const
 
WorldCellGetCell ()
 
bool IsLoaded () const
 
bool IsAutoLoad () const
 
bool IsInInterior () const
 
bool IsPersistent () const
 
bool IsChanged () const
 
virtual void UpdateParameters ()=0
 
virtual void SetParameters ()=0
 
virtual void Update ()
 
void SetAutoLoad (bool auto_load)
 
void SetPersistent (bool persistent)
 
void SetLocation (vec3 loc)
 
void SetRotation (quat rot)
 
void UpdateTransform (const vec3 &loc, const quat &rot)
 
const vec3GetLocation ()
 
const quatGetRotation ()
 
virtual void MessageHandler (Message &msg)=0
 
virtual void EventHandler (Event &event)
 
virtual name_t GetType ()=0
 
void CheckTransition ()
 
SignalTableGetSignalTable ()
 

Static Public Member Functions

static void RegisterType (name_t name, Entity *(*constr_func)(const SharedEntityData &, const ValueArray &), void(*destr_func)(Entity *), const uint32_t *fields, size_t fieldcount)
 
static void RegisterType (name_t name, Entity *(*constr_func)(const SharedEntityData &, const ValueArray &), void(*destr_func)(Entity *), std::initializer_list< FieldInfo > fields)
 
static void UpdateFromList ()
 Updates all of the entities in the update list. More...
 
static EntityMake (name_t type, File *file)
 Loads an Entity from a File. More...
 
static EntityFind (id_t entity_id)
 
static EntityFind (name_t entity_name)
 

Protected Member Functions

void Register ()
 
void FireSignal (signal_t type)
 
void FireSignal (signal_t type, Value value)
 
void AddUpdate ()
 Adds entity to update list. More...
 
void RemoveUpdate ()
 Remove entity from the update list. More...
 

Protected Attributes

id_t id = 0
 
name_t name
 
uint32_t flags = 0
 
bool is_persistent = true
 
bool is_loaded = false
 
bool auto_load = true
 
bool in_interior = false
 
bool changed = false
 
bool is_serializable = true
 
WorldCellcell = nullptr
 
SignalTablesignals = nullptr
 
quat rotation = {1.0f, 0.0f, 0.0f, 0.0f}
 
vec3 location = {0.0f, 0.0f, 0.0f}
 

Friends

class WorldCell
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : uint32_t
Enumerator
FIELD_SERIALIZE 

Constructor & Destructor Documentation

◆ Entity() [1/3]

tram::Entity::Entity ( )

◆ Entity() [2/3]

tram::Entity::Entity ( name_t  name)

◆ Entity() [3/3]

tram::Entity::Entity ( const SharedEntityData shared_data)

◆ ~Entity()

tram::Entity::~Entity ( )
virtual

Member Function Documentation

◆ AddUpdate()

void tram::Entity::AddUpdate ( )
protected

Adds entity to update list.

After being added to the update list, the entity's Update() method will be called every time UpdateFromList() is called.

◆ CheckTransition()

void tram::Entity::CheckTransition ( )

◆ EventHandler()

virtual void tram::Entity::EventHandler ( Event event)
inlinevirtual

◆ Find() [1/2]

Entity * tram::Entity::Find ( id_t  entity_id)
static

◆ Find() [2/2]

Entity * tram::Entity::Find ( name_t  entity_name)
static

◆ FireSignal() [1/2]

void tram::Entity::FireSignal ( signal_t  type)
inlineprotected

◆ FireSignal() [2/2]

void tram::Entity::FireSignal ( signal_t  type,
Value  value 
)
inlineprotected

◆ GetCell()

WorldCell * tram::Entity::GetCell ( )
inline

◆ GetID()

id_t tram::Entity::GetID ( ) const
inline

◆ GetLocation()

const vec3 & tram::Entity::GetLocation ( )
inline

◆ GetName()

name_t tram::Entity::GetName ( ) const
inline

◆ GetRotation()

const quat & tram::Entity::GetRotation ( )
inline

◆ GetSignalTable()

SignalTable * tram::Entity::GetSignalTable ( )
inline

◆ GetType()

virtual name_t tram::Entity::GetType ( )
pure virtual

◆ IsAutoLoad()

bool tram::Entity::IsAutoLoad ( ) const
inline

◆ IsChanged()

bool tram::Entity::IsChanged ( ) const
inline

◆ IsInInterior()

bool tram::Entity::IsInInterior ( ) const
inline

◆ IsLoaded()

bool tram::Entity::IsLoaded ( ) const
inline

◆ IsPersistent()

bool tram::Entity::IsPersistent ( ) const
inline

◆ Load()

virtual void tram::Entity::Load ( )
pure virtual

◆ Make()

Entity * tram::Entity::Make ( name_t  type,
File file 
)
static

Loads an Entity from a File.

◆ MessageHandler()

virtual void tram::Entity::MessageHandler ( Message msg)
pure virtual

◆ Register()

void tram::Entity::Register ( )
protected

◆ RegisterType() [1/2]

void tram::Entity::RegisterType ( name_t  name,
Entity *(*)(const SharedEntityData &, const ValueArray &)  constr_func,
void(*)(Entity *)  destr_func,
const uint32_t *  fields,
size_t  fieldcount 
)
static

◆ RegisterType() [2/2]

void tram::Entity::RegisterType ( name_t  name,
Entity *(*)(const SharedEntityData &, const ValueArray &)  constr_func,
void(*)(Entity *)  destr_func,
std::initializer_list< FieldInfo fields 
)
static

◆ RemoveUpdate()

void tram::Entity::RemoveUpdate ( )
protected

Remove entity from the update list.

◆ Serialize()

virtual void tram::Entity::Serialize ( )
pure virtual

◆ SetAutoLoad()

void tram::Entity::SetAutoLoad ( bool  auto_load)
inline

◆ SetLocation()

void tram::Entity::SetLocation ( vec3  loc)
inline

◆ SetParameters()

virtual void tram::Entity::SetParameters ( )
pure virtual

◆ SetPersistent()

void tram::Entity::SetPersistent ( bool  persistent)
inline

◆ SetRotation()

void tram::Entity::SetRotation ( quat  rot)
inline

◆ Unload()

virtual void tram::Entity::Unload ( )
pure virtual

◆ Update()

virtual void tram::Entity::Update ( )
inlinevirtual

Reimplemented in tram::Ext::Design::Button.

◆ UpdateFromList()

void tram::Entity::UpdateFromList ( )
static

Updates all of the entities in the update list.

◆ UpdateParameters()

virtual void tram::Entity::UpdateParameters ( )
pure virtual

◆ UpdateTransform()

void tram::Entity::UpdateTransform ( const vec3 loc,
const quat rot 
)
inline

Friends And Related Function Documentation

◆ WorldCell

friend class WorldCell
friend

Member Data Documentation

◆ auto_load

bool tram::Entity::auto_load = true
protected

◆ cell

WorldCell* tram::Entity::cell = nullptr
protected

◆ changed

bool tram::Entity::changed = false
protected

◆ flags

uint32_t tram::Entity::flags = 0
protected

◆ id

id_t tram::Entity::id = 0
protected

◆ in_interior

bool tram::Entity::in_interior = false
protected

◆ is_loaded

bool tram::Entity::is_loaded = false
protected

◆ is_persistent

bool tram::Entity::is_persistent = true
protected

◆ is_serializable

bool tram::Entity::is_serializable = true
protected

◆ location

vec3 tram::Entity::location = {0.0f, 0.0f, 0.0f}
protected

◆ name

name_t tram::Entity::name
protected

◆ rotation

quat tram::Entity::rotation = {1.0f, 0.0f, 0.0f, 0.0f}
protected

◆ signals

SignalTable* tram::Entity::signals = nullptr
protected

The documentation for this class was generated from the following files: