Nuclide
Software Development Kit for id Technology (BETA)
api_func.h
1.float deaths;
2
29typedef struct
30{
37 string TimeToString(int realTime, int zoneType, string formatString);
38} utilAPI_t;
42typedef struct
43{
48 bool InMap(string className);
54 bool InPVS(entity lookingEntity, vector visiblePosition);
59 bool InVFS(string fileName);
64typedef struct
65{
73 entity Create(string className, vector spawnPos);
79 float ChangeToClass(entity targetEntity, string className);
90 void Input(entity target, string inputName, string dataString, entity activator);
91} entsAPI_t;
95typedef struct
96{
98 void LoadNextMap(void);
100 void CleanUpMap(void);
104 string GetMap(void);
108 string GetNextMap(void);
111 void SetSpawnPoint(string spawnPointClass);
114 void TeleportToSpawn(entity teleportingEntity);
118 entity FindRandomClassObject(string entityClassName);
119} gameAPI_t;
123typedef struct
124{
126 void LoadDefault(void);
130 void LoadFromFile(string);
131} motdAPI_t;
135typedef struct
136{
139 string GetInventory(entity targetActor);
142 bool HasItem(entity targetActor, string itemClass);
147 int GetReserveAmmo(entity targetActor, int ammoType);
152 bool MaxAmmo(entity targetActor, int ammoType);
155 int TotalActors(void);
159 int TotalActorsOnTeam(int teamID);
160
161 float AimAtPos(entity, vector);
162 float MoveToPos(entity, vector);
163 bool CanSee(entity, entity);
164 bool CanShoot(entity, vector, vector);
166 entity FindCoverNode(entity);
167} actorAPI_t;
171typedef struct
172{
183 void Damage(entity targetEnt, entity inflictingEnt, entity attackingEnt, string damageDef, vector damageOrigin, vector damageDir, vector hitLocation);
194 void RadiusDamage(vector damageCenter, float damageRange, int damageMin, int damageMax, entity attackingEnt, string damageDef);
201 void Obituary(string targetName, string attackerName, string weaponDef, string meansOfDeath);
203var combatAPI_t combat; // end of multiprogs
206
207__variant
208linkToServerProgs(string funcName)
209{
210 static void empty(void)
211 {
212 print("Called unimplemented server-side API call.\n");
213 breakpoint();
214 }
215
216 void *func = externvalue(0, funcName);
217
218 if (func) {
219 return ((__variant)func);
220 } else {
221 return (empty);
222 }
223}
224
225void
226_server_main(void)
227{
228 game.LoadNextMap = linkToServerProgs("SVPF_game_LoadNextMap");
229 game.CleanUpMap = linkToServerProgs("SVPF_game_CleanUpMap");
230 game.GetMap = linkToServerProgs("SVPF_game_GetMap");
231 game.GetNextMap = linkToServerProgs("SVPF_game_GetNextMap");
232 game.SetSpawnPoint = linkToServerProgs("SVPF_game_SetSpawnPoint");
233 game.TeleportToSpawn = linkToServerProgs("SVPF_game_TeleportToSpawn");
234 game.FindRandomClassObject = linkToServerProgs("Spawn_SelectRandom");
235
236 combat.Damage = linkToServerProgs("SVPF_combat_Damage");
237 combat.RadiusDamage = linkToServerProgs("SVPF_combat_RadiusDamage");
238 combat.Obituary = linkToServerProgs("SVPF_combat_Obituary");
239
240 ents.Create = linkToServerProgs("SVPF_ents_Create");
241 ents.ChangeToClass = linkToServerProgs("SVPF_ents_ChangeToClass");
242 ents.Input = linkToServerProgs("SVPF_ents_Input");
243
244 actor.GetInventory = linkToServerProgs("SVPF_actor_GetInventory");
245 actor.GetReserveAmmo = linkToServerProgs("SVPF_actor_GetReserveAmmo");
246 actor.MaxAmmo = linkToServerProgs("SVPF_actor_MaxAmmo");
247 actor.TotalActors = linkToServerProgs("SVPF_actor_TotalActors");
248 actor.TotalActorsOnTeam = linkToServerProgs("SVPF_actor_TotalActorsOnTeam");
249 actor.MoveToPos = linkToServerProgs("SVPF_actor_MoveToPos");
250 actor.HasItem = linkToServerProgs("SVPF_actor_HasItem");
251
252 exists.InMap = linkToServerProgs("SVPF_exists_InMap");
253 exists.InVFS = linkToServerProgs("SVPF_exists_InVFS");
254 exists.InPVS = linkToServerProgs("SVPF_exists_InPVS");
255
256 motd.LoadDefault = linkToServerProgs("MOTD_LoadDefault");
257 motd.LoadFromFile = linkToServerProgs("MOTD_LoadFromFile");
258
259 util.TimeToString = linkToServerProgs("SVPF_util_TimeToString");
260}
var motdAPI_t motd
Access motdAPI_t functions using this variable.
Definition: api_func.h:132
var existsAPI_t exists
Access existsAPI_t functions using this variable.
Definition: api_func.h:61
var gameAPI_t game
Access gameAPI_t functions using this variable.
Definition: api_func.h:120
var utilAPI_t util
Access utilAPI_t functions using this variable.
Definition: api_func.h:39
var combatAPI_t combat
Access combatAPI_t functions using this variable.
Definition: api_func.h:203
var entsAPI_t ents
Access entsAPI_t functions using this variable.
Definition: api_func.h:92
var actorAPI_t actor
Access actorAPI_t functions using this variable.
Definition: api_func.h:168
MOTD library.
Definition: api_func.h:136
entity FindCoverNode(entity)
float AimAtPos(entity, vector)
int GetReserveAmmo(entity targetActor, int ammoType)
Returns the amount of reserve ammo of a given ammo type ID.
bool HasItem(entity targetActor, string itemClass)
Returns whether an item class exists in an actor's inventory.
bool CanShoot(entity, vector, vector)
int TotalActorsOnTeam(int teamID)
Returns the current amount of actors in the game, on a specific team.
bool CanSee(entity, entity)
string GetInventory(entity targetActor)
Returns a tokenizable string containing a list of inventory items of a specified actor (this includes...
float MoveToPos(entity, vector)
int TotalActors(void)
Returns the current amount of actors in the game.
bool MaxAmmo(entity targetActor, int ammoType)
Returns the amount of maximum ammo of a given ammo type ID.
bool ClearEnemy()
Combat library.
Definition: api_func.h:172
void Obituary(string targetName, string attackerName, string weaponDef, string meansOfDeath)
Lets everyone in the game know that something, or something, has passed.
void Damage(entity targetEnt, entity inflictingEnt, entity attackingEnt, string damageDef, vector damageOrigin, vector damageDir, vector hitLocation)
Applies damage to a given entity.
void RadiusDamage(vector damageCenter, float damageRange, int damageMin, int damageMax, entity attackingEnt, string damageDef)
Does damage to all entities within a specified radius with a linear falloff.
Ents library.
Definition: api_func.h:65
void Input(entity target, string inputName, string dataString, entity activator)
Sends an input (See ncIO::Input) to an entity.
entity Create(string className, vector spawnPos)
Creates a new entity of a given class name.
float ChangeToClass(entity targetEntity, string className)
Transitions an entity from one class to another.
Exists library.
Definition: api_func.h:43
bool InVFS(string fileName)
Check whether a file is present in the virtual filesystem.
bool InMap(string className)
Check whether a named entity class exists in the current map/level.
bool InPVS(entity lookingEntity, vector visiblePosition)
Check whether an entity is within a PVS - if it is visible from a certain location and vice-versa.
Game library.
Definition: api_func.h:96
void CleanUpMap(void)
Removed any temporary game entities from the game, and resets the state of the level to the default s...
void TeleportToSpawn(entity teleportingEntity)
Teleports an entity to their ideal spawn-point.
void LoadNextMap(void)
Force loads the next map/level in the rotation.
string GetMap(void)
Returns the name of the map/level.
void SetSpawnPoint(string spawnPointClass)
Sets the default spawn-point class to custom one.
string GetNextMap(void)
Returns the name of the next map/level in the rotation.
entity FindRandomClassObject(string entityClassName)
Return a random instance of a specified entity class.
MOTD library.
Definition: api_func.h:124
void LoadFromFile(string)
Loads a text file as an input for a message of the day.
void LoadDefault(void)
Loads the message of the day from the default location: <gamedir>/motd.txt
Util library.
Definition: api_func.h:30
string TimeToString(int realTime, int zoneType, string formatString)
Returns the current time.