3#ifndef TRAM_SDK_FRAMEWORK_ENTITY_H
4#define TRAM_SDK_FRAMEWORK_ENTITY_H
16struct SharedEntityData;
Entity base class.
Definition: entity.h:23
void SetPersistent(bool is)
Definition: entity.h:54
virtual void Serialize()=0
quat rotation
Definition: entity.h:117
bool IsPersistent() const
Returns the persistence status of an entity.
Definition: entity.h:42
id_t id
Definition: entity.h:107
void CheckTransition()
Check whether an entity has entered a different cell.
Definition: entity.cpp:228
bool IsAutoLoad() const
Returns the auto load flag status.
Definition: entity.h:41
void Register()
Registers the entity.
Definition: entity.cpp:333
virtual void Unload()=0
Unloads an entity.
virtual void EventHandler(Event &event)
Allows entities to receive events.
Definition: entity.h:70
bool IsLoaded() const
Returns the entity load status.
Definition: entity.h:40
SignalTable * signals
Definition: entity.h:115
bool IsDeleted() const
Returns the entity deletion status.
Definition: entity.h:44
virtual void Load()=0
Loads an entity.
void UpdateTransform(const vec3 &loc, const quat &rot)
Definition: entity.h:59
virtual name_t GetType()=0
Returns the type of the entity.
static Entity * Make(name_t type, File *file)
Loads an Entity from a File.
Definition: entity.cpp:417
Entity()
Creates an unnamed entity with a random ID.
Definition: entity.cpp:188
id_t GetID() const
Definition: entity.h:38
void SetFlag(uint32_t flag, bool value)
Definition: entity.h:127
static void RegisterType(name_t name, entity_make, entity_clear, const Type *fields, size_t fieldcount)
Registers a new entity type.
Definition: entity.cpp:266
void SetLocation(vec3 loc)
Definition: entity.h:56
void SetAutoLoad(bool is)
Definition: entity.h:53
virtual ~Entity()
Destructs the entity.
Definition: entity.cpp:221
const vec3 & GetLocation()
Definition: entity.h:66
void Unregister()
Unregisters the entity.
Definition: entity.cpp:348
SignalTable * GetSignalTable()
Definition: entity.h:90
virtual void UpdateParameters()=0
Called when Entity::UpdateTransform is called.
void SetRotation(quat rot)
Definition: entity.h:57
@ FIELD_SERIALIZE
Definition: entity.h:83
WorldCell * GetCell()
Returns the entity's parent cell.
Definition: entity.h:39
vec3 location
Definition: entity.h:118
void FireSignal(signal_t type)
Definition: entity.h:124
@ DISABLE_AUTO_LOAD
Definition: entity.h:100
@ NON_PERSISTENT
Definition: entity.h:98
@ LOADED
Definition: entity.h:99
@ LOADED_FROM_DISK
Definition: entity.h:104
@ DELETED
Definition: entity.h:103
@ NON_SERIALIZABLE
Definition: entity.h:101
@ DIRTY
Definition: entity.h:102
bool IsChanged() const
Definition: entity.h:43
name_t name
Definition: entity.h:108
virtual void SetParameters()=0
Called when either Entity::SetLocation or Entity::SetRotation is called.
bool IsLoadedFromDisk() const
Definition: entity.h:45
void Yeet()
Purges the entity.
Definition: entity.cpp:406
WorldCell * cell
Definition: entity.h:110
virtual void MessageHandler(Message &msg)=0
Allows entities to receive messages.
const quat & GetRotation()
Definition: entity.h:67
uint32_t flags
Definition: entity.h:120
static void Update()
Updates entities.
Definition: entity.cpp:380
static Entity * Find(id_t entity_id)
Finds the entity by its ID number.
Definition: entity.cpp:361
void FireSignal(signal_t type, Value value)
Definition: entity.h:125
name_t GetName() const
Definition: entity.h:37
Very fast file reader/writer.
Definition: file.h:18
List of Message templates.
Definition: signal.h:50
void Fire(signal_t signal, id_t sender)
Definition: signal.cpp:105
Generic, type-safe union.
Definition: value.h:18
World streaming unit.
Definition: worldcell.h:16
uint32_t id_t
Definition: core.h:10
Type
Type enumeration for serialization, etc.
Definition: type.h:12
uint32_t signal_t
Definition: signal.h:12
Entity *(* entity_make)(const SharedEntityData &, const ValueArray &)
Definition: entity.h:20
glm::vec3 vec3
Definition: math.h:11
glm::quat quat
Definition: math.h:12
void(* entity_clear)(Entity *)
Definition: entity.h:21
Type field_type
Definition: entity.h:78
uint32_t field_flags
Definition: entity.h:79
uint32_t field_id
Definition: entity.h:77
Event data.
Definition: event.h:24
Message data.
Definition: message.h:16
Basic Entity parameters.
Definition: entity.h:132
quat rotation
Definition: entity.h:138
uint32_t flags
Definition: entity.h:136
name_t type
Definition: entity.h:133
name_t name
Definition: entity.h:135
vec3 position
Definition: entity.h:137
Interned string type.
Definition: uid.h:10