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/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/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/manifest.json b/NewHorizons/manifest.json index 95333d16..7968e81a 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "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" ],