1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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 Smithy 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 = 'Lantern effects',
- nodenames = {'furniture:lantern_ceiling'},
- interval = 13,
- chance = 7,
- action = function(pos, node)
- particles_lantern(pos)
- local objs = minetest.get_objects_inside_radius(pos, 4)
- for _, obj in pairs(objs) do
- if obj:is_player() then
- local name = obj:get_player_name()
- local hunger = tonumber(hbhunger.hunger[name]) + 6
- hbhunger.hunger[name] = math.min(30, hunger)
- hbhunger.set_hunger_raw(obj)
- end
- end
- end
- })
|