update some commands to the new notification system

....there's a bug in run_command tho with respect to return value handling
This commit is contained in:
Starbeamrainbowlabs 2024-10-17 00:27:33 +01:00
parent 36a6bf6b49
commit 1677c68a7b
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
5 changed files with 14 additions and 9 deletions

View file

@ -62,9 +62,9 @@ function selection.add_point(name, newpos)
-- Done automatically
-- worldedit.marker_update(name)
worldedit.player_notify(name, msg)
wea_c.notify.ok(name, msg)
else
worldedit.player_notify(name, "Error. Too far away (try raising your maxdist with //farwand maxdist <number>)")
wea_c.notify.error(name, "Error. Too far away (try raising your maxdist with //farwand maxdist <number>)")
-- print("[set_pos1]", name, "nil")
end
end
@ -76,7 +76,7 @@ function selection.clear_points(name)
wea_c.pos.clear(name)
-- worldedit.marker_update(name)
worldedit.player_notify(name, "Region cleared")
wea_c.notify.ok(name, "Region cleared")
end
--- Checks if a string is a valid axis.

View file

@ -17,6 +17,8 @@ minetest.register_chatcommand("/saplingaliases", {
local msg = {}
local mode = "info"
if params_text == "aliases" then
table.insert(msg, "Currently registered aliases:\n")
local aliases = wea_c.get_all_sapling_aliases()
@ -32,10 +34,13 @@ minetest.register_chatcommand("/saplingaliases", {
local str = table.concat(results, "\n")
table.insert(msg, str)
else
mode = "error"
table.insert(msg, "Unknown mode '")
table.insert(msg, params_text)
table.insert(msg, "' (valid modes: aliases, all_saplings).")
end
worldedit.player_notify(name, table.concat(msg))
-- Don't forget to update this
wea_c.notify(name, mode, table.concat(msg))
end
})

View file

@ -53,6 +53,6 @@ minetest.register_chatcommand("/sculptlist", {
table.insert(msg, wea_c.format.make_ascii_table(display))
end
worldedit.player_notify(name, table.concat(msg))
wea_c.notify.info(name, table.concat(msg))
end
})

View file

@ -1,3 +1,5 @@
local wea_c = worldeditadditions_core
-- ███████ ██████ ██████
-- ██ ██ ██ ██ ██
-- █████ ██ ██ ██████
@ -13,7 +15,6 @@
-- ?Basename support for values
-- ?Comma deliniation support for values
local wea_c = worldeditadditions_core
local function step(params)
-- Initialize additional params on first call
if not params.first then
@ -38,7 +39,7 @@ local function step(params)
-- If we haven't run out of values call function again
minetest.after(0, step, params)
else
worldedit.player_notify(params.player_name, "For "..
wea_c.notify.ok(params.player_name, "For "..
table.concat(params.values,", ")..
", /"..params.cmd_name.." completed in " ..
wea_c.format.human_time(params.time))

View file

@ -86,8 +86,7 @@ worldeditadditions_core.register_command("metaball", {
local success, value = wea.metaballs.volume(name)
if not success then
worldedit.player_notify(name, value)
return -1
return false, value
end
return value