From: Mario Date: Wed, 15 Nov 2017 00:52:42 +0000 (+1000) Subject: Add a new target_heal entity (duplicate of trigger_health, but for being targeted... X-Git-Tag: xonotic-v0.8.5~2440 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3fe48a1a2173c146f0f53601d326937c27bd1012;p=xonotic%2Fxonotic-data.pk3dir.git Add a new target_heal entity (duplicate of trigger_health, but for being targeted instead of serving as an area of effect healing block) --- 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