]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix secondary fire affecting primary accuracy in overkill and instagib
authorMario <zacjardine@y7mail.com>
Sun, 8 Mar 2015 14:11:47 +0000 (01:11 +1100)
committerMario <zacjardine@y7mail.com>
Sun, 8 Mar 2015 14:11:47 +0000 (01:11 +1100)
qcsrc/common/weapons/w_vaporizer.qc
qcsrc/server/mutators/mutator_instagib.qc
qcsrc/server/mutators/mutator_overkill.qc

index e0b43ac645a3169c1f6fcf8a68b8ae46dbd3728e..c757ebd85b01654e9f2d133cda54a73ac6fe7206 100644 (file)
@@ -775,8 +775,10 @@ float W_Vaporizer(float req)
                                                W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
 
                                        // ugly instagib hack to reuse the fire mode of the laser
+                                       int oldwep = self.weapon; // we can't avoid this hack
+                                       self.weapon = WEP_BLASTER;
                                        W_Blaster_Attack(
-                                               WEP_VAPORIZER | HITTYPE_SECONDARY,
+                                               WEP_BLASTER | HITTYPE_SECONDARY,
                                                WEP_CVAR_SEC(vaporizer, shotangle),
                                                WEP_CVAR_SEC(vaporizer, damage),
                                                WEP_CVAR_SEC(vaporizer, edgedamage),
@@ -787,6 +789,7 @@ float W_Vaporizer(float req)
                                                WEP_CVAR_SEC(vaporizer, delay),
                                                WEP_CVAR_SEC(vaporizer, lifetime)
                                        );
+                                       self.weapon = oldwep;
 
                                        // now do normal refire
                                        weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
index 00396820c6d688635eb66855a4ca385cbe131d65..c6db80991a95643aea31fffd88b7c6410e095693 100644 (file)
@@ -236,6 +236,18 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage)
 
                if(IS_PLAYER(frag_attacker))
                if(DEATH_ISWEAPON(frag_deathtype, WEP_VAPORIZER))
+               {
+                       if(frag_target.armorvalue)
+                       {
+                               frag_target.armorvalue -= 1;
+                               frag_damage = 0;
+                               frag_target.damage_dealt += 1;
+                               frag_attacker.damage_dealt += 1; // TODO: change this to a specific hitsound for armor hit
+                               Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, frag_target.armorvalue);
+                       }
+               }
+
+               if(IS_PLAYER(frag_attacker) && DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
                {
                        if(frag_deathtype & HITTYPE_SECONDARY)
                        {
@@ -249,14 +261,6 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage)
                                                frag_force = '0 0 0';
                                }
                        }
-                       else if(frag_target.armorvalue)
-                       {
-                               frag_target.armorvalue -= 1;
-                               frag_damage = 0;
-                               frag_target.damage_dealt += 1;
-                               frag_attacker.damage_dealt += 1; // TODO: change this to a specific hitsound for armor hit
-                               Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, frag_target.armorvalue);
-                       }
                }
        }
 
index dca48795c925d7162f07f917906d257fbe2f8d99..0a0f79afdc5a90720c6eb9bb1f55fe20d037be19 100644 (file)
@@ -139,6 +139,8 @@ MUTATOR_HOOKFUNCTION(ok_PlayerPreThink)
                self.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor();
                makevectors(self.v_angle);
 
+               int oldwep = self.weapon;
+               self.weapon = WEP_BLASTER;
                W_Blaster_Attack(
                        WEP_BLASTER | HITTYPE_SECONDARY,
                        WEP_CVAR_SEC(vaporizer, shotangle),
@@ -151,6 +153,7 @@ MUTATOR_HOOKFUNCTION(ok_PlayerPreThink)
                        WEP_CVAR_SEC(vaporizer, delay),
                        WEP_CVAR_SEC(vaporizer, lifetime)
                );
+               self.weapon = oldwep;
        }
 
        self.weapon_blocked = false;