From 5c7f77725394d47ce0b907aabf885ea207a507bd Mon Sep 17 00:00:00 2001 From: autocommitter Date: Tue, 15 Oct 2024 22:37:32 +0200 Subject: State at 2024-10-15 --- ywang/nodes/(1991,19,8251).lua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 ywang/nodes/(1991,19,8251).lua (limited to 'ywang/nodes') diff --git a/ywang/nodes/(1991,19,8251).lua b/ywang/nodes/(1991,19,8251).lua new file mode 100644 index 0000000..740144a --- /dev/null +++ b/ywang/nodes/(1991,19,8251).lua @@ -0,0 +1,35 @@ +local formats = {".%d", "+%d", "%d\t", "\t%d", "%d ", " %d", "%d\n", "\n%d", "-%d", "%d."} +local len = #formats*10 + +local function color(num) + return math.fmod(num*67+101, 255) + math.fmod(num*97+109, 255) + math.fmod(num*73+127, 255) +end + +if not disco then + disco = 0 +end +if not atc_id then + return +end +if event.type == "train" then + if not atc_id then return end + atc_send("B0") + disco = 0 +end +if event.type == "train" or event.type == "schedule" then + local line = get_line() + if not line or line == "" or (line:len() == 2 and tonumber(line)) then + local digit, fmt, str + for _ = 1, 10 do + digit = math.floor(disco/#formats) + fmt = formats[disco%#formats+1] + str = fmt:format(digit) + disco = (disco+1)%len + if color(tonumber(str)) <= 512 then + break + end + end + set_line(str) + schedule_in(5) + end +end \ No newline at end of file -- cgit v1.2.3