Merge branch 'dev' into ship-spawn-facts

This commit is contained in:
xen-42 2024-10-04 13:34:15 -04:00
commit aeb08f1480
20 changed files with 102 additions and 18 deletions

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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<NHAstroObject>();
@ -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(

View File

@ -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;

View File

@ -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();
}
}
}

View File

@ -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
/// </summary>
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<NHAstroObject>() 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<AstroObject>().GetPrimaryBody().GetAttachedOWRigidbody()).magnitude;

View File

@ -41,6 +41,7 @@ namespace NewHorizons.External.Configs
/// <summary>
/// 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
/// </summary>
public string subtitlePath = "subtitle.png";
}

View File

@ -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
}

View File

@ -107,6 +107,12 @@ namespace NewHorizons.External.Modules
/// </summary>
[DefaultValue(300f)] public float maxShockSpeed = 300f;
/// <summary>
/// Will the ship automatically try to orient itself to face upwards while in this volume?
/// </summary>
[DefaultValue(true)]
public bool allowShipAutoroll = true;
[JsonObject]
public class CloudInfo
{

View File

@ -37,9 +37,11 @@ namespace NewHorizons.External.Modules
public float groundSize;
/// <summary>
/// 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)
/// </summary>
public bool invulnerableToSun;
[DefaultValue(true)]
public bool hasFluidDetector = true;
/// <summary>
/// Do we show the minimap when walking around this planet?
@ -58,6 +60,8 @@ namespace NewHorizons.External.Modules
/// <summary>
/// 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
/// </summary>
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;

View File

@ -56,6 +56,7 @@ namespace NewHorizons.External.Modules.Props
/// <summary>
/// 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.
/// </summary>
public bool keepLoaded;

View File

@ -26,5 +26,11 @@ namespace NewHorizons.External.Modules.VariableSize
/// Tint of the water
/// </summary>
public MColor tint;
/// <summary>
/// Will the ship automatically try to orient itself to face upwards while in this volume?
/// </summary>
[DefaultValue(true)]
public bool allowShipAutoroll = true;
}
}

View File

@ -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<AstroObject>();
// Fix #933 not defaulting primary body
primaryBody = (SearchUtilities.Find("Sun_Body") ?? AstroObjectBuilder.CenterOfUniverse)?.GetComponent<AstroObject>();
}
else
{

View File

@ -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<LayoutElement>();
layout.minHeight = SUBTITLE_HEIGHT;
_titleCanvasGroup = SearchUtilities.Find("TitleCanvas").GetComponent<CanvasGroup>();
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--;

View File

@ -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",

View File

@ -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
}
}
},

View File

@ -81,7 +81,7 @@
<xs:element name="AltPhotoCondition" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
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"
</xs:documentation>
</xs:annotation>
</xs:element>

View File

@ -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",