add to volume simpler

This commit is contained in:
Nick 2024-03-25 17:58:14 -04:00
parent 962e04994b
commit 14d75ff216

View File

@ -116,20 +116,14 @@ namespace NewHorizons.Handlers
// For some reason none of this seems to apply to the Player.
// If somebody ever makes a sound volume thats somehow always applying to the player tho then itd probably be this
// Sometimes the ship isn't added to the volumes it's meant to now be in
// We'll just toggle all volumes on the planet on and off
var shipDetector = Locator.GetShipDetector().GetComponent<AlignmentForceDetector>();
var shipDetector2 = Locator.GetShipDetector().GetComponent<ShipFluidDetector>();
foreach (var volume in SpawnPointBuilder.ShipSpawn.GetAttachedOWRigidbody().GetComponentsInChildren<EffectVolume>())
{
if (volume.GetOWTriggerVolume().GetPenetrationDistance(ship.transform.position) > 0)
{
// Add ship to volume
// If it's already tracking it it will complain here but thats fine
shipDetector.AddVolume(volume);
shipDetector2.AddVolume(volume);
volume.GetOWTriggerVolume().AddObjectToVolume(shipDetector.gameObject);
volume.GetOWTriggerVolume().AddObjectToVolume(Locator.GetShipDetector());
}
}
}