Skip to content

Commit

Permalink
Update broken AllowWeaponTargetCheck in gadgets.lua (beyond-all-reaso…
Browse files Browse the repository at this point in the history
…n#3984)

Update gadgets.lua
  • Loading branch information
SethDGamre authored Dec 6, 2024
1 parent 514bced commit 084a194
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions luarules/gadgets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 084a194

Please sign in to comment.