Skip to content

Commit

Permalink
Add tag serverSaveTime on config.lua (#251)
Browse files Browse the repository at this point in the history
With this modification, the configuration of the global server save can be done directly in config.lua, thus centralizing configurable things in a single place
  • Loading branch information
beats-dh authored Apr 17, 2022
1 parent 6db7c30 commit e848604
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion data/scripts/globalevents/server_save.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
1 change: 1 addition & 0 deletions src/config/config_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ enum stringConfig_t {
MAP_CUSTOM_AUTHOR,
DISCORD_WEBHOOK_URL,
SAVE_INTERVAL_TYPE,
SERVER_SAVE_TIME,

LAST_STRING_CONFIG
};
Expand Down
1 change: 1 addition & 0 deletions src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/lua/functions/core/game/config_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit e848604

Please sign in to comment.