Tramway SDK
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tram::Ext::Kitchensink::Button Class Reference

Essentially a func_door. More...

#include <extensions/kitchensink/entities.h>

Inheritance diagram for tram::Ext::Kitchensink::Button:
tram::Entity

Public Member Functions

 Button (const SharedEntityData &, const ValueArray &)
 
void UpdateParameters ()
 Called when Entity::UpdateTransform is called. More...
 
void SetParameters ()
 Called when either Entity::SetLocation or Entity::SetRotation is called. More...
 
void Load ()
 Loads an entity. More...
 
void Unload ()
 Unloads an entity. More...
 
void Serialize ()
 
void EventHandler (Event &event)
 Allows entities to receive events. More...
 
void MessageHandler (Message &msg)
 Allows entities to receive messages. More...
 
name_t GetType ()
 Returns the type of the entity. More...
 
- Public Member Functions inherited from tram::Entity
 Entity ()
 Creates an unnamed entity with a random ID. More...
 
 Entity (name_t name)
 Creates a named entity with a random ID. More...
 
 Entity (const SharedEntityData &)
 Creates an entity from a SharedEntityData. More...
 
virtual ~Entity ()
 Destructs the entity. More...
 
name_t GetName () const
 
id_t GetID () const
 
WorldCellGetCell ()
 Returns the entity's parent cell. More...
 
bool IsLoaded () const
 Returns the entity load status. More...
 
bool IsAutoLoad () const
 Returns the auto load flag status. More...
 
bool IsPersistent () const
 Returns the persistence status of an entity. More...
 
bool IsChanged () const
 
bool IsDeleted () const
 Returns the entity deletion status. More...
 
bool IsLoadedFromDisk () const
 
void Yeet ()
 Purges the entity. More...
 
void SetAutoLoad (bool is)
 
void SetPersistent (bool is)
 
void SetLocation (vec3 loc)
 
void SetRotation (quat rot)
 
void UpdateTransform (const vec3 &loc, const quat &rot)
 
const vec3GetLocation ()
 
const quatGetRotation ()
 
void CheckTransition ()
 Check whether an entity has entered a different cell. More...
 
SignalTableGetSignalTable ()
 

Static Public Member Functions

static void Register ()
 
- Static Public Member Functions inherited from tram::Entity
static void Update ()
 Updates entities. More...
 
static void RegisterType (name_t name, entity_make, entity_clear, const Type *fields, size_t fieldcount)
 Registers a new entity type. More...
 
static void RegisterType (name_t name, entity_make, entity_clear, const FieldInfo *fields, size_t fieldcount)
 Registers a new entity type. More...
 
static void RegisterType (name_t name, entity_make, entity_clear, std::initializer_list< FieldInfo > fields)
 Registers a new entity type. More...
 
static EntityMake (name_t type, File *file)
 Loads an Entity from a File. More...
 
static EntityMake (name_t type, const SharedEntityData &, const ValueArray &)
 Creates an entity. More...
 
static EntityFind (id_t entity_id)
 Finds the entity by its ID number. More...
 
static EntityFind (name_t entity_name)
 Finds the entity by its name. More...
 

Protected Member Functions

void SwitchState (int)
 
- Protected Member Functions inherited from tram::Entity
void Register ()
 Registers the entity. More...
 
void Unregister ()
 Unregisters the entity. More...
 
void FireSignal (signal_t type)
 
void FireSignal (signal_t type, Value value)
 
void SetFlag (uint32_t flag, bool value)
 

Protected Attributes

Component< RenderComponentrendercomponent
 
Component< PhysicsComponentphysicscomponent
 
EventListener tick
 
uint32_t flags
 
name_t model
 
name_t lightmap
 
vec3 origin
 
vec3 direction
 
float speed
 
float pause
 
float distance
 
name_t sound
 
name_t parent
 
vec3 start_pos
 
quat start_rot
 
float progress
 
float timer
 
int state
 
int last_activate
 
- Protected Attributes inherited from tram::Entity
id_t id = 0
 
name_t name
 
WorldCellcell = nullptr
 
SignalTablesignals = nullptr
 
quat rotation = {1.0f, 0.0f, 0.0f, 0.0f}
 
vec3 location = {0.0f, 0.0f, 0.0f}
 
uint32_t flags = 0
 

Additional Inherited Members

- Public Types inherited from tram::Entity
enum  : uint32_t { FIELD_SERIALIZE = 1 }
 
- Protected Types inherited from tram::Entity
enum  : uint32_t {
  NON_PERSISTENT = 1 , LOADED = 2 , DISABLE_AUTO_LOAD = 4 , NON_SERIALIZABLE = 8 ,
  DIRTY = 16 , DELETED = 32 , LOADED_FROM_DISK = 64
}
 

Detailed Description

Essentially a func_door.

It can open. It can close. It responds to Signal inputs and gives out outputs. It can be a door. It can be a lift. It can even be a button.

Constructor & Destructor Documentation

◆ Button()

tram::Ext::Kitchensink::Button::Button ( const SharedEntityData shared_data,
const ValueArray field_array 
)

Member Function Documentation

◆ EventHandler()

void tram::Ext::Kitchensink::Button::EventHandler ( Event event)
virtual

Allows entities to receive events.

Whenever an entity registers an event, an event of the same type as the event listener is posted and Event::Dispatch() has been called, the entity will receive the event through this method.

Reimplemented from tram::Entity.

◆ GetType()

name_t tram::Ext::Kitchensink::Button::GetType ( )
virtual

Returns the type of the entity.

Usually this method returns the same name that is used to Entity::RegisterType() its type.

Implements tram::Entity.

◆ Load()

void tram::Ext::Kitchensink::Button::Load ( )
virtual

Loads an entity.

Usually the Load() method for an entity type will set up its components, event listeners, etc. After being loaded, the entity will be ready for simulation.

When implementing this method, make sure to flag the entity with the LOADED flag, so that world streaming system doesn't try to load your entity twice.

Implements tram::Entity.

◆ MessageHandler()

void tram::Ext::Kitchensink::Button::MessageHandler ( Message msg)
virtual

Allows entities to receive messages.

Whenever an entity is sent a Message, once the Message::Dispatch() function has been called, the entity will gets the message passed to it through this method.

Implements tram::Entity.

◆ Register()

void tram::Ext::Kitchensink::Button::Register ( )
static

◆ Serialize()

void tram::Ext::Kitchensink::Button::Serialize ( )
virtual

Implements tram::Entity.

◆ SetParameters()

void tram::Ext::Kitchensink::Button::SetParameters ( )
virtual

Called when either Entity::SetLocation or Entity::SetRotation is called.

Usually this method is used to relocate or rerotate an entity.

If the entity has a PhysicsComponent, its position or rotation is usually set from this method, otherwise in the next Physics update step, the entity's previous rotation and location will be restored.

Implements tram::Entity.

◆ SwitchState()

void tram::Ext::Kitchensink::Button::SwitchState ( int  )
protected

◆ Unload()

void tram::Ext::Kitchensink::Button::Unload ( )
virtual

Unloads an entity.

Usually the Load() method for an entity type will destroy its its components, event listeners, etc. After being unloaded, the entity have been removed from the simulation.

When implementing this method, make sure to clear your entity's LOADED flag, so that world streaming system can load the entity again.

Implements tram::Entity.

◆ UpdateParameters()

void tram::Ext::Kitchensink::Button::UpdateParameters ( )
virtual

Called when Entity::UpdateTransform is called.

From the runtime's side, only the Physics system will call the Entity::UpdateTransform() method, and through it, this method.

Usually this method is used to forward the entity's new position and rotation to its RenderComponent, if it has one.

If the entity has a PhysicsComponent, its position or rotation is never updated from this method.

Implements tram::Entity.

Member Data Documentation

◆ direction

vec3 tram::Ext::Kitchensink::Button::direction
protected

◆ distance

float tram::Ext::Kitchensink::Button::distance
protected

◆ flags

uint32_t tram::Ext::Kitchensink::Button::flags
protected

◆ last_activate

int tram::Ext::Kitchensink::Button::last_activate
protected

◆ lightmap

name_t tram::Ext::Kitchensink::Button::lightmap
protected

◆ model

name_t tram::Ext::Kitchensink::Button::model
protected

◆ origin

vec3 tram::Ext::Kitchensink::Button::origin
protected

◆ parent

name_t tram::Ext::Kitchensink::Button::parent
protected

◆ pause

float tram::Ext::Kitchensink::Button::pause
protected

◆ physicscomponent

Component<PhysicsComponent> tram::Ext::Kitchensink::Button::physicscomponent
protected

◆ progress

float tram::Ext::Kitchensink::Button::progress
protected

◆ rendercomponent

Component<RenderComponent> tram::Ext::Kitchensink::Button::rendercomponent
protected

◆ sound

name_t tram::Ext::Kitchensink::Button::sound
protected

◆ speed

float tram::Ext::Kitchensink::Button::speed
protected

◆ start_pos

vec3 tram::Ext::Kitchensink::Button::start_pos
protected

◆ start_rot

quat tram::Ext::Kitchensink::Button::start_rot
protected

◆ state

int tram::Ext::Kitchensink::Button::state
protected

◆ tick

EventListener tram::Ext::Kitchensink::Button::tick
protected

◆ timer

float tram::Ext::Kitchensink::Button::timer
protected

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