diff --git a/QSB/Events/EventNames.cs b/QSB/Events/EventNames.cs
index 2b6f3a95..92d23232 100644
--- a/QSB/Events/EventNames.cs
+++ b/QSB/Events/EventNames.cs
@@ -63,5 +63,6 @@
public static string QSBExitPlatform = "QSBExitPlatform";
public static string QSBCampfireState = "QSBCampfireState";
public static string QSBMarshmallowEvent = "QSBMarshmallowEvent";
+ public static string QSBOpenHatch = "QSBOpenHatch";
}
}
\ No newline at end of file
diff --git a/QSB/Events/EventType.cs b/QSB/Events/EventType.cs
index bb188caa..f48eb68a 100644
--- a/QSB/Events/EventType.cs
+++ b/QSB/Events/EventType.cs
@@ -43,6 +43,7 @@
CampfireState,
Roasting,
MarshmallowEvent,
- FlyShip
+ FlyShip,
+ OpenHatch
}
}
\ No newline at end of file
diff --git a/QSB/Events/QSBEventManager.cs b/QSB/Events/QSBEventManager.cs
index 62680171..0d7b609a 100644
--- a/QSB/Events/QSBEventManager.cs
+++ b/QSB/Events/QSBEventManager.cs
@@ -78,7 +78,8 @@ namespace QSB.Events
new IdentifyFrequencyEvent(),
new IdentifySignalEvent(),
// Ship
- new FlyShipEvent()
+ new FlyShipEvent(),
+ new OpenHatchEvent()
};
if (UnitTestDetector.IsInUnitTest)
diff --git a/QSB/Patches/QSBPatchManager.cs b/QSB/Patches/QSBPatchManager.cs
index 9fb4c77b..2f1e3739 100644
--- a/QSB/Patches/QSBPatchManager.cs
+++ b/QSB/Patches/QSBPatchManager.cs
@@ -11,6 +11,7 @@ using QSB.OrbSync.Patches;
using QSB.PoolSync.Patches;
using QSB.QuantumSync.Patches;
using QSB.RoastingSync.Patches;
+using QSB.ShipSync.Patches;
using QSB.StatueSync.Patches;
using QSB.TimeSync.Patches;
using QSB.TranslationSync.Patches;
@@ -49,7 +50,8 @@ namespace QSB.Patches
new GeyserPatches(),
new PoolPatches(),
new CampfirePatches(),
- new RoastingPatches()
+ new RoastingPatches(),
+ new ShipPatches()
};
DebugLog.DebugWrite("Patch Manager ready.", MessageType.Success);
diff --git a/QSB/QSB.csproj b/QSB/QSB.csproj
index 1cb9a974..0bff310c 100644
--- a/QSB/QSB.csproj
+++ b/QSB/QSB.csproj
@@ -225,7 +225,8 @@
-
+
+
diff --git a/QSB/ShipSync/Events/FlyShipEvent.cs b/QSB/ShipSync/Events/FlyShipEvent.cs
index 7e2c7815..ce9209e7 100644
--- a/QSB/ShipSync/Events/FlyShipEvent.cs
+++ b/QSB/ShipSync/Events/FlyShipEvent.cs
@@ -39,7 +39,7 @@ namespace QSB.ShipSync.Events
{
SetCurrentFlyer(message.Value, message.AboutId);
var shipCockpitController = GameObject.Find("ShipCockpitController").GetComponent();
- var interactVolume = shipCockpitController.GetValue("_interactVolumes");
+ var interactVolume = shipCockpitController.GetValue("_interactVolume");
if (message.Value)
{
interactVolume.DisableInteraction();
diff --git a/QSB/ShipSync/Events/HatchEvent.cs b/QSB/ShipSync/Events/HatchEvent.cs
deleted file mode 100644
index e4025358..00000000
--- a/QSB/ShipSync/Events/HatchEvent.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace QSB.ShipSync.Events
-{
- class HatchEvent
- {
- }
-}
diff --git a/QSB/ShipSync/Events/OpenHatchEvent.cs b/QSB/ShipSync/Events/OpenHatchEvent.cs
new file mode 100644
index 00000000..ed0ff98c
--- /dev/null
+++ b/QSB/ShipSync/Events/OpenHatchEvent.cs
@@ -0,0 +1,31 @@
+using OWML.Utils;
+using QSB.Events;
+using QSB.Messaging;
+
+namespace QSB.ShipSync.Events
+{
+ class OpenHatchEvent : QSBEvent
+ {
+ public override EventType Type => EventType.OpenHatch;
+
+ public override void SetupListener()
+ => GlobalMessenger.AddListener(EventNames.QSBOpenHatch, Handler);
+
+ public override void CloseListener()
+ => GlobalMessenger.RemoveListener(EventNames.QSBOpenHatch, Handler);
+
+ private void Handler() => SendEvent(CreateMessage());
+
+ private PlayerMessage CreateMessage() => new PlayerMessage
+ {
+ AboutId = LocalPlayerId
+ };
+
+ public override void OnReceiveRemote(bool server, PlayerMessage message)
+ {
+ var shipTransform = Locator.GetShipTransform();
+ var hatchController = shipTransform.GetComponentInChildren();
+ hatchController.Invoke("OpenHatch");
+ }
+ }
+}
\ No newline at end of file
diff --git a/QSB/ShipSync/Patches/ShipPatches.cs b/QSB/ShipSync/Patches/ShipPatches.cs
new file mode 100644
index 00000000..648f1731
--- /dev/null
+++ b/QSB/ShipSync/Patches/ShipPatches.cs
@@ -0,0 +1,22 @@
+using QSB.Events;
+using QSB.Patches;
+
+namespace QSB.ShipSync.Patches
+{
+ class ShipPatches : QSBPatch
+ {
+ public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
+
+ public override void DoPatches()
+ => QSBCore.HarmonyHelper.AddPrefix("OnPressInteract", typeof(ShipPatches), nameof(HatchController_OnPressInteract));
+
+ public override void DoUnpatches()
+ => QSBCore.HarmonyHelper.Unpatch("OnPressInteract");
+
+ public static bool HatchController_OnPressInteract()
+ {
+ QSBEventManager.FireEvent(EventNames.QSBOpenHatch);
+ return true;
+ }
+ }
+}