From 3fe48a1a2173c146f0f53601d326937c27bd1012 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 15 Nov 2017 10:52:42 +1000 Subject: [PATCH] Add a new target_heal entity (duplicate of trigger_health, but for being targeted instead of serving as an area of effect healing block) --- qcsrc/common/triggers/trigger/heal.qc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/qcsrc/common/triggers/trigger/heal.qc b/qcsrc/common/triggers/trigger/heal.qc index e7b309062..4447ea21e 100644 --- a/qcsrc/common/triggers/trigger/heal.qc +++ b/qcsrc/common/triggers/trigger/heal.qc @@ -13,7 +13,9 @@ void trigger_heal_touch(entity this, entity toucher) if (!IS_DEAD(toucher)) if (toucher.triggerhealtime < time) { - EXACTTRIGGER_TOUCH(this, toucher); + bool is_trigger = !boolean(!this.nottargeted && this.targetname != ""); + if(is_trigger) + EXACTTRIGGER_TOUCH(this, toucher); toucher.triggerhealtime = time + 1; if (toucher.health < this.max_health) @@ -26,6 +28,11 @@ void trigger_heal_touch(entity this, entity toucher) } } +void trigger_heal_use(entity this, entity actor, entity trigger) +{ + trigger_heal_touch(this, actor); +} + spawnfunc(trigger_heal) { this.active = ACTIVE_ACTIVE; @@ -40,4 +47,17 @@ spawnfunc(trigger_heal) this.noise = "misc/mediumhealth.wav"; precache_sound(this.noise); } + +spawnfunc(target_heal) +{ + this.active = ACTIVE_ACTIVE; + this.use = trigger_heal_use; + if (!this.health) + this.health = 10; + if (!this.max_health) + this.max_health = 200; //Max health topoff for field + if(this.noise == "") + this.noise = "misc/mediumhealth.wav"; + precache_sound(this.noise); +} #endif -- 2.39.2