ai_helper: fix visibility bug in get_attackable_enemies()
The passed filter needs to be enclosed in an [and] tag, otherwise the check for visibility might not work correctly, for example if the filter contains a top level [or] tag.
This commit is contained in:
parent
ac346b86c8
commit
19ecc3dc61
1 changed files with 4 additions and 1 deletions
|
@ -1188,7 +1188,10 @@ function ai_helper.get_attackable_enemies(filter, side, cfg)
|
|||
local filter_plus_vision = {}
|
||||
if filter then filter_plus_vision = ai_helper.table_copy(filter) end
|
||||
if (not ignore_visibility) then
|
||||
table.insert(filter_plus_vision, { "filter_vision", { side = viewing_side, visible = 'yes' } })
|
||||
filter_plus_vision = {
|
||||
{ "and", filter_plus_vision },
|
||||
{ "filter_vision", { side = viewing_side, visible = 'yes' } }
|
||||
}
|
||||
end
|
||||
|
||||
local enemies = {}
|
||||
|
|
Loading…
Add table
Reference in a new issue