mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 23:42:59 +00:00
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:
parent
36a6bf6b49
commit
1677c68a7b
5 changed files with 14 additions and 9 deletions
|
@ -62,9 +62,9 @@ function selection.add_point(name, newpos)
|
||||||
|
|
||||||
-- Done automatically
|
-- Done automatically
|
||||||
-- worldedit.marker_update(name)
|
-- worldedit.marker_update(name)
|
||||||
worldedit.player_notify(name, msg)
|
wea_c.notify.ok(name, msg)
|
||||||
else
|
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")
|
-- print("[set_pos1]", name, "nil")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -76,7 +76,7 @@ function selection.clear_points(name)
|
||||||
wea_c.pos.clear(name)
|
wea_c.pos.clear(name)
|
||||||
-- worldedit.marker_update(name)
|
-- worldedit.marker_update(name)
|
||||||
|
|
||||||
worldedit.player_notify(name, "Region cleared")
|
wea_c.notify.ok(name, "Region cleared")
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Checks if a string is a valid axis.
|
--- Checks if a string is a valid axis.
|
||||||
|
|
|
@ -17,6 +17,8 @@ minetest.register_chatcommand("/saplingaliases", {
|
||||||
|
|
||||||
local msg = {}
|
local msg = {}
|
||||||
|
|
||||||
|
local mode = "info"
|
||||||
|
|
||||||
if params_text == "aliases" then
|
if params_text == "aliases" then
|
||||||
table.insert(msg, "Currently registered aliases:\n")
|
table.insert(msg, "Currently registered aliases:\n")
|
||||||
local aliases = wea_c.get_all_sapling_aliases()
|
local aliases = wea_c.get_all_sapling_aliases()
|
||||||
|
@ -32,10 +34,13 @@ minetest.register_chatcommand("/saplingaliases", {
|
||||||
local str = table.concat(results, "\n")
|
local str = table.concat(results, "\n")
|
||||||
table.insert(msg, str)
|
table.insert(msg, str)
|
||||||
else
|
else
|
||||||
|
mode = "error"
|
||||||
table.insert(msg, "Unknown mode '")
|
table.insert(msg, "Unknown mode '")
|
||||||
table.insert(msg, params_text)
|
table.insert(msg, params_text)
|
||||||
table.insert(msg, "' (valid modes: aliases, all_saplings).")
|
table.insert(msg, "' (valid modes: aliases, all_saplings).")
|
||||||
end
|
end
|
||||||
worldedit.player_notify(name, table.concat(msg))
|
|
||||||
|
-- Don't forget to update this
|
||||||
|
wea_c.notify(name, mode, table.concat(msg))
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
|
@ -53,6 +53,6 @@ minetest.register_chatcommand("/sculptlist", {
|
||||||
table.insert(msg, wea_c.format.make_ascii_table(display))
|
table.insert(msg, wea_c.format.make_ascii_table(display))
|
||||||
end
|
end
|
||||||
|
|
||||||
worldedit.player_notify(name, table.concat(msg))
|
wea_c.notify.info(name, table.concat(msg))
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
|
||||||
-- ███████ ██████ ██████
|
-- ███████ ██████ ██████
|
||||||
-- ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██
|
||||||
-- █████ ██ ██ ██████
|
-- █████ ██ ██ ██████
|
||||||
|
@ -13,7 +15,6 @@
|
||||||
-- ?Basename support for values
|
-- ?Basename support for values
|
||||||
-- ?Comma deliniation support for values
|
-- ?Comma deliniation support for values
|
||||||
|
|
||||||
local wea_c = worldeditadditions_core
|
|
||||||
local function step(params)
|
local function step(params)
|
||||||
-- Initialize additional params on first call
|
-- Initialize additional params on first call
|
||||||
if not params.first then
|
if not params.first then
|
||||||
|
@ -38,7 +39,7 @@ local function step(params)
|
||||||
-- If we haven't run out of values call function again
|
-- If we haven't run out of values call function again
|
||||||
minetest.after(0, step, params)
|
minetest.after(0, step, params)
|
||||||
else
|
else
|
||||||
worldedit.player_notify(params.player_name, "For "..
|
wea_c.notify.ok(params.player_name, "For "..
|
||||||
table.concat(params.values,", ")..
|
table.concat(params.values,", ")..
|
||||||
", /"..params.cmd_name.." completed in " ..
|
", /"..params.cmd_name.." completed in " ..
|
||||||
wea_c.format.human_time(params.time))
|
wea_c.format.human_time(params.time))
|
||||||
|
|
|
@ -86,8 +86,7 @@ worldeditadditions_core.register_command("metaball", {
|
||||||
local success, value = wea.metaballs.volume(name)
|
local success, value = wea.metaballs.volume(name)
|
||||||
|
|
||||||
if not success then
|
if not success then
|
||||||
worldedit.player_notify(name, value)
|
return false, value
|
||||||
return -1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
Loading…
Reference in a new issue