diff --git a/luarules/gadgets.lua b/luarules/gadgets.lua index cc333410793..fdbf7bb2b2b 100644 --- a/luarules/gadgets.lua +++ b/luarules/gadgets.lua @@ -1662,14 +1662,21 @@ function gadgetHandler:TerraformComplete(unitID, unitDefID, unitTeam, end function gadgetHandler:AllowWeaponTargetCheck(attackerID, attackerWeaponNum, attackerWeaponDefID) - for _, g in ipairs(self.AllowWeaponTargetCheckList) do - if not g:AllowWeaponTargetCheck(attackerID, attackerWeaponNum, attackerWeaponDefID) then - return false +local ignore = true +for _, g in ipairs(self.AllowWeaponTargetCheckList) do + local allowCheck, ignoreCheck = g:AllowWeaponTargetCheck(attackerID, attackerWeaponNum, attackerWeaponDefID) + if not ignoreCheck then + ignore = false + if not allowCheck then + return 0 end end - return true end +return ((ignore and -1) or 1) +end + + function gadgetHandler:AllowWeaponTarget(attackerID, targetID, attackerWeaponNum, attackerWeaponDefID, defPriority) local allowed = true local priority = 1.0