]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/trigger/multi.qc
Properly support team field on trigger_multiple
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / multi.qc
index 7e6311df1bc7cde481ee40b3efcf54ec58e51522..2f32e50fa50b92d8396a72293df0022c07413420 100644 (file)
@@ -54,7 +54,7 @@ void multi_trigger(entity this)
                multi_wait(this); // waiting finished
        }
        else
-       {       // we can't just remove (this) here, because this is a touch function
+       {       // we can't just delete(this) here, because this is a touch function
                // called while C code is looping through area links...
                settouch(this, func_null);
        }
@@ -86,9 +86,8 @@ void multi_touch(entity this, entity toucher)
        }
 
        // if the trigger has pressed keys, check that the player is pressing those keys
-       if(this.pressedkeys)
-       if(IS_PLAYER(toucher)) // only for players
-       if(!(toucher.pressedkeys & this.pressedkeys))
+       if(this.pressedkeys && IS_PLAYER(toucher)) // only for players
+       if(!(CS(toucher).pressedkeys & this.pressedkeys))
                return;
 
        EXACTTRIGGER_TOUCH(this, toucher);
@@ -105,6 +104,9 @@ void multi_eventdamage(entity this, entity inflictor, entity attacker, float dam
        if(this.spawnflags & DOOR_NOSPLASH)
                if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
                        return;
+       if(this.team)
+               if(((this.spawnflags & 4) == 0) == (this.team != attacker.team))
+                       return;
        this.health = this.health - damage;
        if (this.health <= 0)
        {
@@ -170,6 +172,7 @@ spawnfunc(trigger_multiple)
        {
                if (this.spawnflags & SPAWNFLAG_NOTOUCH)
                        objerror (this, "health and notouch don't make sense\n");
+               this.canteamdamage = true;
                this.max_health = this.health;
                this.event_damage = multi_eventdamage;
                this.takedamage = DAMAGE_YES;