summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blox/init.lua56
-rw-r--r--bobblocks/blocks.lua60
-rw-r--r--coloredwood/init.lua56
-rw-r--r--framedglass/init.lua17
-rw-r--r--homedecor/bedroom.lua50
-rw-r--r--homedecor/crafts.lua34
-rw-r--r--homedecor/furniture.lua22
-rw-r--r--homedecor/furniture_recipes.lua2
-rw-r--r--homedecor/lighting.lua50
-rw-r--r--homedecor/shutters.lua15
-rw-r--r--homedecor/window_treatments.lua38
-rw-r--r--ilights/init.lua8
-rw-r--r--inbox/depends.txt1
-rw-r--r--inbox/init.lua6
-rw-r--r--lavalamp/init.lua13
-rw-r--r--lrfurn/armchairs.lua17
-rw-r--r--lrfurn/longsofas.lua18
-rw-r--r--lrfurn/sofas.lua18
-rw-r--r--plasticbox/init.lua3
-rw-r--r--stained_glass/init.lua35
-rw-r--r--unifiedbricks/init.lua24
-rw-r--r--unifieddyes/init.lua172
22 files changed, 284 insertions, 431 deletions
diff --git a/blox/init.lua b/blox/init.lua
index 6faabd9..2313d13 100644
--- a/blox/init.lua
+++ b/blox/init.lua
@@ -123,13 +123,9 @@ for _, nodeclass in ipairs(NodeClass) do
paramtype = "light",
paramtype2 = "color",
is_ground_content = true,
- groups = {cracky=3, not_in_creative_inventory=creative},
+ groups = {cracky=3, not_in_creative_inventory=creative, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
- 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, "blox:stone_"..nodeclass)
- end,
+ after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("blox:cobble_"..nodeclass, {
@@ -144,13 +140,9 @@ for _, nodeclass in ipairs(NodeClass) do
paramtype = "light",
paramtype2 = "color",
is_ground_content = true,
- groups = {cracky=3, not_in_creative_inventory=creative},
+ groups = {cracky=3, not_in_creative_inventory=creative, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
- 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, "blox:cobble_"..nodeclass)
- end,
+ after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("blox:wood_"..nodeclass, {
@@ -165,13 +157,9 @@ for _, nodeclass in ipairs(NodeClass) do
paramtype = "light",
paramtype2 = "color",
is_ground_content = true,
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory=creative},
+ groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory=creative, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
- 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, "blox:wood_"..nodeclass)
- end,
+ after_dig_node = unifieddyes.after_dig_node
})
end
@@ -184,13 +172,9 @@ minetest.register_node("blox:wood_tinted", {
paramtype = "light",
paramtype2 = "color",
is_ground_content = true,
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory=creative},
+ groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory=creative, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
- 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, "blox:wood_tinted")
- end,
+ after_dig_node = unifieddyes.after_dig_node
})
@@ -201,13 +185,9 @@ minetest.register_node("blox:cobble_tinted", {
paramtype = "light",
paramtype2 = "color",
is_ground_content = true,
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory=creative},
+ groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory=creative, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
- 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, "blox:cobble_tinted")
- end,
+ after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("blox:stone_tinted", {
@@ -217,13 +197,9 @@ minetest.register_node("blox:stone_tinted", {
paramtype = "light",
paramtype2 = "color",
is_ground_content = true,
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory=creative},
+ groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory=creative, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
- 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, "blox:stone_tinted")
- end,
+ after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("blox:stone_square", {
@@ -233,13 +209,9 @@ minetest.register_node("blox:stone_square", {
paramtype = "light",
paramtype2 = "color",
is_ground_content = true,
- groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory=creative},
+ groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory=creative, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
- 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, "blox:stone_square")
- end,
+ after_dig_node = unifieddyes.after_dig_node
})
-- Crafting
diff --git a/bobblocks/blocks.lua b/bobblocks/blocks.lua
index 84fdc37..3c9ef40 100644
--- a/bobblocks/blocks.lua
+++ b/bobblocks/blocks.lua
@@ -42,18 +42,14 @@ minetest.register_node("bobblocks:block", {
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
foo = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:block_off"
}
},
on_punch = bobblocks.update_bobblock,
- 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, "bobblocks:block", false)
- end
+ after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("bobblocks:block_off", {
@@ -63,19 +59,15 @@ minetest.register_node("bobblocks:block_off", {
palette = "unifieddyes_palette.png",
is_ground_content = true,
alpha = WATER_ALPHA,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
drop = 'bobblocks:redblock',
foo = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:block"
}
},
- on_punch = bobblocks.update_bobblock,
- 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, "bobblocks:block_off", false)
- end
+ on_rightclick = bobblocks.update_bobblock,
+ after_dig_node = unifieddyes.after_dig_node
})
-- Block Poles
@@ -91,18 +83,14 @@ minetest.register_node("bobblocks:pole", {
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
foo = {conductor={
state = mesecon.state.on,
offstate = "bobblocks:pole_off"
}
},
- on_punch = bobblocks.update_bobblock,
- 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, "bobblocks:pole", false)
- end
+ on_rightclick = bobblocks.update_bobblock,
+ after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("bobblocks:pole_off", {
@@ -116,19 +104,15 @@ minetest.register_node("bobblocks:pole_off", {
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-10,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
drop = 'bobblocks:redpole',
foo = {conductor={
state = mesecon.state.off,
onstate = "bobblocks:pole"
}
},
- on_punch = bobblocks.update_bobblock,
- 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, "bobblocks:pole_off", false)
- end
+ on_rightclick = bobblocks.update_bobblock,
+ after_dig_node = unifieddyes.after_dig_node
})
-- old static nodes grandfathered-in because they have a different texture or usage than the colored ones.
@@ -155,18 +139,14 @@ minetest.register_node("bobblocks:wavyblock", {
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
light_source = LIGHT_MAX-0,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
foo = {conductor=
{
state = mesecon.state.on,
offstate = "bobblocks:wavyblock_off"
}
},
- 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, "bobblocks:wavyblock", false)
- end
+ after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("bobblocks:wavyblock_off", {
@@ -176,7 +156,7 @@ minetest.register_node("bobblocks:wavyblock_off", {
palette = "unifieddyes_palette.png",
is_ground_content = true,
alpha = WATER_ALPHA,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1, ud_param2_colorable = 1},
drop = 'bobblocks:wavyblock',
foo = {conductor=
{
@@ -184,11 +164,7 @@ minetest.register_node("bobblocks:wavyblock_off", {
onstate = "bobblocks:wavyblock"
}
},
- 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, "bobblocks:wavyblock_off", false)
- end
+ after_dig_node = unifieddyes.after_dig_node
})
minetest.register_node("bobblocks:wavypole", {
@@ -202,12 +178,8 @@ minetest.register_node("bobblocks:wavypole", {
sunlight_propagates = true,
is_ground_content = true,
sounds = default.node_sound_glass_defaults(),
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, ud_param2_colorable = 1},
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, "bobblocks:wavypole", false)
- end
--light_source = LIGHT_MAX-0,
})
diff --git a/coloredwood/init.lua b/coloredwood/init.lua
index c83f236..d4c48c5 100644
--- a/coloredwood/init.lua
+++ b/coloredwood/init.lua
@@ -152,13 +152,10 @@ for _, color in ipairs(coloredwood.hues_plus_greys) do
palette = "unifieddyes_palette_"..color.."s.png",
walkable = true,
sunlight_propagates = false,
- groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2, not_in_creative_inventory=1},
+ ud_replacement_node = "coloredwood:wood_"..color,
+ groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2, not_in_creative_inventory=1, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
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, "coloredwood:wood_"..color, true)
- end,
drop = "default:wood"
})
@@ -178,12 +175,8 @@ for _, color in ipairs(coloredwood.hues_plus_greys) do
paramtype = "light",
paramtype2 = "colorfacedir",
palette = "unifieddyes_palette_"..color.."s.png",
- groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2, not_in_creative_inventory=1},
- 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, nil, true)
- end
+ groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2, not_in_creative_inventory=1, ud_param2_colorable = 1},
+ after_dig_node = unifieddyes.after_dig_node
}
)
end
@@ -198,25 +191,12 @@ end
or string.find(i.name, "moreblocks:slab_wood")
or string.find(i.name, "moreblocks:panel_wood")
or string.find(i.name, "moreblocks:micro_wood")
- or string.find(i.name, "moreblocks:slope_wood")
- then
-
+ or string.find(i.name, "moreblocks:slope_wood") then
+ local s1, s2 = is_stairsplus(i.name)
minetest.override_item(i.name, {
- on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
- local wield = itemstack:get_name()
- local newnode = nil
- if string.find(wield, "dye:") or string.find(wield, "unifieddyes:") then
- local s1, s2 = is_stairsplus(i.name)
- local paletteidx, hue = unifieddyes.getpaletteidx(wield, true)
- if hue ~= 0 then
- newnode = "coloredwood:"..s1.."_wood_"..coloredwood.hues[hue]..s2
- else
- newnode = "coloredwood:"..s1.."_wood_grey"..s2
- end
- end
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, newnode, true)
- end,
+ ud_replacement_node = "coloredwood:"..s1.."_wood_grey",
+ paramtype2 = "colorfacedir",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1, ud_param2_colorable = 1},
})
end
end
@@ -243,10 +223,8 @@ end
minetest.override_item("default:wood", {
paramtype2 = "colorfacedir",
- on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, "coloredwood:wood_grey", true)
- end
+ ud_replacement_node = "coloredwood:wood_grey",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1, ud_param2_colorable = 1},
})
minetest.register_node("coloredwood:fence", {
@@ -257,25 +235,19 @@ minetest.register_node("coloredwood:fence", {
paramtype2 = "color",
palette = "unifieddyes_palette.png",
walkable = true,
- groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, ud_param2_colorable = 1},
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
},
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, "coloredwood:fence")
- end,
drop = "default:fence_wood"
})
minetest.override_item("default:fence_wood", {
- on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, "coloredwood:fence")
- end
+ ud_replacement_node = "coloredwood:fence",
+ groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, ud_param2_colorable = 1}
})
-- ============================
diff --git a/framedglass/init.lua b/framedglass/init.lua
index 07f60d1..90bd6c5 100644
--- a/framedglass/init.lua
+++ b/framedglass/init.lua
@@ -1,5 +1,7 @@
-- Minetest 0.4.7 mod: framedglass
+framedglass = {}
+
minetest.register_craft({
output = 'framedglass:wooden_framed_glass 4',
recipe = {
@@ -94,13 +96,14 @@ local function is_buildable_to(placer_name, ...)
return true
end
-local color_on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+function framedglass.color_on_punch(pos, node, puncher, pointed_thing)
+ local itemstack = puncher:get_wielded_item()
local itemname = itemstack:get_name()
if not string.find(itemname, "dye:") then
if minetest.registered_nodes[node.name] then
local pos2 = select_node(pointed_thing)
- if pos2 and is_buildable_to(clicker, pos2) then
+ if pos2 and is_buildable_to(puncher, pos2) then
minetest.set_node(pos2, { name = itemname })
if not creative_mode then
itemstack:take_item()
@@ -121,18 +124,18 @@ local color_on_rightclick = function(pos, node, clicker, itemstack, pointed_thin
local newcolor2 = string.gsub(newcolor2, "dark_grey", "darkgrey")
if oldcolor == newcolor2 then
- minetest.chat_send_player(clicker:get_player_name(), "That node is already "..newcolor.."." )
+ minetest.chat_send_player(puncher:get_player_name(), "That node is already "..newcolor.."." )
return itemstack
end
if not (newcolor == "dark_grey"
or newcolor == "dark_green"
or minetest.registered_nodes["framedglass:steel_framed_obsidian_glass"..newcolor]) then
- minetest.chat_send_player(clicker:get_player_name(), "Framed glass doesn't support "..newcolor.."." )
+ minetest.chat_send_player(puncher:get_player_name(), "Framed glass doesn't support "..newcolor.."." )
return itemstack
end
- local inv = clicker:get_inventory()
+ local inv = puncher:get_inventory()
local prevdye = "dye:"..oldcolor2
print(oldcolor, oldcolor2, newcolor, newcolor2, prevdye)
@@ -178,7 +181,7 @@ minetest.register_node("framedglass:steel_framed_obsidian_glass", {
sunlight_propagates = true,
groups = {cracky=3,oddly_breakable_by_hand=3},
sounds = default.node_sound_glass_defaults(),
- on_rightclick = color_on_rightclick,
+ on_punch = framedglass.color_on_punch,
after_dig_node = return_dye_after_dig
})
@@ -196,7 +199,7 @@ function add_coloured_framedglass(name, desc, color)
use_texture_alpha = true,
groups = {cracky=3, not_in_creative_inventory=1},
sounds = default.node_sound_glass_defaults(),
- on_rightclick = color_on_rightclick,
+ on_punch = framedglass.color_on_punch,
after_dig_node = return_dye_after_dig,
drop = "framedglass:steel_framed_obsidian_glass"
})
diff --git a/homedecor/bedroom.lua b/homedecor/bedroom.lua
index 79c573b..8e29ee3 100644
--- a/homedecor/bedroom.lua
+++ b/homedecor/bedroom.lua
@@ -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
diff --git a/homedecor/crafts.lua b/homedecor/crafts.lua
index b887c2d..9877f84 100644
--- a/homedecor/crafts.lua
+++ b/homedecor/crafts.lua
@@ -2488,27 +2488,21 @@ local bedcolors = {
{ "brown", "brown" },
}
-for c in ipairs(bedcolors) do
- local color = bedcolors[c][1]
- local woolcolor = bedcolors[c][2]
-
- minetest.register_craft( {
- output = "homedecor:bed_"..color.."_regular",
- recipe = {
- { "group:stick", "", "group:stick" },
- { "wool:white", "wool:"..woolcolor, "wool:"..woolcolor },
- { "group:wood", "", "group:wood" },
- },
- })
-
- minetest.register_craft( {
- output = "homedecor:bed_"..color.."_kingsize",
- recipe = {
- { "homedecor:bed_"..color.."_regular", "homedecor:bed_"..color.."_regular" }
- },
- })
+minetest.register_craft( {
+ output = "homedecor:bed_regular",
+ recipe = {
+ { "group:stick", "", "group:stick" },
+ { "wool:white", "wool:white", "wool:white" },
+ { "group:wood", "", "group:wood" },
+ },
+})
-end
+minetest.register_craft( {
+ output = "homedecor:bed_kingsize",
+ recipe = {
+ { "homedecor:bed_regular", "homedecor:bed_regular" }
+ },
+})
minetest.register_craft( {
output = "homedecor:bottle_green",
diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua
index 8f60c5d..d1e24a9 100644
--- a/homedecor/furniture.lua
+++ b/homedecor/furniture.lua
@@ -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 = {
diff --git a/homedecor/furniture_recipes.lua b/homedecor/furniture_recipes.lua
index 9ece79f..e64e849 100644
--- a/homedecor/furniture_recipes.lua
+++ b/homedecor/furniture_recipes.lua
@@ -1,6 +1,6 @@
minetest.register_craft({
- output = "homedecor:table", "homedecor:kitchen_chair_wood 2",
+ output = "homedecor:table",
recipe = {
{ "group:wood","group:wood", "group:wood" },
{ "group:stick", "", "group:stick" },
diff --git a/homedecor/lighting.lua b/homedecor/lighting.lua
index 5b29338..0a1edaf 100644
--- a/homedecor/lighting.lua
+++ b/homedecor/lighting.lua
@@ -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
diff --git a/homedecor/shutters.lua b/homedecor/shutters.lua
index 733632b..8feb0e7 100644
--- a/homedecor/shutters.lua
+++ b/homedecor/shutters.lua
@@ -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"
})
diff --git a/homedecor/window_treatments.lua b/homedecor/window_treatments.lua
index 27be83d..c09f2dd 100644
--- a/homedecor/window_treatments.lua
+++ b/homedecor/window_treatments.lua
@@ -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
})
diff --git a/ilights/init.lua b/ilights/init.lua
index 96f2d3e..b94f916 100644
--- a/ilights/init.lua
+++ b/ilights/init.lua
@@ -60,7 +60,7 @@ minetest.register_node("ilights:light", {
"ilights_lamp_lens.png"
},
use_texture_alpha = true,
- groups = {cracky=3},
+ groups = {cracky=3, ud_param2_colorable = 1},
paramtype = "light",
paramtype2 = "colorwallmounted",
palette = "unifieddyes_palette_colorwallmounted.png",
@@ -68,11 +68,7 @@ minetest.register_node("ilights:light", {
selection_box = lamp_cbox,
node_box = lamp_cbox,
after_place_node = ilights.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, "ilights:light", "wallmounted")
- end,
+ after_dig_node = unifieddyes.after_dig_node
})
minetest.register_craft({
diff --git a/inbox/depends.txt b/inbox/depends.txt
index 947d2a7..ace758c 100644
--- a/inbox/depends.txt
+++ b/inbox/depends.txt
@@ -1,2 +1,3 @@
default
homedecor_i18n
+screwdriver?
diff --git a/inbox/init.lua b/inbox/init.lua
index 7262e9f..3de7a3c 100644
--- a/inbox/init.lua
+++ b/inbox/init.lua
@@ -2,7 +2,7 @@
local S = homedecor_i18n.gettext
local inbox = {}
-screwdriver = screwdriver or {}
+local screwdriver = rawget(_G, "screwdriver") or {}
minetest.register_craft({
output ="inbox:empty",
@@ -53,12 +53,12 @@ minetest.register_node("inbox:empty", {
clicker:get_player_control().aux1 then
minetest.show_formspec(
clicker:get_player_name(),
- "default:chest_locked",
+ "inbox:mailbox",
inbox.get_inbox_formspec(pos))
else
minetest.show_formspec(
clicker:get_player_name(),
- "default:chest_locked",
+ "inbox:mailbox",
inbox.get_inbox_insert_formspec(pos))
end
return itemstack
diff --git a/lavalamp/init.lua b/lavalamp/init.lua
index eec843a..42b70af 100644
--- a/lavalamp/init.lua
+++ b/lavalamp/init.lua
@@ -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
})
diff --git a/lrfurn/armchairs.lua b/lrfurn/armchairs.lua
index fc9d096..e471267 100644
--- a/lrfurn/armchairs.lua
+++ b/lrfurn/armchairs.lua
@@ -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
})
diff --git a/lrfurn/longsofas.lua b/lrfurn/longsofas.lua
index b741aa9..b5216c2 100644
--- a/lrfurn/longsofas.lua
+++ b/lrfurn/longsofas.lua
@@ -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
})
diff --git a/lrfurn/sofas.lua b/lrfurn/sofas.lua
index b05414c..57d4904 100644
--- a/lrfurn/sofas.lua
+++ b/lrfurn/sofas.lua
@@ -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
})
diff --git a/plasticbox/init.lua b/plasticbox/init.lua
index 8bd6a69..96366f3 100644
--- a/plasticbox/init.lua
+++ b/plasticbox/init.lua
@@ -2,12 +2,11 @@ minetest.register_node("plasticbox:plasticbox", {
description = "Plastic Box",
tiles = {"plasticbox_white.png"},
is_ground_content = false,
- groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1},
+ groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
paramtype2 = "color",
palette = "unifieddyes_palette.png",
after_dig_node = unifieddyes.after_dig_node,
- on_rightclick = unifieddyes.on_rightclick,
})
stairsplus:register_all("plasticbox", "plasticbox", "plasticbox:plasticbox", {
diff --git a/stained_glass/init.lua b/stained_glass/init.lua
index 6ffb61d..0ffd0c0 100644
--- a/stained_glass/init.lua
+++ b/stained_glass/init.lua
@@ -51,7 +51,7 @@ minetest.register_node("stained_glass:stained_glass", {
light_source = myglow,
is_ground_content = true,
walkable = true,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
sounds = default.node_sound_glass_defaults(),
drop = "moreblocks:super_glow_glass",
after_dig_node = unifieddyes.after_dig_node,
@@ -61,17 +61,13 @@ minetest.register_node("stained_glass:stained_glass", {
minetest.swap_node(pos, { name = "stained_glass:pastel_stained_glass", param2 = node.param2 })
return
end
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, "stained_glass:stained_glass")
end,
drop = "moreblocks:super_glow_glass"
})
minetest.override_item("moreblocks:super_glow_glass", {
- on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, "stained_glass:stained_glass")
- end
+ groups = {snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, ud_param2_colorable = 1},
+ ud_replacement_node = "stained_glass:stained_glass"
})
-- pastel and faint
@@ -88,7 +84,7 @@ minetest.register_node("stained_glass:pastel_stained_glass", {
light_source = myglow,
is_ground_content = true,
walkable = true,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, 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)
@@ -97,8 +93,6 @@ minetest.register_node("stained_glass:pastel_stained_glass", {
minetest.swap_node(pos, { name = "stained_glass:faint_stained_glass", param2 = node.param2 })
return
end
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, "stained_glass:pastel_stained_glass")
end,
drop = "moreblocks:super_glow_glass"
})
@@ -115,13 +109,9 @@ minetest.register_node("stained_glass:faint_stained_glass", {
light_source = myglow,
is_ground_content = true,
walkable = true,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, 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)
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, "stained_glass:faint_stained_glass")
- end,
drop = "moreblocks:super_glow_glass"
})
@@ -146,7 +136,7 @@ minetest.register_node("stained_glass:stained_trap_glass", {
light_source = myglow,
is_ground_content = true,
walkable = false,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
sounds = default.node_sound_glass_defaults(),
drop = "moreblocks:trap_super_glow_glass",
after_dig_node = unifieddyes.after_dig_node,
@@ -156,8 +146,6 @@ minetest.register_node("stained_glass:stained_trap_glass", {
minetest.swap_node(pos, { name = "stained_glass:pastel_stained_trap_glass", param2 = node.param2 })
return
end
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, "stained_glass:stained_trap_glass")
end,
drop = "moreblocks:trap_super_glow_glass"
})
@@ -176,7 +164,7 @@ minetest.register_node("stained_glass:pastel_stained_trap_glass", {
light_source = myglow,
is_ground_content = true,
walkable = true,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, 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)
@@ -185,8 +173,6 @@ minetest.register_node("stained_glass:pastel_stained_trap_glass", {
minetest.swap_node(pos, { name = "stained_glass:faint_stained_trap_glass", param2 = node.param2 })
return
end
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, "stained_glass:pastel_stained_glass")
end,
drop = "moreblocks:trap_super_glow_glass"
})
@@ -203,13 +189,8 @@ minetest.register_node("stained_glass:faint_stained_trap_glass", {
light_source = myglow,
is_ground_content = true,
walkable = true,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1},
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1, 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)
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, "stained_glass:faint_stained_glass")
- end,
drop = "moreblocks:trap_super_glow_glass"
})
diff --git a/unifiedbricks/init.lua b/unifiedbricks/init.lua
index 369126a..d041e8a 100644
--- a/unifiedbricks/init.lua
+++ b/unifiedbricks/init.lua
@@ -104,21 +104,15 @@ minetest.register_node("unifiedbricks:brickblock", {
paramtype2 = "color",
palette = "unifieddyes_palette.png",
is_ground_content = true,
- groups = {cracky=3, not_in_creative_inventory=1},
+ groups = {cracky=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
sounds = default.node_sound_stone_defaults(),
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, "unifiedbricks:brickblock")
- end,
drop = "default:brick"
})
minetest.override_item("default:brick", {
- on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, "unifiedbricks:brickblock")
- end
+ ud_replacement_node = "unifiedbricks:brickblock",
+ groups = {cracky = 3, ud_param2_colorable = 1}
})
minetest.register_node("unifiedbricks:clayblock", {
@@ -130,23 +124,17 @@ minetest.register_node("unifiedbricks:clayblock", {
paramtype2 = "color",
palette = "unifieddyes_palette.png",
is_ground_content = true,
- groups = {crumbly=3, not_in_creative_inventory=1},
+ groups = {crumbly=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
sounds = default.node_sound_dirt_defaults({
footstep = "",
}),
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, "unifiedbricks:clayblock")
- end,
drop = "default:clay"
})
minetest.override_item("default:clay", {
- on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
- unifieddyes.on_rightclick(pos, node, clicker,
- itemstack, pointed_thing, "unifiedbricks:clayblock")
- end
+ ud_replacement_node = "unifiedbricks:clayblock",
+ groups = {crumbly = 3, ud_param2_colorable = 1}
})
diff --git a/unifieddyes/init.lua b/unifieddyes/init.lua
index 0ed6cb1..d012050 100644
--- a/unifieddyes/init.lua
+++ b/unifieddyes/init.lua
@@ -73,6 +73,24 @@ local HUES2 = {
"Red-violet"
}
+local default_dyes = {
+ "black",
+ "blue",
+ "brown",
+ "cyan",
+ "dark_green",
+ "dark_grey",
+ "green",
+ "grey",
+ "magenta",
+ "orange",
+ "pink",
+ "red",
+ "violet",
+ "white",
+ "yellow"
+}
+
-- code borrowed from homedecor
function unifieddyes.select_node(pointed_thing)
@@ -271,17 +289,49 @@ function unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
end
end
-function unifieddyes.on_rightclick(pos, node, player, stack, pointed_thing, newnode, is_color_fdir)
- local name = player:get_player_name()
- if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
- minetest.record_protection_violation(pos,name)
- return stack
+function unifieddyes.on_use(itemstack, player, pointed_thing)
+
+ if not pointed_thing or pointed_thing.type == "nothing" then return end -- if "using" the dye on air
+
+ local pos = minetest.get_pointed_thing_position(pointed_thing)
+ local node = minetest.get_node(pos)
+ local nodedef = minetest.registered_nodes[node.name]
+
+ -- if the node has an on_punch defined, bail out and call that instead.
+ local onpunch = nodedef.on_punch(pos, node, player, pointed_thing)
+ if onpunch then
+ return onpunch
+ end
+
+ -- if the target is unknown, has no groups defined, or isn't UD-colorable, just bail out
+ if not (nodedef and nodedef.groups and nodedef.groups.ud_param2_colorable) then return end
+
+ local newnode = nodedef.ud_replacement_node
+ local is_color_fdir
+
+ if nodedef.paramtype2 == "color" then
+ is_color_fdir = false
+ elseif nodedef.paramtype2 == "colorfacedir"
+ then is_color_fdir = true
+ elseif nodedef.paramtype2 == "colorwallmounted"
+ then is_color_fdir = "wallmounted"
end
- local name = stack:get_name()
- local pos2 = unifieddyes.select_node(pointed_thing)
- local paletteidx, hue = unifieddyes.getpaletteidx(name, is_color_fdir)
- print(dump(paletteidx))
+ local playername = player:get_player_name()
+
+ if is_color_fdir == nil then -- target node doesn't support coloring at all.
+ minetest.chat_send_player(playername, "That node can't be colored.")
+ return
+ end
+
+ if minetest.is_protected(pos, playername) and not minetest.check_player_privs(playername, {protection_bypass=true}) then
+ minetest.record_protection_violation(pos, playername)
+ return
+ end
+
+ local stackname = itemstack:get_name()
+ local pos2 = unifieddyes.select_node(pointed_thing)
+ local paletteidx, hue = unifieddyes.getpaletteidx(stackname, is_color_fdir)
if paletteidx then
@@ -297,14 +347,19 @@ function unifieddyes.on_rightclick(pos, node, player, stack, pointed_thing, newn
end
end
- meta:set_string("dye", name)
- if not creative_mode and prevdye ~= name then
- stack:take_item()
+ meta:set_string("dye", stackname)
+
+ if prevdye == stackname then
+ local a,b = string.find(stackname, ":")
+ minetest.chat_send_player(playername, "That node is already "..string.sub(stackname, a + 1).."." )
+ return
+ elseif not creative_mode then
+ itemstack:take_item()
end
+
node.param2 = paletteidx
local oldpaletteidx, oldhuenum = unifieddyes.getpaletteidx(prevdye, is_color_fdir)
-
local oldnode = minetest.get_node(pos)
local oldhue = nil
@@ -343,6 +398,9 @@ function unifieddyes.on_rightclick(pos, node, player, stack, pointed_thing, newn
end
node.name = newnode
minetest.swap_node(pos, node)
+ if not creative_mode then
+ return itemstack
+ end
else -- this path is used when you're just painting an existing node, rather than replacing one.
newnode = oldnode -- note that here, newnode/oldnode are a full node, not just the name.
if is_color_fdir == "wallmounted" then
@@ -362,42 +420,36 @@ function unifieddyes.on_rightclick(pos, node, player, stack, pointed_thing, newn
newnode.param2 = paletteidx
end
minetest.swap_node(pos, newnode)
- end
- else -- here is where a node is just being placed, not something being colored
- if unifieddyes.is_buildable_to(player:get_player_name(), pos2) and
- minetest.registered_nodes[name] then
- local placeable_node = minetest.registered_nodes[stack:get_name()]
-
- local fdir = 0
-
- if is_color_fdir == "wallmounted" then
- local yaw = player:get_look_yaw()
- local dir = minetest.yaw_to_dir(yaw-1.5)
- fdir = minetest.dir_to_wallmounted(dir)
- elseif is_color_fdir then
- local yaw = player:get_look_yaw()
- local dir = minetest.yaw_to_dir(yaw-1.5)
- fdir = minetest.dir_to_facedir(dir)
- end
-
- minetest.set_node(pos2, { name = placeable_node.name, param2 = fdir })
if not creative_mode then
- stack:take_item()
+ return itemstack
end
- return stack
+ end
+ else
+ local a,b = string.find(stackname, ":")
+ if a then
+ minetest.chat_send_player(playername, "That node can't be colored "..string.sub(stackname, a + 1).."." )
end
end
end
+-- re-define default dyes slightly, to add on_use
+
+for _, color in ipairs(default_dyes) do
+ minetest.override_item("dye:"..color, {
+ on_use = unifieddyes.on_use
+ })
+end
+
-- Items/recipes needed to generate the few base colors that are not
-- provided by the standard dyes mod.
-- Lime
minetest.register_craftitem(":dye:lime", {
- description = S("Lime Dye"),
- inventory_image = "unifieddyes_lime.png",
- groups = { dye=1, excolor_lime=1, unicolor_lime=1, not_in_creative_inventory=1 }
+ description = S("Lime Dye"),
+ inventory_image = "unifieddyes_lime.png",
+ groups = { dye=1, excolor_lime=1, unicolor_lime=1, not_in_creative_inventory=1 },
+ on_use = unifieddyes.on_use
})
minetest.register_craft( {
@@ -412,9 +464,10 @@ minetest.register_craft( {
-- Aqua
minetest.register_craftitem(":dye:aqua", {
- description = S("Aqua Dye"),
- inventory_image = "unifieddyes_aqua.png",
- groups = { dye=1, excolor_aqua=1, unicolor_aqua=1, not_in_creative_inventory=1 }
+ description = S("Aqua Dye"),
+ inventory_image = "unifieddyes_aqua.png",
+ groups = { dye=1, excolor_aqua=1, unicolor_aqua=1, not_in_creative_inventory=1 },
+ on_use = unifieddyes.on_use
})
minetest.register_craft( {
@@ -429,9 +482,10 @@ minetest.register_craft( {
-- Sky blue
minetest.register_craftitem(":dye:skyblue", {
- description = S("Sky-blue Dye"),
- inventory_image = "unifieddyes_skyblue.png",
- groups = { dye=1, excolor_sky_blue=1, unicolor_sky_blue=1, not_in_creative_inventory=1 }
+ description = S("Sky-blue Dye"),
+ inventory_image = "unifieddyes_skyblue.png",
+ groups = { dye=1, excolor_sky_blue=1, unicolor_sky_blue=1, not_in_creative_inventory=1 },
+ on_use = unifieddyes.on_use
})
minetest.register_craft( {
@@ -446,9 +500,10 @@ minetest.register_craft( {
-- Red-violet
minetest.register_craftitem(":dye:redviolet", {
- description = S("Red-violet Dye"),
- inventory_image = "unifieddyes_redviolet.png",
- groups = { dye=1, excolor_red_violet=1, unicolor_red_violet=1, not_in_creative_inventory=1 }
+ description = S("Red-violet Dye"),
+ inventory_image = "unifieddyes_redviolet.png",
+ groups = { dye=1, excolor_red_violet=1, unicolor_red_violet=1, not_in_creative_inventory=1 },
+ on_use = unifieddyes.on_use
})
minetest.register_craft( {
@@ -464,9 +519,10 @@ minetest.register_craft( {
-- Light grey
minetest.register_craftitem(":dye:light_grey", {
- description = S("Light Grey Dye"),
- inventory_image = "unifieddyes_lightgrey.png",
- groups = { dye=1, excolor_lightgrey=1, unicolor_light_grey=1, not_in_creative_inventory=1 }
+ description = S("Light Grey Dye"),
+ inventory_image = "unifieddyes_lightgrey.png",
+ groups = { dye=1, excolor_lightgrey=1, unicolor_light_grey=1, not_in_creative_inventory=1 },
+ on_use = unifieddyes.on_use
})
minetest.register_craft( {
@@ -643,40 +699,46 @@ for i = 1, 12 do
minetest.register_craftitem("unifieddyes:dark_" .. hue .. "_s50", {
description = S("Dark " .. hue2 .. " Dye (low saturation)"),
inventory_image = "unifieddyes_dark_" .. hue .. "_s50.png",
- groups = { dye=1, ["unicolor_dark_"..hue.."_s50"]=1, not_in_creative_inventory=1 }
+ groups = { dye=1, ["unicolor_dark_"..hue.."_s50"]=1, not_in_creative_inventory=1 },
+ on_use = unifieddyes.on_use
})
if hue ~= "green" then
minetest.register_craftitem("unifieddyes:dark_" .. hue, {
description = S("Dark " .. hue2 .. " Dye"),
inventory_image = "unifieddyes_dark_" .. hue .. ".png",
- groups = { dye=1, ["unicolor_dark_"..hue]=1, not_in_creative_inventory=1 }
+ groups = { dye=1, ["unicolor_dark_"..hue]=1, not_in_creative_inventory=1 },
+ on_use = unifieddyes.on_use
})
end
minetest.register_craftitem("unifieddyes:medium_" .. hue .. "_s50", {
description = S("Medium " .. hue2 .. " Dye (low saturation)"),
inventory_image = "unifieddyes_medium_" .. hue .. "_s50.png",
- groups = { dye=1, ["unicolor_medium_"..hue.."_s50"]=1, not_in_creative_inventory=1 }
+ groups = { dye=1, ["unicolor_medium_"..hue.."_s50"]=1, not_in_creative_inventory=1 },
+ on_use = unifieddyes.on_use
})
minetest.register_craftitem("unifieddyes:medium_" .. hue, {
description = S("Medium " .. hue2 .. " Dye"),
inventory_image = "unifieddyes_medium_" .. hue .. ".png",
- groups = { dye=1, ["unicolor_medium_"..hue]=1, not_in_creative_inventory=1 }
+ groups = { dye=1, ["unicolor_medium_"..hue]=1, not_in_creative_inventory=1 },
+ on_use = unifieddyes.on_use
})
minetest.register_craftitem("unifieddyes:" .. hue .. "_s50", {
description = S(hue2 .. " Dye (low saturation)"),
inventory_image = "unifieddyes_" .. hue .. "_s50.png",
- groups = { dye=1, ["unicolor_"..hue.."_s50"]=1, not_in_creative_inventory=1 }
+ groups = { dye=1, ["unicolor_"..hue.."_s50"]=1, not_in_creative_inventory=1 },
+ on_use = unifieddyes.on_use
})
if hue ~= "red" then
minetest.register_craftitem("unifieddyes:light_" .. hue, {
description = S("Light " .. hue2 .. " Dye"),
inventory_image = "unifieddyes_light_" .. hue .. ".png",
- groups = { dye=1, ["unicolor_light_"..hue]=1, not_in_creative_inventory=1 }
+ groups = { dye=1, ["unicolor_light_"..hue]=1, not_in_creative_inventory=1 },
+ on_use = unifieddyes.on_use
})
end
minetest.register_alias("unifieddyes:"..hue, "dye:"..hue)