Skip to content

Commit

Permalink
Separate overlay-resolves and load-callbacks into different passes
Browse files Browse the repository at this point in the history
  • Loading branch information
wixoaGit committed Jan 25, 2025
1 parent 2b2cd64 commit 97dddde
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions OpenDreamClient/Rendering/ClientAppearanceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ public void SetAllAppearances(Dictionary<uint, ImmutableAppearance> appearances)
//need to do this because all overlays can't be resolved until the whole appearance table is populated
foreach(KeyValuePair<uint, ImmutableAppearance> pair in _appearances) {
pair.Value.ResolveOverlays(this);
if (_appearanceLoadCallbacks.TryGetValue(pair.Key, out var callbacks)) {
foreach (var callback in callbacks) callback(pair.Value);
}
}

// Callbacks called in another pass to ensure all appearances are initialized first
foreach (var callbackPair in _appearanceLoadCallbacks) {
if (!_appearances.TryGetValue(callbackPair.Key, out var appearance))
continue;

foreach (var callback in callbackPair.Value)
callback(appearance);
}
}

Expand Down

0 comments on commit 97dddde

Please sign in to comment.