Difference between revisions of "Script/Entity"

From SF3
Jump to: navigation, search
Line 57: Line 57:
 
| style = 'color: #505050; line-height: 0.5;' |''set owner faction''
 
| style = 'color: #505050; line-height: 0.5;' |''set owner faction''
 
|-
 
|-
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|string]]  
+
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../LogicEnums#EEntityType|EEntityType]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetEntityType''' () const
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetEntityType''' () const
 
|-
 
|-

Revision as of 10:39, 7 September 2016

class Entity

Represents a reference to an entity in the game world (e.g. a building, creature, etc.).

An instance of this class acts like a weak pointer to an existing entity in the game world and provides an interface to interact with it. Before interacting with the entity, you should call Exists() in order to check if the entity actually (still) exists. IMPORTANT: This class must NOT be stored as a class member. If you want to store the entity for later reference, store the id obtained by GetId instead. You can then later retrieve the entity from the LevelReference class by calling GetEntityById.

Class Methods

Entity& operator= (const Entity&in)
bool operator== (const Entity&in)
Building opConv () const
Creature opConv () const
LogicObject opConv () const
ResourceDeposit opConv () const
bool Exists () const
does the entity actually exist? (always check this before doing anything with the entity!)
uint GetId () const
get persistent entity id, use this to save the entity for later reference.
uint8 GetFaction () const
get owner faction
void SetFaction (const uint8 _Faction)
set owner faction
EEntityType GetEntityType () const
get entity type name
bool IsEnabled () const
whether the entity is currently enabled (i.e. is visible in the game world)
void Enable (const bool _bEnabled)
enabled or disable the entity
bool IsInteractive () const
can the entity be interacted with?
void SetInteractive (const bool _bInteractive)
set whether the entity can be interacted with
bool CanBeAttacked () const
can the entity be attacked?
void SetAttackable (const bool _bAttackable)
set whether the entity can be attacked

class Entity

Represents a reference to an entity in the game world (e.g. a building, creature, etc.).

An instance of this class acts like a weak pointer to an existing entity in the game world and provides an interface to interact with it. Before interacting with the entity, you should call Exists() in order to check if the entity actually (still) exists. IMPORTANT: This class must NOT be stored as a class member. If you want to store the entity for later reference, store the id obtained by GetId instead. You can then later retrieve the entity from the LevelReference class by calling GetEntityById.

Class Methods

Entity& operator= (const Entity&in)
bool operator== (const Entity&in)
Building opConv () const
Creature opConv () const
LogicObject opConv () const
ResourceDeposit opConv () const
bool Exists () const
does the entity actually exist? (always check this before doing anything with the entity!)
uint GetId () const
get persistent entity id, use this to save the entity for later reference.
uint8 GetFaction () const
get owner faction
void SetFaction (const uint8 _Faction)
set owner faction
string GetEntityType () const
get entity type name
bool IsEnabled () const
whether the entity is currently enabled (i.e. is visible in the game world)
void Enable (const bool _bEnabled)
enabled or disable the entity
bool IsInteractive () const
can the entity be interacted with?
void SetInteractive (const bool _bInteractive)
set whether the entity can be interacted with
bool CanBeAttacked () const
can the entity be attacked?
void SetAttackable (const bool _bAttackable)
set whether the entity can be attacked