mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
ShipCustomAttach: disable custom attach point if we attach to something else
This commit is contained in:
parent
f8f37aa011
commit
cf151b2573
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user