mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 15:33:00 +00:00
Fixed some problems
This commit is contained in:
parent
cd8a034333
commit
a9a7a5a9f1
2 changed files with 27 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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 = "<message>",
|
||||
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
|
||||
})
|
Loading…
Reference in a new issue