Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
heal.qc
Go to the documentation of this file.
1#include "heal.qh"
2
3#ifdef SVQC
6
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}
50
56#endif // SVQC
57#ifdef MENUQC
58METHOD(HealNade, describe, string(HealNade this))
59{
60 TC(HealNade, this);
62 PAR(_("The %s detonates after a short delay, temporarily creating a healing orb around the point where it detonated for several seconds. "
63 "If your team members enter the orb they will recover health, and if enemies enter the sphere they will be harmed."), COLORED_NAME(this));
64 return PAGE_TEXT;
65}
66#endif // MENUQC
int autocvar_g_pickup_armormega_max
Definition armor.qh:180
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define COLORED_NAME(this)
Definition color.qh:189
#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 TC(T, sym)
Definition _all.inc:82
#define STAT(...)
Definition stats.qh:94
void nade_heal_boom(entity this)
Definition heal.qc:51
void nade_heal_touch(entity this, entity toucher)
Definition heal.qc:7
float autocvar_g_nades_heal_friend
Definition heal.qh:10
float autocvar_g_nades_heal_time
Definition heal.qh:7
float autocvar_g_nades_heal_rate
Definition heal.qh:8
float autocvar_g_nades_heal_radius
Definition heal.qh:12
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
#define METHOD(cname, name, prototype)
Definition oo.qh:274
entity entity toucher
Definition self.qh:76
#define settouch(e, f)
Definition self.qh:77
#define PAGE_TEXT
Definition string.qh:651
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:657
#define PAGE_TEXT_INIT()
Definition string.qh:650
entity nades_spawn_orb(entity this, float orb_lifetime, float orb_rad)
Spawns an orb for some nade types.
Definition sv_nades.qc:60
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