Make nh work with eye (partially)

This commit is contained in:
Noah Pilarski 2022-08-11 13:10:44 -04:00
parent 7e020b2537
commit aff44f3f18
32 changed files with 326 additions and 104 deletions

View File

@ -1,4 +1,5 @@
using NewHorizons.Builder.Props; using NewHorizons.Builder.Props;
using NewHorizons.Handlers;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Linq; using System.Linq;
@ -61,7 +62,7 @@ namespace NewHorizons.AchievementsPlus
{ {
foreach (var fact in factIDs) foreach (var fact in factIDs)
{ {
if (!Locator.GetShipLogManager().IsFactRevealed(fact)) return false; if (!ShipLogHandler.KnowsFact(fact)) return false;
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -0,0 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/xen-42/outer-wilds-new-horizons/main/NewHorizons/Schemas/translation_schema.json",
"UIDictionary": {
"Vessel": "飞船"
}
}

View File

@ -11,7 +11,8 @@
"FREQ_WARP_CORE": "Anti-Graviton Flux", "FREQ_WARP_CORE": "Anti-Graviton Flux",
"FREQ_UNKNOWN": "???", "FREQ_UNKNOWN": "???",
"ENGAGE_WARP_PROMPT": "Engage Warp To {0}", "ENGAGE_WARP_PROMPT": "Engage Warp To {0}",
"WARP_LOCKED": "AUTOPILOT LOCKED TO:\n{0}" "WARP_LOCKED": "AUTOPILOT LOCKED TO:\n{0}",
"Vessel": "Vessel"
}, },
"AchievementTranslations": { "AchievementTranslations": {
"NH_EATEN_OUTSIDE_BRAMBLE": { "NH_EATEN_OUTSIDE_BRAMBLE": {

View File

@ -9,6 +9,7 @@
"INTERSTELLAR_MODE": "Mode Interstellaire", "INTERSTELLAR_MODE": "Mode Interstellaire",
"FREQ_STATUE": "Statue Nomaï", "FREQ_STATUE": "Statue Nomaï",
"FREQ_WARP_CORE": "Flux Anti-Gravitonique", "FREQ_WARP_CORE": "Flux Anti-Gravitonique",
"FREQ_UNKNOWN": "???" "FREQ_UNKNOWN": "???",
"Vessel": "Vaisseau"
} }
} }

View File

@ -9,6 +9,7 @@
"INTERSTELLAR_MODE": "Interstellar Modus", "INTERSTELLAR_MODE": "Interstellar Modus",
"FREQ_STATUE": "Nomai-Statue", "FREQ_STATUE": "Nomai-Statue",
"FREQ_WARP_CORE": "Anti-Gravitations Flux", "FREQ_WARP_CORE": "Anti-Gravitations Flux",
"FREQ_UNKNOWN": "???" "FREQ_UNKNOWN": "???",
"Vessel": "Gefährts"
} }
} }

View File

@ -0,0 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/xen-42/outer-wilds-new-horizons/main/NewHorizons/Schemas/translation_schema.json",
"UIDictionary": {
"Vessel": "Vascello"
}
}

View File

@ -0,0 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/xen-42/outer-wilds-new-horizons/main/NewHorizons/Schemas/translation_schema.json",
"UIDictionary": {
"Vessel": "船"
}
}

View File

@ -0,0 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/xen-42/outer-wilds-new-horizons/main/NewHorizons/Schemas/translation_schema.json",
"UIDictionary": {
"Vessel": "함선"
}
}

View File

@ -0,0 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/xen-42/outer-wilds-new-horizons/main/NewHorizons/Schemas/translation_schema.json",
"UIDictionary": {
"Vessel": "Statku"
}
}

View File

@ -0,0 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/xen-42/outer-wilds-new-horizons/main/NewHorizons/Schemas/translation_schema.json",
"UIDictionary": {
"Vessel": "Hospedeiro"
}
}

View File

@ -11,6 +11,7 @@
"FREQ_WARP_CORE": "Гиперядро", "FREQ_WARP_CORE": "Гиперядро",
"FREQ_UNKNOWN": "???", "FREQ_UNKNOWN": "???",
"ENGAGE_WARP_PROMPT": "Телепортироваться к {0}", "ENGAGE_WARP_PROMPT": "Телепортироваться к {0}",
"WARP_LOCKED": "АВТОПИЛОТ ЗАКРЕПЛЁН НА:\n{0}" "WARP_LOCKED": "АВТОПИЛОТ ЗАКРЕПЛЁН НА:\n{0}",
"Vessel": "«Звездолёта»"
} }
} }

View File

@ -11,7 +11,8 @@
"FREQ_WARP_CORE": "Flujo De Anti-Gravitones", "FREQ_WARP_CORE": "Flujo De Anti-Gravitones",
"FREQ_UNKNOWN": "???", "FREQ_UNKNOWN": "???",
"ENGAGE_WARP_PROMPT": "Iniciar teletransporte a {0}", "ENGAGE_WARP_PROMPT": "Iniciar teletransporte a {0}",
"WARP_LOCKED": "Piloto automático fijado en:\n{0}" "WARP_LOCKED": "Piloto automático fijado en:\n{0}",
"Vessel": "Nave"
}, },
"AchievementTranslations": { "AchievementTranslations": {
"NH_EATEN_OUTSIDE_BRAMBLE": { "NH_EATEN_OUTSIDE_BRAMBLE": {

View File

@ -0,0 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/xen-42/outer-wilds-new-horizons/main/NewHorizons/Schemas/translation_schema.json",
"UIDictionary": {
"Vessel": "Tekne"
}
}

View File

@ -36,18 +36,21 @@ namespace NewHorizons.Builder.Atmosphere
rulesetGO.AddComponent<AntiTravelMusicRuleset>(); rulesetGO.AddComponent<AntiTravelMusicRuleset>();
EffectRuleset ER = rulesetGO.AddComponent<EffectRuleset>(); var gdRuleset = SearchUtilities.Find("GiantsDeep_Body/Sector_GD/Volumes_GD/RulesetVolumes_GD")?.GetComponent<EffectRuleset>();
ER._type = EffectRuleset.BubbleType.Underwater; if (gdRuleset != null)
var gdRuleset = SearchUtilities.Find("GiantsDeep_Body/Sector_GD/Volumes_GD/RulesetVolumes_GD").GetComponent<EffectRuleset>();
ER._material = gdRuleset._material;
var cloudMaterial = new Material(gdRuleset._cloudMaterial);
if (config.Atmosphere?.clouds?.tint != null)
{ {
cloudMaterial.SetColor(FogColor, config.Atmosphere.clouds.tint.ToColor()); EffectRuleset ER = rulesetGO.AddComponent<EffectRuleset>();
ER._type = EffectRuleset.BubbleType.Underwater;
ER._material = gdRuleset._material;
var cloudMaterial = new Material(gdRuleset._cloudMaterial);
if (config.Atmosphere?.clouds?.tint != null)
{
cloudMaterial.SetColor(FogColor, config.Atmosphere.clouds.tint.ToColor());
}
ER._cloudMaterial = cloudMaterial;
} }
ER._cloudMaterial = cloudMaterial;
if (config.Base.zeroGravityRadius != 0) if (config.Base.zeroGravityRadius != 0)
{ {

View File

@ -29,7 +29,7 @@ namespace NewHorizons.Builder.Body
public static void Make(GameObject planetGO, NewHorizonsBody body) public static void Make(GameObject planetGO, NewHorizonsBody body)
{ {
if (lavaMaterial == null) lavaMaterial = SearchUtilities.FindObjectOfTypeAndName<ProxyOrbiter>("VolcanicMoon_Body").transform.Find("LavaSphere").GetComponent<MeshRenderer>().material; if (lavaMaterial == null) lavaMaterial = SearchUtilities.FindObjectOfTypeAndName<ProxyOrbiter>("VolcanicMoon_Body")?.transform.Find("LavaSphere").GetComponent<MeshRenderer>().material;
var proxyName = $"{body.Config.name}_Proxy"; var proxyName = $"{body.Config.name}_Proxy";

View File

@ -6,7 +6,10 @@ namespace NewHorizons.Builder.General
{ {
public static void Make(GameObject planetGO, Sector sector, float scale, float intensity) public static void Make(GameObject planetGO, Sector sector, float scale, float intensity)
{ {
GameObject lightGO = GameObject.Instantiate(SearchUtilities.Find("BrittleHollow_Body/AmbientLight_BH_Surface"), sector?.transform ?? planetGO.transform); var bhAmbientLight = SearchUtilities.Find("BrittleHollow_Body/AmbientLight_BH_Surface");
if (bhAmbientLight == null) return;
GameObject lightGO = GameObject.Instantiate(bhAmbientLight, sector?.transform ?? planetGO.transform);
lightGO.transform.position = planetGO.transform.position; lightGO.transform.position = planetGO.transform.position;
lightGO.name = "Light"; lightGO.name = "Light";

View File

@ -0,0 +1,17 @@
using NewHorizons.Utility;
namespace NewHorizons.Components.Orbital
{
public class EyeAstroObject : AstroObject
{
public new void Awake()
{
_owRigidbody = GetComponent<OWRigidbody>();
}
public void Register()
{
Locator.RegisterAstroObject(this);
}
}
}

View File

@ -63,6 +63,7 @@ namespace NewHorizons.Components
// Conditions to allow warping into that system (either no planets (stock system) or has a ship spawn point) // Conditions to allow warping into that system (either no planets (stock system) or has a ship spawn point)
var flag = false; var flag = false;
if (starSystem.Equals("SolarSystem")) flag = true; if (starSystem.Equals("SolarSystem")) flag = true;
else if (starSystem.Equals("EyeOfTheUniverse")) flag = false;
else if (config.Spawn?.shipSpawnPoint != null) flag = true; else if (config.Spawn?.shipSpawnPoint != null) flag = true;
if (!StarChartHandler.HasUnlockedSystem(starSystem)) continue; if (!StarChartHandler.HasUnlockedSystem(starSystem)) continue;
@ -73,10 +74,8 @@ namespace NewHorizons.Components
} }
} }
//AddSystemCard("EyeOfTheUniverse"); /*
if(VesselCoordinatePromptHandler.KnowsEyeCoordinates())
/* Ship log manager isnt initiatiized yet
if(Locator.GetShipLogManager().IsFactRevealed("OPC_EYE_COORDINATES_X1"))
{ {
AddSystemCard("EyeOfTheUniverse"); AddSystemCard("EyeOfTheUniverse");
} }
@ -130,6 +129,10 @@ namespace NewHorizons.Components
{ {
texture = ImageUtilities.GetTexture(Main.Instance, "Assets/hearthian system.png"); texture = ImageUtilities.GetTexture(Main.Instance, "Assets/hearthian system.png");
} }
else if (uniqueID.Equals("EyeOfTheUniverse"))
{
texture = ImageUtilities.GetTexture(Main.Instance, "Assets/eye symbol.png");
}
else else
{ {
var path = $"planets/{uniqueID}.png"; var path = $"planets/{uniqueID}.png";

View File

@ -29,22 +29,24 @@ namespace NewHorizons.Components
{ {
_blackHolePrefab = SearchUtilities.Find(_blackHolePath); _blackHolePrefab = SearchUtilities.Find(_blackHolePath);
_whiteHolePrefab = SearchUtilities.Find(_whiteHolePath); _whiteHolePrefab = SearchUtilities.Find(_whiteHolePath);
MakeBlackHole();
MakeWhiteHole();
if (_oneShotSource == null)
{
var audioObject = new GameObject("WarpOneShot");
audioObject.transform.parent = transform;
audioObject.SetActive(false);
_oneShotSource = audioObject.AddComponent<OWAudioSource>();
_oneShotSource._track = OWAudioMixer.TrackName.Ship;
audioObject.SetActive(true);
}
} }
public void Start() public void Start()
{ {
MakeBlackHole();
MakeWhiteHole();
_isWarpingIn = false; _isWarpingIn = false;
var audioObject = new GameObject("WarpOneShot");
audioObject.transform.parent = transform;
audioObject.SetActive(false);
_oneShotSource = audioObject.AddComponent<OWAudioSource>();
_oneShotSource._track = OWAudioMixer.TrackName.Ship;
audioObject.SetActive(true);
GlobalMessenger.AddListener("FinishOpenEyes", new Callback(OnFinishOpenEyes)); GlobalMessenger.AddListener("FinishOpenEyes", new Callback(OnFinishOpenEyes));
} }
@ -55,6 +57,9 @@ namespace NewHorizons.Components
private void MakeBlackHole() private void MakeBlackHole()
{ {
if (_blackhole != null) return;
if (_blackHolePrefab == null) return;
var blackHoleShader = _blackHolePrefab.GetComponent<MeshRenderer>().material.shader; var blackHoleShader = _blackHolePrefab.GetComponent<MeshRenderer>().material.shader;
if (blackHoleShader == null) blackHoleShader = _blackHolePrefab.GetComponent<MeshRenderer>().sharedMaterial.shader; if (blackHoleShader == null) blackHoleShader = _blackHolePrefab.GetComponent<MeshRenderer>().sharedMaterial.shader;
@ -79,6 +84,9 @@ namespace NewHorizons.Components
private void MakeWhiteHole() private void MakeWhiteHole()
{ {
if (_whitehole != null) return;
if (_whiteHolePrefab == null) return;
var whiteHoleShader = _whiteHolePrefab.GetComponent<MeshRenderer>().material.shader; var whiteHoleShader = _whiteHolePrefab.GetComponent<MeshRenderer>().material.shader;
if (whiteHoleShader == null) whiteHoleShader = _whiteHolePrefab.GetComponent<MeshRenderer>().sharedMaterial.shader; if (whiteHoleShader == null) whiteHoleShader = _whiteHolePrefab.GetComponent<MeshRenderer>().sharedMaterial.shader;

View File

@ -32,33 +32,36 @@ namespace NewHorizons.Handlers
_existingBodyDict = new(); _existingBodyDict = new();
_customBodyDict = new(); _customBodyDict = new();
// Set up stars if (Main.Instance.CurrentStarSystem != "EyeOfTheUniverse")
// Need to manage this when there are multiple stars
var sun = SearchUtilities.Find("Sun_Body");
var starController = sun.AddComponent<StarController>();
starController.Light = SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<Light>();
starController.AmbientLight = SearchUtilities.Find("Sun_Body/AmbientLight_SUN").GetComponent<Light>();
starController.FaceActiveCamera = SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<FaceActiveCamera>();
starController.CSMTextureCacher = SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<CSMTextureCacher>();
starController.ProxyShadowLight = SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<ProxyShadowLight>();
starController.Intensity = 0.9859f;
starController.SunColor = new Color(1f, 0.8845f, 0.6677f, 1f);
var starLightGO = GameObject.Instantiate(sun.GetComponentInChildren<SunLightController>().gameObject);
foreach (var comp in starLightGO.GetComponents<Component>())
{ {
if (!(comp is SunLightController) && !(comp is SunLightParamUpdater) && !(comp is Light) && !(comp is Transform)) // Set up stars
// Need to manage this when there are multiple stars
var sun = SearchUtilities.Find("Sun_Body");
var starController = sun.AddComponent<StarController>();
starController.Light = SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<Light>();
starController.AmbientLight = SearchUtilities.Find("Sun_Body/AmbientLight_SUN").GetComponent<Light>();
starController.FaceActiveCamera = SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<FaceActiveCamera>();
starController.CSMTextureCacher = SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<CSMTextureCacher>();
starController.ProxyShadowLight = SearchUtilities.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<ProxyShadowLight>();
starController.Intensity = 0.9859f;
starController.SunColor = new Color(1f, 0.8845f, 0.6677f, 1f);
var starLightGO = GameObject.Instantiate(sun.GetComponentInChildren<SunLightController>().gameObject);
foreach (var comp in starLightGO.GetComponents<Component>())
{ {
GameObject.Destroy(comp); if (!(comp is SunLightController) && !(comp is SunLightParamUpdater) && !(comp is Light) && !(comp is Transform))
{
GameObject.Destroy(comp);
}
} }
GameObject.Destroy(starLightGO.GetComponent<Light>());
starLightGO.name = "StarLightController";
starLightGO.AddComponent<StarLightController>();
StarLightController.AddStar(starController);
starLightGO.SetActive(true);
} }
GameObject.Destroy(starLightGO.GetComponent<Light>());
starLightGO.name = "StarLightController";
starLightGO.AddComponent<StarLightController>();
StarLightController.AddStar(starController);
starLightGO.SetActive(true);
// Load all planets // Load all planets
var toLoad = bodies.ToList(); var toLoad = bodies.ToList();
@ -124,7 +127,7 @@ namespace NewHorizons.Handlers
// Events.FireOnNextUpdate(PlanetDestroyer.RemoveAllProxies); // Events.FireOnNextUpdate(PlanetDestroyer.RemoveAllProxies);
if (Main.SystemDict[Main.Instance.CurrentStarSystem].Config.destroyStockPlanets) PlanetDestructionHandler.RemoveSolarSystem(); if (Main.SystemDict[Main.Instance.CurrentStarSystem].Config.destroyStockPlanets) PlanetDestructionHandler.RemoveStockPlanets();
} }
public static bool LoadBody(NewHorizonsBody body, bool defaultPrimaryToSun = false) public static bool LoadBody(NewHorizonsBody body, bool defaultPrimaryToSun = false)

View File

@ -31,12 +31,26 @@ namespace NewHorizons.Handlers
"White Hole" "White Hole"
}; };
private static readonly string[] _eyeOfTheUniverseBodies = new string[]
{
"Eye Of The Universe",
"Vessel"
};
private static readonly string[] _suspendBlacklist = new string[] private static readonly string[] _suspendBlacklist = new string[]
{ {
"Player_Body", "Player_Body",
"Ship_Body" "Ship_Body"
}; };
public static void RemoveStockPlanets()
{
if (Main.Instance.CurrentStarSystem == "EyeOfTheUniverse")
RemoveEyeOfTheUniverse();
else
RemoveSolarSystem();
}
public static void RemoveSolarSystem() public static void RemoveSolarSystem()
{ {
// Stop the sun from killing the player // Stop the sun from killing the player
@ -54,6 +68,16 @@ namespace NewHorizons.Handlers
Delay.FireInNUpdates(() => { if (Locator.GetAstroObject(AstroObject.Name.Sun).gameObject.activeInHierarchy) { sunVolumes.SetActive(true); } }, 3); Delay.FireInNUpdates(() => { if (Locator.GetAstroObject(AstroObject.Name.Sun).gameObject.activeInHierarchy) { sunVolumes.SetActive(true); } }, 3);
} }
public static void RemoveEyeOfTheUniverse()
{
foreach (var name in _eyeOfTheUniverseBodies)
{
var ao = AstroObjectLocator.GetAstroObject(name);
if (ao != null) Delay.FireInNUpdates(() => RemoveBody(ao, false), 2);
else Logger.LogError($"Couldn't find [{name}]");
}
}
public static void RemoveBody(AstroObject ao, bool delete = false, List<AstroObject> toDestroy = null) public static void RemoveBody(AstroObject ao, bool delete = false, List<AstroObject> toDestroy = null)
{ {
Logger.LogVerbose($"Removing [{ao.name}]"); Logger.LogVerbose($"Removing [{ao.name}]");

View File

@ -40,6 +40,12 @@ namespace NewHorizons.Handlers
SunConfig.name = "Sun"; SunConfig.name = "Sun";
_rootNode = ConstructGraph(new NewHorizonsBody(SunConfig, Main.Instance), bodies); _rootNode = ConstructGraph(new NewHorizonsBody(SunConfig, Main.Instance), bodies);
} }
else if (centers.Length == 0 && Main.Instance.CurrentStarSystem == "EyeOfTheUniverse")
{
var EyeConfig = new PlanetConfig();
EyeConfig.name = "Eye Of The Universe";
_rootNode = ConstructGraph(new NewHorizonsBody(EyeConfig, Main.Instance), bodies);
}
else else
{ {
Logger.LogError($"There must be one and only one centerOfSolarSystem! Found [{centers.Length}]"); Logger.LogError($"There must be one and only one centerOfSolarSystem! Found [{centers.Length}]");

View File

@ -108,5 +108,13 @@ namespace NewHorizons.Handlers
{ {
return _nhBodyToAstroIDs.ContainsKey(body) && _nhBodyToAstroIDs[body].Length > 0; return _nhBodyToAstroIDs.ContainsKey(body) && _nhBodyToAstroIDs[body].Length > 0;
} }
public static bool KnowsFact(string fact)
{
// Works normally in the main system, else check save data directly
var shipLogManager = Locator.GetShipLogManager();
if (Main.Instance.CurrentStarSystem == "SolarSystem" && shipLogManager != null) return shipLogManager.IsFactRevealed(fact);
else return PlayerData._currentGameSave.shipLogFactSaves.ContainsKey(fact) && PlayerData._currentGameSave.shipLogFactSaves[fact].revealOrder > -1;
}
} }
} }

View File

@ -25,6 +25,9 @@ namespace NewHorizons.Handlers
SkyboxBuilder.Make(system.Config.Skybox, system.Mod); SkyboxBuilder.Make(system.Config.Skybox, system.Mod);
} }
if (Main.Instance.CurrentStarSystem == "EyeOfTheUniverse") return;
if (system.Config.enableTimeLoop) if (system.Config.enableTimeLoop)
{ {
var timeLoopController = new GameObject("TimeLoopController"); var timeLoopController = new GameObject("TimeLoopController");

View File

@ -44,6 +44,7 @@ namespace NewHorizons.Handlers
{ {
var texture = MakeTexture(coords.x, coords.y, coords.z); var texture = MakeTexture(coords.x, coords.y, coords.z);
if (_textureCache == null) _textureCache = new List<Texture2D>();
_textureCache.Add(texture); _textureCache.Add(texture);
var sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(texture.width / 2f, texture.height / 2f)); var sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(texture.width / 2f, texture.height / 2f));
@ -61,27 +62,31 @@ namespace NewHorizons.Handlers
// Gets called from the patches // Gets called from the patches
public static void SetPromptVisibility(bool visible) public static void SetPromptVisibility(bool visible)
{ {
if (_factSystemIDPrompt == null) return;
foreach (var pair in _factSystemIDPrompt) foreach (var pair in _factSystemIDPrompt)
{ {
var fact = pair.Item1; var fact = pair.Item1;
var systemID = pair.Item2; var systemID = pair.Item2;
var prompt = pair.Item3; var prompt = pair.Item3;
if (visible) if (prompt != null)
{ {
if (Main.Instance.CurrentStarSystem != systemID && (string.IsNullOrEmpty(fact) || Locator.GetShipLogManager().IsFactRevealed(fact))) if (visible)
{ {
prompt.SetVisibility(true); if (Main.Instance.CurrentStarSystem != systemID && (string.IsNullOrEmpty(fact) || ShipLogHandler.KnowsFact(fact)))
{
prompt.SetVisibility(true);
}
else
{
prompt.SetVisibility(false);
}
} }
else else
{ {
prompt.SetVisibility(false); prompt.SetVisibility(false);
} }
} }
else
{
prompt.SetVisibility(false);
}
} }
} }
@ -191,11 +196,6 @@ namespace NewHorizons.Handlers
} }
} }
public static bool KnowsEyeCoordinates() public static bool KnowsEyeCoordinates() => ShipLogHandler.KnowsFact("OPC_EYE_COORDINATES_X1");
{
// Works normally in the main system, else check save data directly
if (Main.Instance.CurrentStarSystem == "SolarSystem") return Locator.GetShipLogManager().IsFactRevealed("OPC_EYE_COORDINATES_X1");
else return PlayerData._currentGameSave.shipLogFactSaves.ContainsKey("OPC_EYE_COORDINATES_X1") && PlayerData._currentGameSave.shipLogFactSaves["OPC_EYE_COORDINATES_X1"].revealOrder > -1;
}
} }
} }

View File

@ -4,6 +4,7 @@ using NewHorizons.Builder.Atmosphere;
using NewHorizons.Builder.Body; using NewHorizons.Builder.Body;
using NewHorizons.Builder.Props; using NewHorizons.Builder.Props;
using NewHorizons.Components; using NewHorizons.Components;
using NewHorizons.Components.Orbital;
using NewHorizons.External; using NewHorizons.External;
using NewHorizons.External.Configs; using NewHorizons.External.Configs;
using NewHorizons.Handlers; using NewHorizons.Handlers;
@ -58,7 +59,7 @@ namespace NewHorizons
public static bool HasWarpDrive { get; private set; } = false; public static bool HasWarpDrive { get; private set; } = false;
private string _defaultStarSystem = "SolarSystem"; private string _defaultStarSystem = "SolarSystem";
private string _currentStarSystem = "SolarSystem"; internal string _currentStarSystem = "SolarSystem";
private bool _firstLoad = true; private bool _firstLoad = true;
private ShipWarpController _shipWarpController; private ShipWarpController _shipWarpController;
@ -144,13 +145,15 @@ namespace NewHorizons
{ {
Config = Config =
{ {
destroyStockPlanets = false,
factRequiredForWarp = "OPC_EYE_COORDINATES_X1",
Vessel = new StarSystemConfig.VesselModule() Vessel = new StarSystemConfig.VesselModule()
{ {
coords = new StarSystemConfig.NomaiCoordinates coords = new StarSystemConfig.NomaiCoordinates
{ {
x = new int[3]{ 1,5,4 }, x = new int[3] { 1, 5, 4 },
y = new int[4]{ 3,0,1,4 }, y = new int[4] { 3, 0, 1, 4 },
z = new int[6]{ 1,2,3,0,5,4 } z = new int[6] { 1, 2, 3, 0, 5, 4 }
} }
} }
} }
@ -231,6 +234,7 @@ namespace NewHorizons
var isTitleScreen = scene.name == "TitleScreen"; var isTitleScreen = scene.name == "TitleScreen";
var isSolarSystem = scene.name == "SolarSystem"; var isSolarSystem = scene.name == "SolarSystem";
var isEyeOfTheUniverse = scene.name == "EyeOfTheUniverse"; var isEyeOfTheUniverse = scene.name == "EyeOfTheUniverse";
if (isEyeOfTheUniverse) _currentStarSystem = scene.name;
if (!SystemDict.ContainsKey(_currentStarSystem) || !BodyDict.ContainsKey(_currentStarSystem)) if (!SystemDict.ContainsKey(_currentStarSystem) || !BodyDict.ContainsKey(_currentStarSystem))
{ {
@ -268,24 +272,55 @@ namespace NewHorizons
TitleSceneHandler.InitSubtitles(); TitleSceneHandler.InitSubtitles();
} }
if (isEyeOfTheUniverse && IsWarpingFromShip) if (isSolarSystem && _ship == null)
{ {
if (_ship != null) var ship = SearchUtilities.Find("Ship_Body", false);
if (ship != null)
{ {
SceneManager.MoveGameObjectToScene(_ship, SceneManager.GetActiveScene()); _ship = ship.InstantiateInactive();
_ship.transform.position = new Vector3(50, 0, 0); _ship.name = ship.name;
_ship.SetActive(true); _ship.AddComponent<ShipWarpController>().Init();
DontDestroyOnLoad(_ship);
}
}
if (isEyeOfTheUniverse)
{
var eyeOfTheUniverse = SearchUtilities.Find("EyeOfTheUniverse_Body");
var eyeSector = eyeOfTheUniverse.FindChild("Sector_EyeOfTheUniverse").GetComponent<Sector>();
var eyeAO = eyeOfTheUniverse.AddComponent<EyeAstroObject>();
eyeAO._owRigidbody = eyeOfTheUniverse.GetAttachedOWRigidbody();
eyeAO._rootSector = eyeSector;
eyeAO._gravityVolume = eyeSector.GetComponentInChildren<GravityVolume>();
eyeAO._customName = "Eye Of The Universe";
eyeAO._name = AstroObject.Name.Eye;
eyeAO._type = AstroObject.Type.None;
eyeAO.Register();
var vessel = SearchUtilities.Find("Vessel_Body");
var vesselSector = vessel.FindChild("Sector_VesselBridge").GetComponent<Sector>();
var vesselAO = vessel.AddComponent<EyeAstroObject>();
vesselAO._owRigidbody = vessel.GetAttachedOWRigidbody();
vesselAO._primaryBody = eyeAO;
eyeAO._satellite = vesselAO;
vesselAO._rootSector = vesselSector;
vesselAO._customName = "Vessel";
vesselAO._name = AstroObject.Name.CustomString;
vesselAO._type = AstroObject.Type.SpaceStation;
vesselAO.Register();
if (IsWarpingFromShip && _ship != null)
{
var eyeShip = GameObject.Instantiate(_ship);
eyeShip.name = "Ship_Body";
_shipWarpController = eyeShip.GetComponent<ShipWarpController>();
SceneManager.MoveGameObjectToScene(eyeShip, scene);
eyeShip.SetActive(true);
} }
} }
if (isSolarSystem || isEyeOfTheUniverse) if (isSolarSystem || isEyeOfTheUniverse)
{ {
if (_ship != null)
{
_ship = SearchUtilities.Find("Ship_Body").InstantiateInactive();
DontDestroyOnLoad(_ship);
}
IsSystemReady = false; IsSystemReady = false;
NewHorizonsData.Load(); NewHorizonsData.Load();
@ -300,13 +335,9 @@ namespace NewHorizons
AtmosphereBuilder.Init(); AtmosphereBuilder.Init();
BrambleNodeBuilder.Init(BodyDict[CurrentStarSystem].Select(x => x.Config).Where(x => x.Bramble?.dimension != null).ToArray()); BrambleNodeBuilder.Init(BodyDict[CurrentStarSystem].Select(x => x.Config).Where(x => x.Bramble?.dimension != null).ToArray());
if (isSolarSystem) PlanetCreationHandler.Init(BodyDict[CurrentStarSystem]);
{ if (isSolarSystem) VesselWarpHandler.LoadVessel();
PlanetCreationHandler.Init(BodyDict[CurrentStarSystem]); SystemCreationHandler.LoadSystem(SystemDict[CurrentStarSystem]);
VesselWarpHandler.LoadVessel();
SystemCreationHandler.LoadSystem(SystemDict[CurrentStarSystem]);
}
LoadTranslations(ModHelper.Manifest.ModFolderPath + "Assets/", this); LoadTranslations(ModHelper.Manifest.ModFolderPath + "Assets/", this);
@ -315,8 +346,11 @@ namespace NewHorizons
{ {
// Warp drive // Warp drive
HasWarpDrive = StarChartHandler.CanWarp(); HasWarpDrive = StarChartHandler.CanWarp();
_shipWarpController = SearchUtilities.Find("Ship_Body").AddComponent<ShipWarpController>(); if (_shipWarpController == null)
_shipWarpController.Init(); {
_shipWarpController = SearchUtilities.Find("Ship_Body").AddComponent<ShipWarpController>();
_shipWarpController.Init();
}
if (HasWarpDrive == true) EnableWarpDrive(); if (HasWarpDrive == true) EnableWarpDrive();
var shouldWarpInFromShip = IsWarpingFromShip && _shipWarpController != null; var shouldWarpInFromShip = IsWarpingFromShip && _shipWarpController != null;
@ -380,6 +414,16 @@ namespace NewHorizons
var remoteViewer = SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_NorthHemisphere/Sector_NorthPole/Sector_NorthPoleSurface/Interactables_NorthPoleSurface/LowBuilding/Prefab_NOM_RemoteViewer").GetComponent<NomaiRemoteCameraPlatform>(); var remoteViewer = SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_NorthHemisphere/Sector_NorthPole/Sector_NorthPoleSurface/Interactables_NorthPoleSurface/LowBuilding/Prefab_NOM_RemoteViewer").GetComponent<NomaiRemoteCameraPlatform>();
remoteViewer._visualSector = northPoleSurface; remoteViewer._visualSector = northPoleSurface;
} }
else if (isEyeOfTheUniverse)
{
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() =>
{
IsSystemReady = true;
OnSystemReady(false, false);
});
IsWarpingFromShip = false;
IsWarpingFromVessel = false;
}
//Stop starfield from disappearing when there is no lights //Stop starfield from disappearing when there is no lights
var playerBody = SearchUtilities.Find("Player_Body"); var playerBody = SearchUtilities.Find("Player_Body");
@ -629,6 +673,8 @@ namespace NewHorizons
} }
else else
{ {
PlayerData.SaveEyeCompletion();
if (SystemDict[_currentStarSystem].Config.enableTimeLoop) SecondsElapsedInLoop = TimeLoop.GetSecondsElapsed(); if (SystemDict[_currentStarSystem].Config.enableTimeLoop) SecondsElapsedInLoop = TimeLoop.GetSecondsElapsed();
else SecondsElapsedInLoop = -1; else SecondsElapsedInLoop = -1;

View File

@ -1,4 +1,4 @@
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Patches namespace NewHorizons.Patches
{ {
@ -13,6 +13,13 @@ namespace NewHorizons.Patches
return (Main.Instance.CurrentStarSystem != "EyeOfTheUniverse"); return (Main.Instance.CurrentStarSystem != "EyeOfTheUniverse");
} }
[HarmonyPrefix]
[HarmonyPatch(typeof(SubmitActionLoadScene), nameof(SubmitActionLoadScene.ConfirmSubmit))]
public static void SubmitActionLoadScene_ConfirmSubmit(SubmitActionLoadScene __instance)
{
if (__instance._sceneToLoad == SubmitActionLoadScene.LoadableScenes.EYE) Main.Instance._currentStarSystem = "EyeOfTheUniverse";
}
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(ShipThrusterController), nameof(ShipThrusterController.ReadTranslationalInput))] [HarmonyPatch(typeof(ShipThrusterController), nameof(ShipThrusterController.ReadTranslationalInput))]
public static bool ShipThrusterController_ReadTranslationalInput(ShipThrusterController __instance, ref Vector3 __result) public static bool ShipThrusterController_ReadTranslationalInput(ShipThrusterController __instance, ref Vector3 __result)

View File

@ -1,9 +1,13 @@
using HarmonyLib; using HarmonyLib;
using NewHorizons.Components;
namespace NewHorizons.Patches namespace NewHorizons.Patches
{ {
[HarmonyPatch] [HarmonyPatch]
public static class LocatorPatches public static class LocatorPatches
{ {
public static AstroObject _eye;
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(Locator), nameof(Locator.RegisterCloakFieldController))] [HarmonyPatch(typeof(Locator), nameof(Locator.RegisterCloakFieldController))]
public static bool Locator_RegisterCloakFieldController() public static bool Locator_RegisterCloakFieldController()
@ -31,5 +35,36 @@ namespace NewHorizons.Patches
{ {
__result = __result || Components.CloakSectorController.isShipInside; __result = __result || Components.CloakSectorController.isShipInside;
} }
[HarmonyPrefix]
[HarmonyPatch(typeof(Locator), nameof(Locator.GetAstroObject))]
public static bool Locator_GetAstroObject(AstroObject.Name astroObjectName, ref AstroObject __result)
{
if (astroObjectName == AstroObject.Name.Eye && _eye != null)
{
__result = _eye;
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Locator), nameof(Locator.RegisterAstroObject))]
public static bool Locator_RegisterAstroObject(AstroObject astroObject)
{
if (astroObject._name == AstroObject.Name.Eye)
{
_eye = astroObject;
return false;
}
return true;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Locator), nameof(Locator.ClearReferences))]
public static void Locator_ClearReferences()
{
_eye = null;
}
} }
} }

View File

@ -48,7 +48,7 @@ namespace NewHorizons.Patches
{ {
bool canWarpToEye = __instance._coordinateInterface.CheckEyeCoordinates(); bool canWarpToEye = __instance._coordinateInterface.CheckEyeCoordinates();
bool canWarpToStarSystem = __instance._coordinateInterface.CheckAllCoordinates(out string targetSystem); bool canWarpToStarSystem = __instance._coordinateInterface.CheckAllCoordinates(out string targetSystem);
if (slot == __instance._warpVesselSlot && __instance._hasPower && (canWarpToEye || (canWarpToStarSystem && targetSystem != Main.Instance.CurrentStarSystem)) && __instance._blackHole.GetState() == SingularityController.State.Collapsed && LoadManager.GetCurrentScene() != OWScene.EyeOfTheUniverse) if (slot == __instance._warpVesselSlot && __instance._hasPower && ((canWarpToEye && Main.Instance.CurrentStarSystem != "EyeOfTheUniverse") || (canWarpToStarSystem && targetSystem != Main.Instance.CurrentStarSystem)) && __instance._blackHole.GetState() == SingularityController.State.Collapsed)
{ {
__instance._blackHole.Create(); __instance._blackHole.Create();
RumbleManager.StartVesselWarp(); RumbleManager.StartVesselWarp();
@ -56,7 +56,10 @@ namespace NewHorizons.Patches
__instance.enabled = true; __instance.enabled = true;
Locator.GetPauseCommandListener().AddPauseCommandLock(); Locator.GetPauseCommandListener().AddPauseCommandLock();
if (canWarpToEye || (canWarpToStarSystem && targetSystem == "EyeOfTheUniverse")) if (canWarpToEye || (canWarpToStarSystem && targetSystem == "EyeOfTheUniverse"))
{
Main.Instance._currentStarSystem = "EyeOfTheUniverse";
LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, false, LoadManager.FadeType.ToWhite); LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, false, LoadManager.FadeType.ToWhite);
}
else if (canWarpToStarSystem) else if (canWarpToStarSystem)
Main.Instance.ChangeCurrentStarSystem(targetSystem, false, true); Main.Instance.ChangeCurrentStarSystem(targetSystem, false, true);
__instance._blackHoleOneShot.PlayOneShot(AudioType.VesselSingularityCreate); __instance._blackHoleOneShot.PlayOneShot(AudioType.VesselSingularityCreate);

View File

@ -1,4 +1,4 @@
using HarmonyLib; using HarmonyLib;
using NewHorizons.Components.Orbital; using NewHorizons.Components.Orbital;
using NewHorizons.Handlers; using NewHorizons.Handlers;
using System; using System;
@ -16,14 +16,18 @@ namespace NewHorizons.Patches
if (ao == null || ao._name != AstroObject.Name.CustomString) return true; if (ao == null || ao._name != AstroObject.Name.CustomString) return true;
if (ao is NHAstroObject) __result = string.Empty;
if (ao is NHAstroObject nhao && nhao.HideDisplayName) return false;
var customName = ao.GetCustomName();
if (!string.IsNullOrWhiteSpace(customName))
{ {
if ((ao as NHAstroObject).HideDisplayName) __result = ""; __result = TranslationHandler.GetTranslation(customName, TranslationHandler.TextType.UI);
else __result = TranslationHandler.GetTranslation(ao.GetCustomName(), TranslationHandler.TextType.UI);
return false;
} }
return true; return false;
} }
[HarmonyPostfix] [HarmonyPostfix]

View File

@ -35,6 +35,7 @@ namespace NewHorizons.Utility
if (stringID.Equals("ASH_TWIN")) stringID = "TOWER_TWIN"; if (stringID.Equals("ASH_TWIN")) stringID = "TOWER_TWIN";
if (stringID.Equals("EMBER_TWIN")) stringID = "CAVE_TWIN"; if (stringID.Equals("EMBER_TWIN")) stringID = "CAVE_TWIN";
if (stringID.Equals("INTERLOPER")) stringID = "COMET"; if (stringID.Equals("INTERLOPER")) stringID = "COMET";
if (stringID.Equals("EYE")) stringID = "EYE_OF_THE_UNIVERSE";
string key; string key;
if (stringID.ToUpper().Replace("_", "").Equals("MAPSATELLITE")) if (stringID.ToUpper().Replace("_", "").Equals("MAPSATELLITE"))