]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Unhardcode mine layer slot checks
authorMario <mario@smbclan.net>
Mon, 8 Aug 2016 11:39:12 +0000 (21:39 +1000)
committerMario <mario@smbclan.net>
Mon, 8 Aug 2016 11:39:12 +0000 (21:39 +1000)
qcsrc/common/weapons/weapon/minelayer.qc

index 2b59e7841b9b42c2907a92c39f6016c0b7f065f6..f58a8f254927d10b1e4b596f5983b6e593c41c9b 100644 (file)
@@ -131,7 +131,8 @@ void W_MineLayer_Explode(entity this, entity directhitentity)
                if(!w.wr_checkammo1(w, own))
                {
                        own.cnt = WEP_MINE_LAYER.m_id;
-                       int slot = 0; // TODO: unhardcode
+                       .entity weaponentity = this.weaponentity_fld;
+                       int slot = weaponslot(weaponentity);
                        ATTACK_FINISHED(own, slot) = time;
                        PS(own).m_switchweapon = w_getbestweapon(own);
                }
@@ -162,7 +163,8 @@ void W_MineLayer_DoRemoteExplode(entity this)
                if(!w.wr_checkammo1(w, own))
                {
                        own.cnt = WEP_MINE_LAYER.m_id;
-                       int slot = 0; // TODO: unhardcode
+                       .entity weaponentity = this.weaponentity_fld;
+                       int slot = weaponslot(weaponentity);
                        ATTACK_FINISHED(own, slot) = time;
                        PS(own).m_switchweapon = w_getbestweapon(own);
                }
@@ -338,6 +340,7 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
        mine = WarpZone_RefSys_SpawnSameRefSys(actor);
+       mine.weaponentity_fld = weaponentity;
        IL_PUSH(g_mines, mine);
        mine.owner = mine.realowner = actor;
        if(WEP_CVAR(minelayer, detonatedelay) >= 0)