mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-25 06:35:45 +00:00
rename
This commit is contained in:
parent
5e611a4bf0
commit
31d4669773
@ -5,7 +5,7 @@ using System.Threading;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.AlarmTotemSync;
|
||||
|
||||
public class SarcophagusManager : WorldObjectManager
|
||||
public class AlarmTotemManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectScene WorldObjectScene => WorldObjectScene.SolarSystem;
|
||||
public override bool DlcOnly => true;
|
@ -5,7 +5,7 @@ namespace QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
|
||||
|
||||
public class SetEnabledMessage : QSBWorldObjectMessage<QSBAlarmTotem, bool>
|
||||
{
|
||||
public SetEnabledMessage(bool data) : base(data) { }
|
||||
public SetEnabledMessage(bool enabled) : base(enabled) { }
|
||||
|
||||
public override void OnReceiveRemote() =>
|
||||
WorldObject.SetEnabled(Data);
|
||||
|
@ -6,7 +6,7 @@ namespace QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
|
||||
|
||||
public class SetFaceOpenMessage : QSBWorldObjectMessage<QSBAlarmTotem, bool>
|
||||
{
|
||||
public SetFaceOpenMessage(bool data) : base(data) { }
|
||||
public SetFaceOpenMessage(bool open) : base(open) { }
|
||||
|
||||
public override void OnReceiveRemote() =>
|
||||
QSBPatch.RemoteCall(() => WorldObject.AttachedObject.SetFaceOpen(Data));
|
||||
|
@ -55,4 +55,59 @@ public class AlarmTotemPatches : QSBPatch
|
||||
.SendMessage(new SetEnabledMessage(false));
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(AlarmTotem), nameof(AlarmTotem.FixedUpdate))]
|
||||
private static bool FixedUpdate(AlarmTotem __instance)
|
||||
{
|
||||
var isPlayerVisible = __instance._isPlayerVisible;
|
||||
__instance._isPlayerVisible = __instance.CheckPlayerVisible();
|
||||
if (__instance._isPlayerVisible && !isPlayerVisible)
|
||||
{
|
||||
Locator.GetAlarmSequenceController().IncreaseAlarmCounter();
|
||||
__instance._simTotemMaterials[0] = __instance._simAlarmMaterial;
|
||||
__instance._simTotemRenderer.sharedMaterials = __instance._simTotemMaterials;
|
||||
__instance._simVisionConeRenderer.SetColor(__instance._simAlarmColor);
|
||||
if (__instance._isTutorialTotem)
|
||||
{
|
||||
GlobalMessenger.FireEvent("TutorialAlarmTotemTriggered");
|
||||
}
|
||||
}
|
||||
else if (isPlayerVisible && !__instance._isPlayerVisible)
|
||||
{
|
||||
Locator.GetAlarmSequenceController().DecreaseAlarmCounter();
|
||||
__instance._simTotemMaterials[0] = __instance._origSimEyeMaterial;
|
||||
__instance._simTotemRenderer.sharedMaterials = __instance._simTotemMaterials;
|
||||
__instance._simVisionConeRenderer.SetColor(__instance._simVisionConeRenderer.GetOriginalColor());
|
||||
__instance._pulseLightController.FadeTo(0f, 0.5f);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(AlarmTotem), nameof(AlarmTotem.CheckPlayerVisible))]
|
||||
private static bool CheckPlayerVisible(AlarmTotem __instance, out bool __result)
|
||||
{
|
||||
if (!__instance._isFaceOpen)
|
||||
{
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
var lanternController = Locator.GetDreamWorldController().GetPlayerLantern().GetLanternController();
|
||||
var playerLightSensor = Locator.GetPlayerLightSensor();
|
||||
if (lanternController.IsHeldByPlayer() && !lanternController.IsConcealed() || playerLightSensor.IsIlluminated())
|
||||
{
|
||||
var position = Locator.GetPlayerCamera().transform.position;
|
||||
if (__instance.CheckPointInVisionCone(position) && !__instance.CheckLineOccluded(__instance._sightOrigin.position, position))
|
||||
{
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
using QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
|
||||
using QSB.Messaging;
|
||||
using QSB.Player;
|
||||
using QSB.WorldSync;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.AlarmTotemSync.WorldObjects;
|
||||
|
||||
public class QSBAlarmTotem : WorldObject<AlarmTotem>
|
||||
{
|
||||
public readonly List<PlayerInfo> VisibleFor = new();
|
||||
|
||||
public override void SendInitialState(uint to)
|
||||
{
|
||||
this.SendMessage(new SetFaceOpenMessage(AttachedObject._isFaceOpen) { To = to });
|
||||
|
Loading…
x
Reference in New Issue
Block a user