mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Manually set attached components
This commit is contained in:
parent
745b773389
commit
74873efc11
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.Components.Orbital;
|
using NewHorizons.Components.Orbital;
|
||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
@ -31,6 +31,8 @@ namespace NewHorizons.Builder.General
|
|||||||
|
|
||||||
fluidDetector._collider = sphereCollider;
|
fluidDetector._collider = sphereCollider;
|
||||||
|
|
||||||
|
OWRB.RegisterAttachedFluidDetector(fluidDetector);
|
||||||
|
|
||||||
// Could copy the splash from the interloper as well some day
|
// Could copy the splash from the interloper as well some day
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
@ -6,7 +6,7 @@ namespace NewHorizons.Builder.General
|
|||||||
{
|
{
|
||||||
public static class GravityBuilder
|
public static class GravityBuilder
|
||||||
{
|
{
|
||||||
public static GravityVolume Make(GameObject planetGO, AstroObject ao, PlanetConfig config)
|
public static GravityVolume Make(GameObject planetGO, AstroObject ao, OWRigidbody owrb, PlanetConfig config)
|
||||||
{
|
{
|
||||||
var exponent = config.Base.gravityFallOff == GravityFallOff.Linear ? 1f : 2f;
|
var exponent = config.Base.gravityFallOff == GravityFallOff.Linear ? 1f : 2f;
|
||||||
var GM = config.Base.surfaceGravity * Mathf.Pow(config.Base.surfaceSize, exponent);
|
var GM = config.Base.surfaceGravity * Mathf.Pow(config.Base.surfaceSize, exponent);
|
||||||
@ -60,6 +60,7 @@ namespace NewHorizons.Builder.General
|
|||||||
gravityGO.SetActive(true);
|
gravityGO.SetActive(true);
|
||||||
|
|
||||||
ao._gravityVolume = gravityVolume;
|
ao._gravityVolume = gravityVolume;
|
||||||
|
owrb.RegisterAttachedGravityVolume(gravityVolume);
|
||||||
|
|
||||||
return gravityVolume;
|
return gravityVolume;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
namespace NewHorizons.Builder.General
|
namespace NewHorizons.Builder.General
|
||||||
{
|
{
|
||||||
public static class RFVolumeBuilder
|
public static class RFVolumeBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject planetGO, OWRigidbody owRigidBody, float sphereOfInfluence)
|
public static void Make(GameObject planetGO, OWRigidbody owrb, float sphereOfInfluence)
|
||||||
{
|
{
|
||||||
var rfGO = new GameObject("RFVolume");
|
var rfGO = new GameObject("RFVolume");
|
||||||
rfGO.transform.parent = planetGO.transform;
|
rfGO.transform.parent = planetGO.transform;
|
||||||
@ -18,7 +18,7 @@ namespace NewHorizons.Builder.General
|
|||||||
|
|
||||||
var RFV = rfGO.AddComponent<ReferenceFrameVolume>();
|
var RFV = rfGO.AddComponent<ReferenceFrameVolume>();
|
||||||
|
|
||||||
var RV = new ReferenceFrame(owRigidBody);
|
var RV = new ReferenceFrame(owrb);
|
||||||
RV._minSuitTargetDistance = sphereOfInfluence;
|
RV._minSuitTargetDistance = sphereOfInfluence;
|
||||||
RV._maxTargetDistance = 0;
|
RV._maxTargetDistance = 0;
|
||||||
RV._autopilotArrivalDistance = 2.0f * sphereOfInfluence;
|
RV._autopilotArrivalDistance = 2.0f * sphereOfInfluence;
|
||||||
@ -36,6 +36,8 @@ namespace NewHorizons.Builder.General
|
|||||||
RFV._isPrimaryVolume = true;
|
RFV._isPrimaryVolume = true;
|
||||||
RFV._isCloseRangeVolume = false;
|
RFV._isCloseRangeVolume = false;
|
||||||
|
|
||||||
|
owrb.SetAttachedReferenceFrameVolume(RFV);
|
||||||
|
|
||||||
rfGO.SetActive(true);
|
rfGO.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -303,7 +303,7 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
if (body.Config.Base.surfaceGravity != 0)
|
if (body.Config.Base.surfaceGravity != 0)
|
||||||
{
|
{
|
||||||
GravityBuilder.Make(go, ao, body.Config);
|
GravityBuilder.Make(go, ao, owRigidBody, body.Config);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.Config.Base.hasReferenceFrame)
|
if (body.Config.Base.hasReferenceFrame)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user