## Minor features

- Added a debug option for visualizing the names of custom bramble warp
volumes and their entrances/exits. Resolves #1066

## Bug fixes

- Fixed broken implementation of #1062 by changing
TranslationHandler.AddUI to take a bool for translations being
uppercase.
- NH-made spawn points now show up in Cheat And Debug Menu's spawn point
teleporter
This commit is contained in:
Will Corby 2025-03-14 23:56:51 -07:00 committed by GitHub
commit 4b0d65a0ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 77 additions and 7 deletions

View File

@ -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<DebugFogWarp>().fogWarpVolume = outerFogWarpVolume;
PairExit(config.linksTo, outerFogWarpVolume);

View File

@ -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<NHMapMarker>();
mapMarker._labelID = (UITextType)TranslationHandler.AddUI(config.name.ToUpperFixed());
mapMarker._labelID = (UITextType)TranslationHandler.AddUI(config.name, true);
var markerType = MapMarker.MarkerType.Planet;

View File

@ -69,6 +69,8 @@ namespace NewHorizons.Builder.General
PlayerSpawn = playerSpawn;
PlayerSpawnInfo = point;
}
spawnGO.SetActive(true);
}
}
@ -77,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<SpawnPoint>();

View File

@ -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<FogWarpVolume>(true).Append(brambleNode.GetComponent<FogWarpVolume>()))
{
_nhFogWarpVolumes.Add(fogWarpVolume);
if (fogWarpVolume is SphericalFogWarpVolume sphericalFogWarpVolume)
{
fogWarpVolume.gameObject.GetAddComponent<DebugFogWarp>().fogWarpVolume = sphericalFogWarpVolume;
}
}
var innerFogWarpVolume = brambleNode.GetComponent<InnerFogWarpVolume>();

View File

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

View File

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

View File

@ -210,7 +210,7 @@ namespace NewHorizons.Handlers
vesselWarpController._whiteHoleOneShot = vesselWarpController._whiteHole.transform.parent.Find("WhiteHoleAudio_OneShot").GetComponent<OWAudioSource>();
vesselWarpController._whiteHole._startActive = true;
vesselObject.GetComponent<MapMarker>()._labelID = (UITextType)TranslationHandler.AddUI("VESSEL");
vesselObject.GetComponent<MapMarker>()._labelID = (UITextType)TranslationHandler.AddUI("Vessel", true);
var hasParentBody = !string.IsNullOrEmpty(system.Config.Vessel?.vesselSpawn?.parentBody);
var hasPhysics = system.Config.Vessel?.hasPhysics ?? !hasParentBody;

View File

@ -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<bool>(nameof(Debug));
VisualizeQuantumObjects = config.GetSettingsValue<bool>(nameof(VisualizeQuantumObjects));
VisualizeBrambleVolumeNames = config.GetSettingsValue<bool>(nameof(VisualizeBrambleVolumeNames));
VerboseLogs = config.GetSettingsValue<bool>(nameof(VerboseLogs));
SequentialPreCaching = config.GetSettingsValue<bool>(nameof(SequentialPreCaching));

View File

@ -0,0 +1,52 @@
using UnityEngine;
namespace NewHorizons.Utility.DebugTools
{
/// <summary>
/// Adapted from Survivors https://github.com/Hawkbat/ow-mod-jam-2/blob/main/EscapePodFour.cs#L197
/// </summary>
[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;
}
}
}

View File

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

View File

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