quantum-space-buddies/QSB/WorldSync/MiscManager.cs

26 lines
762 B
C#
Raw Normal View History

2022-04-01 18:08:03 +00:00
using Cysharp.Threading.Tasks;
2022-04-01 21:19:28 +00:00
using QSB.Utility;
using System.Linq;
2022-04-01 18:08:03 +00:00
using System.Threading;
namespace QSB.WorldSync;
2023-07-28 18:30:57 +00:00
public class MiscManager : WorldObjectManager
2022-04-01 18:08:03 +00:00
{
public override WorldObjectScene WorldObjectScene => WorldObjectScene.Both;
public override bool DlcOnly => false;
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct)
{
await UniTask.WaitUntil(() => LateInitializerManager.isDoneInitializing, cancellationToken: ct);
2022-04-01 21:20:19 +00:00
var listToInitFrom = QSBWorldSync.GetUnityObjects<OWRigidbody>()
2022-04-01 21:19:28 +00:00
.Where(x =>
x is not (PlayerBody or ShipBody or ShuttleBody) &&
!x.TryGetComponent<SurveyorProbe>(out _)
)
.SortDeterministic();
2022-04-01 21:20:19 +00:00
QSBWorldSync.Init<QSBOWRigidbody, OWRigidbody>(listToInitFrom);
2022-04-01 18:08:03 +00:00
}
}