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 53 of file heal.qc.

54{
57}
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: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_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 if (this.nade_show_particles)
27 Send_Effect(EFFECT_HEALING, toucher.origin, vec2(toucher.velocity), 1);
28
29 GiveResourceWithLimit(toucher, RES_HEALTH, health_factor, maxhealth);
30 }
31 }
32 else if (health_factor < 0)
33 Damage(toucher, this, this.realowner,
34 -health_factor,
35 DEATH_NADE_HEAL.m_id,
37 toucher.origin,
38 '0 0 0'
39 );
40
41 float armor_factor = autocvar_g_nades_heal_armor_rate * frametime * 0.5;
42 if (toucher != this.realowner)
43 armor_factor *= autocvar_g_nades_heal_friend;
44
45 if (SAME_TEAM(toucher, this))
46 {
47 float maxarmor = autocvar_g_pickup_armormega_max;
48 if (GetResource(toucher, RES_ARMOR) < maxarmor)
49 GiveResourceWithLimit(toucher, RES_ARMOR, armor_factor, maxarmor);
50 }
51}
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:493
#define DMG_NOWEP
Definition damage.qh:104
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:120
RES_ARMOR
Definition ent_cs.qc:130
int autocvar_g_pickup_healthmega_max
Definition health.qh:179
#define STAT(...)
Definition stats.qh:82
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
entity entity toucher
Definition self.qh:72
bool nade_show_particles
Definition sv_nades.qh:53
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
#define vec2(...)
Definition vector.qh:90

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_show_particles, realowner, RES_ARMOR, SAME_TEAM, Send_Effect(), STAT, toucher, and vec2.

Referenced by nade_heal_boom().