2022-01-29 04:49:07 +00:00
|
|
|
|
using Cysharp.Threading.Tasks;
|
|
|
|
|
using QSB.MeteorSync.WorldObjects;
|
2022-03-11 05:27:29 +00:00
|
|
|
|
using QSB.Utility;
|
2021-11-11 02:40:02 +00:00
|
|
|
|
using QSB.WorldSync;
|
2021-11-25 15:32:34 +00:00
|
|
|
|
using System.Linq;
|
2022-01-29 04:49:07 +00:00
|
|
|
|
using System.Threading;
|
2021-11-11 02:40:02 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
namespace QSB.MeteorSync;
|
|
|
|
|
|
|
|
|
|
public class MeteorManager : WorldObjectManager
|
2021-11-11 02:40:02 +00:00
|
|
|
|
{
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public override WorldObjectScene WorldObjectScene => WorldObjectScene.SolarSystem;
|
2021-12-21 02:41:12 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public static WhiteHoleVolume WhiteHoleVolume;
|
2021-11-11 02:40:02 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct)
|
|
|
|
|
{
|
|
|
|
|
// wait for all late initializers (which includes meteor launchers) to finish
|
|
|
|
|
await UniTask.WaitUntil(() => LateInitializerManager.isDoneInitializing, cancellationToken: ct);
|
2022-01-29 04:57:17 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
WhiteHoleVolume = QSBWorldSync.GetUnityObjects<WhiteHoleVolume>().First();
|
|
|
|
|
QSBWorldSync.Init<QSBFragment, FragmentIntegrity>();
|
2022-03-11 05:27:29 +00:00
|
|
|
|
|
|
|
|
|
var meteorLaunchers = QSBWorldSync.GetUnityObjects<MeteorLauncher>().SortDeterministic().ToList();
|
|
|
|
|
QSBWorldSync.Init<QSBMeteorLauncher, MeteorLauncher>(meteorLaunchers);
|
|
|
|
|
|
|
|
|
|
// order by pool instead of using SortDeterministic
|
|
|
|
|
var meteors = meteorLaunchers.SelectMany(x =>
|
|
|
|
|
x._meteorPool.EmptyIfNull().Concat(x._dynamicMeteorPool.EmptyIfNull()));
|
|
|
|
|
QSBWorldSync.Init<QSBMeteor, MeteorController>(meteors);
|
2021-11-11 02:40:02 +00:00
|
|
|
|
}
|
2022-03-11 05:27:29 +00:00
|
|
|
|
}
|