Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.19.0 #795

Merged
merged 26 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ccd3e29
Keys are now much more forgiving (ignores whitespace casing why not)
xen-42 Mar 8, 2024
9191dc2
Update TranslationHandler.cs
xen-42 Mar 8, 2024
057554a
Translation fixes for Astral Codec (#794)
xen-42 Mar 8, 2024
641084a
Add shipLogStartingPlanetID to star system config
Bwc9876 Mar 9, 2024
a5a068d
fix compile error
JohnCorby Mar 9, 2024
8946ce3
Updated Schemas
Bwc9876 Mar 9, 2024
9f69964
Add shipLogStartingPlanetID to Star System Config (#798)
JohnCorby Mar 9, 2024
159ffbb
Add secret page docs
Bwc9876 Mar 9, 2024
e3ecb55
RigidbodyPatches - Don't run when QSB is installed
misternebula Mar 10, 2024
0036028
Don't run rigidbody patches when QSB is installed. (#800)
JohnCorby Mar 10, 2024
e8b0bf4
Check for null refs inside streaming warp volume then destroy it
xen-42 Mar 11, 2024
c21fd90
Fix ocean fog
xen-42 Mar 12, 2024
1c11c49
Destroy whole game object
xen-42 Mar 12, 2024
717047b
Fix ocean fog (#803)
xen-42 Mar 12, 2024
13b28fa
Dont add timeloopcontroller to base system
xen-42 Mar 12, 2024
b5ec327
Track new fog warp volumes and only patch those
xen-42 Mar 12, 2024
7bfe3d2
Remove unused volume
xen-42 Mar 12, 2024
b1b7f43
Fix bramble seeds being the wrong size
xen-42 Mar 12, 2024
c615902
Subtitles can now be larger, added subtitle to api (outsider compat)
xen-42 Mar 12, 2024
90c3b9b
Fix subtitle breaking when theres only one
xen-42 Mar 12, 2024
b00aaa6
Dont add timeloopcontroller to base system (#804)
xen-42 Mar 12, 2024
80e9e34
Check for null refs inside streaming warp volume then destroy it (#802)
xen-42 Mar 12, 2024
4997b91
Just return true
xen-42 Mar 12, 2024
61a3717
Fixes for Outsider (#805)
xen-42 Mar 13, 2024
00b3965
Update manifest.json
xen-42 Mar 13, 2024
b0e9437
Merge branch 'dev' of https://github.com/Outer-Wilds-New-Horizons/new…
xen-42 Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NewHorizons/External/Configs/StarSystemConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ public class StarSystemConfig
/// </summary>
public string[] initialReveal;

/// <summary>
/// The planet to focus on when entering the ship log for the first time in a loop. If not set this will be the planet at navtigation position (1, 0)
/// </summary>
public string shipLogStartingPlanetID;

/// <summary>
/// List colors of curiosity entries
/// </summary>
Expand Down
18 changes: 16 additions & 2 deletions NewHorizons/Handlers/TranslationHandler.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using NewHorizons.External.Configs;
using NewHorizons.Utility;
using NewHorizons.Utility.OWML;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace NewHorizons.Handlers
{
Expand Down Expand Up @@ -49,8 +51,17 @@ public static string GetTranslation(string text, TextType type, bool warn)

// Get the translated text
if (dictionary.TryGetValue(language, out var table))
{
if (table.TryGetValue(text, out var translatedText))
{
return translatedText;
}
// Try without whitespace if its missing
else if (table.TryGetValue(text.TruncateWhitespace(), out translatedText))
{
return translatedText;
}
}

if (warn) NHLogger.LogVerbose($"Defaulting to english for {text}");

Expand Down Expand Up @@ -85,8 +96,11 @@ public static void RegisterTranslation(TextTranslation.Language language, Transl
if (!_dialogueTranslationDictionary.ContainsKey(language)) _dialogueTranslationDictionary.Add(language, new Dictionary<string, string>());
foreach (var originalKey in config.DialogueDictionary.Keys)
{
var key = originalKey.Replace("&lt;", "<").Replace("&gt;", ">").Replace("<![CDATA[", "").Replace("]]>", "");
var value = config.DialogueDictionary[originalKey].Replace("&lt;", "<").Replace("&gt;", ">").Replace("<![CDATA[", "").Replace("]]>", "");
// Fix new lines in dialogue translations, remove whitespace from keys else if the dialogue has weird whitespace and line breaks it gets really annoying
// to write translation keys for (can't just copy paste out of xml, have to start adding \\n and \\r and stuff
// If any of these issues become relevant to other dictionaries we can bring this code over, but for now why fix what isnt broke
var key = originalKey.Replace("\\n", "\n").TruncateWhitespace().Replace("&lt;", "<").Replace("&gt;", ">").Replace("<![CDATA[", "").Replace("]]>", "");
var value = config.DialogueDictionary[originalKey].Replace("\\n", "\n").Replace("&lt;", "<").Replace("&gt;", ">").Replace("<![CDATA[", "").Replace("]]>", "");

if (!_dialogueTranslationDictionary[language].ContainsKey(key)) _dialogueTranslationDictionary[language].Add(key, value);
else _dialogueTranslationDictionary[language][key] = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void ShipLogMapMode_Initialize(ShipLogMapMode __instance)
else
{
__instance._astroObjects = navMatrix;
__instance._startingAstroObjectID = navMatrix[1][0].GetID();
__instance._startingAstroObjectID = Main.SystemDict[Main.Instance.CurrentStarSystem].Config.shipLogStartingPlanetID ?? navMatrix[1][0].GetID();
if (Main.Instance.CurrentStarSystem != "SolarSystem")
{
List<GameObject> delete = panRoot.GetAllChildren().Where(g => g.name.Contains("_ShipLog") == false).ToList();
Expand Down
4 changes: 4 additions & 0 deletions NewHorizons/Schemas/star_system_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
"type": "string"
}
},
"shipLogStartingPlanetID": {
"type": "string",
"description": "The planet to focus on when entering the ship log for the first time in a loop. If not set this will be the planet at navtigation position (1, 0)"
},
"curiosities": {
"type": "array",
"description": "List colors of curiosity entries",
Expand Down
6 changes: 6 additions & 0 deletions NewHorizons/Utility/NewHorizonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,5 +350,11 @@ public static XmlNode GetChildNode(this XmlNode parentNode, string tagName)
{
return parentNode.ChildNodes.Cast<XmlNode>().First(node => node.LocalName == tagName);
}

public static string TruncateWhitespace(this string text)
{
// return Regex.Replace(text.Trim(), @"[^\S\r\n]+", "GUH");
return Regex.Replace(text.Trim(), @"\s+", " ").ToLowerInvariant();
}
}
}
2 changes: 1 addition & 1 deletion NewHorizons/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "xen, Bwc9876, JohnCorby, MegaPiggy, Clay, Trifid, and friends",
"name": "New Horizons",
"uniqueName": "xen.NewHorizons",
"version": "1.18.9",
"version": "1.18.10",
"owmlVersion": "2.9.8",
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],
Expand Down
Loading