lighting.lua 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. local function particles_lantern(pos)
  2. minetest.add_particlespawner({
  3. amount = 48,
  4. time = 4,
  5. minpos = {x=pos.x - 0.25, y=pos.y, z=pos.z - 0.25},
  6. maxpos = {x=pos.x + 0.25, y=pos.y + 0.25, z=pos.z + 0.25},
  7. minvel = {x=-.3, y=-.03, z=-.3}, maxvel = {x=.3, y=.05, z=.3},
  8. minacc = {x=-.1, y=.02, z=-.1}, maxacc = {x=.1, y=.02, z=.1},
  9. minexptime = 1, maxexptime = 3,
  10. minsize = 1, maxsize = 2,
  11. collisiondetection = false,
  12. texture = 'furniture_lantern_particle.png',
  13. glow = 10,
  14. })
  15. end
  16. minetest.register_node('furniture:lantern_ceiling', {
  17. --_doc_items_crafting = 'This is crafted in the Woodworking Station.',
  18. description = 'Ceiling Lantern',
  19. drawtype = 'mesh',
  20. mesh = 'furniture_lantern.obj',
  21. tiles = {'furniture_lantern.png'},
  22. paramtype = 'light',
  23. light_source = 14,
  24. walkable = false,
  25. paramtype2 = 'facedir',
  26. selection_box = {
  27. type = 'fixed',
  28. fixed = {-.375, 0, -.375, .375, 0.5, .375},
  29. },
  30. collision_box = {
  31. type = 'fixed',
  32. fixed = {-.375, 0, -.375, .375, 0.5, .375},
  33. },
  34. groups = {oddly_breakable_by_hand = 2, cracky=3},
  35. on_rightclick = function(pos)
  36. particles_lantern(pos)
  37. end,
  38. })
  39. minetest.register_abm({
  40. label = 'Lanter effects',
  41. nodenames = {'furniture:lantern_ceiling'},
  42. interval = 13,
  43. chance = 7,
  44. action = function(pos, node)
  45. particles_lantern(pos)
  46. end
  47. })