mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Gravity cannon computer will write the planet the Shuttle starts on
This commit is contained in:
parent
76705a5b37
commit
d284380f9e
@ -22,7 +22,8 @@
|
|||||||
"DEBUG_PLACE_TEXT": "Place Nomai Text",
|
"DEBUG_PLACE_TEXT": "Place Nomai Text",
|
||||||
"DEBUG_UNDO": "Undo",
|
"DEBUG_UNDO": "Undo",
|
||||||
"DEBUG_REDO": "Redo",
|
"DEBUG_REDO": "Redo",
|
||||||
"Vessel": "Vessel"
|
"Vessel": "Vessel",
|
||||||
|
"NOMAI_SHUTTLE_COMPUTER": "The <![CDATA[<color=orange>shuttle</color>]]> is currently resting at <![CDATA[<color=lightblue>{0}</color>]]>."
|
||||||
},
|
},
|
||||||
"AchievementTranslations": {
|
"AchievementTranslations": {
|
||||||
"NH_EATEN_OUTSIDE_BRAMBLE": {
|
"NH_EATEN_OUTSIDE_BRAMBLE": {
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
using NewHorizons.Builder.Props.TranslatorText;
|
using NewHorizons.Builder.Props.TranslatorText;
|
||||||
|
using NewHorizons.Components.Orbital;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.External.Modules.Props;
|
using NewHorizons.External.Modules.Props;
|
||||||
using NewHorizons.External.Modules.Props.Shuttle;
|
using NewHorizons.External.Modules.Props.Shuttle;
|
||||||
|
using NewHorizons.External.Modules.TranslatorText;
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
|
using NewHorizons.Utility.OuterWilds;
|
||||||
using NewHorizons.Utility.OWML;
|
using NewHorizons.Utility.OWML;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -76,7 +80,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
gravityCannonObject.SetActive(false);
|
gravityCannonObject.SetActive(false);
|
||||||
|
|
||||||
var gravityCannonController = gravityCannonObject.GetComponent<GravityCannonController>();
|
var gravityCannonController = gravityCannonObject.GetComponent<GravityCannonController>();
|
||||||
gravityCannonController._shuttleID = ShuttleHandler.GetShuttleID(info.shuttleID);
|
var id = ShuttleHandler.GetShuttleID(info.shuttleID);
|
||||||
|
gravityCannonController._shuttleID = id;
|
||||||
|
|
||||||
// Gravity controller checks string length instead of isnullorempty
|
// Gravity controller checks string length instead of isnullorempty
|
||||||
gravityCannonController._retrieveShipLogFact = info.retrieveReveal ?? string.Empty;
|
gravityCannonController._retrieveShipLogFact = info.retrieveReveal ?? string.Empty;
|
||||||
@ -86,7 +91,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (info.computer != null)
|
if (info.computer != null)
|
||||||
{
|
{
|
||||||
gravityCannonController._nomaiComputer = CreateComputer(planetGO, sector, info.computer);
|
// Do it next update so that the shuttle has been made
|
||||||
|
Delay.FireOnNextUpdate(() =>
|
||||||
|
{
|
||||||
|
gravityCannonController._nomaiComputer = CreateComputer(planetGO, sector, info.computer, id);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -140,14 +149,23 @@ namespace NewHorizons.Builder.Props
|
|||||||
}, () => Main.IsSystemReady, 10);
|
}, () => Main.IsSystemReady, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static NomaiComputer CreateComputer(GameObject planetGO, Sector sector, GeneralPropInfo computerInfo)
|
private static NomaiComputer CreateComputer(GameObject planetGO, Sector sector, GeneralPropInfo computerInfo, NomaiShuttleController.ShuttleID id)
|
||||||
{
|
{
|
||||||
var computerObject = DetailBuilder.Make(planetGO, sector, TranslatorTextBuilder.ComputerPrefab, new DetailInfo(computerInfo));
|
// Load the position info from the GeneralPropInfo
|
||||||
|
var translatorTextInfo = new TranslatorTextInfo();
|
||||||
|
JsonConvert.PopulateObject(JsonConvert.SerializeObject(computerInfo), translatorTextInfo);
|
||||||
|
translatorTextInfo.type = NomaiTextType.Computer;
|
||||||
|
|
||||||
|
var shuttle = ShuttleBuilder.Shuttles[id];
|
||||||
|
var planet = AstroObjectLocator.GetPlanetName(shuttle.GetComponentInParent<AstroObject>());
|
||||||
|
|
||||||
|
var displayText = TranslationHandler.GetTranslation("NOMAI_SHUTTLE_COMPUTER", TranslationHandler.TextType.UI).Replace("{0}", planet);
|
||||||
|
NHLogger.Log(displayText);
|
||||||
|
var xmlContent = $"<NomaiObject>\r\n <TextBlock>\r\n <ID>1</ID>\r\n <Text>{displayText}</Text>\r\n </TextBlock>\r\n</NomaiObject>";
|
||||||
|
|
||||||
|
var computerObject = TranslatorTextBuilder.Make(planetGO, sector, translatorTextInfo, null, xmlContent);
|
||||||
|
|
||||||
var computer = computerObject.GetComponentInChildren<NomaiComputer>();
|
var computer = computerObject.GetComponentInChildren<NomaiComputer>();
|
||||||
computer.SetSector(sector);
|
|
||||||
|
|
||||||
Delay.FireOnNextUpdate(computer.ClearAllEntries);
|
|
||||||
|
|
||||||
computerObject.SetActive(true);
|
computerObject.SetActive(true);
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using NewHorizons.External.Modules.Props;
|
|||||||
using NewHorizons.External.Modules.Props.Shuttle;
|
using NewHorizons.External.Modules.Props.Shuttle;
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Props
|
namespace NewHorizons.Builder.Props
|
||||||
@ -13,6 +14,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
private static GameObject _orbPrefab;
|
private static GameObject _orbPrefab;
|
||||||
private static GameObject _bodyPrefab;
|
private static GameObject _bodyPrefab;
|
||||||
|
|
||||||
|
public static Dictionary<NomaiShuttleController.ShuttleID, NomaiShuttleController> Shuttles { get; } = new();
|
||||||
|
|
||||||
internal static void InitPrefab()
|
internal static void InitPrefab()
|
||||||
{
|
{
|
||||||
if (_prefab == null)
|
if (_prefab == null)
|
||||||
@ -108,6 +111,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
orbObject.SetActive(true);
|
orbObject.SetActive(true);
|
||||||
shuttleController._orb.RemoveAllLocks();
|
shuttleController._orb.RemoveAllLocks();
|
||||||
|
|
||||||
|
Shuttles[id] = shuttleController;
|
||||||
|
|
||||||
return shuttleObject;
|
return shuttleObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using NewHorizons.External;
|
using NewHorizons.External;
|
||||||
using NewHorizons.External.Modules.Props;
|
using NewHorizons.External.Modules.Props;
|
||||||
using NewHorizons.External.SerializableData;
|
|
||||||
using NewHorizons.External.Modules.TranslatorText;
|
using NewHorizons.External.Modules.TranslatorText;
|
||||||
|
using NewHorizons.External.SerializableData;
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using NewHorizons.Utility.Geometry;
|
using NewHorizons.Utility.Geometry;
|
||||||
@ -14,7 +14,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Props.TranslatorText
|
namespace NewHorizons.Builder.Props.TranslatorText
|
||||||
@ -137,6 +136,11 @@ namespace NewHorizons.Builder.Props.TranslatorText
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Make(planetGO, sector, info, nhBody, xmlContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GameObject Make(GameObject planetGO, Sector sector, TranslatorTextInfo info, NewHorizonsBody nhBody, string xmlContent)
|
||||||
|
{
|
||||||
switch (info.type)
|
switch (info.type)
|
||||||
{
|
{
|
||||||
case NomaiTextType.Wall:
|
case NomaiTextType.Wall:
|
||||||
@ -401,7 +405,7 @@ namespace NewHorizons.Builder.Props.TranslatorText
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static NomaiWallText MakeWallText(GameObject go, Sector sector, TranslatorTextInfo info, string xmlPath, NewHorizonsBody nhBody)
|
private static NomaiWallText MakeWallText(GameObject go, Sector sector, TranslatorTextInfo info, string xmlContent, NewHorizonsBody nhBody)
|
||||||
{
|
{
|
||||||
GameObject nomaiWallTextObj = new GameObject("NomaiWallText");
|
GameObject nomaiWallTextObj = new GameObject("NomaiWallText");
|
||||||
nomaiWallTextObj.SetActive(false);
|
nomaiWallTextObj.SetActive(false);
|
||||||
@ -418,13 +422,13 @@ namespace NewHorizons.Builder.Props.TranslatorText
|
|||||||
|
|
||||||
nomaiWallText._location = EnumUtils.Parse<NomaiText.Location>(info.location.ToString());
|
nomaiWallText._location = EnumUtils.Parse<NomaiText.Location>(info.location.ToString());
|
||||||
|
|
||||||
var text = new TextAsset(xmlPath);
|
var text = new TextAsset(xmlContent);
|
||||||
|
|
||||||
// Text assets need a name to be used with VoiceMod
|
// Text assets need a name to be used with VoiceMod
|
||||||
text.name = Path.GetFileNameWithoutExtension(info.xmlFile);
|
text.name = Path.GetFileNameWithoutExtension(info.xmlFile);
|
||||||
|
|
||||||
BuildArcs(xmlPath, nomaiWallText, nomaiWallTextObj, info, nhBody);
|
BuildArcs(xmlContent, nomaiWallText, nomaiWallTextObj, info, nhBody);
|
||||||
AddTranslation(xmlPath);
|
AddTranslation(xmlContent);
|
||||||
nomaiWallText._nomaiTextAsset = text;
|
nomaiWallText._nomaiTextAsset = text;
|
||||||
|
|
||||||
nomaiWallText.SetTextAsset(text);
|
nomaiWallText.SetTextAsset(text);
|
||||||
|
|||||||
@ -8,9 +8,9 @@ namespace NewHorizons.Handlers
|
|||||||
{
|
{
|
||||||
public static class TranslationHandler
|
public static class TranslationHandler
|
||||||
{
|
{
|
||||||
private static Dictionary<TextTranslation.Language, Dictionary<string, string>> _shipLogTranslationDictionary = new Dictionary<TextTranslation.Language, Dictionary<string, string>>();
|
private static Dictionary<TextTranslation.Language, Dictionary<string, string>> _shipLogTranslationDictionary = new();
|
||||||
private static Dictionary<TextTranslation.Language, Dictionary<string, string>> _dialogueTranslationDictionary = new Dictionary<TextTranslation.Language, Dictionary<string, string>>();
|
private static Dictionary<TextTranslation.Language, Dictionary<string, string>> _dialogueTranslationDictionary = new();
|
||||||
private static Dictionary<TextTranslation.Language, Dictionary<string, string>> _uiTranslationDictionary = new Dictionary<TextTranslation.Language, Dictionary<string, string>>();
|
private static Dictionary<TextTranslation.Language, Dictionary<string, string>> _uiTranslationDictionary = new();
|
||||||
|
|
||||||
public enum TextType
|
public enum TextType
|
||||||
{
|
{
|
||||||
@ -93,8 +93,9 @@ namespace NewHorizons.Handlers
|
|||||||
if (!_uiTranslationDictionary.ContainsKey(language)) _uiTranslationDictionary.Add(language, new Dictionary<string, string>());
|
if (!_uiTranslationDictionary.ContainsKey(language)) _uiTranslationDictionary.Add(language, new Dictionary<string, string>());
|
||||||
foreach (var originalKey in config.UIDictionary.Keys)
|
foreach (var originalKey in config.UIDictionary.Keys)
|
||||||
{
|
{
|
||||||
var key = originalKey.Replace("<", "<").Replace(">", ">").Replace("<![CDATA[", "").Replace("]]>", "");
|
// Don't remove CDATA from UI
|
||||||
var value = config.UIDictionary[originalKey].Replace("<", "<").Replace(">", ">").Replace("<![CDATA[", "").Replace("]]>", "");
|
var key = originalKey.Replace("<", "<").Replace(">", ">");
|
||||||
|
var value = config.UIDictionary[originalKey].Replace("<", "<").Replace(">", ">");
|
||||||
|
|
||||||
if (!_uiTranslationDictionary[language].ContainsKey(key)) _uiTranslationDictionary[language].Add(key, value);
|
if (!_uiTranslationDictionary[language].ContainsKey(key)) _uiTranslationDictionary[language].Add(key, value);
|
||||||
else _uiTranslationDictionary[language][key] = value;
|
else _uiTranslationDictionary[language][key] = value;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using NewHorizons.Components.Orbital;
|
||||||
|
using NewHorizons.Handlers;
|
||||||
using NewHorizons.Utility.OWML;
|
using NewHorizons.Utility.OWML;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -177,5 +179,32 @@ namespace NewHorizons.Utility.OuterWilds
|
|||||||
|
|
||||||
return otherChildren.ToArray();
|
return otherChildren.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetPlanetName(AstroObject astroObject)
|
||||||
|
{
|
||||||
|
if (astroObject != null)
|
||||||
|
{
|
||||||
|
if (astroObject is NHAstroObject nhAstroObject)
|
||||||
|
{
|
||||||
|
var customName = nhAstroObject.GetCustomName();
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(customName))
|
||||||
|
{
|
||||||
|
return TranslationHandler.GetTranslation(customName, TranslationHandler.TextType.UI, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AstroObject.Name astroObjectName = astroObject.GetAstroObjectName();
|
||||||
|
|
||||||
|
if (astroObjectName - AstroObject.Name.Sun <= 7 || astroObjectName - AstroObject.Name.TimberMoon <= 1)
|
||||||
|
{
|
||||||
|
return AstroObject.AstroObjectNameToString(astroObject.GetAstroObjectName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "???";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user