From a9a7a5a9f1437e98431ab2eef0c440c04d6b6a41 Mon Sep 17 00:00:00 2001 From: VorTechnix <45538536+VorTechnix@users.noreply.github.com> Date: Sun, 13 Oct 2024 15:01:53 -0700 Subject: [PATCH] Fixed some problems --- .../commands/test/test.lua | 9 +++--- .../commands/test/tests/credits.test.lua | 32 +++++++++++++------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/worldeditadditions_commands/commands/test/test.lua b/worldeditadditions_commands/commands/test/test.lua index 6be5f6e..8d6f059 100644 --- a/worldeditadditions_commands/commands/test/test.lua +++ b/worldeditadditions_commands/commands/test/test.lua @@ -24,12 +24,11 @@ wea_c.register_command("test", { local ret = wea_c.split(params_text) if #ret < 1 then return false, "Error: No params found!" - elseif ret[1] ~= "list" and #ret < 2 then - if ret[1] == "help" then - return false, "Error: No test found!" - else return false, "Error: No arguments found!" end + elseif ret[1] == "help" and #ret < 2 then + return false, "Error: No test found!" end - if not tests[ ret[1] == "help" and ret[2] or ret[1] ] then + if (ret[1] ~= "list" and + not tests[ ret[1] == "help" and ret[2] or ret[1] ]) then return false, "Error: Test '"..ret[1].."' not found!" end return true, table.remove(ret, 1), ret diff --git a/worldeditadditions_commands/commands/test/tests/credits.test.lua b/worldeditadditions_commands/commands/test/tests/credits.test.lua index eca6ed1..618e9df 100644 --- a/worldeditadditions_commands/commands/test/tests/credits.test.lua +++ b/worldeditadditions_commands/commands/test/tests/credits.test.lua @@ -1,13 +1,27 @@ +-- Helper functions +local set_colour = function(colour, text) + return minetest.colorize(colour, text) +end + +local credits = { + "=== WorldEditAdditions ===", "", + "Made by", + " - "..set_colour("#ff00d7", "Starbeamrainbowlabs").." (https://github.com/sbrl)", + " - "..set_colour("#ffd700", "VorTechnix").." (https://github.com/VorTechnix)", + "","With thanks to our discord members and everyone who has reported issues or contributed!", +} + local Notify = worldeditadditions_core.notify -return worldeditadditions.normalize_test("notify", { - params = "", - description = "Sends message to player in all main notification formats (error, warn, ok, info).", +return worldeditadditions.normalize_test("credits", { + params = "N\\A", + description = "Sends WEA credits to player in info notification format.", func = function(name, params_table) - local message = table.concat(params_table, " ") - Notify.error(name, message) - Notify.warn(name, message) - Notify.ok(name, message) - Notify.info(name, message) - Notify.custom(name, "@" .. name, "Good Job", "#FF00D7") + local function send_credits(i) + Notify.info(name, credits[i]) + if #credits > i then + minetest.after(1, send_credits, i+1) + end + end + send_credits(1) end }) \ No newline at end of file