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
92
104 void InputDelayed(entity target, string inputName, string dataString, entity activator, float delayInSeconds);
105} entsAPI_t;
109typedef struct
110{
112 void EndMap(void);
114 void EndMapDelayed(float);
116 void LoadNextMap(void);
118 void CleanUpMap(void);
122 string GetMap(void);
126 string GetNextMap(void);
129 void SetSpawnPoint(string spawnPointClass);
132 void TeleportToSpawn(entity teleportingEntity);
136 entity FindRandomClassObject(string entityClassName);
137} gameAPI_t;
141typedef struct
142{
144 void LoadDefault(void);
148 void LoadFromFile(string);
149} motdAPI_t;
153typedef struct
154{
157 string GetInventory(entity targetActor);
160 bool HasItem(entity targetActor, string itemClass);
165 int GetReserveAmmo(entity targetActor, int ammoType);
170 bool MaxAmmo(entity targetActor, int ammoType);
173 int TotalActors(void);
177 int TotalActorsOnTeam(int teamID);
178
182 string CurrentWeapon(entity targetActor);
183
187 entity DropItem(entity targetActor, string namedItem);
188
189 float AimAtPos(entity, vector);
190 float MoveToPos(entity, vector);
191 bool CanSee(entity, entity);
192 bool CanShoot(entity, vector, vector);
194 entity FindCoverNode(entity);
195} actorAPI_t;
199typedef struct
200{
201 void Stop(void);
202 void StopOnClient(entity);
203 void Play(musictrack_t);
204 void PlayOnce(musictrack_t);
205 void PlayOnClient(musictrack_t, entity);
206 void PlayOnceOnClient(musictrack_t, entity);
207} musicAPI_t;
211typedef struct
212{
223 void Damage(entity targetEnt, entity inflictingEnt, entity attackingEnt, string damageDef, vector damageOrigin, vector damageDir, vector hitLocation);
234 void RadiusDamage(vector damageCenter, float damageRange, int damageMin, int damageMax, entity attackingEnt, string damageDef);
241 void Obituary(string targetName, string attackerName, string weaponDef, string meansOfDeath);
243var combatAPI_t combat; // end of multiprogs
246
247
249typedef struct
250{
255 string GetString(string serverKey);
260 int GetInteger(string serverKey);
265 float GetFloat(string serverKey);
270 bool GetBool(string serverKey);
275 vector GetVector(string serverKey);
280 void SetString(string serverKey, string setValue);
285 void SetInteger(string serverKey, int setValue);
290 void SetBool(string serverKey, bool setValue);
295 void SetFloat(string serverKey, float setValue);
300 void SetVector(string serverKey, vector setValue);
302
303localinfoAPI_t localinfo;
305__variant
306linkToServerProgs(string funcName)
307{
308 static void empty(void)
309 {
310 print("Called unimplemented server-side API call.\n");
311 breakpoint();
312 }
313
314 void *func = externvalue(0, funcName);
315
316 if (func) {
317 return ((__variant)func);
318 } else {
319 return (empty);
320 }
321}
322
323void
324_server_main(void)
325{
326 game.EndMap = linkToServerProgs("SVPF_game_EndMap");
327 game.EndMapDelayed = linkToServerProgs("SVPF_game_EndMapDelayed");
328 game.LoadNextMap = linkToServerProgs("SVPF_game_LoadNextMap");
329 game.CleanUpMap = linkToServerProgs("SVPF_game_CleanUpMap");
330 game.GetMap = linkToServerProgs("SVPF_game_GetMap");
331 game.GetNextMap = linkToServerProgs("SVPF_game_GetNextMap");
332 game.SetSpawnPoint = linkToServerProgs("SVPF_game_SetSpawnPoint");
333 game.TeleportToSpawn = linkToServerProgs("SVPF_game_TeleportToSpawn");
334 game.FindRandomClassObject = linkToServerProgs("Spawn_SelectRandom");
335
336 combat.Damage = linkToServerProgs("SVPF_combat_Damage");
337 combat.RadiusDamage = linkToServerProgs("SVPF_combat_RadiusDamage");
338 combat.Obituary = linkToServerProgs("SVPF_combat_Obituary");
339
340 localinfo.SetString = linkToServerProgs("SVPF_localinfo_SetString");
341 localinfo.SetBool = linkToServerProgs("SVPF_localinfo_SetBool");
342 localinfo.SetInteger = linkToServerProgs("SVPF_localinfo_SetInteger");
343 localinfo.SetFloat = linkToServerProgs("SVPF_localinfo_SetFloat");
344 localinfo.SetVector = linkToServerProgs("SVPF_localinfo_SetVector");
345 localinfo.GetString = linkToServerProgs("SVPF_localinfo_GetString");
346 localinfo.GetInteger = linkToServerProgs("SVPF_localinfo_GetInteger");
347 localinfo.GetBool = linkToServerProgs("SVPF_localinfo_GetBool");
348 localinfo.GetFloat = linkToServerProgs("SVPF_localinfo_GetFloat");
349 localinfo.GetVector = linkToServerProgs("SVPF_localinfo_GetVector");
350
351 ents.Create = linkToServerProgs("SVPF_ents_Create");
352 ents.ChangeToClass = linkToServerProgs("SVPF_ents_ChangeToClass");
353 ents.Input = linkToServerProgs("SVPF_ents_Input");
354 ents.InputDelayed = linkToServerProgs("SVPF_ents_InputDelayed");
355
356 actor.GetInventory = linkToServerProgs("SVPF_actor_GetInventory");
357 actor.GetReserveAmmo = linkToServerProgs("SVPF_actor_GetReserveAmmo");
358 actor.MaxAmmo = linkToServerProgs("SVPF_actor_MaxAmmo");
359 actor.TotalActors = linkToServerProgs("SVPF_actor_TotalActors");
360 actor.TotalActorsOnTeam = linkToServerProgs("SVPF_actor_TotalActorsOnTeam");
361 actor.MoveToPos = linkToServerProgs("SVPF_actor_MoveToPos");
362 actor.HasItem = linkToServerProgs("SVPF_actor_HasItem");
363 actor.CurrentWeapon = linkToServerProgs("SVPF_actor_CurrentWeapon");
364 actor.DropItem = linkToServerProgs("SVPF_actor_DropItem");
365
366 music.Stop = linkToServerProgs("SVPF_music_Stop");
367 music.StopOnClient = linkToServerProgs("SVPF_music_StopOnClient");
368 music.Play = linkToServerProgs("SVPF_music_Play");
369 music.PlayOnce = linkToServerProgs("SVPF_music_PlayOnce");
370 music.PlayOnClient = linkToServerProgs("SVPF_music_PlayOnClient");
371 music.PlayOnceOnClient = linkToServerProgs("SVPF_music_PlayOnceOnClient");
372
373 exists.InMap = linkToServerProgs("SVPF_exists_InMap");
374 exists.InVFS = linkToServerProgs("SVPF_exists_InVFS");
375 exists.InPVS = linkToServerProgs("SVPF_exists_InPVS");
376
377 motd.LoadDefault = linkToServerProgs("MOTD_LoadDefault");
378 motd.LoadFromFile = linkToServerProgs("MOTD_LoadFromFile");
379
380 util.TimeToString = linkToServerProgs("SVPF_util_TimeToString");
381}
var motdAPI_t motd
Access motdAPI_t functions using this variable.
Definition: api_func.h:150
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:138
var utilAPI_t util
Access utilAPI_t functions using this variable.
Definition: api_func.h:39
var musicAPI_t music
Access musicAPI_t functions using this variable.
Definition: api_func.h:208
var combatAPI_t combat
Access combatAPI_t functions using this variable.
Definition: api_func.h:243
var entsAPI_t ents
Access entsAPI_t functions using this variable.
Definition: api_func.h:106
var actorAPI_t actor
Access actorAPI_t functions using this variable.
Definition: api_func.h:196
Actor library.
Definition: api_func.h:154
entity FindCoverNode(entity)
float AimAtPos(entity, vector)
string CurrentWeapon(entity targetActor)
Returns the current weapon of the referenced actor in string form param targetActor is the actor to q...
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()
entity DropItem(entity targetActor, string namedItem)
Asks the actor to drop a named item.
Combat library.
Definition: api_func.h:212
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 InputDelayed(entity target, string inputName, string dataString, entity activator, float delayInSeconds)
Sends a delayed input (See ncIO::Input) to an entity.
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:110
void CleanUpMap(void)
Removed any temporary game entities from the game, and resets the state of the level to the default s...
void EndMapDelayed(float)
Ends the current map in the specified number of seconds.
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.
void EndMap(void)
Ends the current map.
entity FindRandomClassObject(string entityClassName)
Return a random instance of a specified entity class.
LocalInfo library.
Definition: api_func.h:250
int GetInteger(string serverKey)
Returns the integer value of a server local (hidden-from-clients) info-key.
void SetInteger(string serverKey, int setValue)
Server only.
float GetFloat(string serverKey)
Returns the floating-point value of a server local (hidden-from-clients) info-key.
void SetFloat(string serverKey, float setValue)
Server only.
void SetString(string serverKey, string setValue)
Server only.
void SetBool(string serverKey, bool setValue)
Server only.
string GetString(string serverKey)
Returns the string value of a server local (hidden-from-clients) info-key.
void SetVector(string serverKey, vector setValue)
Server only.
bool GetBool(string serverKey)
Returns the boolean value of a server local (hidden-from-clients) info-key.
vector GetVector(string serverKey)
Returns the vector value of a server local (hidden-from-clients) info-key.
MOTD library.
Definition: api_func.h:142
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
Music library.
Definition: api_func.h:200
void Play(musictrack_t)
void PlayOnceOnClient(musictrack_t, entity)
void Stop(void)
void StopOnClient(entity)
void PlayOnClient(musictrack_t, entity)
void PlayOnce(musictrack_t)
Util library.
Definition: api_func.h:30
string TimeToString(int realTime, int zoneType, string formatString)
Returns the current time.