resaloli

GUI

Sep 29th, 2013
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.42 KB | None | 0 0
  1. bridge = peripheral.wrap("left")
  2. bridge.clear()
  3. function EUStorage()
  4.   batbox1 = peripheral.wrap("batbox_0")
  5.   batbox2 = peripheral.wrap("batbox_1")
  6.   batbox3 = peripheral.wrap("batbox_2")
  7.   batbox4 = peripheral.wrap("batbox_3")
  8. end
  9.  
  10. function BCStorage()
  11.   energycell1 = peripheral.wrap("redstone_energy_cell_0")
  12.   energycell2 = peripheral.wrap("redstone_energy_cell_1")
  13.   energycell3 = peripheral.wrap("redstone_energy_cell_2")
  14.   energycell4 = peripheral.wrap("redstone_energy_cell_3")
  15.   energycell5 = peripheral.wrap("redstone_energy_cell_4")
  16.   energycell6 = peripheral.wrap("redstone_energy_cell_5")
  17. end
  18.  
  19. function tanks()
  20.   tank1 = peripheral.wrap("steel_tank_valve_2")
  21.   tank2 = peripheral.wrap("steel_tank_valve_3")
  22.   tank3 = peripheral.wrap("steel_tank_valve_4")
  23.   tank4 = peripheral.wrap("steel_tank_valve_5")
  24. end
  25.  
  26. function boilers()
  27.     boiler1 = peripheral.wrap("solid_fueled_boiler_firebox_0")
  28.     boiler2 = peripheral.wrap("liquid_fueled_boiler_firebox_0")
  29. end
  30.  
  31. function rest()
  32.   turbine1 = peripheral.wrap("steam_turbine_housing_0")
  33. end
  34.  
  35. function wrapAll()
  36.   EUStorage()
  37.   BCStorage()
  38.   tanks()
  39.   boilers()
  40.   rest()
  41. end
  42.  
  43. wrapAll()
  44. print("Loaded Wraps!")
  45. sleep(0.5)
  46. print("Starting program")
  47. sleep(5)
  48. function debugTanksTables()
  49.     adnTable = tank1.getTanks("unknown")
  50.     adntank = adnTable[1]
  51.    
  52.     fuelTable = tank2.getTanks("unknown")
  53.     fueltank = fuelTable[1]
  54.    
  55.     oilTable = tank3.getTanks("unknown")
  56.     oiltank = oilTable[1]
  57.    
  58.     steamTable = tank4.getTanks("unknown")
  59.     steamtank = steamTable[1]
  60. end
  61.  
  62. debugTanksTables()
  63.  
  64. print("Data Colected")
  65. print("Preparing Data to be shown")
  66. sleep(5)
  67. function draw()
  68.   local xCords = 5
  69.   local EUall = batbox1.getCapacity() + batbox2.getCapacity() + batbox3.getCapacity() + batbox4.getCapacity()
  70.   local EUcurrent = batbox1.getStored() + batbox2.getStored() + batbox3.getStored() + batbox4.getStored()
  71.   local BCall = energycell1.getMaxEnergyStored() + energycell2.getMaxEnergyStored() + energycell3.getMaxEnergyStored() + energycell4.getMaxEnergyStored() + energycell5.getMaxEnergyStored() + energycell5.getMaxEnergyStored()
  72.   local BCcurrent = energycell1.getEnergyStored() + energycell2.getEnergyStored() + energycell3.getEnergyStored() + energycell4.getEnergyStored() + energycell5.getEnergyStored() + energycell5.getEnergyStored()
  73.   ADNAll = adntank.capacity
  74.   ADNCurrent = adntank.amount
  75.   FuelAll = fueltank.capacity
  76.   FuelCurrent = fueltank.amount
  77.   OilAll = oiltank.capacity
  78.   OilCurrent = oiltank.amount
  79.   SteamAll = steamtank.capacity
  80.   SteamCurrent = steamtank.amount
  81.   solidTemp = boiler1.getTemperature()
  82.   liquidTemp = boiler2.getTemperature()
  83.   solidFuel = boiler1.needsFuel()
  84.   maxEnergy = turbine1.getMaxEnergyOutput()
  85.   maintenance = turbine1.needsMaintenance()
  86.  
  87.   local eustoragebox = bridge.addBox(4, 14, 150, 156, 0xC0C0C0, 0.5)
  88.   sleep(0.05)
  89.   local eustoragename = bridge.addText(xCords, 15, "MFSUs", 0x000000)
  90.   local eustorage = bridge.addText(xCords, 25, "Energy: "..EUall.."/"..EUcurrent, 0x000000)
  91.   local bcstoragename = bridge.addText(xCords, 35, "Energy Cells", 0x000000)
  92.   local bcstorage = bridge.addText(xCords, 45, "Energy: "..BCall.."/"..BCcurrent, 0x000000)
  93.   local tanksname = bridge.addText(xCords, 55, "Tanks", 0x000000)
  94.   local adnstorage = bridge.addText(xCords, 65, "ADN: "..ADNAll.."/"..ADNCurrent, 0x000000)
  95.   local fuelstorage = bridge.addText(xCords, 75, "Fuel: "..FuelAll.."/"..FuelCurrent, 0x000000)
  96.   local oilstorage = bridge.addText(xCords, 85, "Oil: "..OilAll.."/"..OilCurrent, 0x000000)
  97.   local steamstorage = bridge.addText(xCords, 95, "Steam: "..SteamAll.."/"..SteamCurrent, 0x000000)
  98.   local bcstoragename = bridge.addText(xCords, 105, "Boilers", 0x000000)
  99.   local solidtemp = bridge.addText(xCords, 115, "SolidTemp: "..solidTemp.."ºC", 0x000000)
  100.   local solidtemp = bridge.addText(xCords, 125, "LiquidTemp: "..liquidTemp.."ºC", 0x000000)
  101.   local soldineedsfuel = bridge.addText(xCords, 135, "Needs Fuel: "..solidFuel, 0x000000)
  102.   local maxoutput = bridge.addText(xCords, 145, "Turbine output: "..maxEnergy, 0x000000)
  103.   local needsmaintenance = bridge.addText(xCords, 155, "Needs Maintenance: "..maintenance, 0x000000)
  104. end
  105.  
  106. bridge.clear()
  107. debugTanksTables()
  108. draw()
  109. while true do
  110.     for i = 1, 15 do
  111.         bridge.clear()
  112.         debugTanksTables()
  113.         draw()
  114.         sleep(1)
  115.         if i == 15 then
  116.             i = 1
  117.         end
  118.     end
  119.     sleep(0.0005)
  120. end
Add Comment
Please, Sign In to add comment