X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ftrigger%2Fheal.qc;h=41519e20cc622c4547bae54d7c226cd147f17e0c;hp=6d68610b5cf8ddb5afb7c2101a0b3ffacdb83f5b;hb=fc15d72b041c9a748b605ba28735380fbe5b5b01;hpb=221325d0a55851348e3397354225f04cd472d42f diff --git a/qcsrc/common/triggers/trigger/heal.qc b/qcsrc/common/triggers/trigger/heal.qc index 6d68610b5..41519e20c 100644 --- a/qcsrc/common/triggers/trigger/heal.qc +++ b/qcsrc/common/triggers/trigger/heal.qc @@ -1,42 +1,42 @@ #ifdef SVQC .float triggerhealtime; -void trigger_heal_touch() +void trigger_heal_touch(entity this) { - if (self.active != ACTIVE_ACTIVE) + if (this.active != ACTIVE_ACTIVE) return; // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu) if (other.iscreature) { if (other.takedamage) - if (!other.deadflag) + if (!IS_DEAD(other)) if (other.triggerhealtime < time) { EXACTTRIGGER_TOUCH; other.triggerhealtime = time + 1; - if (other.health < self.max_health) + if (other.health < this.max_health) { - other.health = min(other.health + self.health, self.max_health); + other.health = min(other.health + this.health, this.max_health); other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot); - sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); + _sound (other, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); } } } } -void spawnfunc_trigger_heal() +spawnfunc(trigger_heal) { - self.active = ACTIVE_ACTIVE; + this.active = ACTIVE_ACTIVE; EXACTTRIGGER_INIT; - self.touch = trigger_heal_touch; - if (!self.health) - self.health = 10; - if (!self.max_health) - self.max_health = 200; //Max health topoff for field - if(self.noise == "") - self.noise = "misc/mediumhealth.wav"; - precache_sound(self.noise); + settouch(this, trigger_heal_touch); + 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