Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local basenet;do local function b()local c,d=http.get"https://pastebin.com/raw/QnFKq9pE"if not c then return false,d end;local e=c.readAll()local f,d=load(e)if not f then return false,d end;return pcall(f)end;for g=0,8 do local h,i=b()if not h then printError(i)sleep(math.pow(2,g))else basenet=i;break end end end
- local low_threshold = settings.get "basenet.low_threshold" or 0.75
- local cell = peripheral.wrap(settings.get "basenet.cell" or error "cell name required")
- local delay = 0.2
- local delay_ticks = delay / 0.05
- local last
- basenet.interval(function()
- local energy = cell.getEnergyStored()
- local diff
- if cell.getAverageChangePerTick then
- diff = cell.getAverageChangePerTick()
- else
- if last then
- diff = (energy - last) / delay_ticks
- end
- last = energy
- end
- local level = energy / (cell.getMaxEnergyStored or cell.getEnergyCapacity)()
- print("IO", diff, "LEVEL", level, "ENERGY", energy)
- basenet.update { level = level, io = diff, low = level < low_threshold }
- end, delay)
- basenet.run()
Add Comment
Please, Sign In to add comment