disable old after_dig_node() callbacks

(don't split a digged node into neutral+dye)
This commit is contained in:
Vanessa Ezekowitz 2017-06-20 05:20:25 -04:00
parent ad8ab99bd8
commit 731c7d133e

@ -145,11 +145,15 @@ local default_dyes = {
"yellow" "yellow"
} }
-- just a stub to keep old mods from crashing when expecting auto-coloring -- just stubs to keep old mods from crashing when expecting auto-coloring
-- or getting back the dye on dig.
function unifieddyes.recolor_on_place(foo) function unifieddyes.recolor_on_place(foo)
end end
function unifieddyes.after_dig_node(foo)
end
-- this helper function registers all of the recipes needed to create colored -- this helper function registers all of the recipes needed to create colored
-- blocks with any of the dyes supported by that block's palette. -- blocks with any of the dyes supported by that block's palette.
@ -547,26 +551,6 @@ function unifieddyes.on_construct(pos)
meta:set_string("palette", "ext") meta:set_string("palette", "ext")
end end
-- call this in your node's after_dig_node to get the last-used dye back.
function unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
local prevdye
if oldmetadata and oldmetadata.fields then
prevdye = oldmetadata.fields.dye
end
local inv = digger:get_inventory()
if prevdye and not (inv:contains_item("main", prevdye) and creative_mode) and minetest.registered_items[prevdye] then
if inv:room_for_item("main", prevdye) then
inv:add_item("main", prevdye)
else
minetest.add_item(pos, prevdye)
end
end
end
function unifieddyes.on_use(itemstack, player, pointed_thing) function unifieddyes.on_use(itemstack, player, pointed_thing)
local stackname = itemstack:get_name() local stackname = itemstack:get_name()
local playername = player:get_player_name() local playername = player:get_player_name()