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

Go to the source code of this file.

Functions

 spawnfunc (target_heal)
 spawnfunc (trigger_heal)
void trigger_heal_init (entity this)
void trigger_heal_touch (entity this, entity toucher)
void trigger_heal_use (entity this, entity actor, entity trigger)

Variables

float triggerhealtime

Function Documentation

◆ spawnfunc() [1/2]

spawnfunc ( target_heal )

Definition at line 55 of file heal.qc.

56{
57 this.use = trigger_heal_use;
59}
#define use
void trigger_heal_init(entity this)
Definition heal.qc:34
void trigger_heal_use(entity this, entity actor, entity trigger)
Definition heal.qc:29

References trigger_heal_init(), trigger_heal_use(), and use.

◆ spawnfunc() [2/2]

spawnfunc ( trigger_heal )

Definition at line 48 of file heal.qc.

49{
53}
#define EXACTTRIGGER_INIT
Definition common.qh:116
void trigger_heal_touch(entity this, entity toucher)
Definition heal.qc:4
#define settouch(e, f)
Definition self.qh:73

References EXACTTRIGGER_INIT, settouch, trigger_heal_init(), and trigger_heal_touch().

◆ trigger_heal_init()

void trigger_heal_init ( entity this)

Definition at line 34 of file heal.qc.

35{
36 this.active = ACTIVE_ACTIVE;
37 if(!this.delay)
38 this.delay = 1;
39 if(!this.health)
40 this.health = 10;
41 if(!this.max_health)
42 this.max_health = 200; // max health topoff for field
43 if(this.noise == "")
44 this.noise = "misc/mediumhealth.wav";
46}
float max_health
float delay
Definition items.qc:17
int active
Definition defs.qh:34
const int ACTIVE_ACTIVE
Definition defs.qh:37
string precache_sound(string sample)
float health
Legacy fields for the resources. To be removed.
Definition resources.qh:9
string noise
Definition subs.qh:83

References active, ACTIVE_ACTIVE, delay, entity(), health, max_health, noise, and precache_sound().

Referenced by spawnfunc(), and spawnfunc().

◆ trigger_heal_touch()

void trigger_heal_touch ( entity this,
entity toucher )

Definition at line 4 of file heal.qc.

5{
6 if (this.active != ACTIVE_ACTIVE)
7 return;
8
9 // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
10 if (toucher.iscreature)
11 {
12 if (toucher.takedamage && !IS_DEAD(toucher) && toucher.triggerhealtime < time)
13 {
14 bool is_trigger = this.targetname == "";
15 if(is_trigger)
17 if(this.delay > 0)
18 toucher.triggerhealtime = time + this.delay;
19
20 bool playthesound = (this.spawnflags & HEAL_SOUND_ALWAYS);
21 bool healed = Heal(toucher, this, this.health, this.max_health);
22
23 if(playthesound || healed)
25 }
26 }
27}
int spawnflags
Definition ammo.qh:15
#define IS_DEAD(s)
Definition player.qh:245
float time
bool Heal(entity targ, entity inflictor, float amount, float limit)
Definition damage.qc:987
#define EXACTTRIGGER_TOUCH(e, t)
Definition common.qh:115
const int HEAL_SOUND_ALWAYS
Definition heal.qh:4
entity entity toucher
Definition self.qh:72
const int CH_TRIGGER
Definition sound.qh:12
const float VOL_BASE
Definition sound.qh:36
#define _sound(e, c, s, v, a)
Definition sound.qh:43
const float ATTEN_NORM
Definition sound.qh:30
string targetname
Definition triggers.qh:56

References _sound, active, ACTIVE_ACTIVE, ATTEN_NORM, CH_TRIGGER, delay, entity(), EXACTTRIGGER_TOUCH, Heal(), HEAL_SOUND_ALWAYS, health, IS_DEAD, max_health, noise, spawnflags, targetname, time, toucher, and VOL_BASE.

Referenced by spawnfunc(), and trigger_heal_use().

◆ trigger_heal_use()

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

Definition at line 29 of file heal.qc.

30{
31 trigger_heal_touch(this, actor);
32}

References entity(), and trigger_heal_touch().

Referenced by spawnfunc().

Variable Documentation

◆ triggerhealtime

float triggerhealtime

Definition at line 3 of file heal.qc.