Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
entrap.qc File Reference
#include "entrap.qh"
#include "veil.qh"
Include dependency graph for entrap.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 MUTATOR_HOOKFUNCTION (nades, MonsterMove)
 MUTATOR_HOOKFUNCTION (nades, PlayerPhysics_UpdateStats)
void nade_entrap_boom (entity this)
void nade_entrap_touch (entity this, entity toucher)

Function Documentation

◆ MUTATOR_HOOKFUNCTION() [1/2]

MUTATOR_HOOKFUNCTION ( nades ,
MonsterMove  )

Definition at line 48 of file entrap.qc.

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}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define M_ARGV(x, type)
Definition events.qh:17
float time
float autocvar_g_nades_entrap_speed
Definition entrap.qh:8

References autocvar_g_nades_entrap_speed, entity(), M_ARGV, and time.

◆ MUTATOR_HOOKFUNCTION() [2/2]

MUTATOR_HOOKFUNCTION ( nades ,
PlayerPhysics_UpdateStats  )

Definition at line 39 of file entrap.qc.

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}
#define STAT(...)
Definition stats.qh:82

References autocvar_g_nades_entrap_speed, entity(), M_ARGV, STAT, and time.

◆ nade_entrap_boom()

void nade_entrap_boom ( entity this)

Definition at line 33 of file entrap.qc.

34{
37}
void nade_entrap_touch(entity this, entity toucher)
Definition entrap.qc:6
float autocvar_g_nades_entrap_time
Definition entrap.qh:10
float autocvar_g_nades_entrap_radius
Definition entrap.qh:9
#define settouch(e, f)
Definition self.qh:73
entity nades_spawn_orb(entity this, float orb_lifetime, float orb_rad)
Spawns an orb for some nade types.
Definition sv_nades.qc:79

References autocvar_g_nades_entrap_radius, autocvar_g_nades_entrap_time, entity(), nade_entrap_touch(), nades_spawn_orb(), and settouch.

Referenced by nade_boom().

◆ nade_entrap_touch()

void nade_entrap_touch ( entity this,
entity toucher )

Definition at line 6 of file entrap.qc.

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}
void UpdateCSQCProjectile(entity e)
float autocvar_g_nades_entrap_strength
Definition entrap.qh:7
entity entity toucher
Definition self.qh:72
#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

References autocvar_g_nades_entrap_strength, DIFF_TEAM, entity(), IS_REAL_CLIENT, IS_VEHICLE, isPushable(), realowner, time, toucher, and UpdateCSQCProjectile().

Referenced by nade_entrap_boom().