]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/trigger/multi.qc
Teams: setteam
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / multi.qc
index 2aa8f5c1ddf1ed8e101cf78466106d6c96c2dc9b..950a69d1d0d92bae02338dbf1baab0925fccd10a 100644 (file)
@@ -23,6 +23,10 @@ void multi_trigger()
                return;         // allready been triggered
        }
 
+       if(self.spawnflags & 16384)
+       if(!IS_PLAYER(self.enemy))
+               return; // only players
+
        if (self.classname == "trigger_secret")
        {
                if (!IS_PLAYER(self.enemy))
@@ -95,35 +99,35 @@ void multi_touch()
        multi_trigger ();
 }
 
-void multi_eventdamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
-       if (!self.takedamage)
+void multi_eventdamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+       if(!this.takedamage)
                return;
-       if(self.spawnflags & DOOR_NOSPLASH)
+       if(this.spawnflags & DOOR_NOSPLASH)
                if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
                        return;
-       self.health = self.health - damage;
-       if (self.health <= 0)
+       this.health = this.health - damage;
+       if (this.health <= 0)
        {
-               self.enemy = attacker;
-               self.goalentity = inflictor;
-               multi_trigger();
+               this.enemy = attacker;
+               this.goalentity = inflictor;
+               WITH(entity, self, this, multi_trigger());
        }
 }
 
-void multi_reset()
-{SELFPARAM();
-       if ( !(self.spawnflags & SPAWNFLAG_NOTOUCH) )
-               self.touch = multi_touch;
-       if (self.max_health)
+void multi_reset(entity this)
+{
+       if ( !(this.spawnflags & SPAWNFLAG_NOTOUCH) )
+               this.touch = multi_touch;
+       if (this.max_health)
        {
-               self.health = self.max_health;
-               self.takedamage = DAMAGE_YES;
-               self.solid = SOLID_BBOX;
+               this.health = this.max_health;
+               this.takedamage = DAMAGE_YES;
+               this.solid = SOLID_BBOX;
        }
-       self.think = func_null;
-       self.nextthink = 0;
-       self.team = self.team_saved;
+       this.think = func_null;
+       this.nextthink = 0;
+       setteam(this, this.team_saved);
 }
 
 /*QUAKED spawnfunc_trigger_multiple (.5 .5 .5) ? notouch
@@ -139,23 +143,18 @@ sounds
 4)
 set "message" to text string
 */
-void spawnfunc_trigger_multiple()
-{SELFPARAM();
+spawnfunc(trigger_multiple)
+{
        self.reset = multi_reset;
        if (self.sounds == 1)
-       {
-               precache_sound ("misc/secret.wav");
                self.noise = "misc/secret.wav";
-       }
        else if (self.sounds == 2)
-       {
-               self.noise = SND(TALK);
-       }
+               self.noise = strzone(SND(TALK));
        else if (self.sounds == 3)
-       {
-               precache_sound ("misc/trigger1.wav");
                self.noise = "misc/trigger1.wav";
-       }
+
+       if(self.noise)
+               precache_sound(self.noise);
 
        if (!self.wait)
                self.wait = 0.2;
@@ -165,7 +164,7 @@ void spawnfunc_trigger_multiple()
 
        EXACTTRIGGER_INIT;
 
-       self.team_saved = self.team;
+       self.team_saved = TMID(self.team);
 
        if (self.health)
        {
@@ -201,9 +200,9 @@ sounds
 4)
 set "message" to text string
 */
-void spawnfunc_trigger_once()
-{SELFPARAM();
-       self.wait = -1;
-       spawnfunc_trigger_multiple();
+spawnfunc(trigger_once)
+{
+       this.wait = -1;
+       spawnfunc_trigger_multiple(this);
 }
 #endif