Skip to content

Commit

Permalink
The "transfer all items" caravan action will now preserve metadata fo…
Browse files Browse the repository at this point in the history
…r even more items such as equipment grids, blueprint data, and upgrade planner data.
  • Loading branch information
notnotmelon committed Nov 9, 2024
1 parent ceff202 commit 8e0d002
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Date: ?
- Buffed the fertilizer-2 recipe. guano 3 -> 1, ammonium-chloride 20 -> 2.
- Deleted the micromine turd.
- The micromine machine now has a fixed recipe for incubated petri dishes.
- The "transfer all items" caravan action will now preserve metadata for even more items such as equipment grids, blueprint data, and upgrade planner data.
---------------------------------------------------------------------------------------------------
Version: 3.0.18
Date: 2024-11-7
Expand Down
12 changes: 5 additions & 7 deletions scripts/caravan/caravan-prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,11 @@ end

local function transfer_all_items(input_inventory, output_inventory)
if input_inventory.is_empty() or output_inventory.is_full() then return end
for _, stack in pairs(input_inventory.get_contents()) do
if output_inventory.can_insert(stack) then
local inserted_count = output_inventory.insert(stack)
if inserted_count ~= 0 then
stack.count = inserted_count
input_inventory.remove(stack)
end
for i = 1, #input_inventory do
local stack = input_inventory[i]
local inserted_count = output_inventory.insert(stack)
if inserted_count ~= 0 then
stack.count = stack.count - inserted_count
end
end
end
Expand Down

0 comments on commit 8e0d002

Please sign in to comment.