mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 15:33:00 +00:00
//reset refactor
This commit is contained in:
parent
ec32f944ed
commit
449f12d5d7
1 changed files with 18 additions and 29 deletions
|
@ -1,32 +1,21 @@
|
||||||
local weac = worldeditadditions_core
|
-- ██████ ███████ ███████ ███████ ████████
|
||||||
|
-- ██ ██ ██ ██ ██ ██
|
||||||
|
-- ██████ █████ ███████ █████ ██
|
||||||
|
-- ██ ██ ██ ██ ██ ██
|
||||||
|
-- ██ ██ ███████ ███████ ███████ ██
|
||||||
|
|
||||||
|
local wea_c = worldeditadditions_core
|
||||||
|
|
||||||
local worldedit_reset
|
worldeditadditions_core.register_command("reset", {
|
||||||
if minetest.registered_chatcommands["/reset"] then
|
params = "",
|
||||||
worldedit_reset = minetest.registered_chatcommands["/reset"].func
|
description = "Clears all defined points and the currently defined region.",
|
||||||
end
|
privs = {worldedit=true},
|
||||||
|
override = true, -- Override the WorldEdit command
|
||||||
local function do_reset(name, params_text)
|
parse = function(params_text)
|
||||||
-- Hide the WorldEdit marker, if appropriate
|
return true, params_text
|
||||||
if type(worldedit_reset) == "function" then
|
end,
|
||||||
worldedit_reset(name, params_text)
|
func = function(name)
|
||||||
|
wea_c.pos.clear(name)
|
||||||
|
return true, "Selection reset for "..name
|
||||||
end
|
end
|
||||||
|
})
|
||||||
-- Hide the WorldEditAdditions marker
|
|
||||||
weac.pos.clear(name)
|
|
||||||
end
|
|
||||||
|
|
||||||
if minetest.registered_chatcommands["/reset"] then
|
|
||||||
minetest.override_chatcommand("/reset", {
|
|
||||||
params = "",
|
|
||||||
description = "Clears all defined points and the currently defined region.",
|
|
||||||
func = do_reset
|
|
||||||
})
|
|
||||||
else
|
|
||||||
minetest.register_chatcommand("/reset", {
|
|
||||||
params = "",
|
|
||||||
description = "Clears all defined points and the currently defined region.",
|
|
||||||
privs = { worldedit = true },
|
|
||||||
func = do_reset
|
|
||||||
})
|
|
||||||
end
|
|
Loading…
Reference in a new issue