]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make nade teams more reliable, also fix effects broken for spectators
authorMario <mario@smbclan.net>
Fri, 11 Mar 2016 23:12:20 +0000 (09:12 +1000)
committerMario <mario@smbclan.net>
Fri, 11 Mar 2016 23:12:20 +0000 (09:12 +1000)
qcsrc/common/effects/all.qc
qcsrc/common/mutators/mutator/nades/nades.qc

index 663526bcc6ed2889445234b443b3e8c0c4b88654..2bdf2ec48b78235f268eeac177fa1f84d504f8c3 100644 (file)
@@ -76,7 +76,7 @@ void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
        net_eff.eent_net_count = eff_cnt;
        net_eff.eent_eff_trail = eff.eent_eff_trail;
 
-       FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(Net_Write_Effect(net_eff, it, 0)));
+       FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(Net_Write_Effect(net_eff, it, 0)));
        remove(net_eff);
 }
 
index 16a435dd17339875072602fff898b02a58128f68..250a3ef71a1797f10ffeb45467c65b695ef77f6c 100644 (file)
@@ -256,7 +256,7 @@ void nade_napalm_ball()
        proj = new(grenade);
        proj.owner = self.owner;
        proj.realowner = self.realowner;
-       proj.team = self.owner.team;
+       proj.team = self.team;
        proj.bot_dodge = true;
        proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage;
        proj.movetype = MOVETYPE_BOUNCE;
@@ -374,7 +374,7 @@ void nade_ice_think()
        {
                if ( autocvar_g_nades_ice_explode )
                {
-                       entity expef = EFFECT_NADE_EXPLODE(self.realowner.team);
+                       entity expef = EFFECT_NADE_EXPLODE(self.team);
                        Send_Effect(expef, self.origin + '0 0 1', '0 0 0', 1);
                        sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
 
@@ -569,7 +569,7 @@ void nade_heal_boom()
        setorigin(healer, self.origin);
        healer.healer_lifetime = autocvar_g_nades_heal_time; // save the cvar
        healer.ltime = time + healer.healer_lifetime;
-       healer.team = self.realowner.team;
+       healer.team = self.team;
        healer.bot_dodge = false;
        healer.solid = SOLID_TRIGGER;
        healer.touch = nade_heal_touch;
@@ -616,7 +616,7 @@ void nade_boom()
                case NADE_TYPE_MONSTER:
                case NADE_TYPE_SPAWN:
                        nade_blast = false;
-                       switch(self.realowner.team)
+                       switch(self.team)
                        {
                                case NUM_TEAM_1: expef = EFFECT_SPAWN_RED; break;
                                case NUM_TEAM_2: expef = EFFECT_SPAWN_BLUE; break;
@@ -632,7 +632,7 @@ void nade_boom()
 
                default:
                case NADE_TYPE_NORMAL:
-                       expef = EFFECT_NADE_EXPLODE(self.realowner.team);
+                       expef = EFFECT_NADE_EXPLODE(self.team);
                        break;
        }
 
@@ -799,7 +799,10 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        this.health -= damage;
 
        if ( this.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
+       {
+               this.team = attacker.team;
                this.realowner = attacker;
+       }
 
        if(this.health <= 0)
                WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, nade_boom));
@@ -959,7 +962,8 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        //setattachment(n, player, "bip01 l hand");
        n.exteriormodeltoclient = player;
        n.customizeentityforclient = nade_customize;
-       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], player.team).eent_eff_name);
+       n.team = player.team;
+       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], n.team).eent_eff_name);
        n.colormod = Nades_from(n.nade_type).m_color;
        n.realowner = nowner;
        n.colormap = player.colormap;