init.lua 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. local groups = {
  2. "cracky", "dig_immediate"
  3. }
  4. -- Register dig nodes with 1 digging group, a rating between 1-3 and a level between 0-2
  5. for g=1, #groups do
  6. local gr = groups[g]
  7. for r=1, 3 do
  8. for l=0, 2 do
  9. if not (gr=="dig_immediate" and (l>0 or r==1)) then
  10. local d
  11. if l > 0 then
  12. d = string.format("Dig Test Node: %s=%d, level=%d", gr, r, l)
  13. else
  14. d = string.format("Dig Test Node: %s=%d", gr, r)
  15. end
  16. local tile = "dignodes_"..gr..".png^dignodes_rating"..r..".png"
  17. if l==1 then
  18. tile = tile .. "^[colorize:#FFFF00:127"
  19. elseif l==2 then
  20. tile = tile .. "^[colorize:#FF0000:127"
  21. end
  22. core.register_node("dignodes:"..gr.."_"..r.."_"..l, {
  23. description = d,
  24. tiles = { tile },
  25. groups = { [gr] = r, level = l },
  26. })
  27. end
  28. end
  29. end
  30. end
  31. -- Node without any digging groups
  32. core.register_node("dignodes:none", {
  33. description = "Dig Test Node: groupless".."\n"..
  34. "Can't be dug by normal digging tools".."\n"..
  35. "(use the Remover tool to remove)",
  36. tiles = {"dignodes_none.png"},
  37. })