armor.lua 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. -- get Boilerplate for Translations
  2. local S = cannabis.S
  3. local path = cannabis.path
  4. if minetest.get_modpath("cannabis") then
  5. local stats = {
  6. fibra = { name="fibra", armor=3.8, heal=28, use=100 },
  7. tessuto= { name="tessuto", armor=2.0, heal=18, use=50 },
  8. foglie = { name="foglie", armor=2.7, heal=8, use=10 },
  9. high = { name="high_performance", armor=3.9, heal=38, use=1 },
  10. adminh = { name="adminh", armor=100, heal=100, use=100 ,armor_water=1,not_in_creative_inventory=0},
  11. }
  12. local mats = {
  13. fibra="cannabis:fibra_ingot",
  14. tessuto="cannabis:tessuto_ingot",
  15. foglie="cannabis:foglie_ingot",
  16. high="cannabis:high_performance_ingot",
  17. adminh="cannabis:adminh_block",
  18. }
  19. for k, v in pairs(stats) do
  20. minetest.register_tool("cannabis:helmet_"..k, {
  21. description = v.name..S(" Helmet"),
  22. inventory_image = "cannabis_armor_inv_helmet_"..k..".png",
  23. groups = {armor_head=math.floor(5*v.armor), armor_heal=v.heal, armor_use=v.use},
  24. wear = 0,
  25. })
  26. minetest.register_tool("cannabis:chestplate_"..k, {
  27. description = v.name.. S(" Chestplate"),
  28. inventory_image = "cannabis_armor_inv_chestplate_"..k..".png",
  29. groups = {armor_torso=math.floor(8*v.armor), armor_heal=v.heal, armor_use=v.use},
  30. wear = 0,
  31. })
  32. minetest.register_tool("cannabis:leggings_"..k, {
  33. description = v.name.. S(" Leggings"),
  34. inventory_image = "cannabis_armor_inv_leggings_"..k..".png",
  35. groups = {armor_legs=math.floor(7*v.armor), armor_heal=v.heal, armor_use=v.use},
  36. wear = 0,
  37. })
  38. minetest.register_tool("cannabis:boots_"..k, {
  39. description = v.name..S(" Boots"),
  40. inventory_image = "cannabis_armor_inv_boots_"..k..".png",
  41. groups = {armor_feet=math.floor(4*v.armor), armor_heal=v.heal, armor_use=v.use},
  42. wear = 0,
  43. })
  44. end
  45. for k, v in pairs(mats) do
  46. minetest.register_craft({
  47. output = "cannabis:helmet_"..k,
  48. recipe = {
  49. {v, v, v},
  50. {v, "", v},
  51. {"", "", ""},
  52. },
  53. })
  54. minetest.register_craft({
  55. output = "cannabis:chestplate_"..k,
  56. recipe = {
  57. {v, "", v},
  58. {v, v, v},
  59. {v, v, v},
  60. },
  61. })
  62. minetest.register_craft({
  63. output = "cannabis:leggings_"..k,
  64. recipe = {
  65. {v, v, v},
  66. {v, "", v},
  67. {v, "", v},
  68. },
  69. })
  70. minetest.register_craft({
  71. output = "cannabis:boots_"..k,
  72. recipe = {
  73. {v, "", v},
  74. {v, "", v},
  75. },
  76. })
  77. end
  78. if minetest.get_modpath("shields") then
  79. for k, v in pairs(stats) do
  80. minetest.register_tool("cannabis:shield_"..k, {
  81. description = v.name.. S(" Hemp Shield"),
  82. inventory_image = "cannabis_armor_inv_shield_"..k..".png",
  83. groups = {armor_shield=math.floor(5*v.armor), armor_heal=v.heal, armor_use=v.use},
  84. wear = 0,
  85. })
  86. local m = mats[k]
  87. minetest.register_craft({
  88. output = "cannabis:shield_"..k,
  89. recipe = {
  90. {m, m, m},
  91. {m, m, m},
  92. {"", m, ""},
  93. },
  94. })
  95. end -- for k,v
  96. end -- if minetest.get_modpath("shields")
  97. end--if minetest.get_modpath("cannabis")