Defaults for hasPhysics and hasZeroGravityVolume

This commit is contained in:
Joshua Thome 2023-03-21 22:12:39 -05:00
parent 9aa436c60f
commit 420c91c670
3 changed files with 10 additions and 7 deletions

View File

@ -201,14 +201,14 @@ namespace NewHorizons.External.Configs
public bool spawnOnVessel;
/// <summary>
/// Whether the vessel should have physics enabled. This must be set to false for the vessel to stay attached to a parent body.
/// Whether the vessel should have physics enabled. Defaults to false if parentBody is set, and true otherwise.
/// </summary>
[DefaultValue(true)] public bool hasPhysics = true;
public bool? hasPhysics;
/// <summary>
/// Whether the vessel should have a zero-gravity volume around it that ignores any other sources of gravity, like the vessel works in Dark Bramble.
/// Whether the vessel should have a zero-gravity volume around it. Defaults to false if parentBody is set, and true otherwise.
/// </summary>
public bool hasZeroGravityVolume;
public bool? hasZeroGravityVolume;
/// <summary>
/// The location that the vessel will warp to.

View File

@ -177,7 +177,10 @@ namespace NewHorizons.Handlers
EyeSpawnPoint eyeSpawnPoint = vesselObject.GetComponentInChildren<EyeSpawnPoint>(true);
system.SpawnPoint = eyeSpawnPoint;
if (system.Config.Vessel?.hasPhysics ?? true)
var hasParentBody = !string.IsNullOrEmpty(system.Config.Vessel?.vesselSpawn?.parentBody);
var hasPhysics = system.Config.Vessel?.hasPhysics ?? !hasParentBody;
if (hasPhysics)
{
vesselObject.transform.parent = null;
}
@ -196,7 +199,8 @@ namespace NewHorizons.Handlers
}
vesselWarpController._targetWarpPlatform._owRigidbody = warpExit.GetAttachedOWRigidbody();
if (system.Config.Vessel?.hasZeroGravityVolume ?? false)
var hasZeroGravityVolume = system.Config.Vessel?.hasZeroGravityVolume ?? !hasParentBody;
if (!hasZeroGravityVolume)
{
var zeroGVolume = vesselObject.transform.Find("Sector_VesselBridge/Volumes_VesselBridge/ZeroGVolume");
if (zeroGVolume != null)

View File

@ -366,7 +366,6 @@ namespace NewHorizons
// If the vessel is forcing the player to spawn there, allow it to override
IsWarpingFromVessel = VesselWarpHandler.ShouldSpawnAtVessel();
Logger.LogWarning("Spawning from vessel: " + IsWarpingFromVessel);
// Some builders have to be reset each loop
SignalBuilder.Init();