entity:is_in_same_region(other) : bug with 4-way crossing separators
Steps :
- in a new map, place 4 separators (two horizontal, two vertical), in a way that they form a cross like this
A 1 B
1
222X333
4
C 4 D
(1 and 4 must touch each other, as well as 2 and 3)
- Place four entities (let's call them A, B, C and D, see chart above for placement). Any kind of entity will work.
- Place a destination anywhere in region A. (or none, since you will end up in top left of the map, which is in region A anyway)
Then, in the map script, write this script
local map=...
local hero=map:get_hero()
function map:on_started()
for e in map:get_entities() do
if e:is_in_same_region(hero) then
print ("found a "..e:get_type()..", name="..(e:get_name() or "<something>"))
end
end
end
What you'll see in the console is that entities A and D are detected, which is not correct: only A must be found (as well as the hero and camera, but this is not the point of this issue).
PS: i can replace the ASCII-art with an actual picture if needed.
Update (2021/4/2): corrected the figure (thanks Cluedrew for pointing it to me)
Edited by PhoenixII54