From a2e666cdd485e0b2b9209e3758c56fe85625959e Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 4 Oct 2016 00:53:57 +1000 Subject: [PATCH] Possible fix for minelayer mines --- qcsrc/common/weapons/weapon/minelayer.qc | 16 ++++++++-------- qcsrc/server/weapons/selection.qc | 2 +- qcsrc/server/weapons/weaponsystem.qc | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index b85d4061e..9564462b8 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -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; diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index f7a061aca..bd05832ab 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -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 diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 05677cb3c..a99a3551b 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -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; }); -- 2.39.2