Nuclide
Software Development Kit for id Tech
mapC.h File Reference

Go to the source code of this file.

Macros

#define QWSSQC
 
#define entity_def(x, ...)   const string x[] = { __VA_ARGS__ }
 
#define thread(x)   if (fork()) { x; abort(); }
 Calls a function (with parameters) in a new thread. 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 radiusDamage (vector position, float radius, int maxDamage, int minDamage, optional entity attacker)
 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...
 

Macro Definition Documentation

◆ entity_def

#define entity_def (   x,
  ... 
)    const string x[] = { __VA_ARGS__ }

◆ QWSSQC

#define QWSSQC

◆ thread

#define thread (   x)    if (fork()) { x; abort(); }

Calls a function (with parameters) in a new thread.

Function Documentation

◆ 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.

◆ 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  position,
float  radius,
int  maxDamage,
int  minDamage,
optional entity  attacker 
)

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

Parameters
positionspecifies the position at which the damage event occurs.
radiusspecifies the radius in game units.
maxDamagethe maximum amount of damage this event can do.
minDamagethe damage done to the entities on the outer-most rim of the radius.
attacker(optional) the source of the attack, defaults to world

◆ 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.

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.