error - area of zero size not supported
judos opened this issue · 2 comments
I think this happens as of factorio 0.13.10:
find_entities is not allowed to set an area of size 0 (search entities on a specific point).
Error while running event on_tick (ID 0) An area of zero size is not supported. Either don't define area to search the entire surface or use 'position'. stack traceback: __Surfaces__/script/lib/api.lua:322: in function 'find_entities' __Surfaces__/script/lib/pair-util.lua:144: in function 'clear_ground' __Surfaces__/script/lib/pair-util.lua:95: in function 'create_paired_entity' __Surfaces__/script/events.lua:250: in function '?' __Surfaces__/script/events.lua:40: in function 'on_tick' __Surfaces__/control.lua:171: in function <__Surfaces__/control.lua:171>
To fix this simply use:
surface.find_entities_filtered{position = searchPoint, type= searchType}
instead.
Thanks for the great mod!!!
I think something like this in api.lua should fix the problem:
function api.surface.find_entities(surface, area, entity_name, entity_type, entity_force)
if area.left_top.x == area.right_bottom.x and area.left_top.y == area.right_bottom.y then
return (api.valid(surface) and struct.is_BoundingBox(area)) and surface.find_entities_filtered({position=area.left_top, name=entity_name, type=entity_type, force=entity_force}) or nil
end
return (api.valid(surface) and struct.is_BoundingBox(area)) and surface.find_entities_filtered({area=area, name=entity_name, type=entity_type, force=entity_force}) or nil
end
fixed in 0.0.7