convert glowlights, table lamps, and standing lamps
to use param2-base coloring. Reworked crafting as needed to account for the node names.
| @@ -1211,7 +1211,7 @@ minetest.register_craft({ | ||||
| minetest.register_craft({ | ||||
| 	output = "homedecor:refrigerator_steel", | ||||
| 	recipe = { | ||||
| 		{"default:steel_ingot", "homedecor:glowlight_small_cube_white", "default:steel_ingot", }, | ||||
| 		{"default:steel_ingot", "homedecor:glowlight_small_cube", "default:steel_ingot", }, | ||||
| 		{"default:steel_ingot", "default:copperblock", "default:steel_ingot", }, | ||||
| 		{"default:steel_ingot", "default:clay", "default:steel_ingot", }, | ||||
| 	} | ||||
| @@ -1387,73 +1387,10 @@ minetest.register_craft( { | ||||
|         }, | ||||
| }) | ||||
|  | ||||
| -- yellow glowlights | ||||
| -- glowlights | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = "homedecor:glowlight_half_yellow 6", | ||||
| 	recipe = { | ||||
| 		{"default:glass", "homedecor:power_crystal", "default:glass", }, | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = "homedecor:glowlight_half_yellow 6", | ||||
| 	recipe = { | ||||
| 		{"moreblocks:super_glow_glass", "moreblocks:glow_glass", "moreblocks:super_glow_glass", }, | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
|         output = "homedecor:glowlight_quarter_yellow 6", | ||||
|         recipe = { | ||||
| 		{"homedecor:glowlight_half_yellow", "homedecor:glowlight_half_yellow", "homedecor:glowlight_half_yellow", }, | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = "homedecor:glowlight_small_cube_yellow 16", | ||||
| 	recipe = { | ||||
| 		{"default:glass" }, | ||||
| 		{"homedecor:power_crystal" }, | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
|         output = "homedecor:glowlight_small_cube_yellow 16", | ||||
|         recipe = { | ||||
| 		{"moreblocks:glow_glass" }, | ||||
| 		{"moreblocks:super_glow_glass" }, | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
|         output = "homedecor:glowlight_small_cube_yellow 4", | ||||
|         recipe = { | ||||
| 		{"homedecor:glowlight_half_yellow" }, | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
|         output = "homedecor:glowlight_half_yellow", | ||||
|         recipe = { | ||||
| 		{"homedecor:glowlight_small_cube_yellow","homedecor:glowlight_small_cube_yellow"}, | ||||
| 		{"homedecor:glowlight_small_cube_yellow","homedecor:glowlight_small_cube_yellow"} | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 		output = "homedecor:glowlight_half_yellow", | ||||
| 		type = "shapeless", | ||||
| 		recipe = { | ||||
| 		"homedecor:glowlight_quarter_yellow", | ||||
| 		"homedecor:glowlight_quarter_yellow" | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| -- white | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = "homedecor:glowlight_half_white 6", | ||||
| 	output = "homedecor:glowlight_half 6", | ||||
| 	recipe = { | ||||
| 		{ "dye:white", "dye:white", "dye:white" }, | ||||
| 		{ "default:glass", "homedecor:power_crystal", "default:glass", }, | ||||
| @@ -1461,7 +1398,7 @@ minetest.register_craft({ | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
|         output = "homedecor:glowlight_half_white 6", | ||||
|         output = "homedecor:glowlight_half 6", | ||||
|         recipe = { | ||||
| 		{ "dye:white", "dye:white", "dye:white" }, | ||||
| 		{"moreblocks:super_glow_glass", "moreblocks:glow_glass", "moreblocks:super_glow_glass", }, | ||||
| @@ -1469,24 +1406,14 @@ minetest.register_craft({ | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	type = "shapeless", | ||||
|         output = "homedecor:glowlight_half_white 2", | ||||
|         output = "homedecor:glowlight_quarter 6", | ||||
|         recipe = { | ||||
| 		"dye:white", | ||||
| 		"homedecor:glowlight_half_yellow", | ||||
| 		"homedecor:glowlight_half_yellow", | ||||
| 		{"homedecor:glowlight_half", "homedecor:glowlight_half", "homedecor:glowlight_half", }, | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
|         output = "homedecor:glowlight_quarter_white 6", | ||||
|         recipe = { | ||||
| 		{"homedecor:glowlight_half_white", "homedecor:glowlight_half_white", "homedecor:glowlight_half_white", }, | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = "homedecor:glowlight_small_cube_white 8", | ||||
| 	output = "homedecor:glowlight_small_cube 8", | ||||
| 	recipe = { | ||||
| 		{ "dye:white" }, | ||||
| 		{ "default:glass" }, | ||||
| @@ -1495,7 +1422,7 @@ minetest.register_craft({ | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
|         output = "homedecor:glowlight_small_cube_white 8", | ||||
|         output = "homedecor:glowlight_small_cube 8", | ||||
|         recipe = { | ||||
| 		{"dye:white" }, | ||||
| 		{"moreblocks:super_glow_glass" }, | ||||
| @@ -1503,26 +1430,26 @@ minetest.register_craft({ | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
|         output = "homedecor:glowlight_small_cube_white 4", | ||||
|         output = "homedecor:glowlight_small_cube 4", | ||||
|         recipe = { | ||||
| 		{"homedecor:glowlight_half_white" }, | ||||
| 		{"homedecor:glowlight_half" }, | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
|         output = "homedecor:glowlight_half_white", | ||||
|         output = "homedecor:glowlight_half", | ||||
|         recipe = { | ||||
| 		{"homedecor:glowlight_small_cube_white","homedecor:glowlight_small_cube_white"}, | ||||
| 		{"homedecor:glowlight_small_cube_white","homedecor:glowlight_small_cube_white"} | ||||
| 		{"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"}, | ||||
| 		{"homedecor:glowlight_small_cube","homedecor:glowlight_small_cube"} | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 		output = "homedecor:glowlight_half_white", | ||||
| 		output = "homedecor:glowlight_half", | ||||
| 		type = "shapeless", | ||||
| 		recipe = { | ||||
| 		"homedecor:glowlight_quarter_white", | ||||
| 		"homedecor:glowlight_quarter_white" | ||||
| 		"homedecor:glowlight_quarter", | ||||
| 		"homedecor:glowlight_quarter" | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| @@ -2210,7 +2137,7 @@ minetest.register_craft({ | ||||
| minetest.register_craft({ | ||||
|         output = "homedecor:fishtank", | ||||
|         recipe = { | ||||
| 			{ "homedecor:plastic_sheeting", "homedecor:glowlight_small_cube_white", "homedecor:plastic_sheeting" }, | ||||
| 			{ "homedecor:plastic_sheeting", "homedecor:glowlight_small_cube", "homedecor:plastic_sheeting" }, | ||||
| 			{ "default:glass", "bucket:bucket_water", "default:glass" }, | ||||
| 			{ "default:glass", "building_blocks:gravel_spread", "default:glass" }, | ||||
|         }, | ||||
| @@ -2346,7 +2273,7 @@ minetest.register_craft({ | ||||
|     recipe = { | ||||
| 		{ "homedecor:motor" }, | ||||
| 		{ "homedecor:fan_blades" }, | ||||
| 		{ "homedecor:glowlight_small_cube_white" } | ||||
| 		{ "homedecor:glowlight_small_cube" } | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| @@ -2355,7 +2282,7 @@ minetest.register_craft({ | ||||
|     recipe = { | ||||
| 		{ "technic:motor" }, | ||||
| 		{ "homedecor:fan_blades" }, | ||||
| 		{ "homedecor:glowlight_small_cube_white" } | ||||
| 		{ "homedecor:glowlight_small_cube" } | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| @@ -3137,7 +3064,7 @@ for _, color in ipairs(dlamp_colors) do | ||||
| 	minetest.register_craft({ | ||||
| 		output = "homedecor:desk_lamp_"..color, | ||||
| 		recipe = { | ||||
| 			{ "", "homedecor:steel_strip", "homedecor:glowlight_small_cube_white" }, | ||||
| 			{ "", "homedecor:steel_strip", "homedecor:glowlight_small_cube" }, | ||||
| 			{ "", "homedecor:copper_wire", "" }, | ||||
| 			{ "homedecor:plastic_sheeting", "dye:"..color, "homedecor:plastic_sheeting" }, | ||||
| 		}, | ||||
| @@ -3221,7 +3148,7 @@ minetest.register_craft({ | ||||
| 	recipe = { | ||||
| 		{ "", "technic:brass_ingot", ""}, | ||||
| 		{ "", "homedecor:chainlink_brass", ""}, | ||||
| 		{ "default:glass", "homedecor:glowlight_small_cube_white", "default:glass"} | ||||
| 		{ "default:glass", "homedecor:glowlight_small", "default:glass"} | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| @@ -3229,7 +3156,7 @@ minetest.register_craft({ | ||||
| 	output = "homedecor:ceiling_lamp", | ||||
| 	recipe = { | ||||
| 		{ "", "chains:chain_top_brass", ""}, | ||||
| 		{ "default:glass", "homedecor:glowlight_small_cube_white", "default:glass"} | ||||
| 		{ "default:glass", "homedecor:glowlight_small", "default:glass"} | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
|   | ||||
| @@ -136,67 +136,28 @@ minetest.register_craft({ | ||||
| 	burntime = 10, | ||||
| }) | ||||
|  | ||||
| local lamp_colors = { "blue", "green", "pink", "red", "violet" } | ||||
| minetest.register_craft({ | ||||
| 	output = "homedecor:table_lamp_off", | ||||
| 	recipe = { | ||||
| 		{ "wool:white", "default:torch", "wool:white"}, | ||||
| 		{ "", "group:stick", ""}, | ||||
| 		{ "", "stairs:slab_wood", "" }, | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| for _, color in ipairs(lamp_colors) do | ||||
|  | ||||
| 	minetest.register_craft({ | ||||
| 		output = "homedecor:table_lamp_"..color.."_off", | ||||
| 		recipe = { | ||||
| 			{"wool:"..color,"default:torch" ,"wool:"..color}, | ||||
| 			{"","group:stick",""}, | ||||
| 			{"","stairs:slab_wood",""}, | ||||
| 		}, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft({ | ||||
| 		output = "homedecor:table_lamp_"..color.."_off", | ||||
| 		recipe = { | ||||
| 			{"wool:"..color,"default:torch" ,"wool:"..color}, | ||||
| 			{"","group:stick",""}, | ||||
| 			{"","moreblocks:slab_wood",""}, | ||||
| 		}, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft({ | ||||
| 		type = "shapeless", | ||||
| 		output = "homedecor:table_lamp_"..color.."_off", | ||||
| 		recipe = { | ||||
| 			"dye:"..color, | ||||
| 			"homedecor:table_lamp_off", | ||||
| 		}, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft({ | ||||
| 		type = "fuel", | ||||
| 		recipe = "homedecor:table_lamp_"..color.."_off", | ||||
| 		burntime = 10, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft({ | ||||
| 		output = "homedecor:standing_lamp_"..color.."_off", | ||||
| 		recipe = { | ||||
| 			{"homedecor:table_lamp_"..color.."_off"}, | ||||
| 			{"group:stick"}, | ||||
| 			{"group:stick"}, | ||||
| 		}, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft({ | ||||
| 		type = "shapeless", | ||||
| 		output = "homedecor:standing_lamp_"..color.."_off", | ||||
| 		recipe = { | ||||
| 			"homedecor:standing_lamp_off", | ||||
| 			"dye:"..color | ||||
| 		}, | ||||
| 	}) | ||||
|  | ||||
| end | ||||
| minetest.register_craft({ | ||||
| 	output = "homedecor:standing_lamp_off", | ||||
| 	recipe = { | ||||
| 		{ "homedecor:table_lamp_off"}, | ||||
| 		{ "group:stick"}, | ||||
| 		{ "group:stick"}, | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = "homedecor:toilet", | ||||
| 	recipe = { | ||||
| 		{"","","bucket:bucket_water"}, | ||||
| 		{ "","","bucket:bucket_water"}, | ||||
| 		{ "group:marble","group:marble", "group:marble" }, | ||||
| 		{ "", "bucket:bucket_empty", "" }, | ||||
| 	}, | ||||
|   | ||||
| @@ -8,75 +8,90 @@ local function N_(x) return x end | ||||
|  | ||||
| local colors = { N_("yellow"), N_("white") } | ||||
|  | ||||
| for i in ipairs(colors) do | ||||
| local glowlight_nodebox = { | ||||
| 	half = homedecor.nodebox.slab_y(1/2), | ||||
| 	quarter = homedecor.nodebox.slab_y(1/4), | ||||
| 	small_cube = { | ||||
| 			type = "fixed", | ||||
| 			fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } | ||||
| 	}, | ||||
| } | ||||
|  | ||||
| 	local color = colors[i] | ||||
| 	local glowlight_nodebox = { | ||||
| 		half = homedecor.nodebox.slab_y(1/2), | ||||
| 		quarter = homedecor.nodebox.slab_y(1/4), | ||||
| 		small_cube = { | ||||
| 				type = "fixed", | ||||
| 				fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } | ||||
| 		}, | ||||
| 	} | ||||
| homedecor.register("glowlight_half", { | ||||
| 	description = S("Thick Glowlight"), | ||||
| 	tiles = { | ||||
| 		"homedecor_glowlight_top.png", | ||||
| 		"homedecor_glowlight_bottom.png", | ||||
| 		"homedecor_glowlight_thick_sides.png", | ||||
| 		"homedecor_glowlight_thick_sides.png", | ||||
| 		"homedecor_glowlight_thick_sides.png", | ||||
| 		"homedecor_glowlight_thick_sides.png" | ||||
| 	}, | ||||
| 	paramtype2 = "colorwallmounted", | ||||
| 	palette = "unifieddyes_palette_colorwallmounted.png", | ||||
| 	selection_box = glowlight_nodebox.half, | ||||
| 	node_box = glowlight_nodebox.half, | ||||
| 	groups = { snappy = 3 }, | ||||
| 	light_source = default.LIGHT_MAX, | ||||
| 	sounds = default.node_sound_glass_defaults(), | ||||
| 	on_place = minetest.rotate_node, | ||||
| 	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, "glowlight_half", "wallmounted") | ||||
| 	end, | ||||
| }) | ||||
|  | ||||
| 	homedecor.register("glowlight_half_"..color, { | ||||
| 		description = S("Thick Glowlight (@1)", S(color)), | ||||
| 		tiles = { | ||||
| 			"homedecor_glowlight_"..color.."_top.png", | ||||
| 			"homedecor_glowlight_"..color.."_bottom.png", | ||||
| 			"homedecor_glowlight_thick_"..color.."_sides.png", | ||||
| 			"homedecor_glowlight_thick_"..color.."_sides.png", | ||||
| 			"homedecor_glowlight_thick_"..color.."_sides.png", | ||||
| 			"homedecor_glowlight_thick_"..color.."_sides.png" | ||||
| 		}, | ||||
| 		selection_box = glowlight_nodebox.half, | ||||
| 		node_box = glowlight_nodebox.half, | ||||
| 		groups = { snappy = 3 }, | ||||
| 		light_source = default.LIGHT_MAX, | ||||
| 		sounds = default.node_sound_glass_defaults(), | ||||
| 		on_place = minetest.rotate_node | ||||
| 	}) | ||||
| homedecor.register("glowlight_quarter", { | ||||
| 	description = S("Thin Glowlight"), | ||||
| 	tiles = { | ||||
| 		"homedecor_glowlight_top.png", | ||||
| 		"homedecor_glowlight_bottom.png", | ||||
| 		"homedecor_glowlight_thin_sides.png", | ||||
| 		"homedecor_glowlight_thin_sides.png", | ||||
| 		"homedecor_glowlight_thin_sides.png", | ||||
| 		"homedecor_glowlight_thin_sides.png" | ||||
| 	}, | ||||
| 	paramtype2 = "colorwallmounted", | ||||
| 	palette = "unifieddyes_palette_colorwallmounted.png", | ||||
| 	selection_box = glowlight_nodebox.quarter, | ||||
| 	node_box = glowlight_nodebox.quarter, | ||||
| 	groups = { snappy = 3 }, | ||||
| 	light_source = default.LIGHT_MAX-1, | ||||
| 	sounds = default.node_sound_glass_defaults(), | ||||
| 	on_place = minetest.rotate_node, | ||||
| 	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, "glowlight_half", "wallmounted") | ||||
| 	end, | ||||
| }) | ||||
|  | ||||
| 	homedecor.register("glowlight_quarter_"..color, { | ||||
| 		description = S("Thin Glowlight (@1)", S(color)), | ||||
| 		tiles = { | ||||
| 			"homedecor_glowlight_"..color.."_top.png", | ||||
| 			"homedecor_glowlight_"..color.."_bottom.png", | ||||
| 			"homedecor_glowlight_thin_"..color.."_sides.png", | ||||
| 			"homedecor_glowlight_thin_"..color.."_sides.png", | ||||
| 			"homedecor_glowlight_thin_"..color.."_sides.png", | ||||
| 			"homedecor_glowlight_thin_"..color.."_sides.png" | ||||
| 		}, | ||||
| 		selection_box = glowlight_nodebox.quarter, | ||||
| 		node_box = glowlight_nodebox.quarter, | ||||
| 		groups = { snappy = 3 }, | ||||
| 		light_source = default.LIGHT_MAX-1, | ||||
| 		sounds = default.node_sound_glass_defaults(), | ||||
| 		on_place = minetest.rotate_node | ||||
| 	}) | ||||
| homedecor.register("glowlight_small_cube", { | ||||
| 	description = S("Small Glowlight Cube"), | ||||
| 	tiles = { | ||||
| 		"homedecor_glowlight_cube_tb.png", | ||||
| 		"homedecor_glowlight_cube_tb.png", | ||||
| 		"homedecor_glowlight_cube_sides.png", | ||||
| 		"homedecor_glowlight_cube_sides.png", | ||||
| 		"homedecor_glowlight_cube_sides.png", | ||||
| 		"homedecor_glowlight_cube_sides.png" | ||||
| 	}, | ||||
| 	paramtype2 = "colorwallmounted", | ||||
| 	palette = "unifieddyes_palette_colorwallmounted.png", | ||||
| 	selection_box = glowlight_nodebox.small_cube, | ||||
| 	node_box = glowlight_nodebox.small_cube, | ||||
| 	groups = { snappy = 3 }, | ||||
| 	light_source = default.LIGHT_MAX-1, | ||||
| 	sounds = default.node_sound_glass_defaults(), | ||||
| 	on_place = minetest.rotate_node, | ||||
| 	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, "glowlight_small_cube", "wallmounted") | ||||
| 	end, | ||||
| }) | ||||
|  | ||||
| 	-- Glowlight "cubes" | ||||
|  | ||||
| 	homedecor.register("glowlight_small_cube_"..color, { | ||||
| 		description = S("Small Glowlight Cube (@1)", S(color)), | ||||
| 		tiles = { | ||||
| 			"homedecor_glowlight_cube_"..color.."_tb.png", | ||||
| 			"homedecor_glowlight_cube_"..color.."_tb.png", | ||||
| 			"homedecor_glowlight_cube_"..color.."_sides.png", | ||||
| 			"homedecor_glowlight_cube_"..color.."_sides.png", | ||||
| 			"homedecor_glowlight_cube_"..color.."_sides.png", | ||||
| 			"homedecor_glowlight_cube_"..color.."_sides.png" | ||||
| 		}, | ||||
| 		selection_box = glowlight_nodebox.small_cube, | ||||
| 		node_box = glowlight_nodebox.small_cube, | ||||
| 		groups = { snappy = 3 }, | ||||
| 		light_source = default.LIGHT_MAX-1, | ||||
| 		sounds = default.node_sound_glass_defaults(), | ||||
| 		on_place = minetest.rotate_node | ||||
| 	}) | ||||
|  | ||||
| end | ||||
|  | ||||
| homedecor.register("plasma_lamp", { | ||||
| 	description = S("Plasma Lamp"), | ||||
| @@ -344,15 +359,21 @@ homedecor.register("lattice_lantern_small", { | ||||
| 	on_place = minetest.rotate_node | ||||
| }) | ||||
|  | ||||
| local repl = { off="low", low="med", med="hi", hi="max", max="off", } | ||||
| local repl = { | ||||
| 	["off"] ="low", | ||||
| 	["low"] ="med", | ||||
| 	["med"] ="hi", | ||||
| 	["hi"]  ="max", | ||||
| 	["max"] ="off", | ||||
| } | ||||
|  | ||||
| local lamp_colors = { | ||||
| 	{ N_("white"),  "#ffffffe0:175" }, | ||||
| 	{ N_("blue"),   "#2626c6e0:200" }, | ||||
| 	{ N_("green"),  "#27a927e0:200" }, | ||||
| 	{ N_("pink"),   "#ff8fb7e0:200" }, | ||||
| 	{ N_("red"),    "#ad2323e0:200" }, | ||||
| 	{ N_("violet"), "#7f29d7e0:200" }, | ||||
| 	"white", | ||||
| 	"blue", | ||||
| 	"green", | ||||
| 	"pink", | ||||
| 	"red", | ||||
| 	"violet", | ||||
| } | ||||
|  | ||||
| local tlamp_cbox = { | ||||
| @@ -373,22 +394,23 @@ local brightness_tab = { | ||||
| 	0xffffffff, | ||||
| } | ||||
|  | ||||
| local function reg_lamp(suffix, nxt, tilesuffix, light, color, brightness) | ||||
| 	local lampcolor = "_"..color[1] | ||||
| 	local colordesc = S(color[1]) | ||||
| 	local woolcolor = color[1] | ||||
| 	local invcolor = color[2] | ||||
| local function reg_lamp(suffix, nxt, light, brightness) | ||||
|  | ||||
| 	homedecor.register("table_lamp"..lampcolor.."_"..suffix, { | ||||
| 		description = S("Table Lamp (@1)", colordesc), | ||||
| 	local wool_brighten = (light or 0) * 15 | ||||
|  | ||||
| 	homedecor.register("table_lamp_"..suffix, { | ||||
| 		description = S("Table Lamp"), | ||||
| 		mesh = "homedecor_table_lamp.obj", | ||||
| 		tiles = { | ||||
| 			{ name = "wool_"..woolcolor..".png", color = brightness_tab[brightness] }, | ||||
| 			"wool_grey.png^[colorize:#ffffff:"..wool_brighten, | ||||
| 			{ name = "homedecor_table_standing_lamp_lightbulb.png", color = brightness_tab[brightness] }, | ||||
| 			"homedecor_generic_wood_red.png", | ||||
| 			{ name = "homedecor_generic_wood_red.png", color = 0xffffffff }, | ||||
| 			{ name = "homedecor_generic_metal.png", color = homedecor.color_black }, | ||||
| 		}, | ||||
| 		inventory_image = "homedecor_table_lamp_foot_inv.png^(homedecor_table_lamp_top_inv.png^[colorize:"..invcolor..")", | ||||
| 		inventory_image = "homedecor_table_lamp_foot_inv.png^homedecor_table_lamp_top_inv.png", | ||||
| 		paramtype = "light", | ||||
| 		paramtype2 = "color", | ||||
| 		palette = "unifieddyes_palette.png", | ||||
| 		walkable = false, | ||||
| 		light_source = light, | ||||
| 		selection_box = tlamp_cbox, | ||||
| @@ -396,25 +418,33 @@ local function reg_lamp(suffix, nxt, tilesuffix, light, color, brightness) | ||||
| 		groups = {cracky=2,oddly_breakable_by_hand=1, | ||||
| 			not_in_creative_inventory=((light ~= nil) and 1) or nil, | ||||
| 		}, | ||||
| 		drop = "homedecor:table_lamp"..lampcolor.."_off", | ||||
| 		drop = "homedecor:table_lamp_off", | ||||
| 		on_punch = function(pos, node, puncher) | ||||
| 			node.name = "homedecor:table_lamp"..lampcolor.."_"..repl[suffix] | ||||
| 			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, | ||||
| 	}) | ||||
|  | ||||
| 	-- standing lamps | ||||
|  | ||||
| 	homedecor.register("standing_lamp"..lampcolor.."_"..suffix, { | ||||
| 		description = S("Standing Lamp (@1)", colordesc), | ||||
| 	homedecor.register("standing_lamp_"..suffix, { | ||||
| 		description = S("Standing Lamp"), | ||||
| 		mesh = "homedecor_standing_lamp.obj", | ||||
| 		tiles = { | ||||
| 			{ name = "wool_"..woolcolor..".png", color = brightness_tab[brightness] }, | ||||
| 			"wool_grey.png^[colorize:#ffffff:"..wool_brighten, | ||||
| 			{ name = "homedecor_table_standing_lamp_lightbulb.png", color = brightness_tab[brightness] }, | ||||
| 			"homedecor_generic_wood_red.png", | ||||
| 			{ name ="homedecor_generic_metal.png", color = homedecor.color_black }, | ||||
| 			{ name = "homedecor_generic_wood_red.png", color = 0xffffffff }, | ||||
| 			{ name = "homedecor_generic_metal.png", color = homedecor.color_black }, | ||||
| 		}, | ||||
| 		inventory_image = "homedecor_standing_lamp_foot_inv.png^(homedecor_standing_lamp_top_inv.png^[colorize:"..invcolor..")", | ||||
| 		inventory_image = "homedecor_standing_lamp_foot_inv.png^homedecor_standing_lamp_top_inv.png", | ||||
| 		paramtype = "light", | ||||
| 		paramtype2 = "color", | ||||
| 		palette = "unifieddyes_palette.png", | ||||
| 		walkable = false, | ||||
| 		light_source = light, | ||||
| 		groups = {cracky=2,oddly_breakable_by_hand=1, | ||||
| @@ -424,28 +454,26 @@ local function reg_lamp(suffix, nxt, tilesuffix, light, color, brightness) | ||||
| 		sounds = default.node_sound_wood_defaults(), | ||||
| 		on_rotate = screwdriver.rotate_simple, | ||||
| 		on_punch = function(pos, node, puncher) | ||||
| 			node.name = "homedecor:standing_lamp"..lampcolor.."_"..repl[suffix] | ||||
| 			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" }, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_alias("homedecor:standing_lamp_bottom"..lampcolor.."_"..suffix, "homedecor:standing_lamp"..lampcolor.."_"..suffix) | ||||
| 	minetest.register_alias("homedecor:standing_lamp_top"..lampcolor.."_"..suffix, "air") | ||||
|  | ||||
| 	-- for old maps that had the original 3dforniture mod | ||||
| 	if lampcolor == "" then | ||||
| 		minetest.register_alias("3dforniture:table_lamp_"..suffix, "homedecor:table_lamp_"..suffix) | ||||
| 	end | ||||
| 	minetest.register_alias("3dforniture:table_lamp_"..suffix, "homedecor:table_lamp_"..suffix) | ||||
| end | ||||
|  | ||||
| for n, color in ipairs(lamp_colors) do | ||||
| 	reg_lamp("off",  "low",  "",   nil,  color, 1 ) | ||||
| 	reg_lamp("low",  "med",  "l",    3,  color, 2 ) | ||||
| 	reg_lamp("med",  "hi",   "m",    7,  color, 3 ) | ||||
| 	reg_lamp("hi",   "max",  "h",   11,  color, 4 ) | ||||
| 	reg_lamp("max",  "off",  "x",   14,  color, 5 ) | ||||
| end | ||||
| reg_lamp("off", "low",  nil, 1 ) | ||||
| reg_lamp("low", "med",  3,   2 ) | ||||
| reg_lamp("med", "hi",   7,   3 ) | ||||
| reg_lamp("hi",  "max", 11,   4 ) | ||||
| reg_lamp("max", "off", 14,   5 ) | ||||
|  | ||||
| local dlamp_cbox = { | ||||
| 	type = "fixed", | ||||
| @@ -505,3 +533,98 @@ homedecor.register("ceiling_lamp_off", { | ||||
| 	end, | ||||
| 	drop = "homedecor:ceiling_lamp" | ||||
| }) | ||||
|  | ||||
| -- conversion LBM for param2 coloring | ||||
|  | ||||
| homedecor.old_static_nodes = { | ||||
| 	"homedecor:glowlight_quarter_white", | ||||
| 	"homedecor:glowlight_quarter_yellow", | ||||
| 	"homedecor:glowlight_half_white", | ||||
| 	"homedecor:glowlight_half_yellow", | ||||
| 	"homedecor:glowlight_small_cube_white", | ||||
| 	"homedecor:glowlight_small_cube_yellow" | ||||
| } | ||||
|  | ||||
| local lamp_power = {"off", "low", "med", "hi", "max"} | ||||
|  | ||||
| for _, power in ipairs(lamp_power) do | ||||
| 	for _, color in ipairs(lamp_colors) do | ||||
| 		table.insert(homedecor.old_static_nodes, "homedecor:table_lamp_"..color.."_"..power) | ||||
| 		table.insert(homedecor.old_static_nodes, "homedecor:standing_lamp_"..color.."_"..power) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| print(dump(homedecor.old_static_nodes)) | ||||
|  | ||||
| minetest.register_lbm({ | ||||
| 	name = "homedecor:convert_lighting", | ||||
| 	label = "Convert homedecor glowlights, table lamps, and standing lamps to use param2 color", | ||||
| 	run_at_every_load = true, | ||||
| 	nodenames = homedecor.old_static_nodes, | ||||
| 	action = function(pos, node) | ||||
| 		local name = node.name | ||||
| 		local newnode | ||||
| 		local color | ||||
|  | ||||
| 		if string.find(name, "small_cube") then | ||||
| 			newname = "homedecor:glowlight_small_cube" | ||||
| 		elseif string.find(name, "glowlight_half") then | ||||
| 			newname = "homedecor:glowlight_half" | ||||
| 		elseif string.find(name, "glowlight_quarter") then | ||||
| 			newname = "homedecor:glowlight_quarter" | ||||
| 		end | ||||
|  | ||||
| 		local lampname | ||||
| 		if string.find(name, "standing_lamp") then  | ||||
| 			lampname = "homedecor:standing_lamp" | ||||
| 		elseif string.find(name, "table_lamp") then | ||||
| 			lampname = "homedecor:table_lamp" | ||||
| 		end | ||||
| 		if lampname then | ||||
| 			newname = lampname | ||||
| 			if string.find(name, "_off") then | ||||
| 				newname = newname.."_off" | ||||
| 			elseif string.find(name, "_low") then | ||||
| 				newname = newname.."_low" | ||||
| 			elseif string.find(name, "_med") then | ||||
| 				newname = newname.."_med" | ||||
| 			elseif string.find(name, "_hi") then | ||||
| 				newname = newname.."_hi" | ||||
| 			elseif string.find(name, "_max") then | ||||
| 				newname = newname.."_max" | ||||
| 			end | ||||
| 		end | ||||
|  | ||||
| 		if string.find(name, "red") then | ||||
| 			color = "red" | ||||
| 		elseif string.find(name, "pink") then | ||||
| 			color = "pink" | ||||
| 		elseif string.find(name, "green") then | ||||
| 			color = "green" | ||||
| 		elseif string.find(name, "blue") then | ||||
| 			color = "blue" | ||||
| 		elseif string.find(name, "yellow") then | ||||
| 			color = "yellow" | ||||
| 		elseif string.find(name, "violet") then | ||||
| 			color = "violet" | ||||
| 		else | ||||
| 			color = "white" | ||||
| 		end | ||||
|  | ||||
| 		local paletteidx | ||||
| 		local fdir | ||||
| 		if string.find(name, "glowlight") then | ||||
| 			paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted") | ||||
| 			param2 = paletteidx + (node.param2 % 8 ) | ||||
| 		else | ||||
| 			paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, false) | ||||
| 			param2 = paletteidx | ||||
| 		end | ||||
|  | ||||
| 		print(node.name.." --> "..newname..", "..color.." ("..paletteidx.."), fdir = "..node.param2.." --> "..param2) | ||||
|  | ||||
| 		minetest.set_node(pos, { name = newname, param2 = param2 }) | ||||
| 		local meta = minetest.get_meta(pos) | ||||
| 		meta:set_string("dye", "unifieddyes:"..color) | ||||
| 	end | ||||
| }) | ||||
|   | ||||
| Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 119 B | 
| Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 135 B | 
| Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B | 
| Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B | 
| Before Width: | Height: | Size: 350 B | 
| Before Width: | Height: | Size: 353 B | 
| Before Width: | Height: | Size: 352 B | 
| Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B | 
| Before Width: | Height: | Size: 458 B | 
| Before Width: | Height: | Size: 134 B After Width: | Height: | Size: 134 B | 
| Before Width: | Height: | Size: 317 B | 
| Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 172 B | 
| Before Width: | Height: | Size: 455 B | 
| Before Width: | Height: | Size: 616 B |