From: Mario Date: Thu, 4 Jan 2018 02:17:27 +0000 (+1000) Subject: Properly support team field on trigger_multiple X-Git-Tag: xonotic-v0.8.5~2390 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d865de7a9a17c5a1d9286aec40f68c3530697660;p=xonotic%2Fxonotic-data.pk3dir.git Properly support team field on trigger_multiple --- diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index 392ab3e5f..bb15503c7 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -765,6 +765,7 @@ spawnfunc(func_door) if (this.health) { + //this.canteamdamage = true; // TODO this.takedamage = DAMAGE_YES; this.event_damage = door_damage; } diff --git a/qcsrc/common/triggers/func/door_rotating.qc b/qcsrc/common/triggers/func/door_rotating.qc index 2c72dc9cf..c61a02686 100644 --- a/qcsrc/common/triggers/func/door_rotating.qc +++ b/qcsrc/common/triggers/func/door_rotating.qc @@ -109,6 +109,7 @@ spawnfunc(func_door_rotating) if (this.health) { + //this.canteamdamage = true; // TODO this.takedamage = DAMAGE_YES; this.event_damage = door_damage; } diff --git a/qcsrc/common/triggers/func/door_secret.qc b/qcsrc/common/triggers/func/door_secret.qc index 0bad196ab..6f2d101ef 100644 --- a/qcsrc/common/triggers/func/door_secret.qc +++ b/qcsrc/common/triggers/func/door_secret.qc @@ -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; diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index 5e8c641be..2f32e50fa 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -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; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 7ddea9f5e..e9cf6ee28 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index c0ff6b3f4..029660c2b 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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; } }