Advertisement
mathiaas

tune

Apr 30th, 2024 (edited)
928
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. local scriptName = "tune"
  2. local args = {...}
  3.  
  4. if #args < 1 then
  5.     print("Usage: " .. scriptName .. " <channel>")
  6.     return
  7. end
  8.  
  9. local CHANNEL = args[1]
  10. dofile("constants")
  11.  
  12. if not COLOR_CHANNELS[CHANNEL] then
  13.     print(CHANNEL .. " is not a valid color channel.")
  14.     return
  15. end
  16.  
  17. local success, data = turtle.inspect()
  18. if not success or data.name ~= BLOCKS.enderChest.name then
  19.     print("Place an ender chest in front of the turtle")
  20.     return
  21. end
  22.  
  23. local enderChest = peripheral.wrap("front")
  24. if enderChest == nil then
  25.     print("Failed to connect to ender chest")
  26.     return
  27. end
  28.  
  29. enderChest.setColors(unpack(COLOR_CHANNELS[CHANNEL]))
  30. print("Ender chest is now tuned to: '" .. CHANNEL .. "'")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement