X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fcommon%2Ftriggers%2Ftrigger%2Fheal.qc;h=f2345e8f59397aba32c0802dd24e6b218a3c255a;hb=88e815808cb794930e7a0d6257cfdb8b3456a9a1;hp=4447ea21e25f0cf7928378fc97a462eb004c2b05;hpb=2d5f6090a4faee9716a9c149b9ac6927cc3bb9db;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/trigger/heal.qc b/qcsrc/common/triggers/trigger/heal.qc index 4447ea21e..f2345e8f5 100644 --- a/qcsrc/common/triggers/trigger/heal.qc +++ b/qcsrc/common/triggers/trigger/heal.qc @@ -16,14 +16,19 @@ void trigger_heal_touch(entity this, entity toucher) bool is_trigger = !boolean(!this.nottargeted && this.targetname != ""); if(is_trigger) EXACTTRIGGER_TOUCH(this, toucher); - toucher.triggerhealtime = time + 1; + if(this.delay > 0) + toucher.triggerhealtime = time + this.delay; + bool playthesound = (this.spawnflags & 4); if (toucher.health < this.max_health) { + playthesound = true; toucher.health = min(toucher.health + this.health, this.max_health); toucher.pauserothealth_finished = max(toucher.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot); - _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); } + + if(playthesound) + _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); } } } @@ -33,31 +38,30 @@ void trigger_heal_use(entity this, entity actor, entity trigger) trigger_heal_touch(this, actor); } -spawnfunc(trigger_heal) +void trigger_heal_init(entity this) { this.active = ACTIVE_ACTIVE; - - EXACTTRIGGER_INIT; - settouch(this, trigger_heal_touch); - if (!this.health) + if(!this.delay) + this.delay = 1; + if(!this.health) this.health = 10; - if (!this.max_health) - this.max_health = 200; //Max health topoff for field + 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); } +spawnfunc(trigger_heal) +{ + EXACTTRIGGER_INIT; + settouch(this, trigger_heal_touch); + trigger_heal_init(this); +} + 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); + trigger_heal_init(this); } #endif