Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --написано Zardar (dc Taoshi)-------
- local max_rod_depth = 10 --максимальная глубина стержней
- local eu_low = 2.0e9 --цифра перед е = к-во энергии в лярдах
- local eu_high = 6.0e9
- local pause = 0.4 -- длина паузы
- ---------------------------------------
- local computer = require('computer')
- local component = require('component')
- local fs = require('filesystem')
- local unicode = require('unicode')
- local gpu = require('component').gpu
- local term = require('term')
- local os = require('os')
- local pullSignal = computer.pullSignal
- local events = {component_removed='removed',
- component_added='added'
- --touch='touch',
- --drag='touch',
- --drop='touch',
- --key_up='keyUp'
- }
- local iter,tps = 0, 0
- local current_rods_lvl = max_rod_depth
- local eu_in, eu_out, ener, tps = '','','',''
- local time = computer.uptime()
- local t = time
- local actions,reactor = {},{}
- local lapotronka=require('component').impact_lsc
- for f in pairs(component.list('impact_reactor'))
- do reactor[#reactor+1]=component.proxy(f) end
- -------------------------------------
- local function rods(n)
- for f in pairs (reactor) do
- reactor[f].setLevelRods(n)
- end
- return true
- end
- -------------------------------------
- local function time()
- local f=io.open('/tmp/f','w')
- f:write('how are you doing?')
- f:close()
- return(fs.lastModified('/tmp/f'))
- end
- local function digital(n)
- local text=''
- for f in string.gmatch(n,'%d') do text=text..f end
- return text
- end
- --------------------------------------
- --function computer.pullSignal(...)
- --local e = {pullSignal(...)}
- -- if events[e[1]] then
- -- return actions[events[e[1]]](e)
- -- end
- -- return true --table.unpack(e)
- --end
- -------------------------------------------
- events.component_removed=function(e)
- return true
- end
- events.component_added=function(e)
- return true
- end
- -------------------------------------------
- function setRods()
- local info=lapotronka.getSensorInformation()
- local text,eu,eu_in,eu_out='','','',''
- text=digital(info[2])
- eu=tonumber(text)
- eu_in=digital(info[6])
- eu_out=digital(info[8])
- if eu<eu_low then if current_rods_lvl < max_rod_depth then rods(max_rod_depth) current_rods_lvl=max_rod_depth end end-- Если мало то стержни на Макс погружение
- if eu>eu_high then if current_rods_lvl > 1 then rods(1) current_rods_lvl=1 end end-- Если больше то стержни на 10%
- ener=tostring(math.floor(eu/1000000))..'M '
- gpu.fill(3,2,27,9,' ')
- gpu.set(4,7,'ХРАНИТСЯ:')
- gpu.set(16,7,ener)
- gpu.set(4,9,'EU IN:')
- gpu.set(16,9,eu_in)
- gpu.set(4,11,'EU OUT:')
- gpu.set(16,11,eu_out)
- gpu.set(4,5,'ПОГРУЖЕНИЕ:')
- gpu.set(16,5,tostring(current_rods_lvl)..'0%')
- gpu.set(4,3,"TPS: "..tostring(tps))
- end
- -----------------------------
- term.clear()
- gpu.setBackground(0x333333)
- gpu.setForeground(0x11ee11)
- --gpu.fill(1,1,33,11,' ')
- while true do setRods()
- iter=iter+1
- if iter == 5 then inner=time() end
- os.sleep(pause)
- if iter == 5 then outer=time() end
- if iter == 5 then tps = string.sub(20000 * pause / (outer - inner),1,5) end
- if iter == 5 then iter = 0 end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement