Merge branch 'dev' into stellar-remnants

This commit is contained in:
Noah Pilarski 2022-08-22 17:21:25 -04:00
commit 827a0b464d
28 changed files with 222 additions and 92 deletions

View File

@ -11,7 +11,10 @@
"FREQ_WARP_CORE": "Anti-Graviton Flux",
"FREQ_UNKNOWN": "???",
"ENGAGE_WARP_PROMPT": "Engage Warp To {0}",
"WARP_LOCKED": "AUTOPILOT LOCKED TO:\n{0}"
"WARP_LOCKED": "AUTOPILOT LOCKED TO:\n{0}",
"LOCK_AUTOPILOT_WARP": "Lock Autopilot to Star System",
"RICH_PRESENCE_EXPLORING": "Exploring {0}.",
"RICH_PRESENCE_WARPING": "Warping to {0}."
},
"AchievementTranslations": {
"NH_EATEN_OUTSIDE_BRAMBLE": {

View File

@ -6,9 +6,40 @@
"NEW_HORIZONS_WARP_DRIVE_DIALOGUE_3": "Ensuite, bouclez votre ceinture et engagez le pilote automatique pour y aller!"
},
"UIDictionary": {
"INTERSTELLAR_MODE": "Mode Interstellaire",
"INTERSTELLAR_MODE": "Mode interstellaire",
"FREQ_STATUE": "Statue Nomaï",
"FREQ_WARP_CORE": "Flux Anti-Gravitonique",
"FREQ_UNKNOWN": "???"
"FREQ_UNKNOWN": "???",
"ENGAGE_WARP_PROMPT": "Engagez la distorsion vers {0}",
"WARP_LOCKED": "PILOTE AUTOMATIQUE VISÉ SUR:\n{0}",
"LOCK_AUTOPILOT_WARP": "Visez le pilote automatique",
"RICH_PRESENCE_EXPLORING": "En explorant {0}.",
"RICH_PRESENCE_WARPING": "En route vers {0}."
},
"AchievementTranslations": {
"NH_EATEN_OUTSIDE_BRAMBLE": {
"Name": "Brèche de confinement",
"Description": "Soyez mangé à l'extérieur de Sombronces."
},
"NH_MULTIPLE_SYSTEM": {
"Name": "Le voyageur",
"Description": "Visitez 5 systèmes solaires uniques d'affilée."
},
"NH_NEW_FREQ": {
"Name": "Fréquence anormale",
"Description": "Découvrez une nouvelle fréquence."
},
"NH_PROBE_LOST": {
"Name": "Connexion perdue",
"Description": "Perdez votre lance-guetteur."
},
"NH_WARP_DRIVE": {
"Name": "En désaccord avec l'histoire.",
"Description": "Utilisez le moteur de distorsion de votre fusée."
},
"NH_VESSEL_WARP": {
"Name": "En accord avec l'histoire.",
"Description": "Voyagez vers un autre système solaire avec le Vaissau."
}
}
}

View File

@ -1,4 +1,4 @@
using NewHorizons.AchievementsPlus;
using NewHorizons.OtherMods.AchievementsPlus;
using NewHorizons.Components;
using NewHorizons.External.Modules;
using NewHorizons.Utility;

View File

@ -45,6 +45,7 @@ namespace NewHorizons.Builder.Props
}
});
}
private static void FixMeteor(MeteorController meteor, PropModule.VolcanoInfo info)
{
meteor.transform.localScale = Vector3.one * info.scale;
@ -53,24 +54,16 @@ namespace NewHorizons.Builder.Props
mat.SetColor(Color1, info.stoneTint?.ToColor() ?? defaultStoneTint);
mat.SetColor(EmissionColor, info.lavaTint?.ToColor() ?? defaultLavaTint);
var detectors = meteor.transform.Find("ConstantDetectors").gameObject;
GameObject.Destroy(detectors.GetComponent<ConstantForceDetector>());
GameObject.Destroy(detectors.GetComponent<ConstantFluidDetector>());
GameObject.Destroy(meteor.transform.Find("ConstantDetectors").gameObject);
var detectors = meteor.transform.Find("DynamicDetector").gameObject;
meteor._constantFluidDetector = null;
meteor._constantForceDetector = null;
var forceDetector = detectors.gameObject.AddComponent<DynamicForceDetector>();
detectors.gameObject.AddComponent<DynamicFluidDetector>();
detectors.layer = LayerMask.NameToLayer("BasicDetector");
var sphere = detectors.AddComponent<SphereCollider>();
sphere.radius = 1;
var sphere2 = detectors.AddComponent<SphereShape>();
sphere2._collisionMode = Shape.CollisionMode.Detector;
sphere2.radius = 1;
forceDetector._collider = sphere;
forceDetector._shape = sphere2;
meteor._owColliders = meteor.gameObject.GetComponentsInChildren<OWCollider>();
}
}
}

View File

@ -1,4 +1,4 @@
using NewHorizons.AchievementsPlus;
using NewHorizons.OtherMods.AchievementsPlus;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,4 @@
using NewHorizons.AchievementsPlus;
using NewHorizons.OtherMods.AchievementsPlus;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,4 @@
using NewHorizons.AchievementsPlus;
using NewHorizons.OtherMods.AchievementsPlus;
using UnityEngine;
namespace NewHorizons.Components.Achievement

View File

@ -1,4 +1,4 @@
using NewHorizons.AchievementsPlus.NH;
using NewHorizons.OtherMods.AchievementsPlus.NH;
namespace NewHorizons.Components
{

View File

@ -47,8 +47,8 @@ namespace NewHorizons.Components
_centerPromptList = centerPromptList;
_upperRightPromptList = upperRightPromptList;
_detectiveModePrompt = new ScreenPrompt(InputLibrary.swapShipLogMode, "Rumor Mode", 0, ScreenPrompt.DisplayState.Normal, false);
_targetSystemPrompt = new ScreenPrompt(InputLibrary.markEntryOnHUD, "Lock Autopilot to Star System", 0, ScreenPrompt.DisplayState.Normal, false);
_detectiveModePrompt = new ScreenPrompt(InputLibrary.swapShipLogMode, UITextLibrary.GetString(UITextType.LogRumorModePrompt), 0, ScreenPrompt.DisplayState.Normal, false);
_targetSystemPrompt = new ScreenPrompt(InputLibrary.markEntryOnHUD, TranslationHandler.GetTranslation("LOCK_AUTOPILOT_WARP", TranslationHandler.TextType.UI), 0, ScreenPrompt.DisplayState.Normal, false);
GlobalMessenger<ReferenceFrame>.AddListener("TargetReferenceFrame", new Callback<ReferenceFrame>(OnTargetReferenceFrame));

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using NewHorizons.AchievementsPlus;
using NewHorizons.OtherMods.AchievementsPlus;
using NewHorizons.External.Modules;
using NewHorizons.External.Modules.VariableSize;
using Newtonsoft.Json;

View File

@ -7,6 +7,7 @@ using NewHorizons.Components;
using NewHorizons.Components.Orbital;
using NewHorizons.Components.SizeControllers;
using NewHorizons.External.Modules;
using NewHorizons.OtherMods.OWRichPresence;
using NewHorizons.Utility;
using System;
using System.Collections.Generic;
@ -455,6 +456,8 @@ namespace NewHorizons.Handlers
});
}
RichPresenceHandler.SetUpPlanet(body.Config.name, go, sector);
Logger.LogVerbose($"Finished creating [{body.Config.name}]");
return go;

View File

@ -2,6 +2,8 @@ using NewHorizons.External.Configs;
using System;
using System.Collections.Generic;
using System.Linq;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Handlers
{
public static class TranslationHandler
@ -18,11 +20,6 @@ namespace NewHorizons.Handlers
}
public static string GetTranslation(string text, TextType type)
{
return GetTranslation(text, type, out var _);
}
public static string GetTranslation(string text, TextType type, out TextTranslation.Language translatedLanguage)
{
Dictionary<TextTranslation.Language, Dictionary<string, string>> dictionary;
var language = TextTranslation.Get().m_language;
@ -39,32 +36,25 @@ namespace NewHorizons.Handlers
dictionary = _uiTranslationDictionary;
break;
default:
translatedLanguage = TextTranslation.Language.UNKNOWN;
Logger.LogVerbose($"Invalid TextType {type}");
return text;
}
// Get the translated text
if (dictionary.TryGetValue(language, out var table))
{
if (table.TryGetValue(text, out var translatedText))
{
translatedLanguage = language;
return translatedText;
}
}
Logger.LogVerbose($"Defaulting to english for {text}");
// Try to default to English
if (dictionary.TryGetValue(TextTranslation.Language.ENGLISH, out var englishTable))
{
if (englishTable.TryGetValue(text, out var englishText))
{
translatedLanguage = TextTranslation.Language.ENGLISH;
return englishText;
}
}
Logger.LogVerbose($"Defaulting to key for {text}");
// Default to the key
translatedLanguage = TextTranslation.Language.UNKNOWN;
return text;
}

View File

@ -1,5 +1,5 @@
using HarmonyLib;
using NewHorizons.AchievementsPlus;
using NewHorizons.OtherMods.AchievementsPlus;
using NewHorizons.Builder.Atmosphere;
using NewHorizons.Builder.Body;
using NewHorizons.Builder.Props;
@ -10,7 +10,7 @@ using NewHorizons.Handlers;
using NewHorizons.Utility;
using NewHorizons.Utility.DebugMenu;
using NewHorizons.Utility.DebugUtilities;
using NewHorizons.VoiceActing;
using NewHorizons.OtherMods.VoiceActing;
using OWML.Common;
using OWML.ModHelper;
using System;
@ -22,6 +22,7 @@ using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using Logger = NewHorizons.Utility.Logger;
using NewHorizons.OtherMods.OWRichPresence;
namespace NewHorizons
{
@ -198,6 +199,9 @@ namespace NewHorizons
AchievementHandler.Init();
VoiceHandler.Init();
RichPresenceHandler.Init();
OnStarSystemLoaded.AddListener(RichPresenceHandler.OnStarSystemLoaded);
OnChangeStarSystem.AddListener(RichPresenceHandler.OnChangeStarSystem);
LoadAddonManifest("Assets/addon-manifest.json", this);
}

View File

@ -1,10 +1,11 @@
using NewHorizons.External.Configs;
using NewHorizons.Utility;
using OWML.ModHelper;
using System;
using System.Collections.Generic;
using System.Linq;
namespace NewHorizons.AchievementsPlus
namespace NewHorizons.OtherMods.AchievementsPlus
{
public static class AchievementHandler
{
@ -15,6 +16,8 @@ namespace NewHorizons.AchievementsPlus
private static List<AchievementInfo> _achievements;
public static void Init()
{
try
{
API = Main.Instance.ModHelper.Interaction.TryGetModApi<IAchievements>("xen.AchievementTracker");
@ -41,6 +44,11 @@ namespace NewHorizons.AchievementsPlus
GlobalMessenger<string, bool>.AddListener("DialogueConditionChanged", OnDialogueConditionChanged);
}
catch(Exception ex)
{
Logger.LogError($"Achievements+ handler failed to initialize: {ex}");
}
}
public static void OnDestroy()
{

View File

@ -2,7 +2,7 @@ using NewHorizons.Builder.Props;
using Newtonsoft.Json;
using System.Linq;
namespace NewHorizons.AchievementsPlus
namespace NewHorizons.OtherMods.AchievementsPlus
{
/// <summary>
/// Info for an achievement to be used with the Achievements+ mod.

View File

@ -1,6 +1,6 @@
using OWML.ModHelper;
namespace NewHorizons.AchievementsPlus
namespace NewHorizons.OtherMods.AchievementsPlus
{
public interface IAchievements
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.AchievementsPlus.NH
namespace NewHorizons.OtherMods.AchievementsPlus.NH
{
public static class EatenOutsideBrambleAchievement
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.AchievementsPlus.NH
namespace NewHorizons.OtherMods.AchievementsPlus.NH
{
public static class MultipleSystemAchievement
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.AchievementsPlus.NH
namespace NewHorizons.OtherMods.AchievementsPlus.NH
{
public static class NewFrequencyAchievement
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.AchievementsPlus.NH
namespace NewHorizons.OtherMods.AchievementsPlus.NH
{
public static class ProbeLostAchievement
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.AchievementsPlus.NH
namespace NewHorizons.OtherMods.AchievementsPlus.NH
{
public static class VesselWarpAchievement
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.AchievementsPlus.NH
namespace NewHorizons.OtherMods.AchievementsPlus.NH
{
public static class WarpDriveAchievement
{

View File

@ -0,0 +1,14 @@
using UnityEngine;
namespace NewHorizons.OtherMods.OWRichPresence
{
public interface IRichPresenceAPI
{
public void SetRichPresence(string message, int imageKey);
public void SetRichPresence(string message, string imageKey);
public void SetTriggerActivation(bool active);
public GameObject CreateTrigger(GameObject parent, string message, string imageKey);
public GameObject CreateTrigger(GameObject parent, Sector sector, string message, string imageKey);
public void SetCurrentRootPresence(string message, string imageKey);
}
}

View File

@ -0,0 +1,71 @@
using NewHorizons.Components;
using NewHorizons.Handlers;
using NewHorizons.Utility;
using System;
using System.IO;
using System.Linq;
using UnityEngine;
using UnityEngine.SceneManagement;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.OtherMods.OWRichPresence
{
public class RichPresenceHandler
{
public static bool Enabled { get; private set; }
private static IRichPresenceAPI API;
public static void Init()
{
try
{
API = Main.Instance.ModHelper.Interaction.TryGetModApi<IRichPresenceAPI>("MegaPiggy.OWRichPresence");
if (API == null)
{
Logger.LogVerbose("OWRichPresence isn't installed");
Enabled = false;
return;
}
Enabled = true;
}
catch(Exception ex)
{
Logger.LogError($"OWRichPresence handler failed to initialize: {ex}");
Enabled = false;
}
}
public static void SetUpPlanet(string name, GameObject go, Sector sector)
{
if (!Enabled) return;
Logger.LogVerbose($"Registering {go.name} to OWRichPresence");
var localizedName = TranslationHandler.GetTranslation(name, TranslationHandler.TextType.UI);
var message = TranslationHandler.GetTranslation("RICH_PRESENCE_EXPLORING", TranslationHandler.TextType.UI).Replace("{0}", localizedName);
API.CreateTrigger(go, sector, message, name.Replace(" ", "").Replace("'", "").ToLowerInvariant());
}
public static void OnStarSystemLoaded(string name)
{
if (name == "SolarSystem") return;
var localizedName = ShipLogStarChartMode.UniqueIDToName(name);
var message = TranslationHandler.GetTranslation("RICH_PRESENCE_EXPLORING", TranslationHandler.TextType.UI).Replace("{0}", localizedName);
API.SetCurrentRootPresence(message, "sun");
}
public static void OnChangeStarSystem(string destination)
{
var localizedName = ShipLogStarChartMode.UniqueIDToName(destination);
var message = TranslationHandler.GetTranslation("RICH_PRESENCE_WARPING", TranslationHandler.TextType.UI).Replace("{0}", localizedName);
API.SetRichPresence(message, "newhorizons");
}
}
}

View File

@ -1,4 +1,4 @@
namespace NewHorizons.VoiceActing
namespace NewHorizons.OtherMods.VoiceActing
{
public interface IVoiceMod
{

View File

@ -1,8 +1,9 @@
using NewHorizons.Utility;
using System;
using System.IO;
using System.Linq;
namespace NewHorizons.VoiceActing
namespace NewHorizons.OtherMods.VoiceActing
{
public static class VoiceHandler
{
@ -11,18 +12,30 @@ namespace NewHorizons.VoiceActing
private static IVoiceMod API;
public static void Init()
{
try
{
API = Main.Instance.ModHelper.Interaction.TryGetModApi<IVoiceMod>("Krevace.VoiceMod");
if (API == null)
{
Logger.LogVerbose("VoiceMod isn't installed");
Enabled = false;
return;
}
Enabled = true;
SetUp();
}
catch (Exception ex)
{
Logger.LogError($"VoiceMod handler failed to initialize: {ex}");
Enabled = false;
}
}
private static void SetUp()
{
foreach (var mod in Main.Instance.GetDependants().Append(Main.Instance))
{
var folder = $"{mod.ModHelper.Manifest.ModFolderPath}voicemod";

View File

@ -1,6 +1,6 @@
using HarmonyLib;
using NewHorizons.AchievementsPlus;
using NewHorizons.AchievementsPlus.NH;
using NewHorizons.OtherMods.AchievementsPlus;
using NewHorizons.OtherMods.AchievementsPlus.NH;
using NewHorizons.Builder.Props;
using NewHorizons.External;
using NewHorizons.Handlers;

View File

@ -1,5 +1,5 @@
using HarmonyLib;
using NewHorizons.AchievementsPlus;
using NewHorizons.OtherMods.AchievementsPlus;
using NewHorizons.Builder.ShipLog;
using NewHorizons.Components;
using NewHorizons.Handlers;