mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Vessel fixes
This commit is contained in:
parent
4085eb8eff
commit
9aa436c60f
@ -191,7 +191,7 @@ namespace NewHorizons.External.Configs
|
||||
public string promptFact;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the vessel should spawn in this system even if it wasn't used to warp to it.
|
||||
/// Whether the vessel should spawn in this system even if it wasn't used to warp to it. This will automatically power on the vessel.
|
||||
/// </summary>
|
||||
public bool alwaysPresent;
|
||||
|
||||
@ -205,6 +205,11 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
[DefaultValue(true)] public bool hasPhysics = true;
|
||||
|
||||
/// <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.
|
||||
/// </summary>
|
||||
public bool hasZeroGravityVolume;
|
||||
|
||||
/// <summary>
|
||||
/// The location that the vessel will warp to.
|
||||
/// </summary>
|
||||
|
||||
@ -27,19 +27,25 @@ namespace NewHorizons.Handlers
|
||||
VesselPrefab = Main.NHPrivateAssetBundle.LoadAsset<GameObject>("Vessel_Body");
|
||||
}
|
||||
|
||||
public static bool IsVesselPresent()
|
||||
public static bool IsVesselPresentAndActive()
|
||||
{
|
||||
var vesselConfig = SystemDict[Instance.CurrentStarSystem].Config?.Vessel;
|
||||
var isDefaultSolarSystem = Instance.CurrentStarSystem == "SolarSystem";
|
||||
var vesselIsPresent = vesselConfig?.alwaysPresent ?? isDefaultSolarSystem;
|
||||
var vesselIsPresent = vesselConfig?.alwaysPresent ?? false;
|
||||
return Instance.IsWarpingFromVessel || vesselIsPresent;
|
||||
}
|
||||
|
||||
public static bool IsVesselPresent()
|
||||
{
|
||||
var isDefaultSolarSystem = Instance.CurrentStarSystem == "SolarSystem";
|
||||
var isEyeOfTheUniverse = Instance.CurrentStarSystem == "EyeOfTheUniverse";
|
||||
return IsVesselPresentAndActive() || isDefaultSolarSystem || isEyeOfTheUniverse;
|
||||
}
|
||||
|
||||
public static bool ShouldSpawnAtVessel()
|
||||
{
|
||||
var vesselConfig = SystemDict[Instance.CurrentStarSystem].Config?.Vessel;
|
||||
var shouldSpawnOnVessel = IsVesselPresent() && (vesselConfig?.spawnOnVessel ?? false);
|
||||
return Instance.IsWarpingFromVessel || (IsVesselPresent() && shouldSpawnOnVessel);
|
||||
return Instance.IsWarpingFromVessel || shouldSpawnOnVessel;
|
||||
}
|
||||
|
||||
public static void LoadVessel()
|
||||
@ -51,7 +57,7 @@ namespace NewHorizons.Handlers
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsVesselPresent())
|
||||
if (IsVesselPresentAndActive())
|
||||
_vesselSpawnPoint = Instance.CurrentStarSystem == "SolarSystem" ? UpdateVessel() : CreateVessel();
|
||||
else
|
||||
_vesselSpawnPoint = SearchUtilities.Find("DB_VesselDimension_Body/Sector_VesselDimension").GetComponentInChildren<SpawnPoint>();
|
||||
@ -182,9 +188,23 @@ namespace NewHorizons.Handlers
|
||||
UnityEngine.Object.DestroyImmediate(vesselObject.GetComponent<CenterOfTheUniverseOffsetApplier>());
|
||||
UnityEngine.Object.DestroyImmediate(vesselObject.GetComponent<OWRigidbody>());
|
||||
UnityEngine.Object.DestroyImmediate(vesselObject.GetComponent<Rigidbody>());
|
||||
var rfVolume = vesselObject.transform.Find("RFVolume");
|
||||
if (rfVolume != null)
|
||||
{
|
||||
GameObject.Destroy(rfVolume.gameObject);
|
||||
}
|
||||
}
|
||||
vesselWarpController._targetWarpPlatform._owRigidbody = warpExit.GetAttachedOWRigidbody();
|
||||
|
||||
if (system.Config.Vessel?.hasZeroGravityVolume ?? false)
|
||||
{
|
||||
var zeroGVolume = vesselObject.transform.Find("Sector_VesselBridge/Volumes_VesselBridge/ZeroGVolume");
|
||||
if (zeroGVolume != null)
|
||||
{
|
||||
GameObject.Destroy(zeroGVolume.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
vesselObject.SetActive(true);
|
||||
|
||||
Delay.FireOnNextUpdate(() => SetupWarpController(vesselWarpController));
|
||||
@ -274,6 +294,10 @@ namespace NewHorizons.Handlers
|
||||
vesselWarpController._cageAnimator.OnTranslationComplete -= new TransformAnimator.AnimationEvent(vesselWarpController.OnCageAnimationComplete);
|
||||
vesselWarpController._cageAnimator.OnTranslationComplete += new TransformAnimator.AnimationEvent(vesselWarpController.OnCageAnimationComplete);
|
||||
}
|
||||
|
||||
// Normally the power-on sound is 2D/global, we set it to 3D/local so it isn't audible if the player isn't nearby
|
||||
vesselWarpController._audioSource.spatialBlend = 1f;
|
||||
vesselWarpController._audioSource.rolloffMode = AudioRolloffMode.Linear;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,8 +146,7 @@ namespace NewHorizons
|
||||
x = new int[5]{ 0,3,2,1,5 },
|
||||
y = new int[5]{ 4,5,3,2,1 },
|
||||
z = new int[5]{ 4,1,2,5,0 }
|
||||
},
|
||||
alwaysPresent = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user