mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix static heavenly body
This commit is contained in:
parent
48a811809d
commit
a5eb0d25ee
@ -11,6 +11,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
namespace NewHorizons.Builder.General
|
||||
{
|
||||
@ -39,21 +40,26 @@ namespace NewHorizons.Builder.General
|
||||
{
|
||||
hb = AddHeavenlyBody(config.Name);
|
||||
}
|
||||
|
||||
if(!config.Orbit.IsStatic)
|
||||
{
|
||||
var planetoid = new Planet.Plantoid(size, gravity, body.transform.rotation, initialMotion._initAngularSpeed, parent, orbit);
|
||||
|
||||
var mapping = Planet.defaultMapping;
|
||||
mapping[hb] = planetoid;
|
||||
Planet.defaultMapping = mapping;
|
||||
}
|
||||
|
||||
// Fix for binary focal points
|
||||
var focalPoint = Position.AstroLookup[parent].Invoke()?.gameObject.GetComponent<BinaryFocalPoint>();
|
||||
if (focalPoint != null)
|
||||
if (focalPoint != null && Planet.defaultMapping.ContainsKey(parent))
|
||||
{
|
||||
var primary = Position.getBody(GetBody(focalPoint.PrimaryName));
|
||||
var secondary = Position.getBody(GetBody(focalPoint.SecondaryName));
|
||||
|
||||
if(primary != null && secondary != null)
|
||||
{
|
||||
Logger.Log($"Fixing BinaryFocalPoint HeavenlyBody gravity value for {parent.name}");
|
||||
var exponent = ((primary?.GetAttachedGravityVolume()?.GetValue<float>("_falloffExponent") ?? 2f) + (secondary?.GetAttachedGravityVolume()?.GetValue<float>("_falloffExponent") ?? 2f)) / 2f;
|
||||
var mass = ((primary?.GetAttachedGravityVolume()?.GetValue<float>("_gravitationalMass") ?? ((primary?.GetMass() ?? 0f) * 1000f)) + (secondary?.GetAttachedGravityVolume()?.GetValue<float>("_gravitationalMass") ?? ((secondary?.GetMass() ?? 0f) * 1000f))) / 4f;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user