ComputerCraft/generator/data.lua

83 lines
1.9 KiB
Lua
Raw Permalink Normal View History

2024-03-10 23:45:44 +03:00
--[[
== GENERATOR STATUS =============================
SU 580000 / 598030 | 96% | 18030 avl
RPM 180 / 256 | 70%
GEN Online
== ENG ==========================================
ENG1 lvl 9 | watr 100% | powr 80% | size 100%
ENG2 lvl 9 | watr 100% | powr 78% | size 100%
ENG2 lvl 9 | watr 80% | powr 79% | size 100%
LAVA [||||||||| ] 53% | 49mbu
== BAT ==========================================
BAT1 [||||||||| ] 35%
BAT2 [||||||||||||||| ] 70%
BAT3 [|||||||||||| ] 42%
Total 140 MFE / 270 MFE
== LOG ==========================================
Time 21:50:52 GMT+3
21:50:50 energy -3992 FE
21:50:51 energy -539 FE
21:50:52 GEN off -> on
21:50:52 energy +44 FE
]]
local RPM_CONTROLLER = peripheral.find("create:speedcontroller") -- TODO: Type
local ENGINES = {peripheral.find("create:engine")} -- TODO: Type
local BATTERIES = {peripheral.find("createcraftsandadditions:accumulator")} -- TODO: Type
local LAVA = peripheral.find("create:fluid_tank") -- TODO: Type
local GENERATOR_SWITCH = {
set = function (on)
redstone.setOutput("top", on) -- Change side with redstone here!
end
} -- TODO: Type? Redstone???? Side?
local MONITOR_INFO
local MONITOR_CONTROLS
local monitors = {peripheral.find("monitor")}
for _, monitor in pairs(monitors) do
local x, y = monitor.getSize()
if x < 0 and y < 0 then
MONITOR_CONTROLS = monitor
else
MONITOR_INFO = monitor
end
end
-- All data, to be updated by relevant functions
local DATA = {
su = {
used = 0,
total = 0
},
rpm = 0,
generation = false,
engines = {
},
batteries = {
},
events = {
}
}
local function update_data()
end
local function change_rpm(rpm)
RPM_CONTROLLER.setTarget(rpm) -- TODO: Real method?
end
local function set_generation()
end
local function log(msg)
local current_time = textutils.formatTime(os.time("local"), true)
end