diff --git a/QSB/EchoesOfTheEye/LightSensorSync/Patches/LightSensorPatches.cs b/QSB/EchoesOfTheEye/LightSensorSync/Patches/LightSensorPatches.cs index 47de79d0..adf436c4 100644 --- a/QSB/EchoesOfTheEye/LightSensorSync/Patches/LightSensorPatches.cs +++ b/QSB/EchoesOfTheEye/LightSensorSync/Patches/LightSensorPatches.cs @@ -82,6 +82,7 @@ internal class LightSensorPatches : QSBPatch return false; } var illuminated = __instance._illuminated; + var locallyIlluminated = qsbLightSensor._locallyIlluminated; __instance.UpdateIllumination(); if (!illuminated && __instance._illuminated) { @@ -92,6 +93,15 @@ internal class LightSensorPatches : QSBPatch { __instance.OnDetectDarkness.Invoke(); } + if (!locallyIlluminated && qsbLightSensor._locallyIlluminated) + { + qsbLightSensor.OnDetectLocalLight.Invoke(); + return false; + } + if (locallyIlluminated && !qsbLightSensor._locallyIlluminated) + { + qsbLightSensor.OnDetectLocalDarkness.Invoke(); + } return false; } diff --git a/QSB/EchoesOfTheEye/LightSensorSync/WorldObjects/QSBLightSensor.cs b/QSB/EchoesOfTheEye/LightSensorSync/WorldObjects/QSBLightSensor.cs index f3e77637..e5558338 100644 --- a/QSB/EchoesOfTheEye/LightSensorSync/WorldObjects/QSBLightSensor.cs +++ b/QSB/EchoesOfTheEye/LightSensorSync/WorldObjects/QSBLightSensor.cs @@ -20,14 +20,13 @@ namespace QSB.EchoesOfTheEye.LightSensorSync.WorldObjects; /// 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 also breaks in zone2. +/// 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. /// internal class QSBLightSensor : WorldObject { internal bool _locallyIlluminated; - public Action OnDetectLocalLight; public Action OnDetectLocalDarkness; @@ -46,7 +45,7 @@ internal class QSBLightSensor : WorldObject { QSBPlayerManager.OnRemovePlayer += OnPlayerLeave; - // normally done in Start, but world objects arent ready by that point + // do this stuff here instead of Start, since world objects won't be ready by that point Delay.RunWhen(() => QSBWorldSync.AllObjectsReady, () => { if (AttachedObject._sector != null) @@ -55,7 +54,6 @@ internal class QSBLightSensor : WorldObject { _locallyIlluminated = true; OnDetectLocalLight?.Invoke(); - this.SendMessage(new SetIlluminatedMessage(true)); } } });