Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions uniform-unstick.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,25 @@ 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
end
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
Expand Down