Using rotated areas in filtered searches

Place to get help with not working mods / modding interface.
Post Reply
AckEmma
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Feb 09, 2024 6:15 am
Contact:

Using rotated areas in filtered searches

Post by AckEmma »

I've been developing a mod that places tiles under entities and knew I'd have some trouble with curved rails.
I've seen others make bitmasks for rails specifically but I wanted to be able to have it work for any entity (including ones with secondary bounding boxes with orientation).

I've found that `find_tiles_filtered` doesn't correctly take the orientation still even though `find_entities_filtered` does.

- Version and before image (version 1.1.101)
before-version.png
before-version.png (729.37 KiB) Viewed 169 times
- After `find_entities_filtered`

Code: Select all

/c for _,e in pairs(game.surfaces[1].find_entities_filtered{area={left_top={0.1,-9.9},right_bottom={9.9,19.9},orientation=0.1}}) do e.destroy() end
entities_filter.png
entities_filter.png (709.82 KiB) Viewed 169 times
-After `find_tiles_filtered`

Code: Select all

/c for _,e in pairs(game.surfaces[1].find_tiles_filtered{area={left_top={0.1,-9.9},right_bottom={9.9,19.9},orientation=0.1}}) do game.surfaces[1].create_entity{ name = "tile-ghost", position = e.position, inner_name = "concrete", force = game.player.force, expires = false } end
tiles_filter.png
tiles_filter.png (827.93 KiB) Viewed 169 times

I've gotten around this by programming my own version of `find_tiles_filtered` that makes special calls to the builtin after apply the orientation to the bounding box using a rotation matrix but anticipate that it would be much slower than any builtin method.

When BoundingBox Orientation support was added in 1.1.82 was it only for `find_entities_filtered` or meant to be for all functions that used BoundingBox in that way?
106122

Post Reply

Return to “Modding help”