generated from AriasCreations/vsmodtemplate
Include a version number in config, to track if it needs automatic migrations.
This commit is contained in:
parent
2efa532059
commit
a3eee94f7e
3 changed files with 15 additions and 13 deletions
|
@ -361,8 +361,8 @@ namespace AriasServerUtils
|
|||
config = API.LoadModConfig<ASUModConfig>(GetConfigurationFile("global", ModConfigType.Global));
|
||||
if (config == null) config = new ASUModConfig();
|
||||
|
||||
// Step 2. Check if there are new or missing cooldowns
|
||||
config.SanityCheckCooldowns();
|
||||
// Step 2. Check if config needs Migrations
|
||||
config.SanityCheck();
|
||||
|
||||
// -> Step 3. Load Mod Warps <-
|
||||
serverWarps = API.LoadModConfig<Warps>(GetConfigurationFile("warps", ModConfigType.Global));
|
||||
|
|
|
@ -22,28 +22,24 @@ namespace AriasServerUtils
|
|||
{ CooldownType.RTP, "30s" },
|
||||
{ CooldownType.Back, "5s" }
|
||||
};
|
||||
private static readonly int CURRENT_VERSION = 3;
|
||||
|
||||
|
||||
public int Version { get; set; } = 0;
|
||||
public int MaxHomes { get; set; } = 20;
|
||||
public bool AdminsBypassMaxHomes { get; set; } = true;
|
||||
public bool onlyAdminsCreateWarps { get; set; } = true;
|
||||
public int MaxBackCache { get; set; } = 10;
|
||||
public int PlayerSleepingPercentage { get; set; } = 50;
|
||||
public int MaxRTPBlockDistance { get; set; } = 5000;
|
||||
public Dictionary<CooldownType, string> Cooldowns { get; set; } = new Dictionary<CooldownType, string>
|
||||
{
|
||||
{ CooldownType.Home, "5s" },
|
||||
{ CooldownType.Warp, "10s" },
|
||||
{ CooldownType.Spawn, "5s" },
|
||||
{ CooldownType.RTP, "30s" },
|
||||
{ CooldownType.Back, "5s" }
|
||||
};
|
||||
public Dictionary<CooldownType, string> Cooldowns { get; set; } = new Dictionary<CooldownType, string>();
|
||||
|
||||
public Dictionary<CooldownType, string> GetDefaultCooldowns()
|
||||
{
|
||||
return m_defaultCD;
|
||||
}
|
||||
|
||||
public void SanityCheckCooldowns()
|
||||
public void SanityCheck()
|
||||
{
|
||||
foreach (var cd in GetDefaultCooldowns())
|
||||
{
|
||||
|
@ -53,6 +49,12 @@ namespace AriasServerUtils
|
|||
ServerUtilities.MarkDirty();
|
||||
}
|
||||
}
|
||||
|
||||
if (Version < CURRENT_VERSION)
|
||||
{
|
||||
Version = CURRENT_VERSION;
|
||||
ServerUtilities.MarkDirty(); // This is here to ensure that the config gets saved when there is a update. Whenever a new field is added to config, the CURRENT_VERSION should get bumped so that this SanityCheck can properly work
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"modid": "ariasserverutils",
|
||||
"name": "Aria's Server Utilities",
|
||||
"authors": ["zontreck"],
|
||||
"description": "A collection of server utilities\n\nBuild Date: 03-07-2025 @ 1:17 AM MST",
|
||||
"version": "1.0.5-dev.3",
|
||||
"description": "A collection of server utilities\n\nBuild Date: 03-07-2025 @ 1:21 AM MST",
|
||||
"version": "1.0.5-dev.4",
|
||||
"dependencies": {
|
||||
"game": ""
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue