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
-- peripheral setup local core = peripheral.find("draconic_rf_storage") local modem = peripheral.find("modem") modem.open(1) -- variables setup local function getCoreTier(max) local tier = 0 if max < 50000000 then tier = 1 elseif max < 300000000 then tier = 2 elseif max < 2000000000 then tier = 3 elseif max < 10000000000 then tier = 4 elseif max < 50000000000 then tier = 5 elseif max < 400000000000 then tier = 6 elseif max < 3000000000000 then tier = 7 else tier = 8 end return tier end function getRequest() local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message") if message == "provideCoreData" then local now = core.getEnergyStored() local max = core.getMaxEnergyStored() local energyRate = core.getTransferPerTick() local core_data = { now = now, max = max, rate = energyRate, tier = getCoreTier(max) } modem.transmit(replyChannel, channel, core_data) end end local function waitForRequest() parallel.waitForAny(wait, getRequest) end function wait() sleep(0.5) end while true do waitForRequest() 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)