nodes.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. local img = {"eye", "men", "sun"}
  2. for i=1,3 do
  3. minetest.register_node("pyramids:deco_stone"..i, {
  4. description = "Sandstone with "..img[i],
  5. tiles = {"default_sandstone.png^pyramids_"..img[i]..".png"},
  6. is_ground_content = true,
  7. groups = {crumbly=2,cracky=3},
  8. sounds = default.node_sound_stone_defaults(),
  9. })
  10. end
  11. trap_on_timer = function (pos, elapsed)
  12. local objs = minetest.get_objects_inside_radius(pos, 2)
  13. for i, obj in pairs(objs) do
  14. if obj:is_player() then
  15. local n = minetest.get_node(pos)
  16. if n and n.name then
  17. if minetest.registered_nodes[n.name].crack and minetest.registered_nodes[n.name].crack < 2 then
  18. minetest.set_node(pos, {name="pyramids:trap_2"})
  19. minetest.check_for_falling(pos)
  20. end
  21. end
  22. end
  23. end
  24. return true
  25. end
  26. minetest.register_node("pyramids:trap", {
  27. description = "Cracked sandstone brick",
  28. tiles = {"default_sandstone_brick.png^pyramids_crack.png"},
  29. is_ground_content = true,
  30. groups = {crumbly=2,cracky=3},
  31. sounds = default.node_sound_stone_defaults(),
  32. on_construct = function(pos)
  33. minetest.get_node_timer(pos):start(0.1)
  34. end,
  35. crack = 1,
  36. on_timer = trap_on_timer,
  37. drop = "",
  38. })
  39. minetest.register_node("pyramids:trap_2", {
  40. description = "trapstone",
  41. tiles = {"default_sandstone_brick.png^pyramids_crack.png^[transformR90"},
  42. is_ground_content = true,
  43. groups = {crumbly=2,cracky=3,falling_node=1,not_in_creative_inventory=1},
  44. sounds = default.node_sound_stone_defaults(),
  45. drop = "",
  46. })