toucher.triggerhealtime = time + this.delay;
bool playthesound = (this.spawnflags & HEAL_SOUND_ALWAYS);
- 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);
- }
+ bool healed = Heal(toucher, this, GetResourceAmount(this, RES_HEALTH), this.max_health);
- if(playthesound)
+ if(playthesound || healed)
_sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
}
}
this.active = ACTIVE_ACTIVE;
if(!this.delay)
this.delay = 1;
- if(!this.health)
- this.health = 10;
+ if(!GetResourceAmount(this, RES_HEALTH))
+ SetResourceAmount(this, RES_HEALTH, 10); // TODO: use a special field for this, it doesn't have actual health!
if(!this.max_health)
this.max_health = 200; // max health topoff for field
if(this.noise == "")