3 .float triggerhealtime;
4 void trigger_heal_touch(entity this, entity toucher)
6 if (this.active != ACTIVE_ACTIVE)
9 // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
10 if (toucher.iscreature)
12 if (toucher.takedamage)
13 if (!IS_DEAD(toucher))
14 if (toucher.triggerhealtime < time)
16 bool is_trigger = !boolean(!this.nottargeted && this.targetname != "");
18 EXACTTRIGGER_TOUCH(this, toucher);
19 toucher.triggerhealtime = time + 1;
21 if (toucher.health < this.max_health)
23 toucher.health = min(toucher.health + this.health, this.max_health);
24 toucher.pauserothealth_finished = max(toucher.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
25 _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
31 void trigger_heal_use(entity this, entity actor, entity trigger)
33 trigger_heal_touch(this, actor);
36 spawnfunc(trigger_heal)
38 this.active = ACTIVE_ACTIVE;
41 settouch(this, trigger_heal_touch);
45 this.max_health = 200; //Max health topoff for field
47 this.noise = "misc/mediumhealth.wav";
48 precache_sound(this.noise);
51 spawnfunc(target_heal)
53 this.active = ACTIVE_ACTIVE;
54 this.use = trigger_heal_use;
58 this.max_health = 200; //Max health topoff for field
60 this.noise = "misc/mediumhealth.wav";
61 precache_sound(this.noise);