diff --git a/NewHorizons/Builder/General/AstroObjectBuilder.cs b/NewHorizons/Builder/General/AstroObjectBuilder.cs index 45966762..a2fc1410 100644 --- a/NewHorizons/Builder/General/AstroObjectBuilder.cs +++ b/NewHorizons/Builder/General/AstroObjectBuilder.cs @@ -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(); + astroObject.modUniqueName = nhBody.Mod.ModHelper.Manifest.UniqueName; + + var config = nhBody.Config; + astroObject.isVanilla = isVanilla; astroObject.HideDisplayName = !config.Base.hasMapMarker; astroObject.invulnerableToSun = config.Base.invulnerableToSun; diff --git a/NewHorizons/Components/Orbital/NHAstroObject.cs b/NewHorizons/Components/Orbital/NHAstroObject.cs index ed51060c..cb35f059 100644 --- a/NewHorizons/Components/Orbital/NHAstroObject.cs +++ b/NewHorizons/Components/Orbital/NHAstroObject.cs @@ -14,6 +14,11 @@ namespace NewHorizons.Components.Orbital public bool invulnerableToSun; public bool isVanilla; + /// + /// 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 + /// + public string modUniqueName; + public void SetOrbitalParametersFromConfig(OrbitModule orbit) { SetOrbitalParametersFromTrueAnomaly(orbit.eccentricity, orbit.semiMajorAxis, orbit.inclination, orbit.argumentOfPeriapsis, orbit.longitudeOfAscendingNode, orbit.trueAnomaly); diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index a778b8ad..75edb30a 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -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;