init.lua 1.8 KB

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