Page 1 of 1

How to delete a logistic group?

Posted: Sat Jun 07, 2025 11:25 am
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 308 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?

Re: How to delete a logistic group?

Posted: Sun Jun 08, 2025 9:41 am
by Natha
Maybe set group to an empty string

Re: How to delete a logistic group?

Posted: Sun Jun 08, 2025 2:09 pm
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 178 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.