Page 1 of 1

[Solved] Filter entities : add shortcut for single tile area

Posted: Wed Jan 30, 2019 11:19 am
by Perlin
Hello,

Just a little suggestion, it is not possible to use find_entities_filtered with an area of one tile, for example:

Code: Select all

game.surfaces[1].find_entities_filtered{
    area = {{-17.5,-5.5}, {-17.5,-5.5}}
}
gives me this error: "An area of zero size is not supported. Either don't define area to search the entire surface, or use 'position'"

In case of 1 tile area, the function should fallback itself to the use of 'position' and transform my code into:

Code: Select all

game.surfaces[1].find_entities_filtered{
    position= {-17.5,-5.5}
}
My use case is that I'm in on_player_built_tile event, and I can receive a single tile square if I pressed "minus" to reduce the tile drawing box to 1x1 square. I can do this job myself, but I think it should be handled by the find_entities_filtered method.

Regards,

Re: Filter entities : add shortcut for single tile area

Posted: Wed Jan 30, 2019 12:01 pm
by Klonan
This is done for 0.17,
I was having the same problem when using custom selection tools

Re: [Solved] Filter entities : add shortcut for single tile area

Posted: Wed Jan 30, 2019 12:36 pm
by Perlin
Nice !