Check for NH characters

This commit is contained in:
Noah Pilarski 2022-11-26 18:45:36 -05:00
parent 0ab737913b
commit 56e0aafb72
3 changed files with 16 additions and 2 deletions

View File

@ -6,6 +6,7 @@ using System.Xml;
using UnityEngine;
using NewHorizons.Utility;
using Logger = NewHorizons.Utility.Logger;
using NewHorizons.Components;
namespace NewHorizons.Builder.Props
{
@ -114,7 +115,7 @@ namespace NewHorizons.Builder.Props
interact.enabled = false;
}
var dialogueTree = conversationZone.AddComponent<CharacterDialogueTree>();
var dialogueTree = conversationZone.AddComponent<NHCharacterDialogueTree>();
var xml = File.ReadAllText(Path.Combine(mod.Manifest.ModFolderPath, info.xmlFile));
var text = new TextAsset(xml)

View File

@ -0,0 +1,6 @@
namespace NewHorizons.Components
{
public class NHCharacterDialogueTree : CharacterDialogueTree
{
}
}

View File

@ -1,4 +1,5 @@
using HarmonyLib;
using NewHorizons.Components;
using NewHorizons.OtherMods.AchievementsPlus.NH;
using System.Linq;
using UnityEngine;
@ -31,6 +32,12 @@ namespace NewHorizons.Patches
[HarmonyPostfix]
[HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.StartConversation))]
public static void CharacterDialogueTree_StartConversation(CharacterDialogueTree __instance) => TalkToFiveCharactersAchievement.OnTalkedToCharacter(__instance._characterName);
public static void CharacterDialogueTree_StartConversation(CharacterDialogueTree __instance)
{
if (__instance is NHCharacterDialogueTree)
{
TalkToFiveCharactersAchievement.OnTalkedToCharacter(__instance._characterName);
}
}
}
}