]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_damage.qc
Weapons: require explicit `Weapons_from` call
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_damage.qc
index 147c03ca26e60a4a1d64eea44fae528544ca74a6..0e23d0828bcab192ddcb421af3834058b8ede882 100644 (file)
@@ -61,10 +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 & WepSet_FromWeapon(culprit.m_id)))
-                       culprit = get_weaponinfo(attacker.weapon);
+               if(!culprit) culprit = Weapons_from(attacker.weapon);
+               else if(!(attacker.weapons & (culprit.m_wepset))) culprit = Weapons_from(attacker.weapon);
 
                if(g_weaponarena_random_with_blaster && culprit == WEP_BLASTER) // WEAPONTODO: Shouldn't this be in a mutator?
                {
@@ -84,7 +82,7 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
 
                        // all others (including the culprit): remove
                        GiveFrags_randomweapons.weapons &= ~attacker.weapons;
-                       GiveFrags_randomweapons.weapons &= ~WepSet_FromWeapon(culprit.m_id);
+                       GiveFrags_randomweapons.weapons &= ~(culprit.m_wepset);
 
                        // among the remaining ones, choose one by random
                        W_RandomWeapons(GiveFrags_randomweapons, 1);
@@ -92,13 +90,13 @@ void GiveFrags (entity attacker, entity targ, float f, int deathtype)
                        if(GiveFrags_randomweapons.weapons)
                        {
                                attacker.weapons |= GiveFrags_randomweapons.weapons;
-                               attacker.weapons &= ~WepSet_FromWeapon(culprit.m_id);
+                               attacker.weapons &= ~(culprit.m_wepset);
                        }
                }
 
                // after a frag, choose another random weapon set
-               if (!(attacker.weapons & WepSet_FromWeapon(attacker.weapon)))
-                       W_SwitchWeapon_Force(attacker, w_getbestweapon(attacker));
+               if (!(attacker.weapons & WepSet_FromWeapon(Weapons_from(attacker.weapon))))
+                       W_SwitchWeapon_Force(attacker, Weapons_from(w_getbestweapon(attacker)));
        }
 
        // FIXME fix the mess this is (we have REAL points now!)
@@ -261,7 +259,7 @@ float Obituary_WeaponDeath(
        return false;
 }
 
-.int buffs; // TODO: remove
+.int buffs = _STAT(BUFFS); // TODO: remove
 
 void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
 {
@@ -857,7 +855,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                        farcent.origin = hitloc;
                        farcent.forcetype = FORCETYPE_FORCEATPOS;
                        farcent.nextthink = time + 0.1;
-                       farcent.think = SUB_Remove;
+                       farcent.think = SUB_Remove_self;
                }
                else
                {