mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
635e942524
@ -165,7 +165,7 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
var ao = existingPlanet.GetComponent<AstroObject>();
|
||||
if (ao != null) Delay.FireInNUpdates(() => PlanetDestructionHandler.RemoveBody(ao), 2);
|
||||
else Delay.FireInNUpdates(() => existingPlanet.SetActive(false), 2);
|
||||
else Delay.FireInNUpdates(() => PlanetDestructionHandler.DisableBody(existingPlanet, false), 2);
|
||||
}
|
||||
else if (body.Config.isQuantumState)
|
||||
{
|
||||
|
||||
@ -43,14 +43,6 @@ namespace NewHorizons.Handlers
|
||||
var sunVolumes = SearchUtilities.Find("Sun_Body/Sector_SUN/Volumes_SUN");
|
||||
sunVolumes.SetActive(false);
|
||||
|
||||
foreach (var ow in CenterOfTheUniverse.s_rigidbodies)
|
||||
{
|
||||
if (ow._origParent != null && (ow._origParentBody != null || ow._simulateInSector != null) && ow.transform.GetComponent<AstroObject>() == null && !ow._suspended && !_suspendBlacklist.Contains(ow.gameObject.name))
|
||||
{
|
||||
ow.Suspend();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var name in _solarSystemBodies)
|
||||
{
|
||||
var ao = AstroObjectLocator.GetAstroObject(name);
|
||||
@ -219,12 +211,44 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
}
|
||||
|
||||
private static void DisableBody(GameObject go, bool delete)
|
||||
private static bool CanSuspend(OWRigidbody rigidbody, string name)
|
||||
{
|
||||
if (rigidbody.transform.name == name) return true;
|
||||
if (rigidbody._origParentBody == null) return false;
|
||||
return CanSuspend(rigidbody._origParentBody, name);
|
||||
}
|
||||
|
||||
internal static void DisableBody(GameObject go, bool delete)
|
||||
{
|
||||
if (go == null) return;
|
||||
|
||||
Logger.LogVerbose($"Removing [{go.name}]");
|
||||
|
||||
OWRigidbody rigidbody = go.GetComponent<OWRigidbody>();
|
||||
if (rigidbody != null)
|
||||
{
|
||||
string name = rigidbody.transform.name;
|
||||
foreach (var ow in CenterOfTheUniverse.s_rigidbodies)
|
||||
{
|
||||
if (_suspendBlacklist.Contains(ow.transform.name)) continue;
|
||||
if (ow.GetComponent<AstroObject>() != null) continue;
|
||||
if (ow._origParentBody != null)
|
||||
{
|
||||
if (CanSuspend(ow, name))
|
||||
{
|
||||
ow.Suspend();
|
||||
}
|
||||
}
|
||||
else if (ow._simulateInSector != null)
|
||||
{
|
||||
if (CanSuspend(ow._simulateInSector.GetAttachedOWRigidbody(), name))
|
||||
{
|
||||
ow.Suspend();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (delete)
|
||||
{
|
||||
GameObject.Destroy(go);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user