mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-30 03:32:47 +00:00
CheckPlayerVisible
This commit is contained in:
parent
8bf212c02d
commit
ea5477cc15
@ -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;
|
||||
|
||||
@ -83,6 +84,38 @@ public class AlarmTotemPatches : QSBPatch
|
||||
}
|
||||
*/
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(AlarmTotem), nameof(AlarmTotem.CheckPlayerVisible))]
|
||||
private static bool CheckPlayerVisible(AlarmTotem __instance, out bool __result)
|
||||
{
|
||||
if (!__instance._isFaceOpen)
|
||||
{
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
foreach (var player in QSBPlayerManager.PlayerList)
|
||||
{
|
||||
var lanternController = player.AssignedSimulationLantern?.AttachedObject?._lanternController;
|
||||
if (!lanternController)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var playerLightSensor = player.LightSensor;
|
||||
if ((lanternController.IsHeldByPlayer() && !lanternController.IsConcealed()) || playerLightSensor.IsIlluminated())
|
||||
{
|
||||
var position = player.Camera.transform.position;
|
||||
if (__instance.CheckPointInVisionCone(position) && !__instance.CheckLineOccluded(__instance._sightOrigin.position, position))
|
||||
{
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(AlarmBell), nameof(AlarmBell.OnEntry))]
|
||||
private static bool OnEntry(AlarmBell __instance, GameObject hitObj)
|
||||
|
Loading…
x
Reference in New Issue
Block a user