mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix raft docks not working on NH rafts
This commit is contained in:
parent
ffe41747fb
commit
06870db051
@ -459,6 +459,15 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
component.gameObject.AddComponent<NHRaftController>();
|
||||
}
|
||||
else if (component is RaftDock dock)
|
||||
{
|
||||
// These flood toggles are to disable flooded docks on the Stranger
|
||||
// Presumably the user isn't making one of those
|
||||
foreach (var toggle in dock.GetComponents<FloodToggle>())
|
||||
{
|
||||
Component.DestroyImmediate(toggle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -66,6 +66,9 @@ namespace NewHorizons.Builder.Props
|
||||
var waterVolume = planetGO.GetComponentInChildren<RadialFluidVolume>();
|
||||
fluidDetector._alignmentFluid = waterVolume;
|
||||
fluidDetector._buoyancy.checkAgainstWaves = true;
|
||||
// Rafts were unable to trigger docks because these were disabled for some reason
|
||||
fluidDetector.GetComponent<BoxShape>().enabled = true;
|
||||
fluidDetector.GetComponent<OWCollider>().enabled = true;
|
||||
|
||||
// Light sensors
|
||||
foreach (var lightSensor in raftObject.GetComponentsInChildren<SingleLightSensor>())
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using HarmonyLib;
|
||||
using NewHorizons.Components.Props;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Patches.EchoesOfTheEyePatches
|
||||
@ -73,5 +74,31 @@ namespace NewHorizons.Patches.EchoesOfTheEyePatches
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(RaftController.UpdateMoveToTarget))]
|
||||
public static void UpdateMoveToTarget(RaftController __instance)
|
||||
{
|
||||
// If it has a riverFluid volume then its a regular stranger one
|
||||
if (__instance._movingToTarget && __instance._riverFluid == null)
|
||||
{
|
||||
OWRigidbody raftBody = __instance._raftBody;
|
||||
OWRigidbody origParentBody = __instance._raftBody.GetOrigParentBody();
|
||||
Transform transform = origParentBody.transform;
|
||||
Vector3 vector = transform.TransformPoint(__instance._targetLocalPosition);
|
||||
|
||||
// Base game threshold has this at 1f (after doing smoothstep on it)
|
||||
// For whatever reason it never hits that for NH planets (probably since they're moving so much compared to the steady velocity of the Stranger)
|
||||
// Might break for somebody with a wacky spinning planet in which case we can adjust this or add some kind of fallback (i.e., wait x seconds and then just say its there)
|
||||
// Fixes #1005
|
||||
if (__instance.currentDistanceLerp > 0.999f)
|
||||
{
|
||||
raftBody.SetPosition(vector);
|
||||
raftBody.SetRotation(transform.rotation * __instance._targetLocalRotation);
|
||||
__instance.StopMovingToTarget();
|
||||
__instance.OnArriveAtTarget.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user