init.lua 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. redshroom = redshroom or {}
  2. redshroom.modpath = minetest.get_modpath("redshroom")
  3. -- Localize for performance.
  4. local math_random = math.random
  5. local SHROOM_SCHEMATICS = {
  6. "redshroom_shroom1.mts",
  7. "redshroom_shroom2.mts",
  8. "redshroom_shroom3.mts",
  9. "redshroom_shroom4.mts",
  10. "redshroom_shroom5.mts",
  11. "redshroom_shroom6.mts",
  12. }
  13. minetest.register_node("redshroom:head", {
  14. description = "Red Shroom Head",
  15. tiles = {"redshroom_headtop.png", "redshroom_headtop.png", "redshroom_headside1.png^redshroom_headside2.png"},
  16. paramtype2 = "facedir",
  17. groups = utility.dig_groups("shroom", {flammable=2}),
  18. sounds = default.node_sound_wood_defaults(),
  19. on_place = minetest.rotate_node
  20. })
  21. minetest.register_node("redshroom:head2", {
  22. description = "Red Shroom Head",
  23. tiles = {"redshroom_headtop.png", "redshroom_headtop.png", "redshroom_headside1.png"},
  24. paramtype2 = "facedir",
  25. groups = utility.dig_groups("shroom", {flammable=2}),
  26. sounds = default.node_sound_wood_defaults(),
  27. on_place = minetest.rotate_node
  28. })
  29. minetest.register_node("redshroom:stem", {
  30. description = "Red Shroom Stem",
  31. tiles = {"redshroom_stemtop.png", "redshroom_stemtop.png", "redshroom_stemside.png"},
  32. paramtype2 = "facedir",
  33. groups = utility.dig_groups("shroom", {flammable=2}),
  34. sounds = default.node_sound_wood_defaults(),
  35. on_place = minetest.rotate_node
  36. })
  37. minetest.register_craft({
  38. type = "shapeless",
  39. output = "default:stick 16",
  40. recipe = {"redshroom:stem"},
  41. })
  42. minetest.register_node("redshroom:stemwhite", {
  43. description = "White Shroom Stem",
  44. tiles = {"redshroom_stemtop_white.png", "redshroom_stemtop_white.png", "redshroom_stemside_white.png"},
  45. paramtype2 = "facedir",
  46. groups = utility.dig_groups("shroom", {flammable=2}),
  47. sounds = default.node_sound_wood_defaults(),
  48. on_place = minetest.rotate_node
  49. })
  50. minetest.register_craft({
  51. type = "shapeless",
  52. output = "default:stick 16",
  53. recipe = {"redshroom:stemwhite"},
  54. })
  55. minetest.register_craft({
  56. type = "cooking",
  57. output = "default:coal_lump 4",
  58. recipe = "redshroom:stemwhite",
  59. cooktime = 60,
  60. })
  61. minetest.register_node("redshroom:gills", {
  62. description = "Shroom Gills",
  63. drawtype = "plantlike",
  64. tiles = {"redshroom_gills.png"},
  65. paramtype = "light",
  66. groups = utility.dig_groups("plant", {flammable=2, hanging_node=1}),
  67. drop = "", -- Gills are destroyed when dug.
  68. shears_drop = true, -- obtainable via shears
  69. walkable = false,
  70. buildable_to = true,
  71. sounds = default.node_sound_leaves_defaults(),
  72. selection_box = {
  73. type = "fixed",
  74. fixed = {-0.5, 5/16, -0.5, 0.5, 0.5, 0.5},
  75. },
  76. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  77. })
  78. redshroom.create_shroom_on_vmanip = function(vm, pos)
  79. local schempath = redshroom.modpath .. "/schematics/"
  80. local path = schempath .. SHROOM_SCHEMATICS[math_random(#SHROOM_SCHEMATICS)]
  81. minetest.place_schematic_on_vmanip(vm, vector.add(pos, {x=-2, y=0, z=-2}), path, "random", nil, false)
  82. end
  83. redshroom.create_shroom = function(pos)
  84. local schempath = redshroom.modpath .. "/schematics/"
  85. local path = schempath .. SHROOM_SCHEMATICS[math_random(#SHROOM_SCHEMATICS)]
  86. minetest.place_schematic(vector.add(pos, {x=-2, y=0, z=-2}), path, "random", nil, false)
  87. end