Difference between revisions of "Script/ResourceDeposit"

From SF3
Jump to: navigation, search
(Created page with "==class ResourceDeposit== === Class Methods === {| border='0' style ='border:solid 1px #eeeedd; color: black; width: 1200px;background-color: #ffffcc;' cellspacing='0' cellpa...")
 
Line 1: Line 1:
 
==class ResourceDeposit==
 
==class ResourceDeposit==
 +
Represents a reference to a resource deposit in the game world.
 +
An instance of this class acts like a weak pointer to an existing resource deposit in the game world and provides an interface to interact
 +
with it.
 +
Before interacting with the resource deposit, you should call Exists() in order to check if the resource deposit actually (still) exists.
 +
IMPORTANT: This class must NOT be stored as a class member. If you want to store the resource deposit for later reference, store the id
 +
obtained by GetId instead. You can then later retrieve the resource deposit from the LevelReference class by calling GetResourceDepositById. 
  
 +
'''Inherits from:''' [[../Entity|Entity]]
 
=== Class Methods ===
 
=== Class Methods ===
 
{| border='0' style ='border:solid 1px #eeeedd; color: black; width: 1200px;background-color: #ffffcc;' cellspacing='0' cellpadding='7'
 
{| border='0' style ='border:solid 1px #eeeedd; color: black; width: 1200px;background-color: #ffffcc;' cellspacing='0' cellpadding='7'
Line 7: Line 14:
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetResourceType''' () const
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetResourceType''' () const
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''get resource type name''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetCurrent''' () const
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetCurrent''' () const
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''get current amount of resource units in the deposit''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetCapacity''' () const
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetCapacity''' () const
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''get maximum amount of resources in the deposit''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''AddResources''' (const [[../BasicDataTypes|uint]] ''_uAmount'')
 
| style='color: black; width: 90%; line-height: 0.8;' | '''AddResources''' (const [[../BasicDataTypes|uint]] ''_uAmount'')
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''add _uAmount resource units to the deposit (this will automatically be capped at the deposit's capacity).''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''RemoveResources''' (const [[../BasicDataTypes|uint]] ''_uAmount'')
 
| style='color: black; width: 90%; line-height: 0.8;' | '''RemoveResources''' (const [[../BasicDataTypes|uint]] ''_uAmount'')
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''remove _uAmount resources units from the deposit (can not go below 0)''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../ResourceDeposit|ResourceDeposit]]&  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../ResourceDeposit|ResourceDeposit]]&  
Line 39: Line 56:
 
| style='color: black; width: 90%; line-height: 0.8;' | '''Exists''' () const
 
| style='color: black; width: 90%; line-height: 0.8;' | '''Exists''' () const
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''does the entity actually exist? (always check this before doing anything with the entity!)''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetId''' () const
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetId''' () const
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''get persistent entity id, use this to save the entity for later reference.''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint8]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|uint8]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetFaction''' () const
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetFaction''' () const
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''get owner faction''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''SetFaction''' (const [[../BasicDataTypes|uint8]] ''_Faction'')
 
| style='color: black; width: 90%; line-height: 0.8;' | '''SetFaction''' (const [[../BasicDataTypes|uint8]] ''_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;' | [[../BasicDataTypes|string]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetEntityType''' () const
 
| style='color: black; width: 90%; line-height: 0.8;' | '''GetEntityType''' () const
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''get entity type name''
 
|-
 
|-
 
| 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]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''IsEnabled''' () const
 
| style='color: black; width: 90%; line-height: 0.8;' | '''IsEnabled''' () const
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''whether the entity is currently enabled (i.e. is visible in the game world)''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''Enable''' (const [[../BasicDataTypes|bool]] ''_bEnabled'')
 
| style='color: black; width: 90%; line-height: 0.8;' | '''Enable''' (const [[../BasicDataTypes|bool]] ''_bEnabled'')
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''enabled or disable the entity''
 
|-
 
|-
 
| 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]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''IsInteractive''' () const
 
| style='color: black; width: 90%; line-height: 0.8;' | '''IsInteractive''' () const
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''can the entity be interacted with?''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''SetInteractive''' (const [[../BasicDataTypes|bool]] ''_bInteractive'')
 
| style='color: black; width: 90%; line-height: 0.8;' | '''SetInteractive''' (const [[../BasicDataTypes|bool]] ''_bInteractive'')
 
|-
 
|-
 +
|
 +
| 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: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''CanBeAttacked''' () const
 
| style='color: black; width: 90%; line-height: 0.8;' | '''CanBeAttacked''' () const
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''can the entity be attacked?''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
 
| style='color: black; width: 90%; line-height: 0.8;' | '''SetAttackable''' (const [[../BasicDataTypes|bool]] ''_bAttackable'')
 
| style='color: black; width: 90%; line-height: 0.8;' | '''SetAttackable''' (const [[../BasicDataTypes|bool]] ''_bAttackable'')
 
|-
 
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''set whether the entity can be attacked''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../Entity|Entity]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../Entity|Entity]]  

Revision as of 09:01, 1 September 2016

class ResourceDeposit

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

Inherits from: Entity

Class Methods

string GetResourceType () const
get resource type name
uint GetCurrent () const
get current amount of resource units in the deposit
uint GetCapacity () const
get maximum amount of resources in the deposit
uint AddResources (const uint _uAmount)
add _uAmount resource units to the deposit (this will automatically be capped at the deposit's capacity).
uint RemoveResources (const uint _uAmount)
remove _uAmount resources units from the deposit (can not go below 0)
ResourceDeposit& operator= (const ResourceDeposit&in)
bool operator== (const ResourceDeposit&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
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
Entity opImplConv () const

class ResourceDeposit

Class Methods

string GetResourceType () const
uint GetCurrent () const
uint GetCapacity () const
uint AddResources (const uint _uAmount)
uint RemoveResources (const uint _uAmount)
ResourceDeposit& operator= (const ResourceDeposit&in)
bool operator== (const ResourceDeposit&in)
bool operator== (const Entity&in)
bool Exists () const
uint GetId () const
uint8 GetFaction () const
void SetFaction (const uint8 _Faction)
string GetEntityType () const
bool IsEnabled () const
void Enable (const bool _bEnabled)
bool IsInteractive () const
void SetInteractive (const bool _bInteractive)
bool CanBeAttacked () const
void SetAttackable (const bool _bAttackable)
Entity opImplConv () const