Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
heal.qc File Reference
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

void nade_heal_boom (entity this)
void nade_heal_touch (entity this, entity toucher)

Function Documentation

◆ nade_heal_boom()

void nade_heal_boom ( entity this)

Definition at line 51 of file heal.qc.

52{
55}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void nade_heal_touch(entity this, entity toucher)
Definition heal.qc:7
float autocvar_g_nades_heal_time
Definition heal.qh:7
float autocvar_g_nades_heal_radius
Definition heal.qh:12
#define settouch(e, f)
Definition self.qh:77
entity nades_spawn_orb(entity this, float orb_lifetime, float orb_rad)
Spawns an orb for some nade types.
Definition sv_nades.qc:60

References autocvar_g_nades_heal_radius, autocvar_g_nades_heal_time, entity(), nade_heal_touch(), nades_spawn_orb(), and settouch.

Referenced by nade_boom().

◆ nade_heal_touch()

void nade_heal_touch ( entity this,
entity toucher )

Definition at line 7 of file heal.qc.

8{
10 || IS_DEAD(toucher) || STAT(FROZEN, toucher))
11 return;
12
13 float health_factor = autocvar_g_nades_heal_rate * frametime * 0.5;
14 if (toucher != this.realowner)
15 health_factor *= (SAME_TEAM(toucher, this.realowner))
18
19 if (health_factor > 0)
20 {
21 float maxhealth = (IS_MONSTER(toucher))
22 ? toucher.max_health
24 if (GetResource(toucher, RES_HEALTH) < maxhealth)
25 {
26 nade_Effect(toucher, EFFECT_HEALING, 1);
27 GiveResourceWithLimit(toucher, RES_HEALTH, health_factor, maxhealth);
28 }
29 }
30 else if (health_factor < 0)
31 Damage(toucher, this, this.realowner,
32 -health_factor,
33 DEATH_NADE_HEAL.m_id,
35 toucher.origin,
36 '0 0 0'
37 );
38
39 float armor_factor = autocvar_g_nades_heal_armor_rate * frametime * 0.5;
40 if (toucher != this.realowner)
41 armor_factor *= autocvar_g_nades_heal_friend;
42
43 if (SAME_TEAM(toucher, this))
44 {
45 float maxarmor = autocvar_g_pickup_armormega_max;
46 if (GetResource(toucher, RES_ARMOR) < maxarmor)
47 GiveResourceWithLimit(toucher, RES_ARMOR, armor_factor, maxarmor);
48 }
49}
int autocvar_g_pickup_armormega_max
Definition armor.qh:180
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define IS_DEAD(s)
Definition player.qh:244
#define IS_PLAYER(s)
Definition player.qh:242
float frametime
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:484
#define DMG_NOWEP
Definition damage.qh:104
RES_ARMOR
Definition ent_cs.qc:155
int autocvar_g_pickup_healthmega_max
Definition health.qh:179
#define STAT(...)
Definition stats.qh:94
float autocvar_g_nades_heal_friend
Definition heal.qh:10
float autocvar_g_nades_heal_rate
Definition heal.qh:8
float autocvar_g_nades_heal_armor_rate
Definition heal.qh:9
float autocvar_g_nades_heal_foe
Definition heal.qh:11
void nade_Effect(entity player, entity eff, int eff_cnt)
Network nade effect data to player.
Definition net.qc:147
entity entity toucher
Definition self.qh:76
void GiveResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Gives an entity some resource but not more than a limit.
#define SAME_TEAM(a, b)
Definition teams.qh:241
entity realowner
#define IS_MONSTER(v)
Definition utils.qh:23
#define IS_VEHICLE(v)
Definition utils.qh:24

References autocvar_g_nades_heal_armor_rate, autocvar_g_nades_heal_foe, autocvar_g_nades_heal_friend, autocvar_g_nades_heal_rate, autocvar_g_pickup_armormega_max, autocvar_g_pickup_healthmega_max, Damage(), DMG_NOWEP, entity(), frametime, GetResource(), GiveResourceWithLimit(), IS_DEAD, IS_MONSTER, IS_PLAYER, IS_VEHICLE, nade_Effect(), realowner, RES_ARMOR, SAME_TEAM, STAT, and toucher.

Referenced by nade_heal_boom().