diff --git a/config.lua.dist b/config.lua.dist index 90bb009fbd5..cc84364dd7e 100644 --- a/config.lua.dist +++ b/config.lua.dist @@ -180,6 +180,7 @@ serverSaveNotifyDuration = 5 serverSaveCleanMap = false serverSaveClose = false serverSaveShutdown = true +serverSaveTime = "06:00:00" -- Sort loot by chance, most rare items drop first -- it is good to be setted when you have a higher diff --git a/data/scripts/globalevents/server_save.lua b/data/scripts/globalevents/server_save.lua index 29a7ff0a4ce..fb5cd6eb27c 100644 --- a/data/scripts/globalevents/server_save.lua +++ b/data/scripts/globalevents/server_save.lua @@ -42,5 +42,6 @@ function serversave.onTime(interval) addEvent(ServerSaveWarning, 60000, remaningTime) -- Schedule next event in 1 minute(60000) return not configManager.getBoolean(configKeys.SERVER_SAVE_SHUTDOWN) end -serversave:time("21:50:00") + +serversave:time(configManager.getString(configKeys.SERVER_SAVE_TIME)) serversave:register() diff --git a/src/config/config_definitions.hpp b/src/config/config_definitions.hpp index 0bae89a6b5f..3c0c69f4f96 100644 --- a/src/config/config_definitions.hpp +++ b/src/config/config_definitions.hpp @@ -97,6 +97,7 @@ enum stringConfig_t { MAP_CUSTOM_AUTHOR, DISCORD_WEBHOOK_URL, SAVE_INTERVAL_TYPE, + SERVER_SAVE_TIME, LAST_STRING_CONFIG }; diff --git a/src/config/configmanager.cpp b/src/config/configmanager.cpp index 6fae37b9458..ebfee7d1076 100644 --- a/src/config/configmanager.cpp +++ b/src/config/configmanager.cpp @@ -198,6 +198,7 @@ bool ConfigManager::load() string[STORE_IMAGES_URL] = getGlobalString(L, "coinImagesURL", ""); string[DISCORD_WEBHOOK_URL] = getGlobalString(L, "discordWebhookURL", ""); string[SAVE_INTERVAL_TYPE] = getGlobalString(L, "saveIntervalType", ""); + string[SERVER_SAVE_TIME] = getGlobalString(L, "serverSaveTime", "06:00"); integer[MAX_PLAYERS] = getGlobalNumber(L, "maxPlayers"); integer[PZ_LOCKED] = getGlobalNumber(L, "pzLocked", 60000); diff --git a/src/lua/functions/core/game/config_functions.hpp b/src/lua/functions/core/game/config_functions.hpp index 8cd336fa947..5dfc2b66b66 100644 --- a/src/lua/functions/core/game/config_functions.hpp +++ b/src/lua/functions/core/game/config_functions.hpp @@ -164,6 +164,7 @@ class ConfigFunctions final : LuaScriptInterface { registerEnumIn(L, "configKeys", TOGLE_SAVE_INTERVAL_CLEAN_MAP) registerEnumIn(L, "configKeys", SAVE_INTERVAL_TIME) registerEnumIn(L, "configKeys", TOGLE_IMBUEMENT_SHRINE_STORAGE) + registerEnumIn(L, "configKeys", SERVER_SAVE_TIME) #undef registerEnumIn }