Expose logistic networks per force without spatial queries
Posted: Wed Dec 03, 2025 3:16 am
Currently there's no way to retrieve all logistic networks belonging to a force.
The existing API offers spatial queries like LuaSurface.find_logistic_networks_by_construction_area() and LuaSurface.find_logistic_network_by_position(), but nothing that maps forces to their networks directly.
Spatial queries become inefficient in scenarios like OARC where players from the same force can be spread across very large areas and multiple surfaces.
The only workaround is maintaining a custom cache by hooking into roboport build/destroy events and handling network merging/splitting manually.
Proposed addition:
A property like LuaForce.logistic_networks returning an array of LuaLogisticNetwork, or a surface-scoped method like LuaSurface.get_logistic_networks(force).
This would enable efficient force-level queries without requiring mod authors to implement custom caching infrastructure.
The existing API offers spatial queries like LuaSurface.find_logistic_networks_by_construction_area() and LuaSurface.find_logistic_network_by_position(), but nothing that maps forces to their networks directly.
Spatial queries become inefficient in scenarios like OARC where players from the same force can be spread across very large areas and multiple surfaces.
The only workaround is maintaining a custom cache by hooking into roboport build/destroy events and handling network merging/splitting manually.
Proposed addition:
A property like LuaForce.logistic_networks returning an array of LuaLogisticNetwork, or a surface-scoped method like LuaSurface.get_logistic_networks(force).
This would enable efficient force-level queries without requiring mod authors to implement custom caching infrastructure.