mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
More remote dialogue stuff (#493)
## Improvements - Add `remoteTriggerPrereqCondition` to only show a remote dialogue trigger once a condition has been met. ## Bug fixes - Stop RemoteDialogueTrigger from softlocking you if you disable its CharacterDialogueTree.
This commit is contained in:
commit
b0fbf56882
@ -80,7 +80,9 @@ namespace NewHorizons.Builder.Props
|
||||
priority = 1,
|
||||
dialogue = dialogue,
|
||||
prereqConditionType = RemoteDialogueTrigger.MultiConditionType.AND,
|
||||
prereqConditions = new string[]{ },
|
||||
// Base game never uses more than one condition anyone so we'll keep it simple
|
||||
prereqConditions = string.IsNullOrEmpty(info.remoteTriggerPrereqCondition) ? new string[]{ } : new string[] { info.remoteTriggerPrereqCondition },
|
||||
// Just set your enter conditions in XML instead of complicating it with this
|
||||
onTriggerEnterConditions = new string[]{ }
|
||||
}
|
||||
};
|
||||
|
||||
5
NewHorizons/External/Modules/PropModule.cs
vendored
5
NewHorizons/External/Modules/PropModule.cs
vendored
@ -508,6 +508,11 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public float remoteTriggerRadius;
|
||||
|
||||
/// <summary>
|
||||
/// If setting up a remote trigger volume, this conditions must be met for it to trigger. Note: This is a dialogue condition, not a persistent condition.
|
||||
/// </summary>
|
||||
public string remoteTriggerPrereqCondition;
|
||||
|
||||
/// <summary>
|
||||
/// Relative path to the xml file defining the dialogue.
|
||||
/// </summary>
|
||||
|
||||
44
NewHorizons/Patches/RemoteDialogueTriggerPatches.cs
Normal file
44
NewHorizons/Patches/RemoteDialogueTriggerPatches.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using HarmonyLib;
|
||||
using NewHorizons.Utility;
|
||||
using System;
|
||||
|
||||
namespace NewHorizons.Patches
|
||||
{
|
||||
/// <summary>
|
||||
/// Should fix a bug where disabled a CharacterDialogueTree makes its related RemoteDialogueTriggers softlock your game
|
||||
/// </summary>
|
||||
[HarmonyPatch]
|
||||
public static class RemoteDialogueTriggerPatches
|
||||
{
|
||||
private static bool _wasLastDialogueInactive = false;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(RemoteDialogueTrigger), nameof(RemoteDialogueTrigger.OnTriggerEnter))]
|
||||
public static void RemoteDialogueTrigger_OnTriggerEnter(RemoteDialogueTrigger __instance)
|
||||
{
|
||||
if (__instance._inRemoteDialogue && __instance._activeRemoteDialogue?.gameObject != null)
|
||||
{
|
||||
_wasLastDialogueInactive = __instance._activeRemoteDialogue.gameObject.activeInHierarchy;
|
||||
if (!_wasLastDialogueInactive)
|
||||
{
|
||||
__instance._activeRemoteDialogue.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(RemoteDialogueTrigger), nameof(RemoteDialogueTrigger.OnEndConversation))]
|
||||
public static void RemoteDialogueTrigger_OnEndConversation(RemoteDialogueTrigger __instance)
|
||||
{
|
||||
if (__instance._inRemoteDialogue && __instance._activeRemoteDialogue != null)
|
||||
{
|
||||
if (_wasLastDialogueInactive)
|
||||
{
|
||||
__instance._activeRemoteDialogue.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
_wasLastDialogueInactive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1134,6 +1134,10 @@
|
||||
"description": "The radius of the remote trigger volume.",
|
||||
"format": "float"
|
||||
},
|
||||
"remoteTriggerPrereqCondition": {
|
||||
"type": "string",
|
||||
"description": "If setting up a remote trigger volume, this conditions must be met for it to trigger. Note: This is a dialogue condition, not a persistent condition."
|
||||
},
|
||||
"xmlFile": {
|
||||
"type": "string",
|
||||
"description": "Relative path to the xml file defining the dialogue."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user