Make no map marker = no display name

This commit is contained in:
Nick 2022-03-21 21:24:55 -04:00
parent bd4a118ee8
commit 5b5698c85e
4 changed files with 15 additions and 7 deletions

View File

@ -38,7 +38,8 @@ namespace NewHorizons.Builder.General
owRigidBody.EnableKinematicSimulation(); owRigidBody.EnableKinematicSimulation();
owRigidBody.MakeKinematic(); owRigidBody.MakeKinematic();
ParameterizedAstroObject astroObject = body.AddComponent<ParameterizedAstroObject>(); NHAstroObject astroObject = body.AddComponent<NHAstroObject>();
astroObject.HideDisplayName = !config.Base.HasMapMarker;
if (config.Orbit != null) astroObject.SetKeplerCoordinatesFromOrbitModule(config.Orbit); if (config.Orbit != null) astroObject.SetKeplerCoordinatesFromOrbitModule(config.Orbit);

View File

@ -186,8 +186,8 @@ namespace NewHorizons.Builder.General
float r1 = r.magnitude * m2 / (m1 + m2); float r1 = r.magnitude * m2 / (m1 + m2);
float r2 = r.magnitude * m1 / (m1 + m2); float r2 = r.magnitude * m1 / (m1 + m2);
ParameterizedAstroObject primaryAO = Position.AstroLookup[primaryHB].Invoke() as ParameterizedAstroObject; NHAstroObject primaryAO = Position.AstroLookup[primaryHB].Invoke() as NHAstroObject;
ParameterizedAstroObject secondaryAO = Position.AstroLookup[secondaryHB].Invoke() as ParameterizedAstroObject; NHAstroObject secondaryAO = Position.AstroLookup[secondaryHB].Invoke() as NHAstroObject;
float ecc = primaryAO.Eccentricity; float ecc = primaryAO.Eccentricity;
float i = primaryAO.Inclination; float i = primaryAO.Inclination;

View File

@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace NewHorizons.Components.Orbital namespace NewHorizons.Components.Orbital
{ {
public class ParameterizedAstroObject : AstroObject, IKeplerCoordinates public class NHAstroObject : AstroObject, IKeplerCoordinates
{ {
public float Inclination { get; set; } public float Inclination { get; set; }
public int SemiMajorAxis { get; set; } public int SemiMajorAxis { get; set; }
@ -17,6 +17,7 @@ namespace NewHorizons.Components.Orbital
public float Eccentricity { get; set; } public float Eccentricity { get; set; }
public float ArgumentOfPeriapsis { get; set; } public float ArgumentOfPeriapsis { get; set; }
public float TrueAnomaly { get; set; } public float TrueAnomaly { get; set; }
public bool HideDisplayName { get; set; }
public void SetKeplerCoordinatesFromOrbitModule(OrbitModule orbit) public void SetKeplerCoordinatesFromOrbitModule(OrbitModule orbit)
{ {

View File

@ -1,4 +1,5 @@
using NewHorizons.Handlers; using NewHorizons.Components.Orbital;
using NewHorizons.Handlers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -25,11 +26,16 @@ namespace NewHorizons.Tools
public static bool GetHUDDisplayName(ReferenceFrame __instance, ref string __result) public static bool GetHUDDisplayName(ReferenceFrame __instance, ref string __result)
{ {
var ao = __instance.GetAstroObject(); var ao = __instance.GetAstroObject();
if (ao != null && ao.GetAstroObjectName() == AstroObject.Name.CustomString)
if (ao == null) return true;
if(ao is NHAstroObject)
{ {
__result = TranslationHandler.GetTranslation(ao.GetCustomName(), TranslationHandler.TextType.UI); if((ao as NHAstroObject).HideDisplayName) __result = "";
else __result = TranslationHandler.GetTranslation(ao.GetCustomName(), TranslationHandler.TextType.UI);
return false; return false;
} }
return true; return true;
} }