mirror of
https://github.com/mt-mods/unifieddyes.git
synced 2024-11-22 15:33:52 +01:00
disable old after_dig_node() callbacks
(don't split a digged node into neutral+dye)
This commit is contained in:
parent
ad8ab99bd8
commit
731c7d133e
26
init.lua
26
init.lua
@ -145,11 +145,15 @@ local default_dyes = {
|
||||
"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)
|
||||
end
|
||||
|
||||
function unifieddyes.after_dig_node(foo)
|
||||
end
|
||||
|
||||
-- this helper function registers all of the recipes needed to create colored
|
||||
-- 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")
|
||||
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)
|
||||
local stackname = itemstack:get_name()
|
||||
local playername = player:get_player_name()
|
||||
|
Loading…
Reference in New Issue
Block a user