diff --git a/NewHorizons/Builder/Body/FunnelBuilder.cs b/NewHorizons/Builder/Body/FunnelBuilder.cs index c3969e90..aeeea881 100644 --- a/NewHorizons/Builder/Body/FunnelBuilder.cs +++ b/NewHorizons/Builder/Body/FunnelBuilder.cs @@ -4,6 +4,7 @@ using NewHorizons.Utility; using UnityEngine; using Logger = NewHorizons.Utility.Logger; using NewHorizons.External.Modules.VariableSize; +using NewHorizons.Components.Orbital; namespace NewHorizons.Builder.Body { @@ -34,7 +35,7 @@ namespace NewHorizons.Builder.Body if (_lavaMaterial == null) _lavaMaterial = new Material(SearchUtilities.Find("VolcanicMoon_Body/MoltenCore_VM/LavaSphere").GetComponent().sharedMaterial).DontDestroyOnLoad(); } - public static void Make(GameObject planetGO, ConstantForceDetector detector, OWRigidbody rigidbody, FunnelModule module) + public static void Make(GameObject planetGO, Sector sector, OWRigidbody rigidbody, FunnelModule module) { InitPrefabs(); @@ -55,7 +56,7 @@ namespace NewHorizons.Builder.Body var detectorGO = new GameObject("Detector_Funnel"); detectorGO.transform.parent = funnelGO.transform; var funnelDetector = detectorGO.AddComponent(); - funnelDetector._inheritDetector = detector; + funnelDetector._inheritDetector = planetGO.GetComponentInChildren(); funnelDetector._detectableFields = new ForceVolume[0]; detectorGO.AddComponent(); @@ -165,7 +166,10 @@ namespace NewHorizons.Builder.Body break; } - var sector = planetGO.GetComponent().GetPrimaryBody().GetRootSector(); + // We take the sector of the binary focal point if it exists for this funnel (like with the twins) + var primaryBody = planetGO.GetComponent().GetPrimaryBody(); + if (primaryBody?.GetComponent() != null) sector = primaryBody.GetRootSector(); + proxyGO.GetComponent().SetSector(sector); geoGO.GetComponent().SetSector(sector); volumesGO.GetComponent().SetSector(sector); diff --git a/NewHorizons/Builder/Body/SingularityBuilder.cs b/NewHorizons/Builder/Body/SingularityBuilder.cs index 40f2afd7..96466121 100644 --- a/NewHorizons/Builder/Body/SingularityBuilder.cs +++ b/NewHorizons/Builder/Body/SingularityBuilder.cs @@ -203,7 +203,7 @@ namespace NewHorizons.Builder.Body if (hasDestructionVolume) destructionVolumeGO.AddComponent(); else if (targetStarSystem != null) { - var wormholeVolume = destructionVolumeGO.AddComponent(); + var wormholeVolume = destructionVolumeGO.AddComponent(); wormholeVolume.TargetSolarSystem = targetStarSystem; } } diff --git a/NewHorizons/Builder/Body/WaterBuilder.cs b/NewHorizons/Builder/Body/WaterBuilder.cs index ae72bce6..9c6f68ed 100644 --- a/NewHorizons/Builder/Body/WaterBuilder.cs +++ b/NewHorizons/Builder/Body/WaterBuilder.cs @@ -39,7 +39,7 @@ namespace NewHorizons.Builder.Body if (_oceanAmbientLight == null) _oceanAmbientLight = SearchUtilities.Find("Ocean_GD").GetComponent()._ambientLight.gameObject.InstantiateInactive().Rename("OceanAmbientLight").DontDestroyOnLoad(); } - public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, WaterModule module) + public static RadialFluidVolume Make(GameObject planetGO, Sector sector, OWRigidbody rb, WaterModule module) { InitPrefabs(); @@ -148,6 +148,8 @@ namespace NewHorizons.Builder.Body waterGO.transform.position = planetGO.transform.position; waterGO.SetActive(true); + + return fluidVolume; } } } diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index a3d4e958..62f9cfdb 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -312,6 +312,14 @@ namespace NewHorizons.Builder.Props if (probeVisuals != null) probeVisuals.gameObject.SetActive(true); } + if (component is DarkMatterSubmergeController submergeController) + { + var water = planetGO.GetComponentsInChildren().FirstOrDefault(x => x._fluidType == FluidVolume.Type.WATER); + // dont use SetDetectableFluid here because Awake hasn't been called yet + if (submergeController._fluidDetector) + submergeController._fluidDetector._onlyDetectableFluid = water; + } + // Fix anglerfish speed on orbiting planets if (component is AnglerfishController angler) { diff --git a/NewHorizons/Builder/Volumes/ChangeStarSystemVolumeBuilder.cs b/NewHorizons/Builder/Volumes/ChangeStarSystemVolumeBuilder.cs new file mode 100644 index 00000000..2d97bbd3 --- /dev/null +++ b/NewHorizons/Builder/Volumes/ChangeStarSystemVolumeBuilder.cs @@ -0,0 +1,18 @@ +using NewHorizons.Components.Volumes; +using NewHorizons.External.Modules; +using UnityEngine; + +namespace NewHorizons.Builder.Volumes +{ + internal static class ChangeStarSystemVolumeBuilder + { + public static WarpVolume Make(GameObject planetGO, Sector sector, VolumesModule.ChangeStarSystemVolumeInfo info) + { + var volume = VolumeBuilder.Make(planetGO, sector, info); + + volume.TargetSolarSystem = info.targetStarSystem; + + return volume; + } + } +} diff --git a/NewHorizons/Builder/Volumes/CreditsVolumeBuilder.cs b/NewHorizons/Builder/Volumes/CreditsVolumeBuilder.cs new file mode 100644 index 00000000..c34745c1 --- /dev/null +++ b/NewHorizons/Builder/Volumes/CreditsVolumeBuilder.cs @@ -0,0 +1,18 @@ +using NewHorizons.Components.Volumes; +using NewHorizons.External.Modules; +using UnityEngine; + +namespace NewHorizons.Builder.Volumes +{ + internal static class CreditsVolumeBuilder + { + public static LoadCreditsVolume Make(GameObject planetGO, Sector sector, VolumesModule.LoadCreditsVolumeInfo info) + { + var volume = VolumeBuilder.Make(planetGO, sector, info); + + volume.creditsType = info.creditsType; + + return volume; + } + } +} diff --git a/NewHorizons/Builder/Volumes/HazardVolumeBuilder.cs b/NewHorizons/Builder/Volumes/HazardVolumeBuilder.cs index 06fc721d..6561460e 100644 --- a/NewHorizons/Builder/Volumes/HazardVolumeBuilder.cs +++ b/NewHorizons/Builder/Volumes/HazardVolumeBuilder.cs @@ -62,6 +62,24 @@ namespace NewHorizons.Builder.Volumes var visorFrostEffectVolume = go.AddComponent(); visorFrostEffectVolume._frostRate = 0.5f; visorFrostEffectVolume._maxFrost = 0.91f; + + var water = planetGO.GetComponentsInChildren().FirstOrDefault(x => x._fluidType == FluidVolume.Type.WATER); + if (water != null) + { + var submerge = go.AddComponent(); + submerge._activeWhenSubmerged = false; + submerge._effectVolumes = new EffectVolume[] { hazardVolume, visorFrostEffectVolume }; + // THERE ARE NO RENDERERS??? RUH ROH!!! + + var detectorGO = new GameObject("ConstantFluidDetector"); + detectorGO.transform.parent = go.transform; + detectorGO.transform.localPosition = Vector3.zero; + detectorGO.layer = LayerMask.NameToLayer("BasicDetector"); + var detector = detectorGO.AddComponent(); + detector.SetDetectableFluid(water); + + submerge._fluidDetector = detector; + } } else if (info.type == VolumesModule.HazardVolumeInfo.HazardType.ELECTRICITY) { diff --git a/NewHorizons/Builder/Volumes/VolumesBuildManager.cs b/NewHorizons/Builder/Volumes/VolumesBuildManager.cs index 802363b5..cd1f474a 100644 --- a/NewHorizons/Builder/Volumes/VolumesBuildManager.cs +++ b/NewHorizons/Builder/Volumes/VolumesBuildManager.cs @@ -192,6 +192,20 @@ namespace NewHorizons.Builder.Volumes VolumeBuilder.Make(go, sector, lightSourceVolume); } } + if (config.Volumes.solarSystemVolume != null) + { + foreach (var solarSystemVolume in config.Volumes.solarSystemVolume) + { + ChangeStarSystemVolumeBuilder.Make(go, sector, solarSystemVolume); + } + } + if (config.Volumes.creditsVolume != null) + { + foreach (var creditsVolume in config.Volumes.creditsVolume) + { + CreditsVolumeBuilder.Make(go, sector, creditsVolume); + } + } } } } diff --git a/NewHorizons/Components/Volumes/ChangeStarSystemVolume.cs b/NewHorizons/Components/Volumes/BlackHoleWarpVolume.cs similarity index 85% rename from NewHorizons/Components/Volumes/ChangeStarSystemVolume.cs rename to NewHorizons/Components/Volumes/BlackHoleWarpVolume.cs index bdf43aae..58202aa1 100644 --- a/NewHorizons/Components/Volumes/ChangeStarSystemVolume.cs +++ b/NewHorizons/Components/Volumes/BlackHoleWarpVolume.cs @@ -1,6 +1,6 @@ -namespace NewHorizons.Components.Volumes +namespace NewHorizons.Components.Volumes { - public class ChangeStarSystemVolume : BlackHoleDestructionVolume + public class BlackHoleWarpVolume : BlackHoleDestructionVolume { public string TargetSolarSystem { get; set; } diff --git a/NewHorizons/Components/Volumes/LoadCreditsVolume.cs b/NewHorizons/Components/Volumes/LoadCreditsVolume.cs new file mode 100644 index 00000000..11990840 --- /dev/null +++ b/NewHorizons/Components/Volumes/LoadCreditsVolume.cs @@ -0,0 +1,35 @@ +using NewHorizons.External.Modules; +using UnityEngine; + +namespace NewHorizons.Components.Volumes +{ + internal class LoadCreditsVolume : BaseVolume + { + public VolumesModule.LoadCreditsVolumeInfo.CreditsType creditsType = VolumesModule.LoadCreditsVolumeInfo.CreditsType.Fast; + + public override void OnTriggerVolumeEntry(GameObject hitObj) + { + if (hitObj.CompareTag("PlayerDetector")) + { + switch(creditsType) + { + case VolumesModule.LoadCreditsVolumeInfo.CreditsType.Fast: + LoadManager.LoadScene(OWScene.Credits_Fast, LoadManager.FadeType.ToBlack); + break; + case VolumesModule.LoadCreditsVolumeInfo.CreditsType.Final: + LoadManager.LoadScene(OWScene.Credits_Final, LoadManager.FadeType.ToBlack); + break; + case VolumesModule.LoadCreditsVolumeInfo.CreditsType.Kazoo: + TimelineObliterationController.s_hasRealityEnded = true; + LoadManager.LoadScene(OWScene.Credits_Fast, LoadManager.FadeType.ToBlack); + break; + } + } + } + + public override void OnTriggerVolumeExit(GameObject hitObj) + { + + } + } +} diff --git a/NewHorizons/Components/Volumes/WarpVolume.cs b/NewHorizons/Components/Volumes/WarpVolume.cs new file mode 100644 index 00000000..f5be0007 --- /dev/null +++ b/NewHorizons/Components/Volumes/WarpVolume.cs @@ -0,0 +1,31 @@ +using NewHorizons.External.Modules; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace NewHorizons.Components.Volumes +{ + internal class WarpVolume : BaseVolume + { + public string TargetSolarSystem; + + public override void OnTriggerVolumeEntry(GameObject hitObj) + { + if (hitObj.CompareTag("PlayerDetector")) + { + if (Main.Instance.CurrentStarSystem != TargetSolarSystem) // Otherwise it really breaks idk why + { + Main.Instance.ChangeCurrentStarSystem(TargetSolarSystem, PlayerState.AtFlightConsole()); + } + } + } + + public override void OnTriggerVolumeExit(GameObject hitObj) + { + + } + } +} diff --git a/NewHorizons/External/Modules/VolumesModule.cs b/NewHorizons/External/Modules/VolumesModule.cs index b1cc6b20..39dfb90b 100644 --- a/NewHorizons/External/Modules/VolumesModule.cs +++ b/NewHorizons/External/Modules/VolumesModule.cs @@ -106,6 +106,16 @@ namespace NewHorizons.External.Modules /// public PriorityVolumeInfo[] zeroGravityVolumes; + /// + /// Entering this volume will load a new solar system. + /// + public ChangeStarSystemVolumeInfo[] solarSystemVolume; + + /// + /// Enter this volume to be sent to the end credits scene + /// + public LoadCreditsVolumeInfo[] creditsVolume; + [JsonObject] public class VolumeInfo { @@ -136,6 +146,33 @@ namespace NewHorizons.External.Modules public string rename; } + [JsonObject] + public class ChangeStarSystemVolumeInfo : VolumeInfo + { + /// + /// The star system that entering this volume will send you to. + /// + [DefaultValue("SolarSystem")] + public string targetStarSystem; + } + + [JsonObject] + public class LoadCreditsVolumeInfo : VolumeInfo + { + [JsonConverter(typeof(StringEnumConverter))] + public enum CreditsType + { + [EnumMember(Value = @"fast")] Fast = 0, + + [EnumMember(Value = @"final")] Final = 1, + + [EnumMember(Value = @"kazoo")] Kazoo = 2 + } + + [DefaultValue("fast")] + public CreditsType creditsType = CreditsType.Fast; + } + [JsonObject] public class PriorityVolumeInfo : VolumeInfo { diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index c8191b91..e0912246 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -466,7 +466,7 @@ namespace NewHorizons.Handlers }); } - RichPresenceHandler.SetUpPlanet(body.Config.name, go, sector); + RichPresenceHandler.SetUpPlanet(body.Config.name, go, sector, body.Config.Star != null, body.Config.Atmosphere != null); Logger.LogVerbose($"Finished creating [{body.Config.name}]"); @@ -638,7 +638,7 @@ namespace NewHorizons.Handlers if (body.Config.Funnel != null) { - FunnelBuilder.Make(go, go.GetComponentInChildren(), rb, body.Config.Funnel); + FunnelBuilder.Make(go, sector, rb, body.Config.Funnel); } // Has to go last probably diff --git a/NewHorizons/Handlers/TitleSceneHandler.cs b/NewHorizons/Handlers/TitleSceneHandler.cs index 9faee29c..45e515e4 100644 --- a/NewHorizons/Handlers/TitleSceneHandler.cs +++ b/NewHorizons/Handlers/TitleSceneHandler.cs @@ -65,6 +65,7 @@ namespace NewHorizons.Handlers var lightGO = new GameObject("Light"); lightGO.transform.parent = SearchUtilities.Find("Scene/Background").transform; lightGO.transform.localPosition = new Vector3(-47.9203f, 145.7596f, 43.1802f); + lightGO.transform.localRotation = Quaternion.Euler(13.1412f, 122.8785f, 169.4302f); var light = lightGO.AddComponent(); light.type = LightType.Directional; light.color = Color.white; @@ -75,31 +76,86 @@ namespace NewHorizons.Handlers private static GameObject LoadTitleScreenBody(NewHorizonsBody body) { Logger.LogVerbose($"Displaying {body.Config.name} on the title screen"); - GameObject titleScreenGO = new GameObject(body.Config.name + "_TitleScreen"); - HeightMapModule heightMap = new HeightMapModule(); - var minSize = 15; - var maxSize = 30; - float size = minSize; + var titleScreenGO = new GameObject(body.Config.name + "_TitleScreen"); + + var maxSize = -1f; + if (body.Config.HeightMap != null) { - size = Mathf.Clamp(body.Config.HeightMap.maxHeight / 10, minSize, maxSize); - heightMap.textureMap = body.Config.HeightMap.textureMap; - heightMap.heightMap = body.Config.HeightMap.heightMap; - heightMap.maxHeight = size; - heightMap.minHeight = body.Config.HeightMap.minHeight * size / body.Config.HeightMap.maxHeight; - heightMap.stretch = body.Config.HeightMap.stretch; + HeightMapBuilder.Make(titleScreenGO, null, body.Config.HeightMap, body.Mod, 30); + maxSize = Mathf.Max(maxSize, body.Config.HeightMap.maxHeight, body.Config.HeightMap.minHeight); } if (body.Config.Atmosphere?.clouds?.texturePath != null && body.Config.Atmosphere?.clouds?.cloudsPrefab != CloudPrefabType.Transparent) { // Hacky but whatever I just want a sphere - size = Mathf.Clamp(body.Config.Atmosphere.size / 10, minSize, maxSize); - heightMap.maxHeight = heightMap.minHeight = size + 1; - heightMap.textureMap = body.Config.Atmosphere.clouds.texturePath; + var cloudTextureMap = new HeightMapModule(); + cloudTextureMap.maxHeight = cloudTextureMap.minHeight = body.Config.Atmosphere.size; + cloudTextureMap.textureMap = body.Config.Atmosphere.clouds.texturePath; + HeightMapBuilder.Make(titleScreenGO, null, cloudTextureMap, body.Mod, 30); + maxSize = Mathf.Max(maxSize, cloudTextureMap.maxHeight); + } + else + { + if (body.Config.Water != null) + { + var waterGO = GameObject.CreatePrimitive(PrimitiveType.Sphere); + var size = 2f * Mathf.Max(body.Config.Water.size, body.Config.Water.size * body.Config.Water.curve?.FirstOrDefault()?.value ?? 0f); + + waterGO.transform.localScale = Vector3.one * size; + + var mr = waterGO.GetComponent(); + var colour = body.Config.Water.tint?.ToColor() ?? Color.blue; + mr.material.color = new Color(colour.r, colour.g, colour.b, 0.9f); + + // Make it transparent! + mr.material.SetOverrideTag("RenderType", "Transparent"); + mr.material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); + mr.material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); + mr.material.SetInt("_ZWrite", 0); + mr.material.DisableKeyword("_ALPHATEST_ON"); + mr.material.DisableKeyword("_ALPHABLEND_ON"); + mr.material.EnableKeyword("_ALPHAPREMULTIPLY_ON"); + mr.material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent; + + waterGO.transform.parent = titleScreenGO.transform; + waterGO.transform.localPosition = Vector3.zero; + + maxSize = Mathf.Max(maxSize, size); + } + if (body.Config.Lava != null) + { + var lavaGO = GameObject.CreatePrimitive(PrimitiveType.Sphere); + var size = 2f * Mathf.Max(body.Config.Lava.size, body.Config.Lava.size * body.Config.Lava.curve?.FirstOrDefault()?.value ?? 0f); + + lavaGO.transform.localScale = Vector3.one * size; + + var mr = lavaGO.GetComponent(); + mr.material.color = body.Config.Lava.tint?.ToColor() ?? Color.red; + mr.material.SetColor("_EmissionColor", mr.material.color * 2f); + + lavaGO.transform.parent = titleScreenGO.transform; + lavaGO.transform.localPosition = Vector3.zero; + + maxSize = Mathf.Max(maxSize, size); + } + if (body.Config.Sand != null) + { + var sandGO = GameObject.CreatePrimitive(PrimitiveType.Sphere); + var size = 2f * Mathf.Max(body.Config.Sand.size, body.Config.Sand.size * body.Config.Sand.curve?.FirstOrDefault()?.value ?? 0f); + + sandGO.transform.localScale = Vector3.one * size; + var mr = sandGO.GetComponent(); + mr.material.color = body.Config.Sand.tint?.ToColor() ?? Color.yellow; + mr.material.SetFloat("_Glossiness", 0); + + sandGO.transform.parent = titleScreenGO.transform; + sandGO.transform.localPosition = Vector3.zero; + + maxSize = Mathf.Max(maxSize, size); + } } - HeightMapBuilder.Make(titleScreenGO, null, heightMap, body.Mod, 30); - - GameObject pivot = GameObject.Instantiate(SearchUtilities.Find("Scene/Background/PlanetPivot"), SearchUtilities.Find("Scene/Background").transform); + var pivot = GameObject.Instantiate(SearchUtilities.Find("Scene/Background/PlanetPivot"), SearchUtilities.Find("Scene/Background").transform); pivot.GetComponent()._degreesPerSecond = 10f; foreach (Transform child in pivot.transform) { @@ -111,17 +167,15 @@ namespace NewHorizons.Handlers { foreach (var ring in body.Config.Rings) { - RingModule newRing = new RingModule(); - newRing.innerRadius = size * 1.2f; - newRing.outerRadius = size * 2f; - newRing.texture = ring.texture; - RingBuilder.Make(titleScreenGO, null, newRing, body.Mod); + RingBuilder.Make(titleScreenGO, null, ring, body.Mod); + + maxSize = Mathf.Max(maxSize, ring.outerRadius); } - titleScreenGO.transform.localScale = Vector3.one * 0.8f; } titleScreenGO.transform.parent = pivot.transform; titleScreenGO.transform.localPosition = Vector3.zero; + titleScreenGO.transform.localScale = Vector3.one * 30f / maxSize; return titleScreenGO; } diff --git a/NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs b/NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs index e2132b89..45ab9040 100644 --- a/NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs +++ b/NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs @@ -9,6 +9,14 @@ namespace NewHorizons.OtherMods.OWRichPresence public void SetTriggerActivation(bool active); public GameObject CreateTrigger(GameObject parent, string message, string imageKey); public GameObject CreateTrigger(GameObject parent, Sector sector, string message, string imageKey); + public GameObject CreateTrigger(GameObject parent, string message, string imageKey, string fallback); + public GameObject CreateTrigger(GameObject parent, Sector sector, string message, string imageKey, string fallback); + public void CreateTriggerVolume(OWTriggerVolume triggerVolume, string message, string imageKey); + public void CreateTriggerVolume(OWTriggerVolume triggerVolume, string message, string imageKey, string fallback); + public GameObject CreateTriggerVolume(GameObject parent, float radius, string message, string imageKey); + public GameObject CreateTriggerVolume(GameObject parent, float radius, string message, string imageKey, string fallback); + public GameObject CreateTriggerVolume(GameObject parent, Vector3 localPosition, float radius, string message, string imageKey); + public GameObject CreateTriggerVolume(GameObject parent, Vector3 localPosition, float radius, string message, string imageKey, string fallback); public void SetCurrentRootPresence(string message, string imageKey); } } diff --git a/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs b/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs index 727bc082..70ef2184 100644 --- a/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs +++ b/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs @@ -38,7 +38,7 @@ namespace NewHorizons.OtherMods.OWRichPresence } } - public static void SetUpPlanet(string name, GameObject go, Sector sector) + public static void SetUpPlanet(string name, GameObject go, Sector sector, bool isStar = false, bool hasAtmosphere = false) { if (!Enabled) return; @@ -47,7 +47,11 @@ namespace NewHorizons.OtherMods.OWRichPresence var localizedName = TranslationHandler.GetTranslation(name, TranslationHandler.TextType.UI); var message = TranslationHandler.GetTranslation("RICH_PRESENCE_EXPLORING", TranslationHandler.TextType.UI).Replace("{0}", localizedName); - API.CreateTrigger(go, sector, message, name.Replace(" ", "").Replace("'", "").Replace("-", "").ToLowerInvariant()); + string fallbackKey = "defaultplanet"; + if (isStar) fallbackKey = "defaultstar"; + else if (hasAtmosphere) fallbackKey = "defaultplanetatmosphere"; + + API.CreateTrigger(go, sector, message, name.Replace(" ", "").Replace("'", "").Replace("-", "").ToLowerInvariant(), fallbackKey); } public static void OnStarSystemLoaded(string name) @@ -59,7 +63,7 @@ namespace NewHorizons.OtherMods.OWRichPresence var localizedName = ShipLogStarChartMode.UniqueIDToName(name); var message = TranslationHandler.GetTranslation("RICH_PRESENCE_EXPLORING", TranslationHandler.TextType.UI).Replace("{0}", localizedName); - API.SetCurrentRootPresence(message, "sun"); + API.SetCurrentRootPresence(message, "newhorizons"); } public static void OnChangeStarSystem(string destination) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index dc13be31..97d49113 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -2715,6 +2715,20 @@ "items": { "$ref": "#/definitions/PriorityVolumeInfo" } + }, + "solarSystemVolume": { + "type": "array", + "description": "Entering this volume will load a new solar system.", + "items": { + "$ref": "#/definitions/ChangeStarSystemVolumeInfo" + } + }, + "creditsVolume": { + "type": "array", + "description": "Enter this volume to be sent to the end credits scene", + "items": { + "$ref": "#/definitions/LoadCreditsVolumeInfo" + } } } }, @@ -3728,6 +3742,85 @@ "default": 1 } } + }, + "ChangeStarSystemVolumeInfo": { + "type": "object", + "additionalProperties": false, + "properties": { + "position": { + "description": "The location of this volume. Optional (will default to 0,0,0).", + "$ref": "#/definitions/MVector3" + }, + "radius": { + "type": "number", + "description": "The radius of this volume.", + "format": "float", + "default": 1.0 + }, + "parentPath": { + "type": "string", + "description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)." + }, + "isRelativeToParent": { + "type": "boolean", + "description": "Whether the positional coordinates are relative to parent instead of the root planet object." + }, + "rename": { + "type": "string", + "description": "An optional rename of this volume." + }, + "targetStarSystem": { + "type": "string", + "description": "The star system that entering this volume will send you to.", + "default": "SolarSystem" + } + } + }, + "LoadCreditsVolumeInfo": { + "type": "object", + "additionalProperties": false, + "properties": { + "position": { + "description": "The location of this volume. Optional (will default to 0,0,0).", + "$ref": "#/definitions/MVector3" + }, + "radius": { + "type": "number", + "description": "The radius of this volume.", + "format": "float", + "default": 1.0 + }, + "parentPath": { + "type": "string", + "description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)." + }, + "isRelativeToParent": { + "type": "boolean", + "description": "Whether the positional coordinates are relative to parent instead of the root planet object." + }, + "rename": { + "type": "string", + "description": "An optional rename of this volume." + }, + "creditsType": { + "default": "fast", + "$ref": "#/definitions/CreditsType" + } + } + }, + "CreditsType": { + "type": "string", + "description": "", + "x-enumNames": [ + "Fast", + "Final", + "Kazoo" + ], + "enum": [ + "fast", + "final", + "kazoo" + ] } }, "$docs": { diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index 95333d16..6f386cbe 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,9 +4,9 @@ "author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.8.5", + "version": "1.8.6", "owmlVersion": "2.9.0", "dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], - "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_Randomizer" ], + "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ], "pathsToPreserve": [ "planets", "systems", "translations" ] }