mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge pull request #76 from xen-42/shiplog-fixes
Fixed some ship log bugs
This commit is contained in:
commit
e0e7bfc7f6
@ -305,15 +305,15 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
public List<MapModeObject> children;
|
public List<MapModeObject> children;
|
||||||
public MapModeObject parent;
|
public MapModeObject parent;
|
||||||
public MapModeObject lastSibling;
|
public MapModeObject lastSibling;
|
||||||
public void Increment_width()
|
public void IncrementWidth()
|
||||||
{
|
{
|
||||||
branch_width++;
|
branch_width++;
|
||||||
parent?.Increment_width();
|
parent?.IncrementWidth();
|
||||||
}
|
}
|
||||||
public void Increment_height()
|
public void IncrementHeight()
|
||||||
{
|
{
|
||||||
branch_height++;
|
branch_height++;
|
||||||
parent?.Increment_height();
|
parent?.IncrementHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,12 +416,12 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
if (even)
|
if (even)
|
||||||
{
|
{
|
||||||
newY += newNode.branch_height;
|
newY += newNode.branch_height;
|
||||||
parent.Increment_height();
|
parent.IncrementHeight();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newX += newNode.branch_width;
|
newX += newNode.branch_width;
|
||||||
parent.Increment_width();
|
parent.IncrementWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
lastSibling = newNode;
|
lastSibling = newNode;
|
||||||
@ -488,7 +488,6 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
astroObject._imageObj.GetComponent<Image>().enabled = false;
|
astroObject._imageObj.GetComponent<Image>().enabled = false;
|
||||||
astroObject._outlineObj.GetComponent<Image>().enabled = false;
|
astroObject._outlineObj.GetComponent<Image>().enabled = false;
|
||||||
astroObject._unviewedObj.GetComponent<Image>().enabled = false;
|
astroObject._unviewedObj.GetComponent<Image>().enabled = false;
|
||||||
astroObject.transform.localScale = node.lastSibling.astroObject.transform.localScale;
|
|
||||||
}
|
}
|
||||||
node.astroObject = astroObject;
|
node.astroObject = astroObject;
|
||||||
if (node.lastSibling != null) ConnectNodeToLastSibling(node, greyScaleMaterial);
|
if (node.lastSibling != null) ConnectNodeToLastSibling(node, greyScaleMaterial);
|
||||||
|
|||||||
39
NewHorizons/External/NewHorizonsData.cs
vendored
39
NewHorizons/External/NewHorizonsData.cs
vendored
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using NewHorizons.Handlers;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
namespace NewHorizons.External
|
namespace NewHorizons.External
|
||||||
@ -59,12 +60,14 @@ namespace NewHorizons.External
|
|||||||
{
|
{
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
Logger.Log($"Reseting save data for {_activeProfileName}");
|
Logger.Log($"Resetting save data for {_activeProfileName}");
|
||||||
_activeProfile = new NewHorizonsProfile();
|
_activeProfile = new NewHorizonsProfile();
|
||||||
_saveFile.Profiles[_activeProfileName] = _activeProfile;
|
_saveFile.Profiles[_activeProfileName] = _activeProfile;
|
||||||
|
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# region Frequencies
|
||||||
|
|
||||||
public static bool KnowsFrequency(string frequency)
|
public static bool KnowsFrequency(string frequency)
|
||||||
{
|
{
|
||||||
@ -81,7 +84,16 @@ namespace NewHorizons.External
|
|||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool KnowsMultipleFrequencies()
|
||||||
|
{
|
||||||
|
return (_activeProfile != null && _activeProfile.KnownFrequencies.Count > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
# endregion
|
||||||
|
|
||||||
|
# region Signals
|
||||||
|
|
||||||
public static bool KnowsSignal(string signal)
|
public static bool KnowsSignal(string signal)
|
||||||
{
|
{
|
||||||
if (_activeProfile == null) return true;
|
if (_activeProfile == null) return true;
|
||||||
@ -97,12 +109,30 @@ namespace NewHorizons.External
|
|||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# endregion
|
||||||
|
|
||||||
|
# region Newly Revealed Facts
|
||||||
|
|
||||||
public static bool KnowsMultipleFrequencies()
|
public static void AddNewlyRevealedFactID(string id)
|
||||||
{
|
{
|
||||||
return (_activeProfile != null && _activeProfile.KnownFrequencies.Count > 0);
|
_activeProfile?.NewlyRevealedFactIDs.Add(id);
|
||||||
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<string> GetNewlyRevealedFactIDs()
|
||||||
|
{
|
||||||
|
return _activeProfile?.NewlyRevealedFactIDs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ClearNewlyRevealedFactIDs()
|
||||||
|
{
|
||||||
|
_activeProfile?.NewlyRevealedFactIDs.Clear();
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
# endregion
|
||||||
|
|
||||||
private class NewHorizonsSaveFile
|
private class NewHorizonsSaveFile
|
||||||
{
|
{
|
||||||
public NewHorizonsSaveFile()
|
public NewHorizonsSaveFile()
|
||||||
@ -119,10 +149,13 @@ namespace NewHorizons.External
|
|||||||
{
|
{
|
||||||
KnownFrequencies = new List<string>();
|
KnownFrequencies = new List<string>();
|
||||||
KnownSignals = new List<string>();
|
KnownSignals = new List<string>();
|
||||||
|
NewlyRevealedFactIDs = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> KnownFrequencies { get; set; }
|
public List<string> KnownFrequencies { get; set; }
|
||||||
public List<string> KnownSignals { get; set; }
|
public List<string> KnownSignals { get; set; }
|
||||||
|
|
||||||
|
public List<string> NewlyRevealedFactIDs { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,8 +23,9 @@ namespace NewHorizons.Handlers
|
|||||||
// NewHorizonsBody -> AstroID
|
// NewHorizonsBody -> AstroID
|
||||||
private static Dictionary<NewHorizonsBody, string> _nhBodyToAstroIDs;
|
private static Dictionary<NewHorizonsBody, string> _nhBodyToAstroIDs;
|
||||||
|
|
||||||
private static string[] vanillaBodies;
|
private static string[] _vanillaBodies;
|
||||||
private static string[] vanillaIDs;
|
private static string[] _vanillaBodyIDs;
|
||||||
|
private static string[] _moddedFactsIDs;
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
@ -33,13 +34,19 @@ namespace NewHorizons.Handlers
|
|||||||
_nhBodyToAstroIDs = new Dictionary<NewHorizonsBody, string>();
|
_nhBodyToAstroIDs = new Dictionary<NewHorizonsBody, string>();
|
||||||
|
|
||||||
List<GameObject> gameObjects = SearchUtilities.GetAllChildren(GameObject.Find(PAN_ROOT_PATH));
|
List<GameObject> gameObjects = SearchUtilities.GetAllChildren(GameObject.Find(PAN_ROOT_PATH));
|
||||||
vanillaBodies = gameObjects.ConvertAll(g => g.name).ToArray();
|
_vanillaBodies = gameObjects.ConvertAll(g => g.name).ToArray();
|
||||||
vanillaIDs = gameObjects.ConvertAll(g => g.GetComponent<ShipLogAstroObject>()?.GetID()).ToArray();
|
_vanillaBodyIDs = gameObjects.ConvertAll(g => g.GetComponent<ShipLogAstroObject>()?.GetID()).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CheckForModdedFacts(ShipLogManager manager)
|
||||||
|
{
|
||||||
|
List<ShipLogFact> moddedFacts = manager._factList.Where(e => manager._entryDataDict.ContainsKey(e._entryID) == false).ToList();
|
||||||
|
_moddedFactsIDs = moddedFacts.ConvertAll(e => e.GetID()).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsVanillaAstroID(string astroId)
|
public static bool IsVanillaAstroID(string astroId)
|
||||||
{
|
{
|
||||||
return vanillaIDs.Contains(astroId);
|
return _vanillaBodyIDs.Contains(astroId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsVanillaBody(NewHorizonsBody body)
|
public static bool IsVanillaBody(NewHorizonsBody body)
|
||||||
@ -48,7 +55,7 @@ namespace NewHorizons.Handlers
|
|||||||
if (existingBody != null && existingBody.GetAstroObjectName() != AstroObject.Name.CustomString)
|
if (existingBody != null && existingBody.GetAstroObjectName() != AstroObject.Name.CustomString)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return vanillaBodies.Contains(body.Config.Name.Replace(" ", ""));
|
return _vanillaBodies.Contains(body.Config.Name.Replace(" ", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetNameFromAstroID(string astroID)
|
public static string GetNameFromAstroID(string astroID)
|
||||||
@ -66,6 +73,11 @@ namespace NewHorizons.Handlers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsModdedFact(string FactID)
|
||||||
|
{
|
||||||
|
return _moddedFactsIDs.Contains(FactID);
|
||||||
|
}
|
||||||
|
|
||||||
public static void AddConfig(string astroID, List<string> entryIDs, NewHorizonsBody body)
|
public static void AddConfig(string astroID, List<string> entryIDs, NewHorizonsBody body)
|
||||||
{
|
{
|
||||||
// Nice to be able to just get the AstroID from the body
|
// Nice to be able to just get the AstroID from the body
|
||||||
|
|||||||
@ -55,6 +55,14 @@ namespace NewHorizons.Tools
|
|||||||
var playerDataResetGame = typeof(PlayerData).GetMethod("ResetGame");
|
var playerDataResetGame = typeof(PlayerData).GetMethod("ResetGame");
|
||||||
Main.Instance.ModHelper.HarmonyHelper.AddPostfix(playerDataResetGame, typeof(Patches), nameof(Patches.OnPlayerDataResetGame));
|
Main.Instance.ModHelper.HarmonyHelper.AddPostfix(playerDataResetGame, typeof(Patches), nameof(Patches.OnPlayerDataResetGame));
|
||||||
|
|
||||||
|
var playerDataAddNewlyRevealedFactID = typeof(PlayerData).GetMethod("AddNewlyRevealedFactID");
|
||||||
|
Main.Instance.ModHelper.HarmonyHelper.AddPrefix(playerDataAddNewlyRevealedFactID, typeof(Patches), nameof(Patches.OnPlayerDataAddNewlyRevealedFactID));
|
||||||
|
var playerDataGetNewlyRevealedFactIDs = typeof(PlayerData).GetMethod("GetNewlyRevealedFactIDs");
|
||||||
|
Main.Instance.ModHelper.HarmonyHelper.AddPrefix(playerDataGetNewlyRevealedFactIDs, typeof(Patches), nameof(Patches.OnPlayerDataGetNewlyRevealedFactIDs));
|
||||||
|
var playerDataClearNewlyRevealedFactIDs = typeof(PlayerData).GetMethod("ClearNewlyRevealedFactIDs");
|
||||||
|
Main.Instance.ModHelper.HarmonyHelper.AddPrefix(playerDataClearNewlyRevealedFactIDs, typeof(Patches), nameof(Patches.OnPlayerDataClearNewlyRevealedFactIDs));
|
||||||
|
|
||||||
|
|
||||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<BlackHoleVolume>("Start", typeof(Patches), nameof(Patches.OnBlackHoleVolumeStart));
|
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<WhiteHoleVolume>("Awake", typeof(Patches), nameof(Patches.OnWhiteHoleVolumeAwake));
|
||||||
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ProbeLauncher>("UpdateOrbitalLaunchValues", typeof(Patches), nameof(Patches.OnProbeLauncherUpdateOrbitalLaunchValues));
|
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ProbeLauncher>("UpdateOrbitalLaunchValues", typeof(Patches), nameof(Patches.OnProbeLauncherUpdateOrbitalLaunchValues));
|
||||||
@ -310,6 +318,32 @@ namespace NewHorizons.Tools
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool OnPlayerDataAddNewlyRevealedFactID(string __0)
|
||||||
|
{
|
||||||
|
if (ShipLogHandler.IsModdedFact(__0))
|
||||||
|
{
|
||||||
|
NewHorizonsData.AddNewlyRevealedFactID(__0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool OnPlayerDataGetNewlyRevealedFactIDs(ref List<string> __result)
|
||||||
|
{
|
||||||
|
__result = PlayerData._currentGameSave.newlyRevealedFactIDs.Concat(NewHorizonsData.GetNewlyRevealedFactIDs()).ToList();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool OnPlayerDataClearNewlyRevealedFactIDs()
|
||||||
|
{
|
||||||
|
PlayerData._currentGameSave.newlyRevealedFactIDs.Clear();
|
||||||
|
NewHorizonsData.ClearNewlyRevealedFactIDs();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static void OnPlayerDataResetGame()
|
public static void OnPlayerDataResetGame()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -66,6 +66,7 @@ namespace NewHorizons.Tools
|
|||||||
|
|
||||||
public static void OnShipLogManagerAwakeComplete(ShipLogManager __instance)
|
public static void OnShipLogManagerAwakeComplete(ShipLogManager __instance)
|
||||||
{
|
{
|
||||||
|
ShipLogHandler.CheckForModdedFacts(__instance);
|
||||||
RumorModeBuilder.GenerateEntryData(__instance);
|
RumorModeBuilder.GenerateEntryData(__instance);
|
||||||
for (var i = 0; i < __instance._entryList.Count; i++)
|
for (var i = 0; i < __instance._entryList.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user