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

Go to the source code of this file.

Functions

 MUTATOR_HOOKFUNCTION (touchexplode, PlayerPreThink)
void PlayerTouchExplode (entity p1, entity p2)
 REGISTER_MUTATOR (touchexplode, expr_evaluate(autocvar_g_touchexplode))
 SOUND (TOUCHEXPLODE, W_Sound("grenade_impact"))

Variables

string autocvar_g_touchexplode
float autocvar_g_touchexplode_damage
float autocvar_g_touchexplode_edgedamage
float autocvar_g_touchexplode_force
float autocvar_g_touchexplode_radius
float touchexplode_time

Function Documentation

◆ MUTATOR_HOOKFUNCTION()

MUTATOR_HOOKFUNCTION ( touchexplode ,
PlayerPreThink  )

Definition at line 29 of file sv_touchexplode.qc.

30{
31 entity player = M_ARGV(0, entity);
32
33 if(time > player.touchexplode_time && !game_stopped && !IS_DEAD(player) && IS_PLAYER(player) && !STAT(FROZEN, player) && !IS_INDEPENDENT_PLAYER(player))
34 {
35 FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
36 if(time > it.touchexplode_time && !STAT(FROZEN, it) && !IS_DEAD(it) && !IS_INDEPENDENT_PLAYER(it))
37 if(boxesoverlap(player.absmin, player.absmax, it.absmin, it.absmax))
38 {
39 PlayerTouchExplode(player, it);
40 player.touchexplode_time = it.touchexplode_time = time + 0.2;
41 }
42 });
43 }
44}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define M_ARGV(x, type)
Definition events.qh:17
#define IS_DEAD(s)
Definition player.qh:245
#define IS_PLAYER(s)
Definition player.qh:243
float game_stopped
Definition stats.qh:81
float time
#define STAT(...)
Definition stats.qh:82
#define IS_INDEPENDENT_PLAYER(e)
Definition client.qh:312
void PlayerTouchExplode(entity p1, entity p2)
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50
ERASEABLE float boxesoverlap(vector m1, vector m2, vector m3, vector m4)
requires that m2>m1 in all coordinates, and that m4>m3
Definition vector.qh:73

References boxesoverlap(), entity(), FOREACH_CLIENT, game_stopped, IS_DEAD, IS_INDEPENDENT_PLAYER, IS_PLAYER, M_ARGV, PlayerPreThink, PlayerTouchExplode(), STAT, and time.

◆ PlayerTouchExplode()

void PlayerTouchExplode ( entity p1,
entity p2 )

Definition at line 15 of file sv_touchexplode.qc.

16{
17 vector org = (p1.origin + p2.origin) * 0.5;
18 org.z += (p1.mins.z + p2.mins.z) * 0.5;
19
20 sound(p1, CH_TRIGGER, SND_TOUCHEXPLODE, VOL_BASE, ATTEN_NORM);
21 Send_Effect(EFFECT_EXPLOSION_SMALL, org, '0 0 0', 1);
22
23 entity e = spawn();
24 setorigin(e, org);
26 delete(e);
27}
#define spawn
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
Definition damage.qc:981
#define DMG_NOWEP
Definition damage.qh:104
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:124
#define NULL
Definition post.qh:14
vector
Definition self.qh:92
vector org
Definition self.qh:92
const int CH_TRIGGER
Definition sound.qh:12
const float VOL_BASE
Definition sound.qh:36
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52
float autocvar_g_touchexplode_radius
float autocvar_g_touchexplode_force
float autocvar_g_touchexplode_edgedamage
float autocvar_g_touchexplode_damage

References ATTEN_NORM, autocvar_g_touchexplode_damage, autocvar_g_touchexplode_edgedamage, autocvar_g_touchexplode_force, autocvar_g_touchexplode_radius, CH_TRIGGER, DMG_NOWEP, entity(), NULL, org, RadiusDamage(), Send_Effect(), sound, spawn, vector, and VOL_BASE.

Referenced by MUTATOR_HOOKFUNCTION().

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( touchexplode ,
expr_evaluate(autocvar_g_touchexplode)  )

◆ SOUND()

SOUND ( TOUCHEXPLODE ,
W_Sound("grenade_impact")  )

Variable Documentation

◆ autocvar_g_touchexplode

string autocvar_g_touchexplode

Definition at line 3 of file sv_touchexplode.qc.

Referenced by REGISTER_MUTATOR().

◆ autocvar_g_touchexplode_damage

float autocvar_g_touchexplode_damage

Definition at line 5 of file sv_touchexplode.qc.

Referenced by PlayerTouchExplode().

◆ autocvar_g_touchexplode_edgedamage

float autocvar_g_touchexplode_edgedamage

Definition at line 6 of file sv_touchexplode.qc.

Referenced by PlayerTouchExplode().

◆ autocvar_g_touchexplode_force

float autocvar_g_touchexplode_force

Definition at line 7 of file sv_touchexplode.qc.

Referenced by PlayerTouchExplode().

◆ autocvar_g_touchexplode_radius

float autocvar_g_touchexplode_radius

Definition at line 4 of file sv_touchexplode.qc.

Referenced by PlayerTouchExplode().

◆ touchexplode_time

float touchexplode_time

Definition at line 13 of file sv_touchexplode.qc.