Advertisement
massacring

VeinMine

Jul 18th, 2024
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. local MiningLib = require('MassaMiningTurtleLib')
  2.  
  3. local tags = {}
  4. local ids = {}
  5. local inclusive
  6.  
  7. local function tutorial()
  8.     print("How to use the VeinMine script.")
  9.     print("")
  10.     print("[] means required.")
  11.     print("<> means optional.")
  12.     print("bool means either true or false.")
  13.     print("")
  14.     print("VerticalMining [inclusive: bool] <id: text> <tag: #text>")
  15.     print("")
  16.     print("You can enter as many tags and ids as you wish.")
  17.     print("Tags must always be affixed with '#'.")
  18.     print("'inclusive' is whether the ids and tags should be a whitelist (true) or blacklist (false).")
  19.     print("")
  20.     print("Example command:")
  21.     print("'VeinMine true #minecraft:logs #minecraft:leaves'")
  22.     print("This will mine all logs and leaves connected in front of the turtle.")
  23. end
  24.  
  25. local function init()
  26.     if arg[1] == "help" then return true end
  27.     if (arg[1] and string.lower(arg[1])) == "true" and true or false then
  28.         inclusive = true
  29.     elseif (arg[1] and string.lower(arg[1])) ~= "false" then error("Requires a boolean argument.", 0)
  30.     else inclusive = false end
  31.     for i,argument in ipairs(arg) do
  32.         if i <= 1 then goto continue end
  33.  
  34.         if string.sub(argument, 1, 1) == "#" then
  35.             tags[i-1] = argument:sub(2)
  36.         else
  37.             ids[i-1] = argument
  38.         end
  39.  
  40.         ::continue::
  41.     end
  42.  
  43.     MiningLib.veinMine(inclusive, ids, tags)
  44. end
  45.  
  46. local guide = init()
  47. if guide then tutorial() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement