wip
This commit is contained in:
@@ -45,12 +45,11 @@ local function consolidate_stacks(stacks)
|
||||
end
|
||||
|
||||
local function extract_inventory_stacks(inventory, skip_count)
|
||||
skip_count = skip_count or 0
|
||||
|
||||
local result = {}
|
||||
local max_slots = inventory:get_size(MAIN)
|
||||
local first_slot = 1 + (skip_count or 0)
|
||||
local last_slot = inventory:get_size(MAIN)
|
||||
|
||||
for index = 1 + skip_count, max_slots do
|
||||
for index = first_slot, last_slot do
|
||||
local stack = inventory:get_stack(MAIN, index)
|
||||
if stack == nil then goto continue end
|
||||
if stack:is_empty() then goto continue end
|
||||
@@ -71,10 +70,11 @@ local function get_human_name(stack)
|
||||
end
|
||||
|
||||
local function inject_inventory(inventory, stacks, skip_count)
|
||||
skip_count = skip_count or 0
|
||||
local first_index = 1 + (skip_count or 0)
|
||||
local last_index = inventory:get_size(MAIN)
|
||||
for inv_index = 1 + skip_count, last_index do
|
||||
inventory:set_stack(MAIN, inv_index, stacks[inv_index])
|
||||
for inv_index = first_index, last_index do
|
||||
local stack_index = inv_index - first_index + 1
|
||||
inventory:set_stack(MAIN, inv_index, stacks[stack_index])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user