Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Attributes | List of all members
dp88_Ore_Field Class Reference

Ore Field. More...

#include <dp88_ar.h>

Classes

class  dp88_Ore_Field_Observer
 

Public Member Functions

void AddOre (unsigned int nUnits)
 
unsigned int RemoveOre (unsigned int nUnits=1)
 
unsigned int NumOreUnits ()
 
unsigned int GetOreValue ()
 
bool IsInfinite ()
 
bool IsSuitableForAI ()
 

Protected Attributes

unsigned int m_myObjId
 My own GameObject ID, used by the zone observer callbacks.
 
Cached Script Parameters

Detailed Description

Author
Daniel Paul (danpa.nosp@m.ul88.nosp@m.@yaho.nosp@m.o.co.nosp@m..uk)

Attach this script to an object which represents an ore (or gem) field on the map, or to a Daves arrow if you do not want animation support for growing / shrinking the field. A script zone will be created at the center of this object (it's local 0,0,0 position) which defines the area miners must enter to be considered 'inside' the ore field. This zone can grow and shrink with the ore field animation if desired.

If you attach this to a script zone directly, it will use that zone instead of spawning a new zone.

Used on it's own this script can either create an ore field with infinite capacity or one which is gradually depleted until it is empty. If you want the ore field to re-grow you must add one or more objects with the dp88_Ore_Extractor script attached.

To visually show the current size of an ore field you can use an animation on the object this script is attached to which will animate from the full frame to an empty frame as the field is depleted. If an ore extractor is present it will also animate in reverse as the field is refilled.

Precondition
A preset with the name "Script_Zone_All" must exist to allow the miner zone to be created. This preset should have CheckStarsOnly disabled to allow AI miners to use this ore field
Parameters
Ore_ValueThe value of each unit of 'ore' mined from this field. Multiply this by the capacity of a miner to get the total credits per dump from a fully loaded miner.
Ore_CapacityThe maximum capacity of this ore field, in units. Set this to 0 to create an infinite ore field which never shrinks or grows.
Ore_UnitsIf Ore_Capacity is not 0 this defines the number of units in the ore field when it is created
Animation_NameThe name of an animation containing the frames to show ore capacity
Animation_Full_FrameThe frame number for the ore field when it is at maximum capacity
Animation_Empty_FrameThe frame number for the ore field when it is empty
Zone_SizeThe size of the zone which miners must enter to mine ore from this field. This size is used when the field is at maximum capacity. When the zone is empty the zone will despawn.
Zone_Anim_Step_XHow much to shrink the miner zone in the X axis by for each frame in the animation
Zone_Anim_Step_YHow much to shrink the miner zone in the Y axis by for each frame in the animation
AI_IgnoreThe name of the resource field (defaults to ore if none is specified)

Member Function Documentation

◆ AddOre()

void dp88_Ore_Field::AddOre ( unsigned int nUnits)

Add one or more units of ore to this field, if there is additional capacity available

Parameters
[in]nUnitsNumber of ore units to be added

◆ GetOreValue()

unsigned int dp88_Ore_Field::GetOreValue ( )
inline

Get the value of the ore in this field

◆ IsInfinite()

bool dp88_Ore_Field::IsInfinite ( )
inline

Check if this ore field is infinite

◆ IsSuitableForAI()

bool dp88_Ore_Field::IsSuitableForAI ( )
inline

Check if the AI miners can use this field

◆ NumOreUnits()

unsigned int dp88_Ore_Field::NumOreUnits ( )
inline

Check the number of ore units currently available in this field

Returns
Number of ore units available in this field, or 0 if this field has infinite capacity

◆ RemoveOre()

unsigned int dp88_Ore_Field::RemoveOre ( unsigned int nUnits = 1)

Attempt to remove one or more units of ore from this field, if they are available

Parameters
[in]nUnitsNumber of ore units to try and remove
Returns
Number of units actually removed, which will be <= nUnits