1
0

crafting_prepare.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. -- Registering some dummy items and recipes for the crafting tests
  2. core.register_craftitem("unittests:torch", {
  3. description = "Crafting Test Item: Torch",
  4. inventory_image = "unittests_torch.png",
  5. groups = { dummy = 1 },
  6. })
  7. core.register_craftitem("unittests:coal_lump", {
  8. description = "Crafting Test Item: Coal Lump",
  9. inventory_image = "unittests_coal_lump.png",
  10. groups = { dummy = 1 },
  11. })
  12. core.register_craftitem("unittests:stick", {
  13. description = "Crafting Test Item: Stick",
  14. inventory_image = "unittests_stick.png",
  15. groups = { dummy = 1 },
  16. })
  17. core.register_craftitem("unittests:iron_lump", {
  18. description = "Crafting Test Item: Iron Lump",
  19. inventory_image = "unittests_iron_lump.png",
  20. groups = { dummy = 1 },
  21. })
  22. core.register_craftitem("unittests:steel_ingot", {
  23. description = "Crafting Test Item: Steel Ingot",
  24. inventory_image = "unittests_steel_ingot.png",
  25. groups = { dummy = 1 },
  26. })
  27. -- Use aliases in recipes for more complete testing
  28. core.register_alias("unittests:steel_ingot_alias", "unittests:steel_ingot")
  29. core.register_alias("unittests:coal_lump_alias", "unittests:coal_lump")
  30. core.register_alias("unittests:iron_lump_alias", "unittests:iron_lump")
  31. -- Recipes for tests: Normal crafting, cooking and fuel
  32. core.register_craft({
  33. output = 'unittests:torch 4',
  34. recipe = {
  35. {'unittests:coal_lump_alias'},
  36. {'unittests:stick'},
  37. }
  38. })
  39. core.register_craft({
  40. type = "cooking",
  41. output = "unittests:steel_ingot_alias",
  42. recipe = "unittests:iron_lump_alias",
  43. })
  44. core.register_craft({
  45. type = "fuel",
  46. recipe = "unittests:coal_lump_alias",
  47. burntime = 40,
  48. })
  49. -- Test tool repair
  50. core.register_craft({
  51. type = "toolrepair",
  52. additional_wear = -0.05,
  53. })
  54. -- Test the disable_repair=1 group
  55. core.register_tool("unittests:unrepairable_tool", {
  56. description = "Crafting Test Item: Unrepairable Tool",
  57. inventory_image = "unittests_unrepairable_tool.png",
  58. tool_capabilities = {
  59. groupcaps = {
  60. cracky = {
  61. times = {3, 2, 1},
  62. }
  63. }
  64. },
  65. groups = { disable_repair = 1, dummy = 1 }
  66. })
  67. core.register_tool("unittests:repairable_tool", {
  68. description = "Crafting Test Item: Repairable Tool",
  69. inventory_image = "unittests_repairable_tool.png",
  70. tool_capabilities = {
  71. groupcaps = {
  72. cracky = {
  73. times = {3, 2, 1},
  74. }
  75. }
  76. },
  77. groups = { dummy = 1 },
  78. })