2022-06-16 15:24:35 +00:00
|
|
|
local core = require("graphics.core")
|
|
|
|
|
|
|
|
local style = require("coordinator.ui.style")
|
|
|
|
|
2022-06-25 20:21:57 +00:00
|
|
|
local reactor_view = require("coordinator.ui.components.reactor")
|
|
|
|
local boiler_view = require("coordinator.ui.components.boiler")
|
2022-07-02 21:24:52 +00:00
|
|
|
local turbine_view = require("coordinator.ui.components.turbine")
|
2022-06-25 20:21:57 +00:00
|
|
|
|
2022-06-16 15:24:35 +00:00
|
|
|
local Div = require("graphics.elements.div")
|
2022-07-02 19:09:35 +00:00
|
|
|
local PipeNetwork = require("graphics.elements.pipenet")
|
2022-06-29 21:40:46 +00:00
|
|
|
local Rectangle = require("graphics.elements.rectangle")
|
|
|
|
local TextBox = require("graphics.elements.textbox")
|
|
|
|
|
2022-06-16 15:24:35 +00:00
|
|
|
local HorizontalBar = require("graphics.elements.indicators.hbar")
|
|
|
|
local DataIndicator = require("graphics.elements.indicators.data")
|
|
|
|
local StateIndicator = require("graphics.elements.indicators.state")
|
|
|
|
|
|
|
|
local TEXT_ALIGN = core.graphics.TEXT_ALIGN
|
|
|
|
|
|
|
|
local cpair = core.graphics.cpair
|
|
|
|
local border = core.graphics.border
|
2022-06-29 21:40:46 +00:00
|
|
|
local pipe = core.graphics.pipe
|
2022-06-16 15:24:35 +00:00
|
|
|
|
|
|
|
---@param parent graphics_element
|
|
|
|
local function make(parent, x, y, unit_id)
|
|
|
|
-- bounding box div
|
2022-07-02 21:24:52 +00:00
|
|
|
local root = Div{parent=parent,x=x,y=y,width=80,height=27}--,fg_bg=cpair(colors.white,colors.black)}
|
2022-06-16 15:24:35 +00:00
|
|
|
|
|
|
|
-- unit header message
|
|
|
|
TextBox{parent=root,text="Unit #" .. unit_id,alignment=TEXT_ALIGN.CENTER,height=1,fg_bg=style.header}
|
|
|
|
|
2022-06-25 20:21:57 +00:00
|
|
|
-------------
|
|
|
|
-- REACTOR --
|
|
|
|
-------------
|
2022-06-16 15:24:35 +00:00
|
|
|
|
2022-06-25 20:21:57 +00:00
|
|
|
reactor_view(root, 1, 3)
|
2022-06-16 15:24:35 +00:00
|
|
|
|
2022-07-02 21:24:52 +00:00
|
|
|
local coolant_pipes = {
|
|
|
|
pipe(0, 0, 12, 12, colors.lightBlue),
|
|
|
|
pipe(0, 0, 12, 3, colors.lightBlue),
|
2022-06-29 21:40:46 +00:00
|
|
|
pipe(2, 0, 11, 2, colors.orange),
|
|
|
|
pipe(2, 0, 11, 11, colors.orange)
|
|
|
|
}
|
|
|
|
|
2022-07-02 21:24:52 +00:00
|
|
|
PipeNetwork{parent=root,x=4,y=10,pipes=coolant_pipes,bg=colors.lightGray}
|
2022-06-29 21:40:46 +00:00
|
|
|
|
2022-06-25 20:21:57 +00:00
|
|
|
-------------
|
|
|
|
-- BOILERS --
|
|
|
|
-------------
|
2022-06-16 15:24:35 +00:00
|
|
|
|
2022-07-02 21:24:52 +00:00
|
|
|
boiler_view(root, 16, 11)
|
|
|
|
boiler_view(root, 16, 20)
|
|
|
|
|
|
|
|
--------------
|
|
|
|
-- TURBINES --
|
|
|
|
--------------
|
|
|
|
|
|
|
|
turbine_view(root, 58, 3)
|
|
|
|
turbine_view(root, 58, 11)
|
|
|
|
turbine_view(root, 58, 20)
|
|
|
|
|
|
|
|
local steam_pipes_a = {
|
|
|
|
-- boiler 1
|
|
|
|
pipe(0, 1, 6, 1, colors.white, false, true),
|
|
|
|
pipe(0, 2, 6, 2, colors.blue, false, true),
|
|
|
|
-- boiler 2
|
|
|
|
pipe(0, 10, 6, 10, colors.white, false, true),
|
|
|
|
pipe(0, 11, 6, 11, colors.blue, false, true)
|
|
|
|
}
|
|
|
|
|
|
|
|
local steam_pipes_b = {
|
|
|
|
-- turbines 1 & 2, pipes from boiler 1
|
|
|
|
pipe(0, 9, 1, 2, colors.white, false, true),
|
|
|
|
pipe(1, 1, 3, 1, colors.white, false, false),
|
|
|
|
pipe(0, 9, 3, 9, colors.white, false, true),
|
|
|
|
pipe(0, 10, 2, 3, colors.blue, false, true),
|
|
|
|
pipe(2, 2, 3, 2, colors.blue, false, false),
|
|
|
|
pipe(0, 10, 3, 10, colors.blue, false, true),
|
|
|
|
-- turbine 3, pipes from boiler 2
|
|
|
|
pipe(0, 18, 1, 9, colors.white, false, true),
|
|
|
|
pipe(1, 1, 3, 1, colors.white, false, false),
|
|
|
|
pipe(0, 18, 3, 18, colors.white, false, true),
|
|
|
|
pipe(0, 19, 2, 10, colors.blue, false, true),
|
|
|
|
pipe(0, 19, 3, 19, colors.blue, false, true),
|
|
|
|
}
|
|
|
|
|
|
|
|
PipeNetwork{parent=root,x=47,y=11,pipes=steam_pipes_a,bg=colors.lightGray}
|
|
|
|
PipeNetwork{parent=root,x=54,y=3,pipes=steam_pipes_b,bg=colors.lightGray}
|
2022-06-16 15:24:35 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return make
|