2012-10-02 01:22:54 +02:00
|
|
|
|
|
|
|
-- This file supplies glowlights
|
|
|
|
|
2013-11-10 02:52:01 +01:00
|
|
|
local dirs1 = { 20, 23, 22, 21 }
|
|
|
|
local dirs2 = { 9, 18, 7, 12 }
|
|
|
|
|
2013-10-22 02:31:54 +02:00
|
|
|
local S = homedecor.gettext
|
2013-03-05 08:18:56 +01:00
|
|
|
|
2013-04-24 18:30:21 +02: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)
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.add_node(pos, {name = "homedecor:glowlight_quarter_"..color, param2 = 20})
|
2013-04-24 18:30:21 +02:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = { "homedecor:glowlight_thick_"..color },
|
|
|
|
interval = 1,
|
|
|
|
chance = 1,
|
|
|
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.add_node(pos, {name = "homedecor:glowlight_half_"..color, param2 = 20})
|
2013-04-24 18:30:21 +02:00
|
|
|
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]
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.add_node(pos, {name = "homedecor:glowlight_quarter_"..color, param2 = nfdir})
|
2013-04-24 18:30:21 +02:00
|
|
|
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]
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.add_node(pos, {name = "homedecor:glowlight_half_"..color, param2 = nfdir})
|
2013-04-24 18:30:21 +02:00
|
|
|
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)
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.add_node(pos, {name = "homedecor:glowlight_small_cube_"..color, param2 = 20})
|
2013-04-24 18:30:21 +02:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2012-10-02 01:22:54 +02:00
|
|
|
-- Yellow
|
|
|
|
|
2013-04-24 18:30:21 +02:00
|
|
|
minetest.register_node('homedecor:glowlight_half_yellow', {
|
2013-03-05 08:18:56 +01:00
|
|
|
description = S("Yellow Glowlight (thick)"),
|
2012-10-02 01:22:54 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
tiles = {
|
2013-07-01 06:51:18 +02:00
|
|
|
'homedecor_glowlight_yellow_top.png',
|
|
|
|
'homedecor_glowlight_yellow_bottom.png',
|
2012-10-02 01:22:54 +02:00
|
|
|
'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",
|
2013-04-24 18:30:21 +02:00
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
2012-10-02 01:22:54 +02:00
|
|
|
},
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
2013-04-24 18:30:21 +02:00
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
2012-10-02 01:22:54 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
sunlight_propagates = false,
|
|
|
|
paramtype = "light",
|
2013-04-24 18:30:21 +02:00
|
|
|
paramtype2 = "facedir",
|
2012-10-02 01:22:54 +02:00
|
|
|
walkable = true,
|
|
|
|
groups = { snappy = 3 },
|
|
|
|
light_source = LIGHT_MAX,
|
2013-03-17 00:46:30 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2014-01-30 20:09:46 +01:00
|
|
|
on_place = minetest.rotate_node
|
2012-10-02 01:22:54 +02:00
|
|
|
})
|
|
|
|
|
2013-04-24 18:30:21 +02:00
|
|
|
minetest.register_node('homedecor:glowlight_quarter_yellow', {
|
2013-03-05 08:18:56 +01:00
|
|
|
description = S("Yellow Glowlight (thin)"),
|
2012-10-02 01:22:54 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
tiles = {
|
2013-07-01 06:51:18 +02:00
|
|
|
'homedecor_glowlight_yellow_top.png',
|
|
|
|
'homedecor_glowlight_yellow_bottom.png',
|
2012-10-02 01:22:54 +02:00
|
|
|
'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",
|
2013-04-24 18:30:21 +02:00
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
2012-10-02 01:22:54 +02:00
|
|
|
},
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
2013-04-24 18:30:21 +02:00
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
2012-10-02 01:22:54 +02:00
|
|
|
},
|
|
|
|
|
2012-10-04 00:53:17 +02:00
|
|
|
sunlight_propagates = false,
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
walkable = true,
|
2012-10-02 01:22:54 +02:00
|
|
|
groups = { snappy = 3 },
|
|
|
|
light_source = LIGHT_MAX-1,
|
2013-03-17 00:46:30 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2014-01-30 20:09:46 +01:00
|
|
|
on_place = minetest.rotate_node
|
2012-10-02 01:22:54 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
-- White
|
|
|
|
|
2013-04-24 18:30:21 +02:00
|
|
|
minetest.register_node('homedecor:glowlight_half_white', {
|
2013-03-05 08:18:56 +01:00
|
|
|
description = S("White Glowlight (thick)"),
|
2012-10-02 01:22:54 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
tiles = {
|
2013-07-01 06:51:18 +02:00
|
|
|
'homedecor_glowlight_white_top.png',
|
|
|
|
'homedecor_glowlight_white_bottom.png',
|
2012-10-02 01:22:54 +02:00
|
|
|
'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",
|
2013-04-24 18:30:21 +02:00
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
2012-10-02 01:22:54 +02:00
|
|
|
},
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
2013-04-24 18:30:21 +02:00
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
2012-10-02 01:22:54 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
sunlight_propagates = false,
|
|
|
|
paramtype = "light",
|
2013-04-24 18:30:21 +02:00
|
|
|
paramtype2 = "facedir",
|
2012-10-02 01:22:54 +02:00
|
|
|
walkable = true,
|
|
|
|
groups = { snappy = 3 },
|
|
|
|
light_source = LIGHT_MAX,
|
2013-03-17 00:46:30 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2014-01-30 20:09:46 +01:00
|
|
|
on_place = minetest.rotate_node
|
2012-10-02 01:22:54 +02:00
|
|
|
})
|
|
|
|
|
2013-04-24 18:30:21 +02:00
|
|
|
minetest.register_node('homedecor:glowlight_quarter_white', {
|
2013-03-05 08:18:56 +01:00
|
|
|
description = S("White Glowlight (thin)"),
|
2012-10-02 01:22:54 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
tiles = {
|
2013-07-01 06:51:18 +02:00
|
|
|
'homedecor_glowlight_white_top.png',
|
|
|
|
'homedecor_glowlight_white_bottom.png',
|
2012-10-02 01:22:54 +02:00
|
|
|
'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",
|
2013-04-24 18:30:21 +02:00
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
2012-10-02 01:22:54 +02:00
|
|
|
},
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
2013-04-24 18:30:21 +02:00
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
2012-10-02 01:22:54 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
sunlight_propagates = false,
|
|
|
|
paramtype = "light",
|
2013-04-24 18:30:21 +02:00
|
|
|
paramtype2 = "facedir",
|
2012-10-02 01:22:54 +02:00
|
|
|
walkable = true,
|
|
|
|
groups = { snappy = 3 },
|
|
|
|
light_source = LIGHT_MAX-1,
|
2013-03-17 00:46:30 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2014-01-30 20:09:46 +01:00
|
|
|
on_place = minetest.rotate_node
|
2012-10-02 01:22:54 +02:00
|
|
|
})
|
|
|
|
|
2013-04-24 18:30:21 +02:00
|
|
|
-- Glowlight "cubes"
|
|
|
|
|
|
|
|
minetest.register_node('homedecor:glowlight_small_cube_yellow', {
|
|
|
|
description = S("Yellow Glowlight (small cube)"),
|
2012-10-04 00:53:17 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
tiles = {
|
2013-04-24 18:30:21 +02:00
|
|
|
'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'
|
2012-10-04 00:53:17 +02:00
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2013-04-24 18:30:21 +02:00
|
|
|
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
2012-10-04 00:53:17 +02:00
|
|
|
},
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
2013-04-24 18:30:21 +02:00
|
|
|
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
2012-10-04 00:53:17 +02:00
|
|
|
},
|
2013-04-24 18:30:21 +02:00
|
|
|
|
2012-10-04 00:53:17 +02:00
|
|
|
sunlight_propagates = false,
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
walkable = true,
|
2013-04-24 18:30:21 +02:00
|
|
|
groups = { snappy = 3 },
|
2012-10-04 00:53:17 +02:00
|
|
|
light_source = LIGHT_MAX-1,
|
2013-03-17 00:46:30 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2014-01-30 20:09:46 +01:00
|
|
|
on_place = minetest.rotate_node
|
2012-10-04 00:53:17 +02:00
|
|
|
})
|
|
|
|
|
2012-10-02 01:22:54 +02:00
|
|
|
minetest.register_node('homedecor:glowlight_small_cube_white', {
|
2013-03-05 08:18:56 +01:00
|
|
|
description = S("White Glowlight (small cube)"),
|
2012-10-02 01:22:54 +02:00
|
|
|
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",
|
2013-04-24 18:30:21 +02:00
|
|
|
paramtype2 = "facedir",
|
2012-10-02 01:22:54 +02:00
|
|
|
walkable = true,
|
|
|
|
groups = { snappy = 3 },
|
|
|
|
light_source = LIGHT_MAX-1,
|
2013-03-17 00:46:30 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
2014-01-30 20:09:46 +01:00
|
|
|
on_place = minetest.rotate_node
|
2012-10-02 01:22:54 +02:00
|
|
|
})
|
2012-10-02 03:06:10 +02:00
|
|
|
|
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', {
|
2014-09-23 14:20:34 +02:00
|
|
|
description = S("Thick Candle"),
|
2014-07-27 17:52:42 +02:00
|
|
|
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(),
|
|
|
|
})
|
|
|
|
|
2014-09-22 08:40:03 +02:00
|
|
|
minetest.register_node('homedecor:candle_thin', {
|
2014-09-23 14:20:34 +02:00
|
|
|
description = S("Thin Candle"),
|
2014-09-22 08:40:03 +02:00
|
|
|
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.0625, -0.5, -0.0625, 0.0625, 0, 0.0625 },
|
|
|
|
{ -0.125, 0, 0, 0.125, 0.5, 0 },
|
|
|
|
{ 0, 0, -0.125, 0, 0.5, 0.125 }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{ -0.125, -0.5, -0.125, 0.125, 0.35, 0.125 },
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sunlight_propagates = true,
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
walkable = true,
|
|
|
|
groups = { snappy = 3 },
|
|
|
|
light_source = LIGHT_MAX-4,
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
})
|
|
|
|
|
2014-07-27 17:52:42 +02:00
|
|
|
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
|
|
|
|
})
|
|
|
|
|
2014-09-30 16:40:36 +02:00
|
|
|
local repl = { off="low", low="med", med="hi", hi="max", max="off", }
|
|
|
|
local lamp_colors = { "", "blue", "green", "pink", "red", "violet" }
|
|
|
|
|
2014-09-30 16:53:10 +02:00
|
|
|
local function reg_lamp(suffix, nxt, tilesuffix, light, color)
|
2014-09-30 16:40:36 +02:00
|
|
|
local lampcolor = "_"..color
|
2014-09-30 16:58:46 +02:00
|
|
|
local standingcolor = "_"..color
|
2014-09-30 16:53:10 +02:00
|
|
|
local colordesc = " ("..color..")"
|
|
|
|
if color == "" then
|
|
|
|
lampcolor = ""
|
2014-09-30 16:58:46 +02:00
|
|
|
standingcolor = "_white"
|
2014-09-30 16:53:10 +02:00
|
|
|
colordesc = " (white)"
|
|
|
|
end
|
2014-09-30 16:40:36 +02:00
|
|
|
minetest.register_node("homedecor:table_lamp"..lampcolor.."_"..suffix, {
|
2014-09-30 16:53:10 +02:00
|
|
|
description = S("Table Lamp "..colordesc),
|
2014-09-30 16:40:36 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
tiles = {
|
|
|
|
"forniture_table_lamp_s"..tilesuffix..".png",
|
|
|
|
"forniture_table_lamp_s"..tilesuffix..".png",
|
|
|
|
"forniture_table_lamp"..lampcolor.."_l"..tilesuffix..".png",
|
|
|
|
},
|
|
|
|
paramtype = "light",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{ -0.1500, -0.500, -0.1500, 0.1500, -0.45, 0.1500 },
|
|
|
|
{ -0.0500, -0.450, -0.0500, 0.0500, -0.40, 0.0500 },
|
|
|
|
{ -0.0250, -0.400, -0.0250, 0.0250, -0.10, 0.0250 },
|
|
|
|
{ -0.0125, -0.125, -0.2000, 0.0125, -0.10, 0.2000 },
|
|
|
|
{ -0.2000, -0.125, -0.0125, 0.2000, -0.10, 0.0125 },
|
|
|
|
{ -0.2000, -0.100, -0.2000, -0.1750, 0.30, 0.2000 },
|
|
|
|
{ 0.1750, -0.100, -0.2000, 0.2000, 0.30, 0.2000 },
|
|
|
|
{ -0.1750, -0.100, -0.2000, 0.1750, 0.30, -0.1750 },
|
|
|
|
{ -0.1750, -0.100, 0.1750, 0.1750, 0.30, 0.2000 },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
walkable = false,
|
|
|
|
light_source = light,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.2, -0.5, -0.2, 0.2, 0.30, 0.2 },
|
|
|
|
},
|
|
|
|
groups = {cracky=2,oddly_breakable_by_hand=1,
|
2014-09-30 16:53:10 +02:00
|
|
|
not_in_creative_inventory=((light ~= nil) and 1) or nil,
|
2014-09-30 16:40:36 +02:00
|
|
|
},
|
|
|
|
drop = "homedecor:table_lamp"..lampcolor.."_off",
|
|
|
|
on_punch = function(pos, node, puncher)
|
|
|
|
node.name = "homedecor:table_lamp"..lampcolor.."_"..repl[suffix]
|
|
|
|
minetest.set_node(pos, node)
|
|
|
|
nodeupdate(pos)
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
if lampcolor == "" then
|
|
|
|
minetest.register_alias("3dforniture:table_lamp_"..suffix, "homedecor:table_lamp_"..suffix)
|
|
|
|
end
|
|
|
|
|
2014-09-30 16:53:10 +02:00
|
|
|
-- standing lamps
|
|
|
|
|
2014-09-30 16:40:36 +02:00
|
|
|
minetest.register_node("homedecor:standing_lamp_bottom"..lampcolor.."_"..suffix, {
|
2014-09-30 16:53:10 +02:00
|
|
|
description = S("Standing Lamp"..colordesc),
|
2014-09-30 16:40:36 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
tiles = {
|
|
|
|
"forniture_table_lamp_s"..tilesuffix..".png",
|
|
|
|
"homedecor_standing_lamp_bottom_sides.png",
|
|
|
|
},
|
2014-09-30 16:58:46 +02:00
|
|
|
inventory_image = "homedecor_standing_lamp"..standingcolor.."_inv.png",
|
2014-09-30 16:40:36 +02:00
|
|
|
paramtype = "light",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{ -0.1500, -0.500, -0.1500, 0.1500, -0.45, 0.1500 },
|
|
|
|
{ -0.0500, -0.450, -0.0500, 0.0500, -0.40, 0.0500 },
|
|
|
|
{ -0.0250, -0.400, -0.0250, 0.0250, 0.50, 0.0250 },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
walkable = false,
|
|
|
|
light_source = light,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { 0, 0, 0, 0, 0, 0}
|
|
|
|
},
|
2014-09-30 16:53:10 +02:00
|
|
|
groups = {cracky=2,oddly_breakable_by_hand=1,
|
|
|
|
not_in_creative_inventory=((light ~= nil) and 1) or nil,
|
|
|
|
},
|
2014-09-30 16:40:36 +02:00
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
|
|
|
|
"homedecor:standing_lamp_bottom"..lampcolor.."_"..suffix, "homedecor:standing_lamp_top"..lampcolor.."_"..suffix)
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("homedecor:standing_lamp_top"..lampcolor.."_"..suffix, {
|
|
|
|
drawtype = "nodebox",
|
|
|
|
tiles = {
|
|
|
|
"forniture_table_lamp_s"..tilesuffix..".png",
|
2014-10-14 09:27:19 +02:00
|
|
|
"forniture_table_lamp_s"..tilesuffix..".png",
|
|
|
|
"forniture_standing_lamp"..lampcolor.."_l"..tilesuffix..".png"
|
2014-09-30 16:40:36 +02:00
|
|
|
},
|
|
|
|
paramtype = "light",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{ -0.0250, -0.500, -0.0250, 0.0250, 0.10, 0.0250 },
|
|
|
|
{ -0.0125, 0.0625, -0.2000, 0.0125, 0.10, 0.2000 },
|
|
|
|
{ -0.2000, 0.0625, -0.0125, 0.2000, 0.10, 0.0125 },
|
|
|
|
{ -0.2000, 0.100, -0.2000, -0.1750, 0.50, 0.2000 },
|
|
|
|
{ 0.1750, 0.100, -0.2000, 0.2000, 0.50, 0.2000 },
|
|
|
|
{ -0.1750, 0.100, -0.2000, 0.1750, 0.50, -0.1750 },
|
|
|
|
{ -0.1750, 0.100, 0.1750, 0.1750, 0.50, 0.2000 },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
walkable = false,
|
|
|
|
light_source = light,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.2, -1.5, -0.2, 0.2, 0.5, 0.2 },
|
|
|
|
},
|
|
|
|
groups = {snappy=3, not_in_creative_inventory=1},
|
|
|
|
on_punch = function(pos, node, puncher)
|
|
|
|
node.name = "homedecor:standing_lamp_top"..lampcolor.."_"..repl[suffix]
|
|
|
|
minetest.set_node(pos, node)
|
|
|
|
nodeupdate(pos)
|
|
|
|
end,
|
|
|
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
|
|
local pos2 = { x = pos.x, y=pos.y - 1, z = pos.z }
|
|
|
|
if minetest.get_node(pos2).name == "homedecor:standing_lamp_bottom"..lampcolor.."_off" then
|
|
|
|
minetest.remove_node(pos2)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
drop = "homedecor:standing_lamp_bottom"..lampcolor.."_off"
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
for _, color in ipairs(lamp_colors) do
|
2014-09-30 16:53:10 +02:00
|
|
|
reg_lamp("off", "low", "", nil, color )
|
|
|
|
reg_lamp("low", "med", "l", 3, color )
|
|
|
|
reg_lamp("med", "hi", "m", 7, color )
|
|
|
|
reg_lamp("hi", "max", "h", 11, color )
|
|
|
|
reg_lamp("max", "off", "x", 14, color )
|
2014-09-30 16:40:36 +02:00
|
|
|
end
|