better handling of the register_on_placenode rotation fix

This commit is contained in:
Vanessa Dannenberg 2018-08-26 07:09:20 -04:00
parent c005dc358a
commit 568168fe1f

@ -160,12 +160,14 @@ local default_dyes = {
minetest.register_on_placenode( minetest.register_on_placenode(
function(pos, newnode, placer, oldnode, itemstack, pointed_thing) function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
local def = minetest.registered_items[newnode.name] local def = minetest.registered_items[newnode.name]
if not def or not def.palette then return false end
if string.find(itemstack:to_string(), "palette_index") then if not def
minetest.swap_node(pos, {name = newnode.name, param2 = newnode.param2}) or not def.palette
return or def.after_place_node then
return false
end end
if not string.find(itemstack:to_string(), "palette_index") then
local param2 = 0 local param2 = 0
local color = 0 local color = 0
@ -181,6 +183,7 @@ minetest.register_on_placenode(
minetest.swap_node(pos, {name = newnode.name, param2 = param2}) minetest.swap_node(pos, {name = newnode.name, param2 = param2})
minetest.get_meta(pos):set_int("palette_index", color) minetest.get_meta(pos):set_int("palette_index", color)
end end
end
) )
-- just stubs to keep old mods from crashing when expecting auto-coloring -- just stubs to keep old mods from crashing when expecting auto-coloring