Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local event = require "event"
- local component = require "component"
- local reactor = component.reactor
- local redstone = component.proxy(component.get("0a9"))
- local rside = 5
- local ventpull = component.proxy(component.get("0f6"))
- local pullside = 4
- local ventput = component.proxy(component.get("0f6"))
- local putside = 5
- local menet4 = component.proxy(component.get("9b3"))
- local m4side = 5
- --local menet2 = component.proxy(component.get("8ca"))
- --local menet1 = component.proxy(component.get("079"))
- local gpu = component.gpu
- local w, h = gpu.getResolution()
- local inv = component.inventory_controller
- local invside = 2
- local invs = inv.getInventorySize(invside)
- local power = 0
- local changing = false
- local heating = false
- local loading=false
- local lzhs = {}
- local li=1
- local rshs = {}
- local si=1
- local rods4 = {}
- local ri4=1
- local rods2 = {}
- local ri2=1
- local rods1 = {}
- local ri1=1
- local mox="Rod"
- local moxdmg=20000
- local vents = {}
- local vi=1
- local ahvs = {}
- local ahvi=1
- local ahes = {}
- local ai=1
- local ohes = {}
- local oi=1
- local hes = {}
- local hi=1
- local tnrs={}
- local ti=1
- local nrs={}
- local ni=1
- local c1s = {}
- local c1i=1
- local c3s = {}
- local c3i=1
- local c6s = {}
- local c6i=1
- local warn=false
- local args={...}
- local eutarget=1000
- local preveu=nil
- if #args>0 then
- eutarget=tonumber(args[1])
- end
- local prevb=0x000000
- function setGpuB(b)
- if b~=prevb then
- gpu.setBackground(b)
- prevb=b
- end
- end
- local prevf=0x000000
- function setGpuF(f)
- if f~=prevf then
- gpu.setForeground(f)
- prevf=f
- end
- end
- function getElement(pos)
- local l=" "
- if inv.getStackInSlot(invside,pos) then
- l=inv.getStackInSlot(invside,pos)
- end
- return l
- end
- local redDmg={}
- local blackDmg={}
- function drawDmg()
- if redDmg and #redDmg>0 then
- setGpuB(0xFF0000)
- for k,t in pairs(redDmg) do
- gpu.set(t[2],t[1],string.rep(" ",t[3]))
- end
- end
- if blackDmg and #blackDmg>0 then
- setGpuB(0x1E1E1E)
- for k,t in pairs(blackDmg) do
- gpu.set(t[2],t[1],string.rep(" ",t[3]))
- end
- end
- end
- function fillDmg(i,j,el,dmg)
- if el=="LZH" then
- dmg=(100000-dmg)/10000
- elseif el=="Rod" or el=="RSH" then
- dmg=(20000-dmg)/2000
- elseif el=="Vent" or el=="AHV" then
- dmg=(1000-dmg)/100
- elseif el=="AHE" or el=="MOX" then
- dmg=(10000-dmg)/1000
- elseif el=="OHE" then
- dmg=(5000-dmg)/500
- elseif el=="HE" then
- dmg=(2500-dmg)/250
- elseif el=="TNR" then
- dmg=(120000-dmg)/12000
- elseif el=="NR" then
- dmg=(30000-dmg)/3000
- elseif el=="C1" then
- dmg=(10000-dmg)/1000
- elseif el=="C3" then
- dmg=(30000-dmg)/3000
- elseif el=="C6" then
- dmg=(60000-dmg)/6000
- end
- if dmg>0 then
- table.insert(redDmg,{i+5,j+2,dmg})
- if dmg<10 then
- table.insert(blackDmg,{i+5,j+2+dmg,11-dmg})
- end
- else
- table.insert(blackDmg,{i+5,j+2,10})
- end
- --[[ setGpuB(0xFF0000)
- gpu.set(j+2,i+5,string.rep(" ",dmg))
- if dmg<10 then
- setGpuB(0x1E1E1E)
- gpu.set(j+2+dmg,i+5,string.rep(" ",10-dmg))
- end]]
- end
- function stopme()
- coroutine.yield()
- return 0
- end
- function checkDmg()
- redDmg={}
- blackDmg={}
- local dmg=0
- local needy=0
- local elem
- for i=1,li-1,1 do
- elem=inv.getStackInSlot(invside,lzhs[i][3])
- if elem then
- fillDmg(lzhs[i][1],lzhs[i][2],"LZH",elem.customDamage)
- else
- fillDmg(lzhs[i][1],lzhs[i][2],"LZH",100000)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,si-1,1 do
- elem=inv.getStackInSlot(invside,rshs[i][3])
- if elem then
- fillDmg(rshs[i][1],rshs[i][2],"RSH",elem.customDamage)
- else
- fillDmg(rshs[i][1],rshs[i][2],"RSH",20000)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,ri4-1,1 do
- elem=inv.getStackInSlot(invside,rods4[i][3])
- if string.match(elem.label,"MOX") then
- mox="MOX"
- moxdmg=10000
- else
- mox="Rod"
- moxdmg=20000
- end
- if elem and not string.match(elem.label,"Depleted") then
- fillDmg(rods4[i][1],rods4[i][2],mox,elem.customDamage)
- else
- fillDmg(rods4[i][1],rods4[i][2],mox,moxdmg)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,ri2-1,1 do
- elem=inv.getStackInSlot(invside,rods2[i][3])
- if string.match(elem.label,"MOX") then
- mox="MOX"
- moxdmg=10000
- else
- mox="Rod"
- moxdmg=20000
- end
- if elem and not string.match(elem.label,"Depleted") then
- fillDmg(rods2[i][1],rods2[i][2],mox,elem.customDamage)
- else
- fillDmg(rods2[i][1],rods2[i][2],mox,moxdmg)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,ri1-1,1 do
- elem=inv.getStackInSlot(invside,rods1[i][3])
- if string.match(elem.label,"MOX") then
- mox="MOX"
- moxdmg=10000
- else
- mox="Rod"
- moxdmg=20000
- end
- if elem and not string.match(elem.label,"Depleted") then
- fillDmg(rods1[i][1],rods1[i][2],mox,elem.customDamage)
- else
- fillDmg(rods1[i][1],rods1[i][2],mox,moxdmg)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,vi-1,1 do
- elem=inv.getStackInSlot(invside,vents[i][3])
- if elem then
- fillDmg(vents[i][1],vents[i][2],"Vent",elem.customDamage)
- else
- fillDmg(vents[i][1],vents[i][2],"Vent",1000)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,ahvi-1,1 do
- elem=inv.getStackInSlot(invside,ahvs[i][3])
- if elem then
- fillDmg(ahvs[i][1],ahvs[i][2],"AHV",elem.customDamage)
- else
- fillDmg(ahvs[i][1],ahvs[i][2],"AHV",1000)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,ai-1,1 do
- elem=inv.getStackInSlot(invside,ahes[i][3])
- if elem then
- fillDmg(ahes[i][1],ahes[i][2],"AHE",elem.customDamage)
- else
- fillDmg(ahes[i][1],ahes[i][2],"AHE",10000)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,oi-1,1 do
- elem=inv.getStackInSlot(invside,ohes[i][3])
- if elem then
- fillDmg(ohes[i][1],ohes[i][2],"OHE",elem.customDamage)
- else
- fillDmg(ohes[i][1],ohes[i][2],"OHE",5000)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,hi-1,1 do
- elem=inv.getStackInSlot(invside,hes[i][3])
- if elem then
- fillDmg(hes[i][1],hes[i][2],"HE",elem.customDamage)
- else
- fillDmg(hes[i][1],hes[i][2],"HE",2500)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,ti-1,1 do
- elem=inv.getStackInSlot(invside,tnrs[i][3])
- if elem then
- fillDmg(tnrs[i][1],tnrs[i][2],"TNR",elem.customDamage)
- else
- fillDmg(tnrs[i][1],tnrs[i][2],"TNR",120000)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,ni-1,1 do
- elem=inv.getStackInSlot(invside,nrs[i][3])
- if elem then
- fillDmg(nrs[i][1],nrs[i][2],"NR",elem.customDamage)
- else
- fillDmg(nrs[i][1],nrs[i][2],"NR",30000)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,c1i-1,1 do
- elem=inv.getStackInSlot(invside,c1s[i][3])
- if elem then
- fillDmg(c1s[i][1],c1s[i][2],"C1",elem.customDamage)
- else
- fillDmg(c1s[i][1],c1s[i][2],"C1",10000)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,c3i-1,1 do
- elem=inv.getStackInSlot(invside,c3s[i][3])
- if elem then
- fillDmg(c3s[i][1],c3s[i][2],"C3",elem.customDamage)
- else
- fillDmg(c3s[i][1],c3s[i][2],"C3",30000)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- for i=1,c6i-1,1 do
- elem=inv.getStackInSlot(invside,c6s[i][3])
- if elem then
- fillDmg(c6s[i][1],c6s[i][2],"C6",elem.customDamage)
- else
- fillDmg(c6s[i][1],c6s[i][2],"C6",60000)
- end
- needy=needy+1
- if needy>18 then
- needy=stopme()
- end
- end
- drawDmg()
- end
- function fillElement(i,j,el,pos)
- local j1=9+j
- local i1=2+i
- pos=pos or 1
- local l=" "
- if el.label then
- l=el.label
- end
- if el=="X" then
- setGpuB(0x696969)
- setGpuF(0x3C3C3C)
- gpu.set(j1+1,i1,"\")
- gpu.set(j1+11,i1,"/")
- gpu.set(j1+3,i1+1,"\")
- gpu.set(j1+9,i1+1,"/")
- gpu.set(j1+5,i1+2,"\")
- gpu.set(j1+7,i1+2,"/")
- gpu.set(j1+7,i1+3,"\")
- gpu.set(j1+5,i1+3,"/")
- gpu.set(j1+9,i1+4,"\")
- gpu.set(j1+3,i1+4,"/")
- gpu.set(j1+11,i1+5,"\")
- gpu.set(j1+1,i1+5,"/")
- elseif el=="0" then
- gpu.set(j1+1,i1,"══════")
- gpu.set(j1+1,i1+5,"══════")
- gpu.set(j1,i1+1,"║║║║",true)
- gpu.set(j1+7,i1+1,"║║║║",true)
- elseif el=="1" then
- gpu.set(j1+7,i1+1,"║║║║",true)
- elseif el=="2" then
- gpu.set(j1+1,i1,"══════")
- gpu.set(j1+1,i1+2,"══════")
- gpu.set(j1+1,i1+5,"══════")
- gpu.set(j1,i1+3,"║║",true)
- gpu.set(j1+7,i1+1,"║")
- elseif el=="3" then
- gpu.set(j1+1,i1,"══════")
- gpu.set(j1+1,i1+2,"══════")
- gpu.set(j1+1,i1+5,"══════")
- gpu.set(j1+7,i1+3,"║║",true)
- gpu.set(j1+7,i1+1,"║")
- elseif el=="4" then
- gpu.set(j1+1,i1+2,"══════")
- gpu.set(j1,i1+1,"║")
- gpu.set(j1+7,i1+1,"║")
- gpu.set(j1+7,i1+3,"║║",true)
- elseif el=="5" then
- gpu.set(j1+1,i1,"══════")
- gpu.set(j1+1,i1+2,"══════")
- gpu.set(j1+1,i1+5,"══════")
- gpu.set(j1,i1+1,"║")
- gpu.set(j1+7,i1+3,"║║",true)
- elseif el=="6" then
- gpu.set(j1+1,i1,"══════")
- gpu.set(j1+1,i1+2,"══════")
- gpu.set(j1+1,i1+5,"══════")
- gpu.set(j1,i1+1,"║")
- gpu.set(j1,i1+3,"║║",true)
- gpu.set(j1+7,i1+3,"║║",true)
- elseif el=="7" then
- gpu.set(j1+1,i1,"══════")
- gpu.set(j1+7,i1+1,"║║║║",true)
- elseif el=="8" then
- gpu.set(j1+1,i1,"══════")
- gpu.set(j1+1,i1+2,"══════")
- gpu.set(j1+1,i1+5,"══════")
- gpu.set(j1,i1+1,"║")
- gpu.set(j1+7,i1+1,"║")
- gpu.set(j1,i1+3,"║║",true)
- gpu.set(j1+7,i1+3,"║║",true)
- elseif el=="9" then
- gpu.set(j1+1,i1,"══════")
- gpu.set(j1+1,i1+2,"══════")
- gpu.set(j1+1,i1+5,"══════")
- gpu.set(j1,i1+1,"║")
- gpu.set(j1+7,i1+3,"║║",true)
- gpu.set(j1+7,i1+1,"║")
- elseif string.match(l,"LZH") then
- setGpuB(0x0000C0)
- gpu.fill(j1+1,i1+1,12,4," ")
- lzhs[li]={i1,j1,pos}
- li=li+1
- elseif string.match(l,"RSH") then
- setGpuB(0xC00000)
- gpu.fill(j1+1,i1+1,12,4," ")
- rshs[si]={i1,j1,pos}
- si=si+1
- elseif string.match(l,"Quad") then
- if string.match(l,"MOX") then
- setGpuB(0x66B680)
- else
- setGpuB(0x006D00)
- end
- gpu.fill(j1+1,i1+1,2,4," ")
- gpu.fill(j1+4,i1+1,2,4," ")
- gpu.fill(j1+8,i1+1,2,4," ")
- gpu.fill(j1+11,i1+1,2,4," ")
- rods4[ri4]={i1,j1,pos}
- ri4=ri4+1
- elseif string.match(l,"Dual") then
- if string.match(l,"MOX") then
- setGpuB(0x66B680)
- else
- setGpuB(0x006D00)
- end
- gpu.fill(j1+4,i1+1,2,4," ")
- gpu.fill(j1+8,i1+1,2,4," ")
- rods2[ri2]={i1,j1,pos}
- ri2=ri2+1
- elseif string.match(l,"Rod") then
- if string.match(l,"MOX") then
- setGpuB(0x66B680)
- else
- setGpuB(0x006D00)
- end
- gpu.fill(j1+6,i1+1,2,4," ")
- rods1[ri1]={i1,j1,pos}
- ri1=ri1+1
- elseif string.match(l,"Advanced Heat Vent") then
- setGpuB(0x33B6FF)
- gpu.fill(j1+1,i1+1,12,4," ")
- ahvs[ahvi]={i1,j1,pos}
- ahvi=ahvi+1
- elseif string.match(l,"Overclocked") then
- setGpuB(0xFFFF40)
- gpu.fill(j1+1,i1+1,12,4," ")
- vents[vi]={i1,j1,pos}
- vi=vi+1
- elseif string.match(l,"Component Heat Vent") then
- setGpuB(0xE1E1E1)
- gpu.fill(j1+1,i1+1,12,4," ")
- elseif string.match(l,"Reactor Heat Vent") then
- setGpuB(0xFF6D00)
- gpu.fill(j1+1,i1+1,12,4," ")
- vents[vi]={i1,j1,pos}
- vi=vi+1
- elseif string.match(l,"Heat Vent") then
- setGpuB(0xA5A5A5)
- gpu.fill(j1+1,i1+1,12,4," ")
- vents[vi]={i1,j1,pos}
- vi=vi+1
- elseif string.match(l,"Advanced Heat Exchanger") then
- setGpuB(0xE1E1E1)
- gpu.fill(j1+1,i1+1,12,4," ")
- setGpuB(0x33B6FF)
- gpu.fill(j1+3,i1+2,8,2," ")
- ahes[ai]={i1,j1,pos}
- ai=ai+1
- elseif string.match(l,"Component Heat Exchanger") then
- setGpuB(0xE1E1E1)
- gpu.fill(j1+1,i1+1,12,4," ")
- setGpuB(0xFFFF40)
- gpu.fill(j1+3,i1+2,8,2," ")
- ohes[oi]={i1,j1,pos}
- oi=oi+1
- elseif string.match(l,"Reactor Heat Exchanger") then
- setGpuB(0xE1E1E1)
- gpu.fill(j1+1,i1+1,12,4," ")
- setGpuB(0xFF6D00)
- gpu.fill(j1+3,i1+2,8,2," ")
- ohes[oi]={i1,j1,pos}
- oi=oi+1
- elseif string.match(l,"Heat Exchanger") then
- setGpuB(0xE1E1E1)
- gpu.fill(j1+1,i1+1,12,4," ")
- setGpuB(0xA5A5A5)
- gpu.fill(j1+3,i1+2,8,2," ")
- hes[hi]={i1,j1,pos}
- hi=hi+1
- elseif string.match(l,"Iridium") then
- setGpuB(0xFFFFFF)
- gpu.fill(j1+1,i1+1,12,4," ")
- elseif string.match(l,"Thick") then
- setGpuB(0xFFFFFF)
- gpu.fill(j1+1,i1+1,12,4," ")
- tnrs[ti]={i1,j1,pos}
- ti=ti+1
- elseif string.match(l,"Neutron") then
- setGpuB(0xFFFFFF)
- gpu.fill(j1+1,i1+1,12,4," ")
- setGpuB(0xA5A5A5)
- gpu.fill(j1+4,i1+2,6,2," ")
- nrs[ni]={i1,j1,pos}
- ni=ni+1
- elseif string.match(l,"10k") then
- setGpuB(0x0000C0)
- gpu.fill(j1+6,i1+1,2,4," ")
- c1s[c1i]={i1,j1,pos}
- c1i=c1i+1
- elseif string.match(l,"30k") then
- setGpuB(0x0000C0)
- gpu.fill(j1+3,i1+1,2,4," ")
- gpu.fill(j1+6,i1+1,2,4," ")
- gpu.fill(j1+9,i1+1,2,4," ")
- c3s[c3i]={i1,j1,pos}
- c3i=c3i+1
- elseif string.match(l,"60k") then
- setGpuB(0x0000C0)
- gpu.set(j1+3,i1+1," ")
- gpu.set(j1+6,i1+1," ")
- gpu.set(j1+9,i1+1," ")
- gpu.set(j1+3,i1+3," ")
- gpu.set(j1+6,i1+3," ")
- gpu.set(j1+9,i1+3," ")
- c6s[c6i]={i1,j1,pos}
- c6i=c6i+1
- elseif string.match(l,"Containment") then
- setGpuB(0x996D40)
- gpu.fill(j1+1,i1+1,12,4," ")
- elseif string.match(l,"Capacity") then
- setGpuB(0xFF6D00)
- gpu.fill(j1+1,i1+1,12,4," ")
- elseif string.match(l,"Plating") then
- setGpuB(0xB4B4B4)
- gpu.fill(j1+1,i1+1,12,4," ")
- end
- end
- function drawReactor()
- setGpuB(0x696969)
- for i=2,37,7 do
- for j=9,137,16 do
- gpu.fill(j,i,14,6," ")
- end
- end
- end
- function drawElement(i,j)
- local i1=i/7
- local j1=j/16+1
- local pos=i1*9+j1
- local s=(invs-4)/6
- if s<9 then
- for g=8,s,-1 do
- local m=math.fmod(pos,g+1)
- if m==0 then
- fillElement(i,j,"X")
- return
- end
- local d=(pos-m)/(g+1)
- pos=pos-d
- end
- end
- local el=getElement(pos)
- fillElement(i,j,el,pos)
- end
- function fillEU(eu)
- if preveu==nil or eu~=preveu then
- setGpuB(0x000000)
- gpu.fill(88,44,72,6," ")
- setGpuF(0x00B6FF)
- local l = string.len(eu)
- for i=l,1,-1 do
- fillElement(42,140-(l-i)*10,string.sub(eu,i,i))
- end
- preveu=eu
- end
- end
- function fillPower(power)
- if power>0 then
- setGpuB(0x00FF00)
- else
- setGpuB(0xFF0000)
- end
- gpu.fill(2,45,14,5," ")
- end
- function fillWarning(w)
- setGpuB(w)
- gpu.fill(18,45,14,5," ")
- end
- local m4p=15
- local m2p=15
- local m1p=15
- menet4.setOutput(m4side,15)
- ventpull.setOutput(pullside,15)
- ventput.setOutput(putside,15)
- --menet2.setOutput(2,15)
- --menet1.setOutput(1,15)
- function rodsChanged()
- for i=1,ri4-1,1 do
- if not inv.getStackInSlot(invside,rods4[i][3]) or (inv.getStackInSlot(invside,rods4[i][3]) and string.match(inv.getStackInSlot(invside,rods4[i][3]).label,"Depleted")) then
- if m4p==15 then
- m4p=0
- m2p=15
- m1p=15
- menet4.setOutput(m4side,0)
- --menet2.setOutput(2,15)
- --menet1.setOutput(1,15)
- end
- return false
- end
- end
- for i=1,ri2-1,1 do
- if not inv.getStackInSlot(invside,rods2[i][3]) or (inv.getStackInSlot(invside,rods2[i][3]) and string.match(inv.getStackInSlot(invside,rods2[i][3]).label,"Depleted")) then
- if m2p==15 then
- m4p=15
- m2p=0
- m1p=15
- menet4.setOutput(m4side,15)
- --menet2.setOutput(2,0)
- --menet1.setOutput(1,15)
- end
- return false
- end
- end
- for i=1,ri1-1,1 do
- if not inv.getStackInSlot(invside,rods1[i][3]) or (inv.getStackInSlot(invside,rods1[i][3]) and string.match(inv.getStackInSlot(invside,rods1[i][3]).label,"Depleted")) then
- if m1p==15 then
- m4p=15
- m2p=15
- m1p=0
- menet4.setOutput(m4side,15)
- --menet2.setOutput(2,15)
- --menet1.setOutput(1,0)
- end
- return false
- end
- end
- menet4.setOutput(m4side,15)
- return true
- end
- function ventLoaded()
- for i=1,ahvi-1,1 do
- if not inv.getStackInSlot(invside,ahvs[i][3]) then
- return false
- end
- end
- return true
- end
- function continueWork()
- if warn then
- return true
- end
- if heating and reactor.getHeat()>8800 then
- redstone.setOutput(rside,0)
- ventpull.setOutput(pullside,15)
- ventput.setOutput(putside,0)
- fillWarning(0xAED6F1)
- heating=false
- loading=true
- else
- if reactor.getHeat()>9900 then
- power=0
- redstone.setOutput(rside,power)
- menet4.setOutput(m4side,15)
- ventpull.setOutput(pullside,15)
- ventput.setOutput(putside,15)
- --menet2.setOutput(2,15)
- --menet1.setOutput(1,15)
- fillPower(power)
- fillWarning(0xFFB600)
- fillEU(0)
- warn=true
- return true
- end
- end
- local eu = math.floor(reactor.getReactorEUOutput())
- if changing then
- if not rodsChanged() then
- return true --do nothing
- else
- changing=false
- power=15
- redstone.setOutput(rside,power)
- fillWarning(0x000000)
- end
- else
- if loading then
- if not ventLoaded() then
- return true
- else
- ventput.setOutput(putside,15)
- redstone.setOutput(rside,15)
- fillWarning(0x000000)
- loading=false
- end
- else
- if reactor.getHeat()<8800 then
- ventpull.setOutput(pullside,0)
- fillWarning(0xFCF3CF)
- heating=true
- else
- if eu<eutarget and power>0 then
- changing=true
- power=0
- redstone.setOutput(rside,power)
- fillWarning(0x006D00)
- fillEU(0)
- return true
- end
- end
- end
- end
- fillEU(eu)
- --checkDmg()
- return true
- end
- function shutexit()
- redstone.setOutput(rside,0)
- setGpuF(0xFFFFFF)
- setGpuB(0x000000)
- gpu.fill(1, 1, w, h, " ")
- return false
- end
- local myEventHandlers = setmetatable({}, { __index = function() return continueWork end })
- function myEventHandlers.key_down(adress, char, code, playerName)
- if code==57 then
- if not changing then
- if power==0 then
- if warn then
- warn=false
- fillWarning(0x000000)
- end
- power=15
- else
- power=0
- end
- fillPower(power)
- redstone.setOutput(rside,power)
- end
- elseif code==46 then
- return shutexit()
- end
- return true
- end
- function myEventHandlers.interrupted(...)
- return shutexit()
- end
- function handleEvent(eventID, ...)
- if (eventID) then
- return myEventHandlers[eventID](...)
- end
- return continueWork()
- end
- setGpuB(0xC3C3C3)
- gpu.fill(1, 1, w, h-7, " ")
- drawReactor()
- for i=0,35,7 do
- for j=0,128,16 do
- drawElement(i,j)
- end
- end
- if reactor.getReactorEUOutput()>0 then
- power=15
- end
- fillPower(power)
- td=coroutine.create(function()
- while true do
- checkDmg()
- os.sleep(0)
- end
- end)
- while handleEvent(event.pull(1)) do
- coroutine.resume(td)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement