Skip to content

Commit

Permalink
Remove automated level mod flagging from realm migrations
Browse files Browse the repository at this point in the history
For now, the server with `--import-assets` then `--flag-modded-levels` to properly fill out this data.
  • Loading branch information
Beyley committed Aug 26, 2024
1 parent 8c1aa42 commit c4f7f15
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions Refresh.GameServer/Database/GameDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,42 +337,6 @@ protected override void Migrate(Migration migration, ulong oldVersion)
newLevel.UpdateDate = DateTimeOffset.FromUnixTimeMilliseconds(oldLevel.UpdateDate);
}

// In version 148, we added a "Modded" tag to levels
if (oldVersion < 148)
{
if (!newLevel.RootResource.StartsWith('g'))
{
void TraverseDependenciesRecursively(GameAsset asset, Action<string, GameAsset?> callback)
{
callback(asset.AssetHash, asset);
foreach (string internalAssetHash in migration.NewRealm.All<AssetDependencyRelation>().Where(d => d.Dependent == asset.AssetHash).AsEnumerable().Select(d => d.Dependency))
{
GameAsset? internalAsset = migration.NewRealm.Find<GameAsset>(internalAssetHash);

// Only run this if this is null, since the next recursion will trigger its own callback
if(internalAsset == null)
callback(internalAssetHash, internalAsset);

if(internalAsset != null)
TraverseDependenciesRecursively(internalAsset, callback);
}
}

GameAsset? asset = migration.NewRealm.Find<GameAsset>(newLevel.RootResource);

if (asset != null)
{
bool modded = false;
TraverseDependenciesRecursively(asset, (hash, gameAsset) =>
{
if (gameAsset != null && (gameAsset.AssetFlags & AssetFlags.Modded) != 0)
modded = true;
});
newLevel.IsModded = modded;
}
}
}

// Version 148 is when `Modded` was added, and in 149 we renamed `Modded` to `IsModded`
if (oldVersion >= 148 && oldVersion < 149)
{
Expand Down

0 comments on commit c4f7f15

Please sign in to comment.