Expose logistic networks per force without spatial queries

Things that already exist in the current mod API
bits-orio
Burner Inserter
Burner Inserter
Posts: 13
Joined: Wed Feb 28, 2024 6:08 pm
Contact:

Expose logistic networks per force without spatial queries

Post by bits-orio »

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.
bits-orio
Burner Inserter
Burner Inserter
Posts: 13
Joined: Wed Feb 28, 2024 6:08 pm
Contact:

Re: Expose logistic networks per force without spatial queries

Post by bits-orio »

Nevermind, I didn't do my research properly.
This already exists:
https://lua-api.factorio.com/latest/cla ... c_networks

Please close this request.
Post Reply

Return to “Already exists”