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
5{
6 float maxhealth;
7 float health_factor;
8
10 if(!IS_DEAD(toucher))
11 if(!STAT(FROZEN, toucher))
12 {
13 health_factor = autocvar_g_nades_heal_rate*frametime/2;
14 if ( toucher != this.realowner )
16
17 if ( health_factor > 0 )
18 {
19 maxhealth = (IS_MONSTER(toucher)) ? toucher.max_health : autocvar_g_pickup_healthmega_max;
20 float hp = GetResource(toucher, RES_HEALTH);
21 if (hp < maxhealth)
22 {
23 if (this.nade_show_particles)
24 Send_Effect(EFFECT_HEALING, toucher.origin, '0 0 0', 1);
25
26 GiveResourceWithLimit(toucher, RES_HEALTH, health_factor, maxhealth);
27 }
28 }
29 else if ( health_factor < 0 )
30 Damage(toucher,this,this.realowner,-health_factor,DEATH_NADE_HEAL.m_id,DMG_NOWEP,toucher.origin,'0 0 0');
31 }
32}
33
35{
37
39 orb.colormod = '1 0 0';
40}
41#endif // SVQC
42#ifdef MENUQC
43METHOD(HealNade, describe, string(HealNade this))
44{
45 TC(HealNade, this);
47 PAR(_("The %s detonates after a short delay, temporarily creating a healing orb around the point where it detonated for several seconds. "
48 "If your team members enter the orb they will recover health, and if enemies enter the sphere they will be harmed."), COLORED_NAME(this));
49 return PAGE_TEXT;
50}
51#endif // MENUQC
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.
entity owner
Definition main.qh:87
#define COLORED_NAME(this)
Definition color.qh:195
#define IS_DEAD(s)
Definition player.qh:245
#define IS_PLAYER(s)
Definition player.qh:243
float frametime
vector origin
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
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:124
int autocvar_g_pickup_healthmega_max
Definition health.qh:179
#define TC(T, sym)
Definition _all.inc:82
#define STAT(...)
Definition stats.qh:82
void nade_heal_boom(entity this)
Definition heal.qc:34
void nade_heal_touch(entity this, entity toucher)
Definition heal.qc:4
float autocvar_g_nades_heal_friend
Definition heal.qh:9
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_foe
Definition heal.qh:10
#define METHOD(cname, name, prototype)
Definition oo.qh:269
entity entity toucher
Definition self.qh:72
#define settouch(e, f)
Definition self.qh:73
#define PAGE_TEXT
Definition string.qh:643
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:649
#define PAGE_TEXT_INIT()
Definition string.qh:642
entity nades_spawn_orb(entity own, entity realown, vector org, float orb_ltime, float orb_rad)
Definition sv_nades.qc:75
float autocvar_g_nades_nade_radius
Definition sv_nades.qh:21
float 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:21
#define IS_VEHICLE(v)
Definition utils.qh:22