This commit is contained in:
JohnCorby 2022-07-24 10:23:46 -07:00
parent 8a1ed54818
commit 7f28ee6553

View File

@ -143,7 +143,7 @@ internal class LightSensorPatches : QSBPatch
/// <summary> /// <summary>
/// to prevent allocating a new list every frame /// to prevent allocating a new list every frame
/// </summary> /// </summary>
private static readonly List<DreamLanternController> _prevIlluminatingDreamLanternList = new(); private static readonly List<DreamLanternController> _illuminatingDreamLanternList = new();
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(nameof(SingleLightSensor.ManagedFixedUpdate))] [HarmonyPatch(nameof(SingleLightSensor.ManagedFixedUpdate))]
@ -165,8 +165,8 @@ internal class LightSensorPatches : QSBPatch
if (__instance._illuminatingDreamLanternList != null) if (__instance._illuminatingDreamLanternList != null)
{ {
_prevIlluminatingDreamLanternList.Clear(); _illuminatingDreamLanternList.Clear();
_prevIlluminatingDreamLanternList.AddRange(__instance._illuminatingDreamLanternList); _illuminatingDreamLanternList.AddRange(__instance._illuminatingDreamLanternList);
} }
var illuminated = __instance._illuminated; var illuminated = __instance._illuminated;
@ -215,7 +215,7 @@ internal class LightSensorPatches : QSBPatch
} }
if (__instance._illuminatingDreamLanternList != null if (__instance._illuminatingDreamLanternList != null
&& !__instance._illuminatingDreamLanternList.SequenceEqual(_prevIlluminatingDreamLanternList)) && !__instance._illuminatingDreamLanternList.SequenceEqual(_illuminatingDreamLanternList))
{ {
if (isPlayerLightSensor) if (isPlayerLightSensor)
{ {