EnergyCheck

Category: Objects / Status
Since engine version: 4.6.5.0 CP

Description

Returns whether an object's energy value is greater than or equal to the specified level. If the game rule "Energy Usage" is not enabled, this function always returns true. Otherwise, this call will also create an energy demand which will cause connected energy lines to transfer energy into this object.

Syntax

bool EnergyCheck (int iEnergy, object pObj);

Parameters

iEnergy:
Requested energy value
pObj:
[opt] Object of which to determine the energy value. Can be 0 in local calls.

Example

if(EnergyCheck(10000)) { DoEnergy(-10000); SetAction("Working"); }
Starts the activity "Working" if sufficient energy is available.
See also: CheckEnergyNeedChain, DoEnergy, GetEnergy
Sven2, November 2001