Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make overlay-resolves and load-callbacks separate passes #2185

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading