Light nodes, and a barrier.

4 different basic lights: off, and 3 intensities.
one broken light that will flicker (nodetimer based)
This commit is contained in:
Auke Kok 2017-01-27 23:54:01 -08:00
parent cf168c7ab1
commit 3eff367968
3 changed files with 79 additions and 0 deletions

View File

@ -108,6 +108,85 @@ for _, v in pairs(nodes) do
end
-- barrier
minetest.register_node("nodes:barrier", {
description = "Barrier",
pointable = true, -- make it easy to understand that it's a barrier
drawtype = "allfaces_optional",
tiles = {"itb_blank.png"},
sunlight_propagates = true,
paramtype = "light",
collision_box = {
type = "fixed",
-- oversized to prevent crawling through
fixed = {-1,-1,-1,1,1,1},
},
})
-- light fixtures
for _, v in pairs({14, 11, 8, 0}) do
minetest.register_node("nodes:lamp_bar_" .. v, {
description = "A Lamp (" .. v .. ")",
light_source = v,
sunlight_propagates = true,
tiles = {"lamp_bar.png"},
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {-1, 1/4, 1/4, 1, 1/2, 1/2},
},
groups = {node = 1},
on_rotate = screwdriver.rotate_simple()
})
end
minetest.register_node("nodes:lamp_bar_broken", {
description = "A Broken Lamp (flickering)",
light_source = 8,
sunlight_propagates = true,
tiles = {"lamp_bar.png"},
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {-1, 1/4, 1/4, 1, 1/2, 1/2},
},
groups = {node = 1},
on_rotate = screwdriver.rotate_simple(),
on_timer = function(pos)
local node = minetest.get_node(pos)
minetest.set_node(pos, {name = "nodes:lamp_bar_broken_off", param2 = node.param2})
end,
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(50)/10)
end,
})
minetest.register_node("nodes:lamp_bar_broken_off", {
description = "A Broken Lamp (flickering, off)",
sunlight_propagates = true,
tiles = {"lamp_bar.png"},
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {-1, 1/4, 1/4, 1, 1/2, 1/2},
},
groups = {node = 1},
on_rotate = screwdriver.rotate_simple(),
on_timer = function(pos)
local node = minetest.get_node(pos)
minetest.set_node(pos, {name = "nodes:lamp_bar_broken", param2 = node.param2})
end,
on_construct = function(pos)
minetest.get_node_timer(pos):start(math.random(50)/10)
end,
})
-- panes
-- iron_pane
-- glass_pane

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B