Skip to content

Commit 2e5febf

Browse files
committed
Fixed prefab cache version not being checked
Previously this caused user to require deleting the cache file in order to start the server successfully.
1 parent 0b2713c commit 2e5febf

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Nitrox.Server.Subnautica/Models/Resources/Parsers/PrefabPlaceholderGroupsResource.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,8 @@ private async Task CreateOrLoadPrefabCacheAsync(string nitroxCachePath)
149149
{
150150
logger.ZLogWarning($"An error occurred while deserializing the prefab cache. Re-creating it: {ex.Message:@Error}");
151151
}
152-
if (cache.HasValue)
152+
if (cache is { Version: CACHE_VERSION })
153153
{
154-
if (cache.Value.Version != CACHE_VERSION)
155-
{
156-
logger.ZLogInformation($"Found outdated cache ({cache.Value.Version}, expected {CACHE_VERSION})");
157-
}
158154
prefabPlaceholdersGroupPaths = cache.Value.PrefabPlaceholdersGroupPaths;
159155
randomPossibilitiesByClassId = cache.Value.RandomPossibilitiesByClassId;
160156
groupsByClassId = cache.Value.GroupsByClassId;
@@ -164,6 +160,10 @@ private async Task CreateOrLoadPrefabCacheAsync(string nitroxCachePath)
164160
// Fallback solution
165161
else
166162
{
163+
if (cache.HasValue)
164+
{
165+
logger.ZLogInformation($"Found outdated cache (is v{cache.Value.Version}, expected v{CACHE_VERSION})");
166+
}
167167
logger.ZLogInformation($"Building cache, this may take a while...");
168168
// Get all prefab-classIds linked to the (partial) bundle path
169169
string prefabDatabasePath = Path.Combine(options.Value.GetSubnauticaResourcesPath(), "StreamingAssets", "SNUnmanagedData", "prefabs.db");

0 commit comments

Comments
 (0)