mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
removed redundant c_off from trilight
This commit is contained in:
parent
49605e5966
commit
e084ae1eea
@ -4,7 +4,6 @@ local element = require("graphics.element")
|
||||
|
||||
---@class tristate_indicator_light_args
|
||||
---@field label string indicator label
|
||||
---@field c_off color color for off
|
||||
---@field c1 color color for state 1
|
||||
---@field c2 color color for state 2
|
||||
---@field c3 color color for state 3
|
||||
@ -20,7 +19,6 @@ local element = require("graphics.element")
|
||||
---@return graphics_element element, element_id id
|
||||
local function tristate_indicator_light(args)
|
||||
assert(type(args.label) == "string", "graphics.elements.indicators.trilight: label is a required field")
|
||||
assert(type(args.c_off) == "integer", "graphics.elements.indicators.trilight: c_off is a required field")
|
||||
assert(type(args.c1) == "integer", "graphics.elements.indicators.trilight: c1 is a required field")
|
||||
assert(type(args.c2) == "integer", "graphics.elements.indicators.trilight: c2 is a required field")
|
||||
assert(type(args.c3) == "integer", "graphics.elements.indicators.trilight: c3 is a required field")
|
||||
@ -32,7 +30,6 @@ local function tristate_indicator_light(args)
|
||||
args.width = math.max(args.min_label_width or 1, string.len(args.label)) + 2
|
||||
|
||||
-- blit translations
|
||||
local c_off colors.toBlit(args.c_off)
|
||||
local c1 colors.toBlit(args.c1)
|
||||
local c2 colors.toBlit(args.c2)
|
||||
local c3 colors.toBlit(args.c3)
|
||||
@ -44,14 +41,12 @@ local function tristate_indicator_light(args)
|
||||
---@param new_state integer indicator state
|
||||
function e.on_update(new_state)
|
||||
e.window.setCursorPos(1, 1)
|
||||
if new_state == 1 then
|
||||
e.window.blit(" \x95", "0" .. c1, c1 .. e.fg_bg.blit_bkg)
|
||||
elseif new_state == 2 then
|
||||
if new_state == 2 then
|
||||
e.window.blit(" \x95", "0" .. c2, c2 .. e.fg_bg.blit_bkg)
|
||||
elseif new_state == 3 then
|
||||
e.window.blit(" \x95", "0" .. c3, c3 .. e.fg_bg.blit_bkg)
|
||||
else
|
||||
e.window.blit(" \x95", "0" ..c_off, c_off .. e.fg_bg.blit_bkg)
|
||||
e.window.blit(" \x95", "0" .. c1, c1 .. e.fg_bg.blit_bkg)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user