Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
-- reactor_monitor.lua -- Attach modem to "back" (or change side) -- Attach monitor to "right" (or change side) local modemSide = "back" local monitorSide = "right" local channel = "reactorFuel" local mon = peripheral.wrap(monitorSide) if not mon then error("No monitor on " .. monitorSide) end rednet.open(modemSide) mon.setTextScale(1) local function drawBar(fuel) local w, h = mon.getSize() local barWidth = math.floor(fuel * w) -- Clear mon.setBackgroundColor(colors.black) mon.clear() -- Fuel bar for x = 1, barWidth do local color if fuel > 0.5 then color = colors.green elseif fuel > 0.25 then color = colors.orange else color = colors.red end mon.setBackgroundColor(color) mon.setCursorPos(x, h // 2) mon.write(" ") end -- Text overlay mon.setBackgroundColor(colors.black) mon.setCursorPos(1, h) mon.write("Fuel: " .. math.floor(fuel * 100) .. "%") end while true do local id, fuel, proto = rednet.receive(channel) if fuel then drawBar(fuel) end end
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)