1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-10-31 23:40:27 +01:00
homedecor_modpack/homedecor/lighting.lua

359 lines
10 KiB
Lua
Raw Normal View History

-- This file supplies glowlights
2013-11-10 02:52:01 +01:00
local dirs1 = { 20, 23, 22, 21 }
local dirs2 = { 9, 18, 7, 12 }
local S = homedecor.gettext
2013-03-05 08:18:56 +01:00
local colors = {"yellow","white"}
for i in ipairs(colors) do
local color = colors[i]
minetest.register_abm({
nodenames = { "homedecor:glowlight_thin_"..color },
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.add_node(pos, {name = "homedecor:glowlight_quarter_"..color, param2 = 20})
end,
})
minetest.register_abm({
nodenames = { "homedecor:glowlight_thick_"..color },
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.add_node(pos, {name = "homedecor:glowlight_half_"..color, param2 = 20})
end,
})
minetest.register_abm({
nodenames = { "homedecor:glowlight_thin_"..color.."_wall" },
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local fdir = node.param2 or 0
nfdir = dirs2[fdir+1]
minetest.add_node(pos, {name = "homedecor:glowlight_quarter_"..color, param2 = nfdir})
end,
})
minetest.register_abm({
nodenames = { "homedecor:glowlight_thick_"..color.."_wall" },
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local fdir = node.param2 or 0
nfdir = dirs2[fdir+1]
minetest.add_node(pos, {name = "homedecor:glowlight_half_"..color, param2 = nfdir})
end,
})
minetest.register_abm({
nodenames = { "homedecor:glowlight_small_cube_"..color.."_ceiling" },
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.add_node(pos, {name = "homedecor:glowlight_small_cube_"..color, param2 = 20})
end,
})
end
-- Yellow
minetest.register_node('homedecor:glowlight_half_yellow', {
2013-03-05 08:18:56 +01:00
description = S("Yellow Glowlight (thick)"),
drawtype = "nodebox",
tiles = {
'homedecor_glowlight_yellow_top.png',
'homedecor_glowlight_yellow_bottom.png',
'homedecor_glowlight_thick_yellow_sides.png',
'homedecor_glowlight_thick_yellow_sides.png',
'homedecor_glowlight_thick_yellow_sides.png',
'homedecor_glowlight_thick_yellow_sides.png'
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
},
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
},
sunlight_propagates = false,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
groups = { snappy = 3 },
light_source = LIGHT_MAX,
2013-03-17 00:46:30 +01:00
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
minetest.register_node('homedecor:glowlight_quarter_yellow', {
2013-03-05 08:18:56 +01:00
description = S("Yellow Glowlight (thin)"),
drawtype = "nodebox",
tiles = {
'homedecor_glowlight_yellow_top.png',
'homedecor_glowlight_yellow_bottom.png',
'homedecor_glowlight_thin_yellow_sides.png',
'homedecor_glowlight_thin_yellow_sides.png',
'homedecor_glowlight_thin_yellow_sides.png',
'homedecor_glowlight_thin_yellow_sides.png'
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
},
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
},
sunlight_propagates = false,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
groups = { snappy = 3 },
light_source = LIGHT_MAX-1,
2013-03-17 00:46:30 +01:00
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
-- White
minetest.register_node('homedecor:glowlight_half_white', {
2013-03-05 08:18:56 +01:00
description = S("White Glowlight (thick)"),
drawtype = "nodebox",
tiles = {
'homedecor_glowlight_white_top.png',
'homedecor_glowlight_white_bottom.png',
'homedecor_glowlight_thick_white_sides.png',
'homedecor_glowlight_thick_white_sides.png',
'homedecor_glowlight_thick_white_sides.png',
'homedecor_glowlight_thick_white_sides.png'
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
},
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
},
sunlight_propagates = false,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
groups = { snappy = 3 },
light_source = LIGHT_MAX,
2013-03-17 00:46:30 +01:00
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
minetest.register_node('homedecor:glowlight_quarter_white', {
2013-03-05 08:18:56 +01:00
description = S("White Glowlight (thin)"),
drawtype = "nodebox",
tiles = {
'homedecor_glowlight_white_top.png',
'homedecor_glowlight_white_bottom.png',
'homedecor_glowlight_thin_white_sides.png',
'homedecor_glowlight_thin_white_sides.png',
'homedecor_glowlight_thin_white_sides.png',
'homedecor_glowlight_thin_white_sides.png'
},
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
},
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
},
sunlight_propagates = false,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
groups = { snappy = 3 },
light_source = LIGHT_MAX-1,
2013-03-17 00:46:30 +01:00
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
-- Glowlight "cubes"
minetest.register_node('homedecor:glowlight_small_cube_yellow', {
description = S("Yellow Glowlight (small cube)"),
drawtype = "nodebox",
tiles = {
'homedecor_glowlight_cube_yellow_tb.png',
'homedecor_glowlight_cube_yellow_tb.png',
'homedecor_glowlight_cube_yellow_sides.png',
'homedecor_glowlight_cube_yellow_sides.png',
'homedecor_glowlight_cube_yellow_sides.png',
'homedecor_glowlight_cube_yellow_sides.png'
},
selection_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
},
node_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
},
sunlight_propagates = false,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
groups = { snappy = 3 },
light_source = LIGHT_MAX-1,
2013-03-17 00:46:30 +01:00
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
minetest.register_node('homedecor:glowlight_small_cube_white', {
2013-03-05 08:18:56 +01:00
description = S("White Glowlight (small cube)"),
drawtype = "nodebox",
tiles = {
'homedecor_glowlight_cube_white_tb.png',
'homedecor_glowlight_cube_white_tb.png',
'homedecor_glowlight_cube_white_sides.png',
'homedecor_glowlight_cube_white_sides.png',
'homedecor_glowlight_cube_white_sides.png',
'homedecor_glowlight_cube_white_sides.png'
},
selection_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
},
node_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
},
sunlight_propagates = false,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
groups = { snappy = 3 },
light_source = LIGHT_MAX-1,
2013-03-17 00:46:30 +01:00
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
2014-06-29 18:49:35 +02:00
minetest.register_node("homedecor:plasma_lamp", {
description = "Plasma Lamp",
drawtype = "glasslike_framed",
tiles = {"homedecor_gold_block.png","homedecor_glass_face_clean.png"},
special_tiles = {
{
name="homedecor_plasma_storm.png",
animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0},
}
},
-- use_texture_alpha = true,
paramtype = "light",
light_source = LIGHT_MAX - 1,
sunlight_propagates = true,
groups = {cracky=3,oddly_breakable_by_hand=3},
sounds = default.node_sound_glass_defaults(),
after_place_node = function(pos, placer, itemstack, pointed_thing)
minetest.swap_node(pos, {name = "homedecor:plasma_lamp", param2 = 255})
end
})
2014-07-27 17:52:42 +02:00
minetest.register_node('homedecor:candle', {
description = S("Candle"),
drawtype = "nodebox",
tiles = {
'homedecor_candle_top.png',
'homedecor_candle_bottom.png',
{name="homedecor_candle_sides.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
},
node_box = {
type = "fixed",
fixed = {
{ -0.125, -0.5, -0.125, 0.125, 0, 0.125 },
{ -0.125, 0, 0, 0.125, 0.5, 0 },
{ 0, 0, -0.125, 0, 0.5, 0.125 }
}
},
selection_box = {
type = "fixed",
fixed = {
{ -0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875 },
}
},
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
groups = { snappy = 3 },
light_source = LIGHT_MAX-4,
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node('homedecor:oil_lamp', {
description = S("Oil lamp"),
drawtype = "plantlike",
tiles = { 'homedecor_oil_lamp.png' },
inventory_image = 'homedecor_oil_lamp.png',
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
selection_box = {
type = "fixed",
fixed = {
{ -0.3, -0.5, -0.3, 0.3, 0.5, 0.3 },
}
},
groups = { snappy = 3 },
light_source = LIGHT_MAX-4,
sounds = default.node_sound_wood_defaults(),
})
2014-07-27 21:15:47 +02:00
minetest.register_node('homedecor:lattice_lantern_large', {
description = S("Lattice lantern (large)"),
tiles = { 'homedecor_lattice_lantern_large.png' },
sunlight_propagates = false,
paramtype = "light",
walkable = true,
groups = { snappy = 3 },
light_source = LIGHT_MAX,
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node('homedecor:lattice_lantern_small', {
description = S("Lattice lantern (small)"),
drawtype = "nodebox",
tiles = {
'homedecor_lattice_lantern_small_tb.png',
'homedecor_lattice_lantern_small_tb.png',
'homedecor_lattice_lantern_small_sides.png'
},
selection_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
},
node_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
},
sunlight_propagates = false,
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
groups = { snappy = 3 },
light_source = LIGHT_MAX-1,
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})