Исправление бага с вылетом игры при нажатии ПКМ на полые блоки дерева

This commit is contained in:
Meow 2024-11-08 05:32:05 +03:00
parent c76dc71284
commit 88ea992984

View File

@ -411,22 +411,35 @@ local function make_stripped_trunk(itemstack, placer, pointed_thing)
end
if noddef._mcl_stripped_variant == nil then
return itemstack
else
minetest.swap_node(pointed_thing.under, {name=noddef._mcl_stripped_variant, param2=node.param2})
if minetest.get_item_group(node_name, "waxed") ~= 0 then
awards.unlock(placer:get_player_name(), "mcl:wax_off")
end
if not minetest.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a axey node)
local toolname = itemstack:get_name()
local wear = mcl_autogroup.get_wear(toolname, "axey")
if wear then
itemstack:add_wear(wear)
tt.reload_itemstack_description(itemstack) -- update tooltip
end
end
end
return itemstack
else
if minetest.registered_nodes[noddef._mcl_stripped_variant] == nil then
-- vl_hollow_logs:acaciatree_hollow -> vl_hollow_logs:stripped_acacia_hollow
local node_name_try = "vl_hollow_logs:stripped_" .. string.sub(node_name, 16, -12) .. "_hollow"
--core.chat_send_all(node_name_try)
if minetest.registered_nodes[node_name_try] == nil then
return
else
minetest.swap_node(pointed_thing.under, {name=node_name_try, param2=node.param2})
end
else
minetest.swap_node(pointed_thing.under, {name=noddef._mcl_stripped_variant, param2=node.param2})
end
if minetest.get_item_group(node_name, "waxed") ~= 0 then
awards.unlock(placer:get_player_name(), "mcl:wax_off")
end
if not minetest.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a axey node)
local toolname = itemstack:get_name()
local wear = mcl_autogroup.get_wear(toolname, "axey")
if wear then
itemstack:add_wear(wear)
tt.reload_itemstack_description(itemstack) -- update tooltip
end
end
end
return itemstack
end