remove GetSyncObject

This commit is contained in:
JohnCorby 2021-12-27 16:44:50 -08:00
parent 74da562d70
commit 62f7b4e1f1
5 changed files with 7 additions and 15 deletions

View File

@ -34,7 +34,7 @@ namespace QSB.Animation.Player.Messages
public override void OnReceiveRemote()
{
var animationSync = QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId);
var animationSync = QSBPlayerManager.GetPlayer(PlayerId).AnimationSync;
if (animationSync == null)
{
return;

View File

@ -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<InstrumentsManager>(PlayerId).CheckInstrumentProps(Value);
player.InstrumentsManager.CheckInstrumentProps(Value);
}
}
}

View File

@ -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;
}
}

View File

@ -219,9 +219,7 @@ namespace QSB.Player
Translator?.ChangeEquipState(TranslatorEquipped);
ProbeLauncher?.ChangeEquipState(ProbeLauncherEquipped);
Signalscope?.ChangeEquipState(SignalscopeEquipped);
QSBCore.UnityEvents.RunWhen(() => AnimationSync != null,
() => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId).SetSuitState(SuitedUp));
AnimationSync.SetSuitState(SuitedUp);
}
public void UpdateStatesFromObjects()

View File

@ -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<T>(uint id) where T : PlayerSyncObject =>
GetPlayer(id).TransformSync.GetComponent<T>();
public static List<PlayerInfo> GetPlayersWithCameras(bool includeLocalCamera = true)
{
var cameraList = PlayerList.Where(x => x.Camera != null && x.PlayerId != LocalPlayerId).ToList();