init.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. snow_bricks = snow_bricks or {}
  2. snow_bricks.modpath = minetest.get_modpath("snow_bricks")
  3. minetest.register_node("snow_bricks:snow_brick", {
  4. description = "Snow Brick",
  5. tiles = {"snow_bricks_snow_brick.png"},
  6. paramtype2 = "facedir",
  7. place_param2 = 0,
  8. groups = utility.dig_groups("brick", {puts_out_fire = 1, melts = 1, cold = 1}),
  9. is_ground_content = false,
  10. _melts_to = "default:water_flowing",
  11. sounds = default.node_sound_stone_defaults({
  12. footstep = {name = "default_snow_footstep", gain = 0.15}
  13. }),
  14. on_construct = function(pos)
  15. if rc.ice_melts_at_pos(pos) then
  16. minetest.get_node_timer(pos):start(math.random(ice.minmax_time()))
  17. end
  18. end,
  19. on_timer = function(pos, elapsed)
  20. if rc.ice_melts_at_pos(pos) then
  21. -- If in nether, then water's constructor will convert again to fire.
  22. minetest.add_node(pos, {name="default:water_flowing"})
  23. end
  24. end,
  25. })
  26. minetest.register_node("snow_bricks:ice_brick", {
  27. description = "Ice Brick",
  28. tiles = {"snow_bricks_ice_brick.png"},
  29. paramtype2 = "facedir",
  30. place_param2 = 0,
  31. groups = utility.dig_groups("brick", {puts_out_fire = 1, melts = 1, cold = 1}),
  32. is_ground_content = false,
  33. _melts_to = "default:water_flowing",
  34. sounds = default.node_sound_stone_defaults({
  35. footstep = {name = "default_glass_footstep", gain = 0.35}
  36. }),
  37. on_construct = function(pos)
  38. if rc.ice_melts_at_pos(pos) then
  39. minetest.get_node_timer(pos):start(math.random(ice.minmax_time()))
  40. end
  41. end,
  42. on_timer = function(pos, elapsed)
  43. if rc.ice_melts_at_pos(pos) then
  44. -- If in nether, then water's constructor will convert again to fire.
  45. minetest.add_node(pos, {name="default:water_flowing"})
  46. end
  47. end,
  48. })
  49. minetest.register_craft({
  50. output = "snow_bricks:snow_brick 4",
  51. recipe = {
  52. {"default:snowblock", "default:snowblock"},
  53. {"default:snowblock", "default:snowblock"},
  54. }
  55. })
  56. minetest.register_craft({
  57. output = "snow_bricks:ice_brick 4",
  58. recipe = {
  59. {"default:ice", "default:ice"},
  60. {"default:ice", "default:ice"},
  61. }
  62. })
  63. minetest.register_craft({
  64. output = "snow_bricks:snow_brick",
  65. recipe = {
  66. {"default:snow", "default:snow", "default:snow"},
  67. {"default:snow", "snow_bricks:ice_brick", "default:snow"},
  68. {"default:snow", "default:snow", "default:snow"},
  69. }
  70. })
  71. stairs.register_stair_and_slab(
  72. "snow_brick",
  73. "snow_bricks:snow_brick",
  74. {cracky = 2, puts_out_fire = 1},
  75. {"snow_bricks_snow_brick.png"},
  76. "Snow Brick",
  77. default.node_sound_stone_defaults({footstep = {name = "default_snow_footstep", gain = 0.15}})
  78. )
  79. stairs.register_stair_and_slab(
  80. "ice_brick",
  81. "snow_bricks:ice_brick",
  82. {cracky = 2, puts_out_fire = 1},
  83. {"snow_bricks_ice_brick.png"},
  84. "Ice Brick",
  85. default.node_sound_stone_defaults({footstep = {name = "default_glass_footstep", gain = 0.35}})
  86. )