rework _illuminated = false with auth

This commit is contained in:
JohnCorby 2022-08-16 17:47:51 -07:00
parent ba83ed2276
commit 6edc85dbcc

View File

@ -59,18 +59,23 @@ internal class LightSensorPatches : QSBPatch
{
if (__instance._illuminated)
{
qsbLightSensor._locallyIlluminated = false;
qsbLightSensor.OnDetectLocalDarkness?.Invoke();
// wait because someone could send a message getting ownership again
Delay.RunFramesLater(10, () =>
{
// no one else took ownership, so we can safely make not illuminated
if (qsbLightSensor.Owner == 0)
{
__instance._illuminated = false;
__instance.OnDetectDarkness.Invoke();
qsbLightSensor.SendMessage(new SetIlluminatedMessage(false));
}
});
}
__instance._illuminated = false;
if (qsbLightSensor._locallyIlluminated)
{
qsbLightSensor._locallyIlluminated = false;
qsbLightSensor.OnDetectLocalDarkness?.Invoke();
}
}
}
return false;