mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-25 06:35:45 +00:00
alarm totems: idk
This commit is contained in:
parent
1d7839abdf
commit
13a36bd56c
15
QSB/EchoesOfTheEye/AlarmTotemSync/AlarmTotemSyncManager.cs
Normal file
15
QSB/EchoesOfTheEye/AlarmTotemSync/AlarmTotemSyncManager.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using QSB.EchoesOfTheEye.AlarmTotemSync.WorldObjects;
|
||||
using QSB.WorldSync;
|
||||
using System.Threading;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.AlarmTotemSync;
|
||||
|
||||
public class SarcophagusManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectScene WorldObjectScene => WorldObjectScene.SolarSystem;
|
||||
public override bool DlcOnly => true;
|
||||
|
||||
public override async UniTask BuildWorldObjects(OWScene scene, CancellationToken ct) =>
|
||||
QSBWorldSync.Init<QSBAlarmTotem, AlarmTotem>();
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using QSB.EchoesOfTheEye.AlarmTotemSync.WorldObjects;
|
||||
using QSB.Messaging;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
|
||||
|
||||
public class SetEnabledMessage : QSBWorldObjectMessage<QSBAlarmTotem, bool>
|
||||
{
|
||||
public SetEnabledMessage(bool data) : base(data) { }
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
if (!Data && )
|
||||
|
||||
QSBPatch.RemoteCall(() => WorldObject.AttachedObject.SetFaceOpen(Data));
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using QSB.EchoesOfTheEye.AlarmTotemSync.WorldObjects;
|
||||
using QSB.Messaging;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
|
||||
|
||||
public class SetFaceOpenMessage : QSBWorldObjectMessage<QSBAlarmTotem, bool>
|
||||
{
|
||||
public SetFaceOpenMessage(bool data) : base(data) { }
|
||||
|
||||
public override void OnReceiveRemote() =>
|
||||
QSBPatch.RemoteCall(() => WorldObject.AttachedObject.SetFaceOpen(Data));
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
using HarmonyLib;
|
||||
using QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
|
||||
using QSB.EchoesOfTheEye.AlarmTotemSync.WorldObjects;
|
||||
using QSB.Messaging;
|
||||
using QSB.Patches;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.AlarmTotemSync.Patches;
|
||||
|
||||
public class AlarmTotemPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(AlarmTotem), nameof(AlarmTotem.SetFaceOpen))]
|
||||
private static void SetFaceOpen(AlarmTotem __instance, bool open)
|
||||
{
|
||||
if (Remote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (__instance._isFaceOpen == open)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QSBWorldSync.AllObjectsReady)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
__instance.GetWorldObject<QSBAlarmTotem>()
|
||||
.SendMessage(new SetFaceOpenMessage(open));
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
|
||||
using QSB.Messaging;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.EchoesOfTheEye.AlarmTotemSync.WorldObjects;
|
||||
|
||||
public class QSBAlarmTotem : WorldObject<AlarmTotem>
|
||||
{
|
||||
public override void SendInitialState(uint to)
|
||||
{
|
||||
this.SendMessage(new SetFaceOpenMessage(AttachedObject._isFaceOpen) { To = to });
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user