get list of all existing logistic sections?

Place to get help with not working mods / modding interface.
User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 444
Joined: Thu Dec 21, 2017 8:02 am
Contact:

get list of all existing logistic sections?

Post 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 ?
creator of 55 mods
My api requests/suggestions: ui relative for overlay||Grenade arc||Player Modifiers||textbox::selection||Singleplayer RCON||disable car's ground sounds
User avatar
gangerM
Burner Inserter
Burner Inserter
Posts: 18
Joined: Thu Nov 28, 2024 5:32 pm
Contact:

Re: get list of all existing logistic sections?

Post 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
User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 444
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: get list of all existing logistic sections?

Post 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
creator of 55 mods
My api requests/suggestions: ui relative for overlay||Grenade arc||Player Modifiers||textbox::selection||Singleplayer RCON||disable car's ground sounds
Post Reply

Return to “Modding help”