## Bug fixes

- Fixed a floating point precision bug that broke the 13th registered
Signalscope frequency

Also added coderCleric's Nomai Text Printer mod to the documentation
since it is very useful for story mod development!
This commit is contained in:
xen-42 2025-08-05 14:53:05 -04:00 committed by GitHub
commit 765d3a136d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 9 deletions

View File

@ -100,8 +100,6 @@ namespace NewHorizons.Builder.Props.Audio
var freq = CollectionUtilities.KeyByValue(_customFrequencyNames, str); var freq = CollectionUtilities.KeyByValue(_customFrequencyNames, str);
if (freq != default) return freq; if (freq != default) return freq;
NHLogger.Log($"Registering new frequency name [{str}]");
if (NumberOfFrequencies == 31) if (NumberOfFrequencies == 31)
{ {
NHLogger.LogWarning($"Can't store any more frequencies, skipping [{str}]"); NHLogger.LogWarning($"Can't store any more frequencies, skipping [{str}]");
@ -111,10 +109,9 @@ namespace NewHorizons.Builder.Props.Audio
freq = EnumUtilities.Create<SignalFrequency>(str); freq = EnumUtilities.Create<SignalFrequency>(str);
_customFrequencyNames.Add(freq, str); _customFrequencyNames.Add(freq, str);
NumberOfFrequencies = EnumUtils.GetValues<SignalFrequency>().Length; NHLogger.Log($"Registered new frequency name [{str}] with value [{(int)freq}] and index [{AudioSignal.FrequencyToIndex(freq)}]");
// This stuff happens after the signalscope is Awake so we have to change the number of frequencies now NumberOfFrequencies = EnumUtils.GetValues<SignalFrequency>().Length;
GameObject.FindObjectOfType<Signalscope>()._strongestSignals = new AudioSignal[NumberOfFrequencies + 1];
return freq; return freq;
} }

View File

@ -45,7 +45,9 @@ namespace NewHorizons.Patches.SignalPatches
SignalFrequency.HideAndSeek => 5, SignalFrequency.HideAndSeek => 5,
SignalFrequency.Radio => 6, SignalFrequency.Radio => 6,
SignalFrequency.Statue => 7, SignalFrequency.Statue => 7,
_ => (int)(Mathf.Log((float)frequency) / Mathf.Log(2f)),// Frequencies are in powers of 2 // Can't cast to int because floating point error, it was doing 12.9999999 -> 12
// Frequencies are in powers of 2
_ => Mathf.RoundToInt(Mathf.Log((float)frequency) / Mathf.Log(2f)),
}; };
return false; return false;
} }

View File

@ -11,7 +11,7 @@ namespace NewHorizons.Patches.SignalPatches
[HarmonyPatch(nameof(Signalscope.Awake))] [HarmonyPatch(nameof(Signalscope.Awake))]
public static void Signalscope_Awake(Signalscope __instance) public static void Signalscope_Awake(Signalscope __instance)
{ {
__instance._strongestSignals = new AudioSignal[8]; __instance._strongestSignals = new AudioSignal[32];
} }
[HarmonyPrefix] [HarmonyPrefix]

View File

@ -4,7 +4,7 @@
"author": "xen, Bwc9876, JohnCorby, MegaPiggy, and friends", "author": "xen, Bwc9876, JohnCorby, MegaPiggy, and friends",
"name": "New Horizons", "name": "New Horizons",
"uniqueName": "xen.NewHorizons", "uniqueName": "xen.NewHorizons",
"version": "1.28.5", "version": "1.28.6",
"owmlVersion": "2.12.1", "owmlVersion": "2.12.1",
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "PacificEngine.OW_CommonResources" ], "conflicts": [ "PacificEngine.OW_CommonResources" ],

View File

@ -23,4 +23,6 @@ To unlock ship logs after reading each text block, add a `<ShipLogConditions>` n
In your planet config, you must define where the Nomai text is positioned. See [the translator text json schema](/schemas/body-schema/defs/translatortextinfo/) for more info. In your planet config, you must define where the Nomai text is positioned. See [the translator text json schema](/schemas/body-schema/defs/translatortextinfo/) for more info.
You can input a `seed` for a wall of text which will randomly generate the position of each arc. To test out different combinations, just keep incrementing the number and then hit "Reload Configs" from the pause menu with debug mode on. This seed ensures the same positioning each time the mod is played. Alternatively, you can use `arcInfo` to set the position and rotation of all text arcs, as well as determining their types (adult, teenager, child, or Stranger). The various age stages make the text look messier, while Stranger allows you to make a translatable version of the DLC text. You can input a `seed` for a wall of text which will randomly generate the position of each arc. To test out different combinations, just keep incrementing the number and then hit "Reload Configs" from the pause menu with debug mode on. This seed ensures the same positioning each time the mod is played. Alternatively, you can use `arcInfo` to set the position and rotation of all text arcs, as well as determining their types (adult, teenager, child, or Stranger). The various age stages make the text look messier, while Stranger allows you to make a translatable version of the DLC text.
If you decide to arrange text manually in your mod, the [Unity Explorer](https://outerwildsmods.com/mods/unityexplorer/) and [Nomai Text Printer](https://github.com/coderCleric/NomaiTextPrinter) mods can make that much more convenient.

View File

@ -56,6 +56,7 @@ These mods are useful when developing your addon
- [Save Editor](https://outerwildsmods.com/mods/saveeditor) - Useful when creating a custom [ship log](/ship-log), can be used to reveal all custom facts so you can see them in the ship's computer. - [Save Editor](https://outerwildsmods.com/mods/saveeditor) - Useful when creating a custom [ship log](/ship-log), can be used to reveal all custom facts so you can see them in the ship's computer.
- [Time Saver](https://outerwildsmods.com/mods/timesaver/) - Lets you skip some repeated cutscenes and get into the game faster. - [Time Saver](https://outerwildsmods.com/mods/timesaver/) - Lets you skip some repeated cutscenes and get into the game faster.
- [The Examples Mod](https://github.com/Outer-Wilds-New-Horizons/nh-examples) - A mod that contains examples of how to use New Horizons features. - [The Examples Mod](https://github.com/Outer-Wilds-New-Horizons/nh-examples) - A mod that contains examples of how to use New Horizons features.
- [Nomai Text Printer](https://github.com/coderCleric/NomaiTextPrinter) - Useful for saving text changes (such as moving arcs with Unity Explorer) to your json files.
## Helpful Tools ## Helpful Tools