lantern glow

This commit is contained in:
D00Med 2017-05-22 13:27:30 +10:00
parent c14532605e
commit 68151c9d11

View File

@ -83,20 +83,23 @@ minetest.register_node("decoblocks:lantern", {
}) })
minetest.register_abm({ minetest.register_abm({
nodenames = {"decoblocks:lantern"}, nodenames = {"decoblocks:lantern", "decoblocks:lantern_ceiling"},
interval = 5, interval = 5,
chance = 1, chance = 1,
action = function(pos, node) action = function(pos, node)
if minetest.get_timeofday() <= 0.6 and minetest.get_timeofday() >= 0.2 then
return
end
minetest.add_particle({ minetest.add_particle({
pos = {x=pos.x, y=pos.y, z=pos.z}, pos = {x=pos.x, y=pos.y, z=pos.z},
velocity = {x=0, y=0, z=0}, velocity = {x=0, y=0, z=0},
acceleration = {x=0, y=0, z=0}, acceleration = {x=0, y=0, z=0},
expirationtime = 5, expirationtime = 5,
size = 25, size = 15,
collisiondetection = false, collisiondetection = false,
collisionremoval = false, collisionremoval = false,
vertical = true, vertical = true,
texture = "decoblocks_glow.png", texture = "mapgen_glow.png",
animation = {type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = 2.00}, animation = {type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = 2.00},
glow = 9 glow = 9
}) })
@ -124,6 +127,31 @@ minetest.register_node("decoblocks:lantern_wall", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
minetest.register_abm({
nodenames = {"decoblocks:lantern_wall"},
interval = 5,
chance = 1,
action = function(pos, node)
if minetest.get_timeofday() <= 0.6 and minetest.get_timeofday() >= 0.2 then
return
end
local dir = minetest.facedir_to_dir(node.param2)
minetest.add_particle({
pos = {x=pos.x-0.35*dir.z, y=pos.y-0.1, z=pos.z-0.35*dir.x},
velocity = {x=0, y=0, z=0},
acceleration = {x=0, y=0, z=0},
expirationtime = 5,
size = 15,
collisiondetection = false,
collisionremoval = false,
vertical = true,
texture = "mapgen_glow.png",
animation = {type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = 0.20},
glow = 9
})
end
})
minetest.register_node("decoblocks:lantern_ceiling", { minetest.register_node("decoblocks:lantern_ceiling", {
drawtype = "mesh", drawtype = "mesh",
mesh = "lantern_ceiling.obj", mesh = "lantern_ceiling.obj",