fabrics.lua 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. --------------------------------------------------------------------------------
  2. -- fabrics.lua: colored fabrics as ingredient for clothes
  3. --------------------------------------------------------------------------------
  4. -- HRtV 2014
  5. -- version: 1.0
  6. -- basics
  7. --------------------------------------------------------------------------------
  8. -- lottclothes:flaxthread - made of default:dry_shrub (4x)
  9. -- lottclothes:flax_<color> - made of flaxthread (5x) and dye:<color> (4x)
  10. local fabric_colors = {
  11. black = "dye:black",
  12. blue = "dye:blue",
  13. brown = "dye:brown",
  14. green = "dye:green",
  15. grey = "dye:grey",
  16. pink = "dye:pink",
  17. red = "dye:red",
  18. white = "dye:white",
  19. yellow = "dye:yellow"
  20. }
  21. -- flaxthreads made of dry_shrub. 2:1
  22. minetest.register_craftitem("lottclothes:flaxthread", {
  23. description = "Flax Thread",
  24. inventory_image = "lottclothes_flaxthread.png",
  25. })
  26. minetest.register_craft({
  27. type = "shapeless",
  28. output = "lottclothes:flaxthread 2",
  29. recipe = {"default:dry_shrub","default:dry_shrub","default:dry_shrub","default:dry_shrub"}
  30. })
  31. -- flax, a fabric made of flaxthreads
  32. for color, dye in pairs(fabric_colors) do
  33. minetest.register_craftitem("lottclothes:flax_"..color, {
  34. description = color:gsub("^%l", string.upper).." Flax",
  35. inventory_image = "lottclothes_flax_"..color..".png"
  36. })
  37. if color == "brown" then
  38. -- default to brown
  39. minetest.register_craft({
  40. output = "lottclothes:flax_"..color.." 3",
  41. recipe = {
  42. {"lottclothes:flaxthread","lottclothes:flaxthread","lottclothes:flaxthread"},
  43. {"lottclothes:flaxthread","lottclothes:flaxthread","lottclothes:flaxthread"},
  44. {"lottclothes:flaxthread","lottclothes:flaxthread","lottclothes:flaxthread"},
  45. }
  46. })
  47. else
  48. -- all other colors require little dye
  49. minetest.register_craft({
  50. output = "lottclothes:flax_"..color.." 3",
  51. recipe = {
  52. {"lottclothes:flaxthread",dye,"lottclothes:flaxthread"},
  53. {dye,"lottclothes:flaxthread",dye},
  54. {"lottclothes:flaxthread",dye,"lottclothes:flaxthread"},
  55. }
  56. })
  57. end
  58. end
  59. -- feltthreads
  60. minetest.register_craftitem("lottclothes:feltthread", {
  61. description = "Felt Thread",
  62. inventory_image = "lottclothes_feltthread.png",
  63. })
  64. minetest.register_craft({
  65. type = "shapeless",
  66. output = "lottclothes:feltthread 2",
  67. recipe = {"group:leaves","group:leaves","group:leaves","group:leaves"}
  68. })
  69. -- felt, a fabric made of feltthreads
  70. for color, dye in pairs(fabric_colors) do
  71. minetest.register_craftitem("lottclothes:felt_"..color, {
  72. description = color:gsub("^%l", string.upper).." Felt",
  73. inventory_image = "lottclothes_felt_"..color..".png"
  74. })
  75. if color == "green" then
  76. -- green is default color, all felt (no dye)
  77. minetest.register_craft({
  78. output = "lottclothes:felt_"..color.." 3",
  79. recipe = {
  80. {"lottclothes:feltthread","lottclothes:feltthread","lottclothes:feltthread"},
  81. {"lottclothes:feltthread","lottclothes:feltthread","lottclothes:feltthread"},
  82. {"lottclothes:feltthread","lottclothes:feltthread","lottclothes:feltthread"},
  83. }
  84. })
  85. else
  86. -- all other colors require little dye
  87. minetest.register_craft({
  88. output = "lottclothes:felt_"..color.." 3",
  89. recipe = {
  90. {"lottclothes:feltthread",dye,"lottclothes:feltthread"},
  91. {dye,"lottclothes:feltthread",dye},
  92. {"lottclothes:feltthread",dye,"lottclothes:feltthread"},
  93. }
  94. })
  95. end
  96. end