diff --git a/NewHorizons/Builder/Atmosphere/AirBuilder.cs b/NewHorizons/Builder/Atmosphere/AirBuilder.cs index 8d502f88..979bd933 100644 --- a/NewHorizons/Builder/Atmosphere/AirBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/AirBuilder.cs @@ -22,7 +22,7 @@ namespace NewHorizons.Builder.Atmosphere sfv._priority = 0; sfv._density = 1.2f; sfv._fluidType = FluidVolume.Type.AIR; - sfv._allowShipAutoroll = true; + sfv._allowShipAutoroll = config.Atmosphere.allowShipAutoroll; sfv._disableOnStart = false; if (config.Atmosphere.hasShockLayer) diff --git a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs index ceef7fd5..5e998cf3 100644 --- a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs @@ -147,7 +147,7 @@ namespace NewHorizons.Builder.Atmosphere fluidCLFV._priority = 1; fluidCLFV._density = 1.2f; fluidCLFV._fluidType = atmo.clouds.fluidType.ConvertToOW(FluidVolume.Type.CLOUD); - fluidCLFV._allowShipAutoroll = true; + fluidCLFV._allowShipAutoroll = atmo.allowShipAutoroll; fluidCLFV._disableOnStart = false; // Fix the rotations once the rest is done diff --git a/NewHorizons/Builder/Body/ProxyBuilder.cs b/NewHorizons/Builder/Body/ProxyBuilder.cs index c788c3b2..f1567659 100644 --- a/NewHorizons/Builder/Body/ProxyBuilder.cs +++ b/NewHorizons/Builder/Body/ProxyBuilder.cs @@ -96,6 +96,12 @@ namespace NewHorizons.Builder.Body // We want to take the largest size I think var realSize = body.Config.Base.surfaceSize; + if (realSize <= 0) + { + // #941 handle proxy body edge case when all scales = 0 + realSize = 1; + } + if (body.Config.HeightMap != null) { HeightMapBuilder.Make(proxy, null, body.Config.HeightMap, body.Mod, 20); diff --git a/NewHorizons/Builder/Body/WaterBuilder.cs b/NewHorizons/Builder/Body/WaterBuilder.cs index 8eba73c0..b53b4617 100644 --- a/NewHorizons/Builder/Body/WaterBuilder.cs +++ b/NewHorizons/Builder/Body/WaterBuilder.cs @@ -129,7 +129,7 @@ namespace NewHorizons.Builder.Body fluidVolume._density = module.density; fluidVolume._layer = 5; fluidVolume._priority = 3; - fluidVolume._allowShipAutoroll = true; + fluidVolume._allowShipAutoroll = module.allowShipAutoroll; fluidVolume._disableOnStart = false; var fogGO = Object.Instantiate(_oceanFog, waterGO.transform); diff --git a/NewHorizons/Builder/General/AstroObjectBuilder.cs b/NewHorizons/Builder/General/AstroObjectBuilder.cs index 21be3536..15f00d62 100644 --- a/NewHorizons/Builder/General/AstroObjectBuilder.cs +++ b/NewHorizons/Builder/General/AstroObjectBuilder.cs @@ -8,6 +8,8 @@ namespace NewHorizons.Builder.General { public static class AstroObjectBuilder { + public static GameObject CenterOfUniverse { get; private set; } + public static NHAstroObject Make(GameObject body, AstroObject primaryBody, NewHorizonsBody nhBody, bool isVanilla) { NHAstroObject astroObject = body.AddComponent(); @@ -17,7 +19,7 @@ namespace NewHorizons.Builder.General astroObject.isVanilla = isVanilla; astroObject.HideDisplayName = !config.MapMarker.enabled; - astroObject.invulnerableToSun = config.Base.invulnerableToSun; + astroObject.invulnerableToSun = !config.Base.hasFluidDetector; if (config.Orbit != null) astroObject.SetOrbitalParametersFromConfig(config.Orbit); @@ -62,6 +64,8 @@ namespace NewHorizons.Builder.General if (config.Base.centerOfSolarSystem) { + CenterOfUniverse = body; + NHLogger.Log($"Setting center of universe to {config.name}"); Delay.RunWhen( diff --git a/NewHorizons/Builder/General/DetectorBuilder.cs b/NewHorizons/Builder/General/DetectorBuilder.cs index 4a62d5b6..034a7e07 100644 --- a/NewHorizons/Builder/General/DetectorBuilder.cs +++ b/NewHorizons/Builder/General/DetectorBuilder.cs @@ -90,7 +90,7 @@ namespace NewHorizons.Builder.General OWRB.RegisterAttachedForceDetector(forceDetector); // For falling into sun - if (!config.Base.invulnerableToSun && config.Star == null && config.FocalPoint == null) + if (config.Base.hasFluidDetector && config.Star == null && config.FocalPoint == null) { detectorGO.layer = Layer.AdvancedDetector; diff --git a/NewHorizons/Builder/General/SpawnPointBuilder.cs b/NewHorizons/Builder/General/SpawnPointBuilder.cs index b047a69b..f5ad5728 100644 --- a/NewHorizons/Builder/General/SpawnPointBuilder.cs +++ b/NewHorizons/Builder/General/SpawnPointBuilder.cs @@ -4,6 +4,7 @@ using NewHorizons.Utility; using NewHorizons.Utility.OuterWilds; using NewHorizons.Utility.OWML; using System; +using System.Collections; using System.Linq; using System.Reflection; using UnityEngine; @@ -126,8 +127,22 @@ namespace NewHorizons.Builder.General handler.Method.Invoke(handler.Target, new object[] { command }); } spv._interactVolume._listInteractions.First(x => x.promptText == UITextType.SuitUpPrompt).interactionEnabled = true; + + // Fix Disappearing Signalscope UI #934 after warping to new system wearing suit + Delay.StartCoroutine(SignalScopeZoomCoroutine()); } } } + + private static IEnumerator SignalScopeZoomCoroutine() + { + while (!Locator.GetToolModeSwapper().GetSignalScope().InZoomMode()) + { + yield return new WaitForEndOfFrame(); + } + yield return null; + Locator.GetToolModeSwapper().GetSignalScope().ExitSignalscopeZoom(); + Locator.GetToolModeSwapper().GetSignalScope().EnterSignalscopeZoom(); + } } } diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index 89d0887b..e49feeee 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -1,5 +1,6 @@ using NewHorizons.Builder.General; using NewHorizons.Components; +using NewHorizons.Components.Orbital; using NewHorizons.Components.Props; using NewHorizons.External.Modules.Props; using NewHorizons.Handlers; @@ -67,6 +68,8 @@ namespace NewHorizons.Builder.Props /// public static GameObject Make(GameObject planetGO, Sector sector, IModBehaviour mod, DetailInfo info) { + if (sector == null) info.keepLoaded = true; + if (info.assetBundle != null) { // Shouldn't happen @@ -98,6 +101,8 @@ namespace NewHorizons.Builder.Props { if (prefab == null) return null; + if (sector == null) detail.keepLoaded = true; + GameObject prop; bool isItem; bool invalidComponentFound = false; @@ -370,6 +375,12 @@ namespace NewHorizons.Builder.Props // Fix anglerfish speed on orbiting planets else if (component is AnglerfishController angler) { + if (planetGO?.GetComponent() is NHAstroObject nhao && !nhao.invulnerableToSun) + { + // Has a fluid detector, will go gorp (#830) + NHLogger.LogWarning("Having an anglerfish on a planet that has a fluid detector can lead to things breaking!"); + } + try { angler._chaseSpeed += OWPhysics.CalculateOrbitVelocity(planetGO.GetAttachedOWRigidbody(), planetGO.GetComponent().GetPrimaryBody().GetAttachedOWRigidbody()).magnitude; diff --git a/NewHorizons/External/Configs/AddonConfig.cs b/NewHorizons/External/Configs/AddonConfig.cs index cfcc731b..a3e39452 100644 --- a/NewHorizons/External/Configs/AddonConfig.cs +++ b/NewHorizons/External/Configs/AddonConfig.cs @@ -41,6 +41,7 @@ namespace NewHorizons.External.Configs /// /// The path to the addons subtitle for the main menu. /// Defaults to "subtitle.png". + /// The dimensions of the Echos of the Eye subtitle is 669 x 67, so aim for that size /// public string subtitlePath = "subtitle.png"; } diff --git a/NewHorizons/External/Configs/PlanetConfig.cs b/NewHorizons/External/Configs/PlanetConfig.cs index f64b7b13..723b36b0 100644 --- a/NewHorizons/External/Configs/PlanetConfig.cs +++ b/NewHorizons/External/Configs/PlanetConfig.cs @@ -279,7 +279,7 @@ namespace NewHorizons.External.Configs } // Stars and focal points shouldnt be destroyed by stars - if (Star != null || FocalPoint != null) Base.invulnerableToSun = true; + if (Star != null || FocalPoint != null) Base.hasFluidDetector = false; } public void Migrate() @@ -678,6 +678,11 @@ namespace NewHorizons.External.Configs if (destructionVolume.onlyAffectsPlayerAndShip) destructionVolume.onlyAffectsPlayerRelatedBodies = true; } } + + if (Base.invulnerableToSun) + { + Base.hasFluidDetector = false; + } } #endregion } diff --git a/NewHorizons/External/Modules/AtmosphereModule.cs b/NewHorizons/External/Modules/AtmosphereModule.cs index e318f372..eb31dac2 100644 --- a/NewHorizons/External/Modules/AtmosphereModule.cs +++ b/NewHorizons/External/Modules/AtmosphereModule.cs @@ -107,6 +107,12 @@ namespace NewHorizons.External.Modules /// [DefaultValue(300f)] public float maxShockSpeed = 300f; + /// + /// Will the ship automatically try to orient itself to face upwards while in this volume? + /// + [DefaultValue(true)] + public bool allowShipAutoroll = true; + [JsonObject] public class CloudInfo { diff --git a/NewHorizons/External/Modules/BaseModule.cs b/NewHorizons/External/Modules/BaseModule.cs index 78a41fee..01ddd024 100644 --- a/NewHorizons/External/Modules/BaseModule.cs +++ b/NewHorizons/External/Modules/BaseModule.cs @@ -37,9 +37,11 @@ namespace NewHorizons.External.Modules public float groundSize; /// - /// Can this planet survive entering a star? + /// Is this planet able to detect fluid volumes? Disabling this means that entering a star or lava volume will not destroy this planet + /// May have adverse effects if anglerfish are added to this planet, disable this if you want those to work (they have fluid volumes in their mouths) /// - public bool invulnerableToSun; + [DefaultValue(true)] + public bool hasFluidDetector = true; /// /// Do we show the minimap when walking around this planet? @@ -58,6 +60,8 @@ namespace NewHorizons.External.Modules /// /// A scale height used for a number of things. Should be the approximate radius of the body. + /// + /// Affected settings include: Base sector size, proxy body scaling, surface gravity /// public float surfaceSize; @@ -82,6 +86,9 @@ namespace NewHorizons.External.Modules #region Obsolete + [Obsolete("invulnerableToSun is deprecated, please use hasFluidDetector instead")] + public bool invulnerableToSun; + [Obsolete("IsSatellite is deprecated, please use ShowMinimap instead")] public bool isSatellite; diff --git a/NewHorizons/External/Modules/Props/DetailInfo.cs b/NewHorizons/External/Modules/Props/DetailInfo.cs index 171f1b64..9cc8feb0 100644 --- a/NewHorizons/External/Modules/Props/DetailInfo.cs +++ b/NewHorizons/External/Modules/Props/DetailInfo.cs @@ -56,6 +56,7 @@ namespace NewHorizons.External.Modules.Props /// /// Should this detail stay loaded (visible and collideable) even if you're outside the sector (good for very large props)? /// Also makes this detail visible on the map. + /// Keeping many props loaded is bad for performance so use this only when it's actually relevant /// Most logic/behavior scripts will still only work inside the sector, as most of those scripts break if a sector is not provided. /// public bool keepLoaded; diff --git a/NewHorizons/External/Modules/VariableSize/WaterModule.cs b/NewHorizons/External/Modules/VariableSize/WaterModule.cs index 3443f162..d28ffb7c 100644 --- a/NewHorizons/External/Modules/VariableSize/WaterModule.cs +++ b/NewHorizons/External/Modules/VariableSize/WaterModule.cs @@ -26,5 +26,11 @@ namespace NewHorizons.External.Modules.VariableSize /// Tint of the water /// public MColor tint; + + /// + /// Will the ship automatically try to orient itself to face upwards while in this volume? + /// + [DefaultValue(true)] + public bool allowShipAutoroll = true; } } \ No newline at end of file diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 44d083c4..42fd5533 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -421,8 +421,8 @@ namespace NewHorizons.Handlers if (defaultPrimaryToSun) { NHLogger.LogError($"Couldn't find {body.Config.Orbit.primaryBody}, defaulting to center of solar system"); - // TODO: Make this work in other systems. We tried using Locator.GetCenterOfUniverse before but that doesn't work since its too early now - primaryBody = SearchUtilities.Find("Sun_Body")?.GetComponent(); + // Fix #933 not defaulting primary body + primaryBody = (SearchUtilities.Find("Sun_Body") ?? AstroObjectBuilder.CenterOfUniverse)?.GetComponent(); } else { diff --git a/NewHorizons/Handlers/SubtitlesHandler.cs b/NewHorizons/Handlers/SubtitlesHandler.cs index d3fe3fb8..1a42bc79 100644 --- a/NewHorizons/Handlers/SubtitlesHandler.cs +++ b/NewHorizons/Handlers/SubtitlesHandler.cs @@ -1,3 +1,4 @@ +using NewHorizons.Utility; using NewHorizons.Utility.Files; using NewHorizons.Utility.OWML; using OWML.Common; @@ -31,6 +32,8 @@ namespace NewHorizons.Handlers private static List<(IModBehaviour mod, string filePath)> _additionalSubtitles = new(); + private CanvasGroup _titleCanvasGroup; + public static void RegisterAdditionalSubtitle(IModBehaviour mod, string filePath) { _additionalSubtitles.Add((mod, filePath)); @@ -64,6 +67,8 @@ namespace NewHorizons.Handlers var layout = GetComponent(); layout.minHeight = SUBTITLE_HEIGHT; + _titleCanvasGroup = SearchUtilities.Find("TitleCanvas").GetComponent(); + CheckForEOTE(); // We add our subtitles as a child object so that their sizing doesnt shift the layout of the main menu @@ -104,7 +109,7 @@ namespace NewHorizons.Handlers var tex = ImageUtilities.GetTexture(mod, filepath, false); if (tex == null) return; - var sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, Mathf.Max(SUBTITLE_HEIGHT, tex.height)), new Vector2(0.5f, 0.5f), 100.0f); + var sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), new Vector2(0.5f, 0.5f), 100.0f); AddSubtitle(sprite); } @@ -137,6 +142,12 @@ namespace NewHorizons.Handlers return; } + // Fix subtitles start cycling before the main menu is visible #844 + if (_titleCanvasGroup.alpha < 1) + { + return; + } + if (pauseTimer > 0) { pauseTimer--; diff --git a/NewHorizons/Schemas/addon_manifest_schema.json b/NewHorizons/Schemas/addon_manifest_schema.json index dec9022f..cc16e431 100644 --- a/NewHorizons/Schemas/addon_manifest_schema.json +++ b/NewHorizons/Schemas/addon_manifest_schema.json @@ -36,7 +36,7 @@ }, "subtitlePath": { "type": "string", - "description": "The path to the addons subtitle for the main menu.\nDefaults to \"subtitle.png\"." + "description": "The path to the addons subtitle for the main menu.\nDefaults to \"subtitle.png\".\nThe dimensions of the Echos of the Eye subtitle is 669 x 67, so aim for that size" }, "$schema": { "type": "string", diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 16ed48c3..129d45d7 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -405,6 +405,11 @@ "description": "Maximum speed that your ship can go in the atmosphere where flames will appear at their brightest.", "format": "float", "default": 300.0 + }, + "allowShipAutoroll": { + "type": "boolean", + "description": "Will the ship automatically try to orient itself to face upwards while in this volume?", + "default": true } } }, @@ -543,9 +548,10 @@ "description": "Radius of a simple sphere used as the ground for the planet. If you want to use more complex terrain, leave this as\n0.", "format": "float" }, - "invulnerableToSun": { + "hasFluidDetector": { "type": "boolean", - "description": "Can this planet survive entering a star?" + "description": "Is this planet able to detect fluid volumes? Disabling this means that entering a star or lava volume will not destroy this planet\nMay have adverse effects if anglerfish are added to this planet, disable this if you want those to work (they have fluid volumes in their mouths)", + "default": true }, "showMinimap": { "type": "boolean", @@ -564,7 +570,7 @@ }, "surfaceSize": { "type": "number", - "description": "A scale height used for a number of things. Should be the approximate radius of the body.", + "description": "A scale height used for a number of things. Should be the approximate radius of the body.\n\nAffected settings include: Base sector size, proxy body scaling, surface gravity", "format": "float" }, "gravityVolumePriority": { @@ -1357,7 +1363,7 @@ }, "keepLoaded": { "type": "boolean", - "description": "Should this detail stay loaded (visible and collideable) even if you're outside the sector (good for very large props)?\nAlso makes this detail visible on the map.\nMost logic/behavior scripts will still only work inside the sector, as most of those scripts break if a sector is not provided." + "description": "Should this detail stay loaded (visible and collideable) even if you're outside the sector (good for very large props)?\nAlso makes this detail visible on the map.\nKeeping many props loaded is bad for performance so use this only when it's actually relevant\nMost logic/behavior scripts will still only work inside the sector, as most of those scripts break if a sector is not provided." }, "hasPhysics": { "type": "boolean", @@ -3928,6 +3934,11 @@ "tint": { "description": "Tint of the water", "$ref": "#/definitions/MColor" + }, + "allowShipAutoroll": { + "type": "boolean", + "description": "Will the ship automatically try to orient itself to face upwards while in this volume?", + "default": true } } }, diff --git a/NewHorizons/Schemas/shiplog_schema.xsd b/NewHorizons/Schemas/shiplog_schema.xsd index 1c68acde..213cc157 100644 --- a/NewHorizons/Schemas/shiplog_schema.xsd +++ b/NewHorizons/Schemas/shiplog_schema.xsd @@ -81,7 +81,7 @@ - If this fact is revealed, show the Alt picture + If this fact is revealed, show the Alt picture. Alt photos use the same file name as default but suffixed with "_alt" diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index f4b1a964..b34aebb5 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/amazingalek/owml/master/schemas/manifest_schema.json", "filename": "NewHorizons.dll", - "author": "xen, Bwc9876, JohnCorby, MegaPiggy, Clay, Trifid, and friends", + "author": "xen, Bwc9876, JohnCorby, MegaPiggy, Trifid, and friends", "name": "New Horizons", "uniqueName": "xen.NewHorizons", "version": "1.22.8",