mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2024-12-29 12:21:25 +00:00
probe body doesn't exist on statue scene reload
This commit is contained in:
parent
03cc8a84a0
commit
a10c850a67
@ -14,16 +14,6 @@ namespace QSB.TornadoSync
|
||||
{
|
||||
QSBWorldSync.Init<QSBTornado, TornadoController>();
|
||||
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
foreach (var transformSync in QSBWorldSync.GetUnityObjects<OccasionalTransformSync>())
|
||||
{
|
||||
NetworkServer.Destroy(transformSync.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
OccasionalTransformSync.Bodies.Clear();
|
||||
|
||||
var gdBody = Locator._giantsDeep.GetOWRigidbody();
|
||||
// cannon
|
||||
var cannon = Locator._orbitalProbeCannon.GetRequiredComponent<OrbitalProbeLaunchController>();
|
||||
@ -33,7 +23,10 @@ namespace QSB.TornadoSync
|
||||
SpawnOccasional(proxy.transform.root.GetAttachedOWRigidbody(), gdBody);
|
||||
}
|
||||
|
||||
SpawnOccasional(cannon._probeBody, gdBody);
|
||||
if (cannon._probeBody)
|
||||
{
|
||||
SpawnOccasional(cannon._probeBody, gdBody);
|
||||
}
|
||||
|
||||
// islands
|
||||
foreach (var island in QSBWorldSync.GetUnityObjects<IslandController>().SortDeterministic())
|
||||
@ -42,6 +35,19 @@ namespace QSB.TornadoSync
|
||||
}
|
||||
}
|
||||
|
||||
public override void UnbuildWorldObjects()
|
||||
{
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
foreach (var transformSync in QSBWorldSync.GetUnityObjects<OccasionalTransformSync>())
|
||||
{
|
||||
NetworkServer.Destroy(transformSync.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
OccasionalTransformSync.Bodies.Clear();
|
||||
}
|
||||
|
||||
private static void SpawnOccasional(OWRigidbody body, OWRigidbody refBody)
|
||||
{
|
||||
OccasionalTransformSync.Bodies.Add((body, refBody));
|
||||
|
Loading…
Reference in New Issue
Block a user