mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add display names to eye astro objects
This commit is contained in:
parent
e55818bfb8
commit
e78a892bf4
@ -1,4 +1,5 @@
|
||||
using HarmonyLib;
|
||||
using NewHorizons.Components.EyeOfTheUniverse;
|
||||
using NewHorizons.Components.Orbital;
|
||||
using NewHorizons.Handlers;
|
||||
|
||||
@ -11,7 +12,27 @@ namespace NewHorizons.Patches.MapPatches
|
||||
[HarmonyPatch(nameof(ReferenceFrame.GetHUDDisplayName))]
|
||||
public static void ReferenceFrame_GetHUDDisplayName(ReferenceFrame __instance, ref string __result)
|
||||
{
|
||||
if (__instance.GetAstroObject() is NHAstroObject nhao && !nhao.isVanilla && !nhao.HideDisplayName)
|
||||
var ao = __instance.GetAstroObject();
|
||||
|
||||
if (ao is EyeAstroObject eyeao && !eyeao.HideDisplayName)
|
||||
{
|
||||
var name = eyeao.GetAstroObjectName();
|
||||
|
||||
if (name == AstroObject.Name.Eye)
|
||||
{
|
||||
__result = UITextLibrary.GetString(UITextType.LocationEye);
|
||||
}
|
||||
else
|
||||
{
|
||||
var customName = eyeao.GetCustomName();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(customName))
|
||||
{
|
||||
__result = TranslationHandler.GetTranslation(customName, TranslationHandler.TextType.UI, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ao is NHAstroObject nhao && !nhao.isVanilla && !nhao.HideDisplayName)
|
||||
{
|
||||
var customName = nhao.GetCustomName();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user