Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defaultSide = "left"
- autoModeBool = false
- pocketID = 36
- pocketID2 = 60
- -- BundledCable Color Declarations
- local witherColor = colors.black
- local forwardColor = colors.blue
- local autoModeColor = colors.green
- local autoModeCheckColor = colors.brown
- local autoModeCheckColor2 = colors.magenta
- -- Fixes some API changes
- function colors.subtract(r, ...)
- for n, c in ipairs({ ... }) do
- r = bit.band(r, bit.bnot(c)%2^31)
- end
- return r
- end
- -- Pulses a bundled redstone color
- function redstonePulse(color, side)
- addColor(color, side)
- sleep(.5)
- delColor(color, side)
- end
- -- Turns on a color of a bundled cable
- function addColor(color , side)
- rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side) + color))
- end
- -- Turns a color off of a bundled cable
- function delColor(color, side)
- rs.setBundledOutput(side, colors.subtract(redstone.getBundledOutput(side), color))
- end
- -- Turns on the UberMiner AutoMode
- function autoMode()
- bool = checkColor(autoModeColor, defaultSide)
- bool2 = checkColor(autoModeCheckColor, defaultSide)
- -- If Kilo's server is running the AutoMode this will cancel it from running again.
- if bool2 then
- term.setTextColor(colors.red)
- print("Already Running Somewhere else, remaining off @ nearest Server")
- rednet.send(pocketID, "running")
- rednet.send(pocketID2, "running")
- -- If the Server is running the AutoMode it'll turn it on
- else if bool then
- print("AutoMode now Online!")
- delColor(autoModeColor, defaultSide)
- addColor(autoModeCheckColor2, defaultSide)
- rednet.send(pocketID, true)
- rednet.send(pocketID2, true)
- -- Or Else it'll turn AutoMode off.
- else
- addColor(autoModeColor, defaultSide)
- delColor(autoModeCheckColor2, defaultSide)
- print("AutoMode now Offline!")
- rednet.send(pocketID, false)
- rednet.send(pocketID2, false)
- end
- end
- end
- -- Edit's the startup to boot up on this pastebin
- function startupClear()
- f = fs.open("startup", "w")
- f.write("shell.run('pastebin run J1ErE7pj')")
- f.close()
- end
- --Asks and saves where the bundled cable is locatated
- function redstoneVar()
- print("Where will the redstone output be? [left,right,bottom,top]")
- command = read()
- if command == "left" or command == "right" or command == "bottom" or command == "top" then
- print("Redstone set to "..command.." side")
- f = fs.open("redstoneVar", "w")
- f.writeLine(command)
- f.close()
- os.reboot()
- else
- term.setTextColor(colors.red)
- print("Invalid Input")
- sleep(1)
- redstoneVar()
- end
- end
- -- Asks and saves where the modem is located
- function modemVars()
- print("Where's the Modem? , [left,right,bottom,top]")
- command = read()
- if command == "left" or command == "right" or command == "bottom" or command == "top" then
- print("Modem set to "..command.." side")
- r = fs.open("modemVar", "w")
- r.writeLine(tostring(command))
- r.close()
- redstoneVar()
- else
- term.setTextColor(colors.red)
- print("Invalid Input")
- modemVar()
- end
- end
- -- Checks if a file containing where the modem exists, and where the bundled redstone side is, if not
- -- Then it asks the user where they want it to be and saves it to modemVar and redstoneVar
- function startupVars()
- if fs.exists("modemVar") == false then
- modemVars()
- else
- -- If they have already been configured than it loads the configs,
- -- and Prints the current configs to the screen.
- f = fs.open("modemVar", "r")
- sideM = f.readLine()
- rednet.open(sideM)
- f1 = fs.open("redstoneVar", "r")
- defaultSide = f1.readLine()
- f1.close()
- term.setTextColor(colors.cyan)
- print("Loaded with configuration :")
- term.setTextColor(colors.red)
- print("Redstone Side : "..defaultSide)
- term.setTextColor(colors.gray)
- print("Wireless Modem Side : "..sideM)
- term.setTextColor(colors.blue)
- end
- end
- -- Checks if a specific color in bundled cable is on or off / Returns a boolean
- function checkColor(color, side)
- boolean = rs.testBundledInput(side, color)
- --print("CheckColor : "..side.." - Side Color - "..color.." Bool -"..tostring(boolean))
- return boolean
- end
- -- Check's if Kilo's UberMiner is on.
- function checkCancel()
- bool = checkColor(autoModeCheckColor, defaultSide)
- bool2 = checkColor(autoModeColor, defaultSide)
- if bool == true and bool2 == false then
- autoMode()
- end
- end
- addColor(autoModeColor, defaultSide)
- startupClear()
- startupVars()
- -- Checks if a rednet message was received.
- function rednetReceive()
- senderID, message = rednet.receive()
- if senderID == pocketID1 or senderID == pocketID2 then
- if message == "wither" then
- redstonePulse(witherColor, defaultSide)
- else if message == "autoMode" then
- autoMode()
- else if message == "forward" then
- redstonePulse(forwardColor, defaultSide)
- else if message == "forceshut" then
- rs.setBundledOutput(defaultSide, 0)
- os.reboot()
- end
- end
- end
- end
- end
- end
- while true do
- rednetReceive()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement