Off Topic > Off Topic

Mr Queeba's ManyMods7 BLF Minecraft Server (Online, 24/7!)

Pages: << < (6/7) > >>

Pah1023:

boop
Working on a code for reactor statistics and stuff during free time.





--- Quote ---local component = require "component"
local event = require "event"
local keyboard = require "keyboard"
reactor = component.br_reactor
err = false
if reactor == nil then
    print("Could not find reactor.")
    err = true
end
gpu=component.gpu
if gpu == nil then
    print("Could not find gpu.")
    err = true
end
function fls()
   local scr
   local l = 0
   for k in pairs(component.list("screen")) do
      local x, y = component.proxy(k).getAspectRatio()
      local size = x * y
      if l < size then
         l = size
         scr = k
      end
   end
   return scr
end

screen = fls()
if screen == nil then
   print("Could not find screen.")
   err = true
end

if err then
   print("One or more errors occurred during startup.")
   return
end
gpu.bind(screen)
w, h = gpu.getResolution()
-- ╔═╗ ╚═╝ ║
function drawHeader()
   gpu.set(1,1,"╔")
   gpu.set(1,2,"║")
   gpu.set(1,3,"╚")
   gpu.fill(2,1,w-3,1,"═")
   gpu.set(w-1,1,"╗")
   gpu.set(w-1,2,"║")
   gpu.set(w-1,3,"╝")
   gpu.fill(2,3,w-3,1,"═")
   gpu.set(2,2,"Reactor Monitor")
end
--touch(screenAddress: string, x: number, y: number, button: number, playerName: string)
local rf = {"RF", "KRF", "MRF", "GRF", "TRF"}
function niceifyNumber(i)
   local step = 1
   while i > 1024 and step < #rf do
      step = step+1
      i = i/1024
   end
   return tostring(math.floor(i*10)/10) .. " " .. rf[step]
end
function handleTouchEvent(screenAddress, x, y, button, playerName)
   if screenAddress ~= screen.address then return end
end
gpu.fill(1,1,w,h," ")
drawHeader()
function drawGraph(x, y, w, h, data)
   local fg = gpu.getForeground()
   local bg = gpu.getBackground()
   gpu.setBackground(0x333333)
   gpu.fill(x,y,w,h," ")
   local steps = w/#data
   local lo = 0
   local hi = 0
   for i, v in pairs(data) do
      if v > hi then hi = v end
      if v < lo then lo = v end
   end
   local t = hi-lo
   
   for i, v in ipairs(data) do
      local xoff = (math.floor(steps*(i-1)))
      gpu.setForeground(0x00FF00)
      gpu.set(x+xoff, y, tostring(niceifyNumber(v)))
      gpu.fill(x+xoff, y+1, 1, h-1, "|")
      gpu.setForeground(0xFF0000)
      local yoff = math.floor((v-lo)/t*(h-2)+0.5)
      gpu.set(x+xoff, y+1+(h-1)-yoff, ".")
   end
   gpu.setForeground(fg)
   gpu.setBackground(bg)
end
local rfs = {-1}
local pp = {-1}
local rfsur = 10
local rfsu = 0
while true do
   if screen == nil then
      screen = fls()
      if screen == nil then
         break
      end
      gpu.bind(screen)
   end
   gpu.setBackground(0x000000);
   gpu.setForeground(0xFFFFFF);
   gpu.fill(1,4,w,h-4," ")
   gpu.fill(1,4,w,1," ")
   rfsu = rfsu + 1
   if rfsu > rfsur then
      rfs[#rfs+1] = reactor.getEnergyStored()
   end
   if #rfs > 10 then
      table.remove(rfs, 1)
   end
   rfs[#rfs] = reactor.getEnergyStored()

   pp[#pp+1] = reactor.getEnergyProducedLast Tick()
   if #pp > 25 then
      table.remove(pp, 1)
   end
   gpu.set(1,4,"RF Stored: ")
   drawGraph(1,5,w,20,rfs)
   gpu.fill(1,25,w,1," ")
   gpu.set(1,25,"Past Produced: ")
   drawGraph(1,26,w,20,pp)
   if keyboard.isKeyDown('c') and keyboard.isControlDown() then
      break
   end
   local cl = math.floor((reactor.getEnergyStored()-5000000)/10000000*100+0.5)+100
   gpu.set(1,46,"Control Rods: " .. tostring(cl) .. "%")

   reactor.setAllControlRodLevel s(cl)
   os.sleep(0.05)

end
--- End quote ---


Twix:

server was just up for like 2 minutes before dying due to lag

zuc

Mr Queeba:

another pack(tm)
mc 1.12.2, 24/7 hosting by creeperhost apex mc hosting!
once i get the hosting set up the server will be online

Verification:

QUEEBA
DID THE SPIDER REVIVE IT

Mr Queeba:

we are now online!
if you downloaded v1.0 of the pack, please update to 1.1

Pages: << < (6/7) > >>

Go to full version