]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_damage.qc
Weapons: store activeweapon as direct weapon reference
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_damage.qc
index dcd75023e6a9c393be0be286b7b2ed1d00f5eb0f..e5ee28cc856e266d6670573ac1f7af7e622c60cf 100644 (file)
@@ -61,8 +61,8 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
        {
                // after a frag, exchange the current weapon (or the culprit, if detectable) by a new random weapon
                Weapon culprit = DEATH_WEAPONOF(deathtype);
-               if(!culprit) culprit = get_weaponinfo(attacker.weapon);
-               else if(!(attacker.weapons & (culprit.m_wepset))) culprit = get_weaponinfo(attacker.weapon);
+               if(!culprit) culprit = PS(attacker).m_weapon;
+               else if(!(attacker.weapons & (culprit.m_wepset))) culprit = PS(attacker).m_weapon;
 
                if(g_weaponarena_random_with_blaster && culprit == WEP_BLASTER) // WEAPONTODO: Shouldn't this be in a mutator?
                {
@@ -95,7 +95,7 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
                }
 
                // after a frag, choose another random weapon set
-               if (!(attacker.weapons & WepSet_FromWeapon(attacker.weapon)))
+               if (!(attacker.weapons & WepSet_FromWeapon(PS(attacker).m_weapon)))
                        W_SwitchWeapon_Force(attacker, w_getbestweapon(attacker));
        }
 
@@ -113,8 +113,7 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
 
 string AppendItemcodes(string s, entity player)
 {
-       float w;
-       w = player.weapon;
+       int w = PS(player).m_weapon.m_id;
        //if(w == 0)
        //      w = player.switchweapon;
        if(w == 0)