mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-07 12:40:02 +00:00
remove sync object stuff
This commit is contained in:
parent
6ecbfd7c63
commit
4780b1a1b1
@ -41,9 +41,8 @@ namespace QSB.Animation.Player
|
||||
QSBSceneManager.OnUniverseSceneLoaded += OnUniverseSceneLoaded;
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
protected void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
Destroy(InvisibleAnimator);
|
||||
Destroy(NetworkAnimator);
|
||||
QSBSceneManager.OnUniverseSceneLoaded -= OnUniverseSceneLoaded;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -36,9 +36,8 @@ namespace QSB.Instruments
|
||||
QSBCore.UnityEvents.RunWhen(() => Locator.GetPlayerBody() != null, SetupInstruments);
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
protected void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
if (!IsLocalPlayer)
|
||||
{
|
||||
return;
|
||||
|
@ -211,8 +211,7 @@ namespace QSB.Player
|
||||
Translator?.ChangeEquipState(TranslatorEquipped);
|
||||
ProbeLauncher?.ChangeEquipState(ProbeLauncherEquipped);
|
||||
Signalscope?.ChangeEquipState(SignalscopeEquipped);
|
||||
QSBCore.UnityEvents.RunWhen(() => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId) != null,
|
||||
() => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId).SetSuitState(SuitedUp));
|
||||
AnimationSync.SetSuitState(SuitedUp);
|
||||
}
|
||||
|
||||
public void UpdateStatesFromObjects()
|
||||
|
@ -6,8 +6,5 @@ namespace QSB.Player
|
||||
{
|
||||
public uint PlayerId => NetId.Value;
|
||||
public PlayerInfo Player => QSBPlayerManager.GetPlayer(PlayerId);
|
||||
|
||||
protected virtual void Start() => QSBPlayerManager.AddSyncObject(this);
|
||||
protected virtual void OnDestroy() => QSBPlayerManager.RemoveSyncObject(this);
|
||||
}
|
||||
}
|
@ -34,8 +34,6 @@ namespace QSB.Player
|
||||
public static PlayerInfo LocalPlayer => GetPlayer(LocalPlayerId);
|
||||
public static readonly List<PlayerInfo> PlayerList = new();
|
||||
|
||||
private static readonly List<PlayerSyncObject> PlayerSyncObjects = new();
|
||||
|
||||
public static PlayerInfo GetPlayer(uint id)
|
||||
{
|
||||
if (id is uint.MaxValue or 0)
|
||||
@ -56,16 +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 IEnumerable<T> GetSyncObjects<T>() where T : PlayerSyncObject =>
|
||||
PlayerSyncObjects.OfType<T>().Where(x => x != null);
|
||||
|
||||
public static T GetSyncObject<T>(uint id) where T : PlayerSyncObject =>
|
||||
GetSyncObjects<T>().FirstOrDefault(x => x != null && x.PlayerId == id);
|
||||
|
||||
public static void AddSyncObject(PlayerSyncObject obj) => PlayerSyncObjects.Add(obj);
|
||||
|
||||
public static void RemoveSyncObject(PlayerSyncObject obj) => PlayerSyncObjects.Remove(obj);
|
||||
|
||||
public static List<PlayerInfo> GetPlayersWithCameras(bool includeLocalCamera = true)
|
||||
{
|
||||
var cameraList = PlayerList.Where(x => x.Camera != null && x.PlayerId != LocalPlayerId).ToList();
|
||||
|
Loading…
x
Reference in New Issue
Block a user