mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix QM, OPC, Sun Station debris labeled when locked on #623
This commit is contained in:
parent
ffd2fe6911
commit
2f9e66398b
@ -7,9 +7,10 @@ namespace NewHorizons.Builder.General
|
||||
{
|
||||
public static class AstroObjectBuilder
|
||||
{
|
||||
public static NHAstroObject Make(GameObject body, AstroObject primaryBody, PlanetConfig config)
|
||||
public static NHAstroObject Make(GameObject body, AstroObject primaryBody, PlanetConfig config, bool isVanilla)
|
||||
{
|
||||
NHAstroObject astroObject = body.AddComponent<NHAstroObject>();
|
||||
astroObject.isVanilla = isVanilla;
|
||||
astroObject.HideDisplayName = !config.Base.hasMapMarker;
|
||||
astroObject.invulnerableToSun = config.Base.invulnerableToSun;
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ namespace NewHorizons.Components.Orbital
|
||||
public bool HideDisplayName { get; set; }
|
||||
public bool IsDimension { get; set; }
|
||||
public bool invulnerableToSun;
|
||||
public bool isVanilla;
|
||||
|
||||
public void SetOrbitalParametersFromConfig(OrbitModule orbit)
|
||||
{
|
||||
|
||||
@ -343,7 +343,7 @@ namespace NewHorizons.Handlers
|
||||
body.Config.Base.hasMapMarker = false;
|
||||
|
||||
var owRigidBody = RigidBodyBuilder.Make(go, body.Config);
|
||||
var ao = AstroObjectBuilder.Make(go, null, body.Config);
|
||||
var ao = AstroObjectBuilder.Make(go, null, body.Config, false);
|
||||
|
||||
var sector = SectorBuilder.Make(go, owRigidBody, 2000f);
|
||||
ao._rootSector = sector;
|
||||
@ -409,7 +409,7 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
|
||||
var owRigidBody = RigidBodyBuilder.Make(go, body.Config);
|
||||
var ao = AstroObjectBuilder.Make(go, primaryBody, body.Config);
|
||||
var ao = AstroObjectBuilder.Make(go, primaryBody, body.Config, false);
|
||||
|
||||
var sphereOfInfluence = GetSphereOfInfluence(body);
|
||||
|
||||
@ -702,7 +702,7 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
|
||||
// Just destroy the existing AO after copying everything over
|
||||
var newAO = AstroObjectBuilder.Make(go, primary, body.Config);
|
||||
var newAO = AstroObjectBuilder.Make(go, primary, body.Config, true);
|
||||
newAO._gravityVolume = ao._gravityVolume;
|
||||
newAO._moon = ao._moon;
|
||||
newAO._name = ao._name;
|
||||
|
||||
@ -7,32 +7,19 @@ namespace NewHorizons.Patches.MapPatches
|
||||
[HarmonyPatch(typeof(ReferenceFrame))]
|
||||
public static class ReferenceFramePatches
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(ReferenceFrame.GetHUDDisplayName))]
|
||||
public static bool ReferenceFrame_GetHUDDisplayName(ReferenceFrame __instance, ref string __result)
|
||||
public static void ReferenceFrame_GetHUDDisplayName(ReferenceFrame __instance, ref string __result)
|
||||
{
|
||||
var ao = __instance.GetAstroObject();
|
||||
|
||||
if (ao == null) return true;
|
||||
|
||||
if (ao._name != AstroObject.Name.CustomString)
|
||||
if (__instance.GetAstroObject() is NHAstroObject nhao && !nhao.isVanilla && !nhao.HideDisplayName)
|
||||
{
|
||||
__result = AstroObject.AstroObjectNameToString(ao._name);
|
||||
return false;
|
||||
}
|
||||
|
||||
__result = string.Empty;
|
||||
|
||||
if (ao is NHAstroObject nhao && nhao.HideDisplayName) return false;
|
||||
|
||||
var customName = ao.GetCustomName();
|
||||
var customName = nhao.GetCustomName();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(customName))
|
||||
{
|
||||
__result = TranslationHandler.GetTranslation(customName, TranslationHandler.TextType.UI, false);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user