ShipCustomAttach: disable custom attach point if we attach to something else

This commit is contained in:
JohnCorby 2022-02-05 03:48:06 -08:00
parent f8f37aa011
commit cf151b2573
2 changed files with 8 additions and 0 deletions

View File

@ -15,9 +15,11 @@ namespace QSB.Player
public static PlayerAttachPoint Current { get; private set; }
[HarmonyPrefix]
[HarmonyPatch(nameof(PlayerAttachPoint.AttachPlayer))]
private static void AttachPlayer(PlayerAttachPoint __instance) => Current = __instance;
[HarmonyPrefix]
[HarmonyPatch(nameof(PlayerAttachPoint.DetachPlayer))]
private static void DetachPlayer() => Current = null;
}

View File

@ -42,6 +42,12 @@ namespace QSB.ShipSync
var attachedToUs = PlayerAttachWatcher.Current == _playerAttachPoint;
if (!attachedToUs)
{
if (_playerAttachPoint.enabled)
{
// attached to us, then attached to something else
_playerAttachPoint.enabled = false;
}
if (PlayerState.IsAttached())
{
return;