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

@ -45,7 +45,7 @@ homedecor.register("bed_regular", {
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
description = S("Bed"),
groups = {snappy=3},
groups = {snappy=3, ud_param2_colorable = 1},
selection_box = bed_sbox,
node_box = bed_cbox,
sounds = default.node_sound_wood_defaults(),
@ -61,10 +61,7 @@ homedecor.register("bed_regular", {
end,
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, "homedecor:bed_regular", "wallmounted")
elseif itemname == "homedecor:bed_regular" then
if itemname == "homedecor:bed_regular" then
homedecor.bed_expansion(pos, clicker, itemstack, pointed_thing, true)
return itemstack
else
@ -90,25 +87,20 @@ homedecor.register("bed_extended", {
palette = "unifieddyes_palette_colorwallmounted.png",
selection_box = bed_sbox,
node_box = bed_cbox,
groups = {snappy=3},
groups = {snappy=3, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
expand = { forward = "air" },
on_rotate = screwdriver.disallow,
after_dig_node = function(pos)
homedecor.unextend_bed(pos)
end,
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, "homedecor:bed_extended", "wallmounted")
else
-- if minetest.get_modpath("beds") then
-- beds.on_rightclick(pos, clicker)
-- end
return itemstack
end
end,
-- on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
-- local itemname = itemstack:get_name()
-- if minetest.get_modpath("beds") then
-- beds.on_rightclick(pos, clicker)
-- end
-- return itemstack
-- end,
drop = "homedecor:bed_regular"
})
@ -125,9 +117,8 @@ homedecor.register("bed_kingsize", {
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
inventory_image = "homedecor_bed_kingsize_inv.png",
groups = {snappy=3, not_in_creative_inventory=1},
description = S("Bed (king sized)"),
groups = {snappy=3, not_in_creative_inventory=1},
groups = {snappy=3, ud_param2_colorable = 1},
selection_box = kbed_sbox,
node_box = kbed_cbox,
sounds = default.node_sound_wood_defaults(),
@ -140,18 +131,13 @@ homedecor.register("bed_kingsize", {
inv:add_item("main", "homedecor:bed_regular 2")
end
end,
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, "homedecor:bed_kingsize", "wallmounted")
else
-- if minetest.get_modpath("beds") then
-- beds.on_rightclick(pos, clicker)
-- end
return itemstack
end
end
-- on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
-- local itemname = itemstack:get_name()
-- if minetest.get_modpath("beds") then
-- beds.on_rightclick(pos, clicker)
-- end
-- return itemstack
-- end
})
for _, w in pairs({ N_("mahogany"), N_("oak") }) do

View File

@ -66,7 +66,7 @@ homedecor.register("kitchen_chair_wood", {
paramtype2 = "wallmounted",
selection_box = kc_cbox,
collision_box = kc_cbox,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
after_place_node = homedecor.fix_rotation_nsew,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -88,20 +88,15 @@ homedecor.register("kitchen_chair_padded", {
palette = "unifieddyes_palette_colorwallmounted.png",
selection_box = kc_cbox,
collision_box = kc_cbox,
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
after_place_node = homedecor.fix_rotation_nsew,
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, "homedecor:kitchen_chair_padded", "wallmounted")
else
pos.y = pos.y+0 -- where do I put my ass ?
homedecor.sit(pos, node, clicker)
return itemstack
end
pos.y = pos.y+0 -- where do I put my ass ?
homedecor.sit(pos, node, clicker)
return itemstack
end
})
@ -116,16 +111,11 @@ homedecor.register("armchair", {
inventory_image = "homedecor_armchair_inv.png",
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
groups = {snappy=3},
groups = {snappy=3, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
node_box = ac_cbox,
after_place_node = homedecor.fix_rotation_nsew,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local itemname = itemstack:get_name()
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "homedecor:armchair", "wallmounted")
end
})
local ob_cbox = {

View File

@ -38,15 +38,11 @@ minetest.register_node("homedecor:glowlight_half", {
wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }
},
node_box = glowlight_nodebox.half,
groups = { snappy = 3 },
groups = { snappy = 3, ud_param2_colorable = 1 },
light_source = default.LIGHT_MAX,
sounds = default.node_sound_glass_defaults(),
after_place_node = homedecor.fix_rotation,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "homedecor:glowlight_half", "wallmounted")
end,
after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("homedecor:glowlight_quarter", {
@ -70,15 +66,11 @@ minetest.register_node("homedecor:glowlight_quarter", {
wall_side = { -0.5, -0.5, -0.5, -0.25, 0.5, 0.5 }
},
node_box = glowlight_nodebox.quarter,
groups = { snappy = 3 },
groups = { snappy = 3, ud_param2_colorable = 1 },
light_source = default.LIGHT_MAX-1,
sounds = default.node_sound_glass_defaults(),
after_place_node = homedecor.fix_rotation,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "homedecor:glowlight_quarter", "wallmounted")
end,
after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("homedecor:glowlight_small_cube", {
@ -102,15 +94,11 @@ minetest.register_node("homedecor:glowlight_small_cube", {
wall_side = { -0.5, -0.25, -0.25, 0, 0.25, 0.25 }
},
node_box = glowlight_nodebox.small_cube,
groups = { snappy = 3 },
groups = { snappy = 3, ud_param2_colorable = 1 },
light_source = default.LIGHT_MAX-1,
sounds = default.node_sound_glass_defaults(),
after_place_node = homedecor.fix_rotation,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "homedecor:glowlight_small_cube", "wallmounted")
end,
after_dig_node = unifieddyes.after_dig_node
})
homedecor.register("plasma_lamp", {
@ -437,19 +425,15 @@ local function reg_lamp(suffix, nxt, light, brightness)
light_source = light,
selection_box = tlamp_cbox,
sounds = default.node_sound_wood_defaults(),
groups = {cracky=2,oddly_breakable_by_hand=1,
groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1,
not_in_creative_inventory=((light ~= nil) and 1) or nil,
},
drop = "homedecor:table_lamp_off",
on_punch = function(pos, node, puncher)
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
node.name = "homedecor:table_lamp_"..repl[suffix]
minetest.set_node(pos, node)
end,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "homedecor:table_lamp_"..suffix, false)
end,
after_dig_node = unifieddyes.after_dig_node
})
homedecor.register("standing_lamp_"..suffix, {
@ -467,21 +451,17 @@ local function reg_lamp(suffix, nxt, light, brightness)
palette = "unifieddyes_palette.png",
walkable = false,
light_source = light,
groups = {cracky=2,oddly_breakable_by_hand=1,
groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1,
not_in_creative_inventory=((light ~= nil) and 1) or nil,
},
selection_box = slamp_cbox,
sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple,
on_punch = function(pos, node, puncher)
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
node.name = "homedecor:standing_lamp_"..repl[suffix]
minetest.set_node(pos, node)
end,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "homedecor:standing_lamp_"..suffix, false)
end,
expand = { top="placeholder" },
})
@ -518,13 +498,9 @@ homedecor.register("desk_lamp", {
selection_box = dlamp_cbox,
node_box = dlamp_cbox,
walkable = false,
groups = {snappy=3},
groups = {snappy=3, ud_param2_colorable = 1},
after_place_node = homedecor.fix_rotation_nsew,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "homedecor:desk_lamp", "wallmounted")
end,
after_dig_node = unifieddyes.after_dig_node
})
-- "kitchen"/"dining room" ceiling lamp

View File

@ -33,16 +33,13 @@ homedecor.register("shutter", {
inventory_image = inv,
wield_image = inv,
paramtype2 = "wallmounted",
groups = { snappy = 3 },
ud_replacement_node = "homedecor:shutter_colored",
groups = { snappy = 3, ud_param2_colorable = 1 },
sounds = default.node_sound_wood_defaults(),
selection_box = shutter_cbox,
node_box = shutter_cbox,
after_place_node = homedecor.fix_rotation,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "homedecor:shutter_colored", "wallmounted")
end
after_dig_node = unifieddyes.after_dig_node
})
homedecor.register("shutter_colored", {
@ -53,16 +50,12 @@ homedecor.register("shutter_colored", {
wield_image = "homedecor_window_shutter_inv.png",
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
groups = { snappy = 3 , not_in_creative_inventory = 1},
groups = { snappy = 3 , not_in_creative_inventory = 1, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
selection_box = shutter_cbox,
node_box = shutter_cbox,
after_place_node = homedecor.fix_rotation,
after_dig_node = unifieddyes.after_dig_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
unifieddyes.on_rightclick(pos, node, clicker,
itemstack, pointed_thing, "homedecor:shutter_colored", "wallmounted")
end,
drop = "homedecor:shutter"
})

View File

@ -108,7 +108,7 @@ minetest.register_node("homedecor:curtain_closed", {
drawtype = 'signlike',
use_texture_alpha = true,
walkable = false,
groups = { snappy = 3 },
groups = { snappy = 3, ud_param2_colorable = 1 },
sounds = default.node_sound_leaves_defaults(),
paramtype = "light",
paramtype2 = "colorwallmounted",
@ -118,18 +118,13 @@ minetest.register_node("homedecor:curtain_closed", {
after_place_node = homedecor.fix_rotation,
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, "homedecor:curtain_closed", "wallmounted")
else
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
-- Open the curtains
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_open", param2 = fdir })
end
return itemstack
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
-- Open the curtains
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_open", param2 = fdir })
end
return itemstack
end
})
@ -140,7 +135,7 @@ minetest.register_node("homedecor:curtain_open", {
drawtype = 'signlike',
use_texture_alpha = true,
walkable = false,
groups = { snappy = 3 },
groups = { snappy = 3, ud_param2_colorable = 1 },
sounds = default.node_sound_leaves_defaults(),
paramtype = "light",
paramtype2 = "colorwallmounted",
@ -150,18 +145,13 @@ minetest.register_node("homedecor:curtain_open", {
after_place_node = homedecor.fix_rotation,
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, "homedecor:curtain_open", "wallmounted")
else
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
-- Close the curtains
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_closed", param2 = fdir })
end
return itemstack
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
-- Close the curtains
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_closed", param2 = fdir })
end
return itemstack
end
})

View File

@ -30,19 +30,14 @@ minetest.register_node("lavalamp:lavalamp", {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25,0.5, 0.25 },
},
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
sounds = default.node_sound_glass_defaults(),
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, "lavalamp:lavalamp", false)
else
node.name = "lavalamp:lavalamp_off"
minetest.swap_node(pos, node)
return itemstack
end
node.name = "lavalamp:lavalamp_off"
minetest.swap_node(pos, node)
return itemstack
end
})

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
})