From 70febea204b003a808f6ab2c7ce6de7aeb0fff64 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Sat, 10 Sep 2022 18:06:41 +0200 Subject: [PATCH] Add chat command ta_color --- doc/manual_DE.lua | 2 ++ doc/manual_EN.lua | 2 ++ logic/signallamp.lua | 36 ++++++++++++++++++++++++++++++++++++ manuals/manual_ta3_DE.md | 2 ++ manuals/manual_ta3_EN.md | 2 ++ 5 files changed, 44 insertions(+) diff --git a/doc/manual_DE.lua b/doc/manual_DE.lua index 041b4f8..0f29dd5 100644 --- a/doc/manual_DE.lua +++ b/doc/manual_DE.lua @@ -1128,6 +1128,8 @@ techage.manual_DE.aText = { "Die Signallampe kann mit 'on'/'off' Kommando ein- bzw. ausgeschaltet werden. Diese Lampe braucht keinen Strom und\n".. "kann mit der Spritzpistole aus der Mod \"Unified Dyes\" und über Lua/Beduino Kommandos eingefärbt werden.\n".. "\n".. + "Mit dem Chat-Kommando '/ta_color' wird die Farbpalette mit den Werten für die Lua/Beduino Kommandos angezeigt.\n".. + "\n".. "\n".. "\n", "Mit diese Blöcken kann man Türe und Tore realisieren\\, die über Kommandos geöffnet (Blöcke verschwinden) und wieder geschlossen werden können. Pro Tor oder Tür wird dazu ein Tür Controller benötigt. \n".. diff --git a/doc/manual_EN.lua b/doc/manual_EN.lua index ce0993a..c972dc1 100644 --- a/doc/manual_EN.lua +++ b/doc/manual_EN.lua @@ -1130,6 +1130,8 @@ techage.manual_EN.aText = { "\n", "The signal lamp can be switched on or off with the 'on' / 'off' command. This lamp does not need electricity and can be colored with the airbrush tool from the mod Unified Dyes\" and via Lua/Beduino commands.\n".. "\n".. + "With the chat command '/ta_color' the color palette with the values for the Lua/Beduino commands is displayed.\n".. + "\n".. "\n".. "\n", "With these blocks you can realize doors and gates that can be opened via commands (blocks disappear) and closed again. One door controller is required for each gate or door.\n".. diff --git a/logic/signallamp.lua b/logic/signallamp.lua index 137538f..1c7c6cc 100644 --- a/logic/signallamp.lua +++ b/logic/signallamp.lua @@ -160,6 +160,42 @@ local function register_signallamp(name, description, tiles, node_box) }) end +minetest.register_chatcommand("ta_color", { + description = minetest.formspec_escape( + "Output the color palette and the numbers for Lua/Beduino color commands"), + + func = function(name, param) + local tbl = {} + if COLORED then + tbl[1] = "size[14,7]" + tbl[2] = "background[0,0;14,7;unifieddyes_palette_extended.png]" + for i = 0, 10 do + local y = i * 0.64 + tbl[#tbl + 1] = "label[0," .. y .. ";" .. (i * 24 + 0) .. "]" + tbl[#tbl + 1] = "label[7," .. y .. ";" .. (i * 24 + 12) .. "]" + end + else + tbl[1] = "size[10,7.5]" + tbl[2] = "background[0,0;10,7.5;techage_palette256.png]" + for i = 0, 13 do + local y = i * 0.5 + tbl[#tbl + 1] = "label[0," .. y .. ";" .. (i * 18 + 0) .. "]" + tbl[#tbl + 1] = "label[5," .. y .. ";" .. (i * 18 + 9) .. "]" + end + end + minetest.show_formspec(name, ";techage:color_form", table.concat(tbl, "")) + return true + end +}) + +-- Register callback +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "techage:color_form" then + return false + end + return true +end) + register_signallamp("techage:signal_lamp", S("TechAge Signal Lamp"), diff --git a/manuals/manual_ta3_DE.md b/manuals/manual_ta3_DE.md index 0d806c8..ac3bd3f 100644 --- a/manuals/manual_ta3_DE.md +++ b/manuals/manual_ta3_DE.md @@ -633,6 +633,8 @@ Im privaten Modus (private) kann das Terminal nur von Spielern verwendet werden, Die Signallampe kann mit `on`/`off` Kommando ein- bzw. ausgeschaltet werden. Diese Lampe braucht keinen Strom und kann mit der Spritzpistole aus der Mod "Unified Dyes" und über Lua/Beduino Kommandos eingefärbt werden. +Mit dem Chat-Kommando `/ta_color` wird die Farbpalette mit den Werten für die Lua/Beduino Kommandos angezeigt. + [ta3_signallamp|image] diff --git a/manuals/manual_ta3_EN.md b/manuals/manual_ta3_EN.md index 4fd9335..be13a3e 100644 --- a/manuals/manual_ta3_EN.md +++ b/manuals/manual_ta3_EN.md @@ -631,6 +631,8 @@ In public mode, all players can use the preconfigured keys. The signal lamp can be switched on or off with the `on` / `off` command. This lamp does not need electricity and can be colored with the airbrush tool from the mod Unified Dyes" and via Lua/Beduino commands. +With the chat command `/ta_color` the color palette with the values for the Lua/Beduino commands is displayed. + [ta3_signallamp|image]