mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Reorganization
This commit is contained in:
parent
d674c25163
commit
fa5fa9572a
20
NewHorizons/External/ShipLogModule.cs
vendored
20
NewHorizons/External/ShipLogModule.cs
vendored
@ -22,6 +22,16 @@ namespace NewHorizons.External
|
||||
public ShipLogDetailInfo[] details;
|
||||
}
|
||||
|
||||
public class ShipLogDetailInfo
|
||||
{
|
||||
public string revealedSprite;
|
||||
public string outlineSprite;
|
||||
public float rotation = 0f;
|
||||
public bool invisibleWhenHidden;
|
||||
public MVector2 position;
|
||||
public MVector2 scale;
|
||||
}
|
||||
|
||||
public class CuriosityColorInfo
|
||||
{
|
||||
public string id;
|
||||
@ -34,15 +44,5 @@ namespace NewHorizons.External
|
||||
public string id;
|
||||
public MVector2 position;
|
||||
}
|
||||
|
||||
public class ShipLogDetailInfo
|
||||
{
|
||||
public string revealedSprite;
|
||||
public string outlineSprite;
|
||||
public float rotation = 0f;
|
||||
public bool invisibleWhenHidden;
|
||||
public MVector2 position;
|
||||
public MVector2 scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -65,6 +65,7 @@ namespace NewHorizons
|
||||
Tools.Patches.Apply();
|
||||
Tools.WarpDrivePatches.Apply();
|
||||
Tools.OWCameraFix.Apply();
|
||||
Tools.ShipLogPatches.Apply();
|
||||
|
||||
Logger.Log("Begin load of config files...", Logger.LogType.Log);
|
||||
|
||||
|
||||
@ -53,38 +53,15 @@ namespace NewHorizons.Tools
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix(playerDataKnowsMultipleFrequencies, typeof(Patches), nameof(Patches.OnPlayerDataKnowsMultipleFrequencies));
|
||||
var playerDataResetGame = typeof(PlayerData).GetMethod("ResetGame");
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix(playerDataResetGame, typeof(Patches), nameof(Patches.OnPlayerDataResetGame));
|
||||
var playerDataGetNewlyRevealedFactIDs = typeof(PlayerData).GetMethod("GetNewlyRevealedFactIDs");
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix(playerDataGetNewlyRevealedFactIDs, typeof(Patches), nameof(Patches.OnPlayerDataGetNewlyRevealedFactIDsComplete));
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<BlackHoleVolume>("Start", typeof(Patches), nameof(Patches.OnBlackHoleVolumeStart));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<WhiteHoleVolume>("Awake", typeof(Patches), nameof(Patches.OnWhiteHoleVolumeAwake));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ProbeLauncher>("UpdateOrbitalLaunchValues", typeof(Patches), nameof(Patches.OnProbeLauncherUpdateOrbitalLaunchValues));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<SurveyorProbe>("IsLaunched", typeof(Patches), nameof(Patches.OnSurveyorProbeIsLaunched));
|
||||
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogManager>("Awake", typeof(Patches), nameof(Patches.OnShipLogManagerAwake));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogManager>("Start", typeof(Patches), nameof(Patches.OnShipLogManagerStart));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogManager>("IsFactRevealed", typeof(Patches), nameof(Patches.OnShipLogManagerIsFactRevealed));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogManager>("CheckForCompletionAchievement", typeof(Patches), nameof(Patches.OnShipLogManagerCheckForCompletionAchievement));
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<UIStyleManager>("GetCuriosityColor", typeof(Patches), nameof(Patches.OnUIStyleManagerGetCuriosityColor));
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogSandFunnel>("Awake", typeof(Patches), nameof(Patches.DisableShipLogSandFunnel));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogSandFunnel>("UpdateState", typeof(Patches), nameof(Patches.DisableShipLogSandFunnel));
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogAstroObject>("GetName", typeof(Patches), nameof(Patches.OnShipLogAstroObjectGetName));
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipCockpitController>("Update", typeof(Patches), nameof(Patches.OnShipCockpitControllerUpdate));
|
||||
|
||||
// Postfixes
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<MapController>("Awake", typeof(Patches), nameof(Patches.OnMapControllerAwake));
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<ShipLogManager>("Awake", typeof(Patches), nameof(Patches.OnShipLogManagerAwakeComplete));
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<ShipLogAstroObject>("UpdateState", typeof(Patches), nameof(Patches.OnShipLogAstroObjectUpdateState));
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<ShipLogMapMode>("EnterMode", typeof(Patches), nameof(Patches.OnShipLogMapModeEnterMode));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<ShipLogMapMode>("Initialize", typeof(Patches), nameof(Patches.OnShipLogMapModeInitialize));
|
||||
}
|
||||
|
||||
public static bool GetHUDDisplayName(ReferenceFrame __instance, ref string __result)
|
||||
@ -394,190 +371,5 @@ namespace NewHorizons.Tools
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#region ShipLog
|
||||
public static void OnShipLogManagerAwake(ShipLogManager __instance)
|
||||
{
|
||||
Logger.Log("Beginning Ship Log Generation For: " + Main.Instance.CurrentStarSystem, Logger.LogType.Log);
|
||||
if (Main.Instance.CurrentStarSystem != "SolarSystem")
|
||||
{
|
||||
__instance._shipLogXmlAssets = new TextAsset[] {};
|
||||
foreach (ShipLogEntryLocation logEntryLocation in GameObject.FindObjectsOfType<ShipLogEntryLocation>())
|
||||
{
|
||||
logEntryLocation._initialized = true;
|
||||
}
|
||||
}
|
||||
foreach (NewHorizonsBody body in Main.BodyDict[Main.Instance.CurrentStarSystem])
|
||||
{
|
||||
if (body.Config.ShipLog?.curiosities != null)
|
||||
{
|
||||
RumorModeBuilder.AddCuriosityColors(body.Config.ShipLog.curiosities);
|
||||
}
|
||||
}
|
||||
foreach (NewHorizonsBody body in Main.BodyDict[Main.Instance.CurrentStarSystem])
|
||||
{
|
||||
if (body.Config.ShipLog?.xmlFile != null)
|
||||
{
|
||||
RumorModeBuilder.AddBodyToShipLog(__instance, body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnShipLogManagerAwakeComplete(ShipLogManager __instance)
|
||||
{
|
||||
RumorModeBuilder.GenerateEntryData(__instance);
|
||||
for (var i = 0; i < __instance._entryList.Count; i++)
|
||||
{
|
||||
ShipLogEntry logEntry = __instance._entryList[i];
|
||||
RumorModeBuilder.UpdateEntryCuriosity(ref logEntry);
|
||||
}
|
||||
Logger.Log("Ship Log Generation Complete For: " + Main.Instance.CurrentStarSystem, Logger.LogType.Log);
|
||||
}
|
||||
|
||||
public static bool OnShipLogManagerIsFactRevealed(ShipLogManager __instance, ref bool __result, string __0)
|
||||
{
|
||||
if (Main.Instance.CurrentStarSystem == "SolarSystem")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__instance._factDict.ContainsKey(__0) == false)
|
||||
{
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool OnShipLogManagerCheckForCompletionAchievement()
|
||||
{
|
||||
return Main.Instance.CurrentStarSystem == "SolarSystem";
|
||||
}
|
||||
|
||||
public static bool OnShipLogManagerStart(ShipLogManager __instance)
|
||||
{
|
||||
if (Main.Instance.CurrentStarSystem == "SolarSystem")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (NewHorizonsBody body in Main.BodyDict[Main.Instance.CurrentStarSystem])
|
||||
{
|
||||
foreach (string fact in body.Config.ShipLog?.initialReveal ?? Array.Empty<string>())
|
||||
{
|
||||
__instance.RevealFact(fact, false, false);
|
||||
}
|
||||
}
|
||||
EntryLocationBuilder.InitializeLocations();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool OnUIStyleManagerGetCuriosityColor(UIStyleManager __instance, CuriosityName __0, bool __1, ref Color __result)
|
||||
{
|
||||
if (Main.Instance.CurrentStarSystem == "SolarSystem")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
__result = RumorModeBuilder.GetCuriosityColor(__0, __1, __instance._neutralColor, __instance._neutralHighlight);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void DeleteDetail(string name)
|
||||
{
|
||||
Object.Destroy(GameObject.Find(ShipLogHandler.PAN_ROOT_PATH + "/" + name));
|
||||
}
|
||||
|
||||
public static void OnShipLogMapModeInitialize(ShipLogMapMode __instance)
|
||||
{
|
||||
if (Main.Instance.CurrentStarSystem != "SolarSystem")
|
||||
{
|
||||
GameObject panRoot = GameObject.Find(ShipLogHandler.PAN_ROOT_PATH);
|
||||
GameObject sunObject = GameObject.Find(ShipLogHandler.PAN_ROOT_PATH + "/Sun");
|
||||
ShipLogAstroObject[][] navMatrix = MapModeBuilder.ConstructMapMode(Main.Instance.CurrentStarSystem, panRoot, sunObject.layer);
|
||||
if (navMatrix.Length <= 1)
|
||||
{
|
||||
Logger.LogWarning("No planets suitable for map mode found! Defaulting to vanilla menu (expect weirdness!).");
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance._astroObjects = navMatrix;
|
||||
__instance._startingAstroObjectID = navMatrix[1][0].GetID();
|
||||
List<GameObject> delete = SearchUtilities.GetAllChildren(panRoot).Where(g => g.name.Contains("_ShipLog") == false).ToList();
|
||||
foreach (GameObject gameObject in delete)
|
||||
{
|
||||
DeleteDetail(gameObject.name);
|
||||
}
|
||||
// Just Lie About Having A Sand Funnel
|
||||
__instance._sandFunnel = __instance.gameObject.AddComponent<ShipLogSandFunnel>();
|
||||
}
|
||||
}
|
||||
Logger.Log("Map Mode Construction Complete", Logger.LogType.Log);
|
||||
}
|
||||
|
||||
public static bool OnShipLogAstroObjectGetName(ShipLogAstroObject __instance, ref string __result)
|
||||
{
|
||||
if (Main.Instance.CurrentStarSystem == "SolarSystem")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
__result = MapModeBuilder.GetAstroBodyShipLogName(__instance.GetID());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnShipLogAstroObjectUpdateState(ShipLogAstroObject __instance)
|
||||
{
|
||||
Transform detailsParent = __instance.transform.Find("Details");
|
||||
if (detailsParent != null)
|
||||
{
|
||||
foreach (GameObject child in SearchUtilities.GetAllChildren(detailsParent.gameObject))
|
||||
{
|
||||
Component detail;
|
||||
if (child.TryGetComponent(typeof(ShipLogDetail), out detail))
|
||||
{
|
||||
(detail as ShipLogDetail)?.UpdateState(__instance._state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Transform lineObject = __instance.transform.Find("Line_ShipLog");
|
||||
if (lineObject != null)
|
||||
{
|
||||
ShipLogDetail lineDetail = lineObject.gameObject.GetComponent<ShipLogDetail>();
|
||||
lineDetail.UpdateState(__instance._state);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool DisableShipLogSandFunnel()
|
||||
{
|
||||
return Main.Instance.CurrentStarSystem == "SolarSystem";
|
||||
}
|
||||
|
||||
public static void OnPlayerDataGetNewlyRevealedFactIDsComplete(ref List<string> __result)
|
||||
{
|
||||
ShipLogManager manager = Locator.GetShipLogManager();
|
||||
__result = __result.Where(e => manager.GetFact(e) != null).ToList();
|
||||
}
|
||||
# endregion
|
||||
|
||||
public static void OnShipLogMapModeEnterMode(ShipLogMapMode __instance)
|
||||
{
|
||||
var newPrompt = "Interstellar Mode";
|
||||
__instance._detectiveModePrompt.SetText(newPrompt);
|
||||
var text = GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/ScreenPromptListScaleRoot/ScreenPromptList_UpperRight/ScreenPrompt/Text").GetComponent<UnityEngine.UI.Text>();
|
||||
text.text = newPrompt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
201
NewHorizons/Tools/ShipLogPatches.cs
Normal file
201
NewHorizons/Tools/ShipLogPatches.cs
Normal file
@ -0,0 +1,201 @@
|
||||
using NewHorizons.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NewHorizons.Utility;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using Object = UnityEngine.Object;
|
||||
using NewHorizons.Builder.ShipLog;
|
||||
using NewHorizons.Builder.Handlers;
|
||||
|
||||
namespace NewHorizons.Tools
|
||||
{
|
||||
public static class ShipLogPatches
|
||||
{
|
||||
public static void Apply()
|
||||
{
|
||||
var playerDataGetNewlyRevealedFactIDs = typeof(PlayerData).GetMethod("GetNewlyRevealedFactIDs");
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix(playerDataGetNewlyRevealedFactIDs, typeof(ShipLogPatches), nameof(ShipLogPatches.OnPlayerDataGetNewlyRevealedFactIDsComplete));
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogManager>("Awake", typeof(ShipLogPatches), nameof(ShipLogPatches.OnShipLogManagerAwake));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogManager>("Start", typeof(ShipLogPatches), nameof(ShipLogPatches.OnShipLogManagerStart));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogManager>("IsFactRevealed", typeof(ShipLogPatches), nameof(ShipLogPatches.OnShipLogManagerIsFactRevealed));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogManager>("CheckForCompletionAchievement", typeof(ShipLogPatches), nameof(ShipLogPatches.OnShipLogManagerCheckForCompletionAchievement));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<UIStyleManager>("GetCuriosityColor", typeof(ShipLogPatches), nameof(ShipLogPatches.OnUIStyleManagerGetCuriosityColor));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogSandFunnel>("Awake", typeof(ShipLogPatches), nameof(ShipLogPatches.DisableShipLogSandFunnel));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogSandFunnel>("UpdateState", typeof(ShipLogPatches), nameof(ShipLogPatches.DisableShipLogSandFunnel));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogAstroObject>("GetName", typeof(ShipLogPatches), nameof(ShipLogPatches.OnShipLogAstroObjectGetName));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<ShipLogMapMode>("Initialize", typeof(ShipLogPatches), nameof(ShipLogPatches.OnShipLogMapModeInitialize));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<ShipLogManager>("Awake", typeof(ShipLogPatches), nameof(ShipLogPatches.OnShipLogManagerAwakeComplete));
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<ShipLogAstroObject>("UpdateState", typeof(ShipLogPatches), nameof(ShipLogPatches.OnShipLogAstroObjectUpdateState));
|
||||
}
|
||||
|
||||
public static void OnShipLogManagerAwake(ShipLogManager __instance)
|
||||
{
|
||||
Logger.Log("Beginning Ship Log Generation For: " + Main.Instance.CurrentStarSystem, Logger.LogType.Log);
|
||||
if (Main.Instance.CurrentStarSystem != "SolarSystem")
|
||||
{
|
||||
__instance._shipLogXmlAssets = new TextAsset[] { };
|
||||
foreach (ShipLogEntryLocation logEntryLocation in GameObject.FindObjectsOfType<ShipLogEntryLocation>())
|
||||
{
|
||||
logEntryLocation._initialized = true;
|
||||
}
|
||||
}
|
||||
foreach (NewHorizonsBody body in Main.BodyDict[Main.Instance.CurrentStarSystem])
|
||||
{
|
||||
if (body.Config.ShipLog?.curiosities != null)
|
||||
{
|
||||
RumorModeBuilder.AddCuriosityColors(body.Config.ShipLog.curiosities);
|
||||
}
|
||||
}
|
||||
foreach (NewHorizonsBody body in Main.BodyDict[Main.Instance.CurrentStarSystem])
|
||||
{
|
||||
if (body.Config.ShipLog?.xmlFile != null)
|
||||
{
|
||||
RumorModeBuilder.AddBodyToShipLog(__instance, body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnShipLogManagerAwakeComplete(ShipLogManager __instance)
|
||||
{
|
||||
RumorModeBuilder.GenerateEntryData(__instance);
|
||||
for (var i = 0; i < __instance._entryList.Count; i++)
|
||||
{
|
||||
ShipLogEntry logEntry = __instance._entryList[i];
|
||||
RumorModeBuilder.UpdateEntryCuriosity(ref logEntry);
|
||||
}
|
||||
Logger.Log("Ship Log Generation Complete For: " + Main.Instance.CurrentStarSystem, Logger.LogType.Log);
|
||||
}
|
||||
|
||||
public static bool OnShipLogManagerIsFactRevealed(ShipLogManager __instance, ref bool __result, string __0)
|
||||
{
|
||||
Logger.Log(__0);
|
||||
|
||||
// Just replace the entire function, no need to Debug Break or wtv
|
||||
if (__instance._factDict != null && __instance._factDict.ContainsKey(__0))
|
||||
{
|
||||
__result = __instance._factDict[__0].IsRevealed();
|
||||
}
|
||||
else
|
||||
{
|
||||
__result = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool OnShipLogManagerCheckForCompletionAchievement()
|
||||
{
|
||||
return Main.Instance.CurrentStarSystem == "SolarSystem";
|
||||
}
|
||||
|
||||
public static bool OnShipLogManagerStart(ShipLogManager __instance)
|
||||
{
|
||||
if (Main.Instance.CurrentStarSystem == "SolarSystem")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (NewHorizonsBody body in Main.BodyDict[Main.Instance.CurrentStarSystem])
|
||||
{
|
||||
foreach (string fact in body.Config.ShipLog?.initialReveal ?? Array.Empty<string>())
|
||||
{
|
||||
__instance.RevealFact(fact, false, false);
|
||||
}
|
||||
}
|
||||
EntryLocationBuilder.InitializeLocations();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool OnUIStyleManagerGetCuriosityColor(UIStyleManager __instance, CuriosityName __0, bool __1, ref Color __result)
|
||||
{
|
||||
if (Main.Instance.CurrentStarSystem == "SolarSystem")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
__result = RumorModeBuilder.GetCuriosityColor(__0, __1, __instance._neutralColor, __instance._neutralHighlight);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnShipLogMapModeInitialize(ShipLogMapMode __instance)
|
||||
{
|
||||
if (Main.Instance.CurrentStarSystem != "SolarSystem")
|
||||
{
|
||||
GameObject panRoot = GameObject.Find(ShipLogHandler.PAN_ROOT_PATH);
|
||||
GameObject sunObject = GameObject.Find(ShipLogHandler.PAN_ROOT_PATH + "/Sun");
|
||||
ShipLogAstroObject[][] navMatrix = MapModeBuilder.ConstructMapMode(Main.Instance.CurrentStarSystem, panRoot, sunObject.layer);
|
||||
if (navMatrix.Length <= 1)
|
||||
{
|
||||
Logger.LogWarning("No planets suitable for map mode found! Defaulting to vanilla menu (expect weirdness!).");
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance._astroObjects = navMatrix;
|
||||
__instance._startingAstroObjectID = navMatrix[1][0].GetID();
|
||||
List<GameObject> delete = SearchUtilities.GetAllChildren(panRoot).Where(g => g.name.Contains("_ShipLog") == false).ToList();
|
||||
foreach (GameObject gameObject in delete)
|
||||
{
|
||||
Object.Destroy(GameObject.Find(ShipLogHandler.PAN_ROOT_PATH + "/" + gameObject.name));
|
||||
}
|
||||
// Just Lie About Having A Sand Funnel
|
||||
__instance._sandFunnel = __instance.gameObject.AddComponent<ShipLogSandFunnel>();
|
||||
}
|
||||
}
|
||||
Logger.Log("Map Mode Construction Complete", Logger.LogType.Log);
|
||||
}
|
||||
|
||||
public static bool OnShipLogAstroObjectGetName(ShipLogAstroObject __instance, ref string __result)
|
||||
{
|
||||
if (Main.Instance.CurrentStarSystem == "SolarSystem")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
__result = MapModeBuilder.GetAstroBodyShipLogName(__instance.GetID());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnShipLogAstroObjectUpdateState(ShipLogAstroObject __instance)
|
||||
{
|
||||
Transform detailsParent = __instance.transform.Find("Details");
|
||||
if (detailsParent != null)
|
||||
{
|
||||
foreach (GameObject child in SearchUtilities.GetAllChildren(detailsParent.gameObject))
|
||||
{
|
||||
Component detail;
|
||||
if (child.TryGetComponent(typeof(ShipLogDetail), out detail))
|
||||
{
|
||||
(detail as ShipLogDetail)?.UpdateState(__instance._state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Transform lineObject = __instance.transform.Find("Line_ShipLog");
|
||||
if (lineObject != null)
|
||||
{
|
||||
ShipLogDetail lineDetail = lineObject.gameObject.GetComponent<ShipLogDetail>();
|
||||
lineDetail.UpdateState(__instance._state);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool DisableShipLogSandFunnel()
|
||||
{
|
||||
return Main.Instance.CurrentStarSystem == "SolarSystem";
|
||||
}
|
||||
|
||||
public static void OnPlayerDataGetNewlyRevealedFactIDsComplete(ref List<string> __result)
|
||||
{
|
||||
ShipLogManager manager = Locator.GetShipLogManager();
|
||||
__result = __result.Where(e => manager.GetFact(e) != null).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,9 +14,7 @@ namespace NewHorizons.Tools
|
||||
public static void Apply()
|
||||
{
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipCockpitController>("Update", typeof(WarpDrivePatches), nameof(WarpDrivePatches.OnShipCockpitControllerUpdate));
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<ShipLogMapMode>("EnterMode", typeof(WarpDrivePatches), nameof(WarpDrivePatches.OnShipLogMapModeEnterMode));
|
||||
|
||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogController>("Update", typeof(WarpDrivePatches), nameof(WarpDrivePatches.OnShipLogControllerUpdate));
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user