Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --<>{}[]
- --Globals
- local component = require("component")
- local sides = require("sides")
- local term = require("term")
- local event = require("event")
- local clock = 0.25
- local net = require("internet")
- local Chtene_Itemy = {"Diamond", "Cobblestone", "Yellorium Ingot", "Iron Ingot", "Osmium Ingot", "Ender Pearl", "Redstone", "Oak Wood"}
- --Setting up switch boards:
- local iter = component.list("switch_board")
- local it1 = iter()
- local it2 = iter()
- local switch2 = 0
- local switch1 = 0
- if it1:sub(1,4) == "b95f" then
- switch1 = component.proxy(it1)
- switch2 = component.proxy(it2)
- else
- switch1 = component.proxy(it2)
- switch2 = component.proxy(it1)
- end
- --Setting up light boards:
- local iterl = component.list("light_board")
- local it1l = iterl()
- local it2l = iterl()
- local light1 = 0
- local light2 = 0
- if it1l:sub(1,4) == "837d" then
- light1 = component.proxy(it1l)
- light2 = component.proxy(it2l)
- else
- light1 = component.proxy(it2l)
- light2 = component.proxy(it1l)
- end
- --Default Switch
- local MP1 = switch2.isActive(4)
- local MP2 = switch2.isActive(3)
- for i=1, 4 do
- switch1.setActive(i, false)
- switch2.setActive(i, false)
- end
- switch2.setActive(4, MP1)
- switch2.setActive(3, MP2)
- --Default Switch
- for i=1, 4 do
- light1.setActive(i, false)
- light2.setActive(i, false)
- end
- light1.setColor(1, 0x00FF00)
- light1.setActive(1, true)
- local BlinkState = false
- light1.setColor(2, 0x0000FF)
- --Debug Card
- local debug = component.debug
- --Reactor
- local reactor = component.br_reactor
- local function RCK()
- return reactor.getEnergyStored()/100000
- end
- --Redstone
- local RS = component.redstone
- --Glasses
- local Glasses = component.openperipheral_bridge
- --ME-Energie
- local ECube = component.tile_thermalexpansion_cell_hardened_name
- local function EMK()
- return ECube.getEnergyStored()/ECube.getMaxEnergyStored()*100
- end
- --Alarm
- local Alarm = component.os_alarm
- Alarm.setRange(150)
- local function round(num, DecPlac)
- local mult = math.pow(10, DecPlac or 0)
- return math.floor(nummult+0.5)/mult
- end
- --Main
- while true do
- local NewLine = ""
- light1.setActive(2, BlinkState)
- BlinkState = not BlinkState
- local CurrentReactor = RCK()
- local CurrentME = EMK()
- local Reactor_State=reactor.getActive()
- print("Reactor: " .. CurrentReactor)
- print("MECube: " .. CurrentME)
- print("")
- NewLine = NewLine .. "Reactor: " .. CurrentReactor .. "\r\n"
- --Domecek lockdown
- if switch2.isActive(4) then
- RS.setOutput(sides.top, 15)
- else
- RS.setOutput(sides.top, 0)
- end
- --DownDoor
- if not switch2.isActive(3) then
- RS.setOutput(sides.forward, 15)
- else
- RS.setOutput(sides.forward, 0)
- end
- --Player info
- local oldLen = 65
- local Players = debug.getPlayers()
- local Gy=10
- for k,P_Name in pairs(Players) do
- if type(P_Name) == "string" then
- player = debug.getPlayer(P_Name)
- P_World = player.getWorld()
- local info = " "
- if player == nil then
- else
- info = P_Name .. " " .. math.floor(player.getHealth()) .. " " .. P_World.getDimensionName()
- end
- local len = string.len(info)*6
- if oldLen < len then
- oldLen = len
- end
- Gy=Gy+10
- end
- end
- Glasses.addBox(1,1,oldLen,Gy,0xFFFFFF,0.2)
- Gy=10
- for k,P_Name in pairs(Players) do
- if type(P_Name) == "string" then
- player = debug.getPlayer(P_Name)
- P_World = player.getWorld()
- local info = " "
- if player == nil then
- else
- local HP =player.getHealth()
- if HP == nil then
- HP = 0
- end
- info = P_Name .. " " .. math.floor(HP) .. " " .. P_World.getDimensionName()
- end
- NewLine = NewLine .. info.."\r\n"
- print(info)
- Glasses.addText(1,Gy,info,0)
- Gy=Gy+10
- end
- end
- --Glasses
- Glasses.addText(1,1,"R: "..CurrentReactor, 0)
- Glasses.sync()
- --Reactor Alarm check
- if ((CurrentReactor < 10) and not Reactor_State) or CurrentME < 95 then
- Alarm.activate()
- else
- Alarm.deactivate()
- end
- if not Reactor_State then
- reactor.setActive(true)
- end
- --End
- if switch1.isActive(1) then
- switch1.setActive(1, false)
- light1.setColor(1, 0xFF0000)
- break
- end
- --ME info
- ME = component.me_controller
- NewLine = NewLine .. "Items: \r\n\r\n"
- for k, v in pairs(ME.getItemsInNetwork()) do
- if type(v) == "table" then
- for _, item in pairs(Chtene_Itemy) do
- if item == v.label then
- NewLine = NewLine .. v.label .. "\t" .. v.size .. "\r\n"
- end
- end
- end
- end
- -- TCP send
- local con = net.open("XXXX", 00000)
- if con then
- print(NewLine)
- con:write(NewLine)
- con:flush()
- else
- print("No Con")
- end
- os.sleep(clock)
- term.clear()
- Glasses.clear()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement