Fix circular saw item duplication bug (#173)

This commit is contained in:
afkplayer5000 2021-08-29 00:23:47 -06:00 committed by GitHub
parent e8d219f108
commit f8a7d66403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -337,6 +337,10 @@ function circular_saw.on_metadata_inventory_take(
local input_stack = inv:get_stack(listname, index) local input_stack = inv:get_stack(listname, index)
if not input_stack:is_empty() and input_stack:get_name()~=stack:get_name() then if not input_stack:is_empty() and input_stack:get_name()~=stack:get_name() then
local player_inv = player:get_inventory() local player_inv = player:get_inventory()
-- Prevent arbitrary item duplication.
inv:remove_item(listname, input_stack)
if player_inv:room_for_item("main", input_stack) then if player_inv:room_for_item("main", input_stack) then
player_inv:add_item("main", input_stack) player_inv:add_item("main", input_stack)
end end