Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
entrap.qc
Go to the documentation of this file.
1#include "entrap.qh"
2
3#ifdef SVQC
4#include "veil.qh"
5
7{
8 if (DIFF_TEAM(toucher, this.realowner)) // TODO: what if realowner changes team or disconnects?
9 {
10 if (!isPushable(toucher))
11 return;
12
13 float pushdeltatime = time - toucher.lastpushtime;
14 if (pushdeltatime > 0.15)
15 pushdeltatime = 0;
16 toucher.lastpushtime = time;
17 if (!pushdeltatime)
18 return;
19
20 // div0: ticrate independent, 1 = identity (not 20)
21 toucher.velocity *= autocvar_g_nades_entrap_strength ** pushdeltatime;
22
24 }
25
27 {
28 entity real_toucher = (IS_VEHICLE(toucher) && toucher.owner) ? toucher.owner : toucher;
29 real_toucher.nade_entrap_time = time + 0.1;
30 }
31}
32
38
39MUTATOR_HOOKFUNCTION(nades, PlayerPhysics_UpdateStats)
40{
41 entity player = M_ARGV(0, entity);
42 // these automatically reset, no need to worry
43
44 if (player.nade_entrap_time > time)
45 STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_nades_entrap_speed;
46}
47
48MUTATOR_HOOKFUNCTION(nades, MonsterMove)
49{
50 entity mon = M_ARGV(0, entity);
51
52 if (mon.nade_entrap_time > time)
53 {
54 M_ARGV(1, float) *= autocvar_g_nades_entrap_speed; // run speed
55 M_ARGV(2, float) *= autocvar_g_nades_entrap_speed; // walk speed
56 }
57
58 if (mon.nade_veil_time && mon.nade_veil_time <= time)
59 {
60 mon.alpha = mon.nade_veil_prevalpha;
61 mon.nade_veil_time = 0;
62 }
63}
64#endif // SVQC
65#ifdef MENUQC
66METHOD(EntrapNade, describe, string(EntrapNade this))
67{
68 TC(EntrapNade, this);
70 PAR(_("The %s detonates after a short delay, temporarily creating an orb around the point where it detonated for several seconds. "
71 "Players and projectiles that enter the sphere will be slowed down, including yourself."), COLORED_NAME(this));
72 return PAGE_TEXT;
73}
74#endif // MENUQC
#define MUTATOR_HOOKFUNCTION(...)
Definition base.qh:335
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define COLORED_NAME(this)
Definition color.qh:195
#define M_ARGV(x, type)
Definition events.qh:17
float time
void UpdateCSQCProjectile(entity e)
void nade_entrap_touch(entity this, entity toucher)
Definition entrap.qc:6
void nade_entrap_boom(entity this)
Definition entrap.qc:33
float autocvar_g_nades_entrap_time
Definition entrap.qh:10
float autocvar_g_nades_entrap_strength
Definition entrap.qh:7
float autocvar_g_nades_entrap_speed
Definition entrap.qh:8
float autocvar_g_nades_entrap_radius
Definition entrap.qh:9
#define TC(T, sym)
Definition _all.inc:82
#define STAT(...)
Definition stats.qh:82
#define METHOD(cname, name, prototype)
Definition oo.qh:269
entity entity toucher
Definition self.qh:72
#define settouch(e, f)
Definition self.qh:73
#define PAGE_TEXT
Definition string.qh:642
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:648
#define PAGE_TEXT_INIT()
Definition string.qh:641
entity nades_spawn_orb(entity this, float orb_lifetime, float orb_rad)
Spawns an orb for some nade types.
Definition sv_nades.qc:79
#define DIFF_TEAM(a, b)
Definition teams.qh:242
entity realowner
bool isPushable(entity e)
Definition triggers.qc:3
#define IS_REAL_CLIENT(v)
Definition utils.qh:17
#define IS_VEHICLE(v)
Definition utils.qh:24