public override void _PhysicsProcess(float delta) { // Process the queue if ((localLoad && finished_entries.Count == 0) || (!localLoad && remote_finished_entries.Count == 0)) { return; } if (localLoad) { if (!finished_entries.TryDequeue(out var entry)) { return; } if (Manager.addWorld(entry)) { game_container.addWorld(entry, focus: game_container.Count == 0); } } else { if (!remote_finished_entries.TryDequeue(out var world_entry)) { return; } var entry = findLocal(world_entry); // TODO: with multithreading local level can be added later than remote, and it won't be shown as downloaded if (entry != null) { world_entry.MergeLocal(entry); } game_container.addWorld(world_entry, focus: game_container.Count == 0, mark_completed: entry != null); } }