From 79cc84a4bca00b4837755d200e088a258ffbca5f Mon Sep 17 00:00:00 2001 From: Buckaroo Banzai <39065740+BuckarooBanzay@users.noreply.github.com> Date: Sat, 10 Jun 2023 08:24:13 +0200 Subject: [PATCH] add `mooncontroller` compatibility for luatool (#133) Co-authored-by: BuckarooBanzay --- luatool/mod.conf | 2 +- luatool/nodes/luacontroller.lua | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/luatool/mod.conf b/luatool/mod.conf index be3b7d8..ba7bacd 100644 --- a/luatool/mod.conf +++ b/luatool/mod.conf @@ -1,4 +1,4 @@ name=luatool description=Provides metatool:luatool to copy/paste luacontroller or luatube code depends=metatool -optional_depends=pipeworks,mesecons_luacontroller,mesecons_microcontroller +optional_depends=pipeworks,mesecons_luacontroller,mesecons_microcontroller,mooncontroller diff --git a/luatool/nodes/luacontroller.lua b/luatool/nodes/luacontroller.lua index b86cadb..9e220ee 100644 --- a/luatool/nodes/luacontroller.lua +++ b/luatool/nodes/luacontroller.lua @@ -22,14 +22,19 @@ local lpadcut = function(s, c, n) return (c:rep(n - #s) .. s):sub(math.max(0, #s - n + 1), #s + 1) end -local nodenameprefix = "mesecons_luacontroller:luacontroller" +local nodenameprefixes = { + "mesecons_luacontroller:luacontroller", + "mooncontroller:mooncontroller" +} --- lua controller, 16 different nodes local nodes = {} -for i=0,15 do - table.insert(nodes, nodenameprefix .. lpadcut(d2b(i), '0', 4)) +for _, prefix in ipairs(nodenameprefixes) do + -- lua/moon controller, 16 different nodes + for i=0,15 do + table.insert(nodes, prefix .. lpadcut(d2b(i), '0', 4)) + end + table.insert(nodes, prefix .. '_burnt') end -table.insert(nodes, nodenameprefix .. '_burnt') local ns = metatool.ns('luatool')