Fixed behavior regarding items that are registered with Minetest.
This commit is contained in:
parent
09600f8762
commit
ddb2a05e64
@ -270,35 +270,37 @@ function artisanryui.update_player_inventory(player, taken_stack)
|
|||||||
local blueprints = artisanryui.last_blueprints_cache[player:get_player_name()]
|
local blueprints = artisanryui.last_blueprints_cache[player:get_player_name()]
|
||||||
|
|
||||||
blueprints:foreach(function(blueprint)
|
blueprints:foreach(function(blueprint)
|
||||||
if blueprint.decremented_input ~= nil then
|
if blueprint:get_result():get_name() == taken_stack:get_name() then
|
||||||
artisanryui.inventory:set_list(player:get_player_name() .. "-input", blueprint.decremented_input.items)
|
if blueprint.decremented_input ~= nil then
|
||||||
return
|
-- This is an item registered with the default Minetest system.
|
||||||
elseif blueprint:get_result():get_name() == taken_stack:get_name() then
|
artisanryui.inventory:set_list(player:get_player_name() .. "-input", blueprint.decremented_input.items)
|
||||||
local start_row = arrayutil.next_matching_row(input_grid, nil, function(item)
|
else
|
||||||
return not artisanryutil.is_empty_item(item)
|
local start_row = arrayutil.next_matching_row(input_grid, nil, function(item)
|
||||||
end)
|
return not artisanryutil.is_empty_item(item)
|
||||||
local start_column = arrayutil.next_matching_column(input_grid, nil, function(item)
|
end)
|
||||||
return not artisanryutil.is_empty_item(item)
|
local start_column = arrayutil.next_matching_column(input_grid, nil, function(item)
|
||||||
end)
|
return not artisanryutil.is_empty_item(item)
|
||||||
|
end)
|
||||||
local blueprint_input = blueprint:get_input()
|
|
||||||
|
|
||||||
for row_index = start_row, start_row + #blueprint_input - 1, 1 do
|
|
||||||
local blueprint_row = blueprint_input[row_index - start_row + 1]
|
|
||||||
|
|
||||||
for column_index = start_column, start_column + #blueprint_row - 1, 1 do
|
local blueprint_input = blueprint:get_input()
|
||||||
local inventory_index = (row_index - 1) * 5 + column_index
|
|
||||||
|
for row_index = start_row, start_row + #blueprint_input - 1, 1 do
|
||||||
|
local blueprint_row = blueprint_input[row_index - start_row + 1]
|
||||||
|
|
||||||
local current_stack = input_grid[row_index][column_index]
|
for column_index = start_column, start_column + #blueprint_row - 1, 1 do
|
||||||
local blueprint_stack = blueprint_row[column_index - start_column + 1]
|
local inventory_index = (row_index - 1) * 5 + column_index
|
||||||
|
|
||||||
current_stack:set_count(current_stack:get_count() - blueprint_stack:get_count())
|
local current_stack = input_grid[row_index][column_index]
|
||||||
|
local blueprint_stack = blueprint_row[column_index - start_column + 1]
|
||||||
artisanryui.inventory:set_stack(player:get_player_name() .. "-input", inventory_index, current_stack)
|
|
||||||
|
current_stack:set_count(current_stack:get_count() - blueprint_stack:get_count())
|
||||||
|
|
||||||
|
artisanryui.inventory:set_stack(player:get_player_name() .. "-input", inventory_index, current_stack)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return
|
return true
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user