diff --git a/NewHorizons/Assets/translations/english.json b/NewHorizons/Assets/translations/english.json index 62c8b150..146c7fec 100644 --- a/NewHorizons/Assets/translations/english.json +++ b/NewHorizons/Assets/translations/english.json @@ -11,7 +11,8 @@ "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}", + "OWRP_EXPLORING": "Exploring {0}" }, "AchievementTranslations": { "NH_EATEN_OUTSIDE_BRAMBLE": { diff --git a/NewHorizons/Assets/translations/french.json b/NewHorizons/Assets/translations/french.json index 15099fc0..f9d17824 100644 --- a/NewHorizons/Assets/translations/french.json +++ b/NewHorizons/Assets/translations/french.json @@ -9,6 +9,7 @@ "INTERSTELLAR_MODE": "Mode Interstellaire", "FREQ_STATUE": "Statue Nomaï", "FREQ_WARP_CORE": "Flux Anti-Gravitonique", - "FREQ_UNKNOWN": "???" + "FREQ_UNKNOWN": "???", + "OWRP_EXPLORING": "En train d'explorer {0}" } } \ No newline at end of file diff --git a/NewHorizons/Builder/Props/SignalBuilder.cs b/NewHorizons/Builder/Props/SignalBuilder.cs index 8cc01ef2..a6b2a86c 100644 --- a/NewHorizons/Builder/Props/SignalBuilder.cs +++ b/NewHorizons/Builder/Props/SignalBuilder.cs @@ -1,4 +1,4 @@ -using NewHorizons.AchievementsPlus; +using NewHorizons.OtherMods.AchievementsPlus; using NewHorizons.Components; using NewHorizons.External.Modules; using NewHorizons.Utility; diff --git a/NewHorizons/Components/Achievement/AchievementObserveTrigger.cs b/NewHorizons/Components/Achievement/AchievementObserveTrigger.cs index 0b5bb37b..1a6acf5f 100644 --- a/NewHorizons/Components/Achievement/AchievementObserveTrigger.cs +++ b/NewHorizons/Components/Achievement/AchievementObserveTrigger.cs @@ -1,4 +1,4 @@ -using NewHorizons.AchievementsPlus; +using NewHorizons.OtherMods.AchievementsPlus; using System; using System.Collections.Generic; using System.Linq; diff --git a/NewHorizons/Components/Achievement/AchievementSnapshotTrigger.cs b/NewHorizons/Components/Achievement/AchievementSnapshotTrigger.cs index d1a6c895..f67f0749 100644 --- a/NewHorizons/Components/Achievement/AchievementSnapshotTrigger.cs +++ b/NewHorizons/Components/Achievement/AchievementSnapshotTrigger.cs @@ -1,4 +1,4 @@ -using NewHorizons.AchievementsPlus; +using NewHorizons.OtherMods.AchievementsPlus; using System; using System.Collections.Generic; using System.Linq; diff --git a/NewHorizons/Components/Achievement/AchievementVolume.cs b/NewHorizons/Components/Achievement/AchievementVolume.cs index 1b3c9151..a5f39b15 100644 --- a/NewHorizons/Components/Achievement/AchievementVolume.cs +++ b/NewHorizons/Components/Achievement/AchievementVolume.cs @@ -1,4 +1,4 @@ -using NewHorizons.AchievementsPlus; +using NewHorizons.OtherMods.AchievementsPlus; using UnityEngine; namespace NewHorizons.Components.Achievement diff --git a/NewHorizons/Components/BlackHoleDestructionVolume.cs b/NewHorizons/Components/BlackHoleDestructionVolume.cs index 4ed3d759..145a0c5c 100644 --- a/NewHorizons/Components/BlackHoleDestructionVolume.cs +++ b/NewHorizons/Components/BlackHoleDestructionVolume.cs @@ -1,4 +1,4 @@ -using NewHorizons.AchievementsPlus.NH; +using NewHorizons.OtherMods.AchievementsPlus.NH; namespace NewHorizons.Components { diff --git a/NewHorizons/External/Configs/AddonConfig.cs b/NewHorizons/External/Configs/AddonConfig.cs index 2fe85d7b..08069e00 100644 --- a/NewHorizons/External/Configs/AddonConfig.cs +++ b/NewHorizons/External/Configs/AddonConfig.cs @@ -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; diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 4beee488..69e46520 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -6,6 +6,7 @@ using NewHorizons.Builder.Props; using NewHorizons.Components; using NewHorizons.Components.Orbital; using NewHorizons.External.Modules; +using NewHorizons.OtherMods.OWRichPresence; using NewHorizons.Utility; using System; using System.Collections.Generic; @@ -446,6 +447,8 @@ namespace NewHorizons.Handlers }); } + RichPresenceHandler.SetUpPlanet(body.Config.name, go, sector); + Logger.LogVerbose($"Finished creating [{body.Config.name}]"); return go; diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 4e7c8114..8df95592 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -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,8 @@ namespace NewHorizons AchievementHandler.Init(); VoiceHandler.Init(); + RichPresenceHandler.Init(); + OnStarSystemLoaded.AddListener(RichPresenceHandler.SetUpSolarSystem); LoadAddonManifest("Assets/addon-manifest.json", this); } diff --git a/NewHorizons/AchievementsPlus/AchievementHandler.cs b/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs similarity index 98% rename from NewHorizons/AchievementsPlus/AchievementHandler.cs rename to NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs index b7ea6a48..bc26a64b 100644 --- a/NewHorizons/AchievementsPlus/AchievementHandler.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs @@ -4,7 +4,7 @@ using OWML.ModHelper; using System.Collections.Generic; using System.Linq; -namespace NewHorizons.AchievementsPlus +namespace NewHorizons.OtherMods.AchievementsPlus { public static class AchievementHandler { diff --git a/NewHorizons/AchievementsPlus/AchievementInfo.cs b/NewHorizons/OtherMods/AchievementsPlus/AchievementInfo.cs similarity index 98% rename from NewHorizons/AchievementsPlus/AchievementInfo.cs rename to NewHorizons/OtherMods/AchievementsPlus/AchievementInfo.cs index d1789a75..9246b3d9 100644 --- a/NewHorizons/AchievementsPlus/AchievementInfo.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/AchievementInfo.cs @@ -2,7 +2,7 @@ using NewHorizons.Builder.Props; using Newtonsoft.Json; using System.Linq; -namespace NewHorizons.AchievementsPlus +namespace NewHorizons.OtherMods.AchievementsPlus { /// /// Info for an achievement to be used with the Achievements+ mod. diff --git a/NewHorizons/AchievementsPlus/IAchievements.cs b/NewHorizons/OtherMods/AchievementsPlus/IAchievements.cs similarity index 90% rename from NewHorizons/AchievementsPlus/IAchievements.cs rename to NewHorizons/OtherMods/AchievementsPlus/IAchievements.cs index 8505624d..9572ca1e 100644 --- a/NewHorizons/AchievementsPlus/IAchievements.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/IAchievements.cs @@ -1,6 +1,6 @@ using OWML.ModHelper; -namespace NewHorizons.AchievementsPlus +namespace NewHorizons.OtherMods.AchievementsPlus { public interface IAchievements { diff --git a/NewHorizons/AchievementsPlus/NH/EatenOutsideBrambleAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/EatenOutsideBrambleAchievement.cs similarity index 92% rename from NewHorizons/AchievementsPlus/NH/EatenOutsideBrambleAchievement.cs rename to NewHorizons/OtherMods/AchievementsPlus/NH/EatenOutsideBrambleAchievement.cs index 8df509ce..67f189bc 100644 --- a/NewHorizons/AchievementsPlus/NH/EatenOutsideBrambleAchievement.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/EatenOutsideBrambleAchievement.cs @@ -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 { diff --git a/NewHorizons/AchievementsPlus/NH/MultipleSystemAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/MultipleSystemAchievement.cs similarity index 95% rename from NewHorizons/AchievementsPlus/NH/MultipleSystemAchievement.cs rename to NewHorizons/OtherMods/AchievementsPlus/NH/MultipleSystemAchievement.cs index f2ae29c5..1d7e6d3f 100644 --- a/NewHorizons/AchievementsPlus/NH/MultipleSystemAchievement.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/MultipleSystemAchievement.cs @@ -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 { diff --git a/NewHorizons/AchievementsPlus/NH/NewFrequencyAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/NewFrequencyAchievement.cs similarity index 90% rename from NewHorizons/AchievementsPlus/NH/NewFrequencyAchievement.cs rename to NewHorizons/OtherMods/AchievementsPlus/NH/NewFrequencyAchievement.cs index 7cde8861..6a2ff325 100644 --- a/NewHorizons/AchievementsPlus/NH/NewFrequencyAchievement.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/NewFrequencyAchievement.cs @@ -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 { diff --git a/NewHorizons/AchievementsPlus/NH/ProbeLostAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/ProbeLostAchievement.cs similarity index 90% rename from NewHorizons/AchievementsPlus/NH/ProbeLostAchievement.cs rename to NewHorizons/OtherMods/AchievementsPlus/NH/ProbeLostAchievement.cs index 9ddef4b8..b99a58cc 100644 --- a/NewHorizons/AchievementsPlus/NH/ProbeLostAchievement.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/ProbeLostAchievement.cs @@ -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 { diff --git a/NewHorizons/AchievementsPlus/NH/VesselWarpAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/VesselWarpAchievement.cs similarity index 92% rename from NewHorizons/AchievementsPlus/NH/VesselWarpAchievement.cs rename to NewHorizons/OtherMods/AchievementsPlus/NH/VesselWarpAchievement.cs index 2cffa8ae..3f1115dd 100644 --- a/NewHorizons/AchievementsPlus/NH/VesselWarpAchievement.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/VesselWarpAchievement.cs @@ -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 { diff --git a/NewHorizons/AchievementsPlus/NH/WarpDriveAchievement.cs b/NewHorizons/OtherMods/AchievementsPlus/NH/WarpDriveAchievement.cs similarity index 92% rename from NewHorizons/AchievementsPlus/NH/WarpDriveAchievement.cs rename to NewHorizons/OtherMods/AchievementsPlus/NH/WarpDriveAchievement.cs index ee0747b7..1a05ed89 100644 --- a/NewHorizons/AchievementsPlus/NH/WarpDriveAchievement.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/NH/WarpDriveAchievement.cs @@ -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 { diff --git a/NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs b/NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs new file mode 100644 index 00000000..0aeb4d6d --- /dev/null +++ b/NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs @@ -0,0 +1,12 @@ +using UnityEngine; + +namespace NewHorizons.OtherMods.OWRichPresence +{ + public interface IRichPresenceAPI + { + public void SetRichPresence(string message, int imageKey); + public void SetTriggerActivation(bool active); + public void CreateTrigger(GameObject parent, Sector sector, string details, string imageKey); + public void SetCurrentRootPresence(string message, string imageKey); + } +} diff --git a/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs b/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs new file mode 100644 index 00000000..4535bb7b --- /dev/null +++ b/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs @@ -0,0 +1,55 @@ +using NewHorizons.Components; +using NewHorizons.Handlers; +using NewHorizons.Utility; +using System.IO; +using System.Linq; +using UnityEngine; +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() + { + API = Main.Instance.ModHelper.Interaction.TryGetModApi("MegaPiggy.OWRichPresence"); + + if (API == null) + { + Logger.LogVerbose("OWRichPresence isn't installed"); + Enabled = false; + return; + } + + Enabled = true; + } + + 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 localizedMessage = TranslationHandler.GetTranslation("OWRP_EXPLORING", TranslationHandler.TextType.UI); + var message = localizedMessage.Replace("{0}", localizedName); + + API.CreateTrigger(go, sector, message, "sun"); + } + + public static void SetUpSolarSystem(string name) + { + if (name == "SolarSystem") return; + + var localizedName = ShipLogStarChartMode.UniqueIDToName(name); + var localizedMessage = TranslationHandler.GetTranslation("OWRP_EXPLORING", TranslationHandler.TextType.UI); + var message = localizedMessage.Replace("{0}", localizedName); + + API.SetCurrentRootPresence(message, "sun"); + } + } +} diff --git a/NewHorizons/VoiceActing/IVoiceMod.cs b/NewHorizons/OtherMods/VoiceActing/IVoiceMod.cs similarity index 68% rename from NewHorizons/VoiceActing/IVoiceMod.cs rename to NewHorizons/OtherMods/VoiceActing/IVoiceMod.cs index d9b12384..b47c3c71 100644 --- a/NewHorizons/VoiceActing/IVoiceMod.cs +++ b/NewHorizons/OtherMods/VoiceActing/IVoiceMod.cs @@ -1,4 +1,4 @@ -namespace NewHorizons.VoiceActing +namespace NewHorizons.OtherMods.VoiceActing { public interface IVoiceMod { diff --git a/NewHorizons/VoiceActing/VoiceHandler.cs b/NewHorizons/OtherMods/VoiceActing/VoiceHandler.cs similarity index 96% rename from NewHorizons/VoiceActing/VoiceHandler.cs rename to NewHorizons/OtherMods/VoiceActing/VoiceHandler.cs index 576c2ad3..6826e98a 100644 --- a/NewHorizons/VoiceActing/VoiceHandler.cs +++ b/NewHorizons/OtherMods/VoiceActing/VoiceHandler.cs @@ -2,7 +2,7 @@ using NewHorizons.Utility; using System.IO; using System.Linq; -namespace NewHorizons.VoiceActing +namespace NewHorizons.OtherMods.VoiceActing { public static class VoiceHandler { diff --git a/NewHorizons/Patches/PlayerDataPatches.cs b/NewHorizons/Patches/PlayerDataPatches.cs index b2c7f423..8f4476c3 100644 --- a/NewHorizons/Patches/PlayerDataPatches.cs +++ b/NewHorizons/Patches/PlayerDataPatches.cs @@ -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; diff --git a/NewHorizons/Patches/ShipLogPatches.cs b/NewHorizons/Patches/ShipLogPatches.cs index 7901dc87..ba588f12 100644 --- a/NewHorizons/Patches/ShipLogPatches.cs +++ b/NewHorizons/Patches/ShipLogPatches.cs @@ -1,5 +1,5 @@ using HarmonyLib; -using NewHorizons.AchievementsPlus; +using NewHorizons.OtherMods.AchievementsPlus; using NewHorizons.Builder.ShipLog; using NewHorizons.Components; using NewHorizons.Handlers;