mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 23:42:59 +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)
|
local ret = wea_c.split(params_text)
|
||||||
if #ret < 1 then
|
if #ret < 1 then
|
||||||
return false, "Error: No params found!"
|
return false, "Error: No params found!"
|
||||||
elseif ret[1] ~= "list" and #ret < 2 then
|
elseif ret[1] == "help" and #ret < 2 then
|
||||||
if ret[1] == "help" then
|
|
||||||
return false, "Error: No test found!"
|
return false, "Error: No test found!"
|
||||||
else return false, "Error: No arguments found!" end
|
|
||||||
end
|
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!"
|
return false, "Error: Test '"..ret[1].."' not found!"
|
||||||
end
|
end
|
||||||
return true, table.remove(ret, 1), ret
|
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
|
local Notify = worldeditadditions_core.notify
|
||||||
return worldeditadditions.normalize_test("notify", {
|
return worldeditadditions.normalize_test("credits", {
|
||||||
params = "<message>",
|
params = "N\\A",
|
||||||
description = "Sends message to player in all main notification formats (error, warn, ok, info).",
|
description = "Sends WEA credits to player in info notification format.",
|
||||||
func = function(name, params_table)
|
func = function(name, params_table)
|
||||||
local message = table.concat(params_table, " ")
|
local function send_credits(i)
|
||||||
Notify.error(name, message)
|
Notify.info(name, credits[i])
|
||||||
Notify.warn(name, message)
|
if #credits > i then
|
||||||
Notify.ok(name, message)
|
minetest.after(1, send_credits, i+1)
|
||||||
Notify.info(name, message)
|
end
|
||||||
Notify.custom(name, "@" .. name, "Good Job", "#FF00D7")
|
end
|
||||||
|
send_credits(1)
|
||||||
end
|
end
|
||||||
})
|
})
|
Loading…
Reference in a new issue