furniture/lighting.lua

50 lines
1.4 KiB
Lua

local function particles_lantern(pos)
minetest.add_particlespawner({
amount = 48,
time = 4,
minpos = {x=pos.x - 0.25, y=pos.y, z=pos.z - 0.25},
maxpos = {x=pos.x + 0.25, y=pos.y + 0.25, z=pos.z + 0.25},
minvel = {x=-.3, y=-.03, z=-.3}, maxvel = {x=.3, y=.05, z=.3},
minacc = {x=-.1, y=.02, z=-.1}, maxacc = {x=.1, y=.02, z=.1},
minexptime = 1, maxexptime = 3,
minsize = 1, maxsize = 2,
collisiondetection = false,
texture = 'furniture_lantern_particle.png',
glow = 10,
})
end
minetest.register_node('furniture:lantern_ceiling', {
--_doc_items_crafting = 'This is crafted in the Woodworking Station.',
description = 'Ceiling Lantern',
drawtype = 'mesh',
mesh = 'furniture_lantern.obj',
tiles = {'furniture_lantern.png'},
paramtype = 'light',
light_source = 14,
walkable = false,
paramtype2 = 'facedir',
selection_box = {
type = 'fixed',
fixed = {-.375, 0, -.375, .375, 0.5, .375},
},
collision_box = {
type = 'fixed',
fixed = {-.375, 0, -.375, .375, 0.5, .375},
},
groups = {oddly_breakable_by_hand = 2, cracky=3},
on_rightclick = function(pos)
particles_lantern(pos)
end,
})
minetest.register_abm({
label = 'Lanter effects',
nodenames = {'furniture:lantern_ceiling'},
interval = 13,
chance = 7,
action = function(pos, node)
particles_lantern(pos)
end
})