remove nested type annotation when building for gdscript

This commit is contained in:
2025-10-30 18:43:46 -05:00
parent 1cb31d719d
commit 01d028753b
2 changed files with 12 additions and 4 deletions

View File

@@ -18,13 +18,14 @@ using Choice.ChoiceExtension;
import hank.HankAST.ExprType;
import hank.StoryTree;
import hank.Alt.AltInstance;
import hank.Types;
/**
Possible states of the story being executed.
**/
enum StoryFrame {
HasText(text:String);
HasChoices(choices:Array<String>, tags:Array<Array<String>>);
HasChoices(choices:Array<String>, tags:TagArray);
Finished;
}
@@ -344,7 +345,7 @@ class Story {
for (choiceInfo in choices)
choiceInfo.output.format(this, hInterface, random, altInstances, nodeScopes, false)
];
var tags = [
var tags:TagArray = [
for (choiceInfo in choices)
choiceInfo.tags
];
@@ -639,7 +640,7 @@ class Story {
return removeDoubleSpaces(t).trim();
}
private function finalChoiceProcessing(choices:Array<String>, tags:Array<Array<String>>) {
private function finalChoiceProcessing(choices:Array<String>, tags:TagArray) {
return HasChoices([for (c in choices) removeDoubleSpaces(c).trim()], tags);
}
@@ -675,7 +676,7 @@ class Story {
public function run(
showText:(String,Void->Void)->Void,
showChoices:(Array<String>,Array<Array<String>>,Int->Void)->Void,
showChoices:(Array<String>,TagArray,Int->Void)->Void,
finish:Void->Void)
{
var loop = run.bind(showText, showChoices, finish);

7
hank/Types.hx Normal file
View File

@@ -0,0 +1,7 @@
package hank;
#if gdscript
typedef TagArray = Array<Dynamic>;
#else
typedef TagArray = Array<Array<String>>;
#end