mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-12-23 00:20:17 +01:00
make all dimmable lights fully dimmable to any level 0-14
for backward compat, they'll resond to the usual strings, too: "off" -> 0 "min" -> 3 "med" -> 7 "hi" -> 11 "max"/"on" -> 14 all dimmable nodes have been renamed to bear the light value in their names, and aliased. the non-dimmable lights still respond as before ("off" or n < 4; "on" or n > 3)
This commit is contained in:
parent
f33636d473
commit
631813bb2d
@ -22,7 +22,7 @@ local brightn_cycle = {
|
|||||||
["on"] = "off",
|
["on"] = "off",
|
||||||
}
|
}
|
||||||
|
|
||||||
local brightn_light_source = {
|
local word_to_bright = {
|
||||||
["off"] = 0,
|
["off"] = 0,
|
||||||
["low"] = 3,
|
["low"] = 3,
|
||||||
["med"] = 7,
|
["med"] = 7,
|
||||||
@ -31,33 +31,6 @@ local brightn_light_source = {
|
|||||||
["max"] = 14,
|
["max"] = 14,
|
||||||
}
|
}
|
||||||
|
|
||||||
local brightn_hex = {
|
|
||||||
["off"] = 0xffd0d0d0,
|
|
||||||
["low"] = 0xffd8d8d8,
|
|
||||||
["med"] = 0xffe0e0e0,
|
|
||||||
["hi"] = 0xffe8e8e8,
|
|
||||||
["on"] = 0xffffffff,
|
|
||||||
["max"] = 0xffffffff,
|
|
||||||
}
|
|
||||||
|
|
||||||
local bright_to_word = {
|
|
||||||
[0] = "off",
|
|
||||||
[1] = "low",
|
|
||||||
[2] = "low",
|
|
||||||
[3] = "low",
|
|
||||||
[4] = "med",
|
|
||||||
[5] = "med",
|
|
||||||
[6] = "med",
|
|
||||||
[7] = "med",
|
|
||||||
[8] = "hi",
|
|
||||||
[9] = "hi",
|
|
||||||
[10] = "hi",
|
|
||||||
[11] = "hi",
|
|
||||||
[12] = "on",
|
|
||||||
[13] = "on",
|
|
||||||
[14] = "on",
|
|
||||||
}
|
|
||||||
|
|
||||||
local rules_xz = {
|
local rules_xz = {
|
||||||
{x = -1, y = 0, z = 0}, -- borrowed from extrawires crossing
|
{x = -1, y = 0, z = 0}, -- borrowed from extrawires crossing
|
||||||
{x = 1, y = 0, z = 0},
|
{x = 1, y = 0, z = 0},
|
||||||
@ -154,21 +127,23 @@ if minetest.get_modpath("digilines") then
|
|||||||
|
|
||||||
if msg and msg ~= "" then
|
if msg and msg ~= "" then
|
||||||
local n = tonumber(msg)
|
local n = tonumber(msg)
|
||||||
local msg = bright_to_word[n] or msg
|
local suff = word_to_bright[msg] or "invalid"
|
||||||
print(node.name, dump(msg))
|
|
||||||
|
|
||||||
local basename = string.sub(node.name, 1, string.find(node.name, "_", -5) - 1)
|
local basename = string.sub(node.name, 1, string.find(node.name, "_", -5) - 1)
|
||||||
if brightn_light_source[msg] then
|
|
||||||
if minetest.registered_nodes[basename.."_"..msg] then
|
if minetest.registered_nodes[basename.."_"..msg] then
|
||||||
minetest.swap_node(pos, {name = basename.."_"..msg, param2 = node.param2})
|
minetest.swap_node(pos, {name = basename.."_"..msg, param2 = node.param2})
|
||||||
elseif (n and n > 3) or msg == "hi" or msg == "max" or msg == "med" then
|
elseif minetest.registered_nodes[basename.."_"..suff] then
|
||||||
|
minetest.swap_node(pos, {name = basename.."_"..suff, param2 = node.param2})
|
||||||
|
elseif minetest.registered_nodes[basename.."_on"]
|
||||||
|
and (msg == "med" or msg == "hi" or msg == "max" or (n and n > 3)) then
|
||||||
minetest.swap_node(pos, {name = basename.."_on", param2 = node.param2})
|
minetest.swap_node(pos, {name = basename.."_on", param2 = node.param2})
|
||||||
elseif (n and n < 4) or msg == "low" then
|
elseif minetest.registered_nodes[basename.."_off"]
|
||||||
|
and (msg == "low" or (n and n < 4)) then
|
||||||
minetest.swap_node(pos, {name = basename.."_off", param2 = node.param2})
|
minetest.swap_node(pos, {name = basename.."_off", param2 = node.param2})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
@ -246,24 +221,31 @@ end
|
|||||||
|
|
||||||
function homedecor.toggle_light(pos, node, clicker, itemstack, pointed_thing)
|
function homedecor.toggle_light(pos, node, clicker, itemstack, pointed_thing)
|
||||||
if is_protected(pos, clicker) then return end
|
if is_protected(pos, clicker) then return end
|
||||||
local sep = string.find(node.name, "_o", -5)
|
local sep = string.find(node.name, "_", -5)
|
||||||
local onoff = string.sub(node.name, sep + 1)
|
local level = string.sub(node.name, sep + 1)
|
||||||
local newname = string.sub(node.name, 1, sep - 1)..((onoff == "off") and "_on" or "_off")
|
local n = tonumber(level) or 0
|
||||||
minetest.swap_node(pos, {name = newname, param2 = node.param2})
|
|
||||||
|
if level == "off" or n < 4 then
|
||||||
|
newsuff = "_14"
|
||||||
|
else
|
||||||
|
newsuff = "_0"
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.swap_node(pos, {name = string.sub(node.name, 1, sep - 1)..newsuff, param2 = node.param2})
|
||||||
end
|
end
|
||||||
|
|
||||||
------------------
|
------------------
|
||||||
-- Dimmable lights
|
-- Dimmable lights
|
||||||
|
|
||||||
for light_brightn_name in pairs(brightn_light_source) do
|
--for light_brightn_name in pairs(word_to_bright) do
|
||||||
|
|
||||||
if brightn_light_source ~= "max" then
|
for brightness_level = 0, 14 do
|
||||||
|
|
||||||
local tiles
|
local tiles
|
||||||
local overlay
|
local overlay
|
||||||
|
|
||||||
local onflag = (light_brightn_name ~= "off")
|
local onflag = (brightness_level > 0)
|
||||||
local nici = (light_brightn_name ~= "on") and 1 or nil
|
local nici = (brightness_level ~= 14) and 1 or nil
|
||||||
|
|
||||||
local gen_ls_tex_white = "homedecor_generic_light_source_off.png"
|
local gen_ls_tex_white = "homedecor_generic_light_source_off.png"
|
||||||
if onflag then gen_ls_tex_white = "homedecor_generic_light_source_white.png" end
|
if onflag then gen_ls_tex_white = "homedecor_generic_light_source_white.png" end
|
||||||
@ -271,6 +253,9 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
local gen_ls_tex_yellow = "homedecor_generic_light_source_off.png"
|
local gen_ls_tex_yellow = "homedecor_generic_light_source_off.png"
|
||||||
if onflag then gen_ls_tex_yellow = "homedecor_generic_light_source_yellow.png" end
|
if onflag then gen_ls_tex_yellow = "homedecor_generic_light_source_yellow.png" end
|
||||||
|
|
||||||
|
local h = (brightness_level == 0) and "0" or string.format("%x", brightness_level+1)
|
||||||
|
local brightness_hex = tonumber("0xff"..string.rep(h, 6))
|
||||||
|
|
||||||
local glowlight_nodebox = {
|
local glowlight_nodebox = {
|
||||||
half = homedecor.nodebox.slab_y(1/2),
|
half = homedecor.nodebox.slab_y(1/2),
|
||||||
quarter = homedecor.nodebox.slab_y(1/4),
|
quarter = homedecor.nodebox.slab_y(1/4),
|
||||||
@ -315,7 +300,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
overlay = nil
|
overlay = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(":homedecor:glowlight_half_"..light_brightn_name, {
|
minetest.register_node(":homedecor:glowlight_half_"..brightness_level, {
|
||||||
description = S("Thick Glowlight"),
|
description = S("Thick Glowlight"),
|
||||||
tiles = tiles,
|
tiles = tiles,
|
||||||
overlay_tiles = overlay,
|
overlay_tiles = overlay,
|
||||||
@ -332,7 +317,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
},
|
},
|
||||||
node_box = glowlight_nodebox.half,
|
node_box = glowlight_nodebox.half,
|
||||||
groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici },
|
groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici },
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
|
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
|
||||||
@ -380,7 +365,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
overlay = nil
|
overlay = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(":homedecor:glowlight_quarter_"..light_brightn_name, {
|
minetest.register_node(":homedecor:glowlight_quarter_"..brightness_level, {
|
||||||
description = S("Thin Glowlight"),
|
description = S("Thin Glowlight"),
|
||||||
tiles = tiles,
|
tiles = tiles,
|
||||||
overlay_tiles = overlay,
|
overlay_tiles = overlay,
|
||||||
@ -397,7 +382,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
},
|
},
|
||||||
node_box = glowlight_nodebox.quarter,
|
node_box = glowlight_nodebox.quarter,
|
||||||
groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici },
|
groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici },
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
|
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
|
||||||
@ -446,7 +431,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
overlay = nil
|
overlay = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(":homedecor:glowlight_small_cube_"..light_brightn_name, {
|
minetest.register_node(":homedecor:glowlight_small_cube_"..brightness_level, {
|
||||||
description = S("Small Glowlight Cube"),
|
description = S("Small Glowlight Cube"),
|
||||||
tiles = tiles,
|
tiles = tiles,
|
||||||
overlay_tiles = overlay,
|
overlay_tiles = overlay,
|
||||||
@ -463,7 +448,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
},
|
},
|
||||||
node_box = glowlight_nodebox.small_cube,
|
node_box = glowlight_nodebox.small_cube,
|
||||||
groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici },
|
groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici },
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
|
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
|
||||||
@ -482,15 +467,18 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
local lighttex
|
local lighttex
|
||||||
|
|
||||||
if onflag then
|
if onflag then
|
||||||
|
local b = (brightness_level > 6) and brightness_level or 6
|
||||||
|
local brightened = "^[multiply:#"..string.rep(string.format("%x", b), 6)
|
||||||
|
|
||||||
lighttex = {
|
lighttex = {
|
||||||
name="homedecor_plasma_storm.png",
|
name="homedecor_plasma_storm.png"..brightened,
|
||||||
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0},
|
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0},
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lighttex = "homedecor_plasma_lamp_off.png"
|
lighttex = "homedecor_plasma_lamp_off.png"
|
||||||
end
|
end
|
||||||
|
|
||||||
homedecor.register("plasma_lamp_"..light_brightn_name, {
|
homedecor.register("plasma_lamp_"..brightness_level, {
|
||||||
description = S("Plasma Lamp/Light"),
|
description = S("Plasma Lamp/Light"),
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "plasma_lamp.obj",
|
mesh = "plasma_lamp.obj",
|
||||||
@ -499,7 +487,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
lighttex
|
lighttex
|
||||||
},
|
},
|
||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici},
|
groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici},
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
@ -519,7 +507,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0.45, 0.25 },
|
fixed = { -0.25, -0.5, -0.25, 0.25, 0.45, 0.25 },
|
||||||
}
|
}
|
||||||
|
|
||||||
homedecor.register("ground_lantern_"..light_brightn_name, {
|
homedecor.register("ground_lantern_"..brightness_level, {
|
||||||
description = S("Ground Lantern/Light"),
|
description = S("Ground Lantern/Light"),
|
||||||
mesh = "homedecor_ground_lantern.obj",
|
mesh = "homedecor_ground_lantern.obj",
|
||||||
tiles = { gen_ls_tex_yellow, "homedecor_generic_metal_wrought_iron.png" },
|
tiles = { gen_ls_tex_yellow, "homedecor_generic_metal_wrought_iron.png" },
|
||||||
@ -527,7 +515,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
inventory_image = "homedecor_ground_lantern_inv.png",
|
inventory_image = "homedecor_ground_lantern_inv.png",
|
||||||
wield_image = "homedecor_ground_lantern_inv.png",
|
wield_image = "homedecor_ground_lantern_inv.png",
|
||||||
groups = {snappy=3, not_in_creative_inventory = nici},
|
groups = {snappy=3, not_in_creative_inventory = nici},
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
selection_box = gl_cbox,
|
selection_box = gl_cbox,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
on_rightclick = homedecor.toggle_light,
|
on_rightclick = homedecor.toggle_light,
|
||||||
@ -546,7 +534,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
fixed = { -0.25, -0.5, -0.2, 0.25, 0.5, 0.5 },
|
fixed = { -0.25, -0.5, -0.2, 0.25, 0.5, 0.5 },
|
||||||
}
|
}
|
||||||
|
|
||||||
homedecor.register("hanging_lantern_"..light_brightn_name, {
|
homedecor.register("hanging_lantern_"..brightness_level, {
|
||||||
description = S("Hanging Lantern/Light"),
|
description = S("Hanging Lantern/Light"),
|
||||||
mesh = "homedecor_hanging_lantern.obj",
|
mesh = "homedecor_hanging_lantern.obj",
|
||||||
tiles = { "homedecor_generic_metal_wrought_iron.png", gen_ls_tex_yellow },
|
tiles = { "homedecor_generic_metal_wrought_iron.png", gen_ls_tex_yellow },
|
||||||
@ -554,7 +542,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
inventory_image = "homedecor_hanging_lantern_inv.png",
|
inventory_image = "homedecor_hanging_lantern_inv.png",
|
||||||
wield_image = "homedecor_hanging_lantern_inv.png",
|
wield_image = "homedecor_hanging_lantern_inv.png",
|
||||||
groups = {snappy=3, not_in_creative_inventory = nici},
|
groups = {snappy=3, not_in_creative_inventory = nici},
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
selection_box = hl_cbox,
|
selection_box = hl_cbox,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
on_rightclick = homedecor.toggle_light,
|
on_rightclick = homedecor.toggle_light,
|
||||||
@ -573,7 +561,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
fixed = { -0.35, -0.45, -0.35, 0.35, 0.5, 0.35 }
|
fixed = { -0.35, -0.45, -0.35, 0.35, 0.5, 0.35 }
|
||||||
}
|
}
|
||||||
|
|
||||||
homedecor.register("ceiling_lantern_"..light_brightn_name, {
|
homedecor.register("ceiling_lantern_"..brightness_level, {
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "homedecor_ceiling_lantern.obj",
|
mesh = "homedecor_ceiling_lantern.obj",
|
||||||
tiles = { gen_ls_tex_yellow, "homedecor_generic_metal_wrought_iron.png" },
|
tiles = { gen_ls_tex_yellow, "homedecor_generic_metal_wrought_iron.png" },
|
||||||
@ -581,7 +569,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
inventory_image = "homedecor_ceiling_lantern_inv.png",
|
inventory_image = "homedecor_ceiling_lantern_inv.png",
|
||||||
description = S("Ceiling Lantern/Light"),
|
description = S("Ceiling Lantern/Light"),
|
||||||
groups = {snappy=3, not_in_creative_inventory = nici},
|
groups = {snappy=3, not_in_creative_inventory = nici},
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
selection_box = cl_cbox,
|
selection_box = cl_cbox,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
on_rightclick = homedecor.toggle_light,
|
on_rightclick = homedecor.toggle_light,
|
||||||
@ -599,11 +587,11 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
sm_light = default.LIGHT_MAX-5
|
sm_light = default.LIGHT_MAX-5
|
||||||
else
|
else
|
||||||
|
|
||||||
homedecor.register("lattice_lantern_large_"..light_brightn_name, {
|
homedecor.register("lattice_lantern_large_"..brightness_level, {
|
||||||
description = S("Lattice lantern/Light (large)"),
|
description = S("Lattice lantern/Light (large)"),
|
||||||
tiles = { gen_ls_tex_yellow.."^homedecor_lattice_lantern_large_overlay.png" },
|
tiles = { gen_ls_tex_yellow.."^homedecor_lattice_lantern_large_overlay.png" },
|
||||||
groups = { snappy = 3, not_in_creative_inventory = nici },
|
groups = { snappy = 3, not_in_creative_inventory = nici },
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
on_rightclick = homedecor.toggle_light,
|
on_rightclick = homedecor.toggle_light,
|
||||||
drop = {
|
drop = {
|
||||||
@ -628,7 +616,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
lighttex_sides = "homedecor_generic_light_source_off.png"
|
lighttex_sides = "homedecor_generic_light_source_off.png"
|
||||||
end
|
end
|
||||||
|
|
||||||
homedecor.register("lattice_lantern_small_"..light_brightn_name, {
|
homedecor.register("lattice_lantern_small_"..brightness_level, {
|
||||||
description = S("Lattice lantern/light (small)"),
|
description = S("Lattice lantern/light (small)"),
|
||||||
tiles = {
|
tiles = {
|
||||||
lighttex_tb.."^homedecor_lattice_lantern_small_tb_overlay.png",
|
lighttex_tb.."^homedecor_lattice_lantern_small_tb_overlay.png",
|
||||||
@ -644,7 +632,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||||
},
|
},
|
||||||
groups = { snappy = 3, not_in_creative_inventory = nici },
|
groups = { snappy = 3, not_in_creative_inventory = nici },
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
on_place = minetest.rotate_node,
|
on_place = minetest.rotate_node,
|
||||||
on_rightclick = homedecor.toggle_light,
|
on_rightclick = homedecor.toggle_light,
|
||||||
@ -665,14 +653,14 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
wall_side = { -0.2, -0.5, -0.15, 0.32, 0.12, 0.15 },
|
wall_side = { -0.2, -0.5, -0.15, 0.32, 0.12, 0.15 },
|
||||||
}
|
}
|
||||||
|
|
||||||
homedecor.register("desk_lamp_"..light_brightn_name, {
|
homedecor.register("desk_lamp_"..brightness_level, {
|
||||||
description = S("Desk Lamp/Light"),
|
description = S("Desk Lamp/Light"),
|
||||||
mesh = "homedecor_desk_lamp.obj",
|
mesh = "homedecor_desk_lamp.obj",
|
||||||
tiles = {
|
tiles = {
|
||||||
"homedecor_generic_metal.png",
|
"homedecor_generic_metal.png",
|
||||||
"homedecor_generic_metal.png",
|
"homedecor_generic_metal.png",
|
||||||
{ name = "homedecor_generic_metal.png", color = homedecor.color_med_grey },
|
{ name = "homedecor_generic_metal.png", color = homedecor.color_med_grey },
|
||||||
{ name = gen_ls_tex_white, color = brightn_hex[light_brightn_name] },
|
{ name = gen_ls_tex_white, color = brightness_hex },
|
||||||
},
|
},
|
||||||
inventory_image = "homedecor_desk_lamp_inv.png",
|
inventory_image = "homedecor_desk_lamp_inv.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -686,7 +674,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
end,
|
end,
|
||||||
on_rotate = unifieddyes.fix_after_screwdriver_nsew,
|
on_rotate = unifieddyes.fix_after_screwdriver_nsew,
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
on_rightclick = homedecor.toggle_light,
|
on_rightclick = homedecor.toggle_light,
|
||||||
drop = {
|
drop = {
|
||||||
items = {
|
items = {
|
||||||
@ -700,7 +688,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
|
|
||||||
-- "kitchen"/"dining room" ceiling lamp
|
-- "kitchen"/"dining room" ceiling lamp
|
||||||
|
|
||||||
homedecor.register("ceiling_lamp_"..light_brightn_name, {
|
homedecor.register("ceiling_lamp_"..brightness_level, {
|
||||||
description = S("Ceiling Lamp/Light"),
|
description = S("Ceiling Lamp/Light"),
|
||||||
mesh = "homedecor_ceiling_lamp.obj",
|
mesh = "homedecor_ceiling_lamp.obj",
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -710,7 +698,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
{ name = "homedecor_generic_plastic.png", color = 0xff442d04 },
|
{ name = "homedecor_generic_plastic.png", color = 0xff442d04 },
|
||||||
},
|
},
|
||||||
inventory_image = "homedecor_ceiling_lamp_inv.png",
|
inventory_image = "homedecor_ceiling_lamp_inv.png",
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
groups = {snappy=3, not_in_creative_inventory = nici},
|
groups = {snappy=3, not_in_creative_inventory = nici},
|
||||||
walkable = false,
|
walkable = false,
|
||||||
on_rightclick = homedecor.toggle_light,
|
on_rightclick = homedecor.toggle_light,
|
||||||
@ -734,14 +722,14 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
fixed = { -0.25, -0.5, -0.25, 0.25, 1.5, 0.25 }
|
fixed = { -0.25, -0.5, -0.25, 0.25, 1.5, 0.25 }
|
||||||
}
|
}
|
||||||
|
|
||||||
local wool_brightened = "wool_grey.png^[colorize:#ffffff:"..(brightn_light_source[light_brightn_name] * 15)
|
local wool_brightened = "wool_grey.png^[colorize:#ffffff:"..(brightness_level * 15)
|
||||||
|
|
||||||
homedecor.register("table_lamp_"..light_brightn_name, {
|
homedecor.register("table_lamp_"..brightness_level, {
|
||||||
description = S("Table Lamp/Light"),
|
description = S("Table Lamp/Light"),
|
||||||
mesh = "homedecor_table_lamp.obj",
|
mesh = "homedecor_table_lamp.obj",
|
||||||
tiles = {
|
tiles = {
|
||||||
wool_brightened,
|
wool_brightened,
|
||||||
{ name = gen_ls_tex_white, color = brightn_hex[light_brightn_name] },
|
{ name = gen_ls_tex_white, color = brightness_hex },
|
||||||
{ name = "homedecor_generic_wood_red.png", color = 0xffffffff },
|
{ name = "homedecor_generic_wood_red.png", color = 0xffffffff },
|
||||||
{ name = "homedecor_generic_metal.png", color = homedecor.color_black },
|
{ name = "homedecor_generic_metal.png", color = homedecor.color_black },
|
||||||
},
|
},
|
||||||
@ -750,7 +738,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette_extended.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = brightness_level,
|
||||||
selection_box = tlamp_cbox,
|
selection_box = tlamp_cbox,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, not_in_creative_inventory=nici },
|
groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, not_in_creative_inventory=nici },
|
||||||
@ -765,12 +753,12 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
on_punch = digiline_on_punch
|
on_punch = digiline_on_punch
|
||||||
})
|
})
|
||||||
|
|
||||||
homedecor.register("standing_lamp_"..light_brightn_name, {
|
homedecor.register("standing_lamp_"..brightness_level, {
|
||||||
description = S("Standing Lamp/Light"),
|
description = S("Standing Lamp/Light"),
|
||||||
mesh = "homedecor_standing_lamp.obj",
|
mesh = "homedecor_standing_lamp.obj",
|
||||||
tiles = {
|
tiles = {
|
||||||
wool_brightened,
|
wool_brightened,
|
||||||
{ name = gen_ls_tex_white, color = brightn_hex[light_brightn_name] },
|
{ name = gen_ls_tex_white, color = brightness_hex },
|
||||||
{ name = "homedecor_generic_wood_red.png", color = 0xffffffff },
|
{ name = "homedecor_generic_wood_red.png", color = 0xffffffff },
|
||||||
{ name = "homedecor_generic_metal.png", color = homedecor.color_black },
|
{ name = "homedecor_generic_metal.png", color = homedecor.color_black },
|
||||||
},
|
},
|
||||||
@ -779,7 +767,7 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
paramtype2 = "color",
|
paramtype2 = "color",
|
||||||
palette = "unifieddyes_palette_extended.png",
|
palette = "unifieddyes_palette_extended.png",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = word_to_bright[light_brightn_name],
|
||||||
groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, not_in_creative_inventory=nici },
|
groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, not_in_creative_inventory=nici },
|
||||||
selection_box = slamp_cbox,
|
selection_box = slamp_cbox,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
@ -795,7 +783,6 @@ for light_brightn_name in pairs(brightn_light_source) do
|
|||||||
on_rightclick = homedecor.toggle_light,
|
on_rightclick = homedecor.toggle_light,
|
||||||
on_punch = digiline_on_punch
|
on_punch = digiline_on_punch
|
||||||
})
|
})
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
@ -861,7 +848,7 @@ for _, light_brightn_name in ipairs({"off", "on"}) do
|
|||||||
description = "Rope lighting (on floor)",
|
description = "Rope lighting (on floor)",
|
||||||
inventory_image = "homedecor_rope_light_on_floor.png",
|
inventory_image = "homedecor_rope_light_on_floor.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = word_to_bright[light_brightn_name],
|
||||||
walkable = false,
|
walkable = false,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
tiles = { gen_ls_tex_white },
|
tiles = { gen_ls_tex_white },
|
||||||
@ -907,7 +894,7 @@ for _, light_brightn_name in ipairs({"off", "on"}) do
|
|||||||
description = "Rope lighting (on ceiling)",
|
description = "Rope lighting (on ceiling)",
|
||||||
inventory_image = "homedecor_rope_light_on_ceiling.png",
|
inventory_image = "homedecor_rope_light_on_ceiling.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
light_source = brightn_light_source[light_brightn_name],
|
light_source = word_to_bright[light_brightn_name],
|
||||||
walkable = false,
|
walkable = false,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
tiles = { gen_ls_tex_white },
|
tiles = { gen_ls_tex_white },
|
||||||
@ -1844,69 +1831,91 @@ minetest.register_alias("chains:chain_top_brass", "homedecor:chain_
|
|||||||
minetest.register_alias("chains:chandelier_steel", "homedecor:chandelier_steel")
|
minetest.register_alias("chains:chandelier_steel", "homedecor:chandelier_steel")
|
||||||
minetest.register_alias("chains:chandelier_brass", "homedecor:chandelier_brass")
|
minetest.register_alias("chains:chandelier_brass", "homedecor:chandelier_brass")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:glowlight_half", "homedecor:glowlight_half_on")
|
minetest.register_alias("homedecor:glowlight_half", "homedecor:glowlight_half_14")
|
||||||
minetest.register_alias("homedecor:glowlight_half_max", "homedecor:glowlight_half_on")
|
minetest.register_alias("homedecor:glowlight_half_max", "homedecor:glowlight_half_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:glowlight_quarter", "homedecor:glowlight_quarter_on")
|
minetest.register_alias("homedecor:glowlight_quarter", "homedecor:glowlight_quarter_14")
|
||||||
minetest.register_alias("homedecor:glowlight_quarter_max", "homedecor:glowlight_quarter_on")
|
minetest.register_alias("homedecor:glowlight_quarter_max", "homedecor:glowlight_quarter_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:glowlight_small_cube", "homedecor:glowlight_small_cube_on")
|
minetest.register_alias("homedecor:glowlight_small_cube", "homedecor:glowlight_small_cube_14")
|
||||||
minetest.register_alias("homedecor:glowlight_small_cube_max", "homedecor:glowlight_small_cube_on")
|
minetest.register_alias("homedecor:glowlight_small_cube_max", "homedecor:glowlight_small_cube_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:rope_light_on_floor", "homedecor:rope_light_on_floor_on")
|
minetest.register_alias("homedecor:rope_light_14_floor", "homedecor:rope_light_on_floor_14")
|
||||||
minetest.register_alias("homedecor:rope_light_on_floor_max", "homedecor:rope_light_on_floor_on")
|
minetest.register_alias("homedecor:rope_light_on_floor_max", "homedecor:rope_light_on_floor_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:rope_light_on_ceiling", "homedecor:rope_light_on_ceiling_on")
|
minetest.register_alias("homedecor:rope_light_on_ceiling", "homedecor:rope_light_on_ceiling_14")
|
||||||
minetest.register_alias("homedecor:rope_light_on_ceiling_max", "homedecor:rope_light_on_ceiling_on")
|
minetest.register_alias("homedecor:rope_light_on_ceiling_max", "homedecor:rope_light_on_ceiling_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:plasma_lamp", "homedecor:plasma_lamp_on")
|
minetest.register_alias("homedecor:plasma_lamp", "homedecor:plasma_lamp_14")
|
||||||
minetest.register_alias("homedecor:plasma_lamp_max", "homedecor:plasma_lamp_on")
|
minetest.register_alias("homedecor:plasma_lamp_max", "homedecor:plasma_lamp_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:plasma_ball", "homedecor:plasma_ball_on")
|
minetest.register_alias("homedecor:plasma_ball", "homedecor:plasma_ball_14")
|
||||||
minetest.register_alias("homedecor:plasma_ball_max", "homedecor:plasma_ball_on")
|
minetest.register_alias("homedecor:plasma_ball_max", "homedecor:plasma_ball_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:ground_lantern", "homedecor:ground_lantern_on")
|
minetest.register_alias("homedecor:ground_lantern", "homedecor:ground_lantern_14")
|
||||||
minetest.register_alias("homedecor:ground_lantern_max", "homedecor:ground_lantern_on")
|
minetest.register_alias("homedecor:ground_lantern_max", "homedecor:ground_lantern_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:hanging_lantern", "homedecor:hanging_lantern_on")
|
minetest.register_alias("homedecor:hanging_lantern", "homedecor:hanging_lantern_14")
|
||||||
minetest.register_alias("homedecor:hanging_lantern_max", "homedecor:hanging_lantern_on")
|
minetest.register_alias("homedecor:hanging_lantern_max", "homedecor:hanging_lantern_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:ceiling_lantern", "homedecor:ceiling_lantern_on")
|
minetest.register_alias("homedecor:ceiling_lantern", "homedecor:ceiling_lantern_14")
|
||||||
minetest.register_alias("homedecor:ceiling_lantern_max", "homedecor:ceiling_lantern_on")
|
minetest.register_alias("homedecor:ceiling_lantern_max", "homedecor:ceiling_lantern_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:lattice_lantern_large", "homedecor:lattice_lantern_large_on")
|
minetest.register_alias("homedecor:lattice_lantern_large", "homedecor:lattice_lantern_large_14")
|
||||||
minetest.register_alias("homedecor:lattice_lantern_large_max", "homedecor:lattice_lantern_large_on")
|
minetest.register_alias("homedecor:lattice_lantern_large_max", "homedecor:lattice_lantern_large_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:lattice_lantern_small", "homedecor:lattice_lantern_small_on")
|
minetest.register_alias("homedecor:lattice_lantern_small", "homedecor:lattice_lantern_small_14")
|
||||||
minetest.register_alias("homedecor:lattice_lantern_small_max", "homedecor:lattice_lantern_small_on")
|
minetest.register_alias("homedecor:lattice_lantern_small_max", "homedecor:lattice_lantern_small_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:desk_lamp", "homedecor:desk_lamp_on")
|
minetest.register_alias("homedecor:desk_lamp", "homedecor:desk_lamp_14")
|
||||||
minetest.register_alias("homedecor:desk_lamp_max", "homedecor:desk_lamp_on")
|
minetest.register_alias("homedecor:desk_lamp_max", "homedecor:desk_lamp_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:ceiling_lamp", "homedecor:ceiling_lamp_on")
|
minetest.register_alias("homedecor:ceiling_lamp", "homedecor:ceiling_lamp_14")
|
||||||
minetest.register_alias("homedecor:ceiling_lamp_max", "homedecor:ceiling_lamp_on")
|
minetest.register_alias("homedecor:ceiling_lamp_max", "homedecor:ceiling_lamp_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:table_lamp", "homedecor:table_lamp_on")
|
minetest.register_alias("homedecor:table_lamp", "homedecor:table_lamp_14")
|
||||||
minetest.register_alias("homedecor:table_lamp_max", "homedecor:table_lamp_on")
|
minetest.register_alias("homedecor:table_lamp_max", "homedecor:table_lamp_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:standing_lamp", "homedecor:standing_lamp_on")
|
minetest.register_alias("homedecor:standing_lamp", "homedecor:standing_lamp_14")
|
||||||
minetest.register_alias("homedecor:standing_lamp_max", "homedecor:standing_lamp_on")
|
minetest.register_alias("homedecor:standing_lamp_max", "homedecor:standing_lamp_14")
|
||||||
|
|
||||||
minetest.register_alias("homedecor:wall_lamp", "homedecor:wall_lamp_on")
|
minetest.register_alias("homedecor:wall_lamp", "homedecor:wall_lamp_14")
|
||||||
minetest.register_alias("homedecor:wall_lamp_max", "homedecor:wall_lamp_on")
|
minetest.register_alias("homedecor:wall_lamp_max", "homedecor:wall_lamp_14")
|
||||||
|
|
||||||
-- for old maps that had the original 3dforniture mod
|
minetest.register_alias("3dforniture:table_lamp", "homedecor:table_lamp_14")
|
||||||
minetest.register_alias("3dforniture:table_lamp", "homedecor:table_lamp_on")
|
minetest.register_alias("3dforniture:table_lamp_max", "homedecor:table_lamp_14")
|
||||||
|
|
||||||
minetest.register_alias("3dforniture:torch_wall", "homedecor:torch_wall")
|
minetest.register_alias("3dforniture:torch_wall", "homedecor:torch_wall")
|
||||||
minetest.register_alias("torch_wall", "homedecor:torch_wall")
|
minetest.register_alias("torch_wall", "homedecor:torch_wall")
|
||||||
|
|
||||||
if minetest.get_modpath("darkage") then
|
for name, level in pairs(word_to_bright) do
|
||||||
minetest.register_alias("homedecor:lattice_lantern_large_off", "darkage:lamp")
|
minetest.register_alias("homedecor:glowlight_half_"..name, "homedecor:glowlight_half_"..level)
|
||||||
minetest.register_alias("homedecor:lattice_lantern_large_low", "darkage:lamp")
|
minetest.register_alias("homedecor:glowlight_quarter_"..name, "homedecor:glowlight_quarter_"..level)
|
||||||
minetest.register_alias("homedecor:lattice_lantern_large_med", "darkage:lamp")
|
minetest.register_alias("homedecor:glowlight_small_cube_"..name, "homedecor:glowlight_small_cube_"..level)
|
||||||
minetest.register_alias("homedecor:lattice_lantern_large_hi", "darkage:lamp")
|
minetest.register_alias("homedecor:rope_light_on_floor_"..name, "homedecor:rope_light_on_floor_"..level)
|
||||||
minetest.register_alias("homedecor:lattice_lantern_large_max", "darkage:lamp")
|
minetest.register_alias("homedecor:rope_light_on_ceiling_"..name, "homedecor:rope_light_on_ceiling_"..level)
|
||||||
minetest.register_alias("homedecor:lattice_lantern_large_on", "darkage:lamp")
|
minetest.register_alias("homedecor:plasma_lamp_"..name, "homedecor:plasma_lamp_"..level)
|
||||||
minetest.register_alias("homedecor:lattice_lantern_large", "darkage:lamp")
|
minetest.register_alias("homedecor:plasma_ball_"..name, "homedecor:plasma_ball_"..level)
|
||||||
|
minetest.register_alias("homedecor:ground_lantern_"..name, "homedecor:ground_lantern_"..level)
|
||||||
|
minetest.register_alias("homedecor:hanging_lantern_"..name, "homedecor:hanging_lantern_"..level)
|
||||||
|
minetest.register_alias("homedecor:ceiling_lantern_"..name, "homedecor:ceiling_lantern_"..level)
|
||||||
|
minetest.register_alias("homedecor:lattice_lantern_large_"..name, "homedecor:lattice_lantern_large_"..level)
|
||||||
|
minetest.register_alias("homedecor:lattice_lantern_small_"..name, "homedecor:lattice_lantern_small_"..level)
|
||||||
|
minetest.register_alias("homedecor:desk_lamp_"..name, "homedecor:desk_lamp_"..level)
|
||||||
|
minetest.register_alias("homedecor:ceiling_lamp_"..name, "homedecor:ceiling_lamp_"..level)
|
||||||
|
minetest.register_alias("homedecor:table_lamp_"..name, "homedecor:table_lamp_"..level)
|
||||||
|
minetest.register_alias("homedecor:standing_lamp_"..name, "homedecor:standing_lamp_"..level)
|
||||||
|
minetest.register_alias("homedecor:wall_lamp_"..name, "homedecor:wall_lamp_"..level)
|
||||||
|
minetest.register_alias("3dforniture:table_lamp_"..name, "homedecor:table_lamp_"..level)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if minetest.get_modpath("darkage") then
|
||||||
|
minetest.register_alias("homedecor:lattice_lantern_large", "darkage:lamp")
|
||||||
|
for n = 0, 14 do
|
||||||
|
minetest.register_alias("homedecor:lattice_lantern_large_"..n, "darkage:lamp")
|
||||||
|
end
|
||||||
|
for name, level in pairs(word_to_bright) do
|
||||||
|
minetest.register_alias("homedecor:lattice_lantern_large_"..name, "darkage:lamp")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user