mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Some minor fixes
This commit is contained in:
parent
cf64019dca
commit
e7087fa602
@ -38,18 +38,18 @@ namespace NewHorizons.Builder.General
|
||||
hb = AddHeavenlyBody(config.Name);
|
||||
}
|
||||
|
||||
if(!config.Orbit.IsStatic)
|
||||
var mapping = Planet.defaultMapping;
|
||||
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 && Planet.defaultMapping.ContainsKey(parent))
|
||||
if (focalPoint != null && mapping.ContainsKey(parent))
|
||||
{
|
||||
var primary = Position.getBody(GetBody(focalPoint.PrimaryName));
|
||||
var secondary = Position.getBody(GetBody(focalPoint.SecondaryName));
|
||||
@ -63,13 +63,21 @@ namespace NewHorizons.Builder.General
|
||||
var exponent = (primaryGravity.exponent + secondaryGravity.exponent) / 2f;
|
||||
var mass = (primaryGravity.mass + secondaryGravity.mass) / 4f;
|
||||
|
||||
var currentValue = Planet.mapping[parent];
|
||||
var newValue = new Planet.Plantoid(currentValue.size, Gravity.of(exponent, mass), currentValue.state);
|
||||
Planet.defaultMapping[parent] = newValue;
|
||||
mapping[parent] = new Planet.Plantoid(mapping[parent].size, Gravity.of(exponent, mass), mapping[parent].state);
|
||||
Planet.defaultMapping = mapping;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Remove(AstroObject obj)
|
||||
{
|
||||
var astro = Position.find(obj);
|
||||
|
||||
var mapping = Planet.defaultMapping;
|
||||
mapping.Remove(astro);
|
||||
Planet.defaultMapping = mapping;
|
||||
}
|
||||
|
||||
private static Gravity getGravity(GravityVolume volume)
|
||||
{
|
||||
if (volume == null)
|
||||
@ -115,7 +123,7 @@ namespace NewHorizons.Builder.General
|
||||
return hb;
|
||||
}
|
||||
|
||||
public static void OnDestroy()
|
||||
public static void Reset()
|
||||
{
|
||||
Planet.defaultMapping = Planet.standardMapping;
|
||||
}
|
||||
|
||||
@ -102,6 +102,8 @@ namespace NewHorizons.Builder.General
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => RemoveProxy(ao.name.Replace("_Body", "")));
|
||||
|
||||
ao.transform.root.gameObject.SetActive(false);
|
||||
|
||||
HeavenlyBodyBuilder.Remove(ao);
|
||||
}
|
||||
|
||||
public static void RemoveDistantProxyClones()
|
||||
|
||||
@ -70,7 +70,7 @@ namespace NewHorizons
|
||||
void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
Logger.Log($"Scene Loaded: {scene.name} {mode}");
|
||||
HeavenlyBodyBuilder.OnDestroy();
|
||||
HeavenlyBodyBuilder.Reset();
|
||||
if (scene.name != "SolarSystem") { return; }
|
||||
|
||||
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => Locator.GetPlayerBody().gameObject.AddComponent<DebugRaycaster>());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user