From 2493e8f97d706563a4540d228cfc55f4a0827845 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 1 Dec 2021 01:46:43 -0800 Subject: [PATCH] go back to using list. rip --- .../TransformSync/JellyfishTransformSync.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/QSB/JellyfishSync/TransformSync/JellyfishTransformSync.cs b/QSB/JellyfishSync/TransformSync/JellyfishTransformSync.cs index c5b146f3..9cb851d6 100644 --- a/QSB/JellyfishSync/TransformSync/JellyfishTransformSync.cs +++ b/QSB/JellyfishSync/TransformSync/JellyfishTransformSync.cs @@ -1,4 +1,5 @@ -using QSB.JellyfishSync.WorldObjects; +using System.Collections.Generic; +using QSB.JellyfishSync.WorldObjects; using QSB.Syncs.Unsectored.Rigidbodies; using QSB.WorldSync; using QuantumUNET.Transport; @@ -12,21 +13,20 @@ namespace QSB.JellyfishSync.TransformSync public override bool UseInterpolation => false; private QSBJellyfish _qsbJellyfish; - private static int _nextId; - private int _id; + private static readonly List _instances = new(); protected override OWRigidbody GetRigidbody() => _qsbJellyfish.AttachedObject._jellyfishBody; public override void Start() { - _id = _nextId++; + _instances.Add(this); base.Start(); } protected override void OnDestroy() { - _nextId--; + _instances.Remove(this); base.OnDestroy(); } @@ -34,7 +34,7 @@ namespace QSB.JellyfishSync.TransformSync protected override void Init() { - _qsbJellyfish = QSBWorldSync.GetWorldFromId(_id); + _qsbJellyfish = QSBWorldSync.GetWorldFromId(_instances.IndexOf(this)); _qsbJellyfish.TransformSync = this; base.Init();