Nuclide
Software Development Kit for id Tech
mapC.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Vera Visions LLC.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16
17#pragma target fte_5768
18#define QWSSQC
19
20/* MapProgs are map specific QuakeC progs.
21 Include this file with YOUR MapProgs! */
22
23#include "../shared/fteextensions.qc"
24#include "../shared/global.h"
25#include "mapC_math.h"
26#include "mapC_weapons.h"
27
48entity
49spawnClass(string className, vector desiredPos)
50{
51 entity(string, vector) spawnFunc = externvalue(0, "spawnClass");
52 return spawnFunc(className, desiredPos);
53}
54
65void
66sendInput(entity target, string inputName, string dataString, entity activator)
67{
68 void(entity, entity, string, string) inputFunc = externvalue(0, "sendInput");
69 inputFunc(target, activator, inputName, setValue);
70}
71
83void
84entityDamage(entity targetEnt, entity inflictingEnt, entity attackingEnt, string damageDef, string weaponDef, vector damageOrigin, vector damageDir, vector hitLocation)
85{
86 void(entity,entity,entity,string,string,vector,vector,vector) checkFunc = externvalue(0, "entityDamage");
87 return checkFunc(targetEnt, inflictingEnt, attackingEnt, damageDef, weaponDef, damageOrigin, damageDir, hitLocation);
88}
89
99void
100radiusDamage(vector damageCenter, float damageRange, int damageMin, int damageMax, entity attackingEnt)
101{
102 void(vector, float, int, int, entity) checkFunc = externvalue(0, "radiusDamage");
103 return checkFunc(damageCenter, damageRange, damageMin, damageMax, attackingEnt);
104}
105
106
110bool
111isAI(entity entityToCheck)
112{
113 bool(entity) checkFunc = externvalue(0, "isAI");
114 return checkFunc(entityToCheck);
115}
116
120bool
121isAlive(entity entityToCheck)
122{
123 bool(entity) checkFunc = externvalue(0, "isAlive");
124 return checkFunc(entityToCheck);
125}
126
130bool
131isGodMode(entity entityToCheck)
132{
133 bool(entity) checkFunc = externvalue(0, "isGodMode");
134 return checkFunc(entityToCheck);
135}
136
140bool
141isPlayer(entity entityToCheck)
142{
143 bool(entity) checkFunc = externvalue(0, "isPlayer");
144 return checkFunc(entityToCheck);
145}
146
150bool
151isSentient(entity entityToCheck)
152{
153 bool(entity) checkFunc = externvalue(0, "isSentient");
154 return checkFunc(entityToCheck);
155}
156
160bool
161isBot(entity entityToCheck)
162{
163 bool(entity) checkFunc = externvalue(0, "isBot");
164 return checkFunc(entityToCheck);
165}
166
167/* misc helper functions. */
168
175string
176timeToString(int realTime, int zoneType, string formatString)
177{
178 /* supposed to take extra (optional parameters...) */
179 if (zoneType == 1i) {
180 strftime(true, formatString);
181 } else {
182 strftime(true, formatString);
183 }
184}
185 // end of multiprogs
187
bool isGodMode(entity entityToCheck)
Returns true/false depending on if the entity is in "god" mode.
Definition: mapC.h:131
bool isAI(entity entityToCheck)
Returns true/false depending on if the entity is an AI character.
Definition: mapC.h:111
void radiusDamage(vector damageCenter, float damageRange, int damageMin, int damageMax, entity attackingEnt)
Does damage to all entities within a specified radius with a linear falloff.
Definition: mapC.h:100
void entityDamage(entity targetEnt, entity inflictingEnt, entity attackingEnt, string damageDef, string weaponDef, vector damageOrigin, vector damageDir, vector hitLocation)
Applies damage to a given entity.
Definition: mapC.h:84
bool isBot(entity entityToCheck)
Returns true/false depending on if the entity is a bot.
Definition: mapC.h:161
void sendInput(entity target, string inputName, string dataString, entity activator)
Sends an input (See NSIO::Input) to an entity.
Definition: mapC.h:66
bool isAlive(entity entityToCheck)
Returns true/false depending on if the entity is alive.
Definition: mapC.h:121
bool isSentient(entity entityToCheck)
Returns true/false depending on if the entity is either a player, or AI character.
Definition: mapC.h:151
bool isPlayer(entity entityToCheck)
Returns true/false depending on if the entity is a player.
Definition: mapC.h:141
entity spawnClass(string className, vector desiredPos)
Spawns an entity of a specific class.
Definition: mapC.h:49
string timeToString(int realTime, int zoneType, string formatString)
Returns the current time.
Definition: mapC.h:176
string target
Definition: defs.h:23
Server-side plugin wrappers for math related functions.
void(float radius, vector texcoordbias) R_EndPolygonRibbon