init.lua 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. ARMOR_MOD_NAME = minetest.get_current_modname()
  2. dofile(minetest.get_modpath(ARMOR_MOD_NAME).."/armor.lua")
  3. if ARMOR_MATERIALS.wood then
  4. minetest.register_tool("3d_armor:helmet_wood", {
  5. description = "Wood Helmet",
  6. inventory_image = "3d_armor_inv_helmet_wood.png",
  7. groups = {armor_head=5, armor_heal=0, armor_use=2000},
  8. wear = 0,
  9. })
  10. minetest.register_tool("3d_armor:chestplate_wood", {
  11. description = "Wood Chestplate",
  12. inventory_image = "3d_armor_inv_chestplate_wood.png",
  13. groups = {armor_torso=10, armor_heal=0, armor_use=2000},
  14. wear = 0,
  15. })
  16. minetest.register_tool("3d_armor:leggings_wood", {
  17. description = "Wood Leggings",
  18. inventory_image = "3d_armor_inv_leggings_wood.png",
  19. groups = {armor_legs=5, armor_heal=0, armor_use=2000},
  20. wear = 0,
  21. })
  22. minetest.register_tool("3d_armor:boots_wood", {
  23. description = "Wood Boots",
  24. inventory_image = "3d_armor_inv_boots_wood.png",
  25. groups = {armor_feet=5, armor_heal=0, armor_use=2000},
  26. wear = 0,
  27. })
  28. end
  29. --[[
  30. if ARMOR_MATERIALS.cactus then
  31. minetest.register_tool("3d_armor:helmet_cactus", {
  32. description = "Cactuc Helmet",
  33. inventory_image = "3d_armor_inv_helmet_cactus.png",
  34. groups = {armor_head=5, armor_heal=0, armor_use=1000},
  35. wear = 0,
  36. })
  37. minetest.register_tool("3d_armor:chestplate_cactus", {
  38. description = "Cactus Chestplate",
  39. inventory_image = "3d_armor_inv_chestplate_cactus.png",
  40. groups = {armor_torso=10, armor_heal=0, armor_use=1000},
  41. wear = 0,
  42. })
  43. minetest.register_tool("3d_armor:leggings_cactus", {
  44. description = "Cactus Leggings",
  45. inventory_image = "3d_armor_inv_leggings_cactus.png",
  46. groups = {armor_legs=5, armor_heal=0, armor_use=1000},
  47. wear = 0,
  48. })
  49. minetest.register_tool("3d_armor:boots_cactus", {
  50. description = "Cactus Boots",
  51. inventory_image = "3d_armor_inv_boots_cactus.png",
  52. groups = {armor_feet=5, armor_heal=0, armor_use=2000},
  53. wear = 0,
  54. })
  55. end
  56. --]]
  57. if ARMOR_MATERIALS.steel then
  58. minetest.register_tool("3d_armor:helmet_steel", {
  59. description = "Wrought Iron Helmet",
  60. inventory_image = "3d_armor_inv_helmet_steel.png",
  61. groups = {armor_head=10, armor_heal=0, armor_use=500},
  62. wear = 0,
  63. })
  64. minetest.register_tool("3d_armor:chestplate_steel", {
  65. description = "Wrought Iron Chestplate",
  66. inventory_image = "3d_armor_inv_chestplate_steel.png",
  67. groups = {armor_torso=15, armor_heal=0, armor_use=500},
  68. wear = 0,
  69. })
  70. minetest.register_tool("3d_armor:leggings_steel", {
  71. description = "Wrought Iron Leggings",
  72. inventory_image = "3d_armor_inv_leggings_steel.png",
  73. groups = {armor_legs=15, armor_heal=0, armor_use=500},
  74. wear = 0,
  75. })
  76. minetest.register_tool("3d_armor:boots_steel", {
  77. description = "Wrought Iron Boots",
  78. inventory_image = "3d_armor_inv_boots_steel.png",
  79. groups = {armor_feet=10, armor_heal=0, armor_use=500},
  80. wear = 0,
  81. })
  82. end
  83. if ARMOR_MATERIALS.carbon then
  84. minetest.register_tool("3d_armor:helmet_carbon", {
  85. description = "Carbon Steel Helmet",
  86. inventory_image = "3d_armor_inv_helmet_carbon.png",
  87. groups = {armor_head=12, armor_heal=0, armor_use=200},
  88. wear = 0,
  89. })
  90. minetest.register_tool("3d_armor:chestplate_carbon", {
  91. description = "Carbon Steel Chestplate",
  92. inventory_image = "3d_armor_inv_chestplate_carbon.png",
  93. groups = {armor_torso=17, armor_heal=0, armor_use=200},
  94. wear = 0,
  95. })
  96. minetest.register_tool("3d_armor:leggings_carbon", {
  97. description = "Carbon Steel Leggings",
  98. inventory_image = "3d_armor_inv_leggings_carbon.png",
  99. groups = {armor_legs=17, armor_heal=0, armor_use=200},
  100. wear = 0,
  101. })
  102. minetest.register_tool("3d_armor:boots_carbon", {
  103. description = "Carbon Steel Boots",
  104. inventory_image = "3d_armor_inv_boots_carbon.png",
  105. groups = {armor_feet=12, armor_heal=0, armor_use=200},
  106. wear = 0,
  107. })
  108. end
  109. if ARMOR_MATERIALS.bronze then
  110. minetest.register_tool("3d_armor:helmet_bronze", {
  111. description = "Bronze Helmet",
  112. inventory_image = "3d_armor_inv_helmet_bronze.png",
  113. groups = {armor_head=10, armor_heal=6, armor_use=250},
  114. wear = 0,
  115. })
  116. minetest.register_tool("3d_armor:chestplate_bronze", {
  117. description = "Bronze Chestplate",
  118. inventory_image = "3d_armor_inv_chestplate_bronze.png",
  119. groups = {armor_torso=15, armor_heal=6, armor_use=250},
  120. wear = 0,
  121. })
  122. minetest.register_tool("3d_armor:leggings_bronze", {
  123. description = "Bronze Leggings",
  124. inventory_image = "3d_armor_inv_leggings_bronze.png",
  125. groups = {armor_legs=15, armor_heal=6, armor_use=250},
  126. wear = 0,
  127. })
  128. minetest.register_tool("3d_armor:boots_bronze", {
  129. description = "Bronze Boots",
  130. inventory_image = "3d_armor_inv_boots_bronze.png",
  131. groups = {armor_feet=10, armor_heal=6, armor_use=250},
  132. wear = 0,
  133. })
  134. end
  135. if ARMOR_MATERIALS.diamond then
  136. minetest.register_tool("3d_armor:helmet_diamond", {
  137. description = "Diamond Helmet",
  138. inventory_image = "3d_armor_inv_helmet_diamond.png",
  139. groups = {armor_head=15, armor_heal=12, armor_use=100},
  140. wear = 0,
  141. })
  142. minetest.register_tool("3d_armor:chestplate_diamond", {
  143. description = "Diamond Chestplate",
  144. inventory_image = "3d_armor_inv_chestplate_diamond.png",
  145. groups = {armor_torso=20, armor_heal=12, armor_use=100},
  146. wear = 0,
  147. })
  148. minetest.register_tool("3d_armor:leggings_diamond", {
  149. description = "Diamond Leggings",
  150. inventory_image = "3d_armor_inv_leggings_diamond.png",
  151. groups = {armor_legs=20, armor_heal=12, armor_use=100},
  152. wear = 0,
  153. })
  154. minetest.register_tool("3d_armor:boots_diamond", {
  155. description = "Diamond Boots",
  156. inventory_image = "3d_armor_inv_boots_diamond.png",
  157. groups = {armor_feet=15, armor_heal=12, armor_use=100},
  158. wear = 0,
  159. })
  160. end
  161. if ARMOR_MATERIALS.gold then
  162. minetest.register_tool("3d_armor:helmet_gold", {
  163. description = "Gold Helmet",
  164. inventory_image = "3d_armor_inv_helmet_gold.png",
  165. groups = {armor_head=10, armor_heal=6, armor_use=250},
  166. wear = 0,
  167. })
  168. minetest.register_tool("3d_armor:chestplate_gold", {
  169. description = "Gold Chestplate",
  170. inventory_image = "3d_armor_inv_chestplate_gold.png",
  171. groups = {armor_torso=15, armor_heal=6, armor_use=250},
  172. wear = 0,
  173. })
  174. minetest.register_tool("3d_armor:leggings_gold", {
  175. description = "Gold Leggings",
  176. inventory_image = "3d_armor_inv_leggings_gold.png",
  177. groups = {armor_legs=15, armor_heal=6, armor_use=250},
  178. wear = 0,
  179. })
  180. minetest.register_tool("3d_armor:boots_gold", {
  181. description = "Gold Boots",
  182. inventory_image = "3d_armor_inv_boots_gold.png",
  183. groups = {armor_feet=10, armor_heal=6, armor_use=250},
  184. wear = 0,
  185. })
  186. end
  187. if ARMOR_MATERIALS.mithril then
  188. minetest.register_tool("3d_armor:helmet_mithril", {
  189. description = "Mithril Helmet",
  190. inventory_image = "3d_armor_inv_helmet_mithril.png",
  191. groups = {armor_head=20, armor_heal=12, armor_use=50},
  192. wear = 0,
  193. })
  194. minetest.register_tool("3d_armor:chestplate_mithril", {
  195. description = "Mithril Chestplate",
  196. inventory_image = "3d_armor_inv_chestplate_mithril.png",
  197. groups = {armor_torso=25, armor_heal=12, armor_use=50},
  198. wear = 0,
  199. })
  200. minetest.register_tool("3d_armor:leggings_mithril", {
  201. description = "Mithril Leggings",
  202. inventory_image = "3d_armor_inv_leggings_mithril.png",
  203. groups = {armor_legs=25, armor_heal=12, armor_use=50},
  204. wear = 0,
  205. })
  206. minetest.register_tool("3d_armor:boots_mithril", {
  207. description = "Mithril Boots",
  208. inventory_image = "3d_armor_inv_boots_mithril.png",
  209. groups = {armor_feet=20, armor_heal=12, armor_use=50},
  210. wear = 0,
  211. })
  212. end
  213. --[[
  214. if ARMOR_MATERIALS.crystal then
  215. minetest.register_tool("3d_armor:helmet_crystal", {
  216. description = "Crystal Helmet",
  217. inventory_image = "3d_armor_inv_helmet_crystal.png",
  218. groups = {armor_head=15, armor_heal=12, armor_use=50, armor_fire=1},
  219. wear = 0,
  220. })
  221. minetest.register_tool("3d_armor:chestplate_crystal", {
  222. description = "Crystal Chestplate",
  223. inventory_image = "3d_armor_inv_chestplate_crystal.png",
  224. groups = {armor_torso=20, armor_heal=12, armor_use=50, armor_fire=1},
  225. wear = 0,
  226. })
  227. minetest.register_tool("3d_armor:leggings_crystal", {
  228. description = "Crystal Leggings",
  229. inventory_image = "3d_armor_inv_leggings_crystal.png",
  230. groups = {armor_legs=20, armor_heal=12, armor_use=50, armor_fire=1},
  231. wear = 0,
  232. })
  233. minetest.register_tool("3d_armor:boots_crystal", {
  234. description = "Crystal Boots",
  235. inventory_image = "3d_armor_inv_boots_crystal.png",
  236. groups = {armor_feet=15, armor_heal=12, armor_use=50, physics_speed=1, physics_jump=0.5, armor_fire=1},
  237. wear = 0,
  238. })
  239. end
  240. --]]
  241. for k, v in pairs(ARMOR_MATERIALS) do
  242. minetest.register_craft({
  243. output = "3d_armor:helmet_"..k,
  244. recipe = {
  245. {v, v, v},
  246. {v, "", v},
  247. {"", "", ""},
  248. },
  249. })
  250. minetest.register_craft({
  251. output = "3d_armor:chestplate_"..k,
  252. recipe = {
  253. {v, "", v},
  254. {v, v, v},
  255. {v, v, v},
  256. },
  257. })
  258. minetest.register_craft({
  259. output = "3d_armor:leggings_"..k,
  260. recipe = {
  261. {v, v, v},
  262. {v, "", v},
  263. {v, "", v},
  264. },
  265. })
  266. minetest.register_craft({
  267. output = "3d_armor:boots_"..k,
  268. recipe = {
  269. {v, "", v},
  270. {v, "", v},
  271. },
  272. })
  273. if not string.find(v, "wood") and not string.find(v, "diamond") and string.find(v, "ingot") then
  274. minetest.register_craft({
  275. type = "cooking",
  276. output = v .. " 5",
  277. recipe = "3d_armor:helmet_"..k,
  278. cooktime = 15,
  279. })
  280. minetest.register_craft({
  281. type = "cooking",
  282. output = v .. " 8",
  283. recipe = "3d_armor:chestplate_"..k,
  284. cooktime = 15,
  285. })
  286. minetest.register_craft({
  287. type = "cooking",
  288. output = v .. " 7",
  289. recipe = "3d_armor:leggings_"..k,
  290. cooktime = 15,
  291. })
  292. minetest.register_craft({
  293. type = "cooking",
  294. output = v .. " 4",
  295. recipe = "3d_armor:boots_"..k,
  296. cooktime = 15,
  297. })
  298. end
  299. -- Wooden armor can be used as fuel.
  300. if string.find(v, "wood") then
  301. minetest.register_craft({
  302. type = "fuel",
  303. recipe = "3d_armor:helmet_" .. k,
  304. burntime = 4,
  305. })
  306. minetest.register_craft({
  307. type = "fuel",
  308. recipe = "3d_armor:chestplate_" .. k,
  309. burntime = 4,
  310. })
  311. minetest.register_craft({
  312. type = "fuel",
  313. recipe = "3d_armor:leggings_" .. k,
  314. burntime = 4,
  315. })
  316. minetest.register_craft({
  317. type = "fuel",
  318. recipe = "3d_armor:boots_" .. k,
  319. burntime = 4,
  320. })
  321. end
  322. end