]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Mario/wepent_experimental' into Mario/wepent_experimental_2
authorMario <mario@smbclan.net>
Mon, 3 Oct 2016 14:54:12 +0000 (00:54 +1000)
committerMario <mario@smbclan.net>
Mon, 3 Oct 2016 14:54:12 +0000 (00:54 +1000)
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/weaponsystem.qc

index b85d4061e91caf7adb0a5819ed281d107febf135..9564462b86205fc8609f069bdd4466e424e91270 100644 (file)
@@ -207,10 +207,10 @@ void W_MineLayer_ProximityExplode(entity this)
        W_MineLayer_Explode(this, NULL);
 }
 
-int W_MineLayer_Count(entity e)
+int W_MineLayer_Count(entity e, .entity weaponentity)
 {
        int minecount = 0;
-       IL_EACH(g_mines, it.realowner == e,
+       IL_EACH(g_mines, it.realowner == e && it.weaponentity_fld == weaponentity,
        {
                minecount += 1;
        });
@@ -397,14 +397,14 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 
        MUTATOR_CALLHOOK(EditProjectile, actor, mine);
 
-       actor.(weaponentity).minelayer_mines = W_MineLayer_Count(actor);
+       actor.(weaponentity).minelayer_mines = W_MineLayer_Count(actor, weaponentity);
 }
 
-bool W_MineLayer_PlacedMines(entity this, bool detonate)
+bool W_MineLayer_PlacedMines(entity this, .entity weaponentity, bool detonate)
 {
        bool minfound = false;
 
-       IL_EACH(g_mines, it.realowner == this,
+       IL_EACH(g_mines, it.realowner == this && it.weaponentity_fld == weaponentity,
        {
                if(detonate)
                {
@@ -513,7 +513,7 @@ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponent
     if(autocvar_g_balance_minelayer_reload_ammo && actor.(weaponentity).clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
     {
         // not if we're holding the minelayer without enough ammo, but can detonate existing mines
-        if(!(W_MineLayer_PlacedMines(actor, false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
+        if(!(W_MineLayer_PlacedMines(actor, weaponentity, false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
             thiswep.wr_reload(thiswep, actor, weaponentity);
         }
     }
@@ -528,7 +528,7 @@ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponent
 
     if(fire & 2)
     {
-        if(W_MineLayer_PlacedMines(actor, true))
+        if(W_MineLayer_PlacedMines(actor, weaponentity, true))
             sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
     }
 }
@@ -546,7 +546,7 @@ METHOD(MineLayer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weap
 }
 METHOD(MineLayer, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    if(W_MineLayer_PlacedMines(actor, false))
+    if(W_MineLayer_PlacedMines(actor, weaponentity, false))
         return true;
     else
         return false;
index f7a061acad826fafbb010dade6e2c250b6c70cff..bd05832abd4ec990e8af55dc1229ff3a5fb98021 100644 (file)
@@ -73,7 +73,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
 
                                // always allow selecting the Mine Layer if we placed mines, so that we can detonate them
                                if(wpn == WEP_MINE_LAYER)
-                                       IL_EACH(g_mines, it.owner == this,
+                                       IL_EACH(g_mines, it.owner == this && it.weaponentity_fld == weaponentity,
                                        {
                                                f = 1;
                                                break; // no need to continue
index 05677cb3c22803ce9ba155df4a1705c1a8488b27..a99a3551b31a7b7817c56a93e2c80983a4ff4871 100644 (file)
@@ -226,7 +226,7 @@ bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary
        // always keep the Mine Layer if we placed mines, so that we can detonate them
        if (thiswep == WEP_MINE_LAYER)
        {
-               IL_EACH(g_mines, it.owner == actor,
+               IL_EACH(g_mines, it.owner == actor && it.weaponentity_fld == weaponentity,
                {
                        return false;
                });