Nuclide
Software Development Kit for id Technology (BETA)
api_func.h
1.float deaths;
2
22/* Util library */
23typedef struct
24{
31 string TimeToString(int realTime, int zoneType, string formatString);
32} utilAPI_t;
34
35/* Exists library */
36typedef struct
37{
38 bool InMap(string);
39 bool InPVS(entity, vector);
40 bool InVFS(string fileName);
43
44/* Ents library */
45typedef struct
46{
54 entity Create(string className, vector spawnPos);
61 bool Precache(string className);
67 entity ChangeToClass(entity targetEntity, string className);
78 entity Input(entity target, string inputName, string dataString, entity activator);
82 bool isAI(entity entityToCheck);
86 bool isAlive(entity entityToCheck);
90 bool isGodMode(entity entityToCheck);
94 bool isPlayer(entity entityToCheck);
98 bool isSentient(entity entityToCheck);
102 bool isBot(entity entityToCheck);
103} entsAPI_t;
105
106/* Game library */
107typedef struct
108{
109 void LoadNextMap(void);
110 void CleanUpMap(void);
111 string GetMap(void);
112 string GetNextMap(void);
113 void SetSpawnPoint(string);
114 void TeleportToSpawn(entity);
115 entity FindRandomClassObject(string);
116} gameAPI_t;
118
119/* MOTD library */
120typedef struct
121{
122 void LoadDefault(void);
123 void LoadFromFile(string);
124} motdAPI_t;
126
127/* MOTD library */
128typedef struct
129{
130 string GetInventory(entity);
131 bool HasItem(entity, string);
132 int GetReserveAmmo(entity, int);
133 bool MaxAmmo(entity, int);
134 int TotalActors(void);
136
137 float AimAtPos(entity, vector);
138 float MoveToPos(entity, vector);
139 bool CanSee(entity, entity);
140 bool CanShoot(entity, vector, vector);
142 entity FindCoverNode(entity);
143} actorAPI_t;
145
146typedef struct
147{
158 void Damage(entity targetEnt, entity inflictingEnt, entity attackingEnt, string damageDef, vector damageOrigin, vector damageDir, vector hitLocation);
169 void RadiusDamage(vector damageCenter, float damageRange, int damageMin, int damageMax, entity attackingEnt, string damageDef);
176 void Obituary(string targetName, string attackerName, string weaponDef, string meansOfDeath);
179 // end of multiprogs
181
182__variant
183linkToServerProgs(string funcName)
184{
185 static void empty(void)
186 {
187 print("Called unimplemented server-side API call.\n");
188 breakpoint();
189 }
190
191 void *func = externvalue(0, funcName);
192
193 if (func) {
194 return ((__variant)func);
195 } else {
196 return (empty);
197 }
198}
199
200void
201_server_main(void)
202{
203 game.LoadNextMap = linkToServerProgs("SVPF_game_LoadNextMap");
204 game.CleanUpMap = linkToServerProgs("SVPF_game_CleanUpMap");
205 game.GetMap = linkToServerProgs("SVPF_game_GetMap");
206 game.GetNextMap = linkToServerProgs("SVPF_game_GetNextMap");
207 game.SetSpawnPoint = linkToServerProgs("SVPF_game_SetSpawnPoint");
208 game.TeleportToSpawn = linkToServerProgs("SVPF_game_TeleportToSpawn");
209 game.FindRandomClassObject = linkToServerProgs("Spawn_SelectRandom");
210
211 combat.Damage = linkToServerProgs("SVPF_combat_Damage");
212 combat.RadiusDamage = linkToServerProgs("SVPF_combat_RadiusDamage");
213 combat.Obituary = linkToServerProgs("SVPF_combat_Obituary");
214
215 ents.Create = linkToServerProgs("spawnClass");
216 ents.ChangeToClass = linkToServerProgs("changeClass");
217 ents.Precache = linkToServerProgs("EntityDef_Precache");
218 ents.Input = linkToServerProgs("sendInput");
219 ents.isAI = linkToServerProgs("isAI");
220 ents.isAlive = linkToServerProgs("isAlive");
221 ents.isGodMode = linkToServerProgs("isGodMode");
222 ents.isPlayer = linkToServerProgs("isPlayer");
223 ents.isSentient = linkToServerProgs("isSentient");
224
225 actor.GetInventory = linkToServerProgs("SVPF_actor_GetInventory");
226 actor.GetReserveAmmo = linkToServerProgs("SVPF_actor_GetReserveAmmo");
227 actor.MaxAmmo = linkToServerProgs("SVPF_actor_MaxAmmo");
228 actor.TotalActors = linkToServerProgs("SVPF_actor_TotalActors");
229 actor.TotalActorsOnTeam = linkToServerProgs("SVPF_actor_TotalActorsOnTeam");
230 actor.MoveToPos = linkToServerProgs("SVPF_actor_MoveToPos");
231 actor.HasItem = linkToServerProgs("SVPF_actor_HasItem");
232
233 exists.InMap = linkToServerProgs("SVPF_exists_InMap");
234 exists.InVFS = linkToServerProgs("SVPF_exists_InVFS");
235 exists.InPVS = linkToServerProgs("SVPF_exists_InPVS");
236
237 motd.LoadDefault = linkToServerProgs("MOTD_LoadDefault");
238 motd.LoadFromFile = linkToServerProgs("MOTD_LoadFromFile");
239
240 util.TimeToString = linkToServerProgs("SVPF_util_TimeToString");
241}
var motdAPI_t motd
Definition: api_func.h:125
var existsAPI_t exists
Definition: api_func.h:42
var gameAPI_t game
Definition: api_func.h:117
var utilAPI_t util
Definition: api_func.h:33
var combatAPI_t combat
Definition: api_func.h:178
var entsAPI_t ents
Definition: api_func.h:104
var actorAPI_t actor
Definition: api_func.h:144
Definition: api_func.h:129
entity FindCoverNode(entity)
float AimAtPos(entity, vector)
int GetReserveAmmo(entity, int)
int TotalActorsOnTeam(int)
bool MaxAmmo(entity, int)
bool CanShoot(entity, vector, vector)
bool HasItem(entity, string)
bool CanSee(entity, entity)
float MoveToPos(entity, vector)
int TotalActors(void)
bool ClearEnemy()
string GetInventory(entity)
Definition: api_func.h:147
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:46
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 ncIO::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:37
bool InVFS(string fileName)
bool InMap(string)
bool InPVS(entity, vector)
Definition: api_func.h:108
entity FindRandomClassObject(string)
void CleanUpMap(void)
void LoadNextMap(void)
string GetMap(void)
void TeleportToSpawn(entity)
string GetNextMap(void)
void SetSpawnPoint(string)
Definition: api_func.h:121
void LoadFromFile(string)
void LoadDefault(void)
Definition: api_func.h:24
string TimeToString(int realTime, int zoneType, string formatString)
Returns the current time.