Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
tMon = "1" rMon = "0" function clean() term.setBackgroundColor(colors.black) term.clear() term.setCursorPos(1,1) end function cleanMon() m.setBackgroundColor(colors.black) m.clear() m.setCursorPos(1,1) end function center(text,index,y) if index == m then screen = m elseif index == m2 then screen = m2 else screen = tWindow[index].window end w,h = screen.getSize() _text = tostring(text) sl = string.len(_text) screen.setCursorPos(math.floor(w/2 +.5)-math.floor(sl/2 +.5),y) screen.write(_text) end function displayReactor() if r.connected() then -- Show Reactor Stats m2.clear() center("| Reactor Monitor |",m2,1) center("-------------------",m2,2) if r.active() then m2.setBackgroundColor(colors.green) else m2.setBackgroundColor(colors.red) end center("POWER",m2,4) m2.setBackgroundColor(colors.black) center("Fuel Temp: " .. math.floor(r.fuelTemperature()),m2,6) center("Case Temp: " .. math.floor(r.casingTemperature()),m2,7) center("Fuel Amount: ".. math.floor(r.fuelTank().fuel()).."/"..math.floor(r.fuelTank().capacity()),m2,8) center("Steam Created: " .. r.coolantTank().transitionedLastTick().." mB/t",m2,9) center("Fuel Rate: ".. r.fuelTank().burnedLastTick() .. " mB/t",m2,10) center("Fuel Reactivity: ".. math.floor(r.fuelTank().fuelReactivity()).. "%",m2,11) center("Total Power Gen: " .. math.floor(totalPowerGen).. " RF/t",m2,12) sw,sh = m2.getSize() loc = 15 height = 10 fbl = sw-8 water = r.coolantTank().coldFluidAmount() waterMax = r.coolantTank().capacity() waterBlock = waterMax/height numWaterBlocks = math.floor(water/waterBlock) steamBroke = r.coolantTank().hotFluidAmount() steamMax = waterMax steam = steamMax - steamBroke steamBlock = steamMax/height numSteamBlocks = math.floor(steam/steamBlock) fuel = r.fuelTank().fuel() fuelMax = r.fuelTank().capacity() fuelBlock = fuelMax/(fbl-3) numFuelBlocks = math.floor(fuel/fuelBlock) -- Draw Boxes around Water and Steam Bar m2.setBackgroundColor(colors.lightGray) for l=1,height do m2.setCursorPos(5,loc-l) m2.write(" ") m2.setCursorPos(8,loc-l) m2.write(" ") m2.setCursorPos(sw-5,loc-l) m2.write(" ") m2.setCursorPos(sw-8,loc-l) m2.write(" ") end m2.setCursorPos(5,loc - height - 1) m2.write(" ") m2.setCursorPos(sw-8,loc - height - 1) m2.write(" ") m2.setCursorPos(5,loc) m2.write(" ") m2.setCursorPos(sw-8,loc) m2.write(" ") --Fill in water level m2.setBackgroundColor(colors.blue) for l=1,numWaterBlocks do m2.setCursorPos(6,loc-l) m2.write(" ") end -- Fill in Steam Level m2.setBackgroundColor(colors.gray) for l=1,numSteamBlocks do m2.setCursorPos(sw-7,loc-l) m2.write(" ") end -- Create Box around Fuel Bar -- top outline m2.setBackgroundColor(colors.lightGray) m2.setCursorPos(5,loc+2) for l=1,fbl-1 do m2.write(" ") end -- bottom outline m2.setCursorPos(5,loc + 5) for l=1,fbl-1 do m2.write(" ") end -- end caps for l=1,2 do m2.setCursorPos(5,loc+l+2) m2.write(" ") m2.setCursorPos(sw-5,loc+l+2) m2.write(" ") end -- Fill in Fuel Bars m2.setBackgroundColor(colors.yellow) for l=1,numFuelBlocks do m2.setCursorPos(5+l,loc+3) m2.write(" ") m2.setCursorPos(5+l,loc+4) m2.write(" ") end m2.setBackgroundColor(colors.black) -- Draw Control Rod Buttons center("Control Rod Level = " .. controlLevel,m2,sh-1) m2.setBackgroundColor(colors.red) m2.setCursorPos(sw/2-15,sh) m2.write(" -1 ") m2.setCursorPos(sw/2-8,sh) m2.write(" -10 ") m2.setCursorPos((sw/2-1),sh) if r.active() then m2.setBackgroundColor(colors.green) else m2.setBackgroundColor(colors.red) end m2.write("POWER") m2.setBackgroundColor(colors.green) m2.setCursorPos(sw/2+6,sh) m2.write(" +10 ") m2.setCursorPos(sw/2+13,sh) m2.write(" +1 ") m2.setBackgroundColor(colors.black) end end function checkValue() if controlLevel > 100 then controlLevel = 100 elseif controlLevel < 0 then controlLevel = 0 end end clean() peripherals = peripheral.getNames() t = {} print("Loading Peripherals..") for i=1,#peripherals do --print(peripherals[i]) type = peripheral.getType(peripherals[i]) if type == "BiggerReactors_Turbine" then table.insert(t,peripheral.wrap(peripherals[i])) print("Adding new turbine to index " .. tostring(#t)) elseif type == "BiggerReactors_Reactor" then if not r then r = peripheral.wrap(peripherals[i]) print("Reactor Has Been Connected") if r.active() then rs.setBundledOutput("bottom",colors.white) else rs.setBundledOutput("bottom",0) end end end end print("Defining Monitors") -- Turbine Monitor m = peripheral.wrap("monitor_"..tMon) -- Reactor Monitor m2 = peripheral.wrap("monitor_" .. rMon) m.setTextScale(.5) m2.setTextScale(.5) if not r then error("No Reactor Found") end if not m then error("No Monitor Found") end if not m2 then error("No Secondary Monitor Found") end cleanMon() --cpu = term.redirect(m) -- Prepare Windows for Turbines tWindow = {} width = 14 height = 5 print("Creating Turbine Windows") for i=1,#t do if i <= 5 then y = 4 xsub = 0 elseif i <= 10 then y = 4 + (1 + height) xsub = 5 elseif i <= 15 then y = 4 + (1 + height) * 2 xsub = 10 elseif i <= 20 then y = 4 + (1 + height) * 3 xsub = 15 elseif i <= 25 then y = 4 + (1 + height) * 4 xsub = 20 else y = 4 + (1 + height) * 5 xsub = 25 end x = 5 + (width * ((i-1) - xsub) ) + ((i-1)-xsub) --if i > 4 and i < 9 then -- x = x - i --end -- New Method tWindow[i] = { window = window.create(m,x,y,width,height,true), xPos = x, yPos = y, } --Old Method -- table.insert(tWindow,window.create(m,x,y,17,height,true)) end totalPowerGen = 0 controlLevel = r.getControlRod(0).level() -- Show Turbine Stats print("Loading Complete.") while true do center("| Turbine Monitor |",m,1) center("-------------------",m,2) x,y = 1,4 totalPowerGen = 0 for i=1,#t do if t[i].connected() then tWindow[i].window.clear() center(i,i,1) if t[i].active() then tWindow[i].window.setBackgroundColor(colors.green) else tWindow[i].window.setBackgroundColor(colors.red) end center("POWER",i,2) tWindow[i].window.setBackgroundColor(colors.gray) center(math.floor(t[i].battery().stored()).. "RF",i,3) center(math.floor(t[i].rotor().RPM()).." RPM",i,4) center(math.floor(t[i].battery().producedLastTick()) .. "RF/T",i,5) tWindow[i].window.setBackgroundColor(colors.black) totalPowerGen = totalPowerGen + t[i].battery().producedLastTick() end end displayReactor() timer = os.startTimer(.5) while true do event,side,x,y = os.pullEvent() if event == "timer" then break elseif event == "monitor_touch" then -- check coords for button push if side == "monitor_" .. rMon then local w,h = m2.getSize() powerX = (w/2)-(5/2) if x >= powerX and x <= powerX + 5 and y == 4 then if r.active() then -- disable input of yellorium rs.setBundledOutput("bottom",0) -- disable reactor r.setActive(false) -- dump fuel repeat r.doEjectFuel() sleep(1) displayReactor() until r.fuelTank().fuel() < 1000 else -- enable input of yellorium rs.setBundledOutput("bottom",colors.white) -- enable reactor r.setActive(true) end elseif y == h then if x >= w/2-15 and x <= w/2-12 then controlLevel = controlLevel - 1 checkValue() r.setAllControlRodLevels(controlLevel) elseif x >= w/2-8 and x <= w/2-4 then controlLevel = controlLevel - 10 checkValue() r.setAllControlRodLevels(controlLevel) elseif x >= w/2+6 and x <= w/2+10 then controlLevel = controlLevel + 10 checkValue() r.setAllControlRodLevels(controlLevel) elseif x >= w/2+13 and x <= w/2+16 then controlLevel = controlLevel + 1 checkValue() r.setAllControlRodLevels(controlLevel) elseif x >= w/2-1 and x <= w/2+3 then if r.active() then r.setActive(false) else r.setActive(true) end end end break elseif side == "monitor_" .. tMon then print("Got Turbine Screen Click at x:" .. x .. " y: " .. y) for i=1,#tWindow do local ww,_ = tWindow[i].window.getSize() local cOffset = math.floor(ww/2 + .5) - 5 local winX = tWindow[i].xPos local winY = tWindow[i].yPos print("Window " .. i .. " x:" .. winX + cOffset .. " y: " .. winY + 1 .. " Click x:" .. x .. " y: " .. y .. " Width:" .. ww .. " Offset:" .. cOffset) if x >= winX + cOffset and x <= winX + cOffset + 5 and y == winY + 1 then if t[i].getActive() then t[i].setActive(false) else t[i].setActive(true) end break end end end end end end
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
Input_AOC
1 hour ago | 18.01 KB
Untitled
15 hours ago | 13.15 KB
Analog GPUs: THE FUTURE
20 hours ago | 8.88 KB
Quotes I believe to be true.
20 hours ago | 0.16 KB
Die 7 wichtigsten Aktionen diese Woche
1 day ago | 4.17 KB
Untitled
1 day ago | 13.34 KB
Untitled
1 day ago | 13.59 KB
VNC SCRIPT 2/2: autoinput.vbs
VBScript | 1 day ago | 0.23 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!