diff --git a/homedecor/furniture.lua b/homedecor/furniture.lua index d3f6d756..f51cfa48 100644 --- a/homedecor/furniture.lua +++ b/homedecor/furniture.lua @@ -110,15 +110,18 @@ for i in ipairs(chaircolors) do end local repl = { off="low", low="med", med="hi", hi="max", max="off", } +local lamp_colors = { "", "blue", "green", "pink", "red", "violet" } -local function reg_lamp(suffix, nxt, desc, tilesuffix, light) - minetest.register_node("homedecor:table_lamp_"..suffix, { +local function reg_lamp(suffix, nxt, desc, tilesuffix, light, color) + local lampcolor = "_"..color + if color == "" then lampcolor = "" end + minetest.register_node("homedecor:table_lamp"..lampcolor.."_"..suffix, { description = S(desc), drawtype = "nodebox", tiles = { "forniture_table_lamp_s"..tilesuffix..".png", "forniture_table_lamp_s"..tilesuffix..".png", - "forniture_table_lamp_l"..tilesuffix..".png", + "forniture_table_lamp"..lampcolor.."_l"..tilesuffix..".png", }, paramtype = "light", node_box = { @@ -144,21 +147,25 @@ local function reg_lamp(suffix, nxt, desc, tilesuffix, light) groups = {cracky=2,oddly_breakable_by_hand=1, not_in_creative_inventory=((desc == nil) and 1) or nil, }, - drop = "homedecor:table_lamp_off", + drop = "homedecor:table_lamp"..lampcolor.."_off", on_punch = function(pos, node, puncher) - node.name = "homedecor:table_lamp_"..repl[suffix] + node.name = "homedecor:table_lamp"..lampcolor.."_"..repl[suffix] minetest.set_node(pos, node) nodeupdate(pos) end, }) - minetest.register_alias("3dforniture:table_lamp_"..suffix, "homedecor:table_lamp_"..suffix) + if lampcolor == "" then + minetest.register_alias("3dforniture:table_lamp_"..suffix, "homedecor:table_lamp_"..suffix) + end end -reg_lamp("off", "low", "Table Lamp", "", nil ) -reg_lamp("low", "med", nil, "l", 3 ) -reg_lamp("med", "hi" , nil, "m", 7 ) -reg_lamp("hi" , "max", nil, "h", 11 ) -reg_lamp("max", "off", nil, "x", 14 ) +for _, color in ipairs(lamp_colors) do + reg_lamp("off", "low", "Table Lamp", "", nil, color ) + reg_lamp("low", "med", nil, "l", 3, color ) + reg_lamp("med", "hi" , nil, "m", 7, color ) + reg_lamp("hi" , "max", nil, "h", 11, color ) + reg_lamp("max", "off", nil, "x", 14, color ) +end -- Aliases for 3dforniture mod. minetest.register_alias("3dforniture:table", "homedecor:table") diff --git a/homedecor/textures/forniture_table_lamp_blue_l.png b/homedecor/textures/forniture_table_lamp_blue_l.png new file mode 100644 index 00000000..e656f742 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_blue_l.png differ diff --git a/homedecor/textures/forniture_table_lamp_blue_lh.png b/homedecor/textures/forniture_table_lamp_blue_lh.png new file mode 100644 index 00000000..2a022874 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_blue_lh.png differ diff --git a/homedecor/textures/forniture_table_lamp_blue_ll.png b/homedecor/textures/forniture_table_lamp_blue_ll.png new file mode 100644 index 00000000..2c7f9396 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_blue_ll.png differ diff --git a/homedecor/textures/forniture_table_lamp_blue_lm.png b/homedecor/textures/forniture_table_lamp_blue_lm.png new file mode 100644 index 00000000..89693056 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_blue_lm.png differ diff --git a/homedecor/textures/forniture_table_lamp_blue_lx.png b/homedecor/textures/forniture_table_lamp_blue_lx.png new file mode 100644 index 00000000..4a9f9a9b Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_blue_lx.png differ diff --git a/homedecor/textures/forniture_table_lamp_green_l.png b/homedecor/textures/forniture_table_lamp_green_l.png new file mode 100644 index 00000000..2fab23c2 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_green_l.png differ diff --git a/homedecor/textures/forniture_table_lamp_green_lh.png b/homedecor/textures/forniture_table_lamp_green_lh.png new file mode 100644 index 00000000..ab6cbc92 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_green_lh.png differ diff --git a/homedecor/textures/forniture_table_lamp_green_ll.png b/homedecor/textures/forniture_table_lamp_green_ll.png new file mode 100644 index 00000000..5acfaeab Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_green_ll.png differ diff --git a/homedecor/textures/forniture_table_lamp_green_lm.png b/homedecor/textures/forniture_table_lamp_green_lm.png new file mode 100644 index 00000000..3bb3ba5c Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_green_lm.png differ diff --git a/homedecor/textures/forniture_table_lamp_green_lx.png b/homedecor/textures/forniture_table_lamp_green_lx.png new file mode 100644 index 00000000..d23a2ce4 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_green_lx.png differ diff --git a/homedecor/textures/forniture_table_lamp_pink_l.png b/homedecor/textures/forniture_table_lamp_pink_l.png new file mode 100644 index 00000000..3c6f17e7 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_pink_l.png differ diff --git a/homedecor/textures/forniture_table_lamp_pink_lh.png b/homedecor/textures/forniture_table_lamp_pink_lh.png new file mode 100644 index 00000000..0b63b294 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_pink_lh.png differ diff --git a/homedecor/textures/forniture_table_lamp_pink_ll.png b/homedecor/textures/forniture_table_lamp_pink_ll.png new file mode 100644 index 00000000..2086fdb3 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_pink_ll.png differ diff --git a/homedecor/textures/forniture_table_lamp_pink_lm.png b/homedecor/textures/forniture_table_lamp_pink_lm.png new file mode 100644 index 00000000..ecb6dd47 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_pink_lm.png differ diff --git a/homedecor/textures/forniture_table_lamp_pink_lx.png b/homedecor/textures/forniture_table_lamp_pink_lx.png new file mode 100644 index 00000000..508167da Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_pink_lx.png differ diff --git a/homedecor/textures/forniture_table_lamp_red_l.png b/homedecor/textures/forniture_table_lamp_red_l.png new file mode 100644 index 00000000..31a2108a Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_red_l.png differ diff --git a/homedecor/textures/forniture_table_lamp_red_lh.png b/homedecor/textures/forniture_table_lamp_red_lh.png new file mode 100644 index 00000000..72ba1251 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_red_lh.png differ diff --git a/homedecor/textures/forniture_table_lamp_red_ll.png b/homedecor/textures/forniture_table_lamp_red_ll.png new file mode 100644 index 00000000..2f7fc87c Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_red_ll.png differ diff --git a/homedecor/textures/forniture_table_lamp_red_lm.png b/homedecor/textures/forniture_table_lamp_red_lm.png new file mode 100644 index 00000000..9c846911 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_red_lm.png differ diff --git a/homedecor/textures/forniture_table_lamp_red_lx.png b/homedecor/textures/forniture_table_lamp_red_lx.png new file mode 100644 index 00000000..dda419b7 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_red_lx.png differ diff --git a/homedecor/textures/forniture_table_lamp_violet_l.png b/homedecor/textures/forniture_table_lamp_violet_l.png new file mode 100644 index 00000000..f2ebbd2d Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_violet_l.png differ diff --git a/homedecor/textures/forniture_table_lamp_violet_lh.png b/homedecor/textures/forniture_table_lamp_violet_lh.png new file mode 100644 index 00000000..2b57d96f Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_violet_lh.png differ diff --git a/homedecor/textures/forniture_table_lamp_violet_ll.png b/homedecor/textures/forniture_table_lamp_violet_ll.png new file mode 100644 index 00000000..31cce4d7 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_violet_ll.png differ diff --git a/homedecor/textures/forniture_table_lamp_violet_lm.png b/homedecor/textures/forniture_table_lamp_violet_lm.png new file mode 100644 index 00000000..8a4e160c Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_violet_lm.png differ diff --git a/homedecor/textures/forniture_table_lamp_violet_lx.png b/homedecor/textures/forniture_table_lamp_violet_lx.png new file mode 100644 index 00000000..2b931fa8 Binary files /dev/null and b/homedecor/textures/forniture_table_lamp_violet_lx.png differ