48 lines
1.7 KiB
Lua
48 lines
1.7 KiB
Lua
-- user options
|
|
local options = {
|
|
port = 'fissionReactorLogicAdapter',
|
|
name = 'Fission Reactor',
|
|
compact = true,
|
|
channels = 10,
|
|
timeout = 15
|
|
}
|
|
|
|
-- initialize client library
|
|
dofile('inputClient.lua')
|
|
|
|
-- generate print responsee message
|
|
function generate_message(width, component, buffer)
|
|
-- read fission values
|
|
local a_raw = component.getStatus()
|
|
local d_raw = component.getDamagePercent()
|
|
local w_raw = component.getWasteFilledPercentage()
|
|
local h_raw = component.getHeatedCoolantFilledPercentage()
|
|
local f_raw = component.getFuelFilledPercentage()
|
|
local c_raw = component.getCoolantFilledPercentage()
|
|
local t_raw = component.getTemperature()
|
|
local r_raw = component.getActualBurnRate()
|
|
|
|
-- format and align reactor status
|
|
message_aligned(buffer, 'Status....:', a_raw and 'ACTIVE' or 'OFFLINE', width)
|
|
message_aligned(buffer, 'Damage....:', format_percent(options, d_raw, false), width)
|
|
|
|
-- format and align reactor internal battery
|
|
message(buffer, '\n')
|
|
message_aligned(buffer, 'Waste.....:', format_percent(options, w_raw), width)
|
|
message_aligned(buffer, 'Heated....:', format_percent(options, h_raw), width)
|
|
|
|
-- format and align fuel fill
|
|
message(buffer, '\n')
|
|
message_aligned(buffer, 'Fuel......:', format_percent(options, f_raw), width)
|
|
message_aligned(buffer, 'Coolant...:', format_percent(options, c_raw), width)
|
|
|
|
-- format and align temperature and burnrate
|
|
message(buffer, '\n')
|
|
message_aligned(buffer, 'Reactor T.:', format_temp(options, t_raw), width)
|
|
message_aligned(buffer, 'Burnrate..:', format_liquid(options, r_raw, true), width)
|
|
end
|
|
|
|
-- run main program
|
|
run_client(options, {
|
|
print = generate_message
|
|
}) |