diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index c8191b91..22ddba90 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -466,7 +466,7 @@ namespace NewHorizons.Handlers }); } - RichPresenceHandler.SetUpPlanet(body.Config.name, go, sector); + RichPresenceHandler.SetUpPlanet(body.Config.name, go, sector, body.Config.Star != null, body.Config.Atmosphere != null); Logger.LogVerbose($"Finished creating [{body.Config.name}]"); diff --git a/NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs b/NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs index e2132b89..45ab9040 100644 --- a/NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs +++ b/NewHorizons/OtherMods/OWRichPresence/IRichPresenceAPI.cs @@ -9,6 +9,14 @@ namespace NewHorizons.OtherMods.OWRichPresence 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 GameObject CreateTrigger(GameObject parent, string message, string imageKey, string fallback); + public GameObject CreateTrigger(GameObject parent, Sector sector, string message, string imageKey, string fallback); + public void CreateTriggerVolume(OWTriggerVolume triggerVolume, string message, string imageKey); + public void CreateTriggerVolume(OWTriggerVolume triggerVolume, string message, string imageKey, string fallback); + public GameObject CreateTriggerVolume(GameObject parent, float radius, string message, string imageKey); + public GameObject CreateTriggerVolume(GameObject parent, float radius, string message, string imageKey, string fallback); + public GameObject CreateTriggerVolume(GameObject parent, Vector3 localPosition, float radius, string message, string imageKey); + public GameObject CreateTriggerVolume(GameObject parent, Vector3 localPosition, float radius, string message, string imageKey, string fallback); public void SetCurrentRootPresence(string message, string imageKey); } } diff --git a/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs b/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs index 727bc082..70ef2184 100644 --- a/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs +++ b/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs @@ -38,7 +38,7 @@ namespace NewHorizons.OtherMods.OWRichPresence } } - public static void SetUpPlanet(string name, GameObject go, Sector sector) + public static void SetUpPlanet(string name, GameObject go, Sector sector, bool isStar = false, bool hasAtmosphere = false) { if (!Enabled) return; @@ -47,7 +47,11 @@ namespace NewHorizons.OtherMods.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("'", "").Replace("-", "").ToLowerInvariant()); + string fallbackKey = "defaultplanet"; + if (isStar) fallbackKey = "defaultstar"; + else if (hasAtmosphere) fallbackKey = "defaultplanetatmosphere"; + + API.CreateTrigger(go, sector, message, name.Replace(" ", "").Replace("'", "").Replace("-", "").ToLowerInvariant(), fallbackKey); } public static void OnStarSystemLoaded(string name) @@ -59,7 +63,7 @@ namespace NewHorizons.OtherMods.OWRichPresence var localizedName = ShipLogStarChartMode.UniqueIDToName(name); var message = TranslationHandler.GetTranslation("RICH_PRESENCE_EXPLORING", TranslationHandler.TextType.UI).Replace("{0}", localizedName); - API.SetCurrentRootPresence(message, "sun"); + API.SetCurrentRootPresence(message, "newhorizons"); } public static void OnChangeStarSystem(string destination)