make it work for other players

This commit is contained in:
JohnCorby 2022-11-17 00:53:29 -08:00
parent 31dc5a2174
commit bb6a2eb432

View File

@ -3,6 +3,7 @@ using QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
using QSB.EchoesOfTheEye.AlarmTotemSync.WorldObjects;
using QSB.Messaging;
using QSB.Patches;
using QSB.Player;
using QSB.WorldSync;
using UnityEngine;
@ -21,15 +22,21 @@ public class AlarmTotemPatches : QSBPatch
__result = false;
return false;
}
var position = Locator.GetPlayerCamera().transform.position;
foreach (var player in QSBPlayerManager.PlayerList)
{
var position = player.Camera.transform.position;
if (__instance.CheckPointInVisionCone(position) && !__instance.CheckLineOccluded(__instance._sightOrigin.position, position))
{
if (Locator.GetPlayerLightSensor().IsIlluminated())
if (player.LightSensor.IsIlluminated())
{
__result = true;
return false;
}
var lanternController = Locator.GetDreamWorldController().GetPlayerLantern().GetLanternController();
if (player.AssignedSimulationLantern == null)
{
continue;
}
var lanternController = player.AssignedSimulationLantern.AttachedObject.GetLanternController();
if (lanternController.IsHeldByPlayer())
{
if (lanternController.IsConcealed())
@ -50,6 +57,7 @@ public class AlarmTotemPatches : QSBPatch
return false;
}
}
}
__result = false;
return false;
}