]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/triggers/trigger/heal.qc
Use the sound list
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / heal.qc
1 #ifdef SVQC
2 .float triggerhealtime;
3 void trigger_heal_touch()
4 {SELFPARAM();
5         if (self.active != ACTIVE_ACTIVE)
6                 return;
7
8         // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
9         if (other.iscreature)
10         {
11                 if (other.takedamage)
12                 if (!other.deadflag)
13                 if (other.triggerhealtime < time)
14                 {
15                         EXACTTRIGGER_TOUCH;
16                         other.triggerhealtime = time + 1;
17
18                         if (other.health < self.max_health)
19                         {
20                                 other.health = min(other.health + self.health, self.max_health);
21                                 other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
22                                 _sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
23                         }
24                 }
25         }
26 }
27
28 void spawnfunc_trigger_heal()
29 {SELFPARAM();
30         self.active = ACTIVE_ACTIVE;
31
32         EXACTTRIGGER_INIT;
33         self.touch = trigger_heal_touch;
34         if (!self.health)
35                 self.health = 10;
36         if (!self.max_health)
37                 self.max_health = 200; //Max health topoff for field
38         if(self.noise == "")
39                 self.noise = "misc/mediumhealth.wav";
40         precache_sound(self.noise);
41 }
42 #endif