r5056 - in trunk/data: qcsrc/server scripts
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Tue Nov 18 03:02:51 EST 2008
Author: div0
Date: 2008-11-18 03:02:50 -0500 (Tue, 18 Nov 2008)
New Revision: 5056
Modified:
trunk/data/qcsrc/server/g_triggers.qc
trunk/data/scripts/entities.def
Log:
Contributed trigger_heal patch.
Modified: trunk/data/qcsrc/server/g_triggers.qc
===================================================================
--- trunk/data/qcsrc/server/g_triggers.qc 2008-11-16 07:11:35 UTC (rev 5055)
+++ trunk/data/qcsrc/server/g_triggers.qc 2008-11-18 08:02:50 UTC (rev 5056)
@@ -435,7 +435,60 @@
return FALSE;
}
+//////////////////////////////////////////////////////////////
+//
+//
+//
+//Trigger heal --a04191b92fbd93aa67214ef7e72d6d2e
+//
+//////////////////////////////////////////////////////////////
+.float triggerhealtime;
+void trigger_heal_touch()
+{
+ // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
+ if (other.iscreature)
+ {
+ if (other.takedamage)
+ if (other.triggerhealtime < time)
+ {
+ EXACTTRIGGER_TOUCH;
+ other.triggerhealtime = time + 1;
+
+ if (other.health < self.max_health)
+ {
+ other.health = min(other.health + self.health, self.max_health);
+ other.pauserothealth_finished = max(other.pauserothealth_finished, time + cvar("g_balance_pause_health_rot"));
+ sound (other, CHAN_AUTO, self.noise, VOL_BASE, ATTN_NORM);
+ }
+ }
+ }
+};
+
+void spawnfunc_trigger_heal()
+{
+ 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);
+};
+
+
+//////////////////////////////////////////////////////////////
+//
+//
+//
+//End trigger_heal
+//
+//////////////////////////////////////////////////////////////
+
+
+
// TODO add a way to do looped sounds with sound(); then complete this entity
.float volume, atten;
void target_speaker_use() {sound(self, CHAN_TRIGGER, self.noise, VOL_BASE * self.volume, self.atten);}
Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def 2008-11-16 07:11:35 UTC (rev 5055)
+++ trunk/data/scripts/entities.def 2008-11-18 08:02:50 UTC (rev 5056)
@@ -1195,3 +1195,11 @@
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
model="models/weapons/g_seeker.md3"
*/
+
+/*QUAKED trigger_heal (.5 .5 .5) ?
+Any object touching this will be healed.
+-------- KEYS --------
+health: health to give per second (default 10)
+max_health: max health this trigger will give (default 200)
+noise: sound file to play (use misc/null.wav to make it silent), default = item_health_medium sound
+*/
More information about the nexuiz-commits
mailing list