Nuclide
Software Development Kit for id Tech

MapC/Shared Game-Logic API. More...

Functions

entity spawnClass (string className, vector desiredPos)
 Spawns an entity of a specific class. More...
 
void sendInput (entity target, string inputName, string dataString, entity activator)
 Sends an input (See NSIO::Input) to an entity. More...
 
void entityDamage (entity targetEnt, entity inflictingEnt, entity attackingEnt, string damageDef, string weaponDef, vector damageOrigin, vector damageDir, vector hitLocation)
 Applies damage to a given entity. More...
 
void radiusDamage (vector damageCenter, float damageRange, int damageMin, int damageMax, entity attackingEnt)
 Does damage to all entities within a specified radius with a linear falloff. More...
 
bool isAI (entity entityToCheck)
 Returns true/false depending on if the entity is an AI character. More...
 
bool isAlive (entity entityToCheck)
 Returns true/false depending on if the entity is alive. More...
 
bool isGodMode (entity entityToCheck)
 Returns true/false depending on if the entity is in "god" mode. More...
 
bool isPlayer (entity entityToCheck)
 Returns true/false depending on if the entity is a player. More...
 
bool isSentient (entity entityToCheck)
 Returns true/false depending on if the entity is either a player, or AI character. More...
 
bool isBot (entity entityToCheck)
 Returns true/false depending on if the entity is a bot. More...
 
string timeToString (int realTime, int zoneType, string formatString)
 Returns the current time. More...
 

Detailed Description

MapC/Shared Game-Logic API.

APIs used by MapC progs and the server progs exclusively.

Function Documentation

◆ entityDamage()

void entityDamage ( entity  targetEnt,
entity  inflictingEnt,
entity  attackingEnt,
string  damageDef,
string  weaponDef,
vector  damageOrigin,
vector  damageDir,
vector  hitLocation 
)

Applies damage to a given entity.

Requires the use of damageDef/entityDef since we're run out of parameters in QuakeC.

Parameters
targetEntis the entity receiving the damage.
inflictingEntis the entity causing the damage (e.g. a projectile, rocket)
attackingEntis the entity owning up to the damage.
damageDefis the damageDef containing all the info, including damage points
weaponDefis (if not "") the name of the weapon causing the damage.
damageOriginis the location where the damage comes from.
damageDiris the direction the damage is coming from.
hitLocationis the final hit location, where the damage is applied.

◆ isAI()

bool isAI ( entity  entityToCheck)

Returns true/false depending on if the entity is an AI character.

Parameters
entityToCheckspecifies the entity to check.

◆ isAlive()

bool isAlive ( entity  entityToCheck)

Returns true/false depending on if the entity is alive.

Parameters
entityToCheckspecifies the entity to check.

◆ isBot()

bool isBot ( entity  entityToCheck)

Returns true/false depending on if the entity is a bot.

Parameters
entityToCheckspecifies the entity to check.

◆ isGodMode()

bool isGodMode ( entity  entityToCheck)

Returns true/false depending on if the entity is in "god" mode.

Parameters
entityToCheckspecifies the entity to check.

◆ isPlayer()

bool isPlayer ( entity  entityToCheck)

Returns true/false depending on if the entity is a player.

Parameters
entityToCheckspecifies the entity to check.

◆ isSentient()

bool isSentient ( entity  entityToCheck)

Returns true/false depending on if the entity is either a player, or AI character.

Parameters
entityToCheckspecifies the entity to check.

◆ radiusDamage()

void radiusDamage ( vector  damageCenter,
float  damageRange,
int  damageMin,
int  damageMax,
entity  attackingEnt 
)

Does damage to all entities within a specified radius with a linear falloff.

If a negative damageMax value is supplied, then no collision checks will be performed. So radiusDamage calls will not be obstructed by level or entity geometry.

Parameters
damageCenteris the location of the center, at which the wave originates.
damageRangeis the radius (in game units) of the wave.
damageMaxis the maximum damage that can be done by this wave.
damageMinis the minimum amount of damage done, at the very edge.
attackingEntis the entity owning up to the damage.

◆ sendInput()

void sendInput ( entity  target,
string  inputName,
string  dataString,
entity  activator 
)

Sends an input (See NSIO::Input) to an entity.

While you're able to manipulate entities in most ways using bare MapC, you might want to change Nuclide specific attributes of them as well. This can only be done using the I/O system.

For the variety of inputs an entity supports, please look at the respective entity-specific documentation.

Parameters
targetis the entity which will receive the input
inputNameis the name of the input. E.g. "SetOrigin"
dataStringcontains parameters for the input. E.g. "0 0 0"
activatorreferences which entity is "responsible" for triggering this input.

◆ spawnClass()

entity spawnClass ( string  className,
vector  desiredPos 
)

Spawns an entity of a specific class.

Returns a new entity.

This is the primary, encouraged method of spawning entities in MapC. If you don't spawn an entity class using this, it will not respond to sendInput().

If a specified class does not exist, it will create an info_notnull type entity, but with the new, desired classname.

The only time when this function returns NULL is if the server is unable to allocated any more entities.

Parameters
classNameis the type of class to be instantiated.
desiredPosis the world position at which the new entity will be placed.

◆ timeToString()

string timeToString ( int  realTime,
int  zoneType,
string  formatString 
)

Returns the current time.

Parameters
realTimespecifies the time in seconds since 01/01/1970.
zoneTypespecifies the time zone to use. 0 = UTC, 1 = Local.
formatStringis a C-language, strftime styled string setting the output format
Returns
Euler-angles generated from the input.