mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add mod unique id to NHAstroObject
This commit is contained in:
parent
641b1d7b97
commit
0d99669f81
@ -1,6 +1,6 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Components.Orbital;
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.External;
|
||||
using NewHorizons.Utility.OWML;
|
||||
using UnityEngine;
|
||||
|
||||
@ -8,9 +8,13 @@ namespace NewHorizons.Builder.General
|
||||
{
|
||||
public static class AstroObjectBuilder
|
||||
{
|
||||
public static NHAstroObject Make(GameObject body, AstroObject primaryBody, PlanetConfig config, bool isVanilla)
|
||||
public static NHAstroObject Make(GameObject body, AstroObject primaryBody, NewHorizonsBody nhBody, bool isVanilla)
|
||||
{
|
||||
NHAstroObject astroObject = body.AddComponent<NHAstroObject>();
|
||||
astroObject.modUniqueName = nhBody.Mod.ModHelper.Manifest.UniqueName;
|
||||
|
||||
var config = nhBody.Config;
|
||||
|
||||
astroObject.isVanilla = isVanilla;
|
||||
astroObject.HideDisplayName = !config.Base.hasMapMarker;
|
||||
astroObject.invulnerableToSun = config.Base.invulnerableToSun;
|
||||
|
||||
@ -14,6 +14,11 @@ namespace NewHorizons.Components.Orbital
|
||||
public bool invulnerableToSun;
|
||||
public bool isVanilla;
|
||||
|
||||
/// <summary>
|
||||
/// The unique name of the mod that created this body or, if it is an existing body being edited, the last mod to edit it
|
||||
/// </summary>
|
||||
public string modUniqueName;
|
||||
|
||||
public void SetOrbitalParametersFromConfig(OrbitModule orbit)
|
||||
{
|
||||
SetOrbitalParametersFromTrueAnomaly(orbit.eccentricity, orbit.semiMajorAxis, orbit.inclination, orbit.argumentOfPeriapsis, orbit.longitudeOfAscendingNode, orbit.trueAnomaly);
|
||||
|
||||
@ -371,7 +371,7 @@ namespace NewHorizons.Handlers
|
||||
const float sphereOfInfluence = 2000f;
|
||||
|
||||
var owRigidBody = RigidBodyBuilder.Make(go, sphereOfInfluence, body.Config);
|
||||
var ao = AstroObjectBuilder.Make(go, null, body.Config, false);
|
||||
var ao = AstroObjectBuilder.Make(go, null, body, false);
|
||||
|
||||
var sector = SectorBuilder.Make(go, owRigidBody, sphereOfInfluence);
|
||||
ao._rootSector = sector;
|
||||
@ -447,7 +447,7 @@ namespace NewHorizons.Handlers
|
||||
var sphereOfInfluence = GetSphereOfInfluence(body);
|
||||
|
||||
var owRigidBody = RigidBodyBuilder.Make(go, sphereOfInfluence, body.Config);
|
||||
var ao = AstroObjectBuilder.Make(go, primaryBody, body.Config, false);
|
||||
var ao = AstroObjectBuilder.Make(go, primaryBody, body, false);
|
||||
|
||||
var sector = SectorBuilder.Make(go, owRigidBody, sphereOfInfluence * 2f);
|
||||
ao._rootSector = sector;
|
||||
@ -788,7 +788,7 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
|
||||
// Just destroy the existing AO after copying everything over
|
||||
var newAO = AstroObjectBuilder.Make(go, primary, body.Config, true);
|
||||
var newAO = AstroObjectBuilder.Make(go, primary, body, true);
|
||||
newAO._gravityVolume = ao._gravityVolume;
|
||||
newAO._moon = ao._moon;
|
||||
newAO._name = ao._name;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user