init.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. local use_moreores = minetest.get_modpath("moreores")
  2. -- Regisiter Shields
  3. if ARMOR_MATERIALS.wood then
  4. minetest.register_tool("shields:shield_wood", {
  5. description = "Wooden Shield",
  6. inventory_image = "shields_inv_shield_wood.png",
  7. groups = {armor_shield=5, armor_heal=0, armor_use=2000},
  8. wear = 0,
  9. })
  10. minetest.register_tool("shields:shield_enhanced_wood", {
  11. description = "Enhanced Wood Shield",
  12. inventory_image = "shields_inv_shield_enhanced_wood.png",
  13. groups = {armor_shield=8, armor_heal=0, armor_use=1000},
  14. wear = 0,
  15. })
  16. minetest.register_craft({
  17. output = "shields:shield_enhanced_wood",
  18. recipe = {
  19. {"default:steel_ingot"},
  20. {"shields:shield_wood"},
  21. {"default:steel_ingot"},
  22. },
  23. })
  24. minetest.register_craft({
  25. type = "cooking",
  26. output = "default:steel_ingot 2",
  27. recipe = "shields:shield_enhanced_wood",
  28. })
  29. end
  30. --[[
  31. if ARMOR_MATERIALS.cactus then
  32. minetest.register_tool("shields:shield_cactus", {
  33. description = "Cactus Shield",
  34. inventory_image = "shields_inv_shield_cactus.png",
  35. groups = {armor_shield=5, armor_heal=0, armor_use=2000},
  36. wear = 0,
  37. })
  38. minetest.register_tool("shields:shield_enhanced_cactus", {
  39. description = "Enhanced Cactus Shield",
  40. inventory_image = "shields_inv_shield_enhanced_cactus.png",
  41. groups = {armor_shield=8, armor_heal=0, armor_use=1000},
  42. wear = 0,
  43. })
  44. minetest.register_craft({
  45. output = "shields:shield_enhanced_cactus",
  46. recipe = {
  47. {"default:steel_ingot"},
  48. {"shields:shield_cactus"},
  49. {"default:steel_ingot"},
  50. },
  51. })
  52. end
  53. --]]
  54. if ARMOR_MATERIALS.steel then
  55. minetest.register_tool("shields:shield_steel", {
  56. description = "Wrought Iron Shield",
  57. inventory_image = "shields_inv_shield_steel.png",
  58. groups = {armor_shield=10, armor_heal=0, armor_use=500},
  59. wear = 0,
  60. })
  61. end
  62. if ARMOR_MATERIALS.carbon then
  63. minetest.register_tool("shields:shield_carbon", {
  64. description = "Carbon Steel Shield",
  65. inventory_image = "shields_inv_shield_carbon.png",
  66. groups = {armor_shield=12, armor_heal=0, armor_use=200},
  67. wear = 0,
  68. })
  69. end
  70. if ARMOR_MATERIALS.bronze then
  71. minetest.register_tool("shields:shield_bronze", {
  72. description = "Bronze Shield",
  73. inventory_image = "shields_inv_shield_bronze.png",
  74. groups = {armor_shield=10, armor_heal=6, armor_use=250},
  75. wear = 0,
  76. })
  77. end
  78. if ARMOR_MATERIALS.diamond then
  79. minetest.register_tool("shields:shield_diamond", {
  80. description = "Diamond Shield",
  81. inventory_image = "shields_inv_shield_diamond.png",
  82. groups = {armor_shield=15, armor_heal=12, armor_use=100},
  83. wear = 0,
  84. })
  85. end
  86. if ARMOR_MATERIALS.gold then
  87. minetest.register_tool("shields:shield_gold", {
  88. description = "Gold Shield",
  89. inventory_image = "shields_inv_shield_gold.png",
  90. groups = {armor_shield=10, armor_heal=6, armor_use=250},
  91. wear = 0,
  92. })
  93. end
  94. if ARMOR_MATERIALS.mithril then
  95. minetest.register_tool("shields:shield_mithril", {
  96. description = "Mithril Shield",
  97. inventory_image = "shields_inv_shield_mithril.png",
  98. groups = {armor_shield=15, armor_heal=12, armor_use=50},
  99. wear = 0,
  100. })
  101. end
  102. for k, v in pairs(ARMOR_MATERIALS) do
  103. minetest.register_craft({
  104. output = "shields:shield_"..k,
  105. recipe = {
  106. {v, v, v},
  107. {v, v, v},
  108. {"", v, ""},
  109. },
  110. })
  111. -- Reverse cooking recipes for all shields except wood and diamond.
  112. if not string.find(v, "wood") and not string.find(v, "diamond") and string.find(v, "ingot") then
  113. minetest.register_craft({
  114. type = "cooking",
  115. output = v .. " 7",
  116. recipe = "shields:shield_" .. k,
  117. cooktime = 15,
  118. })
  119. end
  120. if string.find(v, "wood") then
  121. minetest.register_craft({
  122. type = "fuel",
  123. recipe = "shields:shield_" .. k,
  124. burntime = 5,
  125. })
  126. end
  127. end
  128. minetest.after(0, function()
  129. table.insert(armor.elements, "shield")
  130. end)