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

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