found bug on Factorio 1.1.69 (build 60061, win64, steam), also tested on Factorio 1.1.70 (build 60152, win64, steam)
Sometimes not all entities are found, the missing ones are always larger than 1x1.
complete command:
local entities = search_area.surface.find_entities_filtered{area=search_area.bounds, type="entity-ghost"}
search_area is defined by
search_area = {
bounds=bounds,
inner_bounds=inner_bounds,
force=force,
surface=cell.owner.surface
}
cell is part of a logistic-network:
logisticNetwork = ghostScanner.entity.surface.find_logistic_network_by_position(ghostScanner.entity.position, ghostScanner.entity.force )
for _,cell in pairs(logisticNetwork.cells) do
if the roboport is destroyed and a new one is placed, it often works, magically, all entities are found. but if you place a new roboport next to it, then replace the old one, nothing will change.
mod used:
https://mods.factorio.com/mod/GhostScanner -> in version 1.6.5 line 269 in control.lua
or the attached rework of it -> line 404 in control.lua
Savegame: tiny test save with two logistic network zones, on the northern one (current focus) there are 6 solar panel ghosts, which are detected and 3 assembly machine ghosts which aren't. these 3 ghosts can be replaced by any 3x3 ghost and still not be detected. on another save I could also place 2x2 on the spot to not be detected, but not here.
[1.1.70] sometimes not finding ghosts -> find_entities_filtered{area=search_area.bounds, type="entity-ghost"}
[1.1.70] sometimes not finding ghosts -> find_entities_filtered{area=search_area.bounds, type="entity-ghost"}
- Attachments
-
- GhostScanner_2.1.0.zip
- the mod I'm using, it's not yet published, that's why I'm uploading it here.
- (116.34 KiB) Downloaded 33 times
-
- ghost scanner test - BUG.zip
- (2.65 MiB) Downloaded 32 times
Re: [1.1.70] sometimes not finding ghosts -> find_entities_filtered{area=search_area.bounds, type="entity-ghost"}
Thanks for the report however the search function is correct. The ghost scanner logic is filtering out the ghosts incorrectly.
It searches 2 areas: the top and the bottom. The top area overlaps the ghost bounding boxes but not the ghost center. So when the ghost scanner logic says "is_in_bbox" it says no, the center of the entity is not in the bounding box it is searching. But it marks it as found so future search areas will skip it if they do find it.
It searches 2 areas: the top and the bottom. The top area overlaps the ghost bounding boxes but not the ghost center. So when the ghost scanner logic says "is_in_bbox" it says no, the center of the entity is not in the bounding box it is searching. But it marks it as found so future search areas will skip it if they do find it.
If you want to get ahold of me I'm almost always on Discord.