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

Go to the source code of this file.

Functions

 spawnfunc (trigger_hurt)
bool tracebox_hits_trigger_hurt (vector start, vector e_min, vector e_max, vector end)
void trigger_hurt_touch (entity this, entity toucher)
void trigger_hurt_use (entity this, entity actor, entity trigger)

Variables

entity trigger_hurt_first
entity trigger_hurt_last
entity trigger_hurt_next
float triggerhurttime

Function Documentation

◆ spawnfunc()

spawnfunc ( trigger_hurt )

Definition at line 57 of file hurt.qc.

58{
60 this.active = ACTIVE_ACTIVE;
62 this.use = trigger_hurt_use;
63 this.enemy = world; // I hate you all
64 if (!this.dmg)
65 this.dmg = ((q3compat) ? 5 : 10000);
66 if (this.message == "")
67 this.message = "was in the wrong place";
68 if (this.message2 == "")
69 this.message2 = "was thrown into a world of hurt by";
70 // this.message = "someone like %s always gets wrongplaced";
71
73 trigger_hurt_first = this;
75 trigger_hurt_last.trigger_hurt_next = this;
76 trigger_hurt_last = this;
77}
float dmg
Definition breakable.qc:12
string message
Definition powerups.qc:19
#define use
int active
Definition defs.qh:34
const int ACTIVE_ACTIVE
Definition defs.qh:37
void trigger_hurt_use(entity this, entity actor, entity trigger)
Definition hurt.qc:3
entity trigger_hurt_first
Definition hurt.qc:56
void trigger_hurt_touch(entity this, entity toucher)
Definition hurt.qc:12
entity trigger_hurt_last
Definition hurt.qc:55
#define EXACTTRIGGER_INIT
Definition common.qh:116
#define world
Definition post.qh:15
q3compat
Definition quake3.qc:59
#define settouch(e, f)
Definition self.qh:73
entity enemy
Definition sv_ctf.qh:153
string message2
Definition triggers.qh:19

References active, ACTIVE_ACTIVE, dmg, enemy, EXACTTRIGGER_INIT, message, message2, q3compat, settouch, trigger_hurt_first, trigger_hurt_last, trigger_hurt_touch(), trigger_hurt_use(), use, and world.

◆ tracebox_hits_trigger_hurt()

bool tracebox_hits_trigger_hurt ( vector start,
vector e_min,
vector e_max,
vector end )

Definition at line 79 of file hurt.qc.

80{
81 entity th;
82
83 for(th = trigger_hurt_first; th; th = th.trigger_hurt_next)
84 if(tracebox_hits_box(start, e_min, e_max, end, th.absmin, th.absmax))
85 return true;
86
87 return false;
88}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma)
Definition util.qc:2143

References entity(), tracebox_hits_box(), trigger_hurt_first, and vector.

Referenced by havocbot_checkdanger(), havocbot_movetogoal(), Monster_CheckDanger(), MoveToRandomLocationWithinBounds(), MUTATOR_HOOKFUNCTION(), and navigation_routerating().

◆ trigger_hurt_touch()

void trigger_hurt_touch ( entity this,
entity toucher )

Definition at line 12 of file hurt.qc.

13{
14 if (!toucher.takedamage)
15 return;
16 if (this.active != ACTIVE_ACTIVE)
17 return;
18
19 if(this.team)
20 if(((this.spawnflags & INVERT_TEAMS) == 0) == (this.team != toucher.team))
21 return;
22
23 // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
24 if (toucher.iscreature)
25 {
26 if (time >= toucher.triggerhurttime + (q3compat && !(this.spawnflags & HURT_SLOW) ? 0.05 : 1))
27 {
29 toucher.triggerhurttime = time;
30
31 entity own;
32 own = this.enemy;
33 if (!IS_PLAYER(own))
34 {
35 own = this;
36 this.enemy = NULL; // I still hate you all
37 }
38
39 Damage (toucher, this, own, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, toucher.origin, '0 0 0');
40 }
41 }
42 else if(toucher.damagedbytriggers)
43 {
45 Damage(toucher, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, toucher.origin, '0 0 0');
46 }
47}
int team
Definition main.qh:188
int spawnflags
Definition ammo.qh:15
#define IS_PLAYER(s)
Definition player.qh:243
float time
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:503
#define DMG_NOWEP
Definition damage.qh:104
const int INVERT_TEAMS
Definition defs.qh:10
const int HURT_SLOW
Definition hurt.qh:4
#define EXACTTRIGGER_TOUCH(e, t)
Definition common.qh:115
#define NULL
Definition post.qh:14
entity entity toucher
Definition self.qh:72

References active, ACTIVE_ACTIVE, Damage(), dmg, DMG_NOWEP, enemy, entity(), EXACTTRIGGER_TOUCH, HURT_SLOW, INVERT_TEAMS, IS_PLAYER, NULL, q3compat, spawnflags, team, time, and toucher.

Referenced by spawnfunc().

◆ trigger_hurt_use()

void trigger_hurt_use ( entity this,
entity actor,
entity trigger )

Definition at line 3 of file hurt.qc.

4{
5 if(IS_PLAYER(actor))
6 this.enemy = actor;
7 else
8 this.enemy = NULL; // let's just destroy it, if taking over is too much work
9}

References enemy, entity(), IS_PLAYER, and NULL.

Referenced by spawnfunc().

Variable Documentation

◆ trigger_hurt_first

entity trigger_hurt_first

Definition at line 56 of file hurt.qc.

Referenced by spawnfunc(), and tracebox_hits_trigger_hurt().

◆ trigger_hurt_last

entity trigger_hurt_last

Definition at line 55 of file hurt.qc.

Referenced by spawnfunc().

◆ trigger_hurt_next

entity trigger_hurt_next

Definition at line 54 of file hurt.qc.

◆ triggerhurttime

float triggerhurttime

Definition at line 11 of file hurt.qc.