From 628c6ab533b2af86202131d09f90b2868372ece9 Mon Sep 17 00:00:00 2001 From: jczpqf Date: Sat, 14 Feb 2026 00:19:23 -0600 Subject: [PATCH] Updating uniform-unstick to unassign items from the global list When then uniform-unstick command is run it can unassign items from the squad but it does not remove them from the global assigned items datastructure. This can cause items to be assigned but not to any existing squad. --- uniform-unstick.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/uniform-unstick.lua b/uniform-unstick.lua index 5be03a4cc..02b3e3f0f 100644 --- a/uniform-unstick.lua +++ b/uniform-unstick.lua @@ -97,7 +97,7 @@ local function remove_item_from_position(squad_position, item_id) for idx, assigned_item_id in ipairs(uniform_spec.assigned) do if assigned_item_id == item_id then uniform_spec.assigned:erase(idx) - return + break end end end @@ -105,7 +105,17 @@ local function remove_item_from_position(squad_position, item_id) for _, special_case in ipairs({"quiver", "backpack", "flask"}) do if squad_position.equipment[special_case] == item_id then squad_position.equipment[special_case] = -1 - return + break + end + end + + -- Move the item from assigned to unassigned in the global equipment lists + local item = df.item.find(item_id) + if item then + local item_type = item:getType() + local equipment = df.global.plotinfo.equipment + if utils.erase_sorted(equipment.items_assigned[item_type], item_id) then + utils.insert_sorted(equipment.items_unassigned[item_type], item_id) end end end