26 lines
845 B
C#
Raw Normal View History

2022-01-28 20:49:07 -08:00
using Cysharp.Threading.Tasks;
using QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
2022-04-10 15:16:44 -07:00
using QSB.Utility;
2021-11-08 20:55:53 +00:00
using QSB.WorldSync;
2022-04-10 15:16:44 -07:00
using System.Linq;
2022-01-28 20:49:07 -08:00
using System.Threading;
2021-11-08 20:55:53 +00:00
2022-03-02 19:46:33 -08:00
namespace QSB.EchoesOfTheEye.LightSensorSync;
internal class LightSensorManager : WorldObjectManager
2021-11-08 20:55:53 +00:00
{
public override WorldObjectScene WorldObjectScene => WorldObjectScene.Both;
2022-04-10 15:16:44 -07:00
public override bool DlcOnly => true;
2022-05-28 14:14:25 -07:00
public static bool IsPlayerLightSensor(LightSensor lightSensor) => lightSensor.name is "CameraDetector" or "REMOTE_CameraDetector";
2022-04-10 15:16:44 -07:00
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct)
{
// ignore player light sensors
var list = QSBWorldSync.GetUnityObjects<SingleLightSensor>()
2022-05-28 14:14:25 -07:00
.Where(x => !IsPlayerLightSensor(x))
2022-04-10 15:16:44 -07:00
.SortDeterministic();
QSBWorldSync.Init<QSBLightSensor, SingleLightSensor>(list);
}
}