Nuclide
Software Development Kit for id Technology
api_func.h
1.float deaths;
2
15/* Util library */
16typedef struct
17{
24 string TimeToString(int realTime, int zoneType, string formatString);
25} utilAPI_t;
27
28/* Exists library */
29typedef struct
30{
31 bool InMap(string);
32 bool InPVS(entity, vector);
33 bool InVFS(string fileName);
36
37/* Ents library */
38typedef struct
39{
47 entity Create(string className, vector spawnPos);
54 bool Precache(string className);
60 entity ChangeToClass(entity targetEntity, string className);
71 entity Input(entity target, string inputName, string dataString, entity activator);
75 bool isAI(entity entityToCheck);
79 bool isAlive(entity entityToCheck);
83 bool isGodMode(entity entityToCheck);
87 bool isPlayer(entity entityToCheck);
91 bool isSentient(entity entityToCheck);
95 bool isBot(entity entityToCheck);
96} entsAPI_t;
98
99/* Game library */
100typedef struct
101{
102 void LoadNextMap(void);
103 void CleanUpMap(void);
104 string GetMap(void);
105 string GetNextMap(void);
106 void SetSpawnPoint(string);
107 void TeleportToSpawn(entity);
108} gameAPI_t;
110
111/* MOTD library */
112typedef struct
113{
114 void LoadDefault(void);
115 void LoadFromFile(string);
116} motdAPI_t;
118
119/* MOTD library */
120typedef struct
121{
122 string GetInventory(entity);
123 int GetReserveAmmo(entity, int);
124 bool MaxAmmo(entity, int);
125 int TotalActors(void);
127
128 float AimAtPos(entity, vector);
129 float MoveToPos(entity, vector);
130 bool CanSee(entity, entity);
131 bool CanShoot(entity, vector, vector);
133 entity FindCoverNode(entity);
134} actorAPI_t;
136
137typedef struct
138{
149 void Damage(entity targetEnt, entity inflictingEnt, entity attackingEnt, string damageDef, vector damageOrigin, vector damageDir, vector hitLocation);
160 void RadiusDamage(vector damageCenter, float damageRange, int damageMin, int damageMax, entity attackingEnt, string damageDef);
167 void Obituary(string targetName, string attackerName, string weaponDef, string meansOfDeath);
170 // end of multiprogs
172
173__variant
174linkToServerProgs(string funcName)
175{
176 static void empty(void)
177 {
178 print("Called unimplemented server-side API call.\n");
179 breakpoint();
180 }
181
182 void *func = externvalue(0, funcName);
183
184 if (func) {
185 return ((__variant)func);
186 } else {
187 return (empty);
188 }
189}
190
191void
192_server_main(void)
193{
194 game.LoadNextMap = linkToServerProgs("SVPF_game_LoadNextMap");
195 game.CleanUpMap = linkToServerProgs("SVPF_game_CleanUpMap");
196 game.GetMap = linkToServerProgs("SVPF_game_GetMap");
197 game.GetNextMap = linkToServerProgs("SVPF_game_GetNextMap");
198 game.SetSpawnPoint = linkToServerProgs("SVPF_game_SetSpawnPoint");
199 game.TeleportToSpawn = linkToServerProgs("SVPF_game_TeleportToSpawn");
200
201 combat.Damage = linkToServerProgs("SVPF_combat_Damage");
202 combat.RadiusDamage = linkToServerProgs("SVPF_combat_RadiusDamage");
203 combat.Obituary = linkToServerProgs("SVPF_combat_Obituary");
204
205 ents.Create = linkToServerProgs("spawnClass");
206 ents.ChangeToClass = linkToServerProgs("changeClass");
207 ents.Precache = linkToServerProgs("EntityDef_Precache");
208 ents.Input = linkToServerProgs("sendInput");
209 ents.isAI = linkToServerProgs("isAI");
210 ents.isAlive = linkToServerProgs("isAlive");
211 ents.isGodMode = linkToServerProgs("isGodMode");
212 ents.isPlayer = linkToServerProgs("isPlayer");
213 ents.isSentient = linkToServerProgs("isSentient");
214
215 actor.GetInventory = linkToServerProgs("SVPF_actor_GetInventory");
216 actor.GetReserveAmmo = linkToServerProgs("SVPF_actor_GetReserveAmmo");
217 actor.MaxAmmo = linkToServerProgs("SVPF_actor_MaxAmmo");
218 actor.TotalActors = linkToServerProgs("SVPF_actor_TotalActors");
219 actor.TotalActorsOnTeam = linkToServerProgs("SVPF_actor_TotalActorsOnTeam");
220 actor.MoveToPos = linkToServerProgs("SVPF_actor_MoveToPos");
221
222 exists.InMap = linkToServerProgs("SVPF_exists_InMap");
223 exists.InVFS = linkToServerProgs("SVPF_exists_InVFS");
224 exists.InPVS = linkToServerProgs("SVPF_exists_InPVS");
225
226 motd.LoadDefault = linkToServerProgs("MOTD_LoadDefault");
227 motd.LoadFromFile = linkToServerProgs("MOTD_LoadFromFile");
228
229 util.TimeToString = linkToServerProgs("SVPF_util_TimeToString");
230}
var motdAPI_t motd
Definition: api_func.h:117
var existsAPI_t exists
Definition: api_func.h:35
var gameAPI_t game
Definition: api_func.h:109
var utilAPI_t util
Definition: api_func.h:26
var combatAPI_t combat
Definition: api_func.h:169
var entsAPI_t ents
Definition: api_func.h:97
var actorAPI_t actor
Definition: api_func.h:135
Definition: api_func.h:121
entity FindCoverNode(entity)
float AimAtPos(entity, vector)
int GetReserveAmmo(entity, int)
int TotalActorsOnTeam(int)
bool MaxAmmo(entity, int)
bool CanShoot(entity, vector, vector)
bool CanSee(entity, entity)
float MoveToPos(entity, vector)
int TotalActors(void)
bool ClearEnemy()
string GetInventory(entity)
Definition: api_func.h:138
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.
Definition: api_func.h:39
bool Precache(string className)
Precaches a given entity class.
bool isSentient(entity entityToCheck)
Returns true/false depending on if the entity is either a player, or AI character.
entity Create(string className, vector spawnPos)
Creates a new entity of a given class name.
entity Input(entity target, string inputName, string dataString, entity activator)
Sends an input (See NSIO::Input) to an entity.
entity ChangeToClass(entity targetEntity, string className)
Transitions an entity from one class to another.
bool isAI(entity entityToCheck)
Returns true/false depending on if the entity is an AI character.
bool isGodMode(entity entityToCheck)
Returns true/false depending on if the entity is in "god" mode.
bool isBot(entity entityToCheck)
Returns true/false depending on if the entity is a bot.
bool isPlayer(entity entityToCheck)
Returns true/false depending on if the entity is a player.
bool isAlive(entity entityToCheck)
Returns true/false depending on if the entity is alive.
Definition: api_func.h:30
bool InVFS(string fileName)
bool InMap(string)
bool InPVS(entity, vector)
Definition: api_func.h:101
void CleanUpMap(void)
void LoadNextMap(void)
string GetMap(void)
void TeleportToSpawn(entity)
string GetNextMap(void)
void SetSpawnPoint(string)
Definition: api_func.h:113
void LoadFromFile(string)
void LoadDefault(void)
Definition: api_func.h:17
string TimeToString(int realTime, int zoneType, string formatString)
Returns the current time.