narrat 2.0.7 → 2.0.9

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.
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);
@@ -37640,7 +37640,8 @@ const useVM = defineStore("vm", {
37640
37640
  lastLabel: "main",
37641
37641
  script: {},
37642
37642
  labelStack: ["main"],
37643
- currentScope: {}
37643
+ currentScope: {},
37644
+ commandsWaitingForPlayerAnswer: []
37644
37645
  }),
37645
37646
  actions: {
37646
37647
  generateSaveData() {
@@ -37657,7 +37658,14 @@ const useVM = defineStore("vm", {
37657
37658
  this.currentScope = {};
37658
37659
  },
37659
37660
  setReturnValue(value) {
37660
- this.currentStack.returnValue = value;
37661
+ this.currentFrame.returnValue = value;
37662
+ },
37663
+ waitForPlayerAnswer(cmd) {
37664
+ this.commandsWaitingForPlayerAnswer.push(cmd);
37665
+ },
37666
+ popAnswerQueue() {
37667
+ const cmd = this.commandsWaitingForPlayerAnswer.pop();
37668
+ return cmd;
37661
37669
  },
37662
37670
  removeFromScope(vars) {
37663
37671
  for (const varName of vars) {
@@ -37666,8 +37674,8 @@ const useVM = defineStore("vm", {
37666
37674
  },
37667
37675
  addScopedVariable(key, value) {
37668
37676
  this.currentScope[key] = value;
37669
- if (this.currentStack) {
37670
- this.currentStack.scope[key] = value;
37677
+ if (this.currentFrame) {
37678
+ this.currentFrame.scope[key] = value;
37671
37679
  }
37672
37680
  },
37673
37681
  extendScope(scope) {
@@ -37762,35 +37770,80 @@ const useVM = defineStore("vm", {
37762
37770
  const dataToModify = getModifiableDataPinia();
37763
37771
  addDataHelper(dataToModify, path, value);
37764
37772
  },
37765
- addStack(newStackOptions) {
37773
+ addFrame(newStackOptions) {
37766
37774
  if (!newStackOptions.label) {
37767
- newStackOptions.label = this.currentStack.label;
37775
+ if (this.currentFrame) {
37776
+ newStackOptions.label = this.currentFrame.label;
37777
+ } else {
37778
+ throw new Error(`Tried to add a new frame but no label was passed and there is no current frame label`);
37779
+ }
37768
37780
  }
37769
37781
  const newStack = this.stackOptionsToStack(newStackOptions);
37770
37782
  this.stack.push(newStack);
37771
- return this.runLine();
37783
+ },
37784
+ async addAndRunFrame(newStackOptions) {
37785
+ await this.addFrame(newStackOptions);
37786
+ await this.runFrame();
37787
+ },
37788
+ async runFrame() {
37789
+ const frame = this.currentFrame;
37790
+ if (!frame) {
37791
+ throw new Error(`Tried to run a frame but there is no current frame`);
37792
+ }
37793
+ frame.currentIndex = 0;
37794
+ while (this.currentLine) {
37795
+ await this.runLineOnly();
37796
+ frame.currentIndex++;
37797
+ }
37798
+ const previousScope = frame.scope;
37799
+ this.removeFromScope(Object.keys(previousScope));
37800
+ const { returnValue, onComplete } = frame;
37801
+ this.stack.splice(this.stack.length - 1, 1);
37802
+ if (onComplete) {
37803
+ onComplete(returnValue);
37804
+ }
37805
+ },
37806
+ async runGame() {
37807
+ await this.runFrame();
37808
+ if (this.stack.length === 0) {
37809
+ this.reachedEndOfScript();
37810
+ }
37811
+ },
37812
+ async nextLineOnly() {
37813
+ if (this.stack.length === 0) {
37814
+ return false;
37815
+ }
37816
+ if (this.currentFrame && this.currentFrame.currentIndex < this.currentFrame.branchData.branch.length - 1) {
37817
+ this.currentFrame.currentIndex++;
37818
+ return true;
37819
+ } else {
37820
+ return false;
37821
+ }
37772
37822
  },
37773
37823
  async nextLine() {
37774
37824
  if (this.stack.length === 0) {
37775
- this.finishGame();
37825
+ this.reachedEndOfScript();
37776
37826
  return;
37777
37827
  }
37778
- if (this.currentStack.currentIndex < this.currentStack.branchData.branch.length - 1) {
37779
- this.currentStack.currentIndex++;
37828
+ if (this.currentFrame && this.currentFrame.currentIndex < this.currentFrame.branchData.branch.length - 1) {
37829
+ this.currentFrame.currentIndex++;
37780
37830
  } else {
37781
- return this.previousStack();
37831
+ return this.previousFrame();
37782
37832
  }
37783
37833
  if (this.stack.length === 0) {
37784
- this.finishGame();
37834
+ this.reachedEndOfScript();
37785
37835
  } else {
37786
37836
  return this.runLine();
37787
37837
  }
37788
- this.currentStack.currentIndex++;
37838
+ this.currentFrame.currentIndex++;
37789
37839
  },
37790
- async previousStack() {
37791
- const previousScope = this.currentStack.scope;
37840
+ async previousFrame() {
37841
+ if (!this.currentFrame) {
37842
+ throw new Error(`Tried to go back to previous frame but there is no current frame`);
37843
+ }
37844
+ const previousScope = this.currentFrame.scope;
37792
37845
  this.removeFromScope(Object.keys(previousScope));
37793
- const { returnValue, onComplete } = this.currentStack;
37846
+ const { returnValue, onComplete } = this.currentFrame;
37794
37847
  this.stack.splice(this.stack.length - 1, 1);
37795
37848
  if (onComplete) {
37796
37849
  onComplete(returnValue);
@@ -37798,7 +37851,7 @@ const useVM = defineStore("vm", {
37798
37851
  return this.nextLine();
37799
37852
  }
37800
37853
  },
37801
- finishGame() {
37854
+ reachedEndOfScript() {
37802
37855
  useInventory().onScriptEnd();
37803
37856
  const mainStore = useMain();
37804
37857
  if (mainStore.options.debug) {
@@ -37809,7 +37862,7 @@ const useVM = defineStore("vm", {
37809
37862
  });
37810
37863
  }
37811
37864
  },
37812
- async runLine() {
37865
+ async runLineOnly() {
37813
37866
  const expression = this.currentLine;
37814
37867
  if (!expression) {
37815
37868
  error(`There is no line of script to run.`);
@@ -37818,6 +37871,10 @@ const useVM = defineStore("vm", {
37818
37871
  useInventory().onScriptStart();
37819
37872
  await runCommand(expression);
37820
37873
  },
37874
+ async runLine() {
37875
+ await this.runLineOnly();
37876
+ this.nextLine();
37877
+ },
37821
37878
  runLabelFunction(label, ...args) {
37822
37879
  return new Promise((resolve, reject) => {
37823
37880
  const branchData = this.script[label];
@@ -37833,11 +37890,11 @@ const useVM = defineStore("vm", {
37833
37890
  resolve(returnValue);
37834
37891
  }
37835
37892
  };
37836
- this.addStack(stack);
37893
+ this.addAndRunFrame(stack);
37837
37894
  });
37838
37895
  },
37839
- runCustomStack(stack) {
37840
- this.addStack(stack);
37896
+ runCustomFrame(stack) {
37897
+ this.addAndRunFrame(stack);
37841
37898
  },
37842
37899
  runLabel(label, ...args) {
37843
37900
  const branchData = this.script[label];
@@ -37851,18 +37908,23 @@ const useVM = defineStore("vm", {
37851
37908
  args,
37852
37909
  label
37853
37910
  });
37854
- this.runLine();
37911
+ this.runGame();
37855
37912
  }
37856
37913
  },
37857
37914
  getters: {
37858
- currentStack(state) {
37915
+ currentFrame(state) {
37859
37916
  const result = state.stack[state.stack.length - 1];
37860
37917
  return result;
37861
37918
  },
37862
37919
  currentLine() {
37863
- const currentStack = this.currentStack;
37864
- if (this.currentStack) {
37865
- return currentStack.branchData.branch[currentStack.currentIndex];
37920
+ const currentFrame = this.currentFrame;
37921
+ if (this.currentFrame && currentFrame.branchData.branch.length > currentFrame.currentIndex) {
37922
+ return currentFrame.branchData.branch[currentFrame.currentIndex];
37923
+ }
37924
+ },
37925
+ commandWaitingForAnswer() {
37926
+ if (this.commandsWaitingForPlayerAnswer.length > 0) {
37927
+ return this.commandsWaitingForPlayerAnswer[0];
37866
37928
  }
37867
37929
  }
37868
37930
  }
@@ -38086,7 +38148,7 @@ async function runCommand(expression, choices) {
38086
38148
  error(`Narrat script runtime error at <span class="error-filename">${expression.fileName}:${expression.line + 1}</span>
38087
38149
  <b>${err}</b>
38088
38150
  Script: ${expression.code}
38089
- Label: ${vmStore.currentStack.label}`);
38151
+ Label: ${vmStore.currentFrame.label}`);
38090
38152
  }
38091
38153
  }
38092
38154
  async function generateCommand(expr, choices) {
@@ -38144,7 +38206,7 @@ async function runExpression(expr, choices) {
38144
38206
  const command = await generateCommand(expr, choices);
38145
38207
  const commandPlugin = vm.commands[command.commandType];
38146
38208
  if (commandPlugin) {
38147
- const result = await commandPlugin.runner(command, choices);
38209
+ const result = await commandPlugin.run(command, choices);
38148
38210
  return result;
38149
38211
  } else {
38150
38212
  throw new Error(`${command.commandType} is not a valid command`);
@@ -38153,17 +38215,15 @@ async function runExpression(expr, choices) {
38153
38215
  async function playerAnswered(choice) {
38154
38216
  audioEvent("onPlayerAnswered");
38155
38217
  const vmStore = useVM();
38156
- const command = vmStore.lastChoiceCommand;
38157
- vmStore.lastChoiceCommand = void 0;
38218
+ const command = vmStore.popAnswerQueue();
38158
38219
  const currentLine = vmStore.currentLine;
38159
38220
  try {
38160
38221
  if (command) {
38161
38222
  const commandPlugin = vm.commands[command.commandType];
38162
- if (commandPlugin && commandPlugin.onPlayerAnswered) {
38163
- return await commandPlugin.onPlayerAnswered(command, choice);
38223
+ if (commandPlugin) {
38224
+ return await commandPlugin.processPlayerAnswer(command, choice);
38164
38225
  }
38165
38226
  }
38166
- return await vmStore.nextLine();
38167
38227
  } catch (err) {
38168
38228
  console.error(err);
38169
38229
  error(`Error after player answer at ${currentLine.fileName}:${currentLine.line + 1} (${currentLine.code}<br /> - Error: ${err}`);
@@ -38241,7 +38301,7 @@ const useMain = defineStore("main", {
38241
38301
  },
38242
38302
  async startGame() {
38243
38303
  this.startMachine();
38244
- await useVM().runLine();
38304
+ await useVM().runGame();
38245
38305
  await this.saveGame();
38246
38306
  },
38247
38307
  async loadGame(saveFile) {
@@ -39801,6 +39861,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
39801
39861
  const stack = computed(() => vmStore.stack);
39802
39862
  const dialogStore = useDialogStore();
39803
39863
  const dialog = computed(() => dialogStore.dialog);
39864
+ const dialogRef = ref(null);
39804
39865
  const dialogContainerStyle = computed(() => {
39805
39866
  if (props.layoutMode === "vertical") {
39806
39867
  return {};
@@ -39866,6 +39927,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
39866
39927
  const result = i2 === dialogStore.dialog.length - 1 && stack.value.length > 0;
39867
39928
  return result;
39868
39929
  }
39930
+ watch(dialog.value, (newValue) => {
39931
+ if (dialogRef.value) {
39932
+ const dialog2 = dialogRef.value;
39933
+ dialog2.scrollTop = dialog2.scrollHeight + 1e8;
39934
+ }
39935
+ });
39869
39936
  return (_ctx, _cache) => {
39870
39937
  return openBlock(), createElementBlock(Fragment, null, [
39871
39938
  createVNode(Transition, { name: "fade" }, {
@@ -39880,8 +39947,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
39880
39947
  __props.inGame ? (openBlock(), createElementBlock("div", {
39881
39948
  key: 0,
39882
39949
  class: "dialog override",
39883
- ref_key: "dialog",
39884
- ref: dialog,
39950
+ ref_key: "dialogRef",
39951
+ ref: dialogRef,
39885
39952
  style: normalizeStyle(unref(dialogStyle))
39886
39953
  }, [
39887
39954
  createVNode(TransitionGroup, {
@@ -40223,14 +40290,6 @@ const _sfc_main = defineComponent({
40223
40290
  this.updateScreenSize();
40224
40291
  }, 50);
40225
40292
  },
40226
- watch: {
40227
- dialogLength(newCount, oldCount) {
40228
- if (this.$refs.dialog) {
40229
- const dialog = this.$refs.dialog;
40230
- dialog.scrollTop = dialog.scrollHeight + 1e8;
40231
- }
40232
- }
40233
- },
40234
40293
  computed: {
40235
40294
  ...mapState(useRenderingStore, [
40236
40295
  "screenWidth",
@@ -40242,21 +40301,6 @@ const _sfc_main = defineComponent({
40242
40301
  "layoutMode"
40243
40302
  ]),
40244
40303
  ...mapState(useVM, ["currentLine"]),
40245
- dialogLength() {
40246
- return this.dialog.length;
40247
- },
40248
- lastDialog() {
40249
- if (this.dialog.length > 0) {
40250
- return this.dialog[this.dialog.length - 1];
40251
- }
40252
- return void 0;
40253
- },
40254
- picture() {
40255
- if (this.lastDialog) {
40256
- return getCharacterPictureUrl(this.lastDialog.speaker, this.lastDialog.pose);
40257
- }
40258
- return void 0;
40259
- },
40260
40304
  backgroundStyle() {
40261
40305
  let height;
40262
40306
  if (this.layoutMode === "vertical") {
@@ -40287,23 +40331,6 @@ const _sfc_main = defineComponent({
40287
40331
  left: this.leftOffset
40288
40332
  };
40289
40333
  },
40290
- dialogWidth() {
40291
- const width = getConfig().layout.minTextWidth;
40292
- this.mq;
40293
- return width;
40294
- },
40295
- dialogStyle() {
40296
- let transform;
40297
- const height = "100%";
40298
- if (this.layoutMode === "horizontal")
40299
- ;
40300
- return {
40301
- width: this.layoutMode === "horizontal" ? `${this.dialogWidth}px` : "100%",
40302
- height,
40303
- transform,
40304
- transformOrigin: "right"
40305
- };
40306
- },
40307
40334
  gameWidth() {
40308
40335
  const config2 = getConfig();
40309
40336
  if (this.layoutMode === "vertical") {
@@ -40346,15 +40373,6 @@ const _sfc_main = defineComponent({
40346
40373
  const baseWidth = config2.layout.minTextWidth + config2.layout.backgrounds.width;
40347
40374
  const widthRatio = this.screenWidth / baseWidth;
40348
40375
  return widthRatio;
40349
- },
40350
- dialogContainerStyle() {
40351
- if (this.layoutMode === "vertical") {
40352
- return {};
40353
- } else {
40354
- return {
40355
- paddingBottom: `${getConfig().layout.dialogBottomPadding}px`
40356
- };
40357
- }
40358
40376
  }
40359
40377
  },
40360
40378
  methods: {
@@ -40374,10 +40392,6 @@ const _sfc_main = defineComponent({
40374
40392
  audioEvent("onPressStart");
40375
40393
  useMain().loadGame(this.getSaveFile());
40376
40394
  },
40377
- isDialogActive(i2) {
40378
- const result = i2 === this.dialog.length - 1 && this.stack.length > 0;
40379
- return result;
40380
- },
40381
40395
  nextLine() {
40382
40396
  useVM().nextLine();
40383
40397
  },
@@ -40386,29 +40400,6 @@ const _sfc_main = defineComponent({
40386
40400
  },
40387
40401
  closeModal() {
40388
40402
  useMain().closeModal();
40389
- },
40390
- getDialogBoxOptions(dialogKey, index) {
40391
- const info = getCharacterInfo(dialogKey.speaker);
40392
- let title = info.name;
40393
- if (index >= 1) {
40394
- const previousDialog = this.dialog[index - 1];
40395
- if (previousDialog.speaker === dialogKey.speaker) {
40396
- title = void 0;
40397
- }
40398
- }
40399
- if (dialogKey.choices) {
40400
- dialogKey.choices.forEach((choice) => {
40401
- choice.choice = processText(choice.choice);
40402
- });
40403
- }
40404
- return {
40405
- title: title != null ? title : "",
40406
- text: dialogKey.text,
40407
- styleId: dialogKey.speaker,
40408
- choices: dialogKey.choices,
40409
- old: index < this.dialog.length - 1,
40410
- interactive: dialogKey.interactive
40411
- };
40412
40403
  }
40413
40404
  }
40414
40405
  });
@@ -40608,6 +40599,7 @@ class CommandPlugin {
40608
40599
  __publicField(this, "argTypes");
40609
40600
  __publicField(this, "parser");
40610
40601
  __publicField(this, "onPlayerAnswered");
40602
+ __publicField(this, "returnAfterPlayerAnswer");
40611
40603
  this.keyword = keyword;
40612
40604
  this.runner = runner;
40613
40605
  this.argTypes = argTypes;
@@ -40616,6 +40608,34 @@ class CommandPlugin {
40616
40608
  } else {
40617
40609
  this.parser = parser;
40618
40610
  }
40611
+ this.returnAfterPlayerAnswer = false;
40612
+ }
40613
+ async run(cmd, choices) {
40614
+ let res = await this.runner(cmd, choices);
40615
+ if (this.returnAfterPlayerAnswer) {
40616
+ res = await new Promise((resolve, reject) => {
40617
+ useVM().waitForPlayerAnswer(cmd);
40618
+ cmd.finishCommand = resolve;
40619
+ });
40620
+ }
40621
+ return res;
40622
+ }
40623
+ async processPlayerAnswer(cmd, choice) {
40624
+ let res = choice;
40625
+ if (this.onPlayerAnswered) {
40626
+ res = await this.onPlayerAnswered(cmd, choice);
40627
+ }
40628
+ if (this.returnAfterPlayerAnswer && cmd.finishCommand) {
40629
+ cmd.finishCommand(res);
40630
+ }
40631
+ return res;
40632
+ }
40633
+ static FromOptions(options) {
40634
+ var _a2;
40635
+ const plugin = new CommandPlugin(options.keyword, options.argTypes, options.runner, options.parser);
40636
+ plugin.onPlayerAnswered = options.onPlayerAnswered;
40637
+ plugin.returnAfterPlayerAnswer = (_a2 = options.returnAfterPlayerAnswer) != null ? _a2 : false;
40638
+ return plugin;
40619
40639
  }
40620
40640
  }
40621
40641
  function generateParser(keyword, argTypes) {
@@ -40676,7 +40696,6 @@ const addLevelPlugin = new CommandPlugin("add_level", [
40676
40696
  commandRuntimeError(cmd, `add_level command needs a skill id and a value as parameters`);
40677
40697
  }
40678
40698
  useSkills().incrementSkill(skillKey, amount);
40679
- return useVM().nextLine();
40680
40699
  });
40681
40700
  const addXpPlugin = new CommandPlugin("add_xp", [
40682
40701
  { name: "xpKey", type: "string" },
@@ -40687,7 +40706,6 @@ const addXpPlugin = new CommandPlugin("add_xp", [
40687
40706
  commandRuntimeError(cmd, `add_xp command needs a skill id and a value as parameters`);
40688
40707
  }
40689
40708
  useSkills().addXp(xpKey, xpToAdd);
40690
- return useVM().nextLine();
40691
40709
  });
40692
40710
  const rollPlugin = new CommandPlugin("roll", [
40693
40711
  { name: "id", type: "string" },
@@ -40710,24 +40728,22 @@ const addStatPlugin = new CommandPlugin("add_stat", [
40710
40728
  { name: "amountToAdd", type: "number" }
40711
40729
  ], async (cmd) => {
40712
40730
  const { statKey, amountToAdd } = cmd.options;
40713
- if (!statKey || !amountToAdd) {
40731
+ if (!statKey || typeof amountToAdd !== "number") {
40714
40732
  commandRuntimeError(cmd, `add_stat command needs a stat id and a value as parameters`);
40715
40733
  }
40716
40734
  const hud = useHud();
40717
40735
  hud.addStat(statKey, amountToAdd);
40718
- return useVM().nextLine();
40719
40736
  });
40720
40737
  const setStatPlugin = new CommandPlugin("set_stat", [
40721
40738
  { name: "statKey", type: "string" },
40722
40739
  { name: "value", type: "number" }
40723
40740
  ], async (cmd) => {
40724
40741
  const { statKey, value } = cmd.options;
40725
- if (!statKey || !value) {
40742
+ if (!statKey || typeof value !== "number") {
40726
40743
  commandRuntimeError(cmd, `set_stat command needs a stat id and a value as parameters`);
40727
40744
  }
40728
40745
  const hud = useHud();
40729
40746
  hud.setStat(statKey, value);
40730
- return useVM().nextLine();
40731
40747
  });
40732
40748
  const getStatPlugin = new CommandPlugin("get_stat_value", [{ name: "statKey", type: "string" }], async (cmd) => {
40733
40749
  const { statKey } = cmd.options;
@@ -40737,42 +40753,56 @@ const getStatPlugin = new CommandPlugin("get_stat_value", [{ name: "statKey", ty
40737
40753
  const hud = useHud();
40738
40754
  return hud.getStatValue(statKey);
40739
40755
  });
40740
- const jumpCommand = new CommandPlugin("jump", "any", async (cmd) => {
40741
- if (cmd.args.length < 1 || typeof cmd.args[0] !== "string") {
40742
- commandRuntimeError(cmd, `requires a label argument`);
40756
+ const jumpCommand = CommandPlugin.FromOptions({
40757
+ keyword: "jump",
40758
+ argTypes: "any",
40759
+ runner: async (cmd) => {
40760
+ if (cmd.args.length < 1 || typeof cmd.args[0] !== "string") {
40761
+ commandRuntimeError(cmd, `requires a label argument`);
40762
+ }
40763
+ const label = cmd.args[0];
40764
+ const vm2 = useVM();
40765
+ const newStack = {
40766
+ branchData: vm2.script[label],
40767
+ label,
40768
+ args: cmd.args.splice(1),
40769
+ currentIndex: 0
40770
+ };
40771
+ vm2.setStack(newStack);
40772
+ await useMain().saveGame();
40773
+ await vm2.runFrame();
40743
40774
  }
40744
- const label = cmd.args[0];
40745
- const vm2 = useVM();
40746
- const newStack = {
40747
- branchData: vm2.script[label],
40748
- label,
40749
- args: cmd.args.splice(1),
40750
- currentIndex: 0
40751
- };
40752
- vm2.setStack(newStack);
40753
- await useMain().saveGame();
40754
- await vm2.runLine();
40755
40775
  });
40756
- const runLabelPlugin = new CommandPlugin("run", "any", async (cmd) => {
40757
- if (cmd.args.length < 1 || typeof cmd.args[0] !== "string") {
40758
- commandRuntimeError(cmd, `run command needs a label to argument run`);
40776
+ const runLabelPlugin = CommandPlugin.FromOptions({
40777
+ keyword: "run",
40778
+ argTypes: "any",
40779
+ runner: async (cmd) => {
40780
+ if (cmd.args.length < 1 || typeof cmd.args[0] !== "string") {
40781
+ commandRuntimeError(cmd, `run command needs a label to argument run`);
40782
+ }
40783
+ const label = cmd.args[0];
40784
+ const res = await useVM().runLabelFunction(label, ...cmd.args.slice(1));
40785
+ return res;
40759
40786
  }
40760
- const label = cmd.args[0];
40761
- const res = await useVM().runLabelFunction(label, ...cmd.args.slice(1));
40762
- return res;
40763
40787
  });
40764
- const defineVariablePlugin = new CommandPlugin("var", [
40765
- { name: "name", type: "string" },
40766
- { name: "value", type: "any" }
40767
- ], async (cmd) => {
40768
- const { name, value } = cmd.options;
40769
- useVM().addScopedVariable(name, value);
40770
- return useVM().nextLine();
40788
+ const defineVariablePlugin = CommandPlugin.FromOptions({
40789
+ keyword: "var",
40790
+ argTypes: [
40791
+ { name: "name", type: "string" },
40792
+ { name: "value", type: "any" }
40793
+ ],
40794
+ runner: async (cmd) => {
40795
+ const { name, value } = cmd.options;
40796
+ useVM().addScopedVariable(name, value);
40797
+ }
40771
40798
  });
40772
- const returnPlugin = new CommandPlugin("return", [{ name: "value", type: "any" }], async (cmd) => {
40773
- const { value } = cmd.options;
40774
- useVM().setReturnValue(value);
40775
- return useVM().nextLine();
40799
+ const returnPlugin = CommandPlugin.FromOptions({
40800
+ keyword: "return",
40801
+ argTypes: [{ name: "value", type: "any" }],
40802
+ runner: async (cmd) => {
40803
+ const { value } = cmd.options;
40804
+ useVM().setReturnValue(value);
40805
+ }
40776
40806
  });
40777
40807
  const playCommandArgs = [
40778
40808
  { name: "mode", type: "string" },
@@ -40785,7 +40815,6 @@ const playCommand = new CommandPlugin("play", playCommandArgs, async (cmd) => {
40785
40815
  } else {
40786
40816
  playAudio(playOptions.audio);
40787
40817
  }
40788
- useVM().nextLine();
40789
40818
  });
40790
40819
  const pauseCommand = new CommandPlugin("pause", playCommandArgs, async (cmd) => {
40791
40820
  const pauseOptions = cmd.options;
@@ -40799,7 +40828,6 @@ const pauseCommand = new CommandPlugin("pause", playCommandArgs, async (cmd) =>
40799
40828
  } else {
40800
40829
  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.`);
40801
40830
  }
40802
- return useVM().nextLine();
40803
40831
  });
40804
40832
  const stopCommand = new CommandPlugin("stop", playCommandArgs, async (cmd) => {
40805
40833
  const stopOptions = cmd.options;
@@ -40813,7 +40841,6 @@ const stopCommand = new CommandPlugin("stop", playCommandArgs, async (cmd) => {
40813
40841
  } else {
40814
40842
  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.`);
40815
40843
  }
40816
- return useVM().nextLine();
40817
40844
  });
40818
40845
  const setCommand = new CommandPlugin("set", [
40819
40846
  { name: "key", type: "string" },
@@ -40821,7 +40848,6 @@ const setCommand = new CommandPlugin("set", [
40821
40848
  ], async (cmd) => {
40822
40849
  const state = getModifiableDataPinia();
40823
40850
  setDataHelper(state, cmd.options.key, cmd.options.value);
40824
- return useVM().nextLine();
40825
40851
  });
40826
40852
  const addPlugin = new CommandPlugin("add", [
40827
40853
  { name: "key", type: "string" },
@@ -40829,12 +40855,10 @@ const addPlugin = new CommandPlugin("add", [
40829
40855
  ], async (cmd) => {
40830
40856
  const state = getModifiableDataPinia();
40831
40857
  addDataHelper(state, cmd.options.key, cmd.options.value);
40832
- return useVM().nextLine();
40833
40858
  });
40834
- const setScreenCommand = new CommandPlugin("set_screen", [{ name: "screen", type: "string" }], (cmd) => {
40859
+ const setScreenCommand = new CommandPlugin("set_screen", [{ name: "screen", type: "string" }], async (cmd) => {
40835
40860
  const screens = useScreens();
40836
40861
  screens.setScreen(cmd.options.screen);
40837
- return useVM().nextLine();
40838
40862
  });
40839
40863
  const setButtonCommand = new CommandPlugin("set_button", [
40840
40864
  { name: "buttonId", type: "string" },
@@ -40843,29 +40867,33 @@ const setButtonCommand = new CommandPlugin("set_button", [
40843
40867
  const { buttonId, enabled } = cmd.options;
40844
40868
  const screens = useScreens();
40845
40869
  screens.changeButton(buttonId, enabled);
40846
- return useVM().nextLine();
40847
40870
  });
40848
- const talkCommand = new CommandPlugin("talk", [
40849
- {
40850
- name: "speaker",
40851
- type: "string"
40852
- },
40853
- {
40854
- name: "pose",
40855
- type: "string"
40871
+ const talkCommand = CommandPlugin.FromOptions({
40872
+ keyword: "talk",
40873
+ argTypes: [
40874
+ {
40875
+ name: "speaker",
40876
+ type: "string"
40877
+ },
40878
+ {
40879
+ name: "pose",
40880
+ type: "string"
40881
+ },
40882
+ {
40883
+ name: "text",
40884
+ type: "string"
40885
+ }
40886
+ ],
40887
+ runner: async (cmd, choices) => {
40888
+ await textCommand({
40889
+ speaker: cmd.options.speaker,
40890
+ pose: cmd.options.pose,
40891
+ text: `"${cmd.options.text}"`,
40892
+ choices,
40893
+ interactive: true
40894
+ });
40856
40895
  },
40857
- {
40858
- name: "text",
40859
- type: "string"
40860
- }
40861
- ], async (cmd, choices) => {
40862
- await textCommand({
40863
- speaker: cmd.options.speaker,
40864
- pose: cmd.options.pose,
40865
- text: `"${cmd.options.text}"`,
40866
- choices,
40867
- interactive: true
40868
- });
40896
+ returnAfterPlayerAnswer: true
40869
40897
  });
40870
40898
  const textParser = () => {
40871
40899
  const parser = generateParser("text", []);
@@ -40877,15 +40905,20 @@ const textParser = () => {
40877
40905
  return result;
40878
40906
  };
40879
40907
  };
40880
- const textCommandPlugin = new CommandPlugin("text", [], async (cmd, choices) => {
40881
- await textCommand({
40882
- speaker: "game",
40883
- text: cmd.staticOptions.text,
40884
- choices,
40885
- interactive: true
40886
- });
40887
- }, textParser());
40888
- console.log(textCommandPlugin);
40908
+ const textCommandPlugin = CommandPlugin.FromOptions({
40909
+ keyword: "text",
40910
+ argTypes: [],
40911
+ runner: async (cmd, choices) => {
40912
+ await textCommand({
40913
+ speaker: "game",
40914
+ text: cmd.staticOptions.text,
40915
+ choices,
40916
+ interactive: true
40917
+ });
40918
+ },
40919
+ parser: textParser(),
40920
+ returnAfterPlayerAnswer: true
40921
+ });
40889
40922
  const addItemPlugin = new CommandPlugin("add_item", [
40890
40923
  { name: "id", type: "string" },
40891
40924
  { name: "amount", type: "number" }
@@ -40896,7 +40929,6 @@ const addItemPlugin = new CommandPlugin("add_item", [
40896
40929
  id: id2,
40897
40930
  amount
40898
40931
  });
40899
- return useVM().nextLine();
40900
40932
  });
40901
40933
  const removeItemPlugin = new CommandPlugin("remove_item", [
40902
40934
  { name: "id", type: "string" },
@@ -40908,7 +40940,6 @@ const removeItemPlugin = new CommandPlugin("remove_item", [
40908
40940
  id: id2,
40909
40941
  amount
40910
40942
  });
40911
- return useVM().nextLine();
40912
40943
  });
40913
40944
  const hasItemPlugin = new CommandPlugin("has_item?", [
40914
40945
  { name: "id", type: "string" },
@@ -40927,19 +40958,16 @@ const enableInteractionPlugin = new CommandPlugin("enable_interaction", [{ name:
40927
40958
  const tag = cmd.options.tag;
40928
40959
  const inventory = useInventory();
40929
40960
  inventory.enableInteraction(tag);
40930
- return useVM().nextLine();
40931
40961
  });
40932
40962
  const disableInteractionPlugin = new CommandPlugin("disable_interaction", [{ name: "tag", type: "string" }], async (cmd) => {
40933
40963
  const tag = cmd.options.tag;
40934
40964
  const inventory = useInventory();
40935
40965
  inventory.disableInteraction(tag);
40936
- return useVM().nextLine();
40937
40966
  });
40938
40967
  const startQuestPlugin = new CommandPlugin("start_quest", [{ name: "questId", type: "string" }], async (cmd) => {
40939
40968
  const questId = cmd.options.questId;
40940
40969
  const quests = useQuests();
40941
40970
  quests.startQuest(questId);
40942
- return useVM().nextLine();
40943
40971
  });
40944
40972
  const startObjectivePlugin = new CommandPlugin("start_objective", [
40945
40973
  { name: "questId", type: "string" },
@@ -40948,7 +40976,6 @@ const startObjectivePlugin = new CommandPlugin("start_objective", [
40948
40976
  const { questId, objectiveId } = cmd.options;
40949
40977
  const quests = useQuests();
40950
40978
  quests.startObjective(questId, objectiveId);
40951
- return useVM().nextLine();
40952
40979
  });
40953
40980
  const completeObjectivePlugin = new CommandPlugin("complete_objective", [
40954
40981
  { name: "questId", type: "string" },
@@ -40957,7 +40984,6 @@ const completeObjectivePlugin = new CommandPlugin("complete_objective", [
40957
40984
  const { questId, objectiveId } = cmd.options;
40958
40985
  const quests = useQuests();
40959
40986
  quests.completeObjective(questId, objectiveId);
40960
- return useVM().nextLine();
40961
40987
  });
40962
40988
  const completeQuestPlugin = new CommandPlugin("complete_quest", [
40963
40989
  { name: "questId", type: "string" },
@@ -40966,7 +40992,6 @@ const completeQuestPlugin = new CommandPlugin("complete_quest", [
40966
40992
  const { questId, ending } = cmd.options;
40967
40993
  const quests = useQuests();
40968
40994
  quests.completeQuest(questId, ending);
40969
- return useVM().nextLine();
40970
40995
  });
40971
40996
  const questCompletedPlugin = new CommandPlugin("quest_completed?", [{ name: "questId", type: "string" }], async (cmd) => {
40972
40997
  const { questId } = cmd.options;
@@ -40996,16 +41021,13 @@ const objectiveStartedPlugin = new CommandPlugin("objective_started?", [
40996
41021
  });
40997
41022
  const waitCommand = new CommandPlugin("wait", [{ name: "duration", type: "number" }], async (cmd) => {
40998
41023
  await timeout(cmd.options.duration);
40999
- return useVM().nextLine();
41000
41024
  });
41001
41025
  const notifyPlugin = new CommandPlugin("notify", [{ name: "text", type: "string" }], async (cmd) => {
41002
41026
  const { text } = cmd.options;
41003
41027
  useNotifications().addNotification(text);
41004
- return useVM().nextLine();
41005
41028
  });
41006
41029
  const clearDialogPlugin = new CommandPlugin("clear_dialog", [], async (cmd) => {
41007
41030
  useDialogStore().clearDialog();
41008
- return useVM().nextLine();
41009
41031
  });
41010
41032
  const ifCommand = new CommandPlugin("if", [{ name: "condition", type: "boolean" }], async (cmd) => {
41011
41033
  const newBranch = runConditionCommand(cmd);
@@ -41017,9 +41039,8 @@ const ifCommand = new CommandPlugin("if", [{ name: "condition", type: "boolean"
41017
41039
  },
41018
41040
  currentIndex: 0
41019
41041
  };
41020
- return vmStore.addStack(newStack);
41042
+ return vmStore.addAndRunFrame(newStack);
41021
41043
  }
41022
- return vmStore.nextLine();
41023
41044
  }, (ctx2, parsed) => {
41024
41045
  let newLine = ctx2.currentLine;
41025
41046
  const parser = generateParser("if", [
@@ -41168,7 +41189,6 @@ const divisionPlugin = new CommandPlugin("/", "any", async (cmd) => {
41168
41189
  }, 0);
41169
41190
  });
41170
41191
  const runChoice = async (cmd) => {
41171
- useVM().lastChoiceCommand = cmd;
41172
41192
  const { prompt, choices } = cmd.staticOptions;
41173
41193
  const choiceResults = [];
41174
41194
  for (const [index, choice] of choices.entries()) {
@@ -41176,20 +41196,21 @@ const runChoice = async (cmd) => {
41176
41196
  choiceResults.push(choiceResult);
41177
41197
  }
41178
41198
  cmd.options.choiceResults = choiceResults;
41179
- const dialogChoices = choiceResults.map((res, index) => {
41199
+ const dialogChoices = choiceResults.map((res2, index) => {
41180
41200
  var _a2, _b2;
41181
41201
  let allowed = true;
41182
- if (res.skillCheck) {
41183
- allowed = (_b2 = (_a2 = res.skillCheck) == null ? void 0 : _a2.allowed) != null ? _b2 : false;
41202
+ if (res2.skillCheck) {
41203
+ allowed = (_b2 = (_a2 = res2.skillCheck) == null ? void 0 : _a2.allowed) != null ? _b2 : false;
41184
41204
  }
41185
41205
  const result = {
41186
- choice: res.text,
41206
+ choice: res2.text,
41187
41207
  originalIndex: index,
41188
41208
  allowed
41189
41209
  };
41190
41210
  return result;
41191
41211
  }).filter((el2) => el2.choice);
41192
- runCommand(prompt, dialogChoices);
41212
+ const res = await runCommand(prompt, dialogChoices);
41213
+ await onChoicePlayerAnswered(cmd, res);
41193
41214
  };
41194
41215
  function parseChoiceOption(ctx2, choice, index) {
41195
41216
  choice.expression;
@@ -41246,8 +41267,13 @@ const choiceParser = (ctx2, parsed) => {
41246
41267
  newLine
41247
41268
  };
41248
41269
  };
41249
- const choicePlugin = new CommandPlugin("choice", [], runChoice, choiceParser);
41250
- choicePlugin.onPlayerAnswered = async (command, playerChoice) => {
41270
+ const choicePlugin = CommandPlugin.FromOptions({
41271
+ keyword: "choice",
41272
+ argTypes: [],
41273
+ runner: runChoice,
41274
+ parser: choiceParser
41275
+ });
41276
+ const onChoicePlayerAnswered = async (command, playerChoice) => {
41251
41277
  const choiceIndex = playerChoice;
41252
41278
  const vmStore = useVM();
41253
41279
  const { choices } = command.staticOptions;
@@ -41286,9 +41312,7 @@ choicePlugin.onPlayerAnswered = async (command, playerChoice) => {
41286
41312
  branch: newBranch
41287
41313
  }
41288
41314
  };
41289
- return vmStore.addStack(newStack);
41290
- } else {
41291
- vmStore.nextLine();
41315
+ await vmStore.addAndRunFrame(newStack);
41292
41316
  }
41293
41317
  };
41294
41318
  function getChoiceOptionLineFromChoicePrompt(ctx2, choice) {
@@ -41317,7 +41341,7 @@ const choicePromptCommandPlugin = new CommandPlugin("choicePrompt", "any", async
41317
41341
  };
41318
41342
  }
41319
41343
  const skillCheckFailed = state.happened && !state.succeeded;
41320
- const { difficultyText, allowed } = getSkillCheckText({
41344
+ const { difficultyText } = getSkillCheckText({
41321
41345
  skill: skillId,
41322
41346
  skillCheckId,
41323
41347
  value: difficulty
@@ -41354,10 +41378,11 @@ const choicePromptCommandPlugin = new CommandPlugin("choicePrompt", "any", async
41354
41378
  };
41355
41379
  }
41356
41380
  });
41357
- const textFieldPlugin = new CommandPlugin("text_field", [{ name: "prompt", type: "string" }], async (cmd) => {
41358
- return new Promise((resolve) => {
41359
- useVM().lastChoiceCommand = cmd;
41360
- cmd.options.resolve = resolve;
41381
+ const textFieldPlugin = CommandPlugin.FromOptions({
41382
+ keyword: "text_field",
41383
+ argTypes: [{ name: "prompt", type: "string" }],
41384
+ returnAfterPlayerAnswer: true,
41385
+ runner: async (cmd) => {
41361
41386
  const dialog = {
41362
41387
  speaker: "game",
41363
41388
  text: cmd.options.prompt,
@@ -41365,22 +41390,26 @@ const textFieldPlugin = new CommandPlugin("text_field", [{ name: "prompt", type:
41365
41390
  interactive: true
41366
41391
  };
41367
41392
  useDialogStore().addDialog(dialog);
41368
- });
41393
+ }
41369
41394
  });
41370
41395
  textFieldPlugin.onPlayerAnswered = async (cmd, choice) => {
41371
41396
  if (typeof choice !== "string") {
41372
41397
  commandRuntimeError(cmd, `The player's answer should be a string`);
41373
41398
  }
41374
- cmd.options.resolve(choice);
41399
+ return choice;
41375
41400
  };
41376
- const textFieldPromptPlugin = new CommandPlugin("text_field_prompt", [{ name: "prompt", type: "string" }], async (cmd) => {
41377
- const dialog = {
41378
- speaker: "game",
41379
- text: cmd.options.prompt,
41380
- textField: true,
41381
- interactive: true
41382
- };
41383
- useDialogStore().addDialog(dialog);
41401
+ const textFieldPromptPlugin = CommandPlugin.FromOptions({
41402
+ keyword: "text_field_prompt",
41403
+ argTypes: [{ name: "prompt", type: "string" }],
41404
+ runner: async (cmd) => {
41405
+ const dialog = {
41406
+ speaker: "game",
41407
+ text: cmd.options.prompt,
41408
+ textField: true,
41409
+ interactive: true
41410
+ };
41411
+ useDialogStore().addDialog(dialog);
41412
+ }
41384
41413
  });
41385
41414
  function registerBaseCommands(vm2) {
41386
41415
  vm2.addCommand(choicePlugin);