using QSB.TornadoSync.TransformSync; using QSB.TornadoSync.WorldObjects; using QSB.Utility; using QSB.WorldSync; using QuantumUNET; namespace QSB.TornadoSync { public class TornadoManager : WorldObjectManager { protected override void RebuildWorldObjects(OWScene scene) { QSBWorldSync.Init(); if (!QSBCore.IsHost) { return; } foreach (var transformSync in QSBWorldSync.GetUnityObjects()) { QNetworkServer.Destroy(transformSync.gameObject); } var gdBody = Locator._giantsDeep.GetOWRigidbody(); // cannon var cannon = Locator._orbitalProbeCannon.GetRequiredComponent(); SpawnOccasional(cannon.GetAttachedOWRigidbody(), gdBody); foreach (var proxy in cannon._realDebrisSectorProxies) { SpawnOccasional(proxy.transform.root.GetAttachedOWRigidbody(), gdBody); } SpawnOccasional(cannon._probeBody, gdBody); // islands foreach (var island in QSBWorldSync.GetUnityObjects()) { SpawnOccasional(island._islandBody, gdBody); } } private static void SpawnOccasional(OWRigidbody body, OWRigidbody refBody) { var transformSync = Instantiate(QSBNetworkManager.Instance.OccasionalPrefab).GetRequiredComponent(); transformSync.InitBodyIndexes(body, refBody); transformSync.gameObject.SpawnWithServerAuthority(); } } }