gdcore-tools 2.0.0-gd-v5.4.217-autobuild → 2.0.0-gd-v5.4.218-autobuild

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 (47) hide show
  1. package/dist/Runtime/Extensions/3D/JsExtension.js +7 -3
  2. package/dist/Runtime/Extensions/DialogueTree/JsExtension.js +44 -32
  3. package/dist/Runtime/Extensions/DialogueTree/dialoguetools.js +2 -2
  4. package/dist/Runtime/Extensions/DialogueTree/dialoguetools.js.map +2 -2
  5. package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +15 -0
  6. package/dist/Runtime/Extensions/Multiplayer/messageManager.js +1 -1
  7. package/dist/Runtime/Extensions/Multiplayer/messageManager.js.map +2 -2
  8. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js +1 -1
  9. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +2 -2
  10. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js +1 -1
  11. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
  12. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js +1 -1
  13. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js.map +2 -2
  14. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js +1 -1
  15. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js.map +2 -2
  16. package/dist/Runtime/Model3DManager.js +1 -1
  17. package/dist/Runtime/Model3DManager.js.map +2 -2
  18. package/dist/Runtime/ResourceLoader.js +1 -1
  19. package/dist/Runtime/ResourceLoader.js.map +2 -2
  20. package/dist/Runtime/capturemanager.js +2 -0
  21. package/dist/Runtime/capturemanager.js.map +7 -0
  22. package/dist/Runtime/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js +1 -1
  23. package/dist/Runtime/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js.map +2 -2
  24. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js +1 -1
  25. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js.map +2 -2
  26. package/dist/Runtime/jsonmanager.js +1 -1
  27. package/dist/Runtime/jsonmanager.js.map +2 -2
  28. package/dist/Runtime/layer.js +1 -1
  29. package/dist/Runtime/layer.js.map +2 -2
  30. package/dist/Runtime/pixi-renderers/pixi-bitmapfont-manager.js +1 -1
  31. package/dist/Runtime/pixi-renderers/pixi-bitmapfont-manager.js.map +2 -2
  32. package/dist/Runtime/pixi-renderers/pixi-image-manager.js +1 -1
  33. package/dist/Runtime/pixi-renderers/pixi-image-manager.js.map +2 -2
  34. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +1 -1
  35. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js.map +2 -2
  36. package/dist/Runtime/runtimegame.js +1 -1
  37. package/dist/Runtime/runtimegame.js.map +2 -2
  38. package/dist/Runtime/runtimewatermark.js +2 -2
  39. package/dist/Runtime/runtimewatermark.js.map +2 -2
  40. package/dist/Runtime/scenestack.js +1 -1
  41. package/dist/Runtime/scenestack.js.map +2 -2
  42. package/dist/Runtime/spriteruntimeobject.js +1 -1
  43. package/dist/Runtime/spriteruntimeobject.js.map +2 -2
  44. package/dist/lib/libGD.cjs +1 -1
  45. package/dist/lib/libGD.wasm +0 -0
  46. package/gd.d.ts +22 -6
  47. package/package.json +1 -1
@@ -3231,9 +3231,9 @@ module.exports = {
3231
3231
  : this._originalDepth / modelDepth;
3232
3232
  const minScaleRatio = Math.min(widthRatio, heightRatio, depthRatio);
3233
3233
  if (!Number.isFinite(minScaleRatio)) {
3234
- this._defaultWidth = modelWidth;
3235
- this._defaultHeight = modelHeight;
3236
- this._defaultDepth = modelDepth;
3234
+ this._defaultWidth = this._originalWidth;
3235
+ this._defaultHeight = this._originalHeight;
3236
+ this._defaultDepth = this._originalDepth;
3237
3237
  } else {
3238
3238
  if (widthRatio === minScaleRatio) {
3239
3239
  this._defaultWidth = this._originalWidth;
@@ -3274,6 +3274,10 @@ module.exports = {
3274
3274
  this._defaultDepth = this._originalDepth;
3275
3275
  }
3276
3276
  }
3277
+ } else {
3278
+ this._defaultWidth = this._originalWidth;
3279
+ this._defaultHeight = this._originalHeight;
3280
+ this._defaultDepth = this._originalDepth;
3277
3281
  }
3278
3282
 
3279
3283
  this._threeObject.add(this._threeModelGroup);
@@ -34,18 +34,18 @@ module.exports = {
34
34
  extension
35
35
  .addAction(
36
36
  'LoadDialogueFromSceneVariable',
37
- _('Load dialogue Tree from a scene variable'),
37
+ _('Load dialogue tree from a scene variable'),
38
38
  _(
39
- 'Load a dialogue data object - Yarn json format, stored in a scene variable. Use this command to load all the Dialogue data at the beginning of the game.'
39
+ 'Load a dialogue data object - Yarn JSON format, stored in a scene variable. Use this command to load all the Dialogue data at the beginning of the game.'
40
40
  ),
41
- _('Load dialogue data from Scene variable _PARAM0_'),
41
+ _('Load dialogue data from scene variable _PARAM0_'),
42
42
  '',
43
43
  'JsPlatform/Extensions/yarn32.png',
44
44
  'JsPlatform/Extensions/yarn32.png'
45
45
  )
46
46
  .addParameter(
47
47
  'scenevar',
48
- _('Scene variable that holds the Yarn Json data'),
48
+ _('Scene variable that holds the Yarn JSON data'),
49
49
  '',
50
50
  false
51
51
  )
@@ -57,11 +57,11 @@ module.exports = {
57
57
  extension
58
58
  .addAction(
59
59
  'LoadDialogueFromJsonFile',
60
- _('Load dialogue Tree from a Json File'),
60
+ _('Load dialogue tree from a JSON file'),
61
61
  _(
62
- 'Load a dialogue data object - Yarn json format, stored in a Json file. Use this command to load all the Dialogue data at the beginning of the game.'
62
+ 'Load a dialogue data object - Yarn JSON format, stored in a JSON file. Use this command to load all the Dialogue data at the beginning of the game.'
63
63
  ),
64
- _('Load dialogue data from json file _PARAM1_'),
64
+ _('Load dialogue data from JSON file _PARAM1_'),
65
65
  '',
66
66
  'JsPlatform/Extensions/yarn32.png',
67
67
  'JsPlatform/Extensions/yarn32.png'
@@ -69,7 +69,7 @@ module.exports = {
69
69
  .addCodeOnlyParameter('currentScene', '')
70
70
  .addParameter(
71
71
  'jsonResource',
72
- _('Json file that holds the Yarn Json data'),
72
+ _('JSON file that holds the Yarn JSON data'),
73
73
  '',
74
74
  false
75
75
  )
@@ -125,11 +125,11 @@ module.exports = {
125
125
  extension
126
126
  .addAction(
127
127
  'ConfirmSelectOption',
128
- _('Confirm selected Option'),
128
+ _('Confirm selected option'),
129
129
  _(
130
130
  'Set the selected option as confirmed, which will validate it and go forward to the next node. Use other actions to select options (see "select next option" and "Select previous option").'
131
131
  ),
132
- _('Confirm selected Option'),
132
+ _('Confirm selected option'),
133
133
  '',
134
134
  'JsPlatform/Extensions/yarn32.png',
135
135
  'JsPlatform/Extensions/yarn32.png'
@@ -140,11 +140,11 @@ module.exports = {
140
140
  extension
141
141
  .addAction(
142
142
  'SelectNextOption',
143
- _('Select next Option'),
143
+ _('Select next option'),
144
144
  _(
145
- 'Select next Option (add 1 to selected option number). Use this when the dialogue line is of type "options" and the player has pressed a button to change selected option.'
145
+ 'Select next option (add 1 to selected option number). Use this when the dialogue line is of type "options" and the player has pressed a button to change selected option.'
146
146
  ),
147
- _('Select next Option'),
147
+ _('Select next option'),
148
148
  '',
149
149
  'JsPlatform/Extensions/yarn32.png',
150
150
  'JsPlatform/Extensions/yarn32.png'
@@ -155,11 +155,11 @@ module.exports = {
155
155
  extension
156
156
  .addAction(
157
157
  'SelectPreviousOption',
158
- _('Select previous Option'),
158
+ _('Select previous option'),
159
159
  _(
160
- 'Select previous Option (subtract 1 from selected option number). Use this when the dialogue line is of type "options" and the player has pressed a button to change selected option.'
160
+ 'Select previous option (subtract 1 from selected option number). Use this when the dialogue line is of type "options" and the player has pressed a button to change selected option.'
161
161
  ),
162
- _('Select previous Option'),
162
+ _('Select previous option'),
163
163
  '',
164
164
  'JsPlatform/Extensions/yarn32.png',
165
165
  'JsPlatform/Extensions/yarn32.png'
@@ -225,8 +225,8 @@ module.exports = {
225
225
  'JsPlatform/Extensions/yarn32.png',
226
226
  'JsPlatform/Extensions/yarn32.png'
227
227
  )
228
- .addParameter('string', _('State Variable Name'), '', false)
229
- .addParameter('string', _('Variable string value'), '', false)
228
+ .addParameter('string', _('State variable name'), '', false)
229
+ .addParameter('string', _('New value'), '', false)
230
230
  .getCodeExtraInformation()
231
231
  .setFunctionName('gdjs.dialogueTree.setVariable');
232
232
 
@@ -242,8 +242,8 @@ module.exports = {
242
242
  'JsPlatform/Extensions/yarn32.png',
243
243
  'JsPlatform/Extensions/yarn32.png'
244
244
  )
245
- .addParameter('string', _('State Variable Name'), '', false)
246
- .addParameter('expression', _('Variable number value'), '', true)
245
+ .addParameter('string', _('State variable name'), '', false)
246
+ .addParameter('expression', _('New value'), '', true)
247
247
  .getCodeExtraInformation()
248
248
  .setFunctionName('gdjs.dialogueTree.setVariable');
249
249
 
@@ -259,8 +259,8 @@ module.exports = {
259
259
  'JsPlatform/Extensions/yarn32.png',
260
260
  'JsPlatform/Extensions/yarn32.png'
261
261
  )
262
- .addParameter('string', _('State Variable Name'), '', false)
263
- .addParameter('trueorfalse', _('Variable boolean value'), '', false)
262
+ .addParameter('string', _('State variable name'), '', false)
263
+ .addParameter('trueorfalse', _('New value'), '', false)
264
264
  .getCodeExtraInformation()
265
265
  .setFunctionName('gdjs.dialogueTree.setVariable');
266
266
 
@@ -336,9 +336,9 @@ module.exports = {
336
336
  extension
337
337
  .addStrExpression(
338
338
  'Option',
339
- _('Get the text of an option from an Options line type'),
339
+ _('Get the text of an option from an options line type'),
340
340
  _(
341
- "Get the text of an option from an Options line type, using the option's Number. The numbers start from 0."
341
+ "Get the text of an option from an options line type, using the option's Number. The numbers start from 0."
342
342
  ),
343
343
  '',
344
344
  'JsPlatform/Extensions/yarn32.png'
@@ -350,9 +350,9 @@ module.exports = {
350
350
  extension
351
351
  .addStrExpression(
352
352
  'HorizontalOptionsList',
353
- _('Get a Horizontal list of options from the Options line type'),
353
+ _('Get a Horizontal list of options from the options line type'),
354
354
  _(
355
- "Get the text of all available options from an Options line type as a horizontal list. You can also pass the selected option's cursor string, which by default is ->"
355
+ "Get the text of all available options from an options line type as a horizontal list. You can also pass the selected option's cursor string, which by default is ->"
356
356
  ),
357
357
  '',
358
358
  'JsPlatform/Extensions/yarn32.png'
@@ -365,9 +365,9 @@ module.exports = {
365
365
  extension
366
366
  .addStrExpression(
367
367
  'VerticalOptionsList',
368
- _('Get a Vertical list of options from the Options line type'),
368
+ _('Get a Vertical list of options from the options line type'),
369
369
  _(
370
- "Get the text of all available options from an Options line type as a vertical list. You can also pass the selected option's cursor string, which by default is ->"
370
+ "Get the text of all available options from an options line type as a vertical list. You can also pass the selected option's cursor string, which by default is ->"
371
371
  ),
372
372
  '',
373
373
  'JsPlatform/Extensions/yarn32.png'
@@ -507,14 +507,26 @@ module.exports = {
507
507
  extension
508
508
  .addExpression(
509
509
  'Variable',
510
- _('Get dialogue state value'),
511
- _('Get dialogue state value'),
510
+ _('Get the number stored in a dialogue state variable'),
511
+ _('Get the number stored in a dialogue state variable'),
512
512
  '',
513
513
  'JsPlatform/Extensions/yarn32.png'
514
514
  )
515
- .addParameter('string', _('Variable Name'), '', false)
515
+ .addParameter('string', _('Dialogue state variable name'), '', false)
516
516
  .getCodeExtraInformation()
517
- .setFunctionName('gdjs.dialogueTree.getVariable');
517
+ .setFunctionName('gdjs.dialogueTree.getVariableAsNumber');
518
+
519
+ extension
520
+ .addStrExpression(
521
+ 'VariableString',
522
+ _('Get the string stored in a dialogue state variable'),
523
+ _('Get the string stored in a dialogue state variable'),
524
+ '',
525
+ 'JsPlatform/Extensions/yarn32.png'
526
+ )
527
+ .addParameter('string', _('Dialogue state variable name'), '', false)
528
+ .getCodeExtraInformation()
529
+ .setFunctionName('gdjs.dialogueTree.getVariableAsString');
518
530
 
519
531
  extension
520
532
  .addCondition(
@@ -1,3 +1,3 @@
1
- var gdjs;(function(e){const s=new e.Logger("Dialogue tree");e.dialogueTree={},e.dialogueTree.runner=new bondage.Runner,e.dialogueTree.loadFromSceneVariable=function(i,t){this.runner=e.dialogueTree.runner;try{this.yarnData=JSON.parse(i.getAsString()),this.runner.load(this.yarnData),t&&t.length>0&&e.dialogueTree.startFrom(t)}catch(a){s.error("Error while loading from scene variable: ",a)}},e.dialogueTree.loadFromJsonFile=function(i,t,a){i.getGame().getJsonManager().loadJson(t,function(r,n){if(r)s.error("An error happened while loading JSON resource:",r);else{if(!n)return;e.dialogueTree.yarnData=n;try{e.dialogueTree.runner.load(e.dialogueTree.yarnData)}catch(o){s.error("An error happened while loading parsing the dialogue tree data:",o)}a&&a.length>0&&e.dialogueTree.startFrom(a)}})},e.dialogueTree.stopRunningDialogue=function(){this.dialogueIsRunning&&(this.dialogueIsRunning=!1),this.dialogueData&&(this.dialogueData=null),this.dialogueText="",this.clipTextEnd=0},e.dialogueTree.isRunning=function(){return this.dialogueIsRunning&&!this.dialogueData&&this.dialogueText&&this.clipTextEnd>=this.dialogueText.length&&(this.dialogueIsRunning=!1),this.dialogueIsRunning},e.dialogueTree.scrollClippedText=function(){if(!(this.pauseScrolling||!this.dialogueIsRunning)){if(e.dialogueTree._isLineTypeCommand()&&this.dialogueDataType==="text"&&this.dialogueBranchTitle===this.dialogueData.data.title&&this.lineNum===this.dialogueData.lineNum&&e.dialogueTree.hasClippedScrollingCompleted()){e.dialogueTree.goToNextDialogueLine();return}this.dialogueText&&this.dialogueDataType==="text"&&this.clipTextEnd<this.dialogueText.length&&(this.clipTextEnd+=1)}},e.dialogueTree.completeClippedTextScrolling=function(){this.pauseScrolling||!this.dialogueIsRunning||!this.dialogueText||this.dialogueDataType!=="text"||(this.clipTextEnd=this.dialogueText.length)},e.dialogueTree.hasClippedScrollingCompleted=function(){return!this.dialogueIsRunning||this.dialogueDataType===""?!1:this.dialogueData&&this.dialogueText.length>0&&this.clipTextEnd>=this.dialogueText.length?(e.dialogueTree.getVariable("debug")&&s.warn("Scroll completed:",this.clipTextEnd,"/",this.dialogueText.length),!0):!1},e.dialogueTree.getClippedLineText=function(){return this.dialogueIsRunning&&this.dialogueText.length?this.dialogueText.substring(0,this.clipTextEnd+1):""},e.dialogueTree.getLineText=function(){return this.dialogueIsRunning&&this.dialogueText.length?this.dialogueText:""},e.dialogueTree.commandParametersCount=function(){return this.commandParameters&&this.commandParameters.length>1?this.commandParameters.length-1:0},e.dialogueTree.getCommandParameter=function(i){if(i===-1&&this.commandParameters.length>0)return this.commandParameters[0];if(this.commandParameters&&this.commandParameters.length>=i+1){const t=this.commandParameters[i+1];return t||""}return""},e.dialogueTree.isCommandCalled=function(i){if(!this.dialogueIsRunning)return!1;const t=e.dialogueTree.commandCalls,a=e.dialogueTree.clipTextEnd,r=e.dialogueTree.dialogueText;return this.pauseScrolling||!t?!1:this.commandCalls.some(function(n,o){if(a!==0&&a<n.time)return!1;if(n.cmd==="wait"&&(a===0||a!==r.length)&&(e.dialogueTree.pauseScrolling=!0,setTimeout(function(){e.dialogueTree.pauseScrolling=!1,t.splice(o,1),e.dialogueTree.getVariable("debug")&&s.info("CMD:",n)},parseInt(n.params[1],10))),n.cmd===i)return e.dialogueTree.commandParameters=n.params,t.splice(o,1),e.dialogueTree.getVariable("debug")&&s.info("CMD:",n),!0})},e.dialogueTree._normalizedOptionIndex=function(i){return i>=this.options.length&&(i=this.options.length-1),i<0&&(i=0),i},e.dialogueTree._cycledOptionIndex=function(i){return i>=this.options.length&&(i=0),i<0&&(i=this.options.length-1),i},e.dialogueTree.getLineOption=function(i){return!this.dialogueIsRunning||!this.options.length?[]:(i=e.dialogueTree._normalizedOptionIndex(i),this.options[i])},e.dialogueTree.getLineOptionsText=function(i,t){if(!this.dialogueIsRunning||!this.options.length)return"";let a="";return this.options.forEach(function(r,n){n===e.dialogueTree.selectedOption?a+=i:a+=i.replace(/.*/g," "),a+=r,t&&(a+=`
2
- `)}),a},e.dialogueTree.getLineOptionsTextHorizontal=function(i){return this.getLineOptionsText(i,!1)},e.dialogueTree.getLineOptionsTextVertical=function(i){return this.getLineOptionsText(i,!0)},e.dialogueTree.getLineOptionsCount=function(){return this.dialogueIsRunning&&this.options.length?this.optionsCount:0},e.dialogueTree.confirmSelectOption=function(){if(!!this.dialogueIsRunning&&this.dialogueData.select&&!this.selectedOptionUpdated&&this.selectedOption!==-1){this.commandCalls=[];try{this.dialogueData.select(this.selectedOption),this.dialogueData=this.dialogue.next().value,e.dialogueTree.goToNextDialogueLine()}catch(i){s.error("An error happened when trying to access the dialogue branch!",i)}}},e.dialogueTree.selectNextOption=function(){!this.dialogueIsRunning||this.dialogueData.select&&(this.selectedOption+=1,this.selectedOption=e.dialogueTree._cycledOptionIndex(this.selectedOption),this.selectedOptionUpdated=!0)},e.dialogueTree.selectPreviousOption=function(){!this.dialogueIsRunning||this.dialogueData.select&&(this.selectedOption-=1,this.selectedOption=e.dialogueTree._cycledOptionIndex(this.selectedOption),this.selectedOptionUpdated=!0)},e.dialogueTree.selectOption=function(i){!this.dialogueIsRunning||this.dialogueData.select&&(this.selectedOption=e.dialogueTree._normalizedOptionIndex(i),this.selectedOptionUpdated=!0)},e.dialogueTree.getSelectedOption=function(){if(!!this.dialogueIsRunning)return this.dialogueData.select?this.selectedOption:0},e.dialogueTree.hasSelectedOptionChanged=function(){return this.selectedOptionUpdated?(this.selectedOptionUpdated=!1,this.selectedOption===-1&&(this.selectedOption=0),!0):!1},e.dialogueTree.isDialogueLineType=function(i){if(!this.dialogueIsRunning)return!1;if(this.commandCalls&&i==="command"){if(this.commandCalls.some(function(t){return e.dialogueTree.clipTextEnd>t.time&&t.cmd==="wait"}))return!this.pauseScrolling;if(this.commandCalls.length>0&&this.commandParameters.length>0)return!0}return this.dialogueDataType===i},e.dialogueTree.hasDialogueBranch=function(i){return this.runner&&this.runner.yarnNodes&&Object.keys(this.runner.yarnNodes).some(function(t){return t===i})},e.dialogueTree.startFrom=function(i){this.runner=e.dialogueTree.runner,!!this.hasDialogueBranch(i)&&(this.optionsCount=0,this.options=[],this.tagParameters=[],this.dialogue=this.runner.run(i),this.dialogueText="",this.clipTextEnd=0,this.commandCalls=[],this.commandParameters=[],this.pauseScrolling=!1,this.dialogueData=this.dialogue.next().value,this.dialogueBranchTags=this.dialogueData.data.tags,this.dialogueBranchTitle=this.dialogueData.data.title,this.dialogueBranchBody=this.dialogueData.data.body,this.lineNum=this.dialogueData.lineNum,e.dialogueTree._isLineTypeText()?this.dialogueDataType="text":e.dialogueTree._isLineTypeOptions()?this.dialogueDataType="options":this.dialogueDataType="command",this.dialogueIsRunning=!0,e.dialogueTree.goToNextDialogueLine())},e.dialogueTree._isLineTypeText=function(){return this.dialogueData instanceof bondage.TextResult},e.dialogueTree._isLineTypeOptions=function(){return this.dialogueData instanceof bondage.OptionsResult},e.dialogueTree._isLineTypeCommand=function(){return this.dialogueData instanceof bondage.CommandResult},e.dialogueTree.goToNextDialogueLine=function(){if(!(this.pauseScrolling||!this.dialogueIsRunning))if(this.optionsCount=0,this.selectedOption=-1,this.selectedOptionUpdated=!1,e.dialogueTree.getVariable("debug")&&s.info("Parsing:",this.dialogueData),!this.dialogueData)e.dialogueTree.stopRunningDialogue();else if(e.dialogueTree._isLineTypeText())this.lineNum===this.dialogueData.lineNum&&this.dialogueBranchTitle===this.dialogueData.data.title?(this.clipTextEnd=this.dialogueText.length-1,this.dialogueText+=(this.dialogueText===""?"":" ")+this.dialogueData.text):(this.clipTextEnd=0,this.dialogueText=this.dialogueData.text),this.dialogueBranchTags=this.dialogueData.data.tags,this.dialogueBranchTitle=this.dialogueData.data.title,this.dialogueBranchBody=this.dialogueData.data.body,this.lineNum=this.dialogueData.lineNum,this.dialogueDataType="text",this.dialogueData=this.dialogue.next().value;else if(e.dialogueTree._isLineTypeOptions())this.commandCalls=[],this.dialogueDataType="options",this.dialogueText="",this.clipTextEnd=0,this.optionsCount=this.dialogueData.options.length,this.options=this.dialogueData.options,this.selectedOptionUpdated=!0;else if(e.dialogueTree._isLineTypeCommand()){this.dialogueDataType="command";const i=this.dialogueData.text.split(" "),t=this.commandCalls.length&&this.commandCalls[this.commandCalls.length-1].cmd==="wait"?1:0;this.commandCalls.push({cmd:i[0],params:i,time:this.dialogueText.length+t}),this.dialogueData=this.dialogue.next().value,e.dialogueTree.goToNextDialogueLine()}else this.dialogueDataType="unknown"},e.dialogueTree.getBranchTitle=function(){return this.dialogueIsRunning?this.dialogueBranchTitle:""},e.dialogueTree.branchTitleIs=function(i){return this.dialogueIsRunning?this.dialogueBranchTitle===i:!1},e.dialogueTree.getBranchTags=function(){return this.dialogueIsRunning?this.dialogueBranchTags.join(","):""},e.dialogueTree.getBranchTag=function(i){return this.dialogueIsRunning&&this.dialogueBranchTags.length?(i>this.dialogueBranchTags.length-1&&(i=this.dialogueBranchTags.length-1),this.dialogueBranchTags[i]):""},e.dialogueTree.branchContainsTag=function(i){return this.tagParameters=[],this.dialogueIsRunning&&this.dialogueBranchTags.length?this.dialogueBranchTags.some(function(t){const a=t.match(/([^\(]+)\(([^\)]+)\)/i);return e.dialogueTree.tagParameters=a?a[2].split(","):[],a?a[1]===i:t===i}):!1},e.dialogueTree.getTagParameter=function(i){if(this.dialogueIsRunning&&this.tagParameters.length>=i){const t=this.tagParameters[i];return t||""}return""},e.dialogueTree.getVisitedBranchTitles=function(){return this.dialogueIsRunning?Object.keys(this.runner.visited).join(","):""},e.dialogueTree.branchTitleHasBeenVisited=function(i){return i||(i=this.dialogueBranchTitle),Object.keys(this.runner.visited).includes(i)&&this.runner.visited[i]},e.dialogueTree.getBranchText=function(){return this.dialogueIsRunning?this.dialogueBranchBody:""},e.dialogueTree.getVariable=function(i){return this.runner.variables&&i in this.runner.variables.data?this.runner.variables.get(i):""},e.dialogueTree.compareVariable=function(i,t){return this.runner.variables&&i in this.runner.variables.data?this.runner.variables.get(i)===t:!1},e.dialogueTree.setVariable=function(i,t){this.runner.variables&&this.runner.variables.set(i,t)},e.dialogueTree.saveState=function(i){const t={variables:e.dialogueTree.runner.variables.data,visited:e.dialogueTree.runner.visited};i.fromJSObject(t)},e.dialogueTree.loadState=function(i){const t=i.toJSObject();if(!t){s.error("Load state variable is empty:",i);return}try{e.dialogueTree.runner.visited=t.visited,e.dialogueTree.runner.variables.data={},Object.keys(t.variables).forEach(function(a){const r=t.variables[a];e.dialogueTree.runner.variables.set(a,r)})}catch(a){s.error("Failed to load state from variable:",i,a)}},e.dialogueTree.clearState=function(){e.dialogueTree.runner.visited={},e.dialogueTree.runner.variables.data={}}})(gdjs||(gdjs={}));
1
+ var gdjs;(function(e){const n=new e.Logger("Dialogue tree");e.dialogueTree={},e.dialogueTree.runner=new bondage.Runner,e.dialogueTree.loadFromSceneVariable=function(i,t){this.runner=e.dialogueTree.runner;try{this.yarnData=JSON.parse(i.getAsString()),this.runner.load(this.yarnData),t&&t.length>0&&e.dialogueTree.startFrom(t)}catch(a){n.error("Error while loading from scene variable: ",a)}},e.dialogueTree.loadFromJsonFile=function(i,t,a){i.getGame().getJsonManager().loadJson(t,function(s,r){if(s)n.error("An error happened while loading JSON resource:",s);else{if(!r)return;e.dialogueTree.yarnData=r;try{e.dialogueTree.runner.load(e.dialogueTree.yarnData)}catch(o){n.error("An error happened while loading parsing the dialogue tree data:",o)}a&&a.length>0&&e.dialogueTree.startFrom(a)}})},e.dialogueTree.stopRunningDialogue=function(){this.dialogueIsRunning&&(this.dialogueIsRunning=!1),this.dialogueData&&(this.dialogueData=null),this.dialogueText="",this.clipTextEnd=0},e.dialogueTree.isRunning=function(){return this.dialogueIsRunning&&!this.dialogueData&&this.dialogueText&&this.clipTextEnd>=this.dialogueText.length&&(this.dialogueIsRunning=!1),this.dialogueIsRunning},e.dialogueTree.scrollClippedText=function(){if(!(this.pauseScrolling||!this.dialogueIsRunning)){if(e.dialogueTree._isLineTypeCommand()&&this.dialogueDataType==="text"&&this.dialogueBranchTitle===this.dialogueData.data.title&&this.lineNum===this.dialogueData.lineNum&&e.dialogueTree.hasClippedScrollingCompleted()){e.dialogueTree.goToNextDialogueLine();return}this.dialogueText&&this.dialogueDataType==="text"&&this.clipTextEnd<this.dialogueText.length&&(this.clipTextEnd+=1)}},e.dialogueTree.completeClippedTextScrolling=function(){this.pauseScrolling||!this.dialogueIsRunning||!this.dialogueText||this.dialogueDataType!=="text"||(this.clipTextEnd=this.dialogueText.length)},e.dialogueTree.hasClippedScrollingCompleted=function(){return!this.dialogueIsRunning||this.dialogueDataType===""?!1:this.dialogueData&&this.dialogueText.length>0&&this.clipTextEnd>=this.dialogueText.length?(e.dialogueTree.getVariable("debug")&&n.warn("Scroll completed:",this.clipTextEnd,"/",this.dialogueText.length),!0):!1},e.dialogueTree.getClippedLineText=function(){return this.dialogueIsRunning&&this.dialogueText.length?this.dialogueText.substring(0,this.clipTextEnd+1):""},e.dialogueTree.getLineText=function(){return this.dialogueIsRunning&&this.dialogueText.length?this.dialogueText:""},e.dialogueTree.commandParametersCount=function(){return this.commandParameters&&this.commandParameters.length>1?this.commandParameters.length-1:0},e.dialogueTree.getCommandParameter=function(i){if(i===-1&&this.commandParameters.length>0)return this.commandParameters[0];if(this.commandParameters&&this.commandParameters.length>=i+1){const t=this.commandParameters[i+1];return t||""}return""},e.dialogueTree.isCommandCalled=function(i){if(!this.dialogueIsRunning)return!1;const t=e.dialogueTree.commandCalls,a=e.dialogueTree.clipTextEnd,s=e.dialogueTree.dialogueText;return this.pauseScrolling||!t?!1:this.commandCalls.some(function(r,o){if(a!==0&&a<r.time)return!1;if(r.cmd==="wait"&&(a===0||a!==s.length)&&(e.dialogueTree.pauseScrolling=!0,setTimeout(function(){e.dialogueTree.pauseScrolling=!1,t.splice(o,1),e.dialogueTree.getVariable("debug")&&n.info("CMD:",r)},parseInt(r.params[1],10))),r.cmd===i)return e.dialogueTree.commandParameters=r.params,t.splice(o,1),e.dialogueTree.getVariable("debug")&&n.info("CMD:",r),!0})},e.dialogueTree._normalizedOptionIndex=function(i){return i>=this.options.length&&(i=this.options.length-1),i<0&&(i=0),i},e.dialogueTree._cycledOptionIndex=function(i){return i>=this.options.length&&(i=0),i<0&&(i=this.options.length-1),i},e.dialogueTree.getLineOption=function(i){return!this.dialogueIsRunning||!this.options.length?[]:(i=e.dialogueTree._normalizedOptionIndex(i),this.options[i])},e.dialogueTree.getLineOptionsText=function(i,t){if(!this.dialogueIsRunning||!this.options.length)return"";let a="";return this.options.forEach(function(s,r){r===e.dialogueTree.selectedOption?a+=i:a+=i.replace(/.*/g," "),a+=s,t&&(a+=`
2
+ `)}),a},e.dialogueTree.getLineOptionsTextHorizontal=function(i){return this.getLineOptionsText(i,!1)},e.dialogueTree.getLineOptionsTextVertical=function(i){return this.getLineOptionsText(i,!0)},e.dialogueTree.getLineOptionsCount=function(){return this.dialogueIsRunning&&this.options.length?this.optionsCount:0},e.dialogueTree.confirmSelectOption=function(){if(!!this.dialogueIsRunning&&this.dialogueData.select&&!this.selectedOptionUpdated&&this.selectedOption!==-1){this.commandCalls=[];try{this.dialogueData.select(this.selectedOption);try{this.dialogueData=this.dialogue.next().value}catch(i){n.error("Error while confirming in the dialogue tree. Verify if there is a syntax error? Full error is: ",i);return}e.dialogueTree.goToNextDialogueLine()}catch(i){n.error("An error happened when trying to access the dialogue branch!",i)}}},e.dialogueTree.selectNextOption=function(){!this.dialogueIsRunning||this.dialogueData.select&&(this.selectedOption+=1,this.selectedOption=e.dialogueTree._cycledOptionIndex(this.selectedOption),this.selectedOptionUpdated=!0)},e.dialogueTree.selectPreviousOption=function(){!this.dialogueIsRunning||this.dialogueData.select&&(this.selectedOption-=1,this.selectedOption=e.dialogueTree._cycledOptionIndex(this.selectedOption),this.selectedOptionUpdated=!0)},e.dialogueTree.selectOption=function(i){!this.dialogueIsRunning||this.dialogueData.select&&(this.selectedOption=e.dialogueTree._normalizedOptionIndex(i),this.selectedOptionUpdated=!0)},e.dialogueTree.getSelectedOption=function(){if(!!this.dialogueIsRunning)return this.dialogueData.select?this.selectedOption:0},e.dialogueTree.hasSelectedOptionChanged=function(){return this.selectedOptionUpdated?(this.selectedOptionUpdated=!1,this.selectedOption===-1&&(this.selectedOption=0),!0):!1},e.dialogueTree.isDialogueLineType=function(i){if(!this.dialogueIsRunning)return!1;if(this.commandCalls&&i==="command"){if(this.commandCalls.some(function(t){return e.dialogueTree.clipTextEnd>t.time&&t.cmd==="wait"}))return!this.pauseScrolling;if(this.commandCalls.length>0&&this.commandParameters.length>0)return!0}return this.dialogueDataType===i},e.dialogueTree.hasDialogueBranch=function(i){return this.runner&&this.runner.yarnNodes&&Object.keys(this.runner.yarnNodes).some(function(t){return t===i})},e.dialogueTree.startFrom=function(i){if(this.runner=e.dialogueTree.runner,!!this.hasDialogueBranch(i)){this.optionsCount=0,this.options=[],this.tagParameters=[];try{this.dialogue=this.runner.run(i)}catch(t){n.error("Error while setting up the dialogue tree. Verify if there is a syntax error? Full error is: ",t);return}this.dialogueText="",this.clipTextEnd=0,this.commandCalls=[],this.commandParameters=[],this.pauseScrolling=!1;try{this.dialogueData=this.dialogue.next().value}catch(t){n.error("Error while starting the dialogue tree. Verify if there is a syntax error? Full error is: ",t);return}this.dialogueBranchTags=this.dialogueData.data.tags,this.dialogueBranchTitle=this.dialogueData.data.title,this.dialogueBranchBody=this.dialogueData.data.body,this.lineNum=this.dialogueData.lineNum,e.dialogueTree._isLineTypeText()?this.dialogueDataType="text":e.dialogueTree._isLineTypeOptions()?this.dialogueDataType="options":this.dialogueDataType="command",this.dialogueIsRunning=!0,e.dialogueTree.goToNextDialogueLine()}},e.dialogueTree._isLineTypeText=function(){return this.dialogueData instanceof bondage.TextResult},e.dialogueTree._isLineTypeOptions=function(){return this.dialogueData instanceof bondage.OptionsResult},e.dialogueTree._isLineTypeCommand=function(){return this.dialogueData instanceof bondage.CommandResult},e.dialogueTree.goToNextDialogueLine=function(){if(!(this.pauseScrolling||!this.dialogueIsRunning))if(this.optionsCount=0,this.selectedOption=-1,this.selectedOptionUpdated=!1,e.dialogueTree.getVariable("debug")&&n.info("Parsing:",this.dialogueData),!this.dialogueData)e.dialogueTree.stopRunningDialogue();else if(e.dialogueTree._isLineTypeText()){this.lineNum===this.dialogueData.lineNum&&this.dialogueBranchTitle===this.dialogueData.data.title?(this.clipTextEnd=this.dialogueText.length-1,this.dialogueText+=(this.dialogueText===""?"":" ")+this.dialogueData.text):(this.clipTextEnd=0,this.dialogueText=this.dialogueData.text),this.dialogueBranchTags=this.dialogueData.data.tags,this.dialogueBranchTitle=this.dialogueData.data.title,this.dialogueBranchBody=this.dialogueData.data.body,this.lineNum=this.dialogueData.lineNum,this.dialogueDataType="text";try{this.dialogueData=this.dialogue.next().value}catch(i){n.error("Error while progressing the dialogue tree. Verify if there is a syntax error? Full error is: ",i);return}}else if(e.dialogueTree._isLineTypeOptions())this.commandCalls=[],this.dialogueDataType="options",this.dialogueText="",this.clipTextEnd=0,this.optionsCount=this.dialogueData.options.length,this.options=this.dialogueData.options,this.selectedOptionUpdated=!0;else if(e.dialogueTree._isLineTypeCommand()){this.dialogueDataType="command";const i=this.dialogueData.text.split(" "),t=this.commandCalls.length&&this.commandCalls[this.commandCalls.length-1].cmd==="wait"?1:0;this.commandCalls.push({cmd:i[0],params:i,time:this.dialogueText.length+t});try{this.dialogueData=this.dialogue.next().value}catch(a){n.error("Error while progressing the dialogue tree. Verify if there is a syntax error? Full error is: ",a);return}e.dialogueTree.goToNextDialogueLine()}else this.dialogueDataType="unknown"},e.dialogueTree.getBranchTitle=function(){return this.dialogueIsRunning?this.dialogueBranchTitle:""},e.dialogueTree.branchTitleIs=function(i){return this.dialogueIsRunning?this.dialogueBranchTitle===i:!1},e.dialogueTree.getBranchTags=function(){return this.dialogueIsRunning?this.dialogueBranchTags.join(","):""},e.dialogueTree.getBranchTag=function(i){return this.dialogueIsRunning&&this.dialogueBranchTags.length?(i>this.dialogueBranchTags.length-1&&(i=this.dialogueBranchTags.length-1),this.dialogueBranchTags[i]):""},e.dialogueTree.branchContainsTag=function(i){return this.tagParameters=[],this.dialogueIsRunning&&this.dialogueBranchTags.length?this.dialogueBranchTags.some(function(t){const a=t.match(/([^\(]+)\(([^\)]+)\)/i);return e.dialogueTree.tagParameters=a?a[2].split(","):[],a?a[1]===i:t===i}):!1},e.dialogueTree.getTagParameter=function(i){if(this.dialogueIsRunning&&this.tagParameters.length>=i){const t=this.tagParameters[i];return t||""}return""},e.dialogueTree.getVisitedBranchTitles=function(){return this.dialogueIsRunning?Object.keys(this.runner.visited).join(","):""},e.dialogueTree.branchTitleHasBeenVisited=function(i){return i||(i=this.dialogueBranchTitle),Object.keys(this.runner.visited).includes(i)&&this.runner.visited[i]},e.dialogueTree.getBranchText=function(){return this.dialogueIsRunning?this.dialogueBranchBody:""},e.dialogueTree.getVariable=function(i){return this.runner.variables&&i in this.runner.variables.data?this.runner.variables.get(i):""},e.dialogueTree.getVariableAsNumber=function(i){if(this.runner.variables&&i in this.runner.variables.data){const t=this.runner.variables.get(i);return typeof t!="number"?parseFloat(t)||0:isFinite(t)?t:0}return 0},e.dialogueTree.getVariableAsString=function(i){return this.runner.variables&&i in this.runner.variables.data?""+this.runner.variables.get(i):""},e.dialogueTree.compareVariable=function(i,t){return this.runner.variables&&i in this.runner.variables.data?this.runner.variables.get(i)===t:!1},e.dialogueTree.setVariable=function(i,t){this.runner.variables&&this.runner.variables.set(i,t)},e.dialogueTree.saveState=function(i){const t={variables:e.dialogueTree.runner.variables.data,visited:e.dialogueTree.runner.visited};i.fromJSObject(t)},e.dialogueTree.loadState=function(i){const t=i.toJSObject();if(!t){n.error("Load state variable is empty:",i);return}try{e.dialogueTree.runner.visited=t.visited,e.dialogueTree.runner.variables.data={},Object.keys(t.variables).forEach(function(a){const s=t.variables[a];e.dialogueTree.runner.variables.set(a,s)})}catch(a){n.error("Failed to load state from variable:",i,a)}},e.dialogueTree.clearState=function(){e.dialogueTree.runner.visited={},e.dialogueTree.runner.variables.data={}}})(gdjs||(gdjs={}));
3
3
  //# sourceMappingURL=dialoguetools.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/DialogueTree/dialoguetools.ts"],
4
- "sourcesContent": ["// @ts-nocheck - Weird usage of `this` in this file. Should be refactored.\n\nnamespace gdjs {\n const logger = new gdjs.Logger('Dialogue tree');\n\n gdjs.dialogueTree = {};\n gdjs.dialogueTree.runner = new bondage.Runner();\n\n /**\n * Load the Dialogue Tree data of the game. Initialize The Dialogue Tree, so as it can be used in the game.\n * @param sceneVar The variable to load the Dialogue tree data from. The data is a JSON string, created by Yarn.\n * @param startDialogueNode The Dialogue Branch to start the Dialogue Tree from. If left empty, the data will only be loaded, but can later be initialized via another action\n */\n gdjs.dialogueTree.loadFromSceneVariable = function (\n sceneVar: gdjs.Variable,\n startDialogueNode: string\n ) {\n this.runner = gdjs.dialogueTree.runner;\n try {\n this.yarnData = JSON.parse(sceneVar.getAsString());\n this.runner.load(this.yarnData);\n if (startDialogueNode && startDialogueNode.length > 0) {\n gdjs.dialogueTree.startFrom(startDialogueNode);\n }\n } catch (e) {\n logger.error('Error while loading from scene variable: ', e);\n }\n };\n\n /**\n * Load the Dialogue Tree data from a JSON resource.\n *\n * @param instanceContainer The scene where the dialogue is running.\n * @param jsonResourceName The JSON resource where to load the Dialogue Tree data from. The data is a JSON string usually created with [Yarn Dialogue Editor](https://github.com/InfiniteAmmoInc/Yarn).\n * @param startDialogueNode The Dialogue Branch to start the Dialogue Tree from. If left empty, the data will only be loaded, but can later be initialized via another action\n */\n gdjs.dialogueTree.loadFromJsonFile = function (\n instanceContainer: gdjs.RuntimeInstanceContainer,\n jsonResourceName: string,\n startDialogueNode: string\n ) {\n instanceContainer\n .getGame()\n .getJsonManager()\n .loadJson(jsonResourceName, function (error, content) {\n if (error) {\n logger.error('An error happened while loading JSON resource:', error);\n } else {\n if (!content) {\n return;\n }\n gdjs.dialogueTree.yarnData = content;\n try {\n gdjs.dialogueTree.runner.load(gdjs.dialogueTree.yarnData);\n } catch (error) {\n logger.error(\n 'An error happened while loading parsing the dialogue tree data:',\n error\n );\n }\n if (startDialogueNode && startDialogueNode.length > 0) {\n gdjs.dialogueTree.startFrom(startDialogueNode);\n }\n }\n });\n };\n\n /**\n * Stop the currently running dialogue\n */\n gdjs.dialogueTree.stopRunningDialogue = function () {\n if (this.dialogueIsRunning) {\n this.dialogueIsRunning = false;\n }\n if (this.dialogueData) {\n this.dialogueData = null;\n }\n this.dialogueText = '';\n this.clipTextEnd = 0;\n };\n\n /**\n * Check if the Dialogue Tree is currently parsing data.\n * For example, you can do things like disabling player movement while talking to a NPC.\n */\n gdjs.dialogueTree.isRunning = function () {\n if (\n this.dialogueIsRunning &&\n !this.dialogueData &&\n this.dialogueText &&\n this.clipTextEnd >= this.dialogueText.length\n ) {\n this.dialogueIsRunning = false;\n }\n return this.dialogueIsRunning;\n };\n\n /**\n * Scroll the clipped text. This can be combined with a timer and user input to control how fast the dialogue line text is scrolling.\n */\n gdjs.dialogueTree.scrollClippedText = function () {\n if (this.pauseScrolling || !this.dialogueIsRunning) {\n return;\n }\n\n // Autoscroll commands so the user doesn't have to press again.\n if (\n gdjs.dialogueTree._isLineTypeCommand() &&\n this.dialogueDataType === 'text' &&\n this.dialogueBranchTitle === this.dialogueData.data.title &&\n this.lineNum === this.dialogueData.lineNum &&\n gdjs.dialogueTree.hasClippedScrollingCompleted()\n ) {\n gdjs.dialogueTree.goToNextDialogueLine();\n return;\n }\n\n // Increment scrolling of clipped text\n if (\n this.dialogueText &&\n this.dialogueDataType === 'text' &&\n this.clipTextEnd < this.dialogueText.length\n ) {\n this.clipTextEnd += 1;\n }\n };\n\n /**\n * Scroll the clipped text to its end, so the entire text is printed. This can be useful in keeping the event sheet logic simpler, while supporting more variation.\n */\n gdjs.dialogueTree.completeClippedTextScrolling = function () {\n if (\n this.pauseScrolling ||\n !this.dialogueIsRunning ||\n !this.dialogueText ||\n this.dialogueDataType !== 'text'\n ) {\n return;\n }\n this.clipTextEnd = this.dialogueText.length;\n };\n\n /**\n * Check if text scrolling has completed.\n * Useful to prevent the user from skipping to next line before the current one has been printed fully.\n */\n gdjs.dialogueTree.hasClippedScrollingCompleted = function () {\n if (!this.dialogueIsRunning || this.dialogueDataType === '') {\n return false;\n }\n if (\n this.dialogueData &&\n this.dialogueText.length > 0 &&\n this.clipTextEnd >= this.dialogueText.length\n ) {\n if (gdjs.dialogueTree.getVariable('debug')) {\n logger.warn(\n 'Scroll completed:',\n this.clipTextEnd,\n '/',\n this.dialogueText.length\n );\n }\n return true;\n }\n return false;\n };\n\n /**\n * Get the current dialogue line with a scrolling effect (recommended).\n * Used with the scrollClippedText to achieve a classic scrolling text, as well as any <<wait>> effects to pause scrolling.\n */\n gdjs.dialogueTree.getClippedLineText = function () {\n return this.dialogueIsRunning && this.dialogueText.length\n ? this.dialogueText.substring(0, this.clipTextEnd + 1)\n : '';\n };\n\n /**\n * Get the current complete dialogue line without using any scrolling effects.\n * Note that using this instead getClippedLineText will skip any <<wait>> commands entirely.\n */\n gdjs.dialogueTree.getLineText = function () {\n return this.dialogueIsRunning && this.dialogueText.length\n ? this.dialogueText\n : '';\n };\n\n /**\n * Get the number of command parameters in a command with parameters that has been caught by a isCommandCalled condition\n */\n gdjs.dialogueTree.commandParametersCount = function () {\n if (this.commandParameters && this.commandParameters.length > 1) {\n return this.commandParameters.length - 1;\n }\n return 0;\n };\n\n /**\n * Get a command parameter in any command with parameters that has been caught by a isCommandCalled condition\n * @param paramIndex The index of the parameter to get.\n */\n gdjs.dialogueTree.getCommandParameter = function (paramIndex: float) {\n if (paramIndex === -1 && this.commandParameters.length > 0) {\n return this.commandParameters[0];\n }\n if (\n this.commandParameters &&\n this.commandParameters.length >= paramIndex + 1\n ) {\n const returnedParam = this.commandParameters[paramIndex + 1];\n return returnedParam ? returnedParam : '';\n }\n return '';\n };\n\n /**\n * Catch <<commands>> and <<commands with parameters>> from the current Dialogue Line.\n * You can trigger custom logic that relate to the story you are telling during the dialogue.\n *\n * @param command The command you want to check for being called. Write it without the `<<>>`.\n */\n gdjs.dialogueTree.isCommandCalled = function (command: string) {\n if (!this.dialogueIsRunning) {\n return false;\n }\n const commandCalls = gdjs.dialogueTree.commandCalls;\n const clipTextEnd = gdjs.dialogueTree.clipTextEnd;\n const dialogueText = gdjs.dialogueTree.dialogueText;\n if (this.pauseScrolling || !commandCalls) {\n return false;\n }\n return this.commandCalls.some(function (call, index) {\n if (clipTextEnd !== 0 && clipTextEnd < call.time) {\n return false;\n }\n if (\n call.cmd === 'wait' &&\n (clipTextEnd === 0 || clipTextEnd !== dialogueText.length)\n ) {\n gdjs.dialogueTree.pauseScrolling = true;\n setTimeout(function () {\n gdjs.dialogueTree.pauseScrolling = false;\n commandCalls.splice(index, 1);\n if (gdjs.dialogueTree.getVariable('debug')) {\n logger.info('CMD:', call);\n }\n }, parseInt(call.params[1], 10));\n }\n if (call.cmd === command) {\n gdjs.dialogueTree.commandParameters = call.params;\n commandCalls.splice(index, 1);\n if (gdjs.dialogueTree.getVariable('debug')) {\n logger.info('CMD:', call);\n }\n return true;\n }\n });\n };\n\n /**\n * Internal method to allow for capping option selection.\n */\n gdjs.dialogueTree._normalizedOptionIndex = function (optionIndex) {\n if (optionIndex >= this.options.length) {\n optionIndex = this.options.length - 1;\n }\n if (optionIndex < 0) {\n optionIndex = 0;\n }\n return optionIndex;\n };\n\n /**\n * Internal method to allow for cycling option selection.\n */\n gdjs.dialogueTree._cycledOptionIndex = function (optionIndex) {\n if (optionIndex >= this.options.length) {\n optionIndex = 0;\n }\n if (optionIndex < 0) {\n optionIndex = this.options.length - 1;\n }\n return optionIndex;\n };\n\n /**\n * Get the text of an option the player can select.\n * Used with getLineOptionsCount to render options for the player when a line of the Options type is parsed\n * @param optionIndex The index of the option you want to get\n */\n gdjs.dialogueTree.getLineOption = function (optionIndex: float) {\n if (!this.dialogueIsRunning || !this.options.length) {\n return [];\n }\n optionIndex = gdjs.dialogueTree._normalizedOptionIndex(optionIndex);\n return this.options[optionIndex];\n };\n\n /**\n * Get the text of the options the player can select, along with the selection cursor.\n * @param optionSelectionCursor The string used to draw the currently selected option's cursor\n * @param addNewLine when true each option is rendered on a new line.\n */\n gdjs.dialogueTree.getLineOptionsText = function (\n optionSelectionCursor: string,\n addNewLine: boolean\n ) {\n if (!this.dialogueIsRunning || !this.options.length) {\n return '';\n }\n let textResult = '';\n this.options.forEach(function (optionText, index) {\n if (index === gdjs.dialogueTree.selectedOption) {\n textResult += optionSelectionCursor;\n } else {\n textResult += optionSelectionCursor.replace(/.*/g, ' ');\n }\n textResult += optionText;\n if (addNewLine) {\n textResult += '\\n';\n }\n });\n return textResult;\n };\n gdjs.dialogueTree.getLineOptionsTextHorizontal = function (\n optionSelectionCursor\n ) {\n return this.getLineOptionsText(optionSelectionCursor, false);\n };\n gdjs.dialogueTree.getLineOptionsTextVertical = function (\n optionSelectionCursor\n ) {\n return this.getLineOptionsText(optionSelectionCursor, true);\n };\n\n /**\n * Get the number of options that are presented to the player, during the parsing of an Options type line.\n * @returns The number of options\n */\n gdjs.dialogueTree.getLineOptionsCount = function (): number {\n if (this.dialogueIsRunning && this.options.length) {\n return this.optionsCount;\n }\n return 0;\n };\n\n /**\n * Confirm the currently selected option, during the parsing of an Options type line.\n *\n * This will advance the dialogue tree to the dialogue branch was selected by the player.\n */\n gdjs.dialogueTree.confirmSelectOption = function () {\n if (!this.dialogueIsRunning) {\n return;\n }\n if (\n this.dialogueData.select &&\n !this.selectedOptionUpdated &&\n this.selectedOption !== -1\n ) {\n this.commandCalls = [];\n try {\n this.dialogueData.select(this.selectedOption);\n this.dialogueData = this.dialogue.next().value;\n gdjs.dialogueTree.goToNextDialogueLine();\n } catch (error) {\n logger.error(\n `An error happened when trying to access the dialogue branch!`,\n error\n );\n }\n }\n };\n\n /**\n * Select next option during Options type line parsing. Hook this to your game input.\n */\n gdjs.dialogueTree.selectNextOption = function () {\n if (!this.dialogueIsRunning) {\n return;\n }\n if (this.dialogueData.select) {\n this.selectedOption += 1;\n this.selectedOption = gdjs.dialogueTree._cycledOptionIndex(\n this.selectedOption\n );\n this.selectedOptionUpdated = true;\n }\n };\n\n /**\n * Select previous option during Options type line parsing. Hook this to your game input.\n */\n gdjs.dialogueTree.selectPreviousOption = function () {\n if (!this.dialogueIsRunning) {\n return;\n }\n if (this.dialogueData.select) {\n this.selectedOption -= 1;\n this.selectedOption = gdjs.dialogueTree._cycledOptionIndex(\n this.selectedOption\n );\n this.selectedOptionUpdated = true;\n }\n };\n\n /**\n * Select option by index during Options type line parsing.\n * @param optionIndex The index of the option to select\n */\n gdjs.dialogueTree.selectOption = function (optionIndex: float) {\n if (!this.dialogueIsRunning) {\n return;\n }\n if (this.dialogueData.select) {\n this.selectedOption = gdjs.dialogueTree._normalizedOptionIndex(\n optionIndex\n );\n this.selectedOptionUpdated = true;\n }\n };\n\n /**\n * Get the currently selected option\n * @returns The index of the currently selected option\n */\n gdjs.dialogueTree.getSelectedOption = function (): number {\n if (!this.dialogueIsRunning) {\n return;\n }\n if (this.dialogueData.select) {\n return this.selectedOption;\n }\n return 0;\n };\n\n /**\n * Check when the player has changed option selection since the last call to this function.\n *\n * Can be used to re-render your displayed dialogue options when needed.\n *\n * @returns true if the selected option was updated since the last call to this function\n */\n gdjs.dialogueTree.hasSelectedOptionChanged = function (): boolean {\n if (this.selectedOptionUpdated) {\n this.selectedOptionUpdated = false;\n if (this.selectedOption === -1) {\n this.selectedOption = 0;\n }\n return true;\n }\n return false;\n };\n\n /**\n * Check the type of the Dialogue Line that is being displayed to the player at the moment.\n *\n * There are three types:\n * - text - regular dialogue text is being parsed at the moment\n * - options - the player has reached a branching choice moment where they must select one of multiple options\n * - command - a <<command>> was called in the background, that can be used to trigger game events, but will not be displayed in the dialogue box.\n *\n * @param type The type you want to check for ( one of the three above )\n */\n gdjs.dialogueTree.isDialogueLineType = function (type: string) {\n if (!this.dialogueIsRunning) {\n return false;\n }\n if (this.commandCalls && type === 'command') {\n if (\n this.commandCalls.some(function (call) {\n return (\n gdjs.dialogueTree.clipTextEnd > call.time && call.cmd === 'wait'\n );\n })\n ) {\n return !this.pauseScrolling;\n }\n if (this.commandCalls.length > 0 && this.commandParameters.length > 0) {\n return true;\n }\n }\n return this.dialogueDataType === type;\n };\n\n /**\n * Check if a branch exists. It is also used internally whenever you use the start from action.\n * @param branchName The Dialogue Branch name you want to check.\n */\n gdjs.dialogueTree.hasDialogueBranch = function (branchName: string) {\n return (\n this.runner &&\n this.runner.yarnNodes &&\n Object.keys(this.runner.yarnNodes).some(function (node) {\n return node === branchName;\n })\n );\n };\n\n /**\n * Start parsing dialogue from a specified Dialogue tree branch.\n * Can be used if you want to store multiple dialogues inside a single Dialogue tree data set.\n * @param startDialogueNode The Dialogue Branch name you want to start parsing from.\n */\n gdjs.dialogueTree.startFrom = function (startDialogueNode: string) {\n this.runner = gdjs.dialogueTree.runner;\n if (!this.hasDialogueBranch(startDialogueNode)) {\n return;\n }\n this.optionsCount = 0;\n this.options = [];\n this.tagParameters = [];\n this.dialogue = this.runner.run(startDialogueNode);\n this.dialogueText = '';\n this.clipTextEnd = 0;\n this.commandCalls = [];\n this.commandParameters = [];\n this.pauseScrolling = false;\n this.dialogueData = this.dialogue.next().value;\n this.dialogueBranchTags = this.dialogueData.data.tags;\n this.dialogueBranchTitle = this.dialogueData.data.title;\n this.dialogueBranchBody = this.dialogueData.data.body;\n this.lineNum = this.dialogueData.lineNum;\n if (gdjs.dialogueTree._isLineTypeText()) {\n this.dialogueDataType = 'text';\n } else {\n if (gdjs.dialogueTree._isLineTypeOptions()) {\n this.dialogueDataType = 'options';\n } else {\n this.dialogueDataType = 'command';\n }\n }\n this.dialogueIsRunning = true;\n gdjs.dialogueTree.goToNextDialogueLine();\n };\n\n /**\n * Internal methods to check the type of a Dialogue Line\n */\n gdjs.dialogueTree._isLineTypeText = function () {\n return this.dialogueData instanceof bondage.TextResult;\n };\n gdjs.dialogueTree._isLineTypeOptions = function () {\n return this.dialogueData instanceof bondage.OptionsResult;\n };\n gdjs.dialogueTree._isLineTypeCommand = function () {\n return this.dialogueData instanceof bondage.CommandResult;\n };\n\n /**\n * This is the main lifecycle function.It runs once only when the user is advancing the dialogue to the next line.\n * Progress Dialogue to the next line. Hook it to your game input.\n * Note that this action can be influenced by any <<wait>> commands, but they work only if you have at least one isCommandCalled condition.\n */\n gdjs.dialogueTree.goToNextDialogueLine = function () {\n if (this.pauseScrolling || !this.dialogueIsRunning) {\n return;\n }\n this.optionsCount = 0;\n this.selectedOption = -1;\n this.selectedOptionUpdated = false;\n if (gdjs.dialogueTree.getVariable('debug')) {\n logger.info('Parsing:', this.dialogueData);\n }\n if (!this.dialogueData) {\n gdjs.dialogueTree.stopRunningDialogue();\n } else {\n if (gdjs.dialogueTree._isLineTypeText()) {\n if (\n this.lineNum === this.dialogueData.lineNum &&\n this.dialogueBranchTitle === this.dialogueData.data.title\n ) {\n this.clipTextEnd = this.dialogueText.length - 1;\n this.dialogueText +=\n (this.dialogueText === '' ? '' : ' ') + this.dialogueData.text;\n } else {\n this.clipTextEnd = 0;\n this.dialogueText = this.dialogueData.text;\n }\n this.dialogueBranchTags = this.dialogueData.data.tags;\n this.dialogueBranchTitle = this.dialogueData.data.title;\n this.dialogueBranchBody = this.dialogueData.data.body;\n this.lineNum = this.dialogueData.lineNum;\n this.dialogueDataType = 'text';\n this.dialogueData = this.dialogue.next().value;\n } else {\n if (gdjs.dialogueTree._isLineTypeOptions()) {\n this.commandCalls = [];\n this.dialogueDataType = 'options';\n this.dialogueText = '';\n this.clipTextEnd = 0;\n this.optionsCount = this.dialogueData.options.length;\n this.options = this.dialogueData.options;\n this.selectedOptionUpdated = true;\n } else {\n if (gdjs.dialogueTree._isLineTypeCommand()) {\n this.dialogueDataType = 'command';\n const command = this.dialogueData.text.split(' ');\n\n // If last command was to wait, increase time by one\n const offsetTime =\n this.commandCalls.length &&\n this.commandCalls[this.commandCalls.length - 1].cmd === 'wait'\n ? 1\n : 0;\n this.commandCalls.push({\n cmd: command[0],\n params: command,\n time: this.dialogueText.length + offsetTime,\n });\n this.dialogueData = this.dialogue.next().value;\n gdjs.dialogueTree.goToNextDialogueLine();\n } else {\n this.dialogueDataType = 'unknown';\n }\n }\n }\n }\n };\n\n /**\n * Get the current Dialogue Tree branch title.\n * @returns The current branch title.\n */\n gdjs.dialogueTree.getBranchTitle = function (): string {\n if (this.dialogueIsRunning) {\n return this.dialogueBranchTitle;\n }\n return '';\n };\n\n /**\n * Check if the currently parsed Dialogue branch title is a query.\n * @param title The Dialogue Branch name you want to check for.\n */\n gdjs.dialogueTree.branchTitleIs = function (title: string) {\n if (this.dialogueIsRunning) {\n return this.dialogueBranchTitle === title;\n }\n return false;\n };\n\n /**\n * Get all the branch tags from the current Dialogue branch as a string. Useful for debugging.\n * @returns The current branch tags, separated by a comma.\n */\n gdjs.dialogueTree.getBranchTags = function (): string {\n if (this.dialogueIsRunning) {\n return this.dialogueBranchTags.join(',');\n }\n return '';\n };\n\n /**\n * Get one of the current Dialogue branch tags via index.\n * @param index The index of the Dialogue Branch tag you want to get.\n * @returns The branch tag at the specified index, or an empty string if not found.\n */\n gdjs.dialogueTree.getBranchTag = function (index: float): string {\n if (this.dialogueIsRunning && this.dialogueBranchTags.length) {\n if (index > this.dialogueBranchTags.length - 1) {\n index = this.dialogueBranchTags.length - 1;\n }\n return this.dialogueBranchTags[index];\n }\n return '';\n };\n\n /**\n * Check if the current Dialogue branch contains a specific tag.\n * @param query The name of the Dialogue Branch tag you want to check.\n */\n gdjs.dialogueTree.branchContainsTag = function (query: string) {\n this.tagParameters = [];\n if (this.dialogueIsRunning && this.dialogueBranchTags.length) {\n return this.dialogueBranchTags.some(function (tag) {\n const splitTag = tag.match(/([^\\(]+)\\(([^\\)]+)\\)/i);\n gdjs.dialogueTree.tagParameters = splitTag\n ? splitTag[2].split(',')\n : [];\n return splitTag ? splitTag[1] === query : tag === query;\n });\n }\n return false;\n };\n\n /**\n * Get any tag(parameter,anotherParameter) from a tag captured by the branchContainsTag Condition\n * @param paramIndex The index of the tag parameter you want to get.\n * Leaving this empty will result in retrieving the first parameter.\n */\n gdjs.dialogueTree.getTagParameter = function (paramIndex: float) {\n if (this.dialogueIsRunning && this.tagParameters.length >= paramIndex) {\n const returnedParam = this.tagParameters[paramIndex];\n return returnedParam ? returnedParam : '';\n }\n return '';\n };\n\n /**\n * Get a list of all the titles of visited by the player Branches. Useful for debugging.\n */\n gdjs.dialogueTree.getVisitedBranchTitles = function () {\n if (this.dialogueIsRunning) {\n return Object.keys(this.runner.visited).join(',');\n }\n return '';\n };\n\n /**\n * Check if a player has visited a Dialogue Branch in the past.\n * @param title The title of the branch to check for.\n * Leaving this empty will check if the current branch title has been visited in the past.\n */\n gdjs.dialogueTree.branchTitleHasBeenVisited = function (title: string) {\n if (!title) {\n title = this.dialogueBranchTitle;\n }\n return (\n Object.keys(this.runner.visited).includes(title) &&\n this.runner.visited[title]\n );\n };\n\n /**\n * Get the entire unparsed text of the current Dialogue Branch\n */\n gdjs.dialogueTree.getBranchText = function () {\n if (this.dialogueIsRunning) {\n return this.dialogueBranchBody;\n }\n return '';\n };\n\n /**\n * Get the value of a variable that was created by the Dialogue parses.\n * @param key The name of the variable you want to get the value of\n */\n gdjs.dialogueTree.getVariable = function (key: string) {\n if (this.runner.variables && key in this.runner.variables.data) {\n return this.runner.variables.get(key);\n }\n return '';\n };\n\n /**\n * Check if a specific variable created by the Dialogue parses exists and is equal to a specific value.\n * @param key The name of the variable you want to check the value of\n * @param value The value you want to check against\n */\n gdjs.dialogueTree.compareVariable = function (\n key: string,\n value: string | boolean | number\n ) {\n if (this.runner.variables && key in this.runner.variables.data) {\n return this.runner.variables.get(key) === value;\n }\n return false;\n };\n\n /**\n * Set a specific variable created by the Dialogue parser to a specific value.\n * @param key The name of the variable you want to set the value of\n * @param value The value you want to set\n */\n gdjs.dialogueTree.setVariable = function (\n key: string,\n value: string | boolean | number\n ) {\n if (this.runner.variables) {\n this.runner.variables.set(key, value);\n }\n };\n\n /**\n * Store the current State of the Dialogue Parser in a specified variable.\n * Can be used to implement persistence in dialogue through your game's Load/Save function.\n * That way you can later load all the dialogue choices the player has made.\n * @param outputVariable The variable where to store the State\n */\n gdjs.dialogueTree.saveState = function (outputVariable: gdjs.Variable) {\n const dialogueState = {\n variables: gdjs.dialogueTree.runner.variables.data,\n visited: gdjs.dialogueTree.runner.visited,\n };\n outputVariable.fromJSObject(dialogueState);\n };\n\n /**\n * Load the current State of the Dialogue Parser from a specified variable.\n * Can be used to implement persistence in dialogue through your game's Load/Save function.\n * That way you can later load all the dialogue choices the player has made.\n * @param inputVariable The structured variable where to load the State from.\n */\n gdjs.dialogueTree.loadState = function (inputVariable: gdjs.Variable) {\n const loadedState = inputVariable.toJSObject();\n if (!loadedState) {\n logger.error('Load state variable is empty:', inputVariable);\n return;\n }\n try {\n gdjs.dialogueTree.runner.visited = loadedState.visited;\n gdjs.dialogueTree.runner.variables.data = {};\n Object.keys(loadedState.variables).forEach(function (key) {\n const value = loadedState.variables[key];\n gdjs.dialogueTree.runner.variables.set(key, value);\n });\n } catch (e) {\n logger.error('Failed to load state from variable:', inputVariable, e);\n }\n };\n\n /**\n * Clear the current State of the Dialogue Parser.\n */\n gdjs.dialogueTree.clearState = function () {\n gdjs.dialogueTree.runner.visited = {};\n gdjs.dialogueTree.runner.variables.data = {};\n };\n}\n"],
5
- "mappings": "AAEA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,iBAE/B,EAAK,aAAe,GACpB,EAAK,aAAa,OAAS,GAAI,SAAQ,OAOvC,EAAK,aAAa,sBAAwB,SACxC,EACA,EACA,CACA,KAAK,OAAS,EAAK,aAAa,OAChC,GAAI,CACF,KAAK,SAAW,KAAK,MAAM,EAAS,eACpC,KAAK,OAAO,KAAK,KAAK,UAClB,GAAqB,EAAkB,OAAS,GAClD,EAAK,aAAa,UAAU,SAEvB,EAAP,CACA,EAAO,MAAM,4CAA6C,KAW9D,EAAK,aAAa,iBAAmB,SACnC,EACA,EACA,EACA,CACA,EACG,UACA,iBACA,SAAS,EAAkB,SAAU,EAAO,EAAS,CACpD,GAAI,EACF,EAAO,MAAM,iDAAkD,OAC1D,CACL,GAAI,CAAC,EACH,OAEF,EAAK,aAAa,SAA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AQ,SAAU,EAAK,CACxD,KAAM,GAAQ,EAAY,UAAU,GACpC,EAAK,aAAa,OAAO,UAAU,IAAI,EAAK,WAEvC,EAAP,CACA,EAAO,MAAM,sCAAuC,EAAe,KAOvE,EAAK,aAAa,WAAa,UAAY,CACzC,EAAK,aAAa,OAAO,QAAU,GACnC,EAAK,aAAa,OAAO,UAAU,KAAO,MAhzBpC",
4
+ "sourcesContent": ["// @ts-nocheck - Weird usage of `this` in this file. Should be refactored.\n\nnamespace gdjs {\n const logger = new gdjs.Logger('Dialogue tree');\n\n gdjs.dialogueTree = {};\n gdjs.dialogueTree.runner = new bondage.Runner();\n\n /**\n * Load the Dialogue Tree data of the game. Initialize The Dialogue Tree, so as it can be used in the game.\n * @param sceneVar The variable to load the Dialogue tree data from. The data is a JSON string, created by Yarn.\n * @param startDialogueNode The Dialogue Branch to start the Dialogue Tree from. If left empty, the data will only be loaded, but can later be initialized via another action\n */\n gdjs.dialogueTree.loadFromSceneVariable = function (\n sceneVar: gdjs.Variable,\n startDialogueNode: string\n ) {\n this.runner = gdjs.dialogueTree.runner;\n try {\n this.yarnData = JSON.parse(sceneVar.getAsString());\n this.runner.load(this.yarnData);\n if (startDialogueNode && startDialogueNode.length > 0) {\n gdjs.dialogueTree.startFrom(startDialogueNode);\n }\n } catch (e) {\n logger.error('Error while loading from scene variable: ', e);\n }\n };\n\n /**\n * Load the Dialogue Tree data from a JSON resource.\n *\n * @param instanceContainer The scene where the dialogue is running.\n * @param jsonResourceName The JSON resource where to load the Dialogue Tree data from. The data is a JSON string usually created with [Yarn Dialogue Editor](https://github.com/InfiniteAmmoInc/Yarn).\n * @param startDialogueNode The Dialogue Branch to start the Dialogue Tree from. If left empty, the data will only be loaded, but can later be initialized via another action\n */\n gdjs.dialogueTree.loadFromJsonFile = function (\n instanceContainer: gdjs.RuntimeInstanceContainer,\n jsonResourceName: string,\n startDialogueNode: string\n ) {\n instanceContainer\n .getGame()\n .getJsonManager()\n .loadJson(jsonResourceName, function (error, content) {\n if (error) {\n logger.error('An error happened while loading JSON resource:', error);\n } else {\n if (!content) {\n return;\n }\n gdjs.dialogueTree.yarnData = content;\n try {\n gdjs.dialogueTree.runner.load(gdjs.dialogueTree.yarnData);\n } catch (error) {\n logger.error(\n 'An error happened while loading parsing the dialogue tree data:',\n error\n );\n }\n if (startDialogueNode && startDialogueNode.length > 0) {\n gdjs.dialogueTree.startFrom(startDialogueNode);\n }\n }\n });\n };\n\n /**\n * Stop the currently running dialogue\n */\n gdjs.dialogueTree.stopRunningDialogue = function () {\n if (this.dialogueIsRunning) {\n this.dialogueIsRunning = false;\n }\n if (this.dialogueData) {\n this.dialogueData = null;\n }\n this.dialogueText = '';\n this.clipTextEnd = 0;\n };\n\n /**\n * Check if the Dialogue Tree is currently parsing data.\n * For example, you can do things like disabling player movement while talking to a NPC.\n */\n gdjs.dialogueTree.isRunning = function () {\n if (\n this.dialogueIsRunning &&\n !this.dialogueData &&\n this.dialogueText &&\n this.clipTextEnd >= this.dialogueText.length\n ) {\n this.dialogueIsRunning = false;\n }\n return this.dialogueIsRunning;\n };\n\n /**\n * Scroll the clipped text. This can be combined with a timer and user input to control how fast the dialogue line text is scrolling.\n */\n gdjs.dialogueTree.scrollClippedText = function () {\n if (this.pauseScrolling || !this.dialogueIsRunning) {\n return;\n }\n\n // Autoscroll commands so the user doesn't have to press again.\n if (\n gdjs.dialogueTree._isLineTypeCommand() &&\n this.dialogueDataType === 'text' &&\n this.dialogueBranchTitle === this.dialogueData.data.title &&\n this.lineNum === this.dialogueData.lineNum &&\n gdjs.dialogueTree.hasClippedScrollingCompleted()\n ) {\n gdjs.dialogueTree.goToNextDialogueLine();\n return;\n }\n\n // Increment scrolling of clipped text\n if (\n this.dialogueText &&\n this.dialogueDataType === 'text' &&\n this.clipTextEnd < this.dialogueText.length\n ) {\n this.clipTextEnd += 1;\n }\n };\n\n /**\n * Scroll the clipped text to its end, so the entire text is printed. This can be useful in keeping the event sheet logic simpler, while supporting more variation.\n */\n gdjs.dialogueTree.completeClippedTextScrolling = function () {\n if (\n this.pauseScrolling ||\n !this.dialogueIsRunning ||\n !this.dialogueText ||\n this.dialogueDataType !== 'text'\n ) {\n return;\n }\n this.clipTextEnd = this.dialogueText.length;\n };\n\n /**\n * Check if text scrolling has completed.\n * Useful to prevent the user from skipping to next line before the current one has been printed fully.\n */\n gdjs.dialogueTree.hasClippedScrollingCompleted = function () {\n if (!this.dialogueIsRunning || this.dialogueDataType === '') {\n return false;\n }\n if (\n this.dialogueData &&\n this.dialogueText.length > 0 &&\n this.clipTextEnd >= this.dialogueText.length\n ) {\n if (gdjs.dialogueTree.getVariable('debug')) {\n logger.warn(\n 'Scroll completed:',\n this.clipTextEnd,\n '/',\n this.dialogueText.length\n );\n }\n return true;\n }\n return false;\n };\n\n /**\n * Get the current dialogue line with a scrolling effect (recommended).\n * Used with the scrollClippedText to achieve a classic scrolling text, as well as any <<wait>> effects to pause scrolling.\n */\n gdjs.dialogueTree.getClippedLineText = function () {\n return this.dialogueIsRunning && this.dialogueText.length\n ? this.dialogueText.substring(0, this.clipTextEnd + 1)\n : '';\n };\n\n /**\n * Get the current complete dialogue line without using any scrolling effects.\n * Note that using this instead getClippedLineText will skip any <<wait>> commands entirely.\n */\n gdjs.dialogueTree.getLineText = function () {\n return this.dialogueIsRunning && this.dialogueText.length\n ? this.dialogueText\n : '';\n };\n\n /**\n * Get the number of command parameters in a command with parameters that has been caught by a isCommandCalled condition\n */\n gdjs.dialogueTree.commandParametersCount = function () {\n if (this.commandParameters && this.commandParameters.length > 1) {\n return this.commandParameters.length - 1;\n }\n return 0;\n };\n\n /**\n * Get a command parameter in any command with parameters that has been caught by a isCommandCalled condition\n * @param paramIndex The index of the parameter to get.\n */\n gdjs.dialogueTree.getCommandParameter = function (paramIndex: float) {\n if (paramIndex === -1 && this.commandParameters.length > 0) {\n return this.commandParameters[0];\n }\n if (\n this.commandParameters &&\n this.commandParameters.length >= paramIndex + 1\n ) {\n const returnedParam = this.commandParameters[paramIndex + 1];\n return returnedParam ? returnedParam : '';\n }\n return '';\n };\n\n /**\n * Catch <<commands>> and <<commands with parameters>> from the current Dialogue Line.\n * You can trigger custom logic that relate to the story you are telling during the dialogue.\n *\n * @param command The command you want to check for being called. Write it without the `<<>>`.\n */\n gdjs.dialogueTree.isCommandCalled = function (command: string) {\n if (!this.dialogueIsRunning) {\n return false;\n }\n const commandCalls = gdjs.dialogueTree.commandCalls;\n const clipTextEnd = gdjs.dialogueTree.clipTextEnd;\n const dialogueText = gdjs.dialogueTree.dialogueText;\n if (this.pauseScrolling || !commandCalls) {\n return false;\n }\n return this.commandCalls.some(function (call, index) {\n if (clipTextEnd !== 0 && clipTextEnd < call.time) {\n return false;\n }\n if (\n call.cmd === 'wait' &&\n (clipTextEnd === 0 || clipTextEnd !== dialogueText.length)\n ) {\n gdjs.dialogueTree.pauseScrolling = true;\n setTimeout(function () {\n gdjs.dialogueTree.pauseScrolling = false;\n commandCalls.splice(index, 1);\n if (gdjs.dialogueTree.getVariable('debug')) {\n logger.info('CMD:', call);\n }\n }, parseInt(call.params[1], 10));\n }\n if (call.cmd === command) {\n gdjs.dialogueTree.commandParameters = call.params;\n commandCalls.splice(index, 1);\n if (gdjs.dialogueTree.getVariable('debug')) {\n logger.info('CMD:', call);\n }\n return true;\n }\n });\n };\n\n /**\n * Internal method to allow for capping option selection.\n */\n gdjs.dialogueTree._normalizedOptionIndex = function (optionIndex) {\n if (optionIndex >= this.options.length) {\n optionIndex = this.options.length - 1;\n }\n if (optionIndex < 0) {\n optionIndex = 0;\n }\n return optionIndex;\n };\n\n /**\n * Internal method to allow for cycling option selection.\n */\n gdjs.dialogueTree._cycledOptionIndex = function (optionIndex) {\n if (optionIndex >= this.options.length) {\n optionIndex = 0;\n }\n if (optionIndex < 0) {\n optionIndex = this.options.length - 1;\n }\n return optionIndex;\n };\n\n /**\n * Get the text of an option the player can select.\n * Used with getLineOptionsCount to render options for the player when a line of the Options type is parsed\n * @param optionIndex The index of the option you want to get\n */\n gdjs.dialogueTree.getLineOption = function (optionIndex: float) {\n if (!this.dialogueIsRunning || !this.options.length) {\n return [];\n }\n optionIndex = gdjs.dialogueTree._normalizedOptionIndex(optionIndex);\n return this.options[optionIndex];\n };\n\n /**\n * Get the text of the options the player can select, along with the selection cursor.\n * @param optionSelectionCursor The string used to draw the currently selected option's cursor\n * @param addNewLine when true each option is rendered on a new line.\n */\n gdjs.dialogueTree.getLineOptionsText = function (\n optionSelectionCursor: string,\n addNewLine: boolean\n ) {\n if (!this.dialogueIsRunning || !this.options.length) {\n return '';\n }\n let textResult = '';\n this.options.forEach(function (optionText, index) {\n if (index === gdjs.dialogueTree.selectedOption) {\n textResult += optionSelectionCursor;\n } else {\n textResult += optionSelectionCursor.replace(/.*/g, ' ');\n }\n textResult += optionText;\n if (addNewLine) {\n textResult += '\\n';\n }\n });\n return textResult;\n };\n gdjs.dialogueTree.getLineOptionsTextHorizontal = function (\n optionSelectionCursor\n ) {\n return this.getLineOptionsText(optionSelectionCursor, false);\n };\n gdjs.dialogueTree.getLineOptionsTextVertical = function (\n optionSelectionCursor\n ) {\n return this.getLineOptionsText(optionSelectionCursor, true);\n };\n\n /**\n * Get the number of options that are presented to the player, during the parsing of an Options type line.\n * @returns The number of options\n */\n gdjs.dialogueTree.getLineOptionsCount = function (): number {\n if (this.dialogueIsRunning && this.options.length) {\n return this.optionsCount;\n }\n return 0;\n };\n\n /**\n * Confirm the currently selected option, during the parsing of an Options type line.\n *\n * This will advance the dialogue tree to the dialogue branch was selected by the player.\n */\n gdjs.dialogueTree.confirmSelectOption = function () {\n if (!this.dialogueIsRunning) {\n return;\n }\n if (\n this.dialogueData.select &&\n !this.selectedOptionUpdated &&\n this.selectedOption !== -1\n ) {\n this.commandCalls = [];\n try {\n this.dialogueData.select(this.selectedOption);\n try {\n this.dialogueData = this.dialogue.next().value;\n } catch (error) {\n logger.error(\n 'Error while confirming in the dialogue tree. Verify if there is a syntax error? Full error is: ',\n error\n );\n return;\n }\n gdjs.dialogueTree.goToNextDialogueLine();\n } catch (error) {\n logger.error(\n `An error happened when trying to access the dialogue branch!`,\n error\n );\n }\n }\n };\n\n /**\n * Select next option during Options type line parsing. Hook this to your game input.\n */\n gdjs.dialogueTree.selectNextOption = function () {\n if (!this.dialogueIsRunning) {\n return;\n }\n if (this.dialogueData.select) {\n this.selectedOption += 1;\n this.selectedOption = gdjs.dialogueTree._cycledOptionIndex(\n this.selectedOption\n );\n this.selectedOptionUpdated = true;\n }\n };\n\n /**\n * Select previous option during Options type line parsing. Hook this to your game input.\n */\n gdjs.dialogueTree.selectPreviousOption = function () {\n if (!this.dialogueIsRunning) {\n return;\n }\n if (this.dialogueData.select) {\n this.selectedOption -= 1;\n this.selectedOption = gdjs.dialogueTree._cycledOptionIndex(\n this.selectedOption\n );\n this.selectedOptionUpdated = true;\n }\n };\n\n /**\n * Select option by index during Options type line parsing.\n * @param optionIndex The index of the option to select\n */\n gdjs.dialogueTree.selectOption = function (optionIndex: float) {\n if (!this.dialogueIsRunning) {\n return;\n }\n if (this.dialogueData.select) {\n this.selectedOption = gdjs.dialogueTree._normalizedOptionIndex(\n optionIndex\n );\n this.selectedOptionUpdated = true;\n }\n };\n\n /**\n * Get the currently selected option\n * @returns The index of the currently selected option\n */\n gdjs.dialogueTree.getSelectedOption = function (): number {\n if (!this.dialogueIsRunning) {\n return;\n }\n if (this.dialogueData.select) {\n return this.selectedOption;\n }\n return 0;\n };\n\n /**\n * Check when the player has changed option selection since the last call to this function.\n *\n * Can be used to re-render your displayed dialogue options when needed.\n *\n * @returns true if the selected option was updated since the last call to this function\n */\n gdjs.dialogueTree.hasSelectedOptionChanged = function (): boolean {\n if (this.selectedOptionUpdated) {\n this.selectedOptionUpdated = false;\n if (this.selectedOption === -1) {\n this.selectedOption = 0;\n }\n return true;\n }\n return false;\n };\n\n /**\n * Check the type of the Dialogue Line that is being displayed to the player at the moment.\n *\n * There are three types:\n * - text - regular dialogue text is being parsed at the moment\n * - options - the player has reached a branching choice moment where they must select one of multiple options\n * - command - a <<command>> was called in the background, that can be used to trigger game events, but will not be displayed in the dialogue box.\n *\n * @param type The type you want to check for ( one of the three above )\n */\n gdjs.dialogueTree.isDialogueLineType = function (type: string) {\n if (!this.dialogueIsRunning) {\n return false;\n }\n if (this.commandCalls && type === 'command') {\n if (\n this.commandCalls.some(function (call) {\n return (\n gdjs.dialogueTree.clipTextEnd > call.time && call.cmd === 'wait'\n );\n })\n ) {\n return !this.pauseScrolling;\n }\n if (this.commandCalls.length > 0 && this.commandParameters.length > 0) {\n return true;\n }\n }\n return this.dialogueDataType === type;\n };\n\n /**\n * Check if a branch exists. It is also used internally whenever you use the start from action.\n * @param branchName The Dialogue Branch name you want to check.\n */\n gdjs.dialogueTree.hasDialogueBranch = function (branchName: string) {\n return (\n this.runner &&\n this.runner.yarnNodes &&\n Object.keys(this.runner.yarnNodes).some(function (node) {\n return node === branchName;\n })\n );\n };\n\n /**\n * Start parsing dialogue from a specified Dialogue tree branch.\n * Can be used if you want to store multiple dialogues inside a single Dialogue tree data set.\n * @param startDialogueNode The Dialogue Branch name you want to start parsing from.\n */\n gdjs.dialogueTree.startFrom = function (startDialogueNode: string) {\n this.runner = gdjs.dialogueTree.runner;\n if (!this.hasDialogueBranch(startDialogueNode)) {\n return;\n }\n this.optionsCount = 0;\n this.options = [];\n this.tagParameters = [];\n try {\n this.dialogue = this.runner.run(startDialogueNode);\n } catch (error) {\n logger.error(\n 'Error while setting up the dialogue tree. Verify if there is a syntax error? Full error is: ',\n error\n );\n return;\n }\n this.dialogueText = '';\n this.clipTextEnd = 0;\n this.commandCalls = [];\n this.commandParameters = [];\n this.pauseScrolling = false;\n try {\n this.dialogueData = this.dialogue.next().value;\n } catch (error) {\n logger.error(\n 'Error while starting the dialogue tree. Verify if there is a syntax error? Full error is: ',\n error\n );\n return;\n }\n this.dialogueBranchTags = this.dialogueData.data.tags;\n this.dialogueBranchTitle = this.dialogueData.data.title;\n this.dialogueBranchBody = this.dialogueData.data.body;\n this.lineNum = this.dialogueData.lineNum;\n if (gdjs.dialogueTree._isLineTypeText()) {\n this.dialogueDataType = 'text';\n } else {\n if (gdjs.dialogueTree._isLineTypeOptions()) {\n this.dialogueDataType = 'options';\n } else {\n this.dialogueDataType = 'command';\n }\n }\n this.dialogueIsRunning = true;\n gdjs.dialogueTree.goToNextDialogueLine();\n };\n\n /**\n * Internal methods to check the type of a Dialogue Line\n */\n gdjs.dialogueTree._isLineTypeText = function () {\n return this.dialogueData instanceof bondage.TextResult;\n };\n gdjs.dialogueTree._isLineTypeOptions = function () {\n return this.dialogueData instanceof bondage.OptionsResult;\n };\n gdjs.dialogueTree._isLineTypeCommand = function () {\n return this.dialogueData instanceof bondage.CommandResult;\n };\n\n /**\n * This is the main lifecycle function.It runs once only when the user is advancing the dialogue to the next line.\n * Progress Dialogue to the next line. Hook it to your game input.\n * Note that this action can be influenced by any <<wait>> commands, but they work only if you have at least one isCommandCalled condition.\n */\n gdjs.dialogueTree.goToNextDialogueLine = function () {\n if (this.pauseScrolling || !this.dialogueIsRunning) {\n return;\n }\n this.optionsCount = 0;\n this.selectedOption = -1;\n this.selectedOptionUpdated = false;\n if (gdjs.dialogueTree.getVariable('debug')) {\n logger.info('Parsing:', this.dialogueData);\n }\n if (!this.dialogueData) {\n gdjs.dialogueTree.stopRunningDialogue();\n } else {\n if (gdjs.dialogueTree._isLineTypeText()) {\n if (\n this.lineNum === this.dialogueData.lineNum &&\n this.dialogueBranchTitle === this.dialogueData.data.title\n ) {\n this.clipTextEnd = this.dialogueText.length - 1;\n this.dialogueText +=\n (this.dialogueText === '' ? '' : ' ') + this.dialogueData.text;\n } else {\n this.clipTextEnd = 0;\n this.dialogueText = this.dialogueData.text;\n }\n this.dialogueBranchTags = this.dialogueData.data.tags;\n this.dialogueBranchTitle = this.dialogueData.data.title;\n this.dialogueBranchBody = this.dialogueData.data.body;\n this.lineNum = this.dialogueData.lineNum;\n this.dialogueDataType = 'text';\n try {\n this.dialogueData = this.dialogue.next().value;\n } catch (error) {\n logger.error(\n 'Error while progressing the dialogue tree. Verify if there is a syntax error? Full error is: ',\n error\n );\n return;\n }\n } else {\n if (gdjs.dialogueTree._isLineTypeOptions()) {\n this.commandCalls = [];\n this.dialogueDataType = 'options';\n this.dialogueText = '';\n this.clipTextEnd = 0;\n this.optionsCount = this.dialogueData.options.length;\n this.options = this.dialogueData.options;\n this.selectedOptionUpdated = true;\n } else {\n if (gdjs.dialogueTree._isLineTypeCommand()) {\n this.dialogueDataType = 'command';\n const command = this.dialogueData.text.split(' ');\n\n // If last command was to wait, increase time by one\n const offsetTime =\n this.commandCalls.length &&\n this.commandCalls[this.commandCalls.length - 1].cmd === 'wait'\n ? 1\n : 0;\n this.commandCalls.push({\n cmd: command[0],\n params: command,\n time: this.dialogueText.length + offsetTime,\n });\n try {\n this.dialogueData = this.dialogue.next().value;\n } catch (error) {\n logger.error(\n 'Error while progressing the dialogue tree. Verify if there is a syntax error? Full error is: ',\n error\n );\n return;\n }\n gdjs.dialogueTree.goToNextDialogueLine();\n } else {\n this.dialogueDataType = 'unknown';\n }\n }\n }\n }\n };\n\n /**\n * Get the current Dialogue Tree branch title.\n * @returns The current branch title.\n */\n gdjs.dialogueTree.getBranchTitle = function (): string {\n if (this.dialogueIsRunning) {\n return this.dialogueBranchTitle;\n }\n return '';\n };\n\n /**\n * Check if the currently parsed Dialogue branch title is a query.\n * @param title The Dialogue Branch name you want to check for.\n */\n gdjs.dialogueTree.branchTitleIs = function (title: string) {\n if (this.dialogueIsRunning) {\n return this.dialogueBranchTitle === title;\n }\n return false;\n };\n\n /**\n * Get all the branch tags from the current Dialogue branch as a string. Useful for debugging.\n * @returns The current branch tags, separated by a comma.\n */\n gdjs.dialogueTree.getBranchTags = function (): string {\n if (this.dialogueIsRunning) {\n return this.dialogueBranchTags.join(',');\n }\n return '';\n };\n\n /**\n * Get one of the current Dialogue branch tags via index.\n * @param index The index of the Dialogue Branch tag you want to get.\n * @returns The branch tag at the specified index, or an empty string if not found.\n */\n gdjs.dialogueTree.getBranchTag = function (index: float): string {\n if (this.dialogueIsRunning && this.dialogueBranchTags.length) {\n if (index > this.dialogueBranchTags.length - 1) {\n index = this.dialogueBranchTags.length - 1;\n }\n return this.dialogueBranchTags[index];\n }\n return '';\n };\n\n /**\n * Check if the current Dialogue branch contains a specific tag.\n * @param query The name of the Dialogue Branch tag you want to check.\n */\n gdjs.dialogueTree.branchContainsTag = function (query: string) {\n this.tagParameters = [];\n if (this.dialogueIsRunning && this.dialogueBranchTags.length) {\n return this.dialogueBranchTags.some(function (tag) {\n const splitTag = tag.match(/([^\\(]+)\\(([^\\)]+)\\)/i);\n gdjs.dialogueTree.tagParameters = splitTag\n ? splitTag[2].split(',')\n : [];\n return splitTag ? splitTag[1] === query : tag === query;\n });\n }\n return false;\n };\n\n /**\n * Get any tag(parameter,anotherParameter) from a tag captured by the branchContainsTag Condition\n * @param paramIndex The index of the tag parameter you want to get.\n * Leaving this empty will result in retrieving the first parameter.\n */\n gdjs.dialogueTree.getTagParameter = function (paramIndex: float) {\n if (this.dialogueIsRunning && this.tagParameters.length >= paramIndex) {\n const returnedParam = this.tagParameters[paramIndex];\n return returnedParam ? returnedParam : '';\n }\n return '';\n };\n\n /**\n * Get a list of all the titles of visited by the player Branches. Useful for debugging.\n */\n gdjs.dialogueTree.getVisitedBranchTitles = function () {\n if (this.dialogueIsRunning) {\n return Object.keys(this.runner.visited).join(',');\n }\n return '';\n };\n\n /**\n * Check if a player has visited a Dialogue Branch in the past.\n * @param title The title of the branch to check for.\n * Leaving this empty will check if the current branch title has been visited in the past.\n */\n gdjs.dialogueTree.branchTitleHasBeenVisited = function (title: string) {\n if (!title) {\n title = this.dialogueBranchTitle;\n }\n return (\n Object.keys(this.runner.visited).includes(title) &&\n this.runner.visited[title]\n );\n };\n\n /**\n * Get the entire unparsed text of the current Dialogue Branch\n */\n gdjs.dialogueTree.getBranchText = function () {\n if (this.dialogueIsRunning) {\n return this.dialogueBranchBody;\n }\n return '';\n };\n\n /**\n * Get the value of a variable stored in the dialogue state.\n * @param key The variable name\n */\n gdjs.dialogueTree.getVariable = function (\n key: string\n ): string | float | boolean {\n if (this.runner.variables && key in this.runner.variables.data) {\n return this.runner.variables.get(key);\n }\n return '';\n };\n\n /**\n * Get the value of a variable stored in the dialogue state.\n * @param key The variable name\n */\n gdjs.dialogueTree.getVariableAsNumber = function (key: string): float {\n if (this.runner.variables && key in this.runner.variables.data) {\n const value = this.runner.variables.get(key);\n if (typeof value !== 'number') {\n return parseFloat(value) || 0;\n }\n\n return isFinite(value) ? value : 0;\n }\n return 0;\n };\n\n /**\n * Get the value of a variable stored in the dialogue state.\n * @param key The variable name\n */\n gdjs.dialogueTree.getVariableAsString = function (key: string): string {\n if (this.runner.variables && key in this.runner.variables.data) {\n return '' + this.runner.variables.get(key);\n }\n return '';\n };\n\n /**\n * Check if a specific variable created by the Dialogue parses exists and is equal to a specific value.\n * @param key The name of the variable you want to check the value of\n * @param value The value you want to check against\n */\n gdjs.dialogueTree.compareVariable = function (\n key: string,\n value: string | boolean | number\n ) {\n if (this.runner.variables && key in this.runner.variables.data) {\n return this.runner.variables.get(key) === value;\n }\n return false;\n };\n\n /**\n * Set a specific variable created by the Dialogue parser to a specific value.\n * @param key The name of the variable you want to set the value of\n * @param value The value you want to set\n */\n gdjs.dialogueTree.setVariable = function (\n key: string,\n value: string | boolean | number\n ) {\n if (this.runner.variables) {\n this.runner.variables.set(key, value);\n }\n };\n\n /**\n * Store the current State of the Dialogue Parser in a specified variable.\n * Can be used to implement persistence in dialogue through your game's Load/Save function.\n * That way you can later load all the dialogue choices the player has made.\n * @param outputVariable The variable where to store the State\n */\n gdjs.dialogueTree.saveState = function (outputVariable: gdjs.Variable) {\n const dialogueState = {\n variables: gdjs.dialogueTree.runner.variables.data,\n visited: gdjs.dialogueTree.runner.visited,\n };\n outputVariable.fromJSObject(dialogueState);\n };\n\n /**\n * Load the current State of the Dialogue Parser from a specified variable.\n * Can be used to implement persistence in dialogue through your game's Load/Save function.\n * That way you can later load all the dialogue choices the player has made.\n * @param inputVariable The structured variable where to load the State from.\n */\n gdjs.dialogueTree.loadState = function (inputVariable: gdjs.Variable) {\n const loadedState = inputVariable.toJSObject();\n if (!loadedState) {\n logger.error('Load state variable is empty:', inputVariable);\n return;\n }\n try {\n gdjs.dialogueTree.runner.visited = loadedState.visited;\n gdjs.dialogueTree.runner.variables.data = {};\n Object.keys(loadedState.variables).forEach(function (key) {\n const value = loadedState.variables[key];\n gdjs.dialogueTree.runner.variables.set(key, value);\n });\n } catch (e) {\n logger.error('Failed to load state from variable:', inputVariable, e);\n }\n };\n\n /**\n * Clear the current State of the Dialogue Parser.\n */\n gdjs.dialogueTree.clearState = function () {\n gdjs.dialogueTree.runner.visited = {};\n gdjs.dialogueTree.runner.variables.data = {};\n };\n}\n"],
5
+ "mappings": "AAEA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,iBAE/B,EAAK,aAAe,GACpB,EAAK,aAAa,OAAS,GAAI,SAAQ,OAOvC,EAAK,aAAa,sBAAwB,SACxC,EACA,EACA,CACA,KAAK,OAAS,EAAK,aAAa,OAChC,GAAI,CACF,KAAK,SAAW,KAAK,MAAM,EAAS,eACpC,KAAK,OAAO,KAAK,KAAK,UAClB,GAAqB,EAAkB,OAAS,GAClD,EAAK,aAAa,UAAU,SAEvB,EAAP,CACA,EAAO,MAAM,4CAA6C,KAW9D,EAAK,aAAa,iBAAmB,SACnC,EACA,EACA,EACA,CACA,EACG,UACA,iBACA,SAAS,EAAkB,SAAU,EAAO,EAAS,CACpD,GAAI,EACF,EAAO,MAAM,iDAAkD,OAC1D,CACL,GAAI,CAAC,EACH,OAEF,EAAK,aAAa,SAAW,EAC7B,GAAI,CACF,EAAK,aAAa,OAAO,KAAK,EAAK,aAAa,gBACzC,EAAP,CACA,EAAO,MACL,kEACA,GAGJ,AAAI,GAAqB,EAAkB,OAAS,GAClD,EAAK,aAAa,UAAU,OAStC,EAAK,aAAa,oBAAs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C9B,EACA,EACA,CACA,AAAI,KAAK,OAAO,WACd,KAAK,OAAO,UAAU,IAAI,EAAK,IAUnC,EAAK,aAAa,UAAY,SAAU,EAA+B,CACrE,KAAM,GAAgB,CACpB,UAAW,EAAK,aAAa,OAAO,UAAU,KAC9C,QAAS,EAAK,aAAa,OAAO,SAEpC,EAAe,aAAa,IAS9B,EAAK,aAAa,UAAY,SAAU,EAA8B,CACpE,KAAM,GAAc,EAAc,aAClC,GAAI,CAAC,EAAa,CAChB,EAAO,MAAM,gCAAiC,GAC9C,OAEF,GAAI,CACF,EAAK,aAAa,OAAO,QAAU,EAAY,QAC/C,EAAK,aAAa,OAAO,UAAU,KAAO,GAC1C,OAAO,KAAK,EAAY,WAAW,QAAQ,SAAU,EAAK,CACxD,KAAM,GAAQ,EAAY,UAAU,GACpC,EAAK,aAAa,OAAO,UAAU,IAAI,EAAK,WAEvC,EAAP,CACA,EAAO,MAAM,sCAAuC,EAAe,KAOvE,EAAK,aAAa,WAAa,UAAY,CACzC,EAAK,aAAa,OAAO,QAAU,GACnC,EAAK,aAAa,OAAO,UAAU,KAAO,MAr3BpC",
6
6
  "names": []
7
7
  }
@@ -882,6 +882,11 @@ module.exports = {
882
882
  )
883
883
  .addCodeOnlyParameter('currentScene', '')
884
884
  .addParameter('variable', _('Variable'), '', false)
885
+ .setParameterLongDescription(
886
+ _(
887
+ 'Only root variables can change ownership. Arrays and structures children are synchronized with their parent.'
888
+ )
889
+ )
885
890
  .useStandardParameters(
886
891
  'number',
887
892
  gd.ParameterOptions.makeNewOptions().setDescription(_('Player number'))
@@ -916,6 +921,11 @@ module.exports = {
916
921
  )
917
922
  .addCodeOnlyParameter('currentScene', '')
918
923
  .addParameter('variable', _('Variable'), '', false)
924
+ .setParameterLongDescription(
925
+ _(
926
+ 'Only root variables can change ownership. Arrays and structures children are synchronized with their parent.'
927
+ )
928
+ )
919
929
  .setHelpPath('/all-features/multiplayer')
920
930
  .getCodeExtraInformation()
921
931
  .setIncludeFile('Extensions/Multiplayer/peer.js')
@@ -947,6 +957,11 @@ module.exports = {
947
957
  )
948
958
  .addCodeOnlyParameter('currentScene', '')
949
959
  .addParameter('variable', _('Variable'), '', false)
960
+ .setParameterLongDescription(
961
+ _(
962
+ 'Only root variables can change ownership. Arrays and structures children are synchronized with their parent.'
963
+ )
964
+ )
950
965
  .setHelpPath('/all-features/multiplayer')
951
966
  .getCodeExtraInformation()
952
967
  .setIncludeFile('Extensions/Multiplayer/peer.js')