Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bridge = peripheral.wrap("left")
- local net = peripheral.wrap("bottom")
- local tank1 = peripheral.wrap("iron_tank_valve_0")
- local tank2 = peripheral.wrap("iron_tank_valve_1")
- local massFabb = peripheral.wrap("advanced_machine_block_0")
- local modem = peripheral.wrap("bottom")
- modem.open(1)
- modem.transmit(1,1,'Prepare!')
- bridge.clear()
- term.clear()
- print("Wraps Carregados!")
- sleep(0.5)
- print("Começando Programa!")
- function debugTables()
- lavaTable = tank1.getTanks("unknown")
- lavatank = lavaTable[1]
- mobTable = tank2.getTanks("unknown")
- mobtank = mobTable[1]
- end
- debugTables()
- local cores = {}
- cores.red = 0xff3333
- cores.blue = 0x7dd2e4
- cores.yellow = 0xffff4d
- cores.green = 0x4dff4d
- cores.gray = 0xe0e0e0
- cores.preto = 0x000000
- function desenho()
- bridge.clear()
- local mainBox = caixa(20, 20, 145, 50, cores.gray, 0.5)
- local outlineT = caixa(18,18,150,2,cores.blue,0.5)
- local outlineB = caixa(18,70,150,2,cores.blue,0.5)
- end
- function desenho1()
- bridge.clear()
- local mainBox = caixa(20, 20, 95, 50, cores.gray, 0.5)
- local outlineT = caixa(18,18,100,2,cores.blue,0.5)
- local outlineB = caixa(18,70,100,2,cores.blue,0.5)
- end
- function menu()
- bridge.clear()
- desenho()
- sleep(1)
- texto(22, 22, "$$eneMJ = Energia MJ", cores.red)
- texto(22, 32, "$$eneEU = Energia EU", cores.red)
- texto(22, 42, "$$tankLava = Tank de Lava", cores.red)
- texto(22, 52, "$$tankMob = Tank de Mob", cores.red)
- texto(22, 62, "$$music = Musica Portal", cores.red)
- end
- function caixa(x, y, w, h, col, opa)
- bridge.addBox(x,y,w,h,col,opa)
- end
- function texto(x, y, text, col)
- bridge.addText(x,y,text,col)
- end
- function MJs()
- while true do
- event, command = os.pullEvent("chat_command")
- if command == "eneMJ" then
- repeat
- bridge.clear()
- desenho1()
- print(command)
- local totalStorage = net.callRemote("redstone_energy_cell_0","getMaxEnergyStored")+net.callRemote("redstone_energy_cell_1","getMaxEnergyStored")
- local freeStorage = net.callRemote("redstone_energy_cell_0","getEnergyStored")+net.callRemote("redstone_energy_cell_1","getEnergyStored")
- local mjIndicator = (freeStorage/totalStorage) * 50
- texto(22, 22, "MJ Storage", cores.red)
- texto(22, 32, freeStorage.."/"..totalStorage, cores.green)
- sleep(2)
- until command ~= "eneMJ"
- end
- end
- end
- function EUs()
- while true do
- event, command = os.pullEvent("chat_command")
- if command == "eneEU" then
- repeat
- bridge.clear()
- desenho1()
- print(command)
- local totalStorage = net.callRemote("batbox_0","getCapacity")
- local freeStorage = net.callRemote("batbox_0","getStored")
- local euIndicator = (freeStorage/totalStorage) * 50
- texto(22, 22, "EU Storage", cores.red)
- texto(22, 32, freeStorage.."/"..totalStorage, cores.green)
- sleep(2)
- until command ~= "eneEU"
- end
- end
- end
- function tankL()
- while true do
- event, command = os.pullEvent("chat_command")
- if command == "tankLava" then
- repeat
- bridge.clear()
- desenho1()
- print(command)
- local totalStorage = lavatank.capacity
- local freeStorage = lavatank.amount
- local lavaIndicator = (freeStorage/totalStorage) * 50
- texto(22, 22, "Lava Storage", cores.red)
- texto(22, 32, freeStorage.."/"..totalStorage, cores.green)
- sleep(2)
- until command ~= "tankLava"
- end
- end
- end
- function tankM()
- while true do
- event, command = os.pullEvent("chat_command")
- if command == "tankMob" then
- repeat
- bridge.clear()
- desenho1()
- print(command)
- local totalStorage = mobtank.capacity
- local freeStorage = mobtank.amount
- local mobIndicator = (freeStorage/totalStorage) * 50
- texto(22, 22, "Mob Ess. Storage", cores.red)
- texto(22, 32, freeStorage.."/"..totalStorage, cores.green)
- sleep(2)
- until command ~= "tankMob"
- end
- end
- end
- function massFab()
- while true do
- event, command = os.pullEvent("chat_command")
- if command == "massFab" then
- repeat
- bridge.clear()
- desenho1()
- print(command)
- if massFabb.getStackInSlot(2) == nil then
- uuMatter = 0
- else
- uuMatterTable = massFabb.getStackInSlot(2)
- uuMatter = uuMatterTable["qty"]
- end
- if massFabb.getStackInSlot(1) == nil then
- amplificador = 0
- else
- amplificadorTable = massFabb.getStackInSlot(1)
- amplificador = amplificadorTable["qty"]
- end
- local progress = massFabb.getProgressAsString()
- texto(22, 22, "MassFab", cores.red)
- texto(22, 32, uuMatter.."/64", cores.green)
- texto(22, 42, "Progresso: "..progress, cores.green)
- texto(22, 52, "Amplificador: "..amplificador, cores.green)
- sleep(2)
- until command ~= "massFab"
- end
- end
- end
- function music()
- while true do
- event, command = os.pullEvent("chat_command")
- if command == "music" then
- print(command)
- local jukebox = peripheral.wrap("auto-jukebox_0")
- jukebox.playRecord()
- end
- end
- end
- function start()
- while true do
- event, command = os.pullEvent("chat_command")
- if command == "start" then
- print(command)
- bridge.clear()
- menu()
- end
- end
- end
- function secOn()
- while true do
- event, command = os.pullEvent("chat_command")
- if command == "secOn" then
- print(command)
- modem.transmit(1, 1, "SecON")
- end
- end
- end
- function secOff()
- while true do
- event, command = os.pullEvent("chat_command")
- if command == "secOff" then
- print(command)
- modem.transmit(1, 1, "SecOFF")
- end
- end
- end
- function secState()
- while true do
- event, command = os.pullEvent("chat_command")
- if command == "secState" then
- repeat
- bridge.clear()
- desenho1()
- print(command)
- modem.transmit(1, 1, "SecState")
- local _, side, freq, rfreq, message = os.pullEvent('modem_message')
- print(message)
- texto(22, 22, "Sec State", cores.red)
- texto(22, 32, "Estado: "..message, cores.green)
- sleep(2)
- until command ~= "secState"
- end
- end
- end
- function checkCommand()
- while true do
- local event, command = os.pullEvent("chat_command")
- end
- end
- print("Dados Carregados")
- sleep(1)
- print("Programa Pronto")
- menu()
- parallel.waitForAny(music, massFab, start , MJs, EUs, tankL, tankM, secState, secOn, secOff, checkCommand)
Add Comment
Please, Sign In to add comment