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) pushdeltatime = 0;
15 toucher.lastpushtime = time;
16 if(!pushdeltatime) return;
17
18 // div0: ticrate independent, 1 = identity (not 20)
19 toucher.velocity = toucher.velocity * (autocvar_g_nades_entrap_strength ** pushdeltatime);
20
21 #ifdef SVQC
23 #endif
24 }
25
26 if ( IS_REAL_CLIENT(toucher) || (IS_VEHICLE(toucher) && toucher.owner) )
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
34{
36
38 orb.colormod = NADE_TYPE_ENTRAP.m_color;
39}
40
41MUTATOR_HOOKFUNCTION(nades, PlayerPhysics_UpdateStats)
42{
43 entity player = M_ARGV(0, entity);
44 // these automatically reset, no need to worry
45
46 if(player.nade_entrap_time > time)
47 STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_nades_entrap_speed;
48}
49
50MUTATOR_HOOKFUNCTION(nades, MonsterMove)
51{
52 entity mon = M_ARGV(0, entity);
53
54 if (mon.nade_entrap_time > time)
55 {
56 M_ARGV(1, float) *= autocvar_g_nades_entrap_speed; // run speed
57 M_ARGV(2, float) *= autocvar_g_nades_entrap_speed; // walk speed
58 }
59
60 if (mon.nade_veil_time && mon.nade_veil_time <= time)
61 {
62 mon.alpha = mon.nade_veil_prevalpha;
63 mon.nade_veil_time = 0;
64 }
65}
66#endif // SVQC
67#ifdef MENUQC
68METHOD(EntrapNade, describe, string(EntrapNade this))
69{
70 TC(EntrapNade, this);
72 PAR(_("The %s detonates after a short delay, temporarily creating an orb around the point where it detonated for several seconds. "
73 "Players and projectiles that enter the sphere will be slowed down, including yourself."), COLORED_NAME(this));
74 return PAGE_TEXT;
75}
76#endif // MENUQC
#define MUTATOR_HOOKFUNCTION(...)
Definition base.qh:335
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
entity owner
Definition main.qh:87
#define COLORED_NAME(this)
Definition color.qh:195
#define M_ARGV(x, type)
Definition events.qh:17
float time
vector origin
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:643
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:649
#define PAGE_TEXT_INIT()
Definition string.qh:642
entity nades_spawn_orb(entity own, entity realown, vector org, float orb_ltime, float orb_rad)
Definition sv_nades.qc:75
#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:22