diff --git a/QSB/EchoesOfTheEye/WineCellar/Messages/WineCellarSwitchMessage.cs b/QSB/EchoesOfTheEye/WineCellar/Messages/WineCellarSwitchMessage.cs new file mode 100644 index 00000000..11cfaa36 --- /dev/null +++ b/QSB/EchoesOfTheEye/WineCellar/Messages/WineCellarSwitchMessage.cs @@ -0,0 +1,8 @@ +using QSB.Messaging; + +namespace QSB.EchoesOfTheEye.WineCellar.Messages; + +internal class WineCellarSwitchMessage : QSBWorldObjectMessage +{ + public override void OnReceiveRemote() => WorldObject.AttachedObject.OnPressInteract(); +} diff --git a/QSB/EchoesOfTheEye/WineCellar/Patches/WineCellarPatches.cs b/QSB/EchoesOfTheEye/WineCellar/Patches/WineCellarPatches.cs new file mode 100644 index 00000000..d020297f --- /dev/null +++ b/QSB/EchoesOfTheEye/WineCellar/Patches/WineCellarPatches.cs @@ -0,0 +1,25 @@ +using HarmonyLib; +using QSB.EchoesOfTheEye.WineCellar.Messages; +using QSB.Messaging; +using QSB.Patches; +using QSB.WorldSync; + +namespace QSB.EchoesOfTheEye.WineCellar.Patches; + +internal class WineCellarPatches : QSBPatch +{ + public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect; + + [HarmonyPostfix] + [HarmonyPatch(typeof(WineCellarSwitch), nameof(WineCellarSwitch.OnPressInteract))] + public static void OnPressInteract(WineCellarSwitch __instance) + { + if (Remote) + { + return; + } + + var worldObject = __instance.GetWorldObject(); + worldObject.SendMessage(new WineCellarSwitchMessage()); + } +} diff --git a/QSB/EchoesOfTheEye/WineCellar/QSBWineCellarSwitch.cs b/QSB/EchoesOfTheEye/WineCellar/QSBWineCellarSwitch.cs new file mode 100644 index 00000000..b8809b8c --- /dev/null +++ b/QSB/EchoesOfTheEye/WineCellar/QSBWineCellarSwitch.cs @@ -0,0 +1,5 @@ +using QSB.WorldSync; + +namespace QSB.EchoesOfTheEye.WineCellar; + +internal class QSBWineCellarSwitch : WorldObject { } \ No newline at end of file diff --git a/QSB/EchoesOfTheEye/WineCellar/WineCellarManager.cs b/QSB/EchoesOfTheEye/WineCellar/WineCellarManager.cs new file mode 100644 index 00000000..84d7dc3d --- /dev/null +++ b/QSB/EchoesOfTheEye/WineCellar/WineCellarManager.cs @@ -0,0 +1,14 @@ +using Cysharp.Threading.Tasks; +using QSB.WorldSync; +using System.Threading; + +namespace QSB.EchoesOfTheEye.WineCellar; + +internal class WineCellarManager : WorldObjectManager +{ + public override WorldObjectScene WorldObjectScene => WorldObjectScene.SolarSystem; + public override bool DlcOnly => true; + + public async override UniTask BuildWorldObjects(OWScene scene, CancellationToken ct) + => QSBWorldSync.Init(); +}