From 28a1efa95fca4759d884455b90abbd1a043a5487 Mon Sep 17 00:00:00 2001 From: Shervin Date: Thu, 2 Jan 2025 14:33:57 -0800 Subject: [PATCH] fix: update Story.cs HasFunction method to discern between regular knots and function knots. --- ink-engine-runtime/Story.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ink-engine-runtime/Story.cs b/ink-engine-runtime/Story.cs index 45292b9b..c675c9b9 100644 --- a/ink-engine-runtime/Story.cs +++ b/ink-engine-runtime/Story.cs @@ -1816,7 +1816,15 @@ public void ChooseChoiceIndex(int choiceIdx) public bool HasFunction (string functionName) { try { - return KnotContainerWithName (functionName) != null; + Container container = KnotContainerWithName (functionName); + if(container != null) { + return container.content.Any(c => + c is Ink.Runtime.ControlCommand controlCommand && + controlCommand.commandType == ControlCommand.CommandType.PopFunction + ); + } else { + return false; + } } catch { return false; }