]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Properly support team field on trigger_multiple
authorMario <mario@smbclan.net>
Thu, 4 Jan 2018 02:17:27 +0000 (12:17 +1000)
committerMario <mario@smbclan.net>
Thu, 4 Jan 2018 02:17:27 +0000 (12:17 +1000)
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/door_rotating.qc
qcsrc/common/triggers/func/door_secret.qc
qcsrc/common/triggers/trigger/multi.qc
qcsrc/server/defs.qh
qcsrc/server/g_damage.qc

index 392ab3e5f5f46b883793a34745656298176606b5..bb15503c7f801686a3a1ee3af473de786923fc3c 100644 (file)
@@ -765,6 +765,7 @@ spawnfunc(func_door)
 
        if (this.health)
        {
+               //this.canteamdamage = true; // TODO
                this.takedamage = DAMAGE_YES;
                this.event_damage = door_damage;
        }
index 2c72dc9cf07c1b249d91648683f0e3f4396017a9..c61a02686650eb56ae3a138d3cace85fed2a99b0 100644 (file)
@@ -109,6 +109,7 @@ spawnfunc(func_door_rotating)
 
        if (this.health)
        {
+               //this.canteamdamage = true; // TODO
                this.takedamage = DAMAGE_YES;
                this.event_damage = door_damage;
        }
index 0bad196abf3a57a79a4fbac2637170f35321bdf6..6f2d101ef9a914b61bae21278a6c5fa1c386b6a5 100644 (file)
@@ -228,6 +228,7 @@ spawnfunc(func_door_secret)
 
        if (this.spawnflags & SECRET_YES_SHOOT)
        {
+               //this.canteamdamage = true; // TODO
                this.health = 10000;
                this.takedamage = DAMAGE_YES;
                this.event_damage = fd_secret_damage;
index 5e8c641be542735efe020f155f2d7ff556f7dcbc..2f32e50fa50b92d8396a72293df0022c07413420 100644 (file)
@@ -104,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)
        {
@@ -169,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;
index 7ddea9f5ea8f4bd52b60dbf3997003d0e3fc2b44..e9cf6ee286a7d8831806504435737977436d8e08 100644 (file)
@@ -222,6 +222,8 @@ int have_team_spawns_forteams; // if Xth bit is 1 then team X has spawns else it
 // set when showing a kill countdown
 .entity killindicator;
 
+.bool canteamdamage;
+
 void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
 
 float lockteams;
index c0ff6b3f4ebd6c1a833f45c3b2f880ff06f1f442..029660c2bf05c2e98975f609e8c35d943d4f168d 100644 (file)
@@ -698,7 +698,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                                                                        force = '0 0 0';
                                                        }
                                                }
-                                               else
+                                               else if(!targ.canteamdamage)
                                                        damage = 0;
                                        }
                                }