mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Make hearthian recording actually work
This commit is contained in:
parent
642f6afdc0
commit
f3c953faff
@ -199,8 +199,31 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
else if (hearthianRecorder != null)
|
||||
{
|
||||
// #520
|
||||
hearthianRecorder._characterDialogueTree = dialogue;
|
||||
Delay.FireOnNextUpdate(() =>
|
||||
{
|
||||
// #520
|
||||
if (hearthianRecorder._characterDialogueTree != null)
|
||||
{
|
||||
hearthianRecorder._characterDialogueTree.OnStartConversation -= hearthianRecorder.OnPlayRecorder;
|
||||
hearthianRecorder._characterDialogueTree.OnEndConversation -= hearthianRecorder.OnStopRecorder;
|
||||
}
|
||||
|
||||
// Recorder props have their own dialogue on them already
|
||||
// Make sure to delete it when we're trying to connect new dialogue to it
|
||||
var existingDialogue = hearthianRecorder.GetComponent<CharacterDialogueTree>();
|
||||
if (existingDialogue != dialogue && existingDialogue != null)
|
||||
{
|
||||
// Can't delete the existing dialogue because its a required component but we can make it unable to select at least
|
||||
GameObject.Destroy(hearthianRecorder.GetComponent<OWCollider>());
|
||||
GameObject.Destroy(hearthianRecorder.GetComponent<SphereCollider>());
|
||||
GameObject.Destroy(existingDialogue._interactVolume);
|
||||
existingDialogue.enabled = false;
|
||||
}
|
||||
|
||||
hearthianRecorder._characterDialogueTree = dialogue;
|
||||
hearthianRecorder._characterDialogueTree.OnStartConversation += hearthianRecorder.OnPlayRecorder;
|
||||
hearthianRecorder._characterDialogueTree.OnEndConversation += hearthianRecorder.OnStopRecorder;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -25,6 +25,8 @@ namespace NewHorizons.External.Modules.Props.Dialogue
|
||||
/// CharacterAnimController, TravelerController, TravelerEyeController (eye of the universe), FacePlayerWhenTalking,
|
||||
/// HearthianRecorderEffects or SolanumAnimController.
|
||||
///
|
||||
/// If it's a Recorder this will also delete the existing dialogue already attached to that prop.
|
||||
///
|
||||
/// If none of those components are present it will add a FacePlayerWhenTalking component.
|
||||
/// </summary>
|
||||
public string pathToAnimController;
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace NewHorizons.Patches.DialoguePatches
|
||||
{
|
||||
[HarmonyPatch(typeof(HearthianRecorderEffects))]
|
||||
public static class HearthianRecorderEffectsPatches
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(HearthianRecorderEffects.Awake))]
|
||||
public static bool HearthianRecorderEffects_Awake(HearthianRecorderEffects __instance)
|
||||
{
|
||||
// If we're adding custom dialogue to a recorder the CharacterDialogueTree isn't going to be on the object
|
||||
if (__instance.GetComponent<CharacterDialogueTree>() == null)
|
||||
{
|
||||
__instance.enabled = false;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user