mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Allow rafts to be added to Giant's Deep
This commit is contained in:
parent
ed5052c169
commit
fd2f839d90
@ -43,8 +43,9 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
// Detectors
|
||||
var fluidDetector = raftObject.transform.Find("Detector_Raft").GetComponent<RaftFluidDetector>();
|
||||
var waterVolume = planetGO.GetComponentInChildren<NHFluidVolume>();
|
||||
var waterVolume = (FluidVolume)planetGO.GetComponentInChildren<NHFluidVolume>() ?? planetGO.GetComponentInChildren<SphereOceanFluidVolume>();
|
||||
fluidDetector._alignmentFluid = waterVolume;
|
||||
fluidDetector._buoyancy.checkAgainstWaves = true;
|
||||
|
||||
// Light sensors
|
||||
foreach (var lightSensor in raftObject.GetComponentsInChildren<SingleLightSensor>())
|
||||
|
||||
@ -84,7 +84,7 @@ namespace NewHorizons.Patches
|
||||
[HarmonyPatch(typeof(AlignToSurfaceFluidDetector), "ManagedFixedUpdate")]
|
||||
public static bool AlignToSurfaceFluidDetector_ManagedFixedUpdate(AlignToSurfaceFluidDetector __instance)
|
||||
{
|
||||
if (!(__instance._alignmentFluid is NHFluidVolume)) return true;
|
||||
if (!(__instance._alignmentFluid is NHFluidVolume || __instance._alignmentFluid is SphereOceanFluidVolume)) return true;
|
||||
|
||||
// Mostly copy pasting from the AlignWithDirection class
|
||||
AsymmetricFluidDetector_ManagedFixedUpdate(__instance);
|
||||
@ -104,5 +104,14 @@ namespace NewHorizons.Patches
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(FluidVolume), "GetDepthAtPosition")]
|
||||
public static bool SphereOceanFluidVolume_GetDepthAtPosition(SphereOceanFluidVolume __instance, ref float __result, Vector3 worldPosition)
|
||||
{
|
||||
Vector3 vector = __instance.transform.InverseTransformPoint(worldPosition);
|
||||
__result = Mathf.Sqrt(vector.x * vector.x + vector.z * vector.z + vector.y * vector.y) - __instance._radius;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user