Page 1 of 1

get list of all existing logistic sections?

Posted: Fri Dec 06, 2024 2:59 pm
by ownlyme
i'm making a mod that lets you change all existing logistic groups in one ui, but i can't figure out how to access them.
even if i wanted to give some entity all logistic groups to access them there, i wouldn't know what the strings are for:
https://lua-api.factorio.com/latest/cla ... dd_section
ideas ?

Re: get list of all existing logistic sections?

Posted: Fri Dec 06, 2024 5:19 pm
by gangerM
Few days ago I had a similar problem, this is how I got it from an entity.

Code: Select all

local RequestPoint = CurrentEntity.get_requester_point()
if RequestPoint then
    for Index, Section in ipairs( RequestPoint.sections) do
        -- Groups can be shared between entities, so you might want to do something with it
        local IsGroup = Section.group and Section.group ~= ""
        if Section.filters then
            for Index2=1, #Section.filters do
                -- Slot is one request, contaisn all data
                local Slot = Section.get_slot(Index2)
            end
        end
    end
end
Now we need something to get all entities,"logistic-container", "cargo-landing-pad" or "space-platform-hub" got a requestpoint.

I think going through all entities can be achieved by these;
game.surfaces
Surface.find_entities_filtered
https://lua-api.factorio.com/latest/cla ... s_filtered

There might be easier ways, but this will definitly work

Re: get list of all existing logistic sections?

Posted: Fri Dec 06, 2024 7:37 pm
by ownlyme
yeah i was trying to find a way around scanning all logistic points on all surfaces or caching every entity the player opens