init.lua 3.0 KB

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