forked from mtcontrib/homedecor_modpack
251 lines
7.2 KiB
Lua
251 lines
7.2 KiB
Lua
|
|
-- This file supplies glowlights
|
|
|
|
local dirs1 = { 20, 23, 22, 21 }
|
|
local dirs2 = { 9, 18, 7, 12 }
|
|
|
|
local S = homedecor.gettext
|
|
|
|
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', {
|
|
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,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
on_place = homedecor.protect_and_rotate
|
|
})
|
|
|
|
minetest.register_node('homedecor:glowlight_quarter_yellow', {
|
|
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,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
on_place = homedecor.protect_and_rotate
|
|
})
|
|
|
|
-- White
|
|
|
|
minetest.register_node('homedecor:glowlight_half_white', {
|
|
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,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
on_place = homedecor.protect_and_rotate
|
|
})
|
|
|
|
minetest.register_node('homedecor:glowlight_quarter_white', {
|
|
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,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
on_place = homedecor.protect_and_rotate
|
|
})
|
|
|
|
-- 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,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
on_place = homedecor.protect_and_rotate
|
|
})
|
|
|
|
minetest.register_node('homedecor:glowlight_small_cube_white', {
|
|
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,
|
|
sounds = default.node_sound_wood_defaults(),
|
|
on_place = homedecor.protect_and_rotate
|
|
})
|
|
|