narrat 2.0.8 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +105 -105
  3. package/dist/app.vue.d.ts +96 -96
  4. package/dist/audio.7z +0 -0
  5. package/dist/components/MainMenu.vue.d.ts +12 -12
  6. package/dist/components/Skills.vue.d.ts +22 -22
  7. package/dist/components/debug/debug-menu.vue.d.ts +48 -48
  8. package/dist/components/dialog-picture.vue.d.ts +9 -9
  9. package/dist/components/game-dialog.vue.d.ts +65 -65
  10. package/dist/components/hud.vue.d.ts +12 -12
  11. package/dist/components/inventory-ui.vue.d.ts +30 -30
  12. package/dist/components/loading-bar.vue.d.ts +10 -10
  13. package/dist/components/menu-buttons.vue.d.ts +26 -26
  14. package/dist/components/notification-toast.vue.d.ts +6 -6
  15. package/dist/components/quests-ui.vue.d.ts +20 -20
  16. package/dist/components/utils/modal.vue.d.ts +6 -6
  17. package/dist/components/volume-controls.vue.d.ts +7 -7
  18. package/dist/config.d.ts +151 -151
  19. package/dist/constants.d.ts +1 -1
  20. package/dist/data/characters.json +62 -62
  21. package/dist/data/config.json +182 -182
  22. package/dist/data/example.rpy +367 -363
  23. package/dist/data/refactor.rpy +30 -30
  24. package/dist/defaultConfig.d.ts +2 -2
  25. package/dist/demo/demo.d.ts +1 -1
  26. package/dist/dialog-box.vue.d.ts +37 -37
  27. package/dist/exports/config.d.ts +1 -1
  28. package/dist/exports/display.d.ts +2 -2
  29. package/dist/exports/plugins.d.ts +20 -20
  30. package/dist/fonts/OpenDyslexic.ttf.svg +2326 -2326
  31. package/dist/gameloop.d.ts +3 -3
  32. package/dist/lib/lib.d.ts +15 -15
  33. package/dist/lib.css +1 -1
  34. package/dist/main.d.ts +5 -5
  35. package/dist/narrat.es.js +254 -164
  36. package/dist/narrat.es.js.map +1 -1
  37. package/dist/narrat.umd.js +84 -84
  38. package/dist/narrat.umd.js.map +1 -1
  39. package/dist/plugins/NarratPlugin.d.ts +11 -11
  40. package/dist/stores/audio-store.d.ts +12 -12
  41. package/dist/stores/dialog-store.d.ts +31 -31
  42. package/dist/stores/hud-stats-store.d.ts +22 -22
  43. package/dist/stores/inventory-store.d.ts +37 -37
  44. package/dist/stores/main-store.d.ts +283 -276
  45. package/dist/stores/notification-store.d.ts +12 -12
  46. package/dist/stores/quest-log.d.ts +39 -39
  47. package/dist/stores/rendering-store.d.ts +13 -13
  48. package/dist/stores/screens-store.d.ts +23 -23
  49. package/dist/stores/skills.d.ts +36 -36
  50. package/dist/stores/vm-store.d.ts +155 -148
  51. package/dist/types/app-types.d.ts +4 -4
  52. package/dist/types/character-types.d.ts +27 -27
  53. package/dist/types/dialog-box-types.d.ts +10 -10
  54. package/dist/types/game-save.d.ts +21 -21
  55. package/dist/types/parser.d.ts +93 -92
  56. package/dist/types/state.d.ts +3 -3
  57. package/dist/utils/ajax.d.ts +1 -1
  58. package/dist/utils/audio-loader.d.ts +13 -13
  59. package/dist/utils/characters.d.ts +5 -5
  60. package/dist/utils/data-helpers.d.ts +19 -19
  61. package/dist/utils/debounce.d.ts +14 -14
  62. package/dist/utils/error-handling.d.ts +3 -3
  63. package/dist/utils/helpers.d.ts +6 -6
  64. package/dist/utils/images-loader.d.ts +6 -6
  65. package/dist/utils/logger.d.ts +11 -11
  66. package/dist/utils/object-iterators.d.ts +8 -8
  67. package/dist/utils/promises.d.ts +1 -1
  68. package/dist/utils/randomId.d.ts +1 -1
  69. package/dist/utils/save-helpers.d.ts +3 -3
  70. package/dist/utils/skillchecks.d.ts +17 -17
  71. package/dist/utils/string-helpers.d.ts +3 -3
  72. package/dist/utils/time-helpers.d.ts +2 -2
  73. package/dist/vm/commands/arithmetic-commands.d.ts +17 -17
  74. package/dist/vm/commands/audio-commands.d.ts +8 -8
  75. package/dist/vm/commands/choice.d.ts +37 -37
  76. package/dist/vm/commands/clear_dialog.d.ts +2 -2
  77. package/dist/vm/commands/command-helpers.d.ts +2 -2
  78. package/dist/vm/commands/command-plugin.d.ts +43 -30
  79. package/dist/vm/commands/flow-commands.d.ts +14 -14
  80. package/dist/vm/commands/if.d.ts +10 -10
  81. package/dist/vm/commands/index.d.ts +2 -2
  82. package/dist/vm/commands/inventory-commands.d.ts +15 -15
  83. package/dist/vm/commands/logic-command.d.ts +42 -42
  84. package/dist/vm/commands/notify.d.ts +4 -4
  85. package/dist/vm/commands/quest-commands.d.ts +30 -30
  86. package/dist/vm/commands/screen-commands.d.ts +8 -8
  87. package/dist/vm/commands/set.d.ts +6 -6
  88. package/dist/vm/commands/skill-commands.d.ts +33 -33
  89. package/dist/vm/commands/stats-commands.d.ts +12 -12
  90. package/dist/vm/commands/string-commands.d.ts +9 -9
  91. package/dist/vm/commands/text-field.d.ts +7 -7
  92. package/dist/vm/commands/text.d.ts +13 -13
  93. package/dist/vm/commands/wait.d.ts +4 -4
  94. package/dist/vm/vm-helpers.d.ts +16 -16
  95. package/dist/vm/vm-parser.d.ts +19 -19
  96. package/dist/vm/vm-parser.test.d.ts +1 -1
  97. package/dist/vm/vm.d.ts +19 -19
  98. package/package.json +79 -79
  99. package/CHANGELOG.md +0 -785
  100. package/dist/.DS_Store +0 -0
  101. package/dist/img/.DS_Store +0 -0
  102. package/dist/music/.DS_Store +0 -0
  103. package/dist/sounds/.DS_Store +0 -0
package/dist/narrat.es.js CHANGED
@@ -537,7 +537,7 @@ var es6Promise = { exports: {} };
537
537
  });
538
538
  })(es6Promise);
539
539
  es6Promise.exports.polyfill();
540
- var main = /* @__PURE__ */ (() => '/*! @import *//*! tailwindcss v3.1.4 | MIT License | https://tailwindcss.com */*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::-webkit-backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.flex{display:flex}.table{display:table}.grid{display:grid}.hidden{display:none}.w-full{width:100%}.flex-shrink{flex-shrink:1}.flex-grow{flex-grow:1}.table-auto{table-layout:auto}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize{resize:both}.list-disc{list-style-type:disc}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.gap-4{gap:1rem}.border{border-width:1px}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.italic{font-style:italic}.underline{-webkit-text-decoration-line:underline;text-decoration-line:underline}.line-through{-webkit-text-decoration-line:line-through;text-decoration-line:line-through}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{--font-family: "Helvetica", sans-serif, "Arial", "sans-serif";--bg-color: #131720;--text-color: #d9e1f2;--primary: hsl(255, 30%, 55%);--focus: hsl(210, 90%, 50%);--secondary: #42b983;--border-color: hsla(0, 0%, 100%, .2);--light-1: hsl(210, 30%, 40%);--light-2: hsl(255, 30%, 50%);--light-background: linear-gradient(to right, var(--light-1), var(--light-2));--shadow-1: hsla(236, 50%, 50%, .3);--shadow-2: hsla(236, 50%, 50%, .4);--hud-background: rgba(0, 0, 0, .4);--hud-text-color: var(--text-color);--notifications-bg: darkslateblue;--skills-text-background: rgba(0, 0, 0, .5);--skills-text-color: var(--text-color);--skills-level-background: rgba(0, 0, 0, .5);--skills-level-color: orange;--skills-xp-bar-height: 40px;--skill-check-name-color: orange;--skill-check-difficulty: orange;--skill-check-success: green;--skill-check-failed: red;--skill-check-color: orange;--dialog-choice-color: orange;--dialog-choice-hover-color: var(--text-color);--inventory-text-background: rgba(0, 0, 0, .5);--inventory-text-color: var(--text-color);--inventory-amount-background: rgba(0, 0, 0, .5);--inventory-amount-color: orange;--quest-title-color: yellow;--completed-quest-title-color: grey;--objective-in-progress-color: white;--objective-completed-color: grey}body,*{font-family:var(--font-family)}.list-item{display:inline-block;margin-right:10px}.list-enter-active,.list-leave-active{transition:all .3s ease}#app{background-size:cover}.list-enter-from,.list-leave-to{opacity:0;transform:translate(300px)}.notification-item{display:inline-block;margin-right:10px}.notification-enter-active,.notification-leave-active{transition:all .3s ease}.notification-enter-from,.notification-leave-to{opacity:0;transform:translateY(-300px)}.fade-enter-active,.fade-leave-active{transition:opacity .3s ease}.fade-enter-from,.fade-leave-to{opacity:0}.fade-in-enter-active{transition:opacity .1s ease}.fade-in-enter-from{opacity:0}body{padding:0;margin:0;font-family:Arial,sans-serif;background-color:#000}.select{background:var(--light-background);padding:10px}.option{background-color:var(--light-2);padding:5px;color:var(--text-color)}.button{background:var(--light-background);color:var(--text-color);box-shadow:.4rem .5rem 2.4rem .2rem var(--shadow-1),inset -2px -4px #0006,inset 2px 2px #fff7;border-radius:10px;padding:10px;font-weight:800;font-size:16px;margin:10px;transition:.2s;box-shadow:inset -2px -4px #0006,inset 2px 2px #fff7}.button.large{border-radius:20px}.menu-button{border-radius:5px}.button.main-menu-button{border-radius:20px}.button:focus,.button:hover{transform:translateY(-.2rem);box-shadow:0 0 1rem .2rem var(--shadow-2),inset -2px -4px #0006,inset 2px 2px #fff7}.disabled{-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}.button.disabled{box-shadow:unset;color:gray;background:var(--border-color)}.input{background:var(--light-background);color:var(--text-color);box-shadow:.4rem .4rem 2.4rem .2rem var(--shadow-1);border-radius:100px;padding:10px;font-weight:800;font-size:16px;margin:10px;transition:.2s}.input:focus,.input:hover{transform:translateY(-.2rem);box-shadow:0 0 2.4rem .2rem var(--shadow-2)}a{color:pink;text-decoration:underline}th,td{padding:4px;border:1px solid var(--text-color);text-align:center}#game-holder{width:100vw;height:100vh;padding:0;margin:0;top:0;left:0;background-color:#000;display:flex;align-items:center;justify-content:center;min-height:-webkit-fill-available}.title{font-size:30px;font-weight:700;text-align:center}.container{padding:20px}h1,h2,h3,h4{font-weight:700}h1{font-size:30px}h2{font-size:26px}h3{font-size:24px}hr.solid{border:1px solid var(--text-color);margin-top:30px;margin-bottom:30px}.card-1{box-shadow:0 1px 3px #0000001f,0 1px 2px #0000003d;transition:all .3s cubic-bezier(.25,.8,.25,1)}.card-1:hover{box-shadow:0 14px 28px #00000040,0 10px 10px #00000038}.card-2{box-shadow:0 3px 6px #00000029,0 3px 6px #0000003b}.card-3{box-shadow:0 10px 20px #00000030,0 6px 6px #0000003b}.card-4{box-shadow:0 14px 28px #00000040,0 10px 10px #00000038}.card-5{box-shadow:0 19px 38px #0000004d,0 15px 12px #00000038}.dialog-choice{transition:.2s}.dialog-choice:hover{transform:scale(1.05);transform-origin:center}.dialog-choice:not(:hover)>.skill-check-name,.passive-skill-check>.skill-check-name{color:var(--skill-check-name-color)}.dialog-choice:not(:hover)>.skill-check-difficulty,.passive-skill-check>.skill-check-difficulty{color:var(--skill-check-difficulty)}.skill-check-difficulty{font-weight:700}.dialog-choice:not(:hover)>.skill-check-success,.passive-skill-check>.skill-check-success{color:var(--skill-check-success)}.dialog-choice:not(:hover)>.skill-check-failed,.passive-skill-check>.skill-check-failed{color:var(--skill-check-failed)}.dialog-choice:not(:hover)>.skill-check,.passive-skill-check.skill-check{color:var(--skill-check-color)}.narrat-canvas{position:absolute;height:100%;top:0;left:0}#touchTrigger{pointer-events:none}\n')();
540
+ var main = /* @__PURE__ */ (() => '/*! @import *//*! tailwindcss v3.1.4 | MIT License | https://tailwindcss.com */*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::-webkit-backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.flex{display:flex}.table{display:table}.grid{display:grid}.hidden{display:none}.w-full{width:100%}.flex-shrink{flex-shrink:1}.flex-grow{flex-grow:1}.table-auto{table-layout:auto}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.resize{resize:both}.list-disc{list-style-type:disc}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.gap-4{gap:1rem}.border{border-width:1px}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity))}.italic{font-style:italic}.underline{-webkit-text-decoration-line:underline;text-decoration-line:underline}.line-through{-webkit-text-decoration-line:line-through;text-decoration-line:line-through}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}:root{--font-family: "Helvetica", sans-serif, "Arial", "sans-serif";--bg-color: #131720;--text-color: #d9e1f2;--primary: hsl(255, 30%, 55%);--focus: hsl(210, 90%, 50%);--secondary: #42b983;--border-color: hsla(0, 0%, 100%, .2);--light-1: hsl(210, 30%, 40%);--light-2: hsl(255, 30%, 50%);--light-background: linear-gradient(to right, var(--light-1), var(--light-2));--shadow-1: hsla(236, 50%, 50%, .3);--shadow-2: hsla(236, 50%, 50%, .4);--hud-background: rgba(0, 0, 0, .4);--hud-text-color: var(--text-color);--notifications-bg: darkslateblue;--skills-text-background: rgba(0, 0, 0, .5);--skills-text-color: var(--text-color);--skills-level-background: rgba(0, 0, 0, .5);--skills-level-color: orange;--skills-xp-bar-height: 40px;--skill-check-name-color: orange;--skill-check-difficulty: orange;--skill-check-success: green;--skill-check-failed: red;--skill-check-color: orange;--dialog-choice-color: orange;--dialog-choice-hover-color: var(--text-color);--inventory-text-background: rgba(0, 0, 0, .5);--inventory-text-color: var(--text-color);--inventory-amount-background: rgba(0, 0, 0, .5);--inventory-amount-color: orange;--quest-title-color: yellow;--completed-quest-title-color: grey;--objective-in-progress-color: white;--objective-completed-color: grey}body,*{font-family:var(--font-family)}.list-item{display:inline-block;margin-right:10px}.list-enter-active,.list-leave-active{transition:all .3s ease}#app{background-size:cover}.list-enter-from,.list-leave-to{opacity:0;transform:translate(300px)}.notification-item{display:inline-block;margin-right:10px}.notification-enter-active,.notification-leave-active{transition:all .3s ease}.notification-enter-from,.notification-leave-to{opacity:0;transform:translateY(-300px)}.fade-enter-active,.fade-leave-active{transition:opacity .3s ease}.fade-enter-from,.fade-leave-to{opacity:0}.fade-in-enter-active{transition:opacity .1s ease}.fade-in-enter-from{opacity:0}body{padding:0;margin:0;font-family:Arial,sans-serif;background-color:#000}.select{background:var(--light-background);padding:10px}.option{background-color:var(--light-2);padding:5px;color:var(--text-color)}.button{background:var(--light-background);color:var(--text-color);box-shadow:.4rem .5rem 2.4rem .2rem var(--shadow-1),inset -2px -4px #0006,inset 2px 2px #fff7;border-radius:10px;padding:10px;font-weight:800;font-size:16px;margin:10px;transition:.2s;box-shadow:inset -2px -4px #0006,inset 2px 2px #fff7}.button.large{border-radius:20px}.menu-button{border-radius:5px}.button.main-menu-button{border-radius:20px}.button:focus,.button:hover{transform:translateY(-.2rem);box-shadow:0 0 1rem .2rem var(--shadow-2),inset -2px -4px #0006,inset 2px 2px #fff7}.disabled{-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}.button.disabled{box-shadow:unset;color:gray;background:var(--border-color)}.input{background:var(--light-background);color:var(--text-color);box-shadow:.4rem .4rem 2.4rem .2rem var(--shadow-1);border-radius:100px;padding:10px;font-weight:800;font-size:16px;margin:10px;transition:.2s}.input:focus,.input:hover{transform:translateY(-.2rem);box-shadow:0 0 2.4rem .2rem var(--shadow-2)}a{color:pink;text-decoration:underline}th,td{padding:4px;border:1px solid var(--text-color);text-align:center}#game-holder{width:100vw;height:100vh;padding:0;margin:0;top:0;left:0;background-color:#000;display:flex;align-items:center;justify-content:center;min-height:-webkit-fill-available}.title{font-size:30px;font-weight:700;text-align:center}.container{padding:20px}h1,h2,h3,h4{font-weight:700}h1{font-size:30px}h2{font-size:26px}h3{font-size:24px}hr.solid{border:1px solid var(--text-color);margin-top:30px;margin-bottom:30px}.card-1{box-shadow:0 1px 3px #0000001f,0 1px 2px #0000003d;transition:all .3s cubic-bezier(.25,.8,.25,1)}.card-1:hover{box-shadow:0 14px 28px #00000040,0 10px 10px #00000038}.card-2{box-shadow:0 3px 6px #00000029,0 3px 6px #0000003b}.card-3{box-shadow:0 10px 20px #00000030,0 6px 6px #0000003b}.card-4{box-shadow:0 14px 28px #00000040,0 10px 10px #00000038}.card-5{box-shadow:0 19px 38px #0000004d,0 15px 12px #00000038}.dialog-choice{transition:.2s}.dialog-choice:hover{transform:scale(1.05);transform-origin:center}.dialog-choice:not(:hover)>.skill-check-name,.passive-skill-check>.skill-check-name{color:var(--skill-check-name-color)}.dialog-choice:not(:hover)>.skill-check-difficulty,.passive-skill-check>.skill-check-difficulty{color:var(--skill-check-difficulty)}.skill-check-difficulty{font-weight:700}.dialog-choice:not(:hover)>.skill-check-success,.passive-skill-check>.skill-check-success{color:var(--skill-check-success)}.dialog-choice:not(:hover)>.skill-check-failed,.passive-skill-check>.skill-check-failed{color:var(--skill-check-failed)}.dialog-choice:not(:hover)>.skill-check,.passive-skill-check.skill-check{color:var(--skill-check-color)}.narrat-canvas{position:absolute;height:100%;top:0;left:0}#touchTrigger{pointer-events:none}\n')();
541
541
  const f$1 = ref([]), v$1 = ref(null), m$1 = ref(null), g$1 = ref(null), h$1 = reactive({ current: "" }), y$1 = [], b$1 = ref(false), k$1 = readonly(f$1), w$1 = readonly(v$1), M$1 = readonly(m$1), q$1 = readonly(g$1), x$1 = readonly(h$1), $$1 = (e20 = w$1.value) => {
542
542
  h$1.current = e20;
543
543
  const t2 = k$1.value.findIndex((t3) => t3.name === e20), n2 = k$1.value.map((e21) => e21.name);
@@ -37106,23 +37106,6 @@ const useInventory = defineStore("inventory", {
37106
37106
  }
37107
37107
  }
37108
37108
  });
37109
- const everyObject = (object, predicate) => {
37110
- for (const key in object) {
37111
- if (!predicate(object[key])) {
37112
- return false;
37113
- }
37114
- }
37115
- return true;
37116
- };
37117
- const filterObject = (object, predicate) => {
37118
- const result = {};
37119
- for (const key in object) {
37120
- if (predicate(object[key])) {
37121
- result[key] = object[key];
37122
- }
37123
- }
37124
- return result;
37125
- };
37126
37109
  const useQuests = defineStore("quests", {
37127
37110
  state: () => ({
37128
37111
  quests: {}
@@ -37212,7 +37195,7 @@ const useQuests = defineStore("quests", {
37212
37195
  if (!quest) {
37213
37196
  return false;
37214
37197
  }
37215
- return everyObject(quest.objectives, (objective) => objective.state === "completed");
37198
+ return quest.state === "completed";
37216
37199
  },
37217
37200
  isObjectiveCompleted(questId, objectiveId) {
37218
37201
  const objective = this.getObjective(questId, objectiveId);
@@ -37640,7 +37623,8 @@ const useVM = defineStore("vm", {
37640
37623
  lastLabel: "main",
37641
37624
  script: {},
37642
37625
  labelStack: ["main"],
37643
- currentScope: {}
37626
+ currentScope: {},
37627
+ commandsWaitingForPlayerAnswer: []
37644
37628
  }),
37645
37629
  actions: {
37646
37630
  generateSaveData() {
@@ -37657,7 +37641,14 @@ const useVM = defineStore("vm", {
37657
37641
  this.currentScope = {};
37658
37642
  },
37659
37643
  setReturnValue(value) {
37660
- this.currentStack.returnValue = value;
37644
+ this.currentFrame.returnValue = value;
37645
+ },
37646
+ waitForPlayerAnswer(cmd) {
37647
+ this.commandsWaitingForPlayerAnswer.push(cmd);
37648
+ },
37649
+ popAnswerQueue() {
37650
+ const cmd = this.commandsWaitingForPlayerAnswer.pop();
37651
+ return cmd;
37661
37652
  },
37662
37653
  removeFromScope(vars) {
37663
37654
  for (const varName of vars) {
@@ -37666,8 +37657,8 @@ const useVM = defineStore("vm", {
37666
37657
  },
37667
37658
  addScopedVariable(key, value) {
37668
37659
  this.currentScope[key] = value;
37669
- if (this.currentStack) {
37670
- this.currentStack.scope[key] = value;
37660
+ if (this.currentFrame) {
37661
+ this.currentFrame.scope[key] = value;
37671
37662
  }
37672
37663
  },
37673
37664
  extendScope(scope) {
@@ -37762,35 +37753,80 @@ const useVM = defineStore("vm", {
37762
37753
  const dataToModify = getModifiableDataPinia();
37763
37754
  addDataHelper(dataToModify, path, value);
37764
37755
  },
37765
- addStack(newStackOptions) {
37756
+ addFrame(newStackOptions) {
37766
37757
  if (!newStackOptions.label) {
37767
- newStackOptions.label = this.currentStack.label;
37758
+ if (this.currentFrame) {
37759
+ newStackOptions.label = this.currentFrame.label;
37760
+ } else {
37761
+ throw new Error(`Tried to add a new frame but no label was passed and there is no current frame label`);
37762
+ }
37768
37763
  }
37769
37764
  const newStack = this.stackOptionsToStack(newStackOptions);
37770
37765
  this.stack.push(newStack);
37771
- return this.runLine();
37766
+ },
37767
+ async addAndRunFrame(newStackOptions) {
37768
+ await this.addFrame(newStackOptions);
37769
+ await this.runFrame();
37770
+ },
37771
+ async runFrame() {
37772
+ const frame = this.currentFrame;
37773
+ if (!frame) {
37774
+ throw new Error(`Tried to run a frame but there is no current frame`);
37775
+ }
37776
+ frame.currentIndex = 0;
37777
+ while (this.currentLine) {
37778
+ await this.runLineOnly();
37779
+ frame.currentIndex++;
37780
+ }
37781
+ const previousScope = frame.scope;
37782
+ this.removeFromScope(Object.keys(previousScope));
37783
+ const { returnValue, onComplete } = frame;
37784
+ this.stack.splice(this.stack.length - 1, 1);
37785
+ if (onComplete) {
37786
+ onComplete(returnValue);
37787
+ }
37788
+ },
37789
+ async runGame() {
37790
+ await this.runFrame();
37791
+ if (this.stack.length === 0) {
37792
+ this.reachedEndOfScript();
37793
+ }
37794
+ },
37795
+ async nextLineOnly() {
37796
+ if (this.stack.length === 0) {
37797
+ return false;
37798
+ }
37799
+ if (this.currentFrame && this.currentFrame.currentIndex < this.currentFrame.branchData.branch.length - 1) {
37800
+ this.currentFrame.currentIndex++;
37801
+ return true;
37802
+ } else {
37803
+ return false;
37804
+ }
37772
37805
  },
37773
37806
  async nextLine() {
37774
37807
  if (this.stack.length === 0) {
37775
- this.finishGame();
37808
+ this.reachedEndOfScript();
37776
37809
  return;
37777
37810
  }
37778
- if (this.currentStack.currentIndex < this.currentStack.branchData.branch.length - 1) {
37779
- this.currentStack.currentIndex++;
37811
+ if (this.currentFrame && this.currentFrame.currentIndex < this.currentFrame.branchData.branch.length - 1) {
37812
+ this.currentFrame.currentIndex++;
37780
37813
  } else {
37781
- return this.previousStack();
37814
+ return this.previousFrame();
37782
37815
  }
37783
37816
  if (this.stack.length === 0) {
37784
- this.finishGame();
37817
+ this.reachedEndOfScript();
37785
37818
  } else {
37786
37819
  return this.runLine();
37787
37820
  }
37788
- this.currentStack.currentIndex++;
37821
+ this.currentFrame.currentIndex++;
37789
37822
  },
37790
- async previousStack() {
37791
- const previousScope = this.currentStack.scope;
37823
+ async previousFrame() {
37824
+ if (!this.currentFrame) {
37825
+ throw new Error(`Tried to go back to previous frame but there is no current frame`);
37826
+ }
37827
+ const previousScope = this.currentFrame.scope;
37792
37828
  this.removeFromScope(Object.keys(previousScope));
37793
- const { returnValue, onComplete } = this.currentStack;
37829
+ const { returnValue, onComplete } = this.currentFrame;
37794
37830
  this.stack.splice(this.stack.length - 1, 1);
37795
37831
  if (onComplete) {
37796
37832
  onComplete(returnValue);
@@ -37798,7 +37834,7 @@ const useVM = defineStore("vm", {
37798
37834
  return this.nextLine();
37799
37835
  }
37800
37836
  },
37801
- finishGame() {
37837
+ reachedEndOfScript() {
37802
37838
  useInventory().onScriptEnd();
37803
37839
  const mainStore = useMain();
37804
37840
  if (mainStore.options.debug) {
@@ -37809,7 +37845,7 @@ const useVM = defineStore("vm", {
37809
37845
  });
37810
37846
  }
37811
37847
  },
37812
- async runLine() {
37848
+ async runLineOnly() {
37813
37849
  const expression = this.currentLine;
37814
37850
  if (!expression) {
37815
37851
  error(`There is no line of script to run.`);
@@ -37818,6 +37854,10 @@ const useVM = defineStore("vm", {
37818
37854
  useInventory().onScriptStart();
37819
37855
  await runCommand(expression);
37820
37856
  },
37857
+ async runLine() {
37858
+ await this.runLineOnly();
37859
+ this.nextLine();
37860
+ },
37821
37861
  runLabelFunction(label, ...args) {
37822
37862
  return new Promise((resolve, reject) => {
37823
37863
  const branchData = this.script[label];
@@ -37833,11 +37873,11 @@ const useVM = defineStore("vm", {
37833
37873
  resolve(returnValue);
37834
37874
  }
37835
37875
  };
37836
- this.addStack(stack);
37876
+ this.addAndRunFrame(stack);
37837
37877
  });
37838
37878
  },
37839
- runCustomStack(stack) {
37840
- this.addStack(stack);
37879
+ runCustomFrame(stack) {
37880
+ this.addAndRunFrame(stack);
37841
37881
  },
37842
37882
  runLabel(label, ...args) {
37843
37883
  const branchData = this.script[label];
@@ -37851,18 +37891,23 @@ const useVM = defineStore("vm", {
37851
37891
  args,
37852
37892
  label
37853
37893
  });
37854
- this.runLine();
37894
+ this.runGame();
37855
37895
  }
37856
37896
  },
37857
37897
  getters: {
37858
- currentStack(state) {
37898
+ currentFrame(state) {
37859
37899
  const result = state.stack[state.stack.length - 1];
37860
37900
  return result;
37861
37901
  },
37862
37902
  currentLine() {
37863
- const currentStack = this.currentStack;
37864
- if (this.currentStack) {
37865
- return currentStack.branchData.branch[currentStack.currentIndex];
37903
+ const currentFrame = this.currentFrame;
37904
+ if (this.currentFrame && currentFrame.branchData.branch.length > currentFrame.currentIndex) {
37905
+ return currentFrame.branchData.branch[currentFrame.currentIndex];
37906
+ }
37907
+ },
37908
+ commandWaitingForAnswer() {
37909
+ if (this.commandsWaitingForPlayerAnswer.length > 0) {
37910
+ return this.commandsWaitingForPlayerAnswer[0];
37866
37911
  }
37867
37912
  }
37868
37913
  }
@@ -38086,7 +38131,7 @@ async function runCommand(expression, choices) {
38086
38131
  error(`Narrat script runtime error at <span class="error-filename">${expression.fileName}:${expression.line + 1}</span>
38087
38132
  <b>${err}</b>
38088
38133
  Script: ${expression.code}
38089
- Label: ${vmStore.currentStack.label}`);
38134
+ Label: ${vmStore.currentFrame.label}`);
38090
38135
  }
38091
38136
  }
38092
38137
  async function generateCommand(expr, choices) {
@@ -38144,7 +38189,7 @@ async function runExpression(expr, choices) {
38144
38189
  const command = await generateCommand(expr, choices);
38145
38190
  const commandPlugin = vm.commands[command.commandType];
38146
38191
  if (commandPlugin) {
38147
- const result = await commandPlugin.runner(command, choices);
38192
+ const result = await commandPlugin.run(command, choices);
38148
38193
  return result;
38149
38194
  } else {
38150
38195
  throw new Error(`${command.commandType} is not a valid command`);
@@ -38153,17 +38198,15 @@ async function runExpression(expr, choices) {
38153
38198
  async function playerAnswered(choice) {
38154
38199
  audioEvent("onPlayerAnswered");
38155
38200
  const vmStore = useVM();
38156
- const command = vmStore.lastChoiceCommand;
38157
- vmStore.lastChoiceCommand = void 0;
38201
+ const command = vmStore.popAnswerQueue();
38158
38202
  const currentLine = vmStore.currentLine;
38159
38203
  try {
38160
38204
  if (command) {
38161
38205
  const commandPlugin = vm.commands[command.commandType];
38162
- if (commandPlugin && commandPlugin.onPlayerAnswered) {
38163
- return await commandPlugin.onPlayerAnswered(command, choice);
38206
+ if (commandPlugin) {
38207
+ return await commandPlugin.processPlayerAnswer(command, choice);
38164
38208
  }
38165
38209
  }
38166
- return await vmStore.nextLine();
38167
38210
  } catch (err) {
38168
38211
  console.error(err);
38169
38212
  error(`Error after player answer at ${currentLine.fileName}:${currentLine.line + 1} (${currentLine.code}<br /> - Error: ${err}`);
@@ -38241,7 +38284,7 @@ const useMain = defineStore("main", {
38241
38284
  },
38242
38285
  async startGame() {
38243
38286
  this.startMachine();
38244
- await useVM().runLine();
38287
+ await useVM().runGame();
38245
38288
  await this.saveGame();
38246
38289
  },
38247
38290
  async loadGame(saveFile) {
@@ -39914,6 +39957,15 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
39914
39957
  };
39915
39958
  }
39916
39959
  });
39960
+ const filterObject = (object, predicate) => {
39961
+ const result = {};
39962
+ for (const key in object) {
39963
+ if (predicate(object[key])) {
39964
+ result[key] = object[key];
39965
+ }
39966
+ }
39967
+ return result;
39968
+ };
39917
39969
  var questsUi_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".quests-modal{width:100%;min-height:50%}.quest-header{display:flex;flex-direction:row;align-items:center}.quest-title{font-size:1.5rem;font-weight:700;margin-bottom:.5rem}.quest-completed{color:var(--completed-quest-title-color)}.quest-in-progress{color:var(--quest-title-color)}.quest-state{font-size:1.25rem;font-weight:700;margin-bottom:.5rem}.quest-description{font-size:1.1rem;text-align:justify;font-style:italic;margin-bottom:.5rem}.quest-objectives-container{margin-left:10px}.quest-objective-completed{color:var(--objective-completed-color);text-decoration:line-through}.quest-objective-in-progress{color:var(--objective-in-progress-color)}.quest-objective-description{font-size:1rem;margin-bottom:.5rem}\n")();
39918
39970
  const _sfc_main$2 = defineComponent({
39919
39971
  setup() {
@@ -40539,6 +40591,7 @@ class CommandPlugin {
40539
40591
  __publicField(this, "argTypes");
40540
40592
  __publicField(this, "parser");
40541
40593
  __publicField(this, "onPlayerAnswered");
40594
+ __publicField(this, "returnAfterPlayerAnswer");
40542
40595
  this.keyword = keyword;
40543
40596
  this.runner = runner;
40544
40597
  this.argTypes = argTypes;
@@ -40547,6 +40600,34 @@ class CommandPlugin {
40547
40600
  } else {
40548
40601
  this.parser = parser;
40549
40602
  }
40603
+ this.returnAfterPlayerAnswer = false;
40604
+ }
40605
+ async run(cmd, choices) {
40606
+ let res = await this.runner(cmd, choices);
40607
+ if (this.returnAfterPlayerAnswer) {
40608
+ res = await new Promise((resolve, reject) => {
40609
+ useVM().waitForPlayerAnswer(cmd);
40610
+ cmd.finishCommand = resolve;
40611
+ });
40612
+ }
40613
+ return res;
40614
+ }
40615
+ async processPlayerAnswer(cmd, choice) {
40616
+ let res = choice;
40617
+ if (this.onPlayerAnswered) {
40618
+ res = await this.onPlayerAnswered(cmd, choice);
40619
+ }
40620
+ if (this.returnAfterPlayerAnswer && cmd.finishCommand) {
40621
+ cmd.finishCommand(res);
40622
+ }
40623
+ return res;
40624
+ }
40625
+ static FromOptions(options) {
40626
+ var _a2;
40627
+ const plugin = new CommandPlugin(options.keyword, options.argTypes, options.runner, options.parser);
40628
+ plugin.onPlayerAnswered = options.onPlayerAnswered;
40629
+ plugin.returnAfterPlayerAnswer = (_a2 = options.returnAfterPlayerAnswer) != null ? _a2 : false;
40630
+ return plugin;
40550
40631
  }
40551
40632
  }
40552
40633
  function generateParser(keyword, argTypes) {
@@ -40607,7 +40688,6 @@ const addLevelPlugin = new CommandPlugin("add_level", [
40607
40688
  commandRuntimeError(cmd, `add_level command needs a skill id and a value as parameters`);
40608
40689
  }
40609
40690
  useSkills().incrementSkill(skillKey, amount);
40610
- return useVM().nextLine();
40611
40691
  });
40612
40692
  const addXpPlugin = new CommandPlugin("add_xp", [
40613
40693
  { name: "xpKey", type: "string" },
@@ -40618,7 +40698,6 @@ const addXpPlugin = new CommandPlugin("add_xp", [
40618
40698
  commandRuntimeError(cmd, `add_xp command needs a skill id and a value as parameters`);
40619
40699
  }
40620
40700
  useSkills().addXp(xpKey, xpToAdd);
40621
- return useVM().nextLine();
40622
40701
  });
40623
40702
  const rollPlugin = new CommandPlugin("roll", [
40624
40703
  { name: "id", type: "string" },
@@ -40646,7 +40725,6 @@ const addStatPlugin = new CommandPlugin("add_stat", [
40646
40725
  }
40647
40726
  const hud = useHud();
40648
40727
  hud.addStat(statKey, amountToAdd);
40649
- return useVM().nextLine();
40650
40728
  });
40651
40729
  const setStatPlugin = new CommandPlugin("set_stat", [
40652
40730
  { name: "statKey", type: "string" },
@@ -40658,7 +40736,6 @@ const setStatPlugin = new CommandPlugin("set_stat", [
40658
40736
  }
40659
40737
  const hud = useHud();
40660
40738
  hud.setStat(statKey, value);
40661
- return useVM().nextLine();
40662
40739
  });
40663
40740
  const getStatPlugin = new CommandPlugin("get_stat_value", [{ name: "statKey", type: "string" }], async (cmd) => {
40664
40741
  const { statKey } = cmd.options;
@@ -40668,42 +40745,56 @@ const getStatPlugin = new CommandPlugin("get_stat_value", [{ name: "statKey", ty
40668
40745
  const hud = useHud();
40669
40746
  return hud.getStatValue(statKey);
40670
40747
  });
40671
- const jumpCommand = new CommandPlugin("jump", "any", async (cmd) => {
40672
- if (cmd.args.length < 1 || typeof cmd.args[0] !== "string") {
40673
- commandRuntimeError(cmd, `requires a label argument`);
40748
+ const jumpCommand = CommandPlugin.FromOptions({
40749
+ keyword: "jump",
40750
+ argTypes: "any",
40751
+ runner: async (cmd) => {
40752
+ if (cmd.args.length < 1 || typeof cmd.args[0] !== "string") {
40753
+ commandRuntimeError(cmd, `requires a label argument`);
40754
+ }
40755
+ const label = cmd.args[0];
40756
+ const vm2 = useVM();
40757
+ const newStack = {
40758
+ branchData: vm2.script[label],
40759
+ label,
40760
+ args: cmd.args.splice(1),
40761
+ currentIndex: 0
40762
+ };
40763
+ vm2.setStack(newStack);
40764
+ await useMain().saveGame();
40765
+ await vm2.runFrame();
40674
40766
  }
40675
- const label = cmd.args[0];
40676
- const vm2 = useVM();
40677
- const newStack = {
40678
- branchData: vm2.script[label],
40679
- label,
40680
- args: cmd.args.splice(1),
40681
- currentIndex: 0
40682
- };
40683
- vm2.setStack(newStack);
40684
- await useMain().saveGame();
40685
- await vm2.runLine();
40686
40767
  });
40687
- const runLabelPlugin = new CommandPlugin("run", "any", async (cmd) => {
40688
- if (cmd.args.length < 1 || typeof cmd.args[0] !== "string") {
40689
- commandRuntimeError(cmd, `run command needs a label to argument run`);
40768
+ const runLabelPlugin = CommandPlugin.FromOptions({
40769
+ keyword: "run",
40770
+ argTypes: "any",
40771
+ runner: async (cmd) => {
40772
+ if (cmd.args.length < 1 || typeof cmd.args[0] !== "string") {
40773
+ commandRuntimeError(cmd, `run command needs a label to argument run`);
40774
+ }
40775
+ const label = cmd.args[0];
40776
+ const res = await useVM().runLabelFunction(label, ...cmd.args.slice(1));
40777
+ return res;
40690
40778
  }
40691
- const label = cmd.args[0];
40692
- const res = await useVM().runLabelFunction(label, ...cmd.args.slice(1));
40693
- return res;
40694
40779
  });
40695
- const defineVariablePlugin = new CommandPlugin("var", [
40696
- { name: "name", type: "string" },
40697
- { name: "value", type: "any" }
40698
- ], async (cmd) => {
40699
- const { name, value } = cmd.options;
40700
- useVM().addScopedVariable(name, value);
40701
- return useVM().nextLine();
40780
+ const defineVariablePlugin = CommandPlugin.FromOptions({
40781
+ keyword: "var",
40782
+ argTypes: [
40783
+ { name: "name", type: "string" },
40784
+ { name: "value", type: "any" }
40785
+ ],
40786
+ runner: async (cmd) => {
40787
+ const { name, value } = cmd.options;
40788
+ useVM().addScopedVariable(name, value);
40789
+ }
40702
40790
  });
40703
- const returnPlugin = new CommandPlugin("return", [{ name: "value", type: "any" }], async (cmd) => {
40704
- const { value } = cmd.options;
40705
- useVM().setReturnValue(value);
40706
- return useVM().nextLine();
40791
+ const returnPlugin = CommandPlugin.FromOptions({
40792
+ keyword: "return",
40793
+ argTypes: [{ name: "value", type: "any" }],
40794
+ runner: async (cmd) => {
40795
+ const { value } = cmd.options;
40796
+ useVM().setReturnValue(value);
40797
+ }
40707
40798
  });
40708
40799
  const playCommandArgs = [
40709
40800
  { name: "mode", type: "string" },
@@ -40716,7 +40807,6 @@ const playCommand = new CommandPlugin("play", playCommandArgs, async (cmd) => {
40716
40807
  } else {
40717
40808
  playAudio(playOptions.audio);
40718
40809
  }
40719
- useVM().nextLine();
40720
40810
  });
40721
40811
  const pauseCommand = new CommandPlugin("pause", playCommandArgs, async (cmd) => {
40722
40812
  const pauseOptions = cmd.options;
@@ -40730,7 +40820,6 @@ const pauseCommand = new CommandPlugin("pause", playCommandArgs, async (cmd) =>
40730
40820
  } else {
40731
40821
  commandRuntimeError(cmd, `pause first option needs to either be in music mode, or if stopping a sound needs to have the sound name supplied as second argument.`);
40732
40822
  }
40733
- return useVM().nextLine();
40734
40823
  });
40735
40824
  const stopCommand = new CommandPlugin("stop", playCommandArgs, async (cmd) => {
40736
40825
  const stopOptions = cmd.options;
@@ -40744,7 +40833,6 @@ const stopCommand = new CommandPlugin("stop", playCommandArgs, async (cmd) => {
40744
40833
  } else {
40745
40834
  commandRuntimeError(cmd, `stop option needs to either be in music mode, or if stopping a sound needs to have the sound name supplied as second argument.`);
40746
40835
  }
40747
- return useVM().nextLine();
40748
40836
  });
40749
40837
  const setCommand = new CommandPlugin("set", [
40750
40838
  { name: "key", type: "string" },
@@ -40752,7 +40840,6 @@ const setCommand = new CommandPlugin("set", [
40752
40840
  ], async (cmd) => {
40753
40841
  const state = getModifiableDataPinia();
40754
40842
  setDataHelper(state, cmd.options.key, cmd.options.value);
40755
- return useVM().nextLine();
40756
40843
  });
40757
40844
  const addPlugin = new CommandPlugin("add", [
40758
40845
  { name: "key", type: "string" },
@@ -40760,12 +40847,10 @@ const addPlugin = new CommandPlugin("add", [
40760
40847
  ], async (cmd) => {
40761
40848
  const state = getModifiableDataPinia();
40762
40849
  addDataHelper(state, cmd.options.key, cmd.options.value);
40763
- return useVM().nextLine();
40764
40850
  });
40765
- const setScreenCommand = new CommandPlugin("set_screen", [{ name: "screen", type: "string" }], (cmd) => {
40851
+ const setScreenCommand = new CommandPlugin("set_screen", [{ name: "screen", type: "string" }], async (cmd) => {
40766
40852
  const screens = useScreens();
40767
40853
  screens.setScreen(cmd.options.screen);
40768
- return useVM().nextLine();
40769
40854
  });
40770
40855
  const setButtonCommand = new CommandPlugin("set_button", [
40771
40856
  { name: "buttonId", type: "string" },
@@ -40774,29 +40859,33 @@ const setButtonCommand = new CommandPlugin("set_button", [
40774
40859
  const { buttonId, enabled } = cmd.options;
40775
40860
  const screens = useScreens();
40776
40861
  screens.changeButton(buttonId, enabled);
40777
- return useVM().nextLine();
40778
40862
  });
40779
- const talkCommand = new CommandPlugin("talk", [
40780
- {
40781
- name: "speaker",
40782
- type: "string"
40783
- },
40784
- {
40785
- name: "pose",
40786
- type: "string"
40863
+ const talkCommand = CommandPlugin.FromOptions({
40864
+ keyword: "talk",
40865
+ argTypes: [
40866
+ {
40867
+ name: "speaker",
40868
+ type: "string"
40869
+ },
40870
+ {
40871
+ name: "pose",
40872
+ type: "string"
40873
+ },
40874
+ {
40875
+ name: "text",
40876
+ type: "string"
40877
+ }
40878
+ ],
40879
+ runner: async (cmd, choices) => {
40880
+ await textCommand({
40881
+ speaker: cmd.options.speaker,
40882
+ pose: cmd.options.pose,
40883
+ text: `"${cmd.options.text}"`,
40884
+ choices,
40885
+ interactive: true
40886
+ });
40787
40887
  },
40788
- {
40789
- name: "text",
40790
- type: "string"
40791
- }
40792
- ], async (cmd, choices) => {
40793
- await textCommand({
40794
- speaker: cmd.options.speaker,
40795
- pose: cmd.options.pose,
40796
- text: `"${cmd.options.text}"`,
40797
- choices,
40798
- interactive: true
40799
- });
40888
+ returnAfterPlayerAnswer: true
40800
40889
  });
40801
40890
  const textParser = () => {
40802
40891
  const parser = generateParser("text", []);
@@ -40808,15 +40897,20 @@ const textParser = () => {
40808
40897
  return result;
40809
40898
  };
40810
40899
  };
40811
- const textCommandPlugin = new CommandPlugin("text", [], async (cmd, choices) => {
40812
- await textCommand({
40813
- speaker: "game",
40814
- text: cmd.staticOptions.text,
40815
- choices,
40816
- interactive: true
40817
- });
40818
- }, textParser());
40819
- console.log(textCommandPlugin);
40900
+ const textCommandPlugin = CommandPlugin.FromOptions({
40901
+ keyword: "text",
40902
+ argTypes: [],
40903
+ runner: async (cmd, choices) => {
40904
+ await textCommand({
40905
+ speaker: "game",
40906
+ text: cmd.staticOptions.text,
40907
+ choices,
40908
+ interactive: true
40909
+ });
40910
+ },
40911
+ parser: textParser(),
40912
+ returnAfterPlayerAnswer: true
40913
+ });
40820
40914
  const addItemPlugin = new CommandPlugin("add_item", [
40821
40915
  { name: "id", type: "string" },
40822
40916
  { name: "amount", type: "number" }
@@ -40827,7 +40921,6 @@ const addItemPlugin = new CommandPlugin("add_item", [
40827
40921
  id: id2,
40828
40922
  amount
40829
40923
  });
40830
- return useVM().nextLine();
40831
40924
  });
40832
40925
  const removeItemPlugin = new CommandPlugin("remove_item", [
40833
40926
  { name: "id", type: "string" },
@@ -40839,7 +40932,6 @@ const removeItemPlugin = new CommandPlugin("remove_item", [
40839
40932
  id: id2,
40840
40933
  amount
40841
40934
  });
40842
- return useVM().nextLine();
40843
40935
  });
40844
40936
  const hasItemPlugin = new CommandPlugin("has_item?", [
40845
40937
  { name: "id", type: "string" },
@@ -40858,19 +40950,16 @@ const enableInteractionPlugin = new CommandPlugin("enable_interaction", [{ name:
40858
40950
  const tag = cmd.options.tag;
40859
40951
  const inventory = useInventory();
40860
40952
  inventory.enableInteraction(tag);
40861
- return useVM().nextLine();
40862
40953
  });
40863
40954
  const disableInteractionPlugin = new CommandPlugin("disable_interaction", [{ name: "tag", type: "string" }], async (cmd) => {
40864
40955
  const tag = cmd.options.tag;
40865
40956
  const inventory = useInventory();
40866
40957
  inventory.disableInteraction(tag);
40867
- return useVM().nextLine();
40868
40958
  });
40869
40959
  const startQuestPlugin = new CommandPlugin("start_quest", [{ name: "questId", type: "string" }], async (cmd) => {
40870
40960
  const questId = cmd.options.questId;
40871
40961
  const quests = useQuests();
40872
40962
  quests.startQuest(questId);
40873
- return useVM().nextLine();
40874
40963
  });
40875
40964
  const startObjectivePlugin = new CommandPlugin("start_objective", [
40876
40965
  { name: "questId", type: "string" },
@@ -40879,7 +40968,6 @@ const startObjectivePlugin = new CommandPlugin("start_objective", [
40879
40968
  const { questId, objectiveId } = cmd.options;
40880
40969
  const quests = useQuests();
40881
40970
  quests.startObjective(questId, objectiveId);
40882
- return useVM().nextLine();
40883
40971
  });
40884
40972
  const completeObjectivePlugin = new CommandPlugin("complete_objective", [
40885
40973
  { name: "questId", type: "string" },
@@ -40888,7 +40976,6 @@ const completeObjectivePlugin = new CommandPlugin("complete_objective", [
40888
40976
  const { questId, objectiveId } = cmd.options;
40889
40977
  const quests = useQuests();
40890
40978
  quests.completeObjective(questId, objectiveId);
40891
- return useVM().nextLine();
40892
40979
  });
40893
40980
  const completeQuestPlugin = new CommandPlugin("complete_quest", [
40894
40981
  { name: "questId", type: "string" },
@@ -40897,7 +40984,6 @@ const completeQuestPlugin = new CommandPlugin("complete_quest", [
40897
40984
  const { questId, ending } = cmd.options;
40898
40985
  const quests = useQuests();
40899
40986
  quests.completeQuest(questId, ending);
40900
- return useVM().nextLine();
40901
40987
  });
40902
40988
  const questCompletedPlugin = new CommandPlugin("quest_completed?", [{ name: "questId", type: "string" }], async (cmd) => {
40903
40989
  const { questId } = cmd.options;
@@ -40927,16 +41013,13 @@ const objectiveStartedPlugin = new CommandPlugin("objective_started?", [
40927
41013
  });
40928
41014
  const waitCommand = new CommandPlugin("wait", [{ name: "duration", type: "number" }], async (cmd) => {
40929
41015
  await timeout(cmd.options.duration);
40930
- return useVM().nextLine();
40931
41016
  });
40932
41017
  const notifyPlugin = new CommandPlugin("notify", [{ name: "text", type: "string" }], async (cmd) => {
40933
41018
  const { text } = cmd.options;
40934
41019
  useNotifications().addNotification(text);
40935
- return useVM().nextLine();
40936
41020
  });
40937
41021
  const clearDialogPlugin = new CommandPlugin("clear_dialog", [], async (cmd) => {
40938
41022
  useDialogStore().clearDialog();
40939
- return useVM().nextLine();
40940
41023
  });
40941
41024
  const ifCommand = new CommandPlugin("if", [{ name: "condition", type: "boolean" }], async (cmd) => {
40942
41025
  const newBranch = runConditionCommand(cmd);
@@ -40948,9 +41031,8 @@ const ifCommand = new CommandPlugin("if", [{ name: "condition", type: "boolean"
40948
41031
  },
40949
41032
  currentIndex: 0
40950
41033
  };
40951
- return vmStore.addStack(newStack);
41034
+ return vmStore.addAndRunFrame(newStack);
40952
41035
  }
40953
- return vmStore.nextLine();
40954
41036
  }, (ctx2, parsed) => {
40955
41037
  let newLine = ctx2.currentLine;
40956
41038
  const parser = generateParser("if", [
@@ -41099,7 +41181,6 @@ const divisionPlugin = new CommandPlugin("/", "any", async (cmd) => {
41099
41181
  }, 0);
41100
41182
  });
41101
41183
  const runChoice = async (cmd) => {
41102
- useVM().lastChoiceCommand = cmd;
41103
41184
  const { prompt, choices } = cmd.staticOptions;
41104
41185
  const choiceResults = [];
41105
41186
  for (const [index, choice] of choices.entries()) {
@@ -41107,20 +41188,21 @@ const runChoice = async (cmd) => {
41107
41188
  choiceResults.push(choiceResult);
41108
41189
  }
41109
41190
  cmd.options.choiceResults = choiceResults;
41110
- const dialogChoices = choiceResults.map((res, index) => {
41191
+ const dialogChoices = choiceResults.map((res2, index) => {
41111
41192
  var _a2, _b2;
41112
41193
  let allowed = true;
41113
- if (res.skillCheck) {
41114
- allowed = (_b2 = (_a2 = res.skillCheck) == null ? void 0 : _a2.allowed) != null ? _b2 : false;
41194
+ if (res2.skillCheck) {
41195
+ allowed = (_b2 = (_a2 = res2.skillCheck) == null ? void 0 : _a2.allowed) != null ? _b2 : false;
41115
41196
  }
41116
41197
  const result = {
41117
- choice: res.text,
41198
+ choice: res2.text,
41118
41199
  originalIndex: index,
41119
41200
  allowed
41120
41201
  };
41121
41202
  return result;
41122
41203
  }).filter((el2) => el2.choice);
41123
- runCommand(prompt, dialogChoices);
41204
+ const res = await runCommand(prompt, dialogChoices);
41205
+ await onChoicePlayerAnswered(cmd, res);
41124
41206
  };
41125
41207
  function parseChoiceOption(ctx2, choice, index) {
41126
41208
  choice.expression;
@@ -41177,8 +41259,13 @@ const choiceParser = (ctx2, parsed) => {
41177
41259
  newLine
41178
41260
  };
41179
41261
  };
41180
- const choicePlugin = new CommandPlugin("choice", [], runChoice, choiceParser);
41181
- choicePlugin.onPlayerAnswered = async (command, playerChoice) => {
41262
+ const choicePlugin = CommandPlugin.FromOptions({
41263
+ keyword: "choice",
41264
+ argTypes: [],
41265
+ runner: runChoice,
41266
+ parser: choiceParser
41267
+ });
41268
+ const onChoicePlayerAnswered = async (command, playerChoice) => {
41182
41269
  const choiceIndex = playerChoice;
41183
41270
  const vmStore = useVM();
41184
41271
  const { choices } = command.staticOptions;
@@ -41217,9 +41304,7 @@ choicePlugin.onPlayerAnswered = async (command, playerChoice) => {
41217
41304
  branch: newBranch
41218
41305
  }
41219
41306
  };
41220
- return vmStore.addStack(newStack);
41221
- } else {
41222
- vmStore.nextLine();
41307
+ await vmStore.addAndRunFrame(newStack);
41223
41308
  }
41224
41309
  };
41225
41310
  function getChoiceOptionLineFromChoicePrompt(ctx2, choice) {
@@ -41248,7 +41333,7 @@ const choicePromptCommandPlugin = new CommandPlugin("choicePrompt", "any", async
41248
41333
  };
41249
41334
  }
41250
41335
  const skillCheckFailed = state.happened && !state.succeeded;
41251
- const { difficultyText, allowed } = getSkillCheckText({
41336
+ const { difficultyText } = getSkillCheckText({
41252
41337
  skill: skillId,
41253
41338
  skillCheckId,
41254
41339
  value: difficulty
@@ -41285,10 +41370,11 @@ const choicePromptCommandPlugin = new CommandPlugin("choicePrompt", "any", async
41285
41370
  };
41286
41371
  }
41287
41372
  });
41288
- const textFieldPlugin = new CommandPlugin("text_field", [{ name: "prompt", type: "string" }], async (cmd) => {
41289
- return new Promise((resolve) => {
41290
- useVM().lastChoiceCommand = cmd;
41291
- cmd.options.resolve = resolve;
41373
+ const textFieldPlugin = CommandPlugin.FromOptions({
41374
+ keyword: "text_field",
41375
+ argTypes: [{ name: "prompt", type: "string" }],
41376
+ returnAfterPlayerAnswer: true,
41377
+ runner: async (cmd) => {
41292
41378
  const dialog = {
41293
41379
  speaker: "game",
41294
41380
  text: cmd.options.prompt,
@@ -41296,22 +41382,26 @@ const textFieldPlugin = new CommandPlugin("text_field", [{ name: "prompt", type:
41296
41382
  interactive: true
41297
41383
  };
41298
41384
  useDialogStore().addDialog(dialog);
41299
- });
41385
+ }
41300
41386
  });
41301
41387
  textFieldPlugin.onPlayerAnswered = async (cmd, choice) => {
41302
41388
  if (typeof choice !== "string") {
41303
41389
  commandRuntimeError(cmd, `The player's answer should be a string`);
41304
41390
  }
41305
- cmd.options.resolve(choice);
41391
+ return choice;
41306
41392
  };
41307
- const textFieldPromptPlugin = new CommandPlugin("text_field_prompt", [{ name: "prompt", type: "string" }], async (cmd) => {
41308
- const dialog = {
41309
- speaker: "game",
41310
- text: cmd.options.prompt,
41311
- textField: true,
41312
- interactive: true
41313
- };
41314
- useDialogStore().addDialog(dialog);
41393
+ const textFieldPromptPlugin = CommandPlugin.FromOptions({
41394
+ keyword: "text_field_prompt",
41395
+ argTypes: [{ name: "prompt", type: "string" }],
41396
+ runner: async (cmd) => {
41397
+ const dialog = {
41398
+ speaker: "game",
41399
+ text: cmd.options.prompt,
41400
+ textField: true,
41401
+ interactive: true
41402
+ };
41403
+ useDialogStore().addDialog(dialog);
41404
+ }
41315
41405
  });
41316
41406
  function registerBaseCommands(vm2) {
41317
41407
  vm2.addCommand(choicePlugin);