]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_player.qc
weapons: fix being able to switch to no weapon
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_player.qc
index 1b0e46038acf1c0696c124dd6afca95569c49b4a..cbe38ac5a5cb16dd232eb2eea27d5757f10fe462 100644 (file)
@@ -482,7 +482,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
        if(DIFF_TEAM(self, attacker))
        {
                if(DEATH_ISSPECIAL(deathtype))
-                       awep = get_weaponinfo(attacker.weapon);
+                       awep = PS(attacker).m_weapon;
                else
                        awep = DEATH_WEAPONOF(deathtype);
                valid_damage_for_weaponstats = 1;
@@ -492,7 +492,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
        {
                dh = dh - max(self.health, 0);
                da = da - max(self.armorvalue, 0);
-               WeaponStats_LogDamage(awep.m_id, abot, self.weapon, vbot, dh + da);
+               WeaponStats_LogDamage(awep.m_id, abot, PS(self).m_weapon.m_id, vbot, dh + da);
                MUTATOR_CALLHOOK(PlayerDamaged, attacker, self, dh, da, hitloc, deathtype);
        }
 
@@ -508,7 +508,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                }
 
                if(valid_damage_for_weaponstats)
-                       WeaponStats_LogKill(awep.m_id, abot, self.weapon, vbot);
+                       WeaponStats_LogKill(awep.m_id, abot, PS(self).m_weapon.m_id, vbot);
 
                if(autocvar_sv_gentle < 1) // TODO make a "gentle" version?
                if(sound_allowed(MSG_BROADCAST, attacker))
@@ -548,7 +548,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype);
                excess = frag_damage;
 
-               Weapon wep = get_weaponinfo(self.weapon);
+               Weapon wep = PS(self).m_weapon;
                wep.wr_playerdeath(wep);
 
                RemoveGrapplingHook(self);
@@ -573,7 +573,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                // clear waypoints
                WaypointSprite_PlayerDead();
                // throw a weapon
-               SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon);
+               SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, PS(self).m_switchweapon.m_id);
 
                // become fully visible
                self.alpha = default_player_alpha;
@@ -631,7 +631,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp
                // reset fields the weapons may use just in case
                for (j = WEP_FIRST; j <= WEP_LAST; ++j)
                {
-                       Weapon w = get_weaponinfo(j);
+                       Weapon w = Weapons_from(j);
                        w.wr_resetplayer(w);
                        for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                        {