mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 11:33:44 +01:00
Fix crash when crafting callbacks return strings (#12685)
Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
This commit is contained in:
parent
c8ee755c05
commit
8bf1609ccc
@ -303,14 +303,16 @@ end
|
|||||||
|
|
||||||
function core.on_craft(itemstack, player, old_craft_list, craft_inv)
|
function core.on_craft(itemstack, player, old_craft_list, craft_inv)
|
||||||
for _, func in ipairs(core.registered_on_crafts) do
|
for _, func in ipairs(core.registered_on_crafts) do
|
||||||
itemstack = func(itemstack, player, old_craft_list, craft_inv) or itemstack
|
-- cast to ItemStack since func() could return a string
|
||||||
|
itemstack = ItemStack(func(itemstack, player, old_craft_list, craft_inv) or itemstack)
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
function core.craft_predict(itemstack, player, old_craft_list, craft_inv)
|
function core.craft_predict(itemstack, player, old_craft_list, craft_inv)
|
||||||
for _, func in ipairs(core.registered_craft_predicts) do
|
for _, func in ipairs(core.registered_craft_predicts) do
|
||||||
itemstack = func(itemstack, player, old_craft_list, craft_inv) or itemstack
|
-- cast to ItemStack since func() could return a string
|
||||||
|
itemstack = ItemStack(func(itemstack, player, old_craft_list, craft_inv) or itemstack)
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user