diff --git a/modules/game_battle/battle.lua b/modules/game_battle/battle.lua index 17933306..13968f0b 100644 --- a/modules/game_battle/battle.lua +++ b/modules/game_battle/battle.lua @@ -244,28 +244,34 @@ function doCreatureFitFilters(creature) local localPlayer = g_game.getLocalPlayer() if pos.z ~= localPlayer:getPosition().z or not creature:canBeSeen() then return false end - - local hidePlayers = hidePlayersButton:isChecked() - local hideNPCs = hideNPCsButton:isChecked() - local hideMonsters = hideMonstersButton:isChecked() - local hideSkulls = hideSkullsButton:isChecked() - local hideParty = hidePartyButton:isChecked() - - if hidePlayers and creature:isPlayer() then - return false - elseif hideNPCs and creature:isNpc() then - return false - elseif hideMonsters and creature:isMonster() then - return false - elseif hideSkulls and creature:isPlayer() and creature:getSkull() == SkullNone then - return false - elseif hideParty and creature:getShield() > ShieldWhiteBlue then - return false - end - return true end +function doShowCreatureAtBattle(creature) + if doCreatureFitFilters(creature) then + local hidePlayers = hidePlayersButton:isChecked() + local hideNPCs = hideNPCsButton:isChecked() + local hideMonsters = hideMonstersButton:isChecked() + local hideSkulls = hideSkullsButton:isChecked() + local hideParty = hidePartyButton:isChecked() + + if hidePlayers and creature:isPlayer() then + return false + elseif hideNPCs and creature:isNpc() then + return false + elseif hideMonsters and creature:isMonster() then + return false + elseif hideSkulls and creature:isPlayer() and creature:getSkull() == SkullNone then + return false + elseif hideParty and creature:getShield() > ShieldWhiteBlue then + return false + end + + return true + end + return false +end + function onCreatureHealthPercentChange(creature, health) local battleButton = battleButtonsByCreaturesList[creature:getId()] if battleButton then @@ -452,7 +458,7 @@ function addCreature(creature) end local localPlayer = g_game.getLocalPlayer() - battleButton:setVisible(localPlayer:hasSight(creature:getPosition()) and creature:canBeSeen()) + battleButton:setVisible(localPlayer:hasSight(creature:getPosition()) and creature:canBeSeen() and doShowCreatureAtBattle(creature)) end function removeAllCreatures()