mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-26 18:35:34 +00:00
RaftDock.OnPressInteract sync
This commit is contained in:
parent
712398fb38
commit
75ff37dafc
@ -0,0 +1,10 @@
|
|||||||
|
using QSB.EchoesOfTheEye.RaftSync.WorldObjects;
|
||||||
|
using QSB.Messaging;
|
||||||
|
|
||||||
|
namespace QSB.EchoesOfTheEye.RaftSync.Messages
|
||||||
|
{
|
||||||
|
public class RaftDockOnPressInteractMessage : QSBWorldObjectMessage<QSBRaftDock>
|
||||||
|
{
|
||||||
|
public override void OnReceiveRemote() => WorldObject.OnPressInteract();
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +0,0 @@
|
|||||||
using QSB.EchoesOfTheEye.RaftSync.WorldObjects;
|
|
||||||
using QSB.Messaging;
|
|
||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.RaftSync.Messages
|
|
||||||
{
|
|
||||||
public class RaftUndockMessage : QSBWorldObjectMessage<QSBRaftDock>
|
|
||||||
{
|
|
||||||
public override void OnReceiveRemote() => WorldObject.UndockFromRaftDock();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,8 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using QSB.AuthoritySync;
|
using QSB.AuthoritySync;
|
||||||
|
using QSB.EchoesOfTheEye.RaftSync.Messages;
|
||||||
using QSB.EchoesOfTheEye.RaftSync.WorldObjects;
|
using QSB.EchoesOfTheEye.RaftSync.WorldObjects;
|
||||||
|
using QSB.Messaging;
|
||||||
using QSB.Patches;
|
using QSB.Patches;
|
||||||
using QSB.Utility;
|
using QSB.Utility;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
@ -30,5 +32,33 @@ namespace QSB.EchoesOfTheEye.RaftSync.Patches
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(RaftDock), nameof(RaftDock.OnPressInteract))]
|
||||||
|
private static bool OnPressInteract(RaftDock __instance)
|
||||||
|
{
|
||||||
|
if (__instance._raft != null && __instance._state == RaftCarrier.DockState.Docked)
|
||||||
|
{
|
||||||
|
__instance._raftUndockCountDown = __instance._raft.dropDelay;
|
||||||
|
__instance._state = RaftCarrier.DockState.WaitForExit;
|
||||||
|
__instance._raft.SetRailingRaised(true);
|
||||||
|
if (__instance._gearInterface != null)
|
||||||
|
{
|
||||||
|
__instance._gearInterface.AddRotation(90f);
|
||||||
|
}
|
||||||
|
|
||||||
|
__instance.enabled = true;
|
||||||
|
|
||||||
|
__instance.GetWorldObject<QSBRaftDock>().SendMessage(new RaftDockOnPressInteractMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__instance._gearInterface != null)
|
||||||
|
{
|
||||||
|
__instance._gearInterface.PlayFailure();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace QSB.EchoesOfTheEye.RaftSync.WorldObjects
|
|||||||
// todo SendInitialState
|
// todo SendInitialState
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UndockFromRaftDock()
|
public void OnPressInteract()
|
||||||
{
|
{
|
||||||
if (AttachedObject._raft != null && AttachedObject._state == RaftCarrier.DockState.Docked)
|
if (AttachedObject._raft != null && AttachedObject._state == RaftCarrier.DockState.Docked)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user