armor.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. local local_get_recipe=function(tool,material)
  2. local out_recipe={}
  3. if tool == "helmet" then
  4. out_recipe = {
  5. {material, material, material},
  6. {material, '', material},}
  7. elseif tool == "chestplate" then
  8. out_recipe = {
  9. {material, '', material},
  10. {material, material, material},
  11. {material, material, material},}
  12. elseif tool == "leggings" then
  13. out_recipe = {
  14. {material, material, material},
  15. {material, '', material},
  16. {material, '', material},}
  17. elseif tool == "boots" then
  18. out_recipe = {
  19. {material, '', material},
  20. {material, '', material},}
  21. elseif tool == "shield" then
  22. out_recipe = {
  23. {material, material, material},
  24. {material, material, material},
  25. {'', material, ''},}
  26. else
  27. out_recipe={}
  28. end
  29. return out_recipe
  30. end
  31. if armor ~= nil then
  32. for _,tool in ipairs({"helmet","chestplate","leggings","boots"}) do
  33. minetest.register_craft({
  34. output=physio_stress.modname..":"..tool.."_grass",
  35. recipe=local_get_recipe(tool,"default:grass_1")
  36. })
  37. tt_def={description="Grass "..tool,
  38. inventory_image=physio_stress.modname.."_inv_"..tool.."_grass.png",
  39. damage_groups = {level = 2},
  40. armor_groups={fleshy=2},
  41. groups={armor_heal=0,armor_use=100,}
  42. }
  43. if tool == "helmet" then
  44. tt_def.groups.armor_head=1
  45. elseif tool == "chestplate" then
  46. tt_def.groups.armor_torso=1
  47. elseif tool == "leggings" then
  48. tt_def.groups.armor_legs=1
  49. elseif tool == "boots" then
  50. tt_def.groups.armor_feet=1
  51. end
  52. toolname=physio_stress.modname..":"..tool.."_grass"
  53. armor:register_armor(toolname,tt_def)
  54. end
  55. end