Get rid of enter conditions, just one prereq, clean up patch

This commit is contained in:
Nick 2023-01-18 00:12:58 -05:00
parent b378d2f715
commit fb0d9e30f6
3 changed files with 17 additions and 13 deletions

View File

@ -80,8 +80,10 @@ namespace NewHorizons.Builder.Props
priority = 1, priority = 1,
dialogue = dialogue, dialogue = dialogue,
prereqConditionType = RemoteDialogueTrigger.MultiConditionType.AND, prereqConditionType = RemoteDialogueTrigger.MultiConditionType.AND,
prereqConditions = info.remoteTriggerPrereqConditions ?? new string[]{ }, // Base game never uses more than one condition anyone so we'll keep it simple
onTriggerEnterConditions = info.remoteTriggerOnEnterConditions ?? new string[]{ } 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[]{ }
} }
}; };
remoteDialogueTrigger._activatedDialogues = new bool[1]; remoteDialogueTrigger._activatedDialogues = new bool[1];

View File

@ -509,14 +509,9 @@ namespace NewHorizons.External.Modules
public float remoteTriggerRadius; public float remoteTriggerRadius;
/// <summary> /// <summary>
/// If setting up a remote trigger volume, these conditions must be met for it to trigger /// 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> /// </summary>
public string[] remoteTriggerPrereqConditions; public string remoteTriggerPrereqCondition;
/// <summary>
/// If setting up a remote trigger volume, but I have no idea what this does at all
/// </summary>
public string[] remoteTriggerOnEnterConditions;
/// <summary> /// <summary>
/// Relative path to the xml file defining the dialogue. /// Relative path to the xml file defining the dialogue.

View File

@ -13,19 +13,26 @@ namespace NewHorizons.Patches
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(HUDMarker), nameof(HUDMarker.Awake))] [HarmonyPatch(typeof(HUDMarker), nameof(HUDMarker.Awake))]
public static void OnTriggerEnter(RemoteDialogueTrigger __instance) public static void OnTriggerEnter(RemoteDialogueTrigger __instance)
{
if (__instance._inRemoteDialogue && __instance._activeRemoteDialogue != null)
{ {
_wasLastDialogueInactive = __instance._activeRemoteDialogue.gameObject.activeInHierarchy; _wasLastDialogueInactive = __instance._activeRemoteDialogue.gameObject.activeInHierarchy;
__instance._activeRemoteDialogue.gameObject.SetActive(true); __instance._activeRemoteDialogue.gameObject.SetActive(true);
} }
}
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(HUDMarker), nameof(HUDMarker.Awake))] [HarmonyPatch(typeof(HUDMarker), nameof(HUDMarker.Awake))]
public static void OnEndConversation(RemoteDialogueTrigger __instance) public static void OnEndConversation(RemoteDialogueTrigger __instance)
{
if (__instance._inRemoteDialogue && __instance._activeRemoteDialogue != null)
{ {
if (_wasLastDialogueInactive) if (_wasLastDialogueInactive)
{ {
__instance._activeRemoteDialogue.gameObject.SetActive(false); __instance._activeRemoteDialogue.gameObject.SetActive(false);
} }
}
_wasLastDialogueInactive = false; _wasLastDialogueInactive = false;
} }
} }