init.lua 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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, 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\nHopefully will have a use someday."),
  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. -- aloe_slice definition
  54. local crop_def = {
  55. drawtype = "plantlike",
  56. tiles = {"aloe_plant_01.png"},
  57. paramtype = "light",
  58. sunlight_propagates = true,
  59. waving = 1,
  60. walkable = false,
  61. buildable_to = true,
  62. drop = "",
  63. selection_box = {
  64. type = "fixed",
  65. fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
  66. },
  67. groups = utility.dig_groups("crop", {
  68. flammable = 2, plant = 1, attached_node = 1,
  69. not_in_creative_inventory = 1, growing = 1, notify_destruct = 1,
  70. }),
  71. sounds = default.node_sound_leaves_defaults(),
  72. on_timer = farming.grow_plant,
  73. minlight = 13,
  74. maxlight = default.LIGHT_MAX,
  75. movement_speed_multiplier = default.SLOW_SPEED_PLANTS,
  76. flowerpot_drop = "aloevera:aloe_slice",
  77. }
  78. -- stage 1
  79. crop_def.next_plant = "aloevera:aloe_plant_02"
  80. minetest.register_node("aloevera:aloe_plant_01", table.copy(crop_def))
  81. -- stage 2
  82. crop_def.next_plant = "aloevera:aloe_plant_03"
  83. crop_def.tiles = {"aloe_plant_02.png"}
  84. minetest.register_node("aloevera:aloe_plant_02", table.copy(crop_def))
  85. -- stage 3
  86. crop_def.next_plant = "aloevera:aloe_plant_04"
  87. crop_def.tiles = {"aloe_plant_03.png"}
  88. crop_def.drop = {
  89. items = {
  90. {items = {'aloevera:aloe_slice'}, rarity = 1},
  91. {items = {'aloevera:aloe_slice'}, rarity = 3},
  92. }
  93. }
  94. minetest.register_node("aloevera:aloe_plant_03", table.copy(crop_def))
  95. -- stage 4
  96. crop_def.next_plant = nil
  97. crop_def.tiles = {"aloe_plant_04.png"}
  98. crop_def.groups.growing = 0
  99. crop_def.drop = {
  100. items = {
  101. {items = {'aloevera:aloe_slice'}, rarity = 1},
  102. {items = {'aloevera:aloe_slice 3'}, rarity = 3},
  103. {items = {'aloevera:aloe_seed'}, rarity = 1},
  104. {items = {'aloevera:aloe_seed'}, rarity = 2},
  105. }
  106. }
  107. minetest.register_node("aloevera:aloe_plant_04", table.copy(crop_def))