other_blocks.lua 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. --------------------antracite torch-------------
  2. minetest.register_node("xtraores:antracite_torch", {
  3. description = "" ..core.colorize("#68fff6", "Antracite torch\n")..core.colorize("#FFFFFF", "range: 5\n")..core.colorize("#FFFFFF", "Can be placed"),
  4. drawtype = "mesh",
  5. range = 5.0,
  6. stack_max = 999,
  7. mesh = "torch_floor.obj",
  8. inventory_image = "xtraores_antracite_torch.png",
  9. wield_image = "xtraores_antracite_torch.png",
  10. tiles = {{
  11. name = "xtraores_antracite_torch_on_floor_animated.png",
  12. animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
  13. }},
  14. paramtype = "light",
  15. paramtype2 = "wallmounted",
  16. sunlight_propagates = true,
  17. walkable = false,
  18. liquids_pointable = false,
  19. light_source = 14,
  20. groups = {choppy=2, dig_immediate=3, attached_node=1, antracite_torch=1},
  21. drop = "xtraores:antracite_torch",
  22. selection_box = {
  23. type = "wallmounted",
  24. wall_bottom = {-1/8, -1/2, -1/8, 1/8, 2/16, 1/8},
  25. },
  26. sounds = default.node_sound_wood_defaults(),
  27. on_place = function(itemstack, placer, pointed_thing)
  28. local under = pointed_thing.under
  29. local node = minetest.get_node(under)
  30. local def = minetest.registered_nodes[node.name]
  31. if def and def.on_rightclick and
  32. ((not placer) or (placer and not placer:get_player_control().sneak)) then
  33. return def.on_rightclick(under, node, placer, itemstack,
  34. pointed_thing) or itemstack
  35. end
  36. local above = pointed_thing.above
  37. local wdir = minetest.dir_to_wallmounted(vector.subtract(under, above))
  38. local fakestack = itemstack
  39. if wdir == 0 then
  40. fakestack:set_name("xtraores:antracite_torch_ceiling")
  41. elseif wdir == 1 then
  42. fakestack:set_name("xtraores:antracite_torch")
  43. else
  44. fakestack:set_name("xtraores:antracite_torch_wall")
  45. end
  46. itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir)
  47. itemstack:set_name("xtraores:antracite_torch")
  48. return itemstack
  49. end
  50. })
  51. minetest.register_node("xtraores:antracite_torch_wall", {
  52. drawtype = "mesh",
  53. mesh = "torch_wall.obj",
  54. tiles = {{
  55. name = "xtraores_antracite_torch_on_floor_animated.png",
  56. animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
  57. }},
  58. paramtype = "light",
  59. paramtype2 = "wallmounted",
  60. sunlight_propagates = true,
  61. walkable = false,
  62. light_source = 14,
  63. groups = {choppy=2, dig_immediate=3, not_in_creative_inventory=1, attached_node=1, antracite_torch=1},
  64. drop = "xtraores:antracite_torch",
  65. selection_box = {
  66. type = "wallmounted",
  67. wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8},
  68. },
  69. sounds = default.node_sound_wood_defaults(),
  70. })
  71. minetest.register_node("xtraores:antracite_torch_ceiling", {
  72. drawtype = "mesh",
  73. mesh = "torch_ceiling.obj",
  74. tiles = {{
  75. name = "xtraores_antracite_torch_on_floor_animated.png",
  76. animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
  77. }},
  78. paramtype = "light",
  79. paramtype2 = "wallmounted",
  80. sunlight_propagates = true,
  81. walkable = false,
  82. light_source = 14,
  83. groups = {choppy=2, dig_immediate=3, not_in_creative_inventory=1, attached_node=1, antracite_torch=1},
  84. drop = "xtraores:antracite_torch",
  85. selection_box = {
  86. type = "wallmounted",
  87. wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8},
  88. },
  89. sounds = default.node_sound_wood_defaults(),
  90. })