init.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. minetest.register_node("pbj_pup:pbj_pup", {
  2. description = "PB&J Pup",
  3. tiles = {
  4. "pbj_pup_sides.png",
  5. "pbj_pup_jelly.png",
  6. "pbj_pup_sides.png",
  7. "pbj_pup_sides.png",
  8. "pbj_pup_back.png",
  9. "pbj_pup_front.png"
  10. },
  11. paramtype = "light",
  12. light_source = default.LIGHT_MAX,
  13. paramtype2 = "facedir",
  14. groups = {cracky = 2},
  15. is_ground_content = false,
  16. legacy_facedir_simple = true,
  17. sounds = default.node_sound_defaults(),
  18. })
  19. minetest.register_craft({
  20. type = "fuel",
  21. recipe = "pbj_pup:pbj_pup",
  22. burntime = 1,
  23. })
  24. minetest.register_node(":nyancat:nyancat", {
  25. description = "Nyan Cat",
  26. tiles = {
  27. "nyancat_side.png",
  28. "nyancat_side.png",
  29. "nyancat_side.png",
  30. "nyancat_side.png",
  31. "nyancat_back.png",
  32. "nyancat_front.png"
  33. },
  34. paramtype = "light",
  35. light_source = default.LIGHT_MAX,
  36. paramtype2 = "facedir",
  37. groups = {cracky = 2},
  38. is_ground_content = false,
  39. legacy_facedir_simple = true,
  40. sounds = default.node_sound_defaults(),
  41. })
  42. minetest.register_craft({
  43. type = "fuel",
  44. recipe = "nyancat:nyancat",
  45. burntime = 1,
  46. })
  47. minetest.register_node(":moognu:moognu", {
  48. description = "MooGNU",
  49. tiles = {
  50. "moognu_side.png",
  51. "moognu_side.png",
  52. "moognu_side.png",
  53. "moognu_side.png",
  54. "moognu_back.png",
  55. "moognu_front.png"},
  56. paramtype = "light",
  57. light_source = default.LIGHT_MAX,
  58. paramtype2 = "facedir",
  59. groups = {cracky = 2},
  60. is_ground_content = false,
  61. legacy_facedir_simple = true,
  62. sounds = default.node_sound_defaults(),
  63. })
  64. minetest.register_craft({
  65. type = "fuel",
  66. recipe = "moognu:moognu",
  67. burntime = 1,
  68. })
  69. minetest.register_node(":nyancat:nyancat_rainbow", {
  70. description = "Rainbow",
  71. tiles = {
  72. "nyancat_rainbow.png^[transformR90",
  73. "nyancat_rainbow.png^[transformR90",
  74. "nyancat_rainbow.png"
  75. },
  76. paramtype = "light",
  77. light_source = default.LIGHT_MAX,
  78. paramtype2 = "facedir",
  79. groups = {cracky = 2},
  80. is_ground_content = false,
  81. sounds = default.node_sound_defaults(),
  82. })
  83. minetest.register_craft({
  84. type = "fuel",
  85. recipe = "nyancat:nyancat_rainbow",
  86. burntime = 1,
  87. })
  88. -- Place Nyan or Pup with Rainbow
  89. local function place(pos, facedir, length)
  90. if facedir > 3 then
  91. facedir = 0
  92. end
  93. local tailvec = minetest.facedir_to_dir(facedir)
  94. local p = {x = pos.x, y = pos.y, z = pos.z}
  95. local num = math.random(1, 3)
  96. if num == 1 then
  97. minetest.set_node(p, {name = "pbj_pup:pbj_pup", param2 = facedir})
  98. elseif num == 2 then
  99. minetest.set_node(p, {name = "nyancat:nyancat", param2 = facedir})
  100. else
  101. minetest.set_node(p, {name = "moognu:moognu", param2 = facedir})
  102. end
  103. for i = 1, length do
  104. p.x = p.x + tailvec.x
  105. p.z = p.z + tailvec.z
  106. minetest.set_node(p, {name = "nyancat:nyancat_rainbow", param2 = facedir})
  107. end
  108. end
  109. local function generate(minp, maxp, seed)
  110. local height_min = -31000
  111. local height_max = -32
  112. local chance = 1000
  113. if maxp.y < height_min or minp.y > height_max then
  114. return
  115. end
  116. local y_min = math.max(minp.y, height_min)
  117. local y_max = math.min(maxp.y, height_max)
  118. local pr = PseudoRandom(seed + 9324342)
  119. if pr:next(0, chance) == 0 then
  120. local x0 = pr:next(minp.x, maxp.x)
  121. local y0 = pr:next(minp.y, maxp.y)
  122. local z0 = pr:next(minp.z, maxp.z)
  123. local p0 = {x = x0, y = y0, z = z0}
  124. place(p0, pr:next(0, 3), pr:next(3, 15))
  125. end
  126. end
  127. minetest.register_on_generated(generate)
  128. default.generate_nyancats = generate --Legacy
  129. -- Legacy
  130. minetest.register_alias("default:nyancat", "nyancat:nyancat")
  131. minetest.register_alias("default:nyancat_rainbow", "nyancat:nyancat_rainbow")
  132. minetest.register_alias("pbj_pup:pbj_pup_candies", "nyancat:nyancat_rainbow")
  133. default.make_nyancat = place