From 5581a717270e9e2e4876a1bdba52942f1ce07160 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 27 Dec 2022 20:54:54 -0500 Subject: [PATCH 01/10] Set dialogue for TravelerControllers --- NewHorizons/Builder/Props/DialogueBuilder.cs | 21 ++++++++++++++++++++ NewHorizons/Builder/Props/SignalBuilder.cs | 5 +---- NewHorizons/External/Modules/PropModule.cs | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index d4b5c844..66f91ce6 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -160,14 +160,35 @@ namespace NewHorizons.Builder.Props // At most one of these should ever not be null var nomaiController = character.GetComponent(); var controller = character.GetComponent(); + var traveler = character.GetComponent(); var lookOnlyWhenTalking = info.lookAtRadius <= 0; // To have them look when you start talking if (controller != null) { + if (controller._dialogueTree != null) + { + controller._dialogueTree.OnStartConversation -= controller.OnStartConversation; + controller._dialogueTree.OnEndConversation -= controller.OnEndConversation; + } + controller._dialogueTree = dialogue; 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) { diff --git a/NewHorizons/Builder/Props/SignalBuilder.cs b/NewHorizons/Builder/Props/SignalBuilder.cs index 3072bb45..27a92187 100644 --- a/NewHorizons/Builder/Props/SignalBuilder.cs +++ b/NewHorizons/Builder/Props/SignalBuilder.cs @@ -1,13 +1,10 @@ -using NewHorizons.OtherMods.AchievementsPlus; -using NewHorizons.Components; using NewHorizons.External.Modules; using NewHorizons.Utility; using OWML.Common; -using System; +using OWML.Utils; using System.Collections.Generic; using UnityEngine; using Logger = NewHorizons.Utility.Logger; -using OWML.Utils; namespace NewHorizons.Builder.Props { diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 4e0a3a1e..6dcdcad6 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -421,7 +421,7 @@ namespace NewHorizons.External.Modules /// /// 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. /// public string pathToAnimController; From c4a20d04c029ce2fb19fccbeb7d912969729e741 Mon Sep 17 00:00:00 2001 From: Ben C Date: Wed, 28 Dec 2022 01:56:59 +0000 Subject: [PATCH 02/10] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 03fedb7f..ec6181d3 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1103,7 +1103,7 @@ }, "pathToAnimController": { "type": "string", - "description": "If this dialogue is meant for a character, this is the relative path from the planet to that character's\nCharacterAnimController or SolanumAnimController." + "description": "If this dialogue is meant for a character, this is the relative path from the planet to that character's\nCharacterAnimController, TavelerController, or SolanumAnimController." }, "position": { "description": "When you enter into dialogue, you will look here.", From 7f3e36dd0a661775f916d0c7ac4d45d990f41d98 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Tue, 27 Dec 2022 21:31:48 -0500 Subject: [PATCH 03/10] typo --- NewHorizons/External/Modules/PropModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 6dcdcad6..864ad164 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -421,7 +421,7 @@ namespace NewHorizons.External.Modules /// /// If this dialogue is meant for a character, this is the relative path from the planet to that character's - /// CharacterAnimController, TavelerController, or SolanumAnimController. + /// CharacterAnimController, TravelerController, or SolanumAnimController. /// public string pathToAnimController; From 2511ca2a1f7766d8244d777e45f3972c9bab4872 Mon Sep 17 00:00:00 2001 From: Ben C Date: Wed, 28 Dec 2022 02:34:33 +0000 Subject: [PATCH 04/10] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index ec6181d3..d25b4295 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1103,7 +1103,7 @@ }, "pathToAnimController": { "type": "string", - "description": "If this dialogue is meant for a character, this is the relative path from the planet to that character's\nCharacterAnimController, TavelerController, or SolanumAnimController." + "description": "If this dialogue is meant for a character, this is the relative path from the planet to that character's\nCharacterAnimController, TravelerController, or SolanumAnimController." }, "position": { "description": "When you enter into dialogue, you will look here.", From 6dba33f2564c2257dc74c6b95dec8cadb31cf6e8 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 28 Dec 2022 04:06:25 -0500 Subject: [PATCH 05/10] Set dialogue for TravelerEyeControllers --- NewHorizons/Builder/Props/DialogueBuilder.cs | 13 +++++++++++++ NewHorizons/External/Modules/PropModule.cs | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index 66f91ce6..a0af7849 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -161,6 +161,7 @@ namespace NewHorizons.Builder.Props var nomaiController = character.GetComponent(); var controller = character.GetComponent(); var traveler = character.GetComponent(); + var travelerEye = character.GetComponent(); var lookOnlyWhenTalking = info.lookAtRadius <= 0; @@ -190,6 +191,18 @@ namespace NewHorizons.Builder.Props traveler._dialogueSystem.OnStartConversation += traveler.OnStartConversation; traveler._dialogueSystem.OnEndConversation += traveler.OnEndConversation; } + else if (travelerEye != null) + { + if (travelerEye._dialogueTree != null) + { + travelerEye._dialogueTree.OnStartConversation -= travelerEye.OnStartConversation; + travelerEye._dialogueTree.OnEndConversation -= travelerEye.OnEndConversation; + } + + travelerEye._dialogueTree = dialogue; + travelerEye._dialogueTree.OnStartConversation += travelerEye.OnStartConversation; + travelerEye._dialogueTree.OnEndConversation += travelerEye.OnEndConversation; + } else if (nomaiController != null) { if (lookOnlyWhenTalking) diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 864ad164..3df98520 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -421,7 +421,7 @@ namespace NewHorizons.External.Modules /// /// If this dialogue is meant for a character, this is the relative path from the planet to that character's - /// CharacterAnimController, TravelerController, or SolanumAnimController. + /// CharacterAnimController, TravelerController, TravelerEyeController (eye of the universe), or SolanumAnimController. /// public string pathToAnimController; From 13b779aa6312b10d262a6c7eb98dfd5bd76ccaa2 Mon Sep 17 00:00:00 2001 From: Ben C Date: Wed, 28 Dec 2022 09:17:43 +0000 Subject: [PATCH 06/10] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index d25b4295..4469b7eb 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1103,7 +1103,7 @@ }, "pathToAnimController": { "type": "string", - "description": "If this dialogue is meant for a character, this is the relative path from the planet to that character's\nCharacterAnimController, TravelerController, or SolanumAnimController." + "description": "If this dialogue is meant for a character, this is the relative path from the planet to that character's\nCharacterAnimController, TravelerController, TravelerEyeController (eye of the universe), or SolanumAnimController." }, "position": { "description": "When you enter into dialogue, you will look here.", From d843cd17aaebdb5eab0854157a415d8360e8ff9a Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 28 Dec 2022 04:31:09 -0500 Subject: [PATCH 07/10] Set dialogue for FacePlayerWhenTalkings --- NewHorizons/Builder/Props/DialogueBuilder.cs | 14 ++++++++++++++ NewHorizons/External/Modules/PropModule.cs | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index a0af7849..760e7091 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -216,6 +216,20 @@ namespace NewHorizons.Builder.Props // TODO: make a custom controller for basic characters to just turn them to face you } + var facePlayerWhenTalking = character.GetComponent(); + if (facePlayerWhenTalking != null) + { + if (facePlayerWhenTalking._dialogueTree != null) + { + facePlayerWhenTalking._dialogueTree.OnStartConversation -= facePlayerWhenTalking.OnStartConversation; + facePlayerWhenTalking._dialogueTree.OnEndConversation -= facePlayerWhenTalking.OnEndConversation; + } + + facePlayerWhenTalking._dialogueTree = dialogue; + facePlayerWhenTalking._dialogueTree.OnStartConversation += facePlayerWhenTalking.OnStartConversation; + facePlayerWhenTalking._dialogueTree.OnEndConversation += facePlayerWhenTalking.OnEndConversation; + } + if (info.lookAtRadius > 0) { var playerTrackingZone = new GameObject("PlayerTrackingZone"); diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 3df98520..e939b267 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -421,7 +421,7 @@ namespace NewHorizons.External.Modules /// /// If this dialogue is meant for a character, this is the relative path from the planet to that character's - /// CharacterAnimController, TravelerController, TravelerEyeController (eye of the universe), or SolanumAnimController. + /// CharacterAnimController, TravelerController, TravelerEyeController (eye of the universe), FacePlayerWhenTalking, or SolanumAnimController. /// public string pathToAnimController; From 98749a09ef6fe8644b7c5aea700c2b32536ae8dc Mon Sep 17 00:00:00 2001 From: Ben C Date: Wed, 28 Dec 2022 09:33:07 +0000 Subject: [PATCH 08/10] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 4469b7eb..736a208e 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1103,7 +1103,7 @@ }, "pathToAnimController": { "type": "string", - "description": "If this dialogue is meant for a character, this is the relative path from the planet to that character's\nCharacterAnimController, TravelerController, TravelerEyeController (eye of the universe), or SolanumAnimController." + "description": "If this dialogue is meant for a character, this is the relative path from the planet to that character's\nCharacterAnimController, TravelerController, TravelerEyeController (eye of the universe), FacePlayerWhenTalking, or SolanumAnimController." }, "position": { "description": "When you enter into dialogue, you will look here.", From 6ace48dd43e577572134ddfb430dbfb7b6449b83 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 28 Dec 2022 17:02:27 -0500 Subject: [PATCH 09/10] Add FacePlayerWhenTalking if it isn't there --- NewHorizons/Builder/Props/DialogueBuilder.cs | 3 ++- NewHorizons/External/Modules/PropModule.cs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index 760e7091..2d0c2bbc 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -213,7 +213,8 @@ namespace NewHorizons.Builder.Props } else { - // TODO: make a custom controller for basic characters to just turn them to face you + // If they have nothing else just put the face player when talking thing on them + character.gameObject.GetAddComponent(); } var facePlayerWhenTalking = character.GetComponent(); diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index bea44041..3fc44d0c 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -477,6 +477,8 @@ namespace NewHorizons.External.Modules /// /// If this dialogue is meant for a character, this is the relative path from the planet to that character's /// CharacterAnimController, TravelerController, TravelerEyeController (eye of the universe), FacePlayerWhenTalking, or SolanumAnimController. + /// + /// If none of those components are present it will add a FacePlayerWhenTalking component. /// public string pathToAnimController; From e047d66c292734416c7fbc975ddb2f272ad85977 Mon Sep 17 00:00:00 2001 From: Ben C Date: Wed, 28 Dec 2022 22:04:14 +0000 Subject: [PATCH 10/10] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 3f40ff47..332e0d4a 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1103,7 +1103,7 @@ }, "pathToAnimController": { "type": "string", - "description": "If this dialogue is meant for a character, this is the relative path from the planet to that character's\nCharacterAnimController, TravelerController, TravelerEyeController (eye of the universe), FacePlayerWhenTalking, or SolanumAnimController." + "description": "If this dialogue is meant for a character, this is the relative path from the planet to that character's\nCharacterAnimController, TravelerController, TravelerEyeController (eye of the universe), FacePlayerWhenTalking, or SolanumAnimController.\n\nIf none of those components are present it will add a FacePlayerWhenTalking component." }, "position": { "description": "When you enter into dialogue, you will look here.",