Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local laser = peripheral.find("laserAmplifier")
- local pw_confirm = "1234"
- local i = 1
- local max = 75
- local r = 3
- -- The configuration of the computer should be:
- -- Left side of redstone: toggle the cables
- -- Right side of redstone: toggle the laser amplifier
- -- 2 modems are rquired, connecting the computer to the amplifier
- local function Charging()
- textutils.slowPrint("Starting up charging unit", time)
- rs.setOutput("left", true)
- i = i + 3
- laser_energy = laser.getEnergy() * 100 / laser.getMaxEnergy()
- while laser_energy < max do
- laser_energy = laser.getEnergy() * 100 / laser.getMaxEnergy()
- term.setCursorPos(1, i)
- term.clearLine()
- textutils.slowPrint("...", 5)
- term.setCursorPos(1, i+1)
- print(laser_energy .. "%")
- term.clearLine()
- os.sleep(0.1)
- end
- rs.setOutput("left", false)
- textutils.slowPrint("Module charged at " .. max .. "%", time)
- end
- ----------------------------------------------------------------------------------
- local function EndProcess()
- textutils.slowPrint("Ignition in", time)
- while r > 0 do
- print(r)
- r = r - 1
- os.sleep(1)
- end
- rs.setOutput("right", true)
- os.sleep(1)
- rs.setOutput("right", false)
- textutils.slowPrint("The module has been fired", time)
- end
- ----------------------------------------------------------------------------------
- local function PasswordConfirmedAuto()
- Charging()
- EndProcess()
- end
- ----------------------------------------------------------------------------------
- local function PasswordConfirmedManual()
- Charging()
- textutils.slowWrite("Fire?: ", time)
- firing = read()
- EndProcess()
- end
- ----------------------------------------------------------------------------------
- while true do
- term.clear()
- term.setCursorPos(1, 1)
- print("PAD Online")
- os.sleep(1)
- print("---------------")
- i = i + 3
- term.setCursorPos(1, i)
- textutils.slowWrite("Insert password to power up the module: ", time)
- pw = read("*")
- if pw == pw_confirm then
- i = i + 1
- term.setCursorPos(1, i)
- textutils.slowPrint("The password has been confirmed", time)
- os.sleep(1)
- i = i + 3
- term.setCursorPos(1, i)
- while true do
- textutils.slowWrite("Insert mode: ", time)
- mode = read()
- if mode == "auto" then
- PasswordConfirmedAuto()
- break
- elseif mode == "manual" then
- PasswordConfirmedManual()
- break
- end
- end
- break
- else
- i = 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement