diff --git a/QSB/Animation/Player/Messages/AnimationTriggerMessage.cs b/QSB/Animation/Player/Messages/AnimationTriggerMessage.cs index ee4e62d6..a42709e9 100644 --- a/QSB/Animation/Player/Messages/AnimationTriggerMessage.cs +++ b/QSB/Animation/Player/Messages/AnimationTriggerMessage.cs @@ -34,7 +34,7 @@ namespace QSB.Animation.Player.Messages public override void OnReceiveRemote() { - var animationSync = QSBPlayerManager.GetSyncObject(PlayerId); + var animationSync = QSBPlayerManager.GetPlayer(PlayerId).AnimationSync; if (animationSync == null) { return; diff --git a/QSB/Animation/Player/Messages/ChangeAnimTypeMessage.cs b/QSB/Animation/Player/Messages/ChangeAnimTypeMessage.cs index 89d32f1e..38f18ba6 100644 --- a/QSB/Animation/Player/Messages/ChangeAnimTypeMessage.cs +++ b/QSB/Animation/Player/Messages/ChangeAnimTypeMessage.cs @@ -1,5 +1,4 @@ -using QSB.Instruments; -using QSB.Messaging; +using QSB.Messaging; using QSB.Player; using QSB.WorldSync; using QuantumUNET.Transport; @@ -39,7 +38,7 @@ namespace QSB.Animation.Player.Messages } player.AnimationSync.SetAnimationType(Value); - QSBPlayerManager.GetSyncObject(PlayerId).CheckInstrumentProps(Value); + player.InstrumentsManager.CheckInstrumentProps(Value); } } } \ No newline at end of file diff --git a/QSB/Animation/Player/Patches/PlayerAnimationPatches.cs b/QSB/Animation/Player/Patches/PlayerAnimationPatches.cs index 482ab057..84795864 100644 --- a/QSB/Animation/Player/Patches/PlayerAnimationPatches.cs +++ b/QSB/Animation/Player/Patches/PlayerAnimationPatches.cs @@ -62,16 +62,15 @@ namespace QSB.Animation.Player.Patches __instance._animator.SetBool("UsingJetpack", isInZeroG && PlayerState.IsWearingSuit()); if (__instance._justBecameGrounded) { - var playerAnimationSync = QSBPlayerManager.LocalPlayer.AnimationSync; if (__instance._justTookFallDamage) { __instance._animator.SetTrigger("LandHard"); - new AnimationTriggerMessage(playerAnimationSync.PlayerId, "LandHard").Send(); + new AnimationTriggerMessage(QSBPlayerManager.LocalPlayerId, "LandHard").Send(); } else { __instance._animator.SetTrigger("Land"); - new AnimationTriggerMessage(playerAnimationSync.PlayerId, "Land").Send(); + new AnimationTriggerMessage(QSBPlayerManager.LocalPlayerId, "Land").Send(); } } @@ -128,8 +127,7 @@ namespace QSB.Animation.Player.Patches } __instance._animator.SetTrigger("Jump"); - var playerAnimationSync = QSBPlayerManager.LocalPlayer.AnimationSync; - new AnimationTriggerMessage(playerAnimationSync.PlayerId, "Jump").Send(); + new AnimationTriggerMessage(QSBPlayerManager.LocalPlayerId, "Jump").Send(); return false; } } diff --git a/QSB/Player/PlayerInfo.cs b/QSB/Player/PlayerInfo.cs index ebae3fd7..149f72bd 100644 --- a/QSB/Player/PlayerInfo.cs +++ b/QSB/Player/PlayerInfo.cs @@ -219,9 +219,7 @@ namespace QSB.Player Translator?.ChangeEquipState(TranslatorEquipped); ProbeLauncher?.ChangeEquipState(ProbeLauncherEquipped); Signalscope?.ChangeEquipState(SignalscopeEquipped); - - QSBCore.UnityEvents.RunWhen(() => AnimationSync != null, - () => QSBPlayerManager.GetSyncObject(PlayerId).SetSuitState(SuitedUp)); + AnimationSync.SetSuitState(SuitedUp); } public void UpdateStatesFromObjects() diff --git a/QSB/Player/QSBPlayerManager.cs b/QSB/Player/QSBPlayerManager.cs index aa241c70..f937eee0 100644 --- a/QSB/Player/QSBPlayerManager.cs +++ b/QSB/Player/QSBPlayerManager.cs @@ -54,9 +54,6 @@ namespace QSB.Player public static bool PlayerExists(uint id) => id is not (uint.MaxValue or 0) && PlayerList.Any(x => x.PlayerId == id); - public static T GetSyncObject(uint id) where T : PlayerSyncObject => - GetPlayer(id).TransformSync.GetComponent(); - public static List GetPlayersWithCameras(bool includeLocalCamera = true) { var cameraList = PlayerList.Where(x => x.Camera != null && x.PlayerId != LocalPlayerId).ToList();