init.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. --aloevera init.lua
  2. --all textures by Nakilashiva
  3. local S = function(s)
  4. return s
  5. end
  6. minetest.register_node("aloevera:aloe_seed", {
  7. description = "Aloe Vera Seeds",
  8. tiles = {"aloe_seeds.png"},
  9. wield_image = "aloe_seeds.png",
  10. inventory_image = "aloe_seeds.png",
  11. drawtype = "signlike",
  12. paramtype = "light",
  13. paramtype2 = "wallmounted",
  14. walkable = false,
  15. sunlight_propagates = true,
  16. selection_box = {
  17. type = "fixed",
  18. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
  19. },
  20. groups = utility.dig_groups("seeds", {seed = 1, seed_oil = 1, attached_node = 1, flammable = 2, notify_destruct = 1}),
  21. on_place = function(itemstack, placer, pointed_thing)
  22. return farming.place_seed(itemstack, placer, pointed_thing, "aloevera:aloe_seed")
  23. end,
  24. on_timer = farming.grow_plant,
  25. minlight = 13,
  26. maxlight = 15,
  27. next_plant = "aloevera:aloe_plant_01",
  28. fertility = {"grassland"},
  29. sounds = default.node_sound_dirt_defaults({
  30. dug = {name = "default_grass_footstep", gain = 0.2},
  31. place = {name = "default_place_node", gain = 0.25},
  32. }),
  33. })
  34. -- aloe_slice
  35. minetest.register_craftitem("aloevera:aloe_slice", {
  36. description = S("Aloe Vera Slice"),
  37. inventory_image = "aloe_vera_slice.png",
  38. on_use = minetest.item_eat(3),
  39. groups = {foodrot=1},
  40. flowerpot_insert = {"aloevera:aloe_plant_01", "aloevera:aloe_plant_02", "aloevera:aloe_plant_03", "aloevera:aloe_plant_04"},
  41. })
  42. -- aloe gel
  43. minetest.register_craftitem("aloevera:aloe_gel", {
  44. description = S("Aloe Vera Gel"),
  45. inventory_image = "aloe_vera_gel.png",
  46. })
  47. minetest.register_craft({
  48. type = "extracting",
  49. output = 'aloevera:aloe_gel 5',
  50. recipe = 'aloevera:aloe_slice',
  51. time = 3,
  52. })
  53. minetest.register_craft({
  54. type = "shapeless",
  55. output = 'aloevera:aloe_gel',
  56. recipe = {'aloevera:aloe_slice', 'farming:mortar_pestle'},
  57. replacements = {{'farming:mortar_pestle', 'farming:mortar_pestle'}},
  58. })
  59. -- aloe_slice definition
  60. local crop_def = {
  61. drawtype = "plantlike",
  62. tiles = {"aloe_plant_01.png"},
  63. paramtype = "light",
  64. sunlight_propagates = true,
  65. waving = 1,
  66. walkable = false,
  67. buildable_to = true,
  68. drop = "",
  69. selection_box = {
  70. type = "fixed",
  71. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
  72. },
  73. groups = utility.dig_groups("crop", {
  74. flammable = 2, plant = 1, attached_node = 1,
  75. not_in_creative_inventory = 1, growing = 1, notify_destruct = 1,
  76. }),
  77. sounds = default.node_sound_leaves_defaults(),
  78. on_timer = farming.grow_plant,
  79. minlight = 13,
  80. maxlight = default.LIGHT_MAX,
  81. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  82. flowerpot_drop = "aloevera:aloe_slice",
  83. }
  84. -- stage 1
  85. crop_def.next_plant = "aloevera:aloe_plant_02"
  86. minetest.register_node("aloevera:aloe_plant_01", table.copy(crop_def))
  87. -- stage 2
  88. crop_def.next_plant = "aloevera:aloe_plant_03"
  89. crop_def.tiles = {"aloe_plant_02.png"}
  90. minetest.register_node("aloevera:aloe_plant_02", table.copy(crop_def))
  91. -- stage 3
  92. crop_def.next_plant = "aloevera:aloe_plant_04"
  93. crop_def.tiles = {"aloe_plant_03.png"}
  94. crop_def.drop = {
  95. items = {
  96. {items = {'aloevera:aloe_slice'}, rarity = 1},
  97. {items = {'aloevera:aloe_slice'}, rarity = 3},
  98. }
  99. }
  100. minetest.register_node("aloevera:aloe_plant_03", table.copy(crop_def))
  101. -- stage 4
  102. crop_def.next_plant = nil
  103. crop_def.tiles = {"aloe_plant_04.png"}
  104. crop_def.groups.growing = 0
  105. crop_def.drop = {
  106. items = {
  107. {items = {'aloevera:aloe_slice'}, rarity = 1},
  108. {items = {'aloevera:aloe_slice 3'}, rarity = 3},
  109. {items = {'aloevera:aloe_seed'}, rarity = 1},
  110. {items = {'aloevera:aloe_seed'}, rarity = 3},
  111. }
  112. }
  113. minetest.register_node("aloevera:aloe_plant_04", table.copy(crop_def))