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

Post Reply
User avatar
Perlin
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Jan 13, 2019 5:27 am
Contact:

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

Post 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,
Last edited by Perlin on Wed Jan 30, 2019 12:35 pm, edited 1 time in total.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Filter entities : add shortcut for single tile area

Post by Klonan »

This is done for 0.17,
I was having the same problem when using custom selection tools

User avatar
Perlin
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sun Jan 13, 2019 5:27 am
Contact:

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

Post by Perlin »

Nice !

Post Reply

Return to “Implemented mod requests”