Difference between revisions of "Script/Building"

From SF3
Jump to: navigation, search
Line 208: Line 208:
 
|
 
|
 
| style = 'color: #505050; line-height: 0.5;' |''set whether the entity can be interacted with''
 
| style = 'color: #505050; line-height: 0.5;' |''set whether the entity can be interacted with''
 +
|-
 +
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]
 +
| style='color: black; width: 90%; line-height: 1.0;' | '''IsSelectable''' () const
 +
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''can the entity (theoretically) be selected by the player?''
 +
|-
 +
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]
 +
| style='color: black; width: 90%; line-height: 1.0;' | '''SetSelectable''' (const [[../BasicDataTypes|bool]] ''_bSelectable'')
 +
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''set whether the entity can be selected by the player
 +
(note that depending on the type of entity, there may be additional checks preventing the entity from being selected)''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]  

Revision as of 11:29, 9 January 2017

class Building

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

Inherits from: Entity

Class Methods

string GetDescriptionName () const
get building description name
EBuildingType GetBuildingType () const
get building type
EBuildingStage GetStage () const
get current building stage
uint16 GetSectorIndex () const
get index of the sector in which the building is located.
int GetCurrentHP () const
get current building health
int GetMaxHP () const
get maximum building health
uint8 GetAssignedWorkers () const
get number of workers currently assigned to this building
void AssignWorkers (const uint8 _uNumWorkers)
assign the given number of workers to this building
void Charge (const int _iChargePoints)
modify charge value of a charge type building
bool IsActive () const
is the building currently active? (assignments can be given by the player)
void SetActive (const bool _bActive)
set whether the player can give assignments to the building
bool CanBeUsedByAllFactions () const
can the building be used by all factions?
void SetUsableByAllFactions (const bool _bUsable)
set whether the building is allowed to be used by all factions
bool CheckCustomState (const EBuildingCustomState _State) const
check whether the given custom building state is currently active
void SetCustomState (const EBuildingCustomState _State, const bool _bValue)
set the given custom building state
bool Damage (const EDamageType _DamageType, const uint _uAmount)
damage the building for _uAmount HP of the given damage type, returns true if destroyed
void Destroy ()
immediately destroy the building
uint GetResources (const EResource _Type) const
get the amount of resources of _Type currently in the building's production store.
uint GetResourceCapacity (const EResource _Type) const
get the maximum amount of resources of _Type which the building can store in its production store.
uint AddResources (const EResource _Type, const uint _uAmount)
add _uAmount resources of _Type to the building's production store. returns the actual amount of resources added.
uint RemoveResources (const EResource _Type, const uint _uAmount)
remove _uAmount resources of _Type from the building's production store. returns the actual amount of resources removed.
uint Upgrade (const LevelReference@ _Level, const string&in _sDescriptionName, const bool _bInstant = false)
upgrade the building to the given description
Building& operator= (const Building&in)
bool operator== (const Building&in)
bool operator== (const Entity&in)
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
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 IsSelectable () const
can the entity (theoretically) be selected by the player?
void SetSelectable (const bool _bSelectable)
set whether the entity can be selected by the player

(note that depending on the type of entity, there may be additional checks preventing the entity from being selected)

bool IsBusy () const
is the entity currently marked as busy?
void SetBusy (const bool _bBusy)
mark the entity as busy
void SetInspectionText (const uint _uTextId)
make the entity inspectable and set the text to be displayed upon inspection
bool CanBeAttacked () const
can the entity be attacked?
void SetAttackable (const bool _bAttackable)
set whether the entity can be attacked
Entity opImplConv () const

class Building

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

Inherits from: Entity

Class Methods

string GetDescriptionName () const
get building description name
EBuildingType GetBuildingType () const
get building type
EBuildingStage GetStage () const
get current building stage
uint16 GetSectorIndex () const
get index of the sector in which the building is located.
int GetCurrentHP () const
get current building health
int GetMaxHP () const
get maximum building health
uint8 GetAssignedWorkers () const
get number of workers currently assigned to this building
void AssignWorkers (const uint8 _uNumWorkers)
assign the given number of workers to this building
void Charge (const int _iChargePoints)
modify charge value of a charge type building
bool IsActive () const
is the building currently active? (assignments can be given by the player)
void SetActive (const bool _bActive)
set whether the player can give assignments to the building
bool CanBeUsedByAllFactions () const
can the building be used by all factions?
void SetUsableByAllFactions (const bool _bUsable)
set whether the building is allowed to be used by all factions
bool CheckCustomState (const EBuildingCustomState _State) const
check whether the given custom building state is currently active
void SetCustomState (const EBuildingCustomState _State, const bool _bValue)
set the given custom building state
bool Damage (const EDamageType _DamageType, const uint _uAmount)
damage the building for _uAmount HP of the given damage type, returns true if destroyed
void Destroy ()
immediately destroy the building
uint GetResources (const EResource _Type) const
get the amount of resources of _Type currently in the building's production store.
uint GetResourceCapacity (const EResource _Type) const
get the maximum amount of resources of _Type which the building can store in its production store.
uint AddResources (const EResource _Type, const uint _uAmount)
add _uAmount resources of _Type to the building's production store. returns the actual amount of resources added.
uint RemoveResources (const EResource _Type, const uint _uAmount)
remove _uAmount resources of _Type from the building's production store. returns the actual amount of resources removed.
uint Upgrade (const LevelReference@ _Level, const string&in _sDescriptionName, const bool _bInstant = false)
upgrade the building to the given description
Building& operator= (const Building&in)
bool operator== (const Building&in)
bool operator== (const Entity&in)
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
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 IsBusy () const
is the entity currently marked as busy?
void SetBusy (const bool _bBusy)
mark the entity as busy
void SetInspectionText (const uint _uTextId)
make the entity inspectable and set the text to be displayed upon inspection
bool CanBeAttacked () const
can the entity be attacked?
void SetAttackable (const bool _bAttackable)
set whether the entity can be attacked
Entity opImplConv () const