unified dyes uses on_use now, instead of on_rightclick

This commit is contained in:
Vanessa Ezekowitz
2017-02-04 19:41:36 -05:00
parent 13059eb3a2
commit a493933105
9 changed files with 77 additions and 164 deletions

View File

@ -20,25 +20,20 @@ minetest.register_node("lrfurn:armchair", {
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
inventory_image = "lrfurn_armchair_inv.png",
groups = {snappy=3},
groups = {snappy=3, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
node_box = armchair_cbox,
after_place_node = lrfurn.fix_rotation,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local itemname = itemstack:get_name()
if string.find(itemname, "dye:") or string.find(itemname, "unifieddyes:") then
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "lrfurn:armchair", "wallmounted")
else
if not clicker:is_player() then
return itemstack
end
pos.y = pos.y-0.5
clicker:setpos(pos)
clicker:set_hp(20)
if not clicker:is_player() then
return itemstack
end
pos.y = pos.y-0.5
clicker:setpos(pos)
clicker:set_hp(20)
return itemstack
end
})

View File

@ -18,7 +18,7 @@ minetest.register_node("lrfurn:longsofa", {
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
inventory_image = "lrfurn_longsofa_inv.png",
groups = {snappy=3},
groups = {snappy=3, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
selection_box = longsofa_cbox,
node_box = longsofa_cbox,
@ -40,19 +40,13 @@ minetest.register_node("lrfurn:longsofa", {
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local itemname = itemstack:get_name()
if string.find(itemname, "dye:") or string.find(itemname, "unifieddyes:") then
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "lrfurn:longsofa", "wallmounted")
else
if not clicker:is_player() then
return itemstack
end
pos.y = pos.y-0.5
clicker:setpos(pos)
clicker:set_hp(20)
if not clicker:is_player() then
return itemstack
end
pos.y = pos.y-0.5
clicker:setpos(pos)
clicker:set_hp(20)
return itemstack
end
})

View File

@ -18,7 +18,7 @@ minetest.register_node("lrfurn:sofa", {
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
inventory_image = "lrfurn_sofa_inv.png",
groups = {snappy=3},
groups = {snappy=3, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
selection_box = sofa_cbox,
node_box = sofa_cbox,
@ -40,19 +40,13 @@ minetest.register_node("lrfurn:sofa", {
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local itemname = itemstack:get_name()
if string.find(itemname, "dye:") or string.find(itemname, "unifieddyes:") then
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "lrfurn:sofa", "wallmounted")
else
if not clicker:is_player() then
return itemstack
end
pos.y = pos.y-0.5
clicker:setpos(pos)
clicker:set_hp(20)
if not clicker:is_player() then
return itemstack
end
pos.y = pos.y-0.5
clicker:setpos(pos)
clicker:set_hp(20)
return itemstack
end
})