Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t = peripheral.wrap("back")
- g = peripheral.wrap("left")
- maxEnergy = 1000000
- rpm = t.getRotorSpeed()
- offsetX = 0
- offsetY = 0
- if rpm > 1700 then
- speedUp = false
- else
- speedUp = true
- end
- function getScaled(scaled, current, max)
- return (current * scaled / max)
- end
- function updateCoil()
- rpm = t.getRotorSpeed()
- if speedUp == false then
- if rpm < 1800 then
- speedUp = true
- end
- else
- t.setInductorEngaged(false)
- if rpm > 1850 then
- speedUp = false
- t.setInductorEngaged(true)
- end
- end
- end
- function updateTurbine()
- energy = t.getEnergyStored()
- if energy < maxEnergy then
- t.setActive(true)
- else
- t.setActive(false)
- end
- end
- function isEmpty(s)
- return s == nil or s == ''
- end
- while true do
- updateCoil()
- updateTurbine()
- if t.getActive() then
- g.addText(5+offsetX,10+offsetY,"Active: TRUE")
- else
- g.addText(5+offsetX,10+offsetY,"Active: FALSE")
- end
- g.addText(5+offsetX,40+offsetY,"RPM: "..t.getRotorSpeed())
- g.addBox(4+offsetX,20+offsetY,100,15,0x000000,0.5)
- g.addGradientBox(6+offsetX,22+offsetY,getScaled(96,t.getEnergyStored(),maxEnergy),11,0x00FF00,1,0xFF0000,1,2)
- -- g.addBox(4+offsetX,58+offsetY,29,39,0x000000,0.5)
- --
- -- if not isEmpty(t.getInputType()) then
- -- g.addLiquid(6+offsetX,60+offsetY,11,getScaled(35,t.getInputAmount(),t.getFluidAmountMax()),t.getInputType())
- -- end
- -- if not isEmpty(t.getOutputType()) then
- -- g.addLiquid(20+offsetX,60+offsetY,11,getScaled(35,t.getOutputAmount(),t.getFluidAmountMax()),t.getOutputType())
- -- end
- sleep(0.25)
- g.clear()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement