How to delete a logistic group?

Place to get help with not working mods / modding interface.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1754
Joined: Sun Oct 14, 2018 8:13 am
Contact:

How to delete a logistic group?

Post by Pi-C »

We can easily define logistic groups:

Code: Select all

/c p = game.player
    pos = p.position
    v = p.surface.create_entity{name = "car", force = p.force, position = {pos.x + 5, pos.y}}
    requester = v.get_logistic_point(defines.logistic_member_index.car_requester)
    requester.sections[1].set_slot(1, {value = {type = "item", name = "iron-plate", quality = "normal"}, min = 10})
    requester.sections[1].group = "test"
 
If you open the new car, you can edit/remove the group name from the section and you also get a button to delete the logistic group:
vehicle_logistics.png
vehicle_logistics.png (97.08 KiB) Viewed 305 times
I want to delete groups that have been created by my mod, but I don't see how to do this by script. Is there really no way to do this?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Natha
Filter Inserter
Filter Inserter
Posts: 261
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: How to delete a logistic group?

Post by Natha »

Maybe set group to an empty string
Pi-C
Smart Inserter
Smart Inserter
Posts: 1754
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to delete a logistic group?

Post by Pi-C »

Natha wrote: Sun Jun 08, 2025 9:41 am Maybe set group to an empty string
That wouldn't work. Run the command from my first post, then enter the following:

Code: Select all

/c requester.sections[1].group = ""
This will remove the group name from the section, but the group is still available in the "Change logistic group" GUI:
vehicle_logistics_empty_group.png
vehicle_logistics_empty_group.png (71.73 KiB) Viewed 175 times
The problem is this: We can create a LuaLogisticSection manually or by script. We can create a group manually (enter a new name into the "Change logistic group" GUI) or by script (set LuaLogisticSection::group to a string that hasn't been used yet), and we can change the group name of a section manually (select one of the existing names from "Change logistic group" GUI) and by script (set LuaLogisticSection::group to an existing name). However, once a group has been created, the only way to delete the group that I've found is to manually remove it using the "Delete logistic group" button from the GUI.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Modding help”