mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Try catch around all mod API initializations
This commit is contained in:
parent
8b195896a6
commit
e7bfb53c58
@ -1,6 +1,7 @@
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.Utility;
|
||||
using OWML.ModHelper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@ -15,6 +16,8 @@ namespace NewHorizons.OtherMods.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.OtherMods.AchievementsPlus
|
||||
|
||||
GlobalMessenger<string, bool>.AddListener("DialogueConditionChanged", OnDialogueConditionChanged);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Logger.LogError($"Achievements+ handler failed to initialize: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnDestroy()
|
||||
{
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Handlers;
|
||||
using NewHorizons.Utility;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
@ -15,6 +16,8 @@ namespace NewHorizons.OtherMods.OWRichPresence
|
||||
private static IRichPresenceAPI API;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
try
|
||||
{
|
||||
API = Main.Instance.ModHelper.Interaction.TryGetModApi<IRichPresenceAPI>("MegaPiggy.OWRichPresence");
|
||||
|
||||
@ -27,6 +30,12 @@ namespace NewHorizons.OtherMods.OWRichPresence
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using NewHorizons.Utility;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
@ -11,18 +12,30 @@ namespace NewHorizons.OtherMods.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";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user