Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_nades.qc
Go to the documentation of this file.
1#include "sv_nades.qh"
2
8
10
12
13vector nades_PlayerColor(entity this, bool isPants)
14{
15 if (teamplay)
16 return Team_ColorRGB(this.team);
17
18 // logic copied from Scoreboard_GetName
19 int col = (this.colormap >= 1024)
20 ? this.colormap - 1024
21 : this.clientcolors;
22 return (isPants)
23 ? colormapPaletteColor(col % 16, true)
24 : colormapPaletteColor(floor(col / 16), false);
25}
26
28{
29 this.skin = 8 - (this.wait - time) / (this.nade_lifetime / 10);
30 this.nextthink = time;
31 if (!this.owner || wasfreed(this.owner))
32 delete(this);
33}
34
36{
37 CSQCProjectile(_nade, true, REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, _nade)).m_projectile[1], true);
38}
39
40void nade_spawn(entity _nade)
41{
42 entity timer = new(nade_timer);
43 setmodel(timer, MDL_NADE_TIMER);
44 setattachment(timer, _nade, "");
45 timer.colormap = _nade.colormap;
46 timer.glowmod = _nade.glowmod;
48 timer.nextthink = time;
49 timer.wait = _nade.wait;
50 timer.nade_lifetime = _nade.nade_lifetime;
51 timer.owner = _nade;
52 timer.skin = 10;
53
54 _nade.effects |= EF_LOWPRECISION;
55
56 CSQCProjectile(_nade, true, REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, _nade)).m_projectile[0], true);
57}
58
59
61{
62 if (time >= this.ltime)
63 {
64 delete(this);
65 return;
66 }
67
68 this.nextthink = time;
69
70 if (time >= this.nade_special_time)
71 {
72 this.nade_special_time = time + 0.05;
73 this.nade_show_particles = true;
74 }
75 else
76 this.nade_show_particles = false;
77}
78
79entity nades_spawn_orb(entity this, float orb_lifetime, float orb_rad)
80{
81 // NOTE: this function merely places an orb
82 // you must add a custom touch function to the returned entity if desired
83 entity orb = new(nades_spawn_orb);
84 orb.owner = this.owner;
85 orb.realowner = this.realowner;
86 setorigin(orb, this.origin);
87
88 orb.lifetime = orb_lifetime; // required for timers
89 orb.ltime = time + orb.lifetime;
90 orb.bot_dodge = false;
91 orb.team = this.realowner.team;
92 orb.solid = SOLID_TRIGGER;
93
94 setmodel(orb, MDL_NADE_ORB);
95 orb.skin = 1;
96 orb.radius = orb_rad; // required for fading
97 vector size = '0.5 0.5 0.5' * orb.radius;
98 setsize(orb, -size, size);
99
100 STAT(NADE_BONUS_TYPE, orb) = STAT(NADE_BONUS_TYPE, this);
101 orb.colormod = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, orb)).m_color;
102
103 Net_LinkEntity(orb, true, 0, orb_send);
104
105 orb.reset = SUB_Remove;
106
108 orb.nextthink = time;
109
110 return orb;
111}
112
113
115{
116 entity expef = NULL;
117 vector expcol_min = '0 0 0', expcol_max = '0 0 0';
118
119 Nade ntype = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, this));
120
121 if (!this.takedamage || ntype == NADE_TYPE_Null)
122 {
123 // first condition: nade was destroyed by something (lava, void, etc.), just do a normal explosion
124 // this prevents weird cases like spawn nade setting your spawnpoint on the void, translocate sending you into the void, etc.
125 ntype = NADE_TYPE_NORMAL;
126 }
127
128#define SET_NADE_EFFECT(nade_type, exp_effect, exp_color_min, exp_color_max) \
129 case nade_type: \
130 expef = exp_effect; \
131 expcol_min = exp_color_min; \
132 expcol_max = exp_color_max; \
133 break
134
135 switch (ntype)
136 {
137 SET_NADE_EFFECT(NADE_TYPE_NAPALM, EFFECT_EXPLOSION_MEDIUM, '0 0 0', '0 0 0');
138 SET_NADE_EFFECT(NADE_TYPE_ICE, EFFECT_ELECTRO_COMBO, '0 0 0', '0 0 0');
139 SET_NADE_EFFECT(NADE_TYPE_TRANSLOCATE, NULL, '0 0 0', '0 0 0');
140 SET_NADE_EFFECT(NADE_TYPE_MONSTER, NULL, nades_PlayerColor(this.realowner, false), nades_PlayerColor(this.realowner, true));
141 SET_NADE_EFFECT(NADE_TYPE_SPAWN, EFFECT_SPAWN, nades_PlayerColor(this.realowner, false), nades_PlayerColor(this.realowner, true));
142 SET_NADE_EFFECT(NADE_TYPE_HEAL, EFFECT_SPAWN, '1 0 0', '1 0 0');
143 SET_NADE_EFFECT(NADE_TYPE_ENTRAP, EFFECT_SPAWN, '1 1 0', '1 1 0');
144 SET_NADE_EFFECT(NADE_TYPE_VEIL, EFFECT_SPAWN, '0 0 0', '0 0 0');
145 SET_NADE_EFFECT(NADE_TYPE_AMMO, EFFECT_SPAWN, '0.33 0.33 1', '0.33 0.33 1');
146 SET_NADE_EFFECT(NADE_TYPE_DARKNESS, EFFECT_EXPLOSION_MEDIUM, '0 0 0', '0 0 0');
147 SET_NADE_EFFECT(NADE_TYPE_NORMAL, EFFECT_NADE_EXPLODE, nades_PlayerColor(this.realowner, false), nades_PlayerColor(this.realowner, true));
148 }
149#undef SET_NADE_EFFECT
150
151 if (expef)
152 Send_Effect_Except(expef, findbetterlocation(this.origin, 8), '0 0 0', 1, expcol_min, expcol_max, NULL);
153
154 sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
155 sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
156
157 this.event_damage = func_null; // prevent somehow calling damage in the next call
158
159 switch (ntype)
160 {
161 case NADE_TYPE_NORMAL: nade_normal_boom(this); break;
162 case NADE_TYPE_NAPALM: nade_napalm_boom(this); break;
163 case NADE_TYPE_ICE: nade_ice_boom(this); break;
164 case NADE_TYPE_TRANSLOCATE: nade_translocate_boom(this); break;
165 case NADE_TYPE_SPAWN: nade_spawn_boom(this); break;
166 case NADE_TYPE_HEAL: nade_heal_boom(this); break;
167 case NADE_TYPE_MONSTER: nade_monster_boom(this); break;
168 case NADE_TYPE_ENTRAP: nade_entrap_boom(this); break;
169 case NADE_TYPE_VEIL: nade_veil_boom(this); break;
170 case NADE_TYPE_AMMO: nade_ammo_boom(this); break;
171 case NADE_TYPE_DARKNESS: nade_darkness_boom(this); break;
172 }
173
174 IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this, RemoveHook(it));
175 delete(this);
176}
177
178void spawn_held_nade(entity player, entity nowner, float ntime, string ntype, string pntype);
179void nade_pickup(entity this, entity thenade)
180{
181 spawn_held_nade(this, thenade.realowner, autocvar_g_nades_pickup_time, REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, thenade)).netname, thenade.pokenade_type);
182
183 // set refire so player can't even
185 STAT(NADE_TIMER, this) = 0;
186
187 if (this.nade)
188 this.nade.nade_time_primed = thenade.nade_time_primed;
189}
190
191bool CanThrowNade(entity this);
193{
194 if (toucher)
196
197 if (toucher == this.realowner)
198 return; // no this impacts
199
201 && time >= this.spawnshieldtime
202 && !toucher.nade && GetResource(this, RES_HEALTH) == this.max_health // no boosted shot pickups, thank you very much
203 && CanThrowNade(toucher) // prevent some obvious things, like dead players
204 && IS_REAL_CLIENT(toucher)) // above checks for IS_PLAYER, don't need to do it here
205 {
206 nade_pickup(toucher, this);
207 sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 * (ATTEN_LARGE + ATTEN_MAX));
208 delete(this);
209 return;
210 }
211 /*
212 bool is_weapclip = false;
213 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
214 if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
215 if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
216 is_weapclip = true;
217 */
218 if (ITEM_TOUCH_NEEDKILL()) // || is_weapclip)
219 {
220 IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this, RemoveHook(it));
221 delete(this);
222 return;
223 }
224
226
227 //setsize(this, '-2 -2 -2', '2 2 2');
228 //UpdateCSQCProjectile(this);
229 if (GetResource(this, RES_HEALTH) == this.max_health)
230 {
232 return;
233 }
234
235 this.enemy = toucher;
236 nade_boom(this);
237}
238
240{
241 sound(this, CH_SHOTS_SINGLE, SND_NADE_BEEP, VOL_BASE, 0.5 * (ATTEN_LARGE + ATTEN_MAX));
242 setthink(this, nade_boom);
243 this.nextthink = max(this.wait, time);
244}
245
246void nade_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
247{
248 if (ITEM_DAMAGE_NEEDKILL(deathtype))
249 {
250 this.takedamage = DAMAGE_NO;
251 W_PrepareExplosionByDamage(this, attacker, nade_boom);
252 return;
253 }
254
255 if (STAT(NADE_BONUS_TYPE, this) == NADE_TYPE_TRANSLOCATE.m_id || STAT(NADE_BONUS_TYPE, this) == NADE_TYPE_SPAWN.m_id)
256 return; // can't launch these, to prevent teleporting across the map
257
258 // adjust damage & force to allow specific interactions (e.g. launching nades with Vortex)
259 if (MUTATOR_CALLHOOK(Nade_Damage, this, DEATH_WEAPONOF(deathtype), force, damage))
260 {}
261 else if (DEATH_ISWEAPON(deathtype, WEP_BLASTER))
262 {
263 force *= 1.5;
264 damage = 0;
265 }
266 else if (DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER) || DEATH_ISWEAPON(deathtype, WEP_OVERKILL_NEX))
267 {
268 force *= 6;
269 damage = this.max_health * 0.55;
270 }
271 else if (DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN) || DEATH_ISWEAPON(deathtype, WEP_OVERKILL_MACHINEGUN))
272 damage = this.max_health * 0.1;
273 else if (DEATH_ISWEAPON(deathtype, WEP_SHOTGUN) || DEATH_ISWEAPON(deathtype, WEP_OVERKILL_SHOTGUN)) // WEAPONTODO
274 {
275 if (!(deathtype & HITTYPE_SECONDARY))
276 damage = this.max_health * 1.15;
277 }
278
279 // melee slaps
280 entity death_weapon = DEATH_WEAPONOF(deathtype);
281 if (death_weapon.spawnflags & ((deathtype & HITTYPE_SECONDARY) ? WEP_TYPE_MELEE_SEC : WEP_TYPE_MELEE_PRI))
282 {
283 force *= 10;
284 damage = this.max_health * 0.1;
285 }
286
287 this.velocity += force;
289
290 if (damage <= 0 || (IS_ONGROUND(this) && IS_PLAYER(attacker)))
291 return;
292
293 float hp = GetResource(this, RES_HEALTH);
294 if (hp == this.max_health)
295 {
296 sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 * (ATTEN_LARGE + ATTEN_MAX));
297 this.nextthink = max(time + this.nade_lifetime, time);
298 setthink(this, nade_beep);
299 }
300
301 hp -= damage;
302 SetResource(this, RES_HEALTH, hp);
303
304 if (IS_PLAYER(attacker)
305 && STAT(NADE_BONUS_TYPE, this) != NADE_TYPE_TRANSLOCATE.m_id
306 && STAT(NADE_BONUS_TYPE, this) != NADE_TYPE_SPAWN.m_id)
307 this.realowner = attacker;
308
309 if (hp <= 0)
310 {
311 if (nade_spawn_DestroyDamage(this, attacker)
312 || nade_translocate_DestroyDamage(this, attacker))
313 return;
314
315 W_PrepareExplosionByDamage(this, attacker, nade_boom);
316 }
317 else
318 nade_burn_spawn(this);
319}
320
321void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
322{
323 if (e.nade == NULL)
324 return;
325
326 entity _nade = e.nade;
327 e.nade = NULL;
328
329 if (e.fake_nade)
330 delete(e.fake_nade);
331 e.fake_nade = NULL;
332
333 Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
334
335 makevectors(e.v_angle);
336
337 // NOTE: always throw from first weapon entity?
338 W_SetupShot(e, _nade.weaponentity_fld, false, false, SND_Null, CH_WEAPON_A, 0, DEATH_NADE.m_id);
339
343
344 setorigin(_nade, w_shotorg + offset);
345 //setmodel(_nade, MDL_PROJECTILE_NADE);
346 //setattachment(_nade, NULL, "");
348 float size;
349 if (STAT(NADES_SMALL, e))
350 size = 16;
351 else
352 size = 32;
353 setsize(_nade, '0.5 0.5 0.5' * -size, '0.5 0.5 0.5' * size);
355
356 tracebox(_nade.origin, _nade.mins, _nade.maxs, _nade.origin, MOVE_NOMONSTERS, _nade);
358 setorigin(_nade, e.origin);
359
360 if (e.v_angle.x >= 70 && e.v_angle.x <= 110 && PHYS_INPUT_BUTTON_CROUCH(e))
361 _nade.velocity = '0 0 100';
363 _nade.velocity = e.velocity + _velocity;
365 _nade.velocity = _velocity;
366 else
367 _nade.velocity = W_CalculateProjectileVelocity(e, e.velocity, _velocity, true);
368
369 if (set_owner)
370 _nade.realowner = e;
371
372 settouch(_nade, nade_touch);
373 _nade.spawnshieldtime = time + 0.1; // prevent instantly picking up again
374 SetResource(_nade, RES_HEALTH, autocvar_g_nades_nade_health);
375 _nade.max_health = GetResource(_nade, RES_HEALTH);
376 _nade.takedamage = DAMAGE_AIM;
377 _nade.event_damage = nade_damage;
378 setcefc(_nade, func_null);
379 _nade.exteriormodeltoclient = NULL;
380 _nade.traileffectnum = 0;
381 _nade.teleportable = true;
382 _nade.pushable = true;
383 _nade.gravity = 1;
384 _nade.missile_flags = MIF_SPLASH | MIF_ARC;
385 _nade.damagedbycontents = true;
387 _nade.angles = vectoangles(_nade.velocity);
388 _nade.flags = FL_PROJECTILE;
389 IL_PUSH(g_projectiles, _nade);
390 IL_PUSH(g_bot_dodge, _nade);
391 _nade.projectiledeathtype = DEATH_NADE.m_id;
392 _nade.toss_time = time;
393 _nade.solid = SOLID_CORPSE; //((STAT(NADE_BONUS_TYPE, _nade) == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX);
394
395 switch (STAT(NADE_BONUS_TYPE, _nade))
396 {
397 case NADE_TYPE_TRANSLOCATE.m_id:
398 case NADE_TYPE_SPAWN.m_id:
399 case NADE_TYPE_MONSTER.m_id:
400 _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
401 break;
402 default:
403 _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
404 break;
405 }
406
407 nade_spawn(_nade);
408
409 if (_time)
410 {
411 setthink(_nade, nade_boom);
412 _nade.nextthink = _time;
413 }
414
415 e.nade_refire = time + autocvar_g_nades_nade_refire;
416 STAT(NADE_TIMER, e) = 0;
417}
418
420{
421#define NADE_TYPE_CHECK(nade_ent, nade_cvar) \
422 case nade_ent.m_id: \
423 if (nade_cvar) \
424 return ntype; \
425 break
426
427 switch (ntype.m_id)
428 {
429 case 0: return NADE_TYPE_Null; // use NADE_TYPE_Null to signify a random nade
430 NADE_TYPE_CHECK(NADE_TYPE_NAPALM, autocvar_g_nades_napalm);
432 NADE_TYPE_CHECK(NADE_TYPE_TRANSLOCATE, autocvar_g_nades_translocate);
433 NADE_TYPE_CHECK(NADE_TYPE_SPAWN, autocvar_g_nades_spawn);
434 NADE_TYPE_CHECK(NADE_TYPE_HEAL, autocvar_g_nades_heal);
435 NADE_TYPE_CHECK(NADE_TYPE_MONSTER, autocvar_g_nades_pokenade && autocvar_g_monsters); // if monsters disabled, this nade can't do anything, use instead normal nade
436 NADE_TYPE_CHECK(NADE_TYPE_ENTRAP, autocvar_g_nades_entrap);
437 NADE_TYPE_CHECK(NADE_TYPE_VEIL, autocvar_g_nades_veil);
438 NADE_TYPE_CHECK(NADE_TYPE_AMMO, autocvar_g_nades_ammo);
439 NADE_TYPE_CHECK(NADE_TYPE_DARKNESS, autocvar_g_nades_darkness);
440 }
441 return NADE_TYPE_NORMAL; // default to NADE_TYPE_NORMAL for unknown nade types
442#undef NADE_TYPE_CHECK
443}
444
445void nades_GiveBonus(entity player, float score)
446{
448 && IS_REAL_CLIENT(player) && IS_PLAYER(player) && STAT(NADE_BONUS, player) < autocvar_g_nades_bonus_max
449 && !IS_DEAD(player) && !STAT(FROZEN, player))
450 {
451 if (STAT(NADE_BONUS_SCORE, player) < 1)
452 STAT(NADE_BONUS_SCORE, player) += score / autocvar_g_nades_bonus_score_max;
453
454 if (STAT(NADE_BONUS_SCORE, player) >= 1)
455 {
456 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_NADE_BONUS);
457 play2(player, SND(NADE_BONUS));
458 ++STAT(NADE_BONUS, player);
459 --STAT(NADE_BONUS_SCORE, player);
460 }
461 }
462}
463
466{
467 STAT(NADE_BONUS, player) = STAT(NADE_BONUS_SCORE, player) = 0;
468}
469
471{
472 entity player = M_ARGV(0, entity);
473
474 nades_RemoveBonus(player);
475}
476
477bool nade_customize(entity this, entity client)
478{
479 //if (IS_SPEC(client)) return false;
480 if (client == this.exteriormodeltoclient || (IS_SPEC(client) && client.enemy == this.exteriormodeltoclient))
481 {
482 // somewhat hide the model, but keep the glow
483 //this.effects = 0;
484 if (this.traileffectnum)
485 this.traileffectnum = 0;
486 this.alpha = -1;
487 }
488 else
489 {
490 //this.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
491 if (!this.traileffectnum)
492 {
493 entity nade = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, this));
494 this.traileffectnum = _particleeffectnum(Nade_TrailEffect(nade.m_projectile[0], this.team).eent_eff_name);
495 }
496 this.alpha = 1;
497 }
498
499 return true;
500}
501
503{
505 FOREACH(Nades, it != NADE_TYPE_Null,
506 {
507 if (nades_CheckTypes(it) == it) // this nade type is allowed
508 RandomSelection_AddEnt(it, 1, 1);
509 });
510 return RandomSelection_chosen_ent.m_id;
511}
512
514{
515 FOREACH(Nades, it != NADE_TYPE_Null && (it.netname == ntype || ftos(it.impulse) == ntype), return it);
516 return NADE_TYPE_Null;
517}
518
519Nade Nades_GetType(string ntype)
520{
521 Nade def;
522 if (ntype == "random" || ntype == "0")
523 def = REGISTRY_GET(Nades, nade_choose_random());
524 else
525 def = Nades_FromString(ntype);
526
527 return (def == NADE_TYPE_Null) ? NADE_TYPE_NORMAL : def;
528}
529
530void spawn_held_nade(entity player, entity nowner, float ntime, string ntype, string pntype)
531{
532 entity n = new(nade), fn = new(fake_nade);
533
534 Nade def = Nades_GetType(ntype);
535
536 n.pokenade_type = pntype;
537
538 STAT(NADE_BONUS_TYPE, n) = def.m_id;
539
540 .entity weaponentity = weaponentities[0]; // TODO: unhardcode
541
542 setmodel(n, MDL_PROJECTILE_NADE);
543 //setattachment(n, player, "bip01 l hand");
544 n.exteriormodeltoclient = player;
546 n.traileffectnum = _particleeffectnum(Nade_TrailEffect(def.m_projectile[0], player.team).eent_eff_name);
547 n.colormod = def.m_color;
548 n.realowner = nowner;
549 n.colormap = player.colormap;
550 n.glowmod = player.glowmod;
551 n.wait = time + max(0, ntime);
552 n.nade_time_primed = time;
554 n.nextthink = max(n.wait - 3, time);
555 n.projectiledeathtype = DEATH_NADE.m_id;
556 n.weaponentity_fld = weaponentity;
557 n.nade_lifetime = ntime;
558 n.alpha = def.m_alpha;
559
560 setmodel(fn, MDL_NADE_VIEW);
561 //setattachment(fn, player.(weaponentity), "");
562 fn.viewmodelforclient = player;
563 fn.realowner = fn.owner = player;
564 fn.colormod = def.m_color;
565 fn.colormap = player.colormap;
566 fn.glowmod = player.glowmod;
567 setthink(fn, SUB_Remove);
568 fn.nextthink = n.wait;
569 fn.weaponentity_fld = weaponentity;
570 fn.alpha = def.m_alpha;
571
572 player.nade = n;
573 player.fake_nade = fn;
574}
575
577{
578 if (autocvar_g_nades_bonus_only && !STAT(NADE_BONUS, this))
579 return; // only allow bonus nades
580
581 // TODO: handle old nade if it exists?
582 if (this.nade)
583 delete(this.nade);
584 this.nade = NULL;
585
586 if (this.fake_nade)
587 delete(this.fake_nade);
588 this.fake_nade = NULL;
589
590 Nade ntype;
591 string pntype = this.pokenade_type;
592
593 if (StatusEffects_active(STATUSEFFECT_Strength, this) && autocvar_g_nades_bonus_onstrength)
594 ntype = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, this));
595 else if (STAT(NADE_BONUS, this) >= 1)
596 {
597 ntype = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, this));
598 pntype = this.pokenade_type;
599 --STAT(NADE_BONUS, this);
600 }
601 else
602 {
604 {
606 pntype = CS_CVAR(this).cvar_cl_pokenade_type;
607 }
608 else
609 {
612 }
613 }
614
615 spawn_held_nade(this, this, autocvar_g_nades_nade_lifetime, ntype.netname, pntype);
616}
617
619{
620 return !(this.vehicle || !autocvar_g_nades || IS_DEAD(this) || !IS_PLAYER(this) || weaponLocked(this));
621}
622
624
626{
627 if (!CanThrowNade(this))
628 return;
629
630 entity held_nade = this.nade;
631 if (!held_nade)
632 {
633 this.nade_altbutton = true;
634 if (time > this.nade_refire)
635 {
636 nade_prime(this);
638 }
639 }
640 else
641 {
642 this.nade_altbutton = false;
643 if (time >= held_nade.nade_time_primed + 1)
644 {
645 makevectors(this.v_angle);
646 float _force = time - held_nade.nade_time_primed;
649 vector dir = v_forward * 0.75 + v_up * 0.2 + v_right * 0.05;
651 toss_nade(this, true, dir * _force, 0);
652 }
653 }
654}
655
656void nades_Clear(entity player)
657{
658 if (player.nade)
659 delete(player.nade);
660 if (player.fake_nade)
661 delete(player.fake_nade);
662
663 player.nade = player.fake_nade = NULL;
664 STAT(NADE_TIMER, player) = 0;
665}
666
667MUTATOR_HOOKFUNCTION(nades, VehicleEnter)
668{
669 entity player = M_ARGV(0, entity);
670
671 if (player.nade)
672 toss_nade(player, true, '0 0 100', max(player.nade.wait, time + 0.05));
673}
674
676 METHOD(NadeOffhand, offhand_think, void(NadeOffhand this, entity player, bool key_pressed))
677 {
678 entity held_nade = player.nade;
679
680 if (!CanThrowNade(player) || time <= player.nade_refire)
681 return;
682 if (key_pressed)
683 {
684 if (!held_nade)
685 {
686 nade_prime(player);
687 held_nade = player.nade;
688 }
689 }
690 else if (time >= held_nade.nade_time_primed + 1)
691 {
692 if (held_nade)
693 {
694 makevectors(player.v_angle);
695 float _force = time - held_nade.nade_time_primed;
696 _force /= autocvar_g_nades_nade_lifetime;
697 _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
698 vector dir = v_forward * 0.7 + v_up * 0.2 + v_right * 0.1;
699 dir = W_CalculateSpread(dir, autocvar_g_nades_spread, autocvar_g_projectiles_spread_style, false);
700 toss_nade(player, false, dir * _force, 0);
701 }
702 }
703 }
707{
709 {
711 }
712 return 0;
713}
714
715MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST)
716{
717 entity player = M_ARGV(0, entity);
718
719 if (player.offhand != OFFHAND_NADE || (STAT(WEAPONS, player) & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon)
720 {
721 nades_CheckThrow(player);
722 return true;
723 }
724}
725
727{
728 entity player = M_ARGV(0, entity);
729
730 if (!IS_PLAYER(player))
731 return;
732
733 if (player.nade && (player.offhand != OFFHAND_NADE || (STAT(WEAPONS, player) & WEPSET(HOOK))))
734 OFFHAND_NADE.offhand_think(OFFHAND_NADE, player, player.nade_altbutton);
735
736 entity held_nade = player.nade;
737 if (held_nade)
738 {
739 STAT(NADE_TIMER, player) = bound(0, (time - held_nade.nade_time_primed) / held_nade.nade_lifetime, 1);
740 // LOG_TRACEF("%d %d", STAT(NADE_TIMER, player), time - held_nade.nade_time_primed);
741 makevectors(player.angles);
742 held_nade.velocity = player.velocity;
743 setorigin(held_nade, player.origin + player.view_ofs + v_forward * 8 + v_right * -8 + v_up * 0);
744 held_nade.angles.y = player.angles.y;
745
746 if (time + 0.1 >= held_nade.wait)
747 {
748 toss_nade(player, false, '0 0 0', time + 0.05);
749 int ntype = STAT(NADE_BONUS_TYPE, held_nade);
750 if (ntype == NADE_TYPE_NORMAL.m_id
751 || ntype == NADE_TYPE_NAPALM.m_id
752 || (ntype == NADE_TYPE_ICE.m_id && !autocvar_g_nades_ice_teamcheck)
753 || ntype == NADE_TYPE_TRANSLOCATE.m_id
754 || (ntype == NADE_TYPE_HEAL.m_id && (autocvar_g_nades_heal_friend < 0 || autocvar_g_nades_heal_armor_rate < 0))
755 || (ntype == NADE_TYPE_ENTRAP.m_id && (autocvar_g_nades_entrap_speed < 1 || autocvar_g_nades_entrap_strength < 1))
756 || (ntype == NADE_TYPE_MONSTER.m_id && !autocvar_g_monsters)
757 || (ntype == NADE_TYPE_AMMO.m_id && autocvar_g_nades_ammo_friend < 0)
758 || (ntype == NADE_TYPE_DARKNESS.m_id && !autocvar_g_nades_darkness_teamcheck))
759 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_NADE_THROW);
760 }
761 }
762
763 if (IS_PLAYER(player))
764 {
766 {
767 entity key;
768 int key_count = 0;
769 FOR_EACH_KH_KEY(key)
770 if (key.owner == player)
771 ++key_count;
772
773 float time_score = (GameRules_scoring_is_vip(player))
776
777 if (key_count)
778 time_score = autocvar_g_nades_bonus_score_time_flagcarrier * key_count; // multiply by the number of keys the player is holding
779
781 {
782 STAT(NADE_BONUS_TYPE, player) = nades_CheckTypes(Nades_FromString(CS_CVAR(player).cvar_cl_nade_type)).m_id;
783 player.pokenade_type = CS_CVAR(player).cvar_cl_pokenade_type;
784 }
785 else
786 {
787 STAT(NADE_BONUS_TYPE, player) = Nades_FromString(autocvar_g_nades_bonus_type).m_id;
788 player.pokenade_type = autocvar_g_nades_pokenade_monster_type;
789 }
790
791 if (STAT(NADE_BONUS_SCORE, player) >= 0 && autocvar_g_nades_bonus_score_max)
793 }
794 else
795 STAT(NADE_BONUS, player) = STAT(NADE_BONUS_SCORE, player) = 0;
796
797 nade_veil_Apply(player);
798 }
799}
800
801MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
802{
803 entity player = M_ARGV(0, entity);
804
805 if (StatusEffects_active(STATUSEFFECT_SpawnShield, player))
806 player.nade_refire = StatusEffects_gettime(STATUSEFFECT_SpawnShield, player);
807 else
808 player.nade_refire = time;
809
811 player.nade_refire += autocvar_g_nades_nade_refire;
812
814 STAT(NADE_BONUS_TYPE, player) = Nades_FromString(CS_CVAR(player).cvar_cl_nade_type).m_id;
815
816 STAT(NADE_TIMER, player) = 0;
817
818 if (!player.offhand)
819 player.offhand = OFFHAND_NADE;
820
821 if (player.nade_spawnloc)
822 {
823 setorigin(player, player.nade_spawnloc.origin);
824 --player.nade_spawnloc.cnt;
825
826 if (player.nade_spawnloc.cnt <= 0)
827 {
828 delete(player.nade_spawnloc);
829 player.nade_spawnloc = NULL;
830 }
831
833 }
834}
835
837{
838 entity frag_attacker = M_ARGV(1, entity);
840
841 if (frag_target.nade
843 toss_nade(frag_target, true, '0 0 100', max(frag_target.nade.wait, time + 0.05));
844
845 if (IS_PLAYER(frag_attacker))
846 {
847 float killcount_bonus = (CS(frag_attacker).killcount >= 1)
850 if (SAME_TEAM(frag_attacker, frag_target) || frag_attacker == frag_target)
851 nades_RemoveBonus(frag_attacker);
854 else if (autocvar_g_nades_bonus_score_spree && CS(frag_attacker).killcount > 1)
855 {
856 #define SPREE_ITEM(counta, countb, center, normal, gentle) \
857 case counta: \
858 nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_spree); \
859 break;
860 switch (CS(frag_attacker).killcount)
861 {
863 default:
865 break;
866 }
867 #undef SPREE_ITEM
868 }
869 else
870 nades_GiveBonus(frag_attacker, killcount_bonus);
871 }
872
874}
875
876MUTATOR_HOOKFUNCTION(nades, Damage_Calculate)
877{
878 entity frag_inflictor = M_ARGV(0, entity);
879 entity frag_attacker = M_ARGV(1, entity);
881 float frag_deathtype = M_ARGV(3, float);
882
883 if (autocvar_g_freezetag_revive_nade && STAT(FROZEN, frag_target) && frag_attacker == frag_target && frag_deathtype == DEATH_NADE.m_id
884 && time - frag_inflictor.toss_time <= 0.1)
885 {
888 Send_Effect(EFFECT_ICEORGLASS, frag_target.origin, '0 0 0', 3);
889 M_ARGV(4, float) = 0;
890 M_ARGV(6, vector) = '0 0 0';
891 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_REVIVED_NADE, frag_target.netname);
892 Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_REVIVE_SELF);
893 }
894}
895
896MUTATOR_HOOKFUNCTION(nades, MonsterDies)
897{
899 entity frag_attacker = M_ARGV(1, entity);
900
901 if (IS_PLAYER(frag_attacker) && DIFF_TEAM(frag_attacker, frag_target)
902 && !(frag_target.spawnflags & MONSTERFLAG_SPAWNED))
904}
905
906MUTATOR_HOOKFUNCTION(nades, DropSpecialItems)
907{
909
910 if (frag_target.nade)
911 toss_nade(frag_target, true, '0 0 0', time + 0.05);
912}
913
915{
916 nades_Clear(this);
917 nades_RemoveBonus(this);
918 delete(this.nade_spawnloc);
919 this.nade_spawnloc = NULL;
920}
921
922MUTATOR_HOOKFUNCTION(nades, MakePlayerObserver)
923{
924 entity player = M_ARGV(0, entity);
925 nades_RemovePlayer(player);
926}
928{
929 entity player = M_ARGV(0, entity);
930 nades_RemovePlayer(player);
931}
932MUTATOR_HOOKFUNCTION(nades, reset_map_global)
933{
935}
936
938{
939 entity spectatee = M_ARGV(0, entity);
940 entity client = M_ARGV(1, entity);
941
942 STAT(NADE_TIMER, client) = STAT(NADE_TIMER, spectatee);
943 STAT(NADE_BONUS_TYPE, client) = STAT(NADE_BONUS_TYPE, spectatee);
944 client.pokenade_type = spectatee.pokenade_type;
945 STAT(NADE_BONUS, client) = STAT(NADE_BONUS, spectatee);
946 STAT(NADE_BONUS_SCORE, client) = STAT(NADE_BONUS_SCORE, spectatee);
947}
948
949MUTATOR_HOOKFUNCTION(nades, BuildMutatorsPrettyString)
950{
951 M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Nades");
952}
953
954MUTATOR_HOOKFUNCTION(nades, BuildMutatorsString)
955{
956 M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Nades");
957}
IntrusiveList g_bot_dodge
Definition api.qh:150
#define MUTATOR_ONADD
Definition base.qh:309
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
#define REGISTER_MUTATOR(...)
Definition base.qh:295
const int CBC_ORDER_LAST
Definition base.qh:11
#define MUTATOR_HOOKFUNCTION(...)
Definition base.qh:335
vector W_CalculateSpread(vector dir, float spread, int spread_style, bool must_normalize)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float max_health
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
virtual void offhand_think()
Definition sv_nades.qc:676
Definition nades.qh:14
string netname
Definition nades.qh:21
float m_alpha
Definition nades.qh:19
vector m_color
Definition nades.qh:16
int m_id
Definition nades.qh:15
int m_projectile[2]
Definition nades.qh:41
string netname
Definition powerups.qc:20
float alpha
Definition items.qc:13
float wait
Definition items.qc:17
entity owner
Definition main.qh:87
int team
Definition main.qh:188
#define colormapPaletteColor(c, isPants)
Definition color.qh:5
#define setmodel(this, m)
Definition model.qh:26
#define M_ARGV(x, type)
Definition events.qh:17
void nade_ammo_boom(entity this)
Definition ammo.qc:67
float autocvar_g_nades_ammo_friend
Definition ammo.qh:9
bool autocvar_g_nades_ammo
Definition ammo.qh:6
float ltime
Definition net.qh:10
#define PHYS_INPUT_BUTTON_CROUCH(s)
Definition player.qh:156
#define IS_DEAD(s)
Definition player.qh:244
vector v_angle
Definition player.qh:236
#define IS_PLAYER(s)
Definition player.qh:242
vector findbetterlocation(vector org, float mindist)
Definition util.qc:116
const int FL_PROJECTILE
Definition constants.qh:85
vector v_up
const float MOVE_NOMONSTERS
float DPCONTENTS_BOTCLIP
const float SOLID_TRIGGER
float DPCONTENTS_SOLID
const float SOLID_CORPSE
vector velocity
float DPCONTENTS_BODY
float DPCONTENTS_PLAYERCLIP
float skin
float time
vector v_right
float trace_startsolid
vector size
float nextthink
float colormap
vector v_forward
vector origin
void UpdateCSQCProjectile(entity e)
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
IntrusiveList g_damagedbycontents
Definition damage.qh:143
float spawnshieldtime
Definition damage.qh:61
void nade_darkness_boom(entity this)
Definition darkness.qc:66
bool autocvar_g_nades_darkness
Definition darkness.qh:6
bool autocvar_g_nades_darkness_teamcheck
Definition darkness.qh:8
#define DEATH_ISWEAPON(t, w)
Definition all.qh:46
#define DEATH_WEAPONOF(t)
Definition all.qh:45
const int HITTYPE_SECONDARY
Definition all.qh:29
void SUB_Remove(entity this)
Remove entity.
Definition defer.qh:13
float traileffectnum
float EF_LOWPRECISION
entity exteriormodeltoclient
#define nade(name, colormin1, colormax1, colormin2, colormax2)
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:120
void Send_Effect_Except(entity eff, vector eff_loc, vector eff_vel, int eff_cnt, vector eff_col_min, vector eff_col_max, entity ignore)
Definition all.qc:101
clientcolors
Definition ent_cs.qc:147
void nade_entrap_boom(entity this)
Definition entrap.qc:33
bool autocvar_g_nades_entrap
Definition entrap.qh:6
float autocvar_g_nades_entrap_strength
Definition entrap.qh:7
float autocvar_g_nades_entrap_speed
Definition entrap.qh:8
float timer
Definition hud.qh:125
void nade_ice_boom(entity this)
Definition ice.qc:74
bool autocvar_g_nades_ice
Definition ice.qh:6
bool autocvar_g_nades_ice_teamcheck
Definition ice.qh:9
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
#define FOREACH(list, cond, body)
Definition iter.qh:19
#define PlayerPreThink
Definition _all.inc:254
#define PutClientInServer
Definition _all.inc:246
#define ClientDisconnect
Definition _all.inc:242
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:167
#define STAT(...)
Definition stats.qh:82
float bound(float min, float value, float max)
vector vectoangles(vector v)
string ftos(float f)
float floor(float f)
float max(float f,...)
void nade_monster_boom(entity this)
Definition monster.qc:7
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_BOUNCE
Definition movetypes.qh:139
#define IS_ONGROUND(s)
Definition movetypes.qh:16
void nade_heal_boom(entity this)
Definition heal.qc:53
float autocvar_g_nades_heal_friend
Definition heal.qh:10
bool autocvar_g_nades_heal
Definition heal.qh:6
float autocvar_g_nades_heal_armor_rate
Definition heal.qh:9
bool autocvar_g_nades_pokenade
Definition monster.qh:7
string autocvar_g_nades_pokenade_monster_type
Definition monster.qh:8
void nade_spawn_boom(entity this)
Definition spawn.qc:4
void nade_spawn_SetSpawnHealth(entity player)
Definition spawn.qc:22
bool nade_spawn_DestroyDamage(entity this, entity attacker)
Definition spawn.qc:28
bool autocvar_g_nades_spawn
Definition spawn.qh:6
entity Nade_TrailEffect(int proj, int nade_team)
Definition nades.qc:17
float autocvar_g_nades_spread
Definition nades.qc:7
void nade_napalm_boom(entity this)
Definition napalm.qc:134
bool autocvar_g_nades_napalm
Definition napalm.qh:6
bool orb_send(entity this, entity to, int sf)
Definition net.qc:102
var void func_null()
void nade_normal_boom(entity this)
Definition normal.qc:4
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1573
void Kill_Notification(NOTIF broadcast, entity client, MSG net_type, CPID net_cpid)
Definition all.qc:1537
#define KILL_SPREE_LIST
Definition all.qh:491
#define NEW(cname,...)
Definition oo.qh:117
#define CLASS(...)
Definition oo.qh:145
#define ENDCLASS(cname)
Definition oo.qh:281
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define NULL
Definition post.qh:14
#define makevectors
Definition post.qh:21
ERASEABLE void RandomSelection_Init()
Definition random.qc:4
#define RandomSelection_AddEnt(e, weight, priority)
Definition random.qh:14
entity RandomSelection_chosen_ent
Definition random.qh:5
#define REGISTRY_GET(id, i)
Definition registry.qh:43
#define setthink(e, f)
vector
Definition self.qh:92
entity this
Definition self.qh:72
#define setcefc(e, f)
entity entity toucher
Definition self.qh:72
#define settouch(e, f)
Definition self.qh:73
void SpectateCopy(entity this, entity spectatee)
Definition client.qc:1794
int killcount
Definition client.qh:315
void RemoveHook(entity this)
Definition hook.qc:48
int dir
Definition impulse.qc:89
#define ITEM_TOUCH_NEEDKILL()
Definition items.qh:122
#define ITEM_DAMAGE_NEEDKILL(dt)
Definition items.qh:123
void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
Definition common.qc:87
const int MIF_SPLASH
Definition common.qh:46
#define PROJECTILE_TOUCH(e, t)
Definition common.qh:28
IntrusiveList g_projectiles
Definition common.qh:58
const int MIF_ARC
Definition common.qh:47
#define PROJECTILE_MAKETRIGGER(e)
Definition common.qh:34
const float VOL_BASE
Definition sound.qh:36
const int CH_SHOTS
Definition sound.qh:14
const int CH_WEAPON_A
Definition sound.qh:7
const float ATTEN_MAX
Definition sound.qh:34
const int CH_SHOTS_SINGLE
Definition sound.qh:15
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52
const float ATTEN_LARGE
Definition sound.qh:31
Sound SND_GRENADE_BOUNCE_RANDOM()
Definition all.inc:17
void play2(entity e, string filename)
Definition all.qc:116
float spamsound(entity e, int chan, Sound samp, float vol, float _atten)
use this one if you might be causing spam (e.g.
Definition all.qc:124
#define SND(id)
Definition all.qh:35
#define CS_CVAR(this)
Definition state.qh:51
ClientState CS(Client this)
Definition state.qh:47
float StatusEffects_gettime(StatusEffect this, entity actor)
bool StatusEffects_active(StatusEffect this, entity actor)
const int DAMAGE_NO
Definition subs.qh:79
const int DAMAGE_AIM
Definition subs.qh:81
float takedamage
Definition subs.qh:78
if(frag_attacker.flagcarried)
Definition sv_ctf.qc:2318
entity frag_target
Definition sv_ctf.qc:2314
entity enemy
Definition sv_ctf.qh:153
void freezetag_Unfreeze(entity targ, bool reset_health)
float autocvar_g_freezetag_revive_nade_health
bool autocvar_g_freezetag_revive_nade
#define FOR_EACH_KH_KEY(v)
Definition sv_keyhunt.qh:27
const int MONSTERFLAG_SPAWNED
flag for spawned monsters
float autocvar_g_monsters
Definition sv_monsters.qh:5
#define SET_NADE_EFFECT(nade_type, exp_effect, exp_color_min, exp_color_max)
void nades_RemoveBonus(entity player)
Remove all bonus nades from a player.
Definition sv_nades.qc:465
void nades_orb_think(entity this)
Definition sv_nades.qc:60
void nade_boom(entity this)
Definition sv_nades.qc:114
void spawn_held_nade(entity player, entity nowner, float ntime, string ntype, string pntype)
Definition sv_nades.qc:530
entity nades_spawn_orb(entity this, float orb_lifetime, float orb_rad)
Spawns an orb for some nade types.
Definition sv_nades.qc:79
vector nades_PlayerColor(entity this, bool isPants)
Definition sv_nades.qc:13
bool CanThrowNade(entity this)
Definition sv_nades.qc:618
void nade_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition sv_nades.qc:246
void nades_Clear(entity player)
Remove nades that are being thrown.
Definition sv_nades.qc:656
void nade_pickup(entity this, entity thenade)
Definition sv_nades.qc:179
void nades_CheckThrow(entity this)
Definition sv_nades.qc:625
bool nade_customize(entity this, entity client)
Definition sv_nades.qc:477
Nade Nades_FromString(string ntype)
Definition sv_nades.qc:513
void nades_GiveBonus(entity player, float score)
Give a bonus grenade to a player.
Definition sv_nades.qc:445
void nades_RemovePlayer(entity this)
Remove nades and bonus nades from a player.
Definition sv_nades.qc:914
void nade_touch(entity this, entity toucher)
Definition sv_nades.qc:192
Nade nades_CheckTypes(Nade ntype)
Definition sv_nades.qc:419
void nade_burn_spawn(entity _nade)
Definition sv_nades.qc:35
bool nade_altbutton
Definition sv_nades.qc:623
#define NADE_TYPE_CHECK(nade_ent, nade_cvar)
int nade_choose_random()
Definition sv_nades.qc:502
entity nade_spawnloc
Definition sv_nades.qc:11
void nade_beep(entity this)
Definition sv_nades.qc:239
NadeOffhand OFFHAND_NADE
Definition sv_nades.qc:705
void nade_timer_think(entity this)
Definition sv_nades.qc:27
float nade_time_primed
Definition sv_nades.qc:9
Nade Nades_GetType(string ntype)
Definition sv_nades.qc:519
void nade_prime(entity this)
Definition sv_nades.qc:576
void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
Definition sv_nades.qc:321
void nade_spawn(entity _nade)
Definition sv_nades.qc:40
bool autocvar_g_nades
Definition sv_nades.qh:5
float nade_lifetime
Definition sv_nades.qh:45
float autocvar_g_nades_nade_minforce
Definition sv_nades.qh:15
int autocvar_g_nades_bonus_score_spree
Definition sv_nades.qh:40
int autocvar_g_nades_nade_newton_style
Definition sv_nades.qh:23
bool autocvar_g_nades_bonus_client_select
Definition sv_nades.qh:29
float autocvar_g_nades_nade_refire
Definition sv_nades.qh:18
bool autocvar_g_nades_override_dropweapon
Definition sv_nades.qh:6
string pokenade_type
Definition sv_nades.qh:48
float autocvar_g_nades_nade_lifetime
Definition sv_nades.qh:14
float autocvar_g_nades_pickup_time
Definition sv_nades.qh:13
bool autocvar_g_nades_bonus_onstrength
Definition sv_nades.qh:30
int autocvar_g_nades_bonus_score_time_flagcarrier
Definition sv_nades.qh:35
bool autocvar_g_nades_bonus_only
Definition sv_nades.qh:31
bool autocvar_g_nades_bonus
Definition sv_nades.qh:27
int autocvar_g_nades_bonus_score_time
Definition sv_nades.qh:34
float autocvar_g_nades_nade_health
Definition sv_nades.qh:17
bool autocvar_g_nades_onspawn
Definition sv_nades.qh:8
vector autocvar_g_nades_throw_offset
Definition sv_nades.qh:7
int autocvar_g_nades_bonus_max
Definition sv_nades.qh:32
entity fake_nade
Definition sv_nades.qh:44
float autocvar_g_nades_nade_maxforce
Definition sv_nades.qh:16
float nade_special_time
Definition sv_nades.qh:47
string autocvar_g_nades_bonus_type
Definition sv_nades.qh:28
string cvar_cl_nade_type
Definition sv_nades.qh:50
int autocvar_g_nades_bonus_score_minor
Definition sv_nades.qh:36
bool nade_show_particles
Definition sv_nades.qh:53
bool autocvar_g_nades_pickup
Definition sv_nades.qh:12
int autocvar_g_nades_bonus_score_medium
Definition sv_nades.qh:39
bool autocvar_g_nades_client_select
Definition sv_nades.qh:25
float nade_refire
Definition sv_nades.qh:46
string autocvar_g_nades_nade_type
Definition sv_nades.qh:24
int autocvar_g_nades_bonus_score_max
Definition sv_nades.qh:33
#define GameRules_scoring_is_vip(player)
Definition sv_rules.qh:79
entity vehicle
#define SAME_TEAM(a, b)
Definition teams.qh:241
vector Team_ColorRGB(int teamid)
Definition teams.qh:76
bool teamplay
Definition teams.qh:59
#define DIFF_TEAM(a, b)
Definition teams.qh:242
entity realowner
vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute)
Definition tracing.qc:174
int autocvar_g_projectiles_spread_style
Definition tracing.qh:14
vector w_shotorg
Definition tracing.qh:19
#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype)
Definition tracing.qh:34
void nade_translocate_boom(entity this)
Definition translocate.qc:4
bool nade_translocate_DestroyDamage(entity this, entity attacker)
bool autocvar_g_nades_translocate
Definition translocate.qh:6
#define IS_SPEC(v)
Definition utils.qh:10
#define IS_REAL_CLIENT(v)
Definition utils.qh:17
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:52
void nade_veil_Apply(entity player)
Definition veil.qc:34
void nade_veil_boom(entity this)
Definition veil.qc:28
bool autocvar_g_nades_veil
Definition veil.qh:6
#define WEPSET(id)
Definition all.qh:47
const int WEP_TYPE_MELEE_PRI
Definition weapon.qh:262
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17
const int WEP_TYPE_MELEE_SEC
Definition weapon.qh:263
bool weaponLocked(entity player)