Hi
I have a need in Constructron-Continued to be able to identify a logistic network and not just individual roboports and/or it's neighbors. v1.0.7 will walk between service stations(effectively roboports) based on a game.tick time out and walk to the next closest station with no regard for if it is in the same logistic network or not.
Essentially what I briefly would like to do is identify the logistic networks and their contents in storage then do some logic on what items can be fulfilled in each.
This probably could be achieved with a lot more code but this is a simple and clean way of doing it.
Thanks
Logistic Network Identifier
Re: Logistic Network Identifier
I think it is already possible in both way:
From top down,you can use LuaForce.logistic_networks[surface_name][index] to get LuaLogisticNetwork
https://lua-api.factorio.com/latest/Lua ... c_networks
https://lua-api.factorio.com/latest/Lua ... twork.html
which will have the property you need.
From bottom up,you can LuaEntity.logistic_network to get it.
https://lua-api.factorio.com/latest/Lua ... ic_network
From top down,you can use LuaForce.logistic_networks[surface_name][index] to get LuaLogisticNetwork
https://lua-api.factorio.com/latest/Lua ... c_networks
https://lua-api.factorio.com/latest/Lua ... twork.html
which will have the property you need.
From bottom up,you can LuaEntity.logistic_network to get it.
https://lua-api.factorio.com/latest/Lua ... ic_network
nah,Id system for logistic network is really something needed
Re: Logistic Network Identifier
I thought I might give this a bump.
Re: Logistic Network Identifier
Here is a function you can use to get a unique identifier for a logistic network.
Code: Select all
function get_logistic_network_id(logistic_network)
if not global.logistic_networks then global.logistic_networks = {} end
for id, n in pairs(global.logistic_networks) do
if n == logistic_network then
return id
end
end
if not global.last_id then global.last_id = 0 end
global.last_id = global.last_id + 1
global.logistic_networks[global.last_id] = logistic_network
return global.last_id
end