Nuclide
Software Development Kit for id Technology (BETA)
Loading...
Searching...
No Matches
Projectile.h
1/*
2 * Copyright (c) 2016-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
17typedef enumflags
18{
19 PROJ_CHANGED_ORIGIN_X,
20 PROJ_CHANGED_ORIGIN_Y,
21 PROJ_CHANGED_ORIGIN_Z,
22 PROJ_CHANGED_ANGLES_X,
23 PROJ_CHANGED_ANGLES_Y,
24 PROJ_CHANGED_ANGLES_Z,
25 PROJ_CHANGED_MODELINDEX,
26 PROJ_CHANGED_SIZE,
27 PROJ_CHANGED_FRAME,
28 PROJ_CHANGED_SKIN,
29 PROJ_CHANGED_EFFECTS,
30 PROJ_CHANGED_BODY,
31 PROJ_CHANGED_SCALE,
32 PROJ_CHANGED_VELOCITY,
33 PROJ_CHANGED_ANGULARVELOCITY,
34 PROJ_CHANGED_RENDERCOLOR,
35 PROJ_CHANGED_RENDERAMT,
36 PROJ_CHANGED_RENDERMODE,
37} nsprojectile_changed_t;
38
39.void(entity, entity) m_pImpact;
40.float traileffectnum;
41
204{
205public:
206 void ncProjectile(void);
207
208#ifdef CLIENT
209 virtual void ReceiveEntity(float, float);
210 virtual float predraw(void);
211 virtual void postdraw(void);
212#endif
213
214#ifdef SERVER
216 nonvirtual void SetImpact(void(entity, entity));
218 nonvirtual void Animate(int, int, float);
220 nonvirtual void AnimateOnce(int, int, float);
221
223 virtual void Touch(entity);
224 virtual void Spawned(void);
225 virtual void Pain(entity, entity, int, vector, vector, int);
226 virtual void Death(entity, entity, int, vector, vector, int);
227
228 virtual void SpawnKey(string, string);
229 virtual void EvaluateEntity(void);
230 virtual float SendEntity(entity, float);
231 virtual void Save(float);
232 virtual void Restore(string, string);
233
234 virtual void Trigger(entity, triggermode_t);
235 virtual void Input(entity,string,string);
236
237 nonvirtual void _FuseEnded(void);
238 nonvirtual void _Explode(entity);
239 virtual void HasExploded(void);
240
241 virtual void _LaunchHitscan(vector, vector, float);
242
243 /* launch the projectile into the world */
244 virtual void Launch(vector, vector, float, float, float);
245
246 nonvirtual void SetLightColor(vector);
247 nonvirtual void SetLightRadius(float);
248
249 nonvirtual void SetWeaponOwner(ncWeapon);
250 nonvirtual ncWeapon GetWeaponOwner(void);
251
252 nonvirtual void EnableDetonateOnFuse(bool);
253 nonvirtual void EnableDetonateOnDeath(bool);
254 nonvirtual void EnableDetonateOnWorld(bool);
255 nonvirtual void EnableDetonateOnActor(bool);
256 nonvirtual void EnableStickToWorld(bool);
257 nonvirtual void EnableStickToActor(bool);
258 nonvirtual void EnableThrustHoming(bool);
259 nonvirtual void EnableInheritVelocity(bool);
260#endif
261
262private:
263 NETWORKED_FLOAT_N(traileffectnum)
264 NETWORKED_VECTOR(m_vecLightColor)
265 NETWORKED_FLOAT(m_flLightRadius)
266
267#ifdef SERVER
268 /* I/O system */
269 string m_outputOnDetonate;
270
271 /* sprite animation gubbins */
272 int m_iProjectileAnimEnd;
273 int m_iProjectileAnimStart;
274 float m_flProjectileFramerate;
275
276 /* temp */
277 float m_flDmgMultiplier;
278 float m_trackDelayTime;
279
280 /* defAPI */
281 string m_defDamage;
282 string m_defSplashDamage;
283 vector m_vecLaunchVelocity;
284 float m_flThrust;
285 float m_flThrustStart;
286 float m_flThrustEnd;
287 float m_flFrictionLinear;
288 float m_flBounce;
289 float m_flMass;
290 float m_flGravity;
291 float m_flFuse;
292 bool m_bDetonateOnFuse;
293 bool m_bDetonateOnDeath;
294 bool m_bDetonateOnWorld;
295 bool m_bDetonateOnActor;
296 bool m_bImpactEffect; /* TODO */
297 bool m_bImpactGib; /* TODO */
298 bool m_bImpactSurfData; /* TODO */
299 string m_matDetonate;
300 float m_flDecalSize;
301 string m_partSmokeFly;
302 string m_partFXPath;
303 string m_partModelDetonate;
304 string m_partSmokeDetonate;
305 string m_partSmokeBounce;
306 string m_partSmokeFuse;
307 string m_defProjectileDebris;
308 int m_iDebrisCount;
309 bool m_bDebrisStick;
310 vector m_vecDebrisOffset;
311 vector m_vecDetonateOffset;
312 vector m_vecDamageOffset;
313 vector m_vecImpactPos;
314 bool m_bThrown;
315 float m_timeUntilNextDamage;
316 float m_damageDelay;
317
318 float m_flLightOffset;
319 vector m_vecExplodeLightColor;
320 float m_fExplodelLightRadius;
321 float m_fExplodelLightFadetime;
322 string m_sndFly;
323 string m_sndExplode;
324 string m_sndBounce;
325 vector m_vecSpawnMins;
326 vector m_vecSpawnMaxs;
327 float m_flSpawnFrame;
328 vector m_vecSpawnOrigin;
329 ncWeapon m_weaponOwner;
330
331 /* ETQW-additions */
332 bool m_bIsBullet;
333 ncSurfacePropEntity m_eMultiTarget;
334 int m_iMultiValue;
335 int m_iMultiBody;
336 int m_iShots;
337 vector m_vecSpread;
338 float m_flDamage;
339 string m_strDecalGroup;
340 float m_flRange;
341
342 /* Nuclide additions */
343 bool m_bStickToWorld;
344 bool m_bStickToActor;
345 bool m_bThrustHoming;
346 bool m_bInheritVelocity;
347 bool m_bReflect;
348 bool m_bTrackEnemy;
349 vector m_trackJitter;
350 float m_trackDelay;
351 string m_defPlaneImpact;
352 string m_sndHitActor;
353 string m_sndHitWorld;
354
355 ncTimer m_thrustHandler;
356 vector m_hitLocation;
357 bool m_noFX;
358 vector m_lastPlaneNormal;
359
360 nonvirtual void _AnimateThink(void);
361 nonvirtual void _ThrustThink(void);
362 nonvirtual void _AnimateThinkDead(void);
363
364 virtual void _ApplyDamage(void);
365 virtual void _FireSingle(vector,vector,float,float);
366
367 virtual void OnRemoveEntity(void);
368#endif
369};
370
371#ifdef SERVER
372ncProjectile ncProjectile_SpawnDef(string entityDef, ncActor theOwner);
373ncProjectile ncProjectile_SpawnDefAtPosition(string entityDef, ncActor theOwner, vector vecOrigin, vector vecAngles);
374ncProjectile ncProjectile_SpawnDefAttachment(string entityDef, ncActor theOwner, int attachmentID);
375#endif
This entity class represents an object with choreographed/free-form movement.
Definition Actor.h:93
void ncAttack(void)
Definition Attack.qc:18
This entity class represents an interactive projectile.
Definition Projectile.h:204
virtual void EvaluateEntity(void)
Run each tic after physics are run to determine if we need to send updates over the network.
Definition Projectile.qc:1334
virtual void Trigger(entity, triggermode_t)
Called whenever we're legacy triggered by another object or function.
Definition Projectile.qc:546
nonvirtual ncWeapon GetWeaponOwner(void)
Definition Projectile.qc:661
nonvirtual void _Explode(entity)
Definition Projectile.qc:788
virtual void SpawnKey(string, string)
This method handles entity key/value pairs on map load.
Definition Projectile.qc:91
nonvirtual void Animate(int, int, float)
When called, will animated between two frame positions at a specified framerate on loop.
Definition Projectile.qc:747
nonvirtual void SetLightRadius(float)
Definition Projectile.qc:649
nonvirtual void AnimateOnce(int, int, float)
When called, will animated between two frame positions at a specified framerate and remove itself whe...
Definition Projectile.qc:757
virtual void Spawned(void)
Called when the entity is fulled initialized.
Definition Projectile.qc:552
virtual void HasExploded(void)
Definition Projectile.qc:782
virtual void postdraw(void)
Client: Run after the rendering of 3D world is complete.
Definition Projectile.qc:1433
virtual void Pain(entity, entity, int, vector, vector, int)
Called whenever the entity receives damage.
Definition Projectile.qc:625
virtual void ReceiveEntity(float, float)
Client: Handles network updates from the server for the associated entity.
Definition Projectile.qc:1405
void ncProjectile(void)
Definition Projectile.qc:18
virtual float SendEntity(entity, float)
Called by the engine whenever we need to send a client an update about this entity.
Definition Projectile.qc:1361
nonvirtual void EnableDetonateOnWorld(bool)
Definition Projectile.qc:679
virtual void Input(entity, string, string)
Called when we are being prompted by another object/function with an input message.
Definition Projectile.qc:1311
nonvirtual void SetLightColor(vector)
Definition Projectile.qc:643
virtual void Touch(entity)
Called upon the projectile touching another object.
Definition Projectile.qc:566
nonvirtual void EnableStickToWorld(bool)
Definition Projectile.qc:691
virtual void Restore(string, string)
Similar to ncIO::SpawnKey() but for save-game fields.
Definition Projectile.qc:386
nonvirtual void EnableDetonateOnActor(bool)
Definition Projectile.qc:685
virtual void _LaunchHitscan(vector, vector, float)
Definition Projectile.qc:903
nonvirtual void EnableInheritVelocity(bool)
Definition Projectile.qc:709
nonvirtual void EnableDetonateOnFuse(bool)
Definition Projectile.qc:667
nonvirtual void EnableThrustHoming(bool)
Definition Projectile.qc:703
nonvirtual void SetImpact(void(entity, entity))
Sets the function that'll be called upon impact of the projectile onto a surface.
Definition Projectile.qc:715
nonvirtual void SetWeaponOwner(ncWeapon)
Definition Projectile.qc:655
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
Definition Projectile.qc:329
virtual float predraw(void)
Definition Projectile.qc:1447
nonvirtual void EnableStickToActor(bool)
Definition Projectile.qc:697
virtual void Death(entity, entity, int, vector, vector, int)
Called when the health is equal or below 0.
Definition Projectile.qc:631
virtual void Launch(vector, vector, float, float, float)
Definition Projectile.qc:1175
nonvirtual void _FuseEnded(void)
Definition Projectile.qc:767
nonvirtual void EnableDetonateOnDeath(bool)
Definition Projectile.qc:673
void ncSurfacePropEntity(void)
Definition SurfacePropEntity.qc:18
This class provides a way to trigger a function in the future.
Definition Timer.h:26
This entity class represents weapon based items.
Definition Weapon.h:305
entityDefAPI_t entityDef
Access entityDefAPI_t functions using this variable.
Definition api.h:437