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_sender.lua -- Attach modem to "back" (or change side) -- Attach adapter to reactor (e.g. "left") local modemSide = "right" local reactorSide = "back" local channel = "reactorFuel" local reactor = peripheral.wrap(reactorSide) if not reactor then error("No reactor peripheral found on " .. reactorSide) end rednet.open(modemSide) local function getFuelLevel() local inv = reactor.list() local total = 0 local max = 7 * 4 -- 7 quad cells = 28 units for _, item in pairs(inv) do if item.name:find("uranium_fuel_rod") and not item.name:find("depleted") then if item.name:find("quad") then total = total + 4 elseif item.name:find("dual") then total = total + 2 else total = total + 1 end end end return total / max end while true do local fuel = getFuelLevel() rednet.broadcast(fuel, channel) sleep(5) -- adjust update interval 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)