Set dialogue for TravelerControllers

This commit is contained in:
Nick 2022-12-27 20:54:54 -05:00
parent 81255a5e1e
commit 5581a71727
3 changed files with 23 additions and 5 deletions

View File

@ -160,14 +160,35 @@ namespace NewHorizons.Builder.Props
// At most one of these should ever not be null // At most one of these should ever not be null
var nomaiController = character.GetComponent<SolanumAnimController>(); var nomaiController = character.GetComponent<SolanumAnimController>();
var controller = character.GetComponent<CharacterAnimController>(); var controller = character.GetComponent<CharacterAnimController>();
var traveler = character.GetComponent<TravelerController>();
var lookOnlyWhenTalking = info.lookAtRadius <= 0; var lookOnlyWhenTalking = info.lookAtRadius <= 0;
// To have them look when you start talking // To have them look when you start talking
if (controller != null) if (controller != null)
{ {
if (controller._dialogueTree != null)
{
controller._dialogueTree.OnStartConversation -= controller.OnStartConversation;
controller._dialogueTree.OnEndConversation -= controller.OnEndConversation;
}
controller._dialogueTree = dialogue; controller._dialogueTree = dialogue;
controller.lookOnlyWhenTalking = lookOnlyWhenTalking; controller.lookOnlyWhenTalking = lookOnlyWhenTalking;
controller._dialogueTree.OnStartConversation += controller.OnStartConversation;
controller._dialogueTree.OnEndConversation += controller.OnEndConversation;
}
else if (traveler != null)
{
if (traveler._dialogueSystem != null)
{
traveler._dialogueSystem.OnStartConversation -= traveler.OnStartConversation;
traveler._dialogueSystem.OnEndConversation -= traveler.OnEndConversation;
}
traveler._dialogueSystem = dialogue;
traveler._dialogueSystem.OnStartConversation += traveler.OnStartConversation;
traveler._dialogueSystem.OnEndConversation += traveler.OnEndConversation;
} }
else if (nomaiController != null) else if (nomaiController != null)
{ {

View File

@ -1,13 +1,10 @@
using NewHorizons.OtherMods.AchievementsPlus;
using NewHorizons.Components;
using NewHorizons.External.Modules; using NewHorizons.External.Modules;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using System; using OWML.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
using OWML.Utils;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {

View File

@ -421,7 +421,7 @@ namespace NewHorizons.External.Modules
/// <summary> /// <summary>
/// If this dialogue is meant for a character, this is the relative path from the planet to that character's /// If this dialogue is meant for a character, this is the relative path from the planet to that character's
/// CharacterAnimController or SolanumAnimController. /// CharacterAnimController, TavelerController, or SolanumAnimController.
/// </summary> /// </summary>
public string pathToAnimController; public string pathToAnimController;