From e1dff03059928a5d035d073f790e5317e8352e34 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Fri, 7 Mar 2025 07:29:19 -0500 Subject: [PATCH 1/5] Do the overload with boolean for UI translations being uppercase --- NewHorizons/Builder/General/MarkerBuilder.cs | 3 +-- NewHorizons/Handlers/EyeSceneHandler.cs | 2 +- NewHorizons/Handlers/TranslationHandler.cs | 5 ++++- NewHorizons/Handlers/VesselWarpHandler.cs | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Builder/General/MarkerBuilder.cs b/NewHorizons/Builder/General/MarkerBuilder.cs index 29626f7c..a228f20a 100644 --- a/NewHorizons/Builder/General/MarkerBuilder.cs +++ b/NewHorizons/Builder/General/MarkerBuilder.cs @@ -3,7 +3,6 @@ using NewHorizons.Components; using NewHorizons.External.Configs; using NewHorizons.Handlers; -using NewHorizons.Utility; using UnityEngine; #endregion @@ -16,7 +15,7 @@ namespace NewHorizons.Builder.General { var module = config.MapMarker; NHMapMarker mapMarker = body.AddComponent(); - mapMarker._labelID = (UITextType)TranslationHandler.AddUI(config.name.ToUpperFixed()); + mapMarker._labelID = (UITextType)TranslationHandler.AddUI(config.name, true); var markerType = MapMarker.MarkerType.Planet; diff --git a/NewHorizons/Handlers/EyeSceneHandler.cs b/NewHorizons/Handlers/EyeSceneHandler.cs index dadf34f8..e0e3bccc 100644 --- a/NewHorizons/Handlers/EyeSceneHandler.cs +++ b/NewHorizons/Handlers/EyeSceneHandler.cs @@ -96,7 +96,7 @@ namespace NewHorizons.Handlers vesselAO._type = AstroObject.Type.SpaceStation; vesselAO.Register(); vesselMapMarker._markerType = MapMarker.MarkerType.Moon; - vesselMapMarker._labelID = (UITextType)TranslationHandler.AddUI("VESSEL"); + vesselMapMarker._labelID = (UITextType)TranslationHandler.AddUI("Vessel", true); RFVolumeBuilder.Make(vessel, vesselBody, 600, new External.Modules.ReferenceFrameModule { localPosition = new MVector3(0, 0, -207.375f) }); // Resize vessel sector so that the vessel is fully collidable. diff --git a/NewHorizons/Handlers/TranslationHandler.cs b/NewHorizons/Handlers/TranslationHandler.cs index 9ce24859..753e13d6 100644 --- a/NewHorizons/Handlers/TranslationHandler.cs +++ b/NewHorizons/Handlers/TranslationHandler.cs @@ -205,11 +205,14 @@ namespace NewHorizons.Handlers TextTranslation.Get().m_table.theShipLogTable[key] = value; } - public static int AddUI(string rawText) + public static int AddUI(string rawText) => AddUI(rawText, false); + + public static int AddUI(string rawText, bool upper) { var uiTable = TextTranslation.Get().m_table.theUITable; var text = GetTranslation(rawText, TextType.UI); + if (upper) text = text.ToUpperFixed(); var key = uiTable.Keys.Max() + 1; try diff --git a/NewHorizons/Handlers/VesselWarpHandler.cs b/NewHorizons/Handlers/VesselWarpHandler.cs index 14c3d9c0..87f8d1ad 100644 --- a/NewHorizons/Handlers/VesselWarpHandler.cs +++ b/NewHorizons/Handlers/VesselWarpHandler.cs @@ -210,7 +210,7 @@ namespace NewHorizons.Handlers vesselWarpController._whiteHoleOneShot = vesselWarpController._whiteHole.transform.parent.Find("WhiteHoleAudio_OneShot").GetComponent(); vesselWarpController._whiteHole._startActive = true; - vesselObject.GetComponent()._labelID = (UITextType)TranslationHandler.AddUI("VESSEL"); + vesselObject.GetComponent()._labelID = (UITextType)TranslationHandler.AddUI("Vessel", true); var hasParentBody = !string.IsNullOrEmpty(system.Config.Vessel?.vesselSpawn?.parentBody); var hasPhysics = system.Config.Vessel?.hasPhysics ?? !hasParentBody; From 917bb5463a445d7300492ed38659b457e5e69783 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Fri, 7 Mar 2025 07:57:05 -0500 Subject: [PATCH 2/5] Bump version --- NewHorizons/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index 61d2fdeb..eff475cf 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, JohnCorby, MegaPiggy, and friends", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.27.2", + "version": "1.27.3", "owmlVersion": "2.12.1", "dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "conflicts": [ "PacificEngine.OW_CommonResources" ], From 930aa480f07d1c70a3363e237694de44138c6047 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Thu, 13 Mar 2025 22:27:48 -0400 Subject: [PATCH 3/5] Add bramble name labels --- .../Builder/Body/BrambleDimensionBuilder.cs | 2 + .../Builder/Props/BrambleNodeBuilder.cs | 5 ++ NewHorizons/Main.cs | 2 + .../Utility/DebugTools/DebugFogWarp.cs | 52 +++++++++++++++++++ NewHorizons/default-config.json | 6 +++ 5 files changed, 67 insertions(+) create mode 100644 NewHorizons/Utility/DebugTools/DebugFogWarp.cs diff --git a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs index e1c6d41e..c0319e79 100644 --- a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs +++ b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs @@ -5,6 +5,7 @@ using NewHorizons.External; using NewHorizons.External.Modules; using NewHorizons.External.Modules.Props; using NewHorizons.Utility; +using NewHorizons.Utility.DebugTools; using NewHorizons.Utility.Files; using NewHorizons.Utility.OWML; using OWML.Common; @@ -189,6 +190,7 @@ namespace NewHorizons.Builder.Body outerFogWarpVolume._linkedInnerWarpVolume = null; outerFogWarpVolume._name = OuterFogWarpVolume.Name.None; outerFogWarpVolume._sector = sector; + exitWarps.GetAddComponent().fogWarpVolume = outerFogWarpVolume; PairExit(config.linksTo, outerFogWarpVolume); diff --git a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs index 810b43d8..45724ab4 100644 --- a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs +++ b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs @@ -4,6 +4,7 @@ using NewHorizons.External.Configs; using NewHorizons.External.Modules.Props.Audio; using NewHorizons.Handlers; using NewHorizons.Utility; +using NewHorizons.Utility.DebugTools; using NewHorizons.Utility.OuterWilds; using NewHorizons.Utility.OWML; using Newtonsoft.Json; @@ -204,6 +205,10 @@ namespace NewHorizons.Builder.Props foreach (var fogWarpVolume in brambleNode.GetComponentsInChildren(true).Append(brambleNode.GetComponent())) { _nhFogWarpVolumes.Add(fogWarpVolume); + if (fogWarpVolume is SphericalFogWarpVolume sphericalFogWarpVolume) + { + fogWarpVolume.gameObject.GetAddComponent().fogWarpVolume = sphericalFogWarpVolume; + } } var innerFogWarpVolume = brambleNode.GetComponent(); diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 01e1f089..f81400a9 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -46,6 +46,7 @@ namespace NewHorizons // Settings public static bool Debug { get; private set; } public static bool VisualizeQuantumObjects { get; private set; } + public static bool VisualizeBrambleVolumeNames { get; private set; } public static bool VerboseLogs { get; private set; } public static bool SequentialPreCaching { get; private set; } public static bool CustomTitleScreen { get; private set; } @@ -138,6 +139,7 @@ namespace NewHorizons Debug = config.GetSettingsValue(nameof(Debug)); VisualizeQuantumObjects = config.GetSettingsValue(nameof(VisualizeQuantumObjects)); + VisualizeBrambleVolumeNames = config.GetSettingsValue(nameof(VisualizeBrambleVolumeNames)); VerboseLogs = config.GetSettingsValue(nameof(VerboseLogs)); SequentialPreCaching = config.GetSettingsValue(nameof(SequentialPreCaching)); diff --git a/NewHorizons/Utility/DebugTools/DebugFogWarp.cs b/NewHorizons/Utility/DebugTools/DebugFogWarp.cs new file mode 100644 index 00000000..c541e29f --- /dev/null +++ b/NewHorizons/Utility/DebugTools/DebugFogWarp.cs @@ -0,0 +1,52 @@ +using UnityEngine; + +namespace NewHorizons.Utility.DebugTools +{ + /// + /// Adapted from Survivors https://github.com/Hawkbat/ow-mod-jam-2/blob/main/EscapePodFour.cs#L197 + /// + [RequireComponent(typeof(SphericalFogWarpVolume))] + public class DebugFogWarp : MonoBehaviour + { + public SphericalFogWarpVolume fogWarpVolume; + public void OnGUI() + { + if (Main.Debug && Main.VisualizeBrambleVolumeNames && fogWarpVolume != null) + { + DrawWorldLabel(fogWarpVolume, fogWarpVolume.name); + if (fogWarpVolume._exits != null) + { + foreach (var e in fogWarpVolume._exits) + { + if (e != null) + { + DrawWorldLabel(fogWarpVolume.GetExitPosition(e), e.name); + } + } + } + } + } + + public void DrawWorldLabel(Component component, string text) + { + DrawWorldLabel(component.transform.position, text); + } + + public void DrawWorldLabel(Vector3 worldPos, string text) + { + var c = Locator.GetPlayerCamera(); + var d = Vector3.Distance(c.transform.position, worldPos); + if (d > 1000f) return; + GUI.Label(new Rect(WorldToGui(worldPos), new Vector2(500f, 20f)), text); + } + + public Vector2 WorldToGui(Vector3 wp) + { + var c = Locator.GetPlayerCamera(); + var sp = c.WorldToScreenPoint(wp); + if (sp.z < 0) return new Vector2(Screen.width, Screen.height); + var gp = new Vector2(sp.x, Screen.height - sp.y); + return gp; + } + } +} diff --git a/NewHorizons/default-config.json b/NewHorizons/default-config.json index 4f3239c2..7502ba9a 100644 --- a/NewHorizons/default-config.json +++ b/NewHorizons/default-config.json @@ -22,6 +22,12 @@ "value": false, "tooltip": "Draws boundaries around quantum objects when Debug mode is on." }, + "VisualizeBrambleVolumeNames": { + "title": "Visualize Bramble Volume Names", + "type": "toggle", + "value": false, + "tooltip": "Adds a label to all custom spherical fog warp volumes and entrances/exits when Debug mode is on." + }, "VerboseLogs": { "title": "Verbose Logs", "type": "toggle", From 146966966449874151a39107d6a73f6eb1e1f950 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 15 Mar 2025 02:43:52 -0400 Subject: [PATCH 4/5] make spawns show up in PlayerSpawner.FindPlanetSpawns --- NewHorizons/Builder/General/SpawnPointBuilder.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NewHorizons/Builder/General/SpawnPointBuilder.cs b/NewHorizons/Builder/General/SpawnPointBuilder.cs index a38802b6..69a75135 100644 --- a/NewHorizons/Builder/General/SpawnPointBuilder.cs +++ b/NewHorizons/Builder/General/SpawnPointBuilder.cs @@ -40,6 +40,7 @@ namespace NewHorizons.Builder.General foreach (var point in module.playerSpawnPoints) { GameObject spawnGO = GeneralPropBuilder.MakeNew("PlayerSpawnPoint", planetGO, null, point); + spawnGO.SetActive(false); spawnGO.layer = Layer.PlayerSafetyCollider; playerSpawn = spawnGO.AddComponent(); @@ -69,6 +70,8 @@ namespace NewHorizons.Builder.General PlayerSpawn = playerSpawn; PlayerSpawnInfo = point; } + + spawnGO.SetActive(true); } } From cc73e40fd959d88ab2927a3cba1d0771ea9888e3 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 15 Mar 2025 02:46:55 -0400 Subject: [PATCH 5/5] no need for this as it is already inactive --- NewHorizons/Builder/General/SpawnPointBuilder.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/NewHorizons/Builder/General/SpawnPointBuilder.cs b/NewHorizons/Builder/General/SpawnPointBuilder.cs index 69a75135..a5e8700d 100644 --- a/NewHorizons/Builder/General/SpawnPointBuilder.cs +++ b/NewHorizons/Builder/General/SpawnPointBuilder.cs @@ -40,7 +40,6 @@ namespace NewHorizons.Builder.General foreach (var point in module.playerSpawnPoints) { GameObject spawnGO = GeneralPropBuilder.MakeNew("PlayerSpawnPoint", planetGO, null, point); - spawnGO.SetActive(false); spawnGO.layer = Layer.PlayerSafetyCollider; playerSpawn = spawnGO.AddComponent(); @@ -80,7 +79,6 @@ namespace NewHorizons.Builder.General foreach (var point in module.shipSpawnPoints) { var spawnGO = GeneralPropBuilder.MakeNew("ShipSpawnPoint", planetGO, null, point); - spawnGO.SetActive(false); spawnGO.layer = Layer.PlayerSafetyCollider; var shipSpawn = spawnGO.AddComponent();