]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/minelayer.qc
Use the weapon entity as a parameter to ATTACK_FINISHED instead of the slot number...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / minelayer.qc
index 29192ac58168c153ae2561b86ed128f9c20fe4da..6063c666eb5093b0aea9ba9af3b17730948f342d 100644 (file)
@@ -74,8 +74,7 @@ void W_MineLayer_Explode(entity this, entity directhitentity)
                if(!thiswep.wr_checkammo1(thiswep, own, weaponentity))
                {
                        own.cnt = thiswep.m_id;
-                       int slot = weaponslot(weaponentity);
-                       ATTACK_FINISHED(own, slot) = time;
+                       ATTACK_FINISHED(own, weaponentity) = time;
                        own.(weaponentity).m_switchweapon = w_getbestweapon(own, weaponentity);
                }
        }
@@ -106,8 +105,7 @@ void W_MineLayer_DoRemoteExplode(entity this)
                if(!thiswep.wr_checkammo1(thiswep, own, weaponentity))
                {
                        own.cnt = thiswep.m_id;
-                       int slot = weaponslot(weaponentity);
-                       ATTACK_FINISHED(own, slot) = time;
+                       ATTACK_FINISHED(own, weaponentity) = time;
                        own.(weaponentity).m_switchweapon = w_getbestweapon(own, weaponentity);
                }
        }
@@ -464,9 +462,8 @@ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponent
 }
 METHOD(MineLayer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    //int slot = 0; // TODO: unhardcode
     // actually do // don't switch while placing a mine
-    //if(ATTACK_FINISHED(actor, slot) <= time || PS(actor).m_weapon != WEP_MINE_LAYER)
+    //if(ATTACK_FINISHED(actor, weaponentity) <= time || PS(actor).m_weapon != WEP_MINE_LAYER)
     //{
         float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(minelayer, ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(minelayer, ammo);