initial state for light sensors

This commit is contained in:
JohnCorby 2022-08-16 16:27:56 -07:00
parent 18a083240e
commit 0def903566
3 changed files with 10 additions and 7 deletions

View File

@ -9,6 +9,11 @@ internal class SetIlluminatedMessage : QSBWorldObjectMessage<QSBLightSensor, boo
public override void OnReceiveRemote()
{
if (WorldObject.AttachedObject._illuminated == Data)
{
return;
}
WorldObject.AttachedObject._illuminated = Data;
if (Data)
{

View File

@ -18,8 +18,6 @@ using UnityEngine;
* leave while you still can.
*/
// TODO PLEASE TEST THIS AND DEBUG YOU HAVE TO
namespace QSB.EchoesOfTheEye.LightSensorSync.Patches;
[HarmonyPatch(typeof(SingleLightSensor))]

View File

@ -1,5 +1,7 @@
using Cysharp.Threading.Tasks;
using QSB.AuthoritySync;
using QSB.EchoesOfTheEye.LightSensorSync.Messages;
using QSB.Messaging;
using QSB.Utility;
using QSB.WorldSync;
using System;
@ -13,10 +15,6 @@ using System.Threading;
namespace QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
/// <summary>
/// TODO: switch this over to some sort of auth system.
/// list of illuminators doesn't work because if a player illuminates and then leaves,
/// it'll be considered illuminated forever until they come back.
///
/// BUG: this breaks in zone2.
/// the sector it's enabled in is bigger than the sector the zone2 walls are enabled in :(
/// maybe this can be fixed by making the collision group use the same sector.
@ -34,7 +32,9 @@ internal class QSBLightSensor : AuthWorldObject<SingleLightSensor>
public override void SendInitialState(uint to)
{
base.SendInitialState(to);
// todo initial state
this.SendMessage(new SetIlluminatedMessage(AttachedObject._illuminated) { To = to });
this.SendMessage(new IlluminatingLanternsMessage(AttachedObject._illuminatingDreamLanternList) { To = to });
}
public override async UniTask Init(CancellationToken ct)