1
0
Fork 0

use on_destruct instead of after dig node

hollow_logs_ref_recovery
ChrisPHP 2023-08-20 17:02:55 +01:00 committed by the-real-herowl
parent 559f500322
commit 12568a6749
1 changed files with 2 additions and 7 deletions

View File

@ -107,6 +107,7 @@ end
-- Only drop the items that were in the input slot -- Only drop the items that were in the input slot
local function drop_stonecutter_items(pos, meta) local function drop_stonecutter_items(pos, meta)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
for i=1, inv:get_size("input") do for i=1, inv:get_size("input") do
local stack = inv:get_stack("input", i) local stack = inv:get_stack("input", i)
@ -115,7 +116,6 @@ local function drop_stonecutter_items(pos, meta)
minetest.add_item(p, stack) minetest.add_item(p, stack)
end end
end end
minetest.set_node(pos,{name="air"})
end end
minetest.register_node("mcl_stonecutter:stonecutter", { minetest.register_node("mcl_stonecutter:stonecutter", {
@ -157,12 +157,7 @@ minetest.register_node("mcl_stonecutter:stonecutter", {
_mcl_blast_resistance = 3.5, _mcl_blast_resistance = 3.5,
_mcl_hardness = 3.5, _mcl_hardness = 3.5,
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
on_destruct = drop_stonecutter_items,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
meta:from_table(oldmetadata)
drop_stonecutter_items(pos, meta)
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local name = player:get_player_name() local name = player:get_player_name()
if minetest.is_protected(pos, name) then if minetest.is_protected(pos, name) then