aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2017-11-21 02:55:33 +0000
committerparamat <mat.gregory@virginmedia.com>2017-11-24 05:38:53 +0000
commit912ba1e47f61be18fa01cc91936929168c883f7b (patch)
treeeb60b88fe080385293bad34967ebae4568e9b019
parentf7733f41ea36e7d4531fea61a4cd4b679514d263 (diff)
downloadminetest-912ba1e47f61be18fa01cc91936929168c883f7b.tar.gz
minetest-912ba1e47f61be18fa01cc91936929168c883f7b.tar.bz2
minetest-912ba1e47f61be18fa01cc91936929168c883f7b.zip
Clearobjects: Send progress messages to terminal using actionstream
Change default mode to 'quick' as 'full' can lock up a server for a long time.
-rw-r--r--builtin/game/chatcommands.lua6
-rw-r--r--src/script/lua_api/l_env.cpp2
-rw-r--r--src/serverenvironment.cpp6
3 files changed, 7 insertions, 7 deletions
diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua
index cbfe2fb25..1402724e5 100644
--- a/builtin/game/chatcommands.lua
+++ b/builtin/game/chatcommands.lua
@@ -896,10 +896,10 @@ core.register_chatcommand("clearobjects", {
privs = {server=true},
func = function(name, param)
local options = {}
- if param == "" or param == "full" then
- options.mode = "full"
- elseif param == "quick" then
+ if param == "" or param == "quick" then
options.mode = "quick"
+ elseif param == "full" then
+ options.mode = "full"
else
return false, "Invalid usage, see /help clearobjects."
end
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index f45a8da80..870eeb1ae 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -956,7 +956,7 @@ int ModApiEnvMod::l_clear_objects(lua_State *L)
{
GET_ENV_PTR;
- ClearObjectsMode mode = CLEAR_OBJECTS_MODE_FULL;
+ ClearObjectsMode mode = CLEAR_OBJECTS_MODE_QUICK;
if (lua_istable(L, 1)) {
mode = (ClearObjectsMode)getenumfield(L, 1, "mode",
ModApiEnvMod::es_ClearObjectsMode, mode);
diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp
index f68f2a27d..1ac1ac1ba 100644
--- a/src/serverenvironment.cpp
+++ b/src/serverenvironment.cpp
@@ -1024,7 +1024,7 @@ void ServerEnvironment::clearObjects(ClearObjectsMode mode)
loadable_blocks = loaded_blocks;
}
- infostream << "ServerEnvironment::clearObjects(): "
+ actionstream << "ServerEnvironment::clearObjects(): "
<< "Now clearing objects in " << loadable_blocks.size()
<< " blocks" << std::endl;
@@ -1070,7 +1070,7 @@ void ServerEnvironment::clearObjects(ClearObjectsMode mode)
num_blocks_checked % report_interval == 0) {
float percent = 100.0 * (float)num_blocks_checked /
loadable_blocks.size();
- infostream << "ServerEnvironment::clearObjects(): "
+ actionstream << "ServerEnvironment::clearObjects(): "
<< "Cleared " << num_objs_cleared << " objects"
<< " in " << num_blocks_cleared << " blocks ("
<< percent << "%)" << std::endl;
@@ -1090,7 +1090,7 @@ void ServerEnvironment::clearObjects(ClearObjectsMode mode)
m_last_clear_objects_time = m_game_time;
- infostream << "ServerEnvironment::clearObjects(): "
+ actionstream << "ServerEnvironment::clearObjects(): "
<< "Finished: Cleared " << num_objs_cleared << " objects"
<< " in " << num_blocks_cleared << " blocks" << std::endl;
}