init.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. -- This uses a trick: you can first define the recipes using all of the base
  2. -- colors, and then some recipes using more specific colors for a few non-base
  3. -- colors available. When crafting, the last recipes will be checked first.
  4. local dyes = {
  5. {"white", "White", "basecolor_white"},
  6. {"grey", "Grey", "basecolor_grey"},
  7. {"black", "Black", "basecolor_black"},
  8. {"red", "Red", "basecolor_red"},
  9. {"yellow", "Yellow", "basecolor_yellow"},
  10. {"green", "Green", "basecolor_green"},
  11. {"cyan", "Cyan", "basecolor_cyan"},
  12. {"blue", "Blue", "basecolor_blue"},
  13. {"magenta", "Magenta", "basecolor_magenta"},
  14. {"orange", "Orange", "excolor_orange"},
  15. {"violet", "Violet", "excolor_violet"},
  16. {"brown", "Brown", "unicolor_dark_orange"},
  17. {"pink", "Pink", "unicolor_light_red"},
  18. {"dark_grey", "Dark Grey", "unicolor_darkgrey"},
  19. {"dark_green", "Dark Green", "unicolor_dark_green"},
  20. }
  21. for i = 1, #dyes do
  22. local name, desc, craft_color_group = unpack(dyes[i])
  23. minetest.register_node("wool:" .. name, {
  24. description = desc .. " Wool",
  25. tiles = {"wool_" .. name .. ".png"},
  26. is_ground_content = false,
  27. groups = utility.dig_groups("wool", {
  28. flammable = 3, wool = 1,
  29. wool_block = 1,
  30. fall_damage_add_percent = -30,
  31. }),
  32. sounds = default.node_sound_defaults(),
  33. })
  34. minetest.register_craft{
  35. type = "shapeless",
  36. output = "wool:" .. name,
  37. recipe = {"group:dye," .. craft_color_group, "group:wool_block"},
  38. }
  39. end
  40. -- legacy
  41. -- Backwards compatibility with jordach's 16-color wool mod
  42. minetest.register_alias("wool:dark_blue", "wool:blue")
  43. minetest.register_alias("wool:gold", "wool:yellow")