1
0
Fork 0

use on_destruct instead of after dig node

This commit is contained in:
Chris Page 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
local function drop_stonecutter_items(pos, meta)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
for i=1, inv:get_size("input") do
local stack = inv:get_stack("input", i)
@ -115,7 +116,6 @@ local function drop_stonecutter_items(pos, meta)
minetest.add_item(p, stack)
end
end
minetest.set_node(pos,{name="air"})
end
minetest.register_node("mcl_stonecutter:stonecutter", {
@ -157,12 +157,7 @@ minetest.register_node("mcl_stonecutter:stonecutter", {
_mcl_blast_resistance = 3.5,
_mcl_hardness = 3.5,
sounds = mcl_sounds.node_sound_stone_defaults(),
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos)
meta:from_table(oldmetadata)
drop_stonecutter_items(pos, meta)
end,
on_destruct = drop_stonecutter_items,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local name = player:get_player_name()
if minetest.is_protected(pos, name) then