gdcore-tools 2.0.0-gd-v5.5.241-autobuild → 2.0.0-gd-v5.5.243-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 (132) hide show
  1. package/dist/Runtime/AsyncTasksManager.js +2 -2
  2. package/dist/Runtime/AsyncTasksManager.js.map +2 -2
  3. package/dist/Runtime/CustomRuntimeObject.js +1 -1
  4. package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
  5. package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js +1 -1
  6. package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
  7. package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js +1 -1
  8. package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js.map +2 -2
  9. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js +1 -1
  10. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +2 -2
  11. package/dist/Runtime/Extensions/3D/JsExtension.js +47 -0
  12. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js +1 -1
  13. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js.map +2 -2
  14. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js +1 -1
  15. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js.map +2 -2
  16. package/dist/Runtime/Extensions/3D/Skybox.js +2 -0
  17. package/dist/Runtime/Extensions/3D/Skybox.js.map +7 -0
  18. package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js +1 -1
  19. package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
  20. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js +1 -1
  21. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
  22. package/dist/Runtime/Extensions/DebuggerTools/JsExtension.js +3 -1
  23. package/dist/Runtime/Extensions/DestroyOutsideBehavior/destroyoutsideruntimebehavior.js +1 -1
  24. package/dist/Runtime/Extensions/DestroyOutsideBehavior/destroyoutsideruntimebehavior.js.map +2 -2
  25. package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js +1 -1
  26. package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js.map +2 -2
  27. package/dist/Runtime/Extensions/Multiplayer/messageManager.js +1 -1
  28. package/dist/Runtime/Extensions/Multiplayer/messageManager.js.map +2 -2
  29. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js +1 -1
  30. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +2 -2
  31. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js +1 -1
  32. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
  33. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js +1 -1
  34. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
  35. package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js +1 -1
  36. package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js.map +2 -2
  37. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js +1 -1
  38. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
  39. package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js +1 -1
  40. package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js.map +2 -2
  41. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCar3DRuntimeBehavior.js +1 -1
  42. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCar3DRuntimeBehavior.js.map +2 -2
  43. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js +1 -1
  44. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js.map +2 -2
  45. package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js +1 -1
  46. package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js.map +2 -2
  47. package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js +1 -1
  48. package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js.map +2 -2
  49. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js +1 -1
  50. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
  51. package/dist/Runtime/Extensions/SaveState/JsExtension.js +488 -0
  52. package/dist/Runtime/Extensions/SaveState/SaveConfigurationRuntimeBehavior.js +2 -0
  53. package/dist/Runtime/Extensions/SaveState/SaveConfigurationRuntimeBehavior.js.map +7 -0
  54. package/dist/Runtime/Extensions/SaveState/SaveStateTools.js +2 -0
  55. package/dist/Runtime/Extensions/SaveState/SaveStateTools.js.map +7 -0
  56. package/dist/Runtime/Extensions/Spine/spineruntimeobject.js +1 -1
  57. package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
  58. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js +1 -1
  59. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
  60. package/dist/Runtime/Extensions/TextObject/textruntimeobject.js +1 -1
  61. package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
  62. package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts +4 -4
  63. package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js +1 -1
  64. package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +2 -2
  65. package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js +1 -1
  66. package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
  67. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js +1 -1
  68. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js.map +2 -2
  69. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js +1 -1
  70. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
  71. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js +1 -1
  72. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
  73. package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js +1 -1
  74. package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js.map +2 -2
  75. package/dist/Runtime/Extensions/TweenBehavior/TweenManager.js +2 -2
  76. package/dist/Runtime/Extensions/TweenBehavior/TweenManager.js.map +2 -2
  77. package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js +1 -1
  78. package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js.map +2 -2
  79. package/dist/Runtime/Extensions/TweenBehavior/tweentools.js +1 -1
  80. package/dist/Runtime/Extensions/TweenBehavior/tweentools.js.map +2 -2
  81. package/dist/Runtime/Extensions/Video/videoruntimeobject.js +1 -1
  82. package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
  83. package/dist/Runtime/RuntimeInstanceContainer.js +1 -1
  84. package/dist/Runtime/RuntimeInstanceContainer.js.map +2 -2
  85. package/dist/Runtime/RuntimeLayer.js +1 -1
  86. package/dist/Runtime/RuntimeLayer.js.map +2 -2
  87. package/dist/Runtime/debugger-client/hot-reloader.js +1 -1
  88. package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
  89. package/dist/Runtime/events-tools/objecttools.js +1 -1
  90. package/dist/Runtime/events-tools/objecttools.js.map +2 -2
  91. package/dist/Runtime/events-tools/runtimescenetools.js +1 -1
  92. package/dist/Runtime/events-tools/runtimescenetools.js.map +2 -2
  93. package/dist/Runtime/gd.js +1 -1
  94. package/dist/Runtime/gd.js.map +2 -2
  95. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js +1 -1
  96. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js.map +2 -2
  97. package/dist/Runtime/indexeddb.js +2 -0
  98. package/dist/Runtime/indexeddb.js.map +7 -0
  99. package/dist/Runtime/oncetriggers.js +1 -1
  100. package/dist/Runtime/oncetriggers.js.map +2 -2
  101. package/dist/Runtime/pixi-renderers/pixi-image-manager.js +1 -1
  102. package/dist/Runtime/pixi-renderers/pixi-image-manager.js.map +2 -2
  103. package/dist/Runtime/pixi-renderers/runtimescene-pixi-renderer.js +2 -2
  104. package/dist/Runtime/pixi-renderers/runtimescene-pixi-renderer.js.map +2 -2
  105. package/dist/Runtime/runtimebehavior.js +1 -1
  106. package/dist/Runtime/runtimebehavior.js.map +2 -2
  107. package/dist/Runtime/runtimegame.js +1 -1
  108. package/dist/Runtime/runtimegame.js.map +2 -2
  109. package/dist/Runtime/runtimeobject.js +1 -1
  110. package/dist/Runtime/runtimeobject.js.map +2 -2
  111. package/dist/Runtime/runtimescene.js +1 -1
  112. package/dist/Runtime/runtimescene.js.map +2 -2
  113. package/dist/Runtime/scenestack.js +1 -1
  114. package/dist/Runtime/scenestack.js.map +2 -2
  115. package/dist/Runtime/spriteruntimeobject.js +1 -1
  116. package/dist/Runtime/spriteruntimeobject.js.map +2 -2
  117. package/dist/Runtime/timemanager.js +1 -1
  118. package/dist/Runtime/timemanager.js.map +2 -2
  119. package/dist/Runtime/timer.js +1 -1
  120. package/dist/Runtime/timer.js.map +2 -2
  121. package/dist/Runtime/types/global-types.d.ts +29 -0
  122. package/dist/Runtime/types/project-data.d.ts +144 -3
  123. package/dist/Runtime/types/save-state.d.ts +9 -0
  124. package/dist/Runtime/variable.js +1 -1
  125. package/dist/Runtime/variable.js.map +2 -2
  126. package/dist/Runtime/variablescontainer.js +1 -1
  127. package/dist/Runtime/variablescontainer.js.map +2 -2
  128. package/dist/lib/libGD.cjs +1 -1
  129. package/dist/lib/libGD.wasm +0 -0
  130. package/dist/loaders.cjs +1 -1
  131. package/gd.d.ts +1 -0
  132. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../GDevelop/Extensions/3D/Skybox.ts"],
4
+ "sourcesContent": ["namespace gdjs {\n interface SkyboxFilterNetworkSyncData {}\n gdjs.PixiFiltersTools.registerFilterCreator(\n 'Scene3D::Skybox',\n new (class implements gdjs.PixiFiltersTools.FilterCreator {\n makeFilter(\n target: EffectsTarget,\n effectData: EffectData\n ): gdjs.PixiFiltersTools.Filter {\n if (typeof THREE === 'undefined') {\n return new gdjs.PixiFiltersTools.EmptyFilter();\n }\n return new (class implements gdjs.PixiFiltersTools.Filter {\n _cubeTexture: THREE.CubeTexture;\n _oldBackground:\n | THREE.CubeTexture\n | THREE.Texture\n | THREE.Color\n | null = null;\n _isEnabled: boolean = false;\n\n constructor() {\n this._cubeTexture = target\n .getRuntimeScene()\n .getGame()\n .getImageManager()\n .getThreeCubeTexture(\n effectData.stringParameters.rightFaceResourceName,\n effectData.stringParameters.leftFaceResourceName,\n effectData.stringParameters.topFaceResourceName,\n effectData.stringParameters.bottomFaceResourceName,\n effectData.stringParameters.frontFaceResourceName,\n effectData.stringParameters.backFaceResourceName\n );\n }\n\n isEnabled(target: EffectsTarget): boolean {\n return this._isEnabled;\n }\n setEnabled(target: EffectsTarget, enabled: boolean): boolean {\n if (this._isEnabled === enabled) {\n return true;\n }\n if (enabled) {\n return this.applyEffect(target);\n } else {\n return this.removeEffect(target);\n }\n }\n applyEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene) {\n return false;\n }\n // TODO Add a background stack in LayerPixiRenderer to allow\n // filters to stack them.\n this._oldBackground = scene.background;\n scene.background = this._cubeTexture;\n if (!scene.environment) {\n scene.environment = this._cubeTexture;\n }\n this._isEnabled = true;\n return true;\n }\n removeEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene) {\n return false;\n }\n scene.background = this._oldBackground;\n scene.environment = null;\n this._isEnabled = false;\n return true;\n }\n updatePreRender(target: gdjs.EffectsTarget): any {}\n updateDoubleParameter(parameterName: string, value: number): void {}\n getDoubleParameter(parameterName: string): number {\n return 0;\n }\n updateStringParameter(parameterName: string, value: string): void {}\n updateColorParameter(parameterName: string, value: number): void {}\n getColorParameter(parameterName: string): number {\n return 0;\n }\n updateBooleanParameter(parameterName: string, value: boolean): void {}\n getNetworkSyncData(): SkyboxFilterNetworkSyncData {\n return {};\n }\n updateFromNetworkSyncData(\n syncData: SkyboxFilterNetworkSyncData\n ): void {}\n })();\n }\n })()\n );\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAEE,EAAK,iBAAiB,sBACpB,kBACA,GAAK,MAAqD,CACxD,WACE,EACA,EAC8B,CAC9B,MAAI,OAAO,QAAU,YACZ,GAAI,GAAK,iBAAiB,YAE5B,GAAK,MAA8C,CASxD,aAAc,CAPd,oBAIW,KACX,gBAAsB,GAGpB,KAAK,aAAe,EACjB,kBACA,UACA,kBACA,oBACC,EAAW,iBAAiB,sBAC5B,EAAW,iBAAiB,qBAC5B,EAAW,iBAAiB,oBAC5B,EAAW,iBAAiB,uBAC5B,EAAW,iBAAiB,sBAC5B,EAAW,iBAAiB,sBAIlC,UAAU,EAAgC,CACxC,MAAO,MAAK,WAEd,WAAW,EAAuB,EAA2B,CAC3D,MAAI,MAAK,aAAe,EACf,GAEL,EACK,KAAK,YAAY,GAEjB,KAAK,aAAa,GAG7B,YAAY,EAAgC,CAC1C,KAAM,GAAQ,EAAO,sBAIrB,MAAK,GAKL,MAAK,eAAiB,EAAM,WAC5B,EAAM,WAAa,KAAK,aACnB,EAAM,aACT,GAAM,YAAc,KAAK,cAE3B,KAAK,WAAa,GACX,IAVE,GAYX,aAAa,EAAgC,CAC3C,KAAM,GAAQ,EAAO,sBAIrB,MAAK,GAGL,GAAM,WAAa,KAAK,eACxB,EAAM,YAAc,KACpB,KAAK,WAAa,GACX,IALE,GAOX,gBAAgB,EAAiC,EACjD,sBAAsB,EAAuB,EAAqB,EAClE,mBAAmB,EAA+B,CAChD,MAAO,GAET,sBAAsB,EAAuB,EAAqB,EAClE,qBAAqB,EAAuB,EAAqB,EACjE,kBAAkB,EAA+B,CAC/C,MAAO,GAET,uBAAuB,EAAuB,EAAsB,EACpE,oBAAkD,CAChD,MAAO,GAET,0BACE,EACM,SAhGR",
6
+ "names": []
7
+ }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(i){class n extends i.RuntimeObject{constructor(t,e){super(t,e);this._wrapping=!1;this._wrappingWidth=250;this._opacity=parseFloat(e.content.opacity),this._text=e.content.text,this._color=i.rgbOrHexToRGBColor(e.content.color),this._fontFamily=e.content.fontFamily,this._fontSize=parseFloat(e.content.fontSize),this._textAlign=e.content.align,this._verticalTextAlignment=e.content.verticalTextAlignment||"top",this.hidden=!e.content.visible,this._renderer=new i.BBTextRuntimeObjectRenderer(this,t),this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}updateFromObjectData(t,e){return t.content.opacity!==e.content.opacity&&this.setOpacity(e.content.opacity),t.content.visible!==e.content.visible&&this.hide(!e.content.visible),t.content.text!==e.content.text&&this.setBBText(e.content.text),t.content.color!==e.content.color&&(this._color=i.rgbOrHexToRGBColor(e.content.color),this._renderer.updateColor()),t.content.fontFamily!==e.content.fontFamily&&this.setFontFamily(e.content.fontFamily),t.content.fontSize!==e.content.fontSize&&this.setFontSize(e.content.fontSize),t.content.wordWrap!==e.content.wordWrap&&this.setWrapping(e.content.wordWrap),t.content.align!==e.content.align&&this.setTextAlignment(e.content.align),t.content.verticalTextAlignment!==e.content.verticalTextAlignment&&this.setVerticalTextAlignment(e.content.verticalTextAlignment),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),text:this._text,o:this._opacity,c:this._color,ff:this._fontFamily,fs:this._fontSize,wwrap:this._wrapping,wwidth:this._wrappingWidth,align:this._textAlign,vta:this._verticalTextAlignment,hidden:this.hidden}}updateFromNetworkSyncData(t){super.updateFromNetworkSyncData(t),this._text!==void 0&&this.setBBText(t.text),this._opacity!==void 0&&this.setOpacity(t.o),this._color!==void 0&&(this._color=t.c,this._renderer.updateColor()),this._fontFamily!==void 0&&this.setFontFamily(t.ff),this._fontSize!==void 0&&this.setFontSize(t.fs),this._wrapping!==void 0&&this.setWrapping(t.wwrap),this._wrappingWidth!==void 0&&this.setWrappingWidth(t.wwidth),this._textAlign!==void 0&&this.setTextAlignment(t.align),this._verticalTextAlignment!==void 0&&this.setVerticalTextAlignment(t.vta),this.hidden!==void 0&&this.hide(t.hidden)}extraInitializationFromInitialInstance(t){t.customSize?(this.setWrappingWidth(t.width),this.setWrapping(!0)):this.setWrappingWidth(250),t.opacity!==void 0&&this.setOpacity(t.opacity)}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}setBBText(t){this._text=t,this._renderer.updateText(),this.invalidateHitboxes()}getBBText(){return this._text}setColor(t){this._color=i.rgbOrHexToRGBColor(t),this._renderer.updateColor()}getColor(){return this._color[0]+";"+this._color[1]+";"+this._color[2]}setFontSize(t){this._fontSize=t,this._renderer.updateFontSize()}getFontSize(){return this._fontSize}setFontFamily(t){this._fontFamily=t,this._renderer.updateFontFamily()}getFontFamily(){return this._fontFamily}setAlignment(t){this.setTextAlignment(t)}setTextAlignment(t){this._textAlign=t,this._renderer.updateAlignment()}getAlignment(){return this.getTextAlignment()}getTextAlignment(){return this._textAlign}setVerticalTextAlignment(t){this._verticalTextAlignment=t,this._renderer.updatePosition()}getVerticalTextAlignment(){return this._verticalTextAlignment}setX(t){super.setX(t),this._renderer.updatePosition()}setY(t){super.setY(t),this._renderer.updatePosition()}setAngle(t){super.setAngle(t),this._renderer.updateAngle()}setOpacity(t){t<0&&(t=0),t>255&&(t=255),this._opacity=t,this._renderer.updateOpacity()}getOpacity(){return this._opacity}setWrappingWidth(t){this._wrappingWidth!==t&&(this._wrappingWidth=t,this._renderer.updateWrappingWidth(),this.invalidateHitboxes())}getWrappingWidth(){return this._wrappingWidth}setWrapping(t){this._wrapping!==t&&(this._wrapping=t,this._renderer.updateWordWrap(),this.invalidateHitboxes())}isWrapping(){return this._wrapping}getWidth(){return this._wrapping?this._wrappingWidth:this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}setWidth(t){this.setWrappingWidth(t)}getDrawableY(){return this.getY()-(this._verticalTextAlignment==="center"?this.getHeight()/2:this._verticalTextAlignment==="bottom"?this.getHeight():0)}}i.BBTextRuntimeObject=n,i.registerObject("BBText::BBText",i.BBTextRuntimeObject)})(gdjs||(gdjs={}));
1
+ var gdjs;(function(i){class n extends i.RuntimeObject{constructor(t,e){super(t,e);this._wrapping=!1;this._wrappingWidth=250;this._opacity=parseFloat(e.content.opacity),this._text=e.content.text,this._color=i.rgbOrHexToRGBColor(e.content.color),this._fontFamily=e.content.fontFamily,this._fontSize=parseFloat(e.content.fontSize),this._textAlign=e.content.align,this._verticalTextAlignment=e.content.verticalTextAlignment||"top",this.hidden=!e.content.visible,this._renderer=new i.BBTextRuntimeObjectRenderer(this,t),this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}updateFromObjectData(t,e){return t.content.opacity!==e.content.opacity&&this.setOpacity(e.content.opacity),t.content.visible!==e.content.visible&&this.hide(!e.content.visible),t.content.text!==e.content.text&&this.setBBText(e.content.text),t.content.color!==e.content.color&&(this._color=i.rgbOrHexToRGBColor(e.content.color),this._renderer.updateColor()),t.content.fontFamily!==e.content.fontFamily&&this.setFontFamily(e.content.fontFamily),t.content.fontSize!==e.content.fontSize&&this.setFontSize(e.content.fontSize),t.content.wordWrap!==e.content.wordWrap&&this.setWrapping(e.content.wordWrap),t.content.align!==e.content.align&&this.setTextAlignment(e.content.align),t.content.verticalTextAlignment!==e.content.verticalTextAlignment&&this.setVerticalTextAlignment(e.content.verticalTextAlignment),!0}getNetworkSyncData(t){return{...super.getNetworkSyncData(t),text:this._text,o:this._opacity,c:this._color,ff:this._fontFamily,fs:this._fontSize,wwrap:this._wrapping,wwidth:this._wrappingWidth,align:this._textAlign,vta:this._verticalTextAlignment,hidden:this.hidden}}updateFromNetworkSyncData(t,e){super.updateFromNetworkSyncData(t,e),this._text!==void 0&&this.setBBText(t.text),this._opacity!==void 0&&this.setOpacity(t.o),this._color!==void 0&&(this._color=t.c,this._renderer.updateColor()),this._fontFamily!==void 0&&this.setFontFamily(t.ff),this._fontSize!==void 0&&this.setFontSize(t.fs),this._wrapping!==void 0&&this.setWrapping(t.wwrap),this._wrappingWidth!==void 0&&this.setWrappingWidth(t.wwidth),this._textAlign!==void 0&&this.setTextAlignment(t.align),this._verticalTextAlignment!==void 0&&this.setVerticalTextAlignment(t.vta),this.hidden!==void 0&&this.hide(t.hidden)}extraInitializationFromInitialInstance(t){t.customSize?(this.setWrappingWidth(t.width),this.setWrapping(!0)):this.setWrappingWidth(250),t.opacity!==void 0&&this.setOpacity(t.opacity)}onDestroyed(){super.onDestroyed(),this._renderer.destroy()}setBBText(t){this._text=t,this._renderer.updateText(),this.invalidateHitboxes()}getBBText(){return this._text}setColor(t){this._color=i.rgbOrHexToRGBColor(t),this._renderer.updateColor()}getColor(){return this._color[0]+";"+this._color[1]+";"+this._color[2]}setFontSize(t){this._fontSize=t,this._renderer.updateFontSize()}getFontSize(){return this._fontSize}setFontFamily(t){this._fontFamily=t,this._renderer.updateFontFamily()}getFontFamily(){return this._fontFamily}setAlignment(t){this.setTextAlignment(t)}setTextAlignment(t){this._textAlign=t,this._renderer.updateAlignment()}getAlignment(){return this.getTextAlignment()}getTextAlignment(){return this._textAlign}setVerticalTextAlignment(t){this._verticalTextAlignment=t,this._renderer.updatePosition()}getVerticalTextAlignment(){return this._verticalTextAlignment}setX(t){super.setX(t),this._renderer.updatePosition()}setY(t){super.setY(t),this._renderer.updatePosition()}setAngle(t){super.setAngle(t),this._renderer.updateAngle()}setOpacity(t){t<0&&(t=0),t>255&&(t=255),this._opacity=t,this._renderer.updateOpacity()}getOpacity(){return this._opacity}setWrappingWidth(t){this._wrappingWidth!==t&&(this._wrappingWidth=t,this._renderer.updateWrappingWidth(),this.invalidateHitboxes())}getWrappingWidth(){return this._wrappingWidth}setWrapping(t){this._wrapping!==t&&(this._wrapping=t,this._renderer.updateWordWrap(),this.invalidateHitboxes())}isWrapping(){return this._wrapping}getWidth(){return this._wrapping?this._wrappingWidth:this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}setWidth(t){this.setWrappingWidth(t)}getDrawableY(){return this.getY()-(this._verticalTextAlignment==="center"?this.getHeight()/2:this._verticalTextAlignment==="bottom"?this.getHeight():0)}}i.BBTextRuntimeObject=n,i.registerObject("BBText::BBText",i.BBTextRuntimeObject)})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=bbtextruntimeobject.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/BBText/bbtextruntimeobject.ts"],
4
- "sourcesContent": ["namespace gdjs {\n /** Base parameters for {@link gdjs.BBTextRuntimeObject} */\n export type BBTextObjectDataType = {\n /** The base parameters of the BBText */\n content: {\n /** The opacity of the BBText */\n opacity: number;\n /** Deprecated - Is the text visible? */\n visible: boolean;\n /** Content of the text */\n text: string;\n /** The color of the text */\n color: string;\n /** The font of the text */\n fontFamily: string;\n /** The size of the text */\n fontSize: number;\n /** Activate word wrap if set to true */\n wordWrap: boolean;\n /** Alignment of the text: \"left\", \"center\" or \"right\" */\n align: 'left' | 'center' | 'right';\n verticalTextAlignment: 'top' | 'center' | 'bottom';\n };\n };\n export type BBTextObjectData = ObjectData & BBTextObjectDataType;\n\n export type BBTextObjectNetworkSyncDataType = {\n text: string;\n o: float;\n c: number[];\n ff: string;\n fs: number;\n wwrap: boolean;\n wwidth: float;\n align: string;\n vta: string;\n hidden: boolean;\n };\n\n export type BBTextObjectNetworkSyncData = ObjectNetworkSyncData &\n BBTextObjectNetworkSyncDataType;\n\n /**\n * Displays a rich text using BBCode markup (allowing to set parts of the text as bold, italic, use different colors and shadows).\n */\n export class BBTextRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.OpacityHandler\n {\n _opacity: float;\n\n _text: string;\n\n /** color in format [r, g, b], where each component is in the range [0, 255] */\n _color: integer[];\n _fontFamily: string;\n _fontSize: float;\n\n _wrapping: boolean = false;\n _wrappingWidth: float = 250;\n\n _textAlign: string;\n _verticalTextAlignment: string;\n\n _renderer: gdjs.BBTextRuntimeObjectRenderer;\n\n // While this should rather be exposed as a property for all objects, honor the \"visible\"\n // property that is specific to this object.\n hidden: boolean;\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param objectData The object data used to initialize the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: BBTextObjectData\n ) {\n super(instanceContainer, objectData);\n // @ts-ignore - parseFloat should not be required, but GDevelop 5.0 beta 92 and below were storing it as a string.\n this._opacity = parseFloat(objectData.content.opacity);\n this._text = objectData.content.text;\n this._color = gdjs.rgbOrHexToRGBColor(objectData.content.color);\n this._fontFamily = objectData.content.fontFamily;\n // @ts-ignore - parseFloat should not be required, but GDevelop 5.0 beta 92 and below were storing it as a string.\n this._fontSize = parseFloat(objectData.content.fontSize);\n this._textAlign = objectData.content.align;\n this._verticalTextAlignment =\n objectData.content.verticalTextAlignment || 'top';\n this.hidden = !objectData.content.visible;\n\n this._renderer = new gdjs.BBTextRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n override getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n // @ts-ignore\n override updateFromObjectData(\n oldObjectData: BBTextObjectDataType,\n newObjectData: BBTextObjectDataType\n ): boolean {\n if (oldObjectData.content.opacity !== newObjectData.content.opacity) {\n this.setOpacity(newObjectData.content.opacity);\n }\n if (oldObjectData.content.visible !== newObjectData.content.visible) {\n this.hide(!newObjectData.content.visible);\n }\n if (oldObjectData.content.text !== newObjectData.content.text) {\n this.setBBText(newObjectData.content.text);\n }\n if (oldObjectData.content.color !== newObjectData.content.color) {\n this._color = gdjs.rgbOrHexToRGBColor(newObjectData.content.color);\n this._renderer.updateColor();\n }\n if (\n oldObjectData.content.fontFamily !== newObjectData.content.fontFamily\n ) {\n this.setFontFamily(newObjectData.content.fontFamily);\n }\n if (oldObjectData.content.fontSize !== newObjectData.content.fontSize) {\n this.setFontSize(newObjectData.content.fontSize);\n }\n if (oldObjectData.content.wordWrap !== newObjectData.content.wordWrap) {\n this.setWrapping(newObjectData.content.wordWrap);\n }\n if (oldObjectData.content.align !== newObjectData.content.align) {\n this.setTextAlignment(newObjectData.content.align);\n }\n if (\n oldObjectData.content.verticalTextAlignment !==\n newObjectData.content.verticalTextAlignment\n ) {\n this.setVerticalTextAlignment(\n newObjectData.content.verticalTextAlignment\n );\n }\n return true;\n }\n\n override getNetworkSyncData(): BBTextObjectNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n text: this._text,\n o: this._opacity,\n c: this._color,\n ff: this._fontFamily,\n fs: this._fontSize,\n wwrap: this._wrapping,\n wwidth: this._wrappingWidth,\n align: this._textAlign,\n vta: this._verticalTextAlignment,\n hidden: this.hidden,\n };\n }\n\n override updateFromNetworkSyncData(\n networkSyncData: BBTextObjectNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n if (this._text !== undefined) {\n this.setBBText(networkSyncData.text);\n }\n if (this._opacity !== undefined) {\n this.setOpacity(networkSyncData.o);\n }\n if (this._color !== undefined) {\n this._color = networkSyncData.c;\n this._renderer.updateColor();\n }\n if (this._fontFamily !== undefined) {\n this.setFontFamily(networkSyncData.ff);\n }\n if (this._fontSize !== undefined) {\n this.setFontSize(networkSyncData.fs);\n }\n if (this._wrapping !== undefined) {\n this.setWrapping(networkSyncData.wwrap);\n }\n if (this._wrappingWidth !== undefined) {\n this.setWrappingWidth(networkSyncData.wwidth);\n }\n if (this._textAlign !== undefined) {\n this.setTextAlignment(networkSyncData.align);\n }\n if (this._verticalTextAlignment !== undefined) {\n this.setVerticalTextAlignment(networkSyncData.vta);\n }\n if (this.hidden !== undefined) {\n this.hide(networkSyncData.hidden);\n }\n }\n\n override extraInitializationFromInitialInstance(\n initialInstanceData: InstanceData\n ) {\n if (initialInstanceData.customSize) {\n this.setWrappingWidth(initialInstanceData.width);\n this.setWrapping(true);\n } else {\n this.setWrappingWidth(\n // This value is the default wrapping width of the runtime object.\n 250\n );\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n }\n\n override onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n /**\n * Set the markup text to display.\n */\n setBBText(text: string): void {\n this._text = text;\n this._renderer.updateText();\n this.invalidateHitboxes();\n }\n\n /**\n * Get the markup text displayed by the object.\n */\n getBBText() {\n return this._text;\n }\n\n setColor(rgbColorString: string): void {\n this._color = gdjs.rgbOrHexToRGBColor(rgbColorString);\n this._renderer.updateColor();\n }\n\n /**\n * Get the base color.\n * @return The color as a \"R;G;B\" string, for example: \"255;0;0\"\n */\n getColor(): string {\n return this._color[0] + ';' + this._color[1] + ';' + this._color[2];\n }\n\n setFontSize(fontSize: float): void {\n this._fontSize = fontSize;\n this._renderer.updateFontSize();\n }\n\n getFontSize() {\n return this._fontSize;\n }\n\n setFontFamily(fontFamily: string): void {\n this._fontFamily = fontFamily;\n this._renderer.updateFontFamily();\n }\n\n getFontFamily(): string {\n return this._fontFamily;\n }\n\n /**\n * @deprecated Use `setTextAlignment` instead\n */\n setAlignment(align: string): void {\n this.setTextAlignment(align);\n }\n\n setTextAlignment(align: string): void {\n this._textAlign = align;\n this._renderer.updateAlignment();\n }\n\n /**\n * @deprecated Use `getTextAlignment` instead\n */\n getAlignment(): string {\n return this.getTextAlignment();\n }\n\n getTextAlignment(): string {\n return this._textAlign;\n }\n\n /**\n * Set the text alignment on Y axis for multiline text objects.\n * @param alignment The text alignment.\n */\n setVerticalTextAlignment(alignment: string): void {\n this._verticalTextAlignment = alignment;\n this._renderer.updatePosition();\n }\n\n /**\n * Get the text alignment on Y axis of text object.\n * @return The text alignment.\n */\n getVerticalTextAlignment(): string {\n return this._verticalTextAlignment;\n }\n\n override setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n override setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n override setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Set object opacity.\n * @param opacity The new opacity of the object (0-255).\n */\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this._opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n /**\n * Get object opacity.\n */\n getOpacity() {\n return this._opacity;\n }\n\n /**\n * Set the width.\n * @param width The new width in pixels.\n */\n setWrappingWidth(width: float): void {\n if (this._wrappingWidth === width) return;\n\n this._wrappingWidth = width;\n this._renderer.updateWrappingWidth();\n this.invalidateHitboxes();\n }\n\n /**\n * Get the wrapping width of the object.\n */\n getWrappingWidth(): float {\n return this._wrappingWidth;\n }\n\n setWrapping(wordWrap: boolean): void {\n if (this._wrapping === wordWrap) return;\n\n this._wrapping = wordWrap;\n this._renderer.updateWordWrap();\n this.invalidateHitboxes();\n }\n\n isWrapping() {\n return this._wrapping;\n }\n\n override getWidth(): float {\n return this._wrapping ? this._wrappingWidth : this._renderer.getWidth();\n }\n\n override getHeight(): float {\n return this._renderer.getHeight();\n }\n\n override setWidth(width: float): void {\n this.setWrappingWidth(width);\n }\n\n override getDrawableY(): float {\n return (\n this.getY() -\n (this._verticalTextAlignment === 'center'\n ? this.getHeight() / 2\n : this._verticalTextAlignment === 'bottom'\n ? this.getHeight()\n : 0)\n );\n }\n }\n // @ts-ignore\n gdjs.registerObject('BBText::BBText', gdjs.BBTextRuntimeObject);\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CA6C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
+ "sourcesContent": ["namespace gdjs {\n /** Base parameters for {@link gdjs.BBTextRuntimeObject} */\n export type BBTextObjectDataType = {\n /** The base parameters of the BBText */\n content: {\n /** The opacity of the BBText */\n opacity: number;\n /** Deprecated - Is the text visible? */\n visible: boolean;\n /** Content of the text */\n text: string;\n /** The color of the text */\n color: string;\n /** The font of the text */\n fontFamily: string;\n /** The size of the text */\n fontSize: number;\n /** Activate word wrap if set to true */\n wordWrap: boolean;\n /** Alignment of the text: \"left\", \"center\" or \"right\" */\n align: 'left' | 'center' | 'right';\n verticalTextAlignment: 'top' | 'center' | 'bottom';\n };\n };\n export type BBTextObjectData = ObjectData & BBTextObjectDataType;\n\n export type BBTextObjectNetworkSyncDataType = {\n text: string;\n o: float;\n c: number[];\n ff: string;\n fs: number;\n wwrap: boolean;\n wwidth: float;\n align: string;\n vta: string;\n hidden: boolean;\n };\n\n export type BBTextObjectNetworkSyncData = ObjectNetworkSyncData &\n BBTextObjectNetworkSyncDataType;\n\n /**\n * Displays a rich text using BBCode markup (allowing to set parts of the text as bold, italic, use different colors and shadows).\n */\n export class BBTextRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.OpacityHandler\n {\n _opacity: float;\n\n _text: string;\n\n /** color in format [r, g, b], where each component is in the range [0, 255] */\n _color: integer[];\n _fontFamily: string;\n _fontSize: float;\n\n _wrapping: boolean = false;\n _wrappingWidth: float = 250;\n\n _textAlign: string;\n _verticalTextAlignment: string;\n\n _renderer: gdjs.BBTextRuntimeObjectRenderer;\n\n // While this should rather be exposed as a property for all objects, honor the \"visible\"\n // property that is specific to this object.\n hidden: boolean;\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param objectData The object data used to initialize the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: BBTextObjectData\n ) {\n super(instanceContainer, objectData);\n // @ts-ignore - parseFloat should not be required, but GDevelop 5.0 beta 92 and below were storing it as a string.\n this._opacity = parseFloat(objectData.content.opacity);\n this._text = objectData.content.text;\n this._color = gdjs.rgbOrHexToRGBColor(objectData.content.color);\n this._fontFamily = objectData.content.fontFamily;\n // @ts-ignore - parseFloat should not be required, but GDevelop 5.0 beta 92 and below were storing it as a string.\n this._fontSize = parseFloat(objectData.content.fontSize);\n this._textAlign = objectData.content.align;\n this._verticalTextAlignment =\n objectData.content.verticalTextAlignment || 'top';\n this.hidden = !objectData.content.visible;\n\n this._renderer = new gdjs.BBTextRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n override getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n // @ts-ignore\n override updateFromObjectData(\n oldObjectData: BBTextObjectDataType,\n newObjectData: BBTextObjectDataType\n ): boolean {\n if (oldObjectData.content.opacity !== newObjectData.content.opacity) {\n this.setOpacity(newObjectData.content.opacity);\n }\n if (oldObjectData.content.visible !== newObjectData.content.visible) {\n this.hide(!newObjectData.content.visible);\n }\n if (oldObjectData.content.text !== newObjectData.content.text) {\n this.setBBText(newObjectData.content.text);\n }\n if (oldObjectData.content.color !== newObjectData.content.color) {\n this._color = gdjs.rgbOrHexToRGBColor(newObjectData.content.color);\n this._renderer.updateColor();\n }\n if (\n oldObjectData.content.fontFamily !== newObjectData.content.fontFamily\n ) {\n this.setFontFamily(newObjectData.content.fontFamily);\n }\n if (oldObjectData.content.fontSize !== newObjectData.content.fontSize) {\n this.setFontSize(newObjectData.content.fontSize);\n }\n if (oldObjectData.content.wordWrap !== newObjectData.content.wordWrap) {\n this.setWrapping(newObjectData.content.wordWrap);\n }\n if (oldObjectData.content.align !== newObjectData.content.align) {\n this.setTextAlignment(newObjectData.content.align);\n }\n if (\n oldObjectData.content.verticalTextAlignment !==\n newObjectData.content.verticalTextAlignment\n ) {\n this.setVerticalTextAlignment(\n newObjectData.content.verticalTextAlignment\n );\n }\n return true;\n }\n\n override getNetworkSyncData(\n syncOptions: GetNetworkSyncDataOptions\n ): BBTextObjectNetworkSyncData {\n return {\n ...super.getNetworkSyncData(syncOptions),\n text: this._text,\n o: this._opacity,\n c: this._color,\n ff: this._fontFamily,\n fs: this._fontSize,\n wwrap: this._wrapping,\n wwidth: this._wrappingWidth,\n align: this._textAlign,\n vta: this._verticalTextAlignment,\n hidden: this.hidden,\n };\n }\n\n override updateFromNetworkSyncData(\n networkSyncData: BBTextObjectNetworkSyncData,\n options: UpdateFromNetworkSyncDataOptions\n ): void {\n super.updateFromNetworkSyncData(networkSyncData, options);\n if (this._text !== undefined) {\n this.setBBText(networkSyncData.text);\n }\n if (this._opacity !== undefined) {\n this.setOpacity(networkSyncData.o);\n }\n if (this._color !== undefined) {\n this._color = networkSyncData.c;\n this._renderer.updateColor();\n }\n if (this._fontFamily !== undefined) {\n this.setFontFamily(networkSyncData.ff);\n }\n if (this._fontSize !== undefined) {\n this.setFontSize(networkSyncData.fs);\n }\n if (this._wrapping !== undefined) {\n this.setWrapping(networkSyncData.wwrap);\n }\n if (this._wrappingWidth !== undefined) {\n this.setWrappingWidth(networkSyncData.wwidth);\n }\n if (this._textAlign !== undefined) {\n this.setTextAlignment(networkSyncData.align);\n }\n if (this._verticalTextAlignment !== undefined) {\n this.setVerticalTextAlignment(networkSyncData.vta);\n }\n if (this.hidden !== undefined) {\n this.hide(networkSyncData.hidden);\n }\n }\n\n override extraInitializationFromInitialInstance(\n initialInstanceData: InstanceData\n ) {\n if (initialInstanceData.customSize) {\n this.setWrappingWidth(initialInstanceData.width);\n this.setWrapping(true);\n } else {\n this.setWrappingWidth(\n // This value is the default wrapping width of the runtime object.\n 250\n );\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n }\n\n override onDestroyed(): void {\n super.onDestroyed();\n this._renderer.destroy();\n }\n\n /**\n * Set the markup text to display.\n */\n setBBText(text: string): void {\n this._text = text;\n this._renderer.updateText();\n this.invalidateHitboxes();\n }\n\n /**\n * Get the markup text displayed by the object.\n */\n getBBText() {\n return this._text;\n }\n\n setColor(rgbColorString: string): void {\n this._color = gdjs.rgbOrHexToRGBColor(rgbColorString);\n this._renderer.updateColor();\n }\n\n /**\n * Get the base color.\n * @return The color as a \"R;G;B\" string, for example: \"255;0;0\"\n */\n getColor(): string {\n return this._color[0] + ';' + this._color[1] + ';' + this._color[2];\n }\n\n setFontSize(fontSize: float): void {\n this._fontSize = fontSize;\n this._renderer.updateFontSize();\n }\n\n getFontSize() {\n return this._fontSize;\n }\n\n setFontFamily(fontFamily: string): void {\n this._fontFamily = fontFamily;\n this._renderer.updateFontFamily();\n }\n\n getFontFamily(): string {\n return this._fontFamily;\n }\n\n /**\n * @deprecated Use `setTextAlignment` instead\n */\n setAlignment(align: string): void {\n this.setTextAlignment(align);\n }\n\n setTextAlignment(align: string): void {\n this._textAlign = align;\n this._renderer.updateAlignment();\n }\n\n /**\n * @deprecated Use `getTextAlignment` instead\n */\n getAlignment(): string {\n return this.getTextAlignment();\n }\n\n getTextAlignment(): string {\n return this._textAlign;\n }\n\n /**\n * Set the text alignment on Y axis for multiline text objects.\n * @param alignment The text alignment.\n */\n setVerticalTextAlignment(alignment: string): void {\n this._verticalTextAlignment = alignment;\n this._renderer.updatePosition();\n }\n\n /**\n * Get the text alignment on Y axis of text object.\n * @return The text alignment.\n */\n getVerticalTextAlignment(): string {\n return this._verticalTextAlignment;\n }\n\n override setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n override setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n override setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Set object opacity.\n * @param opacity The new opacity of the object (0-255).\n */\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this._opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n /**\n * Get object opacity.\n */\n getOpacity() {\n return this._opacity;\n }\n\n /**\n * Set the width.\n * @param width The new width in pixels.\n */\n setWrappingWidth(width: float): void {\n if (this._wrappingWidth === width) return;\n\n this._wrappingWidth = width;\n this._renderer.updateWrappingWidth();\n this.invalidateHitboxes();\n }\n\n /**\n * Get the wrapping width of the object.\n */\n getWrappingWidth(): float {\n return this._wrappingWidth;\n }\n\n setWrapping(wordWrap: boolean): void {\n if (this._wrapping === wordWrap) return;\n\n this._wrapping = wordWrap;\n this._renderer.updateWordWrap();\n this.invalidateHitboxes();\n }\n\n isWrapping() {\n return this._wrapping;\n }\n\n override getWidth(): float {\n return this._wrapping ? this._wrappingWidth : this._renderer.getWidth();\n }\n\n override getHeight(): float {\n return this._renderer.getHeight();\n }\n\n override setWidth(width: float): void {\n this.setWrappingWidth(width);\n }\n\n override getDrawableY(): float {\n return (\n this.getY() -\n (this._verticalTextAlignment === 'center'\n ? this.getHeight() / 2\n : this._verticalTextAlignment === 'bottom'\n ? this.getHeight()\n : 0)\n );\n }\n }\n // @ts-ignore\n gdjs.registerObject('BBText::BBText', gdjs.BBTextRuntimeObject);\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CA6CS,eACG,GAAK,aAEf,CA0BE,YACE,EACA,EACA,CACA,MAAM,EAAmB,GApB3B,eAAqB,GACrB,oBAAwB,IAqBtB,KAAK,SAAW,WAAW,EAAW,QAAQ,SAC9C,KAAK,MAAQ,EAAW,QAAQ,KAChC,KAAK,OAAS,EAAK,mBAAmB,EAAW,QAAQ,OACzD,KAAK,YAAc,EAAW,QAAQ,WAEtC,KAAK,UAAY,WAAW,EAAW,QAAQ,UAC/C,KAAK,WAAa,EAAW,QAAQ,MACrC,KAAK,uBACH,EAAW,QAAQ,uBAAyB,MAC9C,KAAK,OAAS,CAAC,EAAW,QAAQ,QAElC,KAAK,UAAY,GAAI,GAAK,4BACxB,KACA,GAIF,KAAK,YAGE,mBAAoB,CAC3B,MAAO,MAAK,UAAU,oBAIf,qBACP,EACA,EACS,CACT,MAAI,GAAc,QAAQ,UAAY,EAAc,QAAQ,SAC1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OjB,WAAW,EAAsB,CAC/B,AAAI,EAAU,GACZ,GAAU,GAER,EAAU,KACZ,GAAU,KAEZ,KAAK,SAAW,EAChB,KAAK,UAAU,gBAMjB,YAAa,CACX,MAAO,MAAK,SAOd,iBAAiB,EAAoB,CACnC,AAAI,KAAK,iBAAmB,GAE5B,MAAK,eAAiB,EACtB,KAAK,UAAU,sBACf,KAAK,sBAMP,kBAA0B,CACxB,MAAO,MAAK,eAGd,YAAY,EAAyB,CACnC,AAAI,KAAK,YAAc,GAEvB,MAAK,UAAY,EACjB,KAAK,UAAU,iBACf,KAAK,sBAGP,YAAa,CACX,MAAO,MAAK,UAGL,UAAkB,CACzB,MAAO,MAAK,UAAY,KAAK,eAAiB,KAAK,UAAU,WAGtD,WAAmB,CAC1B,MAAO,MAAK,UAAU,YAGf,SAAS,EAAoB,CACpC,KAAK,iBAAiB,GAGf,cAAsB,CAC7B,MACE,MAAK,OACJ,MAAK,yBAA2B,SAC7B,KAAK,YAAc,EACnB,KAAK,yBAA2B,SAC9B,KAAK,YACL,IAlWL,EAAM,sBAuWb,EAAK,eAAe,iBAAkB,EAAK,uBApZnC",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(i){class r extends i.RuntimeObject{constructor(t,e){super(t,e);this._wrapping=!1;this._opacity=e.content.opacity,this._text=e.content.text,this._tint=i.rgbOrHexToRGBColor(e.content.tint),this._bitmapFontResourceName=e.content.bitmapFontResourceName,this._textureAtlasResourceName=e.content.textureAtlasResourceName,this._scaleX=e.content.scale,this._scaleY=e.content.scale,this._wrappingWidth=0,this._textAlign=e.content.align,this._verticalTextAlignment=e.content.verticalTextAlignment||"top",this._renderer=new i.BitmapTextRuntimeObjectRenderer(this,t),this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}updateFromObjectData(t,e){return t.content.opacity!==e.content.opacity&&this.setOpacity(e.content.opacity),t.content.text!==e.content.text&&this.setText(e.content.text),t.content.tint!==e.content.tint&&(this._tint=i.rgbOrHexToRGBColor(e.content.tint),this._renderer.updateTint()),t.content.bitmapFontResourceName!==e.content.bitmapFontResourceName&&this.setBitmapFontResourceName(e.content.bitmapFontResourceName),t.content.textureAtlasResourceName!==e.content.textureAtlasResourceName&&this.setTextureAtlasResourceName(e.content.textureAtlasResourceName),t.content.scale!==e.content.scale&&this.setScale(e.content.scale),t.content.align!==e.content.align&&this.setTextAlignment(e.content.align),t.content.verticalTextAlignment!==e.content.verticalTextAlignment&&this.setVerticalTextAlignment(e.content.verticalTextAlignment),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),text:this._text,opa:this._opacity,tint:this._tint,bfrn:this._bitmapFontResourceName,tarn:this._textureAtlasResourceName,scale:this.getScale(),wwrap:this._wrapping,wwidth:this._wrappingWidth,align:this._textAlign,vta:this._verticalTextAlignment}}updateFromNetworkSyncData(t){super.updateFromNetworkSyncData(t),this._text!==void 0&&this.setText(t.text),this._opacity!==void 0&&this.setOpacity(t.opa),this._tint!==void 0&&(this._tint=t.tint,this._renderer.updateTint()),this._bitmapFontResourceName!==void 0&&this.setBitmapFontResourceName(t.bfrn),this._textureAtlasResourceName!==void 0&&this.setTextureAtlasResourceName(t.tarn),this._scaleX!==void 0&&this.setScale(t.scale),this._wrapping!==void 0&&this.setWrapping(t.wwrap),this._wrappingWidth!==void 0&&this.setWrappingWidth(t.wwidth),this._textAlign!==void 0&&this.setTextAlignment(t.align),this._verticalTextAlignment!==void 0&&this.setVerticalTextAlignment(t.vta)}extraInitializationFromInitialInstance(t){t.customSize&&(this.setWrappingWidth(t.width),this.setWrapping(!0)),t.opacity!==void 0&&this.setOpacity(t.opacity)}onDestroyed(){super.onDestroyed(),this._renderer.onDestroy()}setText(t){this._text=t,this._renderer.updateTextContent(),this.invalidateHitboxes()}getText(){return this._text}setTint(t){this._tint=i.rgbOrHexToRGBColor(t),this._renderer.updateTint()}getTint(){return this._tint[0]+";"+this._tint[1]+";"+this._tint[2]}getScale(){const t=this.getScaleX(),e=this.getScaleY();return t===e?t:Math.sqrt(t*e)}getScaleX(){return this._scaleX}getScaleY(){return this._scaleY}setScale(t){this.setScaleX(t),this.setScaleY(t)}setScaleX(t){t<0&&(t=0),this._scaleX!==t&&(this._scaleX=t,this._renderer.updateScale(),this.invalidateHitboxes())}setScaleY(t){t<0&&(t=0),this._scaleY!==t&&(this._scaleY=t,this._renderer.updateScale(),this.invalidateHitboxes())}getFontSize(){return this._renderer.getFontSize()}setBitmapFontAndTextureAtlasResourceName(t,e){t&&(this.setBitmapFontResourceName(t),this._renderer.updateFont()),e&&(this.setTextureAtlasResourceName(e),this._renderer.updateFont())}setBitmapFontResourceName(t){this._bitmapFontResourceName=t}getBitmapFontResourceName(){return this._bitmapFontResourceName}setTextureAtlasResourceName(t){this._textureAtlasResourceName=t}getTextureAtlasResourceName(){return this._textureAtlasResourceName}setTextAlignment(t){this._textAlign=t,this._renderer.updateAlignment()}getTextAlignment(){return this._textAlign}setVerticalTextAlignment(t){this._verticalTextAlignment=t,this._renderer.updatePosition()}getVerticalTextAlignment(){return this._verticalTextAlignment}setX(t){super.setX(t),this._renderer.updatePosition()}setY(t){super.setY(t),this._renderer.updatePosition()}setAngle(t){super.setAngle(t),this._renderer.updateAngle()}setOpacity(t){t<0&&(t=0),t>255&&(t=255),this._opacity=t,this._renderer.updateOpacity()}getOpacity(){return this._opacity}setWrappingWidth(t){this._wrappingWidth=t,this._renderer.updateWrappingWidth(),this.invalidateHitboxes()}getWrappingWidth(){return this._wrappingWidth}setWrapping(t){this._wrapping=t,this._renderer.updateWrappingWidth(),this.invalidateHitboxes()}isWrapping(){return this._wrapping}getWidth(){return this._wrapping?this._wrappingWidth:this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}setWidth(t){this.setWrappingWidth(t)}getDrawableY(){return this.getY()-(this._verticalTextAlignment==="center"?this.getHeight()/2:this._verticalTextAlignment==="bottom"?this.getHeight():0)}}i.BitmapTextRuntimeObject=r,i.registerObject("BitmapText::BitmapTextObject",i.BitmapTextRuntimeObject)})(gdjs||(gdjs={}));
1
+ var gdjs;(function(i){class r extends i.RuntimeObject{constructor(t,e){super(t,e);this._wrapping=!1;this._opacity=e.content.opacity,this._text=e.content.text,this._tint=i.rgbOrHexToRGBColor(e.content.tint),this._bitmapFontResourceName=e.content.bitmapFontResourceName,this._textureAtlasResourceName=e.content.textureAtlasResourceName,this._scaleX=e.content.scale,this._scaleY=e.content.scale,this._wrappingWidth=0,this._textAlign=e.content.align,this._verticalTextAlignment=e.content.verticalTextAlignment||"top",this._renderer=new i.BitmapTextRuntimeObjectRenderer(this,t),this.onCreated()}getRendererObject(){return this._renderer.getRendererObject()}updateFromObjectData(t,e){return t.content.opacity!==e.content.opacity&&this.setOpacity(e.content.opacity),t.content.text!==e.content.text&&this.setText(e.content.text),t.content.tint!==e.content.tint&&(this._tint=i.rgbOrHexToRGBColor(e.content.tint),this._renderer.updateTint()),t.content.bitmapFontResourceName!==e.content.bitmapFontResourceName&&this.setBitmapFontResourceName(e.content.bitmapFontResourceName),t.content.textureAtlasResourceName!==e.content.textureAtlasResourceName&&this.setTextureAtlasResourceName(e.content.textureAtlasResourceName),t.content.scale!==e.content.scale&&this.setScale(e.content.scale),t.content.align!==e.content.align&&this.setTextAlignment(e.content.align),t.content.verticalTextAlignment!==e.content.verticalTextAlignment&&this.setVerticalTextAlignment(e.content.verticalTextAlignment),!0}getNetworkSyncData(t){return{...super.getNetworkSyncData(t),text:this._text,opa:this._opacity,tint:this._tint,bfrn:this._bitmapFontResourceName,tarn:this._textureAtlasResourceName,scale:this.getScale(),wwrap:this._wrapping,wwidth:this._wrappingWidth,align:this._textAlign,vta:this._verticalTextAlignment}}updateFromNetworkSyncData(t,e){super.updateFromNetworkSyncData(t,e),this._text!==void 0&&this.setText(t.text),this._opacity!==void 0&&this.setOpacity(t.opa),this._tint!==void 0&&(this._tint=t.tint,this._renderer.updateTint()),this._bitmapFontResourceName!==void 0&&this.setBitmapFontResourceName(t.bfrn),this._textureAtlasResourceName!==void 0&&this.setTextureAtlasResourceName(t.tarn),this._scaleX!==void 0&&this.setScale(t.scale),this._wrapping!==void 0&&this.setWrapping(t.wwrap),this._wrappingWidth!==void 0&&this.setWrappingWidth(t.wwidth),this._textAlign!==void 0&&this.setTextAlignment(t.align),this._verticalTextAlignment!==void 0&&this.setVerticalTextAlignment(t.vta)}extraInitializationFromInitialInstance(t){t.customSize&&(this.setWrappingWidth(t.width),this.setWrapping(!0)),t.opacity!==void 0&&this.setOpacity(t.opacity)}onDestroyed(){super.onDestroyed(),this._renderer.onDestroy()}setText(t){this._text=t,this._renderer.updateTextContent(),this.invalidateHitboxes()}getText(){return this._text}setTint(t){this._tint=i.rgbOrHexToRGBColor(t),this._renderer.updateTint()}getTint(){return this._tint[0]+";"+this._tint[1]+";"+this._tint[2]}getScale(){const t=this.getScaleX(),e=this.getScaleY();return t===e?t:Math.sqrt(t*e)}getScaleX(){return this._scaleX}getScaleY(){return this._scaleY}setScale(t){this.setScaleX(t),this.setScaleY(t)}setScaleX(t){t<0&&(t=0),this._scaleX!==t&&(this._scaleX=t,this._renderer.updateScale(),this.invalidateHitboxes())}setScaleY(t){t<0&&(t=0),this._scaleY!==t&&(this._scaleY=t,this._renderer.updateScale(),this.invalidateHitboxes())}getFontSize(){return this._renderer.getFontSize()}setBitmapFontAndTextureAtlasResourceName(t,e){t&&(this.setBitmapFontResourceName(t),this._renderer.updateFont()),e&&(this.setTextureAtlasResourceName(e),this._renderer.updateFont())}setBitmapFontResourceName(t){this._bitmapFontResourceName=t}getBitmapFontResourceName(){return this._bitmapFontResourceName}setTextureAtlasResourceName(t){this._textureAtlasResourceName=t}getTextureAtlasResourceName(){return this._textureAtlasResourceName}setTextAlignment(t){this._textAlign=t,this._renderer.updateAlignment()}getTextAlignment(){return this._textAlign}setVerticalTextAlignment(t){this._verticalTextAlignment=t,this._renderer.updatePosition()}getVerticalTextAlignment(){return this._verticalTextAlignment}setX(t){super.setX(t),this._renderer.updatePosition()}setY(t){super.setY(t),this._renderer.updatePosition()}setAngle(t){super.setAngle(t),this._renderer.updateAngle()}setOpacity(t){t<0&&(t=0),t>255&&(t=255),this._opacity=t,this._renderer.updateOpacity()}getOpacity(){return this._opacity}setWrappingWidth(t){this._wrappingWidth=t,this._renderer.updateWrappingWidth(),this.invalidateHitboxes()}getWrappingWidth(){return this._wrappingWidth}setWrapping(t){this._wrapping=t,this._renderer.updateWrappingWidth(),this.invalidateHitboxes()}isWrapping(){return this._wrapping}getWidth(){return this._wrapping?this._wrappingWidth:this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}setWidth(t){this.setWrappingWidth(t)}getDrawableY(){return this.getY()-(this._verticalTextAlignment==="center"?this.getHeight()/2:this._verticalTextAlignment==="bottom"?this.getHeight():0)}}i.BitmapTextRuntimeObject=r,i.registerObject("BitmapText::BitmapTextObject",i.BitmapTextRuntimeObject)})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=bitmaptextruntimeobject.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/BitmapText/bitmaptextruntimeobject.ts"],
4
- "sourcesContent": ["namespace gdjs {\n /** Base parameters for {@link gdjs.BitmapTextRuntimeObject} */\n export type BitmapTextObjectDataType = {\n /** The base parameters of the Bitmap Text */\n content: {\n /** The opacity of the text. */\n opacity: float;\n /** Content of the text. */\n text: string;\n /** The tint of the text. */\n tint: string;\n /** The name of the resource containing the bitmap font for the text. */\n bitmapFontResourceName: string;\n /** The name of the resource containing the atlas image file for the text. */\n textureAtlasResourceName: string;\n /** The scale of the text. */\n scale: float;\n /** Wrapping with from custom size properties. */\n wrappingWidth: float;\n /** Alignment of the text. */\n align: 'left' | 'center' | 'right';\n verticalTextAlignment: 'top' | 'center' | 'bottom';\n };\n };\n export type BitmapTextObjectData = ObjectData & BitmapTextObjectDataType;\n\n export type BitmapTextObjectNetworkSyncDataType = {\n text: string;\n opa: float;\n tint: number[];\n bfrn: string;\n tarn: string;\n scale: number;\n wwrap: boolean;\n wwidth: float;\n align: string;\n vta: string;\n };\n\n export type BitmapTextObjectNetworkSyncData = ObjectNetworkSyncData &\n BitmapTextObjectNetworkSyncDataType;\n\n /**\n * Displays a text using a \"Bitmap Font\", generated in a external editor like bmFont.\n * This is more efficient/faster to render than a traditional text (which needs\n * to have its whole texture re-rendered anytime it changes).\n *\n * Bitmap Font can be created with softwares like:\n * * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/|http://www.angelcode.com/products/bmfont/\n * * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner|http://www.71squared.com/en/glyphdesigner\n * * Littera (Web-based, free): http://kvazars.com/littera/|http://kvazars.com/littera/\n */\n export class BitmapTextRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.TextContainer, gdjs.OpacityHandler, gdjs.Scalable\n {\n _opacity: float;\n _text: string;\n /** color in format [r, g, b], where each component is in the range [0, 255] */\n _tint: integer[];\n _bitmapFontResourceName: string;\n _textureAtlasResourceName: string;\n _scaleX: number;\n _scaleY: number;\n _wrapping: boolean = false;\n _wrappingWidth: float;\n _textAlign: string;\n _verticalTextAlignment: string;\n\n _renderer: gdjs.BitmapTextRuntimeObjectPixiRenderer;\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param objectData The object data used to initialize the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: BitmapTextObjectData\n ) {\n super(instanceContainer, objectData);\n\n this._opacity = objectData.content.opacity;\n this._text = objectData.content.text;\n this._tint = gdjs.rgbOrHexToRGBColor(objectData.content.tint);\n\n this._bitmapFontResourceName = objectData.content.bitmapFontResourceName; // fnt/xml files\n this._textureAtlasResourceName =\n objectData.content.textureAtlasResourceName; // texture file used with fnt/xml (bitmap font file)\n this._scaleX = objectData.content.scale;\n this._scaleY = objectData.content.scale;\n this._wrappingWidth = 0;\n this._textAlign = objectData.content.align;\n this._verticalTextAlignment =\n objectData.content.verticalTextAlignment || 'top';\n\n this._renderer = new gdjs.BitmapTextRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n override getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n // @ts-ignore\n override updateFromObjectData(\n oldObjectData: BitmapTextObjectDataType,\n newObjectData: BitmapTextObjectDataType\n ): boolean {\n if (oldObjectData.content.opacity !== newObjectData.content.opacity) {\n this.setOpacity(newObjectData.content.opacity);\n }\n if (oldObjectData.content.text !== newObjectData.content.text) {\n this.setText(newObjectData.content.text);\n }\n if (oldObjectData.content.tint !== newObjectData.content.tint) {\n this._tint = gdjs.rgbOrHexToRGBColor(newObjectData.content.tint);\n this._renderer.updateTint();\n }\n if (\n oldObjectData.content.bitmapFontResourceName !==\n newObjectData.content.bitmapFontResourceName\n ) {\n this.setBitmapFontResourceName(\n newObjectData.content.bitmapFontResourceName\n );\n }\n if (\n oldObjectData.content.textureAtlasResourceName !==\n newObjectData.content.textureAtlasResourceName\n ) {\n this.setTextureAtlasResourceName(\n newObjectData.content.textureAtlasResourceName\n );\n }\n if (oldObjectData.content.scale !== newObjectData.content.scale) {\n this.setScale(newObjectData.content.scale);\n }\n if (oldObjectData.content.align !== newObjectData.content.align) {\n this.setTextAlignment(newObjectData.content.align);\n }\n if (\n oldObjectData.content.verticalTextAlignment !==\n newObjectData.content.verticalTextAlignment\n ) {\n this.setVerticalTextAlignment(\n newObjectData.content.verticalTextAlignment\n );\n }\n\n return true;\n }\n\n override getNetworkSyncData(): BitmapTextObjectNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n text: this._text,\n opa: this._opacity,\n tint: this._tint,\n bfrn: this._bitmapFontResourceName,\n tarn: this._textureAtlasResourceName,\n scale: this.getScale(),\n wwrap: this._wrapping,\n wwidth: this._wrappingWidth,\n align: this._textAlign,\n vta: this._verticalTextAlignment,\n };\n }\n\n override updateFromNetworkSyncData(\n networkSyncData: BitmapTextObjectNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n if (this._text !== undefined) {\n this.setText(networkSyncData.text);\n }\n if (this._opacity !== undefined) {\n this.setOpacity(networkSyncData.opa);\n }\n if (this._tint !== undefined) {\n this._tint = networkSyncData.tint;\n this._renderer.updateTint();\n }\n if (this._bitmapFontResourceName !== undefined) {\n this.setBitmapFontResourceName(networkSyncData.bfrn);\n }\n if (this._textureAtlasResourceName !== undefined) {\n this.setTextureAtlasResourceName(networkSyncData.tarn);\n }\n if (this._scaleX !== undefined) {\n this.setScale(networkSyncData.scale);\n }\n if (this._wrapping !== undefined) {\n this.setWrapping(networkSyncData.wwrap);\n }\n if (this._wrappingWidth !== undefined) {\n this.setWrappingWidth(networkSyncData.wwidth);\n }\n if (this._textAlign !== undefined) {\n this.setTextAlignment(networkSyncData.align);\n }\n if (this._verticalTextAlignment !== undefined) {\n this.setVerticalTextAlignment(networkSyncData.vta);\n }\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n */\n override extraInitializationFromInitialInstance(\n initialInstanceData: InstanceData\n ) {\n if (initialInstanceData.customSize) {\n this.setWrappingWidth(initialInstanceData.width);\n this.setWrapping(true);\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n }\n\n override onDestroyed(): void {\n super.onDestroyed();\n this._renderer.onDestroy();\n }\n\n /**\n * Set the text to display.\n */\n setText(text: string): void {\n this._text = text;\n this._renderer.updateTextContent();\n this.invalidateHitboxes();\n }\n\n /**\n * Get the text displayed by the object.\n */\n getText(): string {\n return this._text;\n }\n\n setTint(rgbColorString: string): void {\n this._tint = gdjs.rgbOrHexToRGBColor(rgbColorString);\n this._renderer.updateTint();\n }\n\n getTint(): string {\n return this._tint[0] + ';' + this._tint[1] + ';' + this._tint[2];\n }\n\n getScale(): number {\n const scaleX = this.getScaleX();\n const scaleY = this.getScaleY();\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n getScaleX(): float {\n return this._scaleX;\n }\n\n getScaleY(): float {\n return this._scaleY;\n }\n\n setScale(scale: float): void {\n this.setScaleX(scale);\n this.setScaleY(scale);\n }\n\n setScaleX(scaleX: float): void {\n if (scaleX < 0) {\n scaleX = 0;\n }\n if (this._scaleX === scaleX) return;\n\n this._scaleX = scaleX;\n this._renderer.updateScale();\n this.invalidateHitboxes();\n }\n\n setScaleY(scaleY: float): void {\n if (scaleY < 0) {\n scaleY = 0;\n }\n if (this._scaleY === scaleY) return;\n\n this._scaleY = scaleY;\n this._renderer.updateScale();\n this.invalidateHitboxes();\n }\n\n getFontSize(): float {\n return this._renderer.getFontSize();\n }\n\n setBitmapFontAndTextureAtlasResourceName(\n bitmapFontResourceName: string,\n textureAtlasResourceName: string\n ): void {\n if (bitmapFontResourceName) {\n this.setBitmapFontResourceName(bitmapFontResourceName);\n this._renderer.updateFont();\n }\n if (textureAtlasResourceName) {\n this.setTextureAtlasResourceName(textureAtlasResourceName);\n this._renderer.updateFont();\n }\n }\n\n setBitmapFontResourceName(bitmapFontResourceName: string): void {\n this._bitmapFontResourceName = bitmapFontResourceName;\n }\n\n getBitmapFontResourceName(): string {\n return this._bitmapFontResourceName;\n }\n\n setTextureAtlasResourceName(textureAtlasResourceName: string): void {\n this._textureAtlasResourceName = textureAtlasResourceName;\n }\n\n getTextureAtlasResourceName(): string {\n return this._textureAtlasResourceName;\n }\n\n setTextAlignment(align: string): void {\n this._textAlign = align;\n this._renderer.updateAlignment();\n }\n\n getTextAlignment(): string {\n return this._textAlign;\n }\n\n /**\n * Set the text alignment on Y axis for multiline text objects.\n * @param alignment The text alignment.\n */\n setVerticalTextAlignment(alignment: string): void {\n this._verticalTextAlignment = alignment;\n this._renderer.updatePosition();\n }\n\n /**\n * Get the text alignment on Y axis of text object.\n * @return The text alignment.\n */\n getVerticalTextAlignment(): string {\n return this._verticalTextAlignment;\n }\n\n override setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n override setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n override setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Set object opacity.\n * @param opacity The new opacity of the object (0-255).\n */\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this._opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n /**\n * Get object opacity.\n */\n getOpacity(): float {\n return this._opacity;\n }\n\n /**\n * Set the wrapping width.\n * @param width The new width in pixels.\n */\n setWrappingWidth(width: float): void {\n this._wrappingWidth = width;\n this._renderer.updateWrappingWidth();\n this.invalidateHitboxes();\n }\n\n /**\n * Get the wrapping width of the object.\n */\n getWrappingWidth(): float {\n return this._wrappingWidth;\n }\n\n setWrapping(wordWrap: boolean): void {\n this._wrapping = wordWrap;\n this._renderer.updateWrappingWidth();\n this.invalidateHitboxes();\n }\n\n isWrapping(): boolean {\n return this._wrapping;\n }\n\n override getWidth(): float {\n return this._wrapping ? this._wrappingWidth : this._renderer.getWidth();\n }\n\n override getHeight(): float {\n return this._renderer.getHeight();\n }\n\n override setWidth(width: float): void {\n this.setWrappingWidth(width);\n }\n\n override getDrawableY(): float {\n return (\n this.getY() -\n (this._verticalTextAlignment === 'center'\n ? this.getHeight() / 2\n : this._verticalTextAlignment === 'bottom'\n ? this.getHeight()\n : 0)\n );\n }\n }\n gdjs.registerObject(\n 'BitmapText::BitmapTextObject',\n // @ts-ignore\n gdjs.BitmapTextRuntimeObject\n );\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAoDS,eACG,GAAK,aAEf,CAoBE,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAf3B,eAAqB,GAiBnB,KAAK,SAAW,EAAW,QAAQ,QACnC,KAAK,MAAQ,EAAW,QAAQ,KAChC,KAAK,MAAQ,EAAK,mBAAmB,EAAW,QAAQ,MAExD,KAAK,wBAA0B,EAAW,QAAQ,uBAClD,KAAK,0BACH,EAAW,QAAQ,yBACrB,KAAK,Q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,MAAK,OACJ,MAAK,yBAA2B,SAC7B,KAAK,YAAc,EACnB,KAAK,yBAA2B,SAC9B,KAAK,YACL,IAnYL,EAAM,0BAuYb,EAAK,eACH,+BAEA,EAAK,2BA9bC",
4
+ "sourcesContent": ["namespace gdjs {\n /** Base parameters for {@link gdjs.BitmapTextRuntimeObject} */\n export type BitmapTextObjectDataType = {\n /** The base parameters of the Bitmap Text */\n content: {\n /** The opacity of the text. */\n opacity: float;\n /** Content of the text. */\n text: string;\n /** The tint of the text. */\n tint: string;\n /** The name of the resource containing the bitmap font for the text. */\n bitmapFontResourceName: string;\n /** The name of the resource containing the atlas image file for the text. */\n textureAtlasResourceName: string;\n /** The scale of the text. */\n scale: float;\n /** Wrapping with from custom size properties. */\n wrappingWidth: float;\n /** Alignment of the text. */\n align: 'left' | 'center' | 'right';\n verticalTextAlignment: 'top' | 'center' | 'bottom';\n };\n };\n export type BitmapTextObjectData = ObjectData & BitmapTextObjectDataType;\n\n export type BitmapTextObjectNetworkSyncDataType = {\n text: string;\n opa: float;\n tint: number[];\n bfrn: string;\n tarn: string;\n scale: number;\n wwrap: boolean;\n wwidth: float;\n align: string;\n vta: string;\n };\n\n export type BitmapTextObjectNetworkSyncData = ObjectNetworkSyncData &\n BitmapTextObjectNetworkSyncDataType;\n\n /**\n * Displays a text using a \"Bitmap Font\", generated in a external editor like bmFont.\n * This is more efficient/faster to render than a traditional text (which needs\n * to have its whole texture re-rendered anytime it changes).\n *\n * Bitmap Font can be created with softwares like:\n * * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/|http://www.angelcode.com/products/bmfont/\n * * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner|http://www.71squared.com/en/glyphdesigner\n * * Littera (Web-based, free): http://kvazars.com/littera/|http://kvazars.com/littera/\n */\n export class BitmapTextRuntimeObject\n extends gdjs.RuntimeObject\n implements gdjs.TextContainer, gdjs.OpacityHandler, gdjs.Scalable\n {\n _opacity: float;\n _text: string;\n /** color in format [r, g, b], where each component is in the range [0, 255] */\n _tint: integer[];\n _bitmapFontResourceName: string;\n _textureAtlasResourceName: string;\n _scaleX: number;\n _scaleY: number;\n _wrapping: boolean = false;\n _wrappingWidth: float;\n _textAlign: string;\n _verticalTextAlignment: string;\n\n _renderer: gdjs.BitmapTextRuntimeObjectPixiRenderer;\n\n /**\n * @param instanceContainer The container the object belongs to.\n * @param objectData The object data used to initialize the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: BitmapTextObjectData\n ) {\n super(instanceContainer, objectData);\n\n this._opacity = objectData.content.opacity;\n this._text = objectData.content.text;\n this._tint = gdjs.rgbOrHexToRGBColor(objectData.content.tint);\n\n this._bitmapFontResourceName = objectData.content.bitmapFontResourceName; // fnt/xml files\n this._textureAtlasResourceName =\n objectData.content.textureAtlasResourceName; // texture file used with fnt/xml (bitmap font file)\n this._scaleX = objectData.content.scale;\n this._scaleY = objectData.content.scale;\n this._wrappingWidth = 0;\n this._textAlign = objectData.content.align;\n this._verticalTextAlignment =\n objectData.content.verticalTextAlignment || 'top';\n\n this._renderer = new gdjs.BitmapTextRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n override getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n // @ts-ignore\n override updateFromObjectData(\n oldObjectData: BitmapTextObjectDataType,\n newObjectData: BitmapTextObjectDataType\n ): boolean {\n if (oldObjectData.content.opacity !== newObjectData.content.opacity) {\n this.setOpacity(newObjectData.content.opacity);\n }\n if (oldObjectData.content.text !== newObjectData.content.text) {\n this.setText(newObjectData.content.text);\n }\n if (oldObjectData.content.tint !== newObjectData.content.tint) {\n this._tint = gdjs.rgbOrHexToRGBColor(newObjectData.content.tint);\n this._renderer.updateTint();\n }\n if (\n oldObjectData.content.bitmapFontResourceName !==\n newObjectData.content.bitmapFontResourceName\n ) {\n this.setBitmapFontResourceName(\n newObjectData.content.bitmapFontResourceName\n );\n }\n if (\n oldObjectData.content.textureAtlasResourceName !==\n newObjectData.content.textureAtlasResourceName\n ) {\n this.setTextureAtlasResourceName(\n newObjectData.content.textureAtlasResourceName\n );\n }\n if (oldObjectData.content.scale !== newObjectData.content.scale) {\n this.setScale(newObjectData.content.scale);\n }\n if (oldObjectData.content.align !== newObjectData.content.align) {\n this.setTextAlignment(newObjectData.content.align);\n }\n if (\n oldObjectData.content.verticalTextAlignment !==\n newObjectData.content.verticalTextAlignment\n ) {\n this.setVerticalTextAlignment(\n newObjectData.content.verticalTextAlignment\n );\n }\n\n return true;\n }\n\n override getNetworkSyncData(\n syncOptions: GetNetworkSyncDataOptions\n ): BitmapTextObjectNetworkSyncData {\n return {\n ...super.getNetworkSyncData(syncOptions),\n text: this._text,\n opa: this._opacity,\n tint: this._tint,\n bfrn: this._bitmapFontResourceName,\n tarn: this._textureAtlasResourceName,\n scale: this.getScale(),\n wwrap: this._wrapping,\n wwidth: this._wrappingWidth,\n align: this._textAlign,\n vta: this._verticalTextAlignment,\n };\n }\n\n override updateFromNetworkSyncData(\n networkSyncData: BitmapTextObjectNetworkSyncData,\n options: UpdateFromNetworkSyncDataOptions\n ): void {\n super.updateFromNetworkSyncData(networkSyncData, options);\n if (this._text !== undefined) {\n this.setText(networkSyncData.text);\n }\n if (this._opacity !== undefined) {\n this.setOpacity(networkSyncData.opa);\n }\n if (this._tint !== undefined) {\n this._tint = networkSyncData.tint;\n this._renderer.updateTint();\n }\n if (this._bitmapFontResourceName !== undefined) {\n this.setBitmapFontResourceName(networkSyncData.bfrn);\n }\n if (this._textureAtlasResourceName !== undefined) {\n this.setTextureAtlasResourceName(networkSyncData.tarn);\n }\n if (this._scaleX !== undefined) {\n this.setScale(networkSyncData.scale);\n }\n if (this._wrapping !== undefined) {\n this.setWrapping(networkSyncData.wwrap);\n }\n if (this._wrappingWidth !== undefined) {\n this.setWrappingWidth(networkSyncData.wwidth);\n }\n if (this._textAlign !== undefined) {\n this.setTextAlignment(networkSyncData.align);\n }\n if (this._verticalTextAlignment !== undefined) {\n this.setVerticalTextAlignment(networkSyncData.vta);\n }\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n */\n override extraInitializationFromInitialInstance(\n initialInstanceData: InstanceData\n ) {\n if (initialInstanceData.customSize) {\n this.setWrappingWidth(initialInstanceData.width);\n this.setWrapping(true);\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n }\n\n override onDestroyed(): void {\n super.onDestroyed();\n this._renderer.onDestroy();\n }\n\n /**\n * Set the text to display.\n */\n setText(text: string): void {\n this._text = text;\n this._renderer.updateTextContent();\n this.invalidateHitboxes();\n }\n\n /**\n * Get the text displayed by the object.\n */\n getText(): string {\n return this._text;\n }\n\n setTint(rgbColorString: string): void {\n this._tint = gdjs.rgbOrHexToRGBColor(rgbColorString);\n this._renderer.updateTint();\n }\n\n getTint(): string {\n return this._tint[0] + ';' + this._tint[1] + ';' + this._tint[2];\n }\n\n getScale(): number {\n const scaleX = this.getScaleX();\n const scaleY = this.getScaleY();\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n getScaleX(): float {\n return this._scaleX;\n }\n\n getScaleY(): float {\n return this._scaleY;\n }\n\n setScale(scale: float): void {\n this.setScaleX(scale);\n this.setScaleY(scale);\n }\n\n setScaleX(scaleX: float): void {\n if (scaleX < 0) {\n scaleX = 0;\n }\n if (this._scaleX === scaleX) return;\n\n this._scaleX = scaleX;\n this._renderer.updateScale();\n this.invalidateHitboxes();\n }\n\n setScaleY(scaleY: float): void {\n if (scaleY < 0) {\n scaleY = 0;\n }\n if (this._scaleY === scaleY) return;\n\n this._scaleY = scaleY;\n this._renderer.updateScale();\n this.invalidateHitboxes();\n }\n\n getFontSize(): float {\n return this._renderer.getFontSize();\n }\n\n setBitmapFontAndTextureAtlasResourceName(\n bitmapFontResourceName: string,\n textureAtlasResourceName: string\n ): void {\n if (bitmapFontResourceName) {\n this.setBitmapFontResourceName(bitmapFontResourceName);\n this._renderer.updateFont();\n }\n if (textureAtlasResourceName) {\n this.setTextureAtlasResourceName(textureAtlasResourceName);\n this._renderer.updateFont();\n }\n }\n\n setBitmapFontResourceName(bitmapFontResourceName: string): void {\n this._bitmapFontResourceName = bitmapFontResourceName;\n }\n\n getBitmapFontResourceName(): string {\n return this._bitmapFontResourceName;\n }\n\n setTextureAtlasResourceName(textureAtlasResourceName: string): void {\n this._textureAtlasResourceName = textureAtlasResourceName;\n }\n\n getTextureAtlasResourceName(): string {\n return this._textureAtlasResourceName;\n }\n\n setTextAlignment(align: string): void {\n this._textAlign = align;\n this._renderer.updateAlignment();\n }\n\n getTextAlignment(): string {\n return this._textAlign;\n }\n\n /**\n * Set the text alignment on Y axis for multiline text objects.\n * @param alignment The text alignment.\n */\n setVerticalTextAlignment(alignment: string): void {\n this._verticalTextAlignment = alignment;\n this._renderer.updatePosition();\n }\n\n /**\n * Get the text alignment on Y axis of text object.\n * @return The text alignment.\n */\n getVerticalTextAlignment(): string {\n return this._verticalTextAlignment;\n }\n\n override setX(x: float): void {\n super.setX(x);\n this._renderer.updatePosition();\n }\n\n override setY(y: float): void {\n super.setY(y);\n this._renderer.updatePosition();\n }\n\n override setAngle(angle: float): void {\n super.setAngle(angle);\n this._renderer.updateAngle();\n }\n\n /**\n * Set object opacity.\n * @param opacity The new opacity of the object (0-255).\n */\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this._opacity = opacity;\n this._renderer.updateOpacity();\n }\n\n /**\n * Get object opacity.\n */\n getOpacity(): float {\n return this._opacity;\n }\n\n /**\n * Set the wrapping width.\n * @param width The new width in pixels.\n */\n setWrappingWidth(width: float): void {\n this._wrappingWidth = width;\n this._renderer.updateWrappingWidth();\n this.invalidateHitboxes();\n }\n\n /**\n * Get the wrapping width of the object.\n */\n getWrappingWidth(): float {\n return this._wrappingWidth;\n }\n\n setWrapping(wordWrap: boolean): void {\n this._wrapping = wordWrap;\n this._renderer.updateWrappingWidth();\n this.invalidateHitboxes();\n }\n\n isWrapping(): boolean {\n return this._wrapping;\n }\n\n override getWidth(): float {\n return this._wrapping ? this._wrappingWidth : this._renderer.getWidth();\n }\n\n override getHeight(): float {\n return this._renderer.getHeight();\n }\n\n override setWidth(width: float): void {\n this.setWrappingWidth(width);\n }\n\n override getDrawableY(): float {\n return (\n this.getY() -\n (this._verticalTextAlignment === 'center'\n ? this.getHeight() / 2\n : this._verticalTextAlignment === 'bottom'\n ? this.getHeight()\n : 0)\n );\n }\n }\n gdjs.registerObject(\n 'BitmapText::BitmapTextObject',\n // @ts-ignore\n gdjs.BitmapTextRuntimeObject\n );\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAoDS,eACG,GAAK,aAEf,CAoBE,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAf3B,eAAqB,GAiBnB,KAAK,SAAW,EAAW,QAAQ,QACnC,KAAK,MAAQ,EAAW,QAAQ,KAChC,KAAK,MAAQ,EAAK,mBAAmB,EAAW,QAAQ,MAExD,KAAK,wBAA0B,EAAW,QAAQ,uBAClD,KAAK,0BACH,EAAW,QAAQ,yBACrB,KAAK,QAAU,EAAW,QAAQ,MAClC,KAAK,QAAU,EAAW,QAAQ,MAClC,KAAK,eAAiB,EACtB,KAAK,WAAa,EAAW,QAAQ,MACrC,KAAK,uBACH,EAAW,QAAQ,uBAAyB,MAE9C,KAAK,UAAY,GAAI,GAAK,gCACxB,KACA,GAIF,KAAK,YAGE,mBAAoB,CAC3B,MAAO,MAAK,UAAU,oBAIf,qBACP,EACA,EACS,CACT,MAAI,GAAc,QAAQ,UAAY,EAAc,QAAQ,SAC1D,KAAK,WAAW,EAAc,QAAQ,SAEpC,EAAc,QAAQ,OAAS,EAAc,QAAQ,MACvD,KAAK,QAAQ,EAAc,QAAQ,MAEjC,EAAc,QAAQ,OAAS,EAAc,QAAQ,MACvD,MAAK,MAAQ,EAAK,mBAA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WAOd,yBAAyB,EAAyB,CAChD,KAAK,uBAAyB,EAC9B,KAAK,UAAU,iBAOjB,0BAAmC,CACjC,MAAO,MAAK,uBAGL,KAAK,EAAgB,CAC5B,MAAM,KAAK,GACX,KAAK,UAAU,iBAGR,KAAK,EAAgB,CAC5B,MAAM,KAAK,GACX,KAAK,UAAU,iBAGR,SAAS,EAAoB,CACpC,MAAM,SAAS,GACf,KAAK,UAAU,cAOjB,WAAW,EAAsB,CAC/B,AAAI,EAAU,GACZ,GAAU,GAER,EAAU,KACZ,GAAU,KAEZ,KAAK,SAAW,EAChB,KAAK,UAAU,gBAMjB,YAAoB,CAClB,MAAO,MAAK,SAOd,iBAAiB,EAAoB,CACnC,KAAK,eAAiB,EACtB,KAAK,UAAU,sBACf,KAAK,qBAMP,kBAA0B,CACxB,MAAO,MAAK,eAGd,YAAY,EAAyB,CACnC,KAAK,UAAY,EACjB,KAAK,UAAU,sBACf,KAAK,qBAGP,YAAsB,CACpB,MAAO,MAAK,UAGL,UAAkB,CACzB,MAAO,MAAK,UAAY,KAAK,eAAiB,KAAK,UAAU,WAGtD,WAAmB,CAC1B,MAAO,MAAK,UAAU,YAGf,SAAS,EAAoB,CACpC,KAAK,iBAAiB,GAGf,cAAsB,CAC7B,MACE,MAAK,OACJ,MAAK,yBAA2B,SAC7B,KAAK,YAAc,EACnB,KAAK,yBAA2B,SAC9B,KAAK,YACL,IAtYL,EAAM,0BA0Yb,EAAK,eACH,+BAEA,EAAK,2BAjcC",
6
6
  "names": []
7
7
  }
@@ -21,7 +21,9 @@ module.exports = {
21
21
  .setExtensionInformation(
22
22
  'DebuggerTools',
23
23
  _('Debugger Tools'),
24
- _('Allow to interact with the editor debugger from the game.'),
24
+ _(
25
+ 'Allow to interact with the editor debugger from the game (notably: enable 2D debug draw, log a message in the debugger console).'
26
+ ),
25
27
  'Arthur Pacaud (arthuro555), Aurélien Vivet (Bouh)',
26
28
  'MIT'
27
29
  )
@@ -1,2 +1,2 @@
1
- var gdjs;(function(s){class d extends s.RuntimeBehavior{constructor(t,e,o){super(t,e,o);this._extraBorder=e.extraBorder||0}updateFromBehaviorData(t,e){return t.extraBorder!==e.extraBorder&&(this._extraBorder=e.extraBorder),!0}doStepPostEvents(t){const e=this.owner.getWidth(),o=this.owner.getHeight(),i=this.owner.getDrawableX()+this.owner.getCenterX(),n=this.owner.getDrawableY()+this.owner.getCenterY(),r=t.getLayer(this.owner.getLayer()),a=Math.sqrt(e*e+o*o)/2;(i+a+this._extraBorder<r.getCameraX()-r.getCameraWidth()/2||i-a-this._extraBorder>r.getCameraX()+r.getCameraWidth()/2||n+a+this._extraBorder<r.getCameraY()-r.getCameraHeight()/2||n-a-this._extraBorder>r.getCameraY()+r.getCameraHeight()/2)&&this.owner.deleteFromScene()}setExtraBorder(t){this._extraBorder=t}getExtraBorder(){return this._extraBorder}}s.DestroyOutsideRuntimeBehavior=d,s.registerBehavior("DestroyOutsideBehavior::DestroyOutside",s.DestroyOutsideRuntimeBehavior)})(gdjs||(gdjs={}));
1
+ var gdjs;(function(o){class m extends o.RuntimeBehavior{constructor(t,e,s){super(t,e,s);this._extraBorder=e.extraBorder||0,this._unseenGraceDistance=e.unseenGraceDistance||0,this._hasBeenOnScreen=!1}updateFromBehaviorData(t,e){return t.extraBorder!==e.extraBorder&&(this._extraBorder=e.extraBorder),t.unseenGraceDistance!==e.unseenGraceDistance&&(this._unseenGraceDistance=e.unseenGraceDistance),!0}doStepPostEvents(t){const e=this.owner.getWidth(),s=this.owner.getHeight(),a=this.owner.getDrawableX()+this.owner.getCenterX(),i=this.owner.getDrawableY()+this.owner.getCenterY(),r=t.getLayer(this.owner.getLayer()),n=Math.sqrt(e*e+s*s)/2,c=r.getCameraX()-r.getCameraWidth()/2,h=r.getCameraX()+r.getCameraWidth()/2,u=r.getCameraY()-r.getCameraHeight()/2,d=r.getCameraY()+r.getCameraHeight()/2;a+n+this._extraBorder<c||a-n-this._extraBorder>h||i+n+this._extraBorder<u||i-n-this._extraBorder>d?this._hasBeenOnScreen?this.owner.deleteFromScene():(a+n+this._unseenGraceDistance<c||a-n-this._unseenGraceDistance>h||i+n+this._unseenGraceDistance<u||i-n-this._unseenGraceDistance>d)&&this.owner.deleteFromScene():this._hasBeenOnScreen=!0}setExtraBorder(t){this._extraBorder=t}getExtraBorder(){return this._extraBorder}setUnseenGraceDistance(t){this._unseenGraceDistance=t}getUnseenGraceDistance(){return this._unseenGraceDistance}hasBeenOnScreen(){return this._hasBeenOnScreen}}o.DestroyOutsideRuntimeBehavior=m,o.registerBehavior("DestroyOutsideBehavior::DestroyOutside",o.DestroyOutsideRuntimeBehavior)})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=destroyoutsideruntimebehavior.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/DestroyOutsideBehavior/destroyoutsideruntimebehavior.ts"],
4
- "sourcesContent": ["/*\nGDevelop - DestroyOutside Behavior Extension\nCopyright (c) 2013-2016 Florian Rival (Florian.Rival@gmail.com)\n */\n\nnamespace gdjs {\n /**\n * The DestroyOutsideRuntimeBehavior represents a behavior that destroys the object when it leaves the screen.\n */\n export class DestroyOutsideRuntimeBehavior extends gdjs.RuntimeBehavior {\n _extraBorder: any;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n behaviorData,\n owner\n ) {\n super(instanceContainer, behaviorData, owner);\n this._extraBorder = behaviorData.extraBorder || 0;\n }\n\n updateFromBehaviorData(oldBehaviorData, newBehaviorData): boolean {\n if (oldBehaviorData.extraBorder !== newBehaviorData.extraBorder) {\n this._extraBorder = newBehaviorData.extraBorder;\n }\n return true;\n }\n\n doStepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {\n // TODO: This would better be done using the object AABB (getAABB), as (`getCenterX`;`getCenterY`) point\n // is not necessarily in the middle of the object (for sprites for example).\n const ow = this.owner.getWidth();\n const oh = this.owner.getHeight();\n const ocx = this.owner.getDrawableX() + this.owner.getCenterX();\n const ocy = this.owner.getDrawableY() + this.owner.getCenterY();\n const layer = instanceContainer.getLayer(this.owner.getLayer());\n const boundingCircleRadius = Math.sqrt(ow * ow + oh * oh) / 2.0;\n if (\n ocx + boundingCircleRadius + this._extraBorder <\n layer.getCameraX() - layer.getCameraWidth() / 2 ||\n ocx - boundingCircleRadius - this._extraBorder >\n layer.getCameraX() + layer.getCameraWidth() / 2 ||\n ocy + boundingCircleRadius + this._extraBorder <\n layer.getCameraY() - layer.getCameraHeight() / 2 ||\n ocy - boundingCircleRadius - this._extraBorder >\n layer.getCameraY() + layer.getCameraHeight() / 2\n ) {\n //We are outside the camera area.\n this.owner.deleteFromScene();\n }\n }\n\n /**\n * Set an additional border to the camera viewport as a buffer before the object gets destroyed.\n * @param val Border in pixels.\n */\n setExtraBorder(val: number): void {\n this._extraBorder = val;\n }\n\n /**\n * Get the additional border of the camera viewport buffer which triggers the destruction of an object.\n * @return The additional border around the camera viewport in pixels\n */\n getExtraBorder(): number {\n return this._extraBorder;\n }\n }\n gdjs.registerBehavior(\n 'DestroyOutsideBehavior::DestroyOutside',\n gdjs.DestroyOutsideRuntimeBehavior\n );\n}\n"],
5
- "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAIS,eAA4C,GAAK,eAAgB,CAGtE,YACE,EACA,EACA,EACA,CACA,MAAM,EAAmB,EAAc,GACvC,KAAK,aAAe,EAAa,aAAe,EAGlD,uBAAuB,EAAiB,EAA0B,CAChE,MAAI,GAAgB,cAAgB,EAAgB,aAClD,MAAK,aAAe,EAAgB,aAE/B,GAGT,iBAAiB,EAAkD,CAGjE,KAAM,GAAK,KAAK,MAAM,WAChB,EAAK,KAAK,MAAM,YAChB,EAAM,KAAK,MAAM,eAAiB,KAAK,MAAM,aAC7C,EAAM,KAAK,MAAM,eAAiB,KAAK,MAAM,aAC7C,EAAQ,EAAkB,SAAS,KAAK,MAAM,YAC9C,EAAuB,KAAK,KAAK,EAAK,EAAK,EAAK,GAAM,EAC5D,AACE,GAAM,EAAuB,KAAK,aAChC,EAAM,aAAe,EAAM,iBAAmB,GAChD,EAAM,EAAuB,KAAK,aAChC,EAAM,aAAe,EAAM,iBAAmB,GAChD,EAAM,EAAuB,KAAK,aAChC,EAAM,aAAe,EAAM,kBAAoB,GACjD,EAAM,EAAuB,KAAK,aAChC,EAAM,aAAe,EAAM,kBAAoB,IAGjD,KAAK,MAAM,kBAQf,eAAe,EAAmB,CAChC,KAAK,aAAe,EAOtB,gBAAyB,CACvB,MAAO,MAAK,cAxDT,EAAM,gCA2Db,EAAK,iBACH,yCACA,EAAK,iCAjEC",
4
+ "sourcesContent": ["/*\nGDevelop - DestroyOutside Behavior Extension\nCopyright (c) 2013-2016 Florian Rival (Florian.Rival@gmail.com)\n */\n\nnamespace gdjs {\n /**\n * The DestroyOutsideRuntimeBehavior represents a behavior that destroys the object when it leaves the screen.\n */\n export class DestroyOutsideRuntimeBehavior extends gdjs.RuntimeBehavior {\n _extraBorder: float;\n _unseenGraceDistance: float;\n _hasBeenOnScreen: boolean;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n behaviorData,\n owner\n ) {\n super(instanceContainer, behaviorData, owner);\n this._extraBorder = behaviorData.extraBorder || 0;\n this._unseenGraceDistance = behaviorData.unseenGraceDistance || 0;\n this._hasBeenOnScreen = false;\n }\n\n updateFromBehaviorData(oldBehaviorData, newBehaviorData): boolean {\n if (oldBehaviorData.extraBorder !== newBehaviorData.extraBorder) {\n this._extraBorder = newBehaviorData.extraBorder;\n }\n if (\n oldBehaviorData.unseenGraceDistance !==\n newBehaviorData.unseenGraceDistance\n ) {\n this._unseenGraceDistance = newBehaviorData.unseenGraceDistance;\n }\n return true;\n }\n\n doStepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {\n // TODO: This would better be done using the object AABB (getAABB), as (`getCenterX`;`getCenterY`) point\n // is not necessarily in the middle of the object (for sprites for example).\n const ow = this.owner.getWidth();\n const oh = this.owner.getHeight();\n const ocx = this.owner.getDrawableX() + this.owner.getCenterX();\n const ocy = this.owner.getDrawableY() + this.owner.getCenterY();\n const layer = instanceContainer.getLayer(this.owner.getLayer());\n const boundingCircleRadius = Math.sqrt(ow * ow + oh * oh) / 2.0;\n\n const cameraLeft = layer.getCameraX() - layer.getCameraWidth() / 2;\n const cameraRight = layer.getCameraX() + layer.getCameraWidth() / 2;\n const cameraTop = layer.getCameraY() - layer.getCameraHeight() / 2;\n const cameraBottom = layer.getCameraY() + layer.getCameraHeight() / 2;\n\n if (\n ocx + boundingCircleRadius + this._extraBorder < cameraLeft ||\n ocx - boundingCircleRadius - this._extraBorder > cameraRight ||\n ocy + boundingCircleRadius + this._extraBorder < cameraTop ||\n ocy - boundingCircleRadius - this._extraBorder > cameraBottom\n ) {\n if (this._hasBeenOnScreen) {\n // Object is outside the camera area and object was previously seen inside it:\n // delete it now.\n this.owner.deleteFromScene();\n } else if (\n ocx + boundingCircleRadius + this._unseenGraceDistance < cameraLeft ||\n ocx - boundingCircleRadius - this._unseenGraceDistance >\n cameraRight ||\n ocy + boundingCircleRadius + this._unseenGraceDistance < cameraTop ||\n ocy - boundingCircleRadius - this._unseenGraceDistance > cameraBottom\n ) {\n // Object is outside the camera area and also outside the grace distance:\n // force deletion.\n this.owner.deleteFromScene();\n } else {\n // Object is outside the camera area but inside the grace distance\n // and was never seen inside the camera area: don't delete it yet.\n }\n } else {\n this._hasBeenOnScreen = true;\n }\n }\n\n /**\n * Set the additional border outside the camera area.\n *\n * If the object goes beyond the camera area and this border, it will be deleted (unless it was\n * never seen inside the camera area and this border before, in which case it will be deleted\n * according to the grace distance).\n * @param val Border in pixels.\n */\n setExtraBorder(val: number): void {\n this._extraBorder = val;\n }\n\n /**\n * Get the additional border outside the camera area.\n * @return The additional border around the camera viewport in pixels\n */\n getExtraBorder(): number {\n return this._extraBorder;\n }\n\n /**\n * Change the grace distance before an object is deleted if it's outside the camera area\n * and was never seen inside the camera area. Typically useful to avoid objects being deleted\n * before they are visible when they spawn.\n */\n setUnseenGraceDistance(val: number): void {\n this._unseenGraceDistance = val;\n }\n\n /**\n * Get the grace distance before an object is deleted if it's outside the camera area\n * and was never seen inside the camera area.\n */\n getUnseenGraceDistance(): number {\n return this._unseenGraceDistance;\n }\n\n /**\n * Check if this object has been visible on screen (precisely: inside the camera area *including* the extra border).\n */\n hasBeenOnScreen(): boolean {\n return this._hasBeenOnScreen;\n }\n }\n gdjs.registerBehavior(\n 'DestroyOutsideBehavior::DestroyOutside',\n gdjs.DestroyOutsideRuntimeBehavior\n );\n}\n"],
5
+ "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAIS,eAA4C,GAAK,eAAgB,CAKtE,YACE,EACA,EACA,EACA,CACA,MAAM,EAAmB,EAAc,GACvC,KAAK,aAAe,EAAa,aAAe,EAChD,KAAK,qBAAuB,EAAa,qBAAuB,EAChE,KAAK,iBAAmB,GAG1B,uBAAuB,EAAiB,EAA0B,CAChE,MAAI,GAAgB,cAAgB,EAAgB,aAClD,MAAK,aAAe,EAAgB,aAGpC,EAAgB,sBAChB,EAAgB,qBAEhB,MAAK,qBAAuB,EAAgB,qBAEvC,GAGT,iBAAiB,EAAkD,CAGjE,KAAM,GAAK,KAAK,MAAM,WAChB,EAAK,KAAK,MAAM,YAChB,EAAM,KAAK,MAAM,eAAiB,KAAK,MAAM,aAC7C,EAAM,KAAK,MAAM,eAAiB,KAAK,MAAM,aAC7C,EAAQ,EAAkB,SAAS,KAAK,MAAM,YAC9C,EAAuB,KAAK,KAAK,EAAK,EAAK,EAAK,GAAM,EAEtD,EAAa,EAAM,aAAe,EAAM,iBAAmB,EAC3D,EAAc,EAAM,aAAe,EAAM,iBAAmB,EAC5D,EAAY,EAAM,aAAe,EAAM,kBAAoB,EAC3D,EAAe,EAAM,aAAe,EAAM,kBAAoB,EAEpE,AACE,EAAM,EAAuB,KAAK,aAAe,GACjD,EAAM,EAAuB,KAAK,aAAe,GACjD,EAAM,EAAuB,KAAK,aAAe,GACjD,EAAM,EAAuB,KAAK,aAAe,EAEjD,AAAI,KAAK,iBAGP,KAAK,MAAM,kBAEX,GAAM,EAAuB,KAAK,qBAAuB,GACzD,EAAM,EAAuB,KAAK,qBAChC,GACF,EAAM,EAAuB,KAAK,qBAAuB,GACzD,EAAM,EAAuB,KAAK,qBAAuB,IAIzD,KAAK,MAAM,kBAMb,KAAK,iBAAmB,GAY5B,eAAe,EAAmB,CAChC,KAAK,aAAe,EAOtB,gBAAyB,CACvB,MAAO,MAAK,aAQd,uBAAuB,EAAmB,CACxC,KAAK,qBAAuB,EAO9B,wBAAiC,CAC/B,MAAO,MAAK,qBAMd,iBAA2B,CACzB,MAAO,MAAK,kBAlHT,EAAM,gCAqHb,EAAK,iBACH,yCACA,EAAK,iCA3HC",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(r){class o extends r.RuntimeObject{constructor(e,t){super(e,t);this._radius=t.content.radius>0?t.content.radius:1,this._color=r.rgbOrHexToRGBColor(t.content.color),this._debugMode=t.content.debugMode,this._texture=t.content.texture,this._obstaclesManager=r.LightObstaclesManager.getManager(e),this._renderer=new r.LightRuntimeObjectRenderer(this,e),this._instanceContainer=e,this.onCreated()}static hexToRGBColor(e){const t=parseInt(e.replace("#",""),16);return[t>>16&255,t>>8&255,t&255]}getRendererObject(){return this._renderer.getRendererObject()}updateFromObjectData(e,t){return e.content.radius!==t.content.radius&&this.setRadius(t.content.radius),e.content.color!==t.content.color&&(this._color=r.rgbOrHexToRGBColor(t.content.color),this._renderer.updateColor()),e.content.texture!==t.content.texture&&(this._texture=t.content.texture,this._renderer.updateMesh()),e.content.debugMode!==t.content.debugMode&&(this._debugMode=t.content.debugMode,this._renderer.updateDebugMode()),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),rad:this.getRadius(),col:this.getColor()}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),e.rad!==void 0&&this.setRadius(e.rad),e.col!==void 0&&this.setColor(e.col)}updatePreRender(){this._renderer.ensureUpToDate()}getRadius(){return this._radius}setRadius(e){this._radius=e>0?e:1,this._renderer.updateRadius()}getHeight(){return 2*this._radius}getWidth(){return 2*this._radius}getDrawableX(){return this.x-this._radius}getDrawableY(){return this.y-this._radius}getColor(){return this._color[0]+";"+this._color[1]+";"+this._color[2]}setColor(e){this._color=r.rgbOrHexToRGBColor(e),this._renderer.updateColor()}getObstaclesManager(){return this._obstaclesManager}getDebugMode(){return this._debugMode}getTexture(){return this._texture}}r.LightRuntimeObject=o,r.registerObject("Lighting::LightObject",r.LightRuntimeObject)})(gdjs||(gdjs={}));
1
+ var gdjs;(function(r){class o extends r.RuntimeObject{constructor(e,t){super(e,t);this._radius=t.content.radius>0?t.content.radius:1,this._color=r.rgbOrHexToRGBColor(t.content.color),this._debugMode=t.content.debugMode,this._texture=t.content.texture,this._obstaclesManager=r.LightObstaclesManager.getManager(e),this._renderer=new r.LightRuntimeObjectRenderer(this,e),this._instanceContainer=e,this.onCreated()}static hexToRGBColor(e){const t=parseInt(e.replace("#",""),16);return[t>>16&255,t>>8&255,t&255]}getRendererObject(){return this._renderer.getRendererObject()}updateFromObjectData(e,t){return e.content.radius!==t.content.radius&&this.setRadius(t.content.radius),e.content.color!==t.content.color&&(this._color=r.rgbOrHexToRGBColor(t.content.color),this._renderer.updateColor()),e.content.texture!==t.content.texture&&(this._texture=t.content.texture,this._renderer.updateMesh()),e.content.debugMode!==t.content.debugMode&&(this._debugMode=t.content.debugMode,this._renderer.updateDebugMode()),!0}getNetworkSyncData(e){return{...super.getNetworkSyncData(e),rad:this.getRadius(),col:this.getColor()}}updateFromNetworkSyncData(e,t){super.updateFromNetworkSyncData(e,t),e.rad!==void 0&&this.setRadius(e.rad),e.col!==void 0&&this.setColor(e.col)}updatePreRender(){this._renderer.ensureUpToDate()}getRadius(){return this._radius}setRadius(e){this._radius=e>0?e:1,this._renderer.updateRadius()}getHeight(){return 2*this._radius}getWidth(){return 2*this._radius}getDrawableX(){return this.x-this._radius}getDrawableY(){return this.y-this._radius}getColor(){return this._color[0]+";"+this._color[1]+";"+this._color[2]}setColor(e){this._color=r.rgbOrHexToRGBColor(e),this._renderer.updateColor()}getObstaclesManager(){return this._obstaclesManager}getDebugMode(){return this._debugMode}getTexture(){return this._texture}}r.LightRuntimeObject=o,r.registerObject("Lighting::LightObject",r.LightRuntimeObject)})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=lightruntimeobject.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/Lighting/lightruntimeobject.ts"],
4
- "sourcesContent": ["namespace gdjs {\n export type LightObjectDataType = {\n /** The base parameters of light object. */\n content: {\n /** The radius of light object. */\n radius: number;\n /** A string representing color in hexadecimal format. */\n color: string;\n /** A string representing the name of texture used for light object. */\n texture: string;\n /** true if the light objects shows debug graphics, false otherwise. */\n debugMode: boolean;\n };\n };\n\n export type LightObjectData = ObjectData & LightObjectDataType;\n\n export type LightNetworkSyncDataType = {\n rad: number;\n col: string;\n };\n\n export type LightNetworkSyncData = ObjectNetworkSyncData &\n LightNetworkSyncDataType;\n\n /**\n * Displays a Light object.\n */\n export class LightRuntimeObject extends gdjs.RuntimeObject {\n _radius: number;\n\n /** color in format [r, g, b], where each component is in the range [0, 255] */\n _color: integer[];\n _debugMode: boolean;\n _texture: string;\n _obstaclesManager: gdjs.LightObstaclesManager;\n _renderer: gdjs.LightRuntimeObjectRenderer;\n _instanceContainer: gdjs.RuntimeScene;\n\n constructor(\n runtimeScene: gdjs.RuntimeScene,\n lightObjectData: LightObjectData\n ) {\n super(runtimeScene, lightObjectData);\n this._radius =\n lightObjectData.content.radius > 0 ? lightObjectData.content.radius : 1;\n this._color = gdjs.rgbOrHexToRGBColor(lightObjectData.content.color);\n this._debugMode = lightObjectData.content.debugMode;\n this._texture = lightObjectData.content.texture;\n this._obstaclesManager =\n gdjs.LightObstaclesManager.getManager(runtimeScene);\n this._renderer = new gdjs.LightRuntimeObjectRenderer(this, runtimeScene);\n this._instanceContainer = runtimeScene;\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n static hexToRGBColor(hex) {\n const hexNumber = parseInt(hex.replace('#', ''), 16);\n return [(hexNumber >> 16) & 255, (hexNumber >> 8) & 255, hexNumber & 255];\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n updateFromObjectData(\n oldObjectData: LightObjectData,\n newObjectData: LightObjectData\n ): boolean {\n if (oldObjectData.content.radius !== newObjectData.content.radius) {\n this.setRadius(newObjectData.content.radius);\n }\n if (oldObjectData.content.color !== newObjectData.content.color) {\n this._color = gdjs.rgbOrHexToRGBColor(newObjectData.content.color);\n this._renderer.updateColor();\n }\n if (oldObjectData.content.texture !== newObjectData.content.texture) {\n this._texture = newObjectData.content.texture;\n this._renderer.updateMesh();\n }\n if (oldObjectData.content.debugMode !== newObjectData.content.debugMode) {\n this._debugMode = newObjectData.content.debugMode;\n this._renderer.updateDebugMode();\n }\n return true;\n }\n\n getNetworkSyncData(): LightNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n rad: this.getRadius(),\n col: this.getColor(),\n };\n }\n\n updateFromNetworkSyncData(networkSyncData: LightNetworkSyncData): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (networkSyncData.rad !== undefined) {\n this.setRadius(networkSyncData.rad);\n }\n if (networkSyncData.col !== undefined) {\n this.setColor(networkSyncData.col);\n }\n }\n\n updatePreRender(): void {\n this._renderer.ensureUpToDate();\n }\n\n /**\n * Get the radius of the light object.\n * @returns radius of the light object.\n */\n getRadius(): number {\n return this._radius;\n }\n\n /**\n * Set the radius of the light object.\n */\n setRadius(radius: number): void {\n this._radius = radius > 0 ? radius : 1;\n this._renderer.updateRadius();\n }\n\n /**\n * Get the height of the light object.\n * @returns height of light object.\n */\n getHeight(): float {\n return 2 * this._radius;\n }\n\n /**\n * Get the width of the light object.\n * @returns width of light object.\n */\n getWidth(): float {\n return 2 * this._radius;\n }\n\n /**\n * Get the x co-ordinate of the top-left vertex/point of light object.\n * @returns x co-ordinate of the top-left vertex/point.\n */\n getDrawableX(): float {\n return this.x - this._radius;\n }\n\n /**\n * Get the y co-ordinate of the top-left vertex/point of light object.\n * @returns y co-ordinate of the top-left vertex/point.\n */\n getDrawableY(): float {\n return this.y - this._radius;\n }\n\n /**\n * Get the color of the light object as a \"R;G;B\" string.\n * @returns the color of light object in \"R;G;B\" format.\n */\n getColor(): string {\n return this._color[0] + ';' + this._color[1] + ';' + this._color[2];\n }\n\n /**\n * Set the color of the light object in format \"R;G;B\" string, with components in the range of [0-255].\n */\n setColor(color: string): void {\n this._color = gdjs.rgbOrHexToRGBColor(color);\n this._renderer.updateColor();\n }\n\n /**\n * Get the light obstacles manager.\n * @returns the light obstacles manager.\n */\n getObstaclesManager(): gdjs.LightObstaclesManager {\n return this._obstaclesManager;\n }\n\n /**\n * Returns true if the light shows debug graphics, false otherwise.\n * @returns true if debug mode is activated.\n */\n getDebugMode(): boolean {\n return this._debugMode;\n }\n\n /**\n * Returns the path of texture resource.\n * @returns the path of texture.\n */\n getTexture(): string {\n return this._texture;\n }\n }\n gdjs.registerObject('Lighting::LightObject', gdjs.LightRuntimeObject);\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CA4BS,eAAiC,GAAK,aAAc,CAWzD,YACE,EACA,EACA,CACA,MAAM,EAAc,GACpB,KAAK,QACH,EAAgB,QAAQ,OAAS,EAAI,EAAgB,QAAQ,OAAS,EACxE,KAAK,OAAS,EAAK,mBAAmB,EAAgB,QAAQ,OAC9D,KAAK,WAAa,EAAgB,QAAQ,UAC1C,KAAK,SAAW,EAAgB,QAAQ,QACxC,KAAK,kBACH,EAAK,sBAAsB,WAAW,GACxC,KAAK,UAAY,GAAI,GAAK,2BAA2B,KAAM,GAC3D,KAAK,mBAAqB,EAG1B,KAAK,kBAGA,eAAc,EAAK,CACxB,KAAM,GAAY,SAAS,EAAI,QAAQ,IAAK,IAAK,IACjD,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AAqB,CACnB,MAAO,MAAK,UAzKT,EAAM,qBA4Kb,EAAK,eAAe,wBAAyB,EAAK,sBAxM1C",
4
+ "sourcesContent": ["namespace gdjs {\n export type LightObjectDataType = {\n /** The base parameters of light object. */\n content: {\n /** The radius of light object. */\n radius: number;\n /** A string representing color in hexadecimal format. */\n color: string;\n /** A string representing the name of texture used for light object. */\n texture: string;\n /** true if the light objects shows debug graphics, false otherwise. */\n debugMode: boolean;\n };\n };\n\n export type LightObjectData = ObjectData & LightObjectDataType;\n\n export type LightNetworkSyncDataType = {\n rad: number;\n col: string;\n };\n\n export type LightNetworkSyncData = ObjectNetworkSyncData &\n LightNetworkSyncDataType;\n\n /**\n * Displays a Light object.\n */\n export class LightRuntimeObject extends gdjs.RuntimeObject {\n _radius: number;\n\n /** color in format [r, g, b], where each component is in the range [0, 255] */\n _color: integer[];\n _debugMode: boolean;\n _texture: string;\n _obstaclesManager: gdjs.LightObstaclesManager;\n _renderer: gdjs.LightRuntimeObjectRenderer;\n _instanceContainer: gdjs.RuntimeScene;\n\n constructor(\n runtimeScene: gdjs.RuntimeScene,\n lightObjectData: LightObjectData\n ) {\n super(runtimeScene, lightObjectData);\n this._radius =\n lightObjectData.content.radius > 0 ? lightObjectData.content.radius : 1;\n this._color = gdjs.rgbOrHexToRGBColor(lightObjectData.content.color);\n this._debugMode = lightObjectData.content.debugMode;\n this._texture = lightObjectData.content.texture;\n this._obstaclesManager =\n gdjs.LightObstaclesManager.getManager(runtimeScene);\n this._renderer = new gdjs.LightRuntimeObjectRenderer(this, runtimeScene);\n this._instanceContainer = runtimeScene;\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n static hexToRGBColor(hex) {\n const hexNumber = parseInt(hex.replace('#', ''), 16);\n return [(hexNumber >> 16) & 255, (hexNumber >> 8) & 255, hexNumber & 255];\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n updateFromObjectData(\n oldObjectData: LightObjectData,\n newObjectData: LightObjectData\n ): boolean {\n if (oldObjectData.content.radius !== newObjectData.content.radius) {\n this.setRadius(newObjectData.content.radius);\n }\n if (oldObjectData.content.color !== newObjectData.content.color) {\n this._color = gdjs.rgbOrHexToRGBColor(newObjectData.content.color);\n this._renderer.updateColor();\n }\n if (oldObjectData.content.texture !== newObjectData.content.texture) {\n this._texture = newObjectData.content.texture;\n this._renderer.updateMesh();\n }\n if (oldObjectData.content.debugMode !== newObjectData.content.debugMode) {\n this._debugMode = newObjectData.content.debugMode;\n this._renderer.updateDebugMode();\n }\n return true;\n }\n\n getNetworkSyncData(\n syncOptions: GetNetworkSyncDataOptions\n ): LightNetworkSyncData {\n return {\n ...super.getNetworkSyncData(syncOptions),\n rad: this.getRadius(),\n col: this.getColor(),\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: LightNetworkSyncData,\n options: UpdateFromNetworkSyncDataOptions\n ): void {\n super.updateFromNetworkSyncData(networkSyncData, options);\n\n if (networkSyncData.rad !== undefined) {\n this.setRadius(networkSyncData.rad);\n }\n if (networkSyncData.col !== undefined) {\n this.setColor(networkSyncData.col);\n }\n }\n\n updatePreRender(): void {\n this._renderer.ensureUpToDate();\n }\n\n /**\n * Get the radius of the light object.\n * @returns radius of the light object.\n */\n getRadius(): number {\n return this._radius;\n }\n\n /**\n * Set the radius of the light object.\n */\n setRadius(radius: number): void {\n this._radius = radius > 0 ? radius : 1;\n this._renderer.updateRadius();\n }\n\n /**\n * Get the height of the light object.\n * @returns height of light object.\n */\n getHeight(): float {\n return 2 * this._radius;\n }\n\n /**\n * Get the width of the light object.\n * @returns width of light object.\n */\n getWidth(): float {\n return 2 * this._radius;\n }\n\n /**\n * Get the x co-ordinate of the top-left vertex/point of light object.\n * @returns x co-ordinate of the top-left vertex/point.\n */\n getDrawableX(): float {\n return this.x - this._radius;\n }\n\n /**\n * Get the y co-ordinate of the top-left vertex/point of light object.\n * @returns y co-ordinate of the top-left vertex/point.\n */\n getDrawableY(): float {\n return this.y - this._radius;\n }\n\n /**\n * Get the color of the light object as a \"R;G;B\" string.\n * @returns the color of light object in \"R;G;B\" format.\n */\n getColor(): string {\n return this._color[0] + ';' + this._color[1] + ';' + this._color[2];\n }\n\n /**\n * Set the color of the light object in format \"R;G;B\" string, with components in the range of [0-255].\n */\n setColor(color: string): void {\n this._color = gdjs.rgbOrHexToRGBColor(color);\n this._renderer.updateColor();\n }\n\n /**\n * Get the light obstacles manager.\n * @returns the light obstacles manager.\n */\n getObstaclesManager(): gdjs.LightObstaclesManager {\n return this._obstaclesManager;\n }\n\n /**\n * Returns true if the light shows debug graphics, false otherwise.\n * @returns true if debug mode is activated.\n */\n getDebugMode(): boolean {\n return this._debugMode;\n }\n\n /**\n * Returns the path of texture resource.\n * @returns the path of texture.\n */\n getTexture(): string {\n return this._texture;\n }\n }\n gdjs.registerObject('Lighting::LightObject', gdjs.LightRuntimeObject);\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CA4BS,eAAiC,GAAK,aAAc,CAWzD,YACE,EACA,EACA,CACA,MAAM,EAAc,GACpB,KAAK,QACH,EAAgB,QAAQ,OAAS,EAAI,EAAgB,QAAQ,OAAS,EACxE,KAAK,OAAS,EAAK,mBAAmB,EAAgB,QAAQ,OAC9D,KAAK,WAAa,EAAgB,QAAQ,UAC1C,KAAK,SAAW,EAAgB,QAAQ,QACxC,KAAK,kBACH,EAAK,sBAAsB,WAAW,GACxC,KAAK,UAAY,GAAI,GAAK,2BAA2B,KAAM,GAC3D,KAAK,mBAAqB,EAG1B,KAAK,kBAGA,eAAc,EAAK,CACxB,KAAM,GAAY,SAAS,EAAI,QAAQ,IAAK,IAAK,IACjD,MAAO,CAAE,GAAa,GAAM,IAAM,GAAa,EAAK,IAAK,EAAY,KAGvE,mBAAoB,CAClB,MAAO,MAAK,UAAU,oBAGxB,qBACE,EACA,EACS,CACT,MAAI,GAAc,QAAQ,SAAW,EAAc,QAAQ,QACzD,KAAK,UAAU,EAAc,QAAQ,QAEn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er - Debug");s.Logger.getDefaultConsoleLoggerOutput().discardGroup("Multiplayer - Debug");class je{constructor(S){this.clear=()=>{this.cache.clear(),this.keys=[]};this.maxSize=S,this.cache=new Set,this.keys=[]}has(S){return this.cache.has(S)}add(S){if(this.cache.size>=this.maxSize){const D=this.keys.shift();D&&this.cache.delete(D)}this.cache.add(S),this.keys.push(S)}}class ue{constructor(){this._updates=[]}store(S){this._updates.push(S),this._updates.length>10&&this._updates.shift()}getUpdates(){return this._updates}remove(S){const D=this._updates.indexOf(S);D!==-1&&this._updates.splice(D,1)}clear(){this._updates=[]}}const Te=({target:C,source:S})=>{for(const D in S)S.hasOwnProperty(D)&&!C.hasOwnProperty(D)&&(C[D]=S[D]);for(const D in C)C.hasOwnProperty(D)&&!S.hasOwnProperty(D)&&delete C[D]};s.makeMultiplayerMessageManager=()=>{const C=0,S=0,D=0,Je=0,v=window.performance&&typeof window.performance.now=="function"?window.performance.now.bind(window.performance):Date.now,_e=200,Le=4,U=new je(500);let O={},H={};const xe=1;let me=0,Q=null,W=0,V=new ue;const Ge=1;let de=0,J=null,F=0,B=new ue;const Ee=1;let G=0,E={},pe={},M={},A=[],$=[],K={};const x=({originalMessageName:e,originalData:t,expectedMessageName:n,otherPeerIds:r,shouldCancelMessageIfTimesOut:a,maxNumberOfRetries:o,messageRetryTime:l})=>{!s.multiplayer.isLobbyGameRunning()||(O[n]||(O[n]={}),g.info(`Adding expected message ${n} from ${r.join(", ")}.`),r.forEach(c=>{O[n][c]={acknowledged:!1,lastMessageSentAt:v(),originalMessageName:e,originalData:t,shouldCancelMessageIfTimesOut:a,numberOfRetries:0,maxNumberOfRetries:o||Le,messageRetryTime:l||_e}}))},fe=({sceneNetworkId:e,instanceNetworkId:t})=>(H[e]||(H[e]={}),H[e][t]||0),ye=({sceneNetworkId:e,instanceNetworkId:t,clock:n})=>{H[e]||(H[e]={}),H[e][t]=n},w=(e,t,n)=>{if(!(S>0&&Math.random()<S)){if(D>0&&Math.random()<D){setTimeout(()=>{s.multiplayerPeerJsHelper.sendDataTo(e,t,n)},Je);return}if(C>0){setTimeout(()=>{s.multiplayerPeerJsHelper.sendDataTo(e,t,n)},C);return}s.multiplayerPeerJsHelper.sendDataTo(e,t,n)}},Ue=(e,t,n)=>{if(!e.length)return null;let r=null,a=1/0;for(let o=0;o<e.length;++o){if(e[o].networkId)continue;const l=e[o],c=Math.pow(l.getX()-t,2)+Math.pow(l.getY()-n,2);c<a&&(r=l,a=c)}return r},Z=({runtimeScene:e,objectName:t,instanceNetworkId:n,instanceX:r,instanceY:a,shouldCreateIfNotFound:o})=>{const l=e.getInstancesOf(t);if(!l)return null;let c=l.find(i=>i.networkId===n)||null;if(!c&&r!==void 0&&a!==void 0){g.info(`instance ${t} ${n} not found with network ID, trying to find it with position ${r}/${a}.`);const i=Ue(l,r,a);i&&(g.info(`Found closest instance for object ${t} ${n} with no network ID.`),c=i,c.networkId=n)}if(!c&&o){g.info(`Instance ${n} still not found, Creating instance ${t}.`);const i=e.createObject(t);if(!i)return null;i.networkId=n,c=i}return c},Y="#changeInstanceOwner",he=/#changeInstanceOwner#owner_(\d+)#object_(.+)#instance_(.+)/,We=({objectOwner:e,objectName:t,instanceNetworkId:n,newObjectOwner:r,instanceX:a,instanceY:o,sceneNetworkId:l})=>({messageName:`${Y}#owner_${e}#object_${t}#instance_${n}`,messageData:{previousOwner:e,newOwner:r,instanceX:a,instanceY:o,sceneNetworkId:l}}),ee="#instanceOwnerChanged",Ve=/#instanceOwnerChanged#owner_(\d+)#object_(.+)#instance_(.+)/,be=e=>e.replace(Y,ee),Fe=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(Y)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();!l.length||l.forEach(c=>{const i=c.getData(),d=c.getSender(),p=he.exec(a);if(!p)return;const f=p[2],u=p[3],m=i.previousOwner,y=i.newOwner,I=i.sceneNetworkId;if(I!==e.networkId){g.info(`Object ${f} is in scene ${I}, but we are on ${e.networkId}. Skipping.`);return}const P=Z({runtimeScene:e,objectName:f,instanceNetworkId:u,instanceX:i.instanceX,instanceY:i.instanceY});if(!P){g.info(`Instance ${u} not found, it must have been destroyed.`);return}const h=P.getBehavior("MultiplayerObject");if(!h){g.info(`Object ${f} does not have the MultiplayerObjectBehavior, cannot change ownership.`);return}const b=h.getPlayerObjectOwnership(),N=b===m||b===y;if(s.multiplayer.isCurrentPlayerHost()&&!N){g.info(`Object ${f} with instance network ID ${u} does not have the expected owner. Wanted to change from ${m} to ${y}, but object has owner ${b}.`);return}g.info(`Changing ownership of object ${f} to ${y}.`),h.playerNumber=y;const _=be(a);if(g.info(`Sending acknowledgment of ownership change of object ${f} from ${m} to ${y} with instance network ID ${u} to ${d}.`),w([d],_,{}),s.multiplayer.isCurrentPlayerHost()){const j=s.multiplayerPeerJsHelper.getAllPeers().filter(R=>R!==d);if(!j.length)return;x({originalMessageName:a,originalData:i,expectedMessageName:_,otherPeerIds:j,shouldCancelMessageIfTimesOut:!1}),g.info(`Relaying ownership change of object ${f} with instance network ID ${u} to ${j.join(", ")}.`),w(j,a,i)}})})},Me="#updateInstance",Be=/#updateInstance#owner_(\d+)#object_(.+)#instance_(.+)#scene_(.+)/,Ke=({objectOwner:e,objectName:t,instanceNetworkId:n,objectNetworkSyncData:r,sceneNetworkId:a})=>({messageName:`${Me}#owner_${e}#object_${t}#instance_${n}#scene_${a}`,messageData:r}),Ye=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(Me)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();if(!l.length)return;l.slice().reverse().forEach(i=>{const d=i.getData(),p=i.getSender(),f=Be.exec(a);if(!f)return;const u=parseInt(f[1],10);if(u===s.multiplayer.playerNumber)return;const m=f[2],y=f[3],I=f[4];if(I!==e.networkId){g.info(`Object ${m} is in scene ${I}, but we are on ${e.networkId}. Skipping.`);return}const P=d._clock,h=fe({sceneNetworkId:I,instanceNetworkId:y});if(P<=h)return;const b=Z({runtimeScene:e,objectName:m,instanceNetworkId:y,shouldCreateIfNotFound:!0,instanceX:d.x,instanceY:d.y});if(!b){k.error("Instance could not be found or created.");return}const N=b.getBehavior("MultiplayerObject");if(!N){k.error(`Object ${m} does not have the MultiplayerObjectBehavior, cannot update it.`);return}if(N.getPlayerObjectOwnership()===s.multiplayer.playerNumber){g.info(`Object ${m} with instance network ID ${y} is owned by us ${s.multiplayer.playerNumber}, ignoring update message from ${u}.`);return}if(N.getPlayerObjectOwnership()!==u&&(g.info(`Object ${m} with instance network ID ${y} is owned by ${N.getPlayerObjectOwnership()} on our game, changing ownership to ${u} as part of the update event.`),N.playerNumber=u),b.updateFromNetworkSyncData(d),ye({sceneNetworkId:I,instanceNetworkId:y,clock:P}),N._clock=P,s.multiplayer.isCurrentPlayerHost()){const T=s.multiplayerPeerJsHelper.getAllPeers().filter(j=>j!==p);if(!T.length)return;w(T,a,d)}})})},q="#changeVariableOwner",we=/#changeVariableOwner#owner_(\d+)#variable_(.+)/,qe=({variableOwner:e,variableNetworkId:t,newVariableOwner:n})=>({messageName:`${q}#owner_${e}#variable_${t}`,messageData:{previousOwner:e,newOwner:n}}),te="#variableOwnerChanged",Xe=/#variableOwnerChanged#owner_(\d+)#variable_(.+)/,Ie=e=>e.replace(q,te),ze=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(q)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();!l.length||l.forEach(c=>{const i=c.getData(),d=c.getSender(),p=we.exec(a);if(!p)return;const f=p[2],u=i.previousOwner,m=i.newOwner,{type:y,name:I,containerId:P}=s.multiplayerVariablesManager.getVariableTypeAndNameFromNetworkId(f);if(y==="scene"&&P!==e.networkId){g.info(`Variable ${I} is in scene ${P}, but we are on ${e.networkId}. Skipping.`);return}const h=P==="game"?e.getGame().getVariables():e.getVariables();if(!h.has(I)){k.error(`Variable with ID ${f} not found whilst syncing. This should not happen.`);return}const b=h.get(I),N=b.getPlayerOwnership(),_=N===u||N===m;if(s.multiplayer.isCurrentPlayerHost()&&!_){g.info(`Variable with ID ${f} does not have the expected owner. Wanted to change from ${u} to ${m}, but variable has owner ${N}.`);return}g.info(`Changing ownership of variable ${I} to ${m}.`),b.setPlayerOwnership(m);const T=Ie(a);if(g.info(`Sending acknowledgment of ownership change of variable with ID ${f} from ${u} to ${m} to ${d}.`),w([d],T,{}),s.multiplayer.isCurrentPlayerHost()){const R=s.multiplayerPeerJsHelper.getAllPeers().filter(z=>z!==d);if(!R.length)return;x({originalMessageName:a,originalData:i,expectedMessageName:T,otherPeerIds:R,shouldCancelMessageIfTimesOut:!1}),g.info(`Relaying ownership change of variable with Id ${f} to ${R.join(", ")}.`),w(R,a,i)}})})},Qe=e=>e.startsWith(ne)?at:e.startsWith(ee)?Ve:e.startsWith(te)?Xe:e.startsWith(re)?ct:null,Ze=e=>e.startsWith(ne)||e.startsWith(ee)||e.startsWith(te)||e.startsWith(re),et=()=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const e=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(e.keys()).filter(Ze).forEach(r=>{const a=e.get(r);if(!a)return;const o=a.getMessages();!o.length||o.forEach(l=>{const c=l.getData(),i=l.getSender();g.info(`Received acknowledgment for message ${r}.`);const d=Qe(r);if(!d){k.error(`Invalid acknowledgment message ${r}.`);return}const p=d.exec(r);if(!p){k.error(`Invalid acknowledgment message ${r}.`);return}if(!O[r]||!O[r][i])return;const f=c._clock;if(f!==void 0){const u=p[3],m=p[4],y=fe({sceneNetworkId:m,instanceNetworkId:u});if(f<=y)return;ye({sceneNetworkId:m,instanceNetworkId:u,clock:f})}g.info(`Marking message ${r} as acknowledged from ${i}.`),O[r][i].acknowledged=!0})})},tt=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;Object.keys(O).forEach(n=>{const r=O[n],a=Object.keys(r).filter(o=>!r[o].acknowledged);if(!a.length)g.info(`All peers have acknowledged message ${n}.`),delete O[n];else for(const o of a){const{lastMessageSentAt:l,originalMessageName:c,originalData:i,numberOfRetries:d,maxNumberOfRetries:p,messageRetryTime:f}=r[o];if(v()-l>f){if(d>=p){if(g.info(`Giving up on message ${n} for ${o}.`),r[o].shouldCancelMessageIfTimesOut){if(c.startsWith(Y)){const u=he.exec(c);if(!u){delete O[n];return}const m=u[2],y=u[3],I=e.getInstancesOf(m);if(!I){delete O[n];return}let P=I.find(N=>N.networkId===y);if(!P){delete O[n];return}const h=P.getBehavior("MultiplayerObject");if(!h){k.error(`Object ${m} does not have the MultiplayerObjectBehavior, cannot revert ownership.`),delete O[n];return}const b=i.previousOwner;if(b===void 0){delete O[n];return}h.playerNumber=b||0}if(c.startsWith(q)){const u=we.exec(c);if(!u){delete O[n];return}const m=u[2],y=i.previousOwner,{type:I,name:P,containerId:h}=s.multiplayerVariablesManager.getVariableTypeAndNameFromNetworkId(m);if(I==="scene"&&h!==e.networkId){g.info(`Variable ${P} is in scene ${h}, but we are on ${e.networkId}. Skipping ownership revert.`),delete O[n];return}const b=h==="game"?e.getGame().getVariables():e.getVariables();if(!b.has(P)){k.error(`Variable with ID ${m} not found while reverting ownership. This should not happen.`),delete O[n];return}const N=b.get(P);if(y===void 0){delete O[n];return}N.setPlayerOwnership(y||0)}}delete O[n];continue}w([o],c,i),r[o].lastMessageSentAt=v(),r[o].numberOfRetries=d+1}}})},se="#destroyInstance",st=/#destroyInstance#owner_(\d+)#object_(.+)#instance_(.+)#scene_(.+)/,nt=({objectOwner:e,objectName:t,instanceNetworkId:n,sceneNetworkId:r})=>({messageName:`${se}#owner_${e}#object_${t}#instance_${n}#scene_${r}`,messageData:{}}),ne="#instanceDestroyed",at=/#instanceDestroyed#owner_(\d+)#object_(.+)#instance_(.+)/,Pe=e=>e.replace(se,ne),rt=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(se)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();!l.length||l.forEach(c=>{const i=c.getData(),d=c.getSender();g.info(`Received message ${a} with data ${JSON.stringify(i)}.`);const p=st.exec(a);if(!p||parseInt(p[1],10)===s.multiplayer.playerNumber)return;const u=p[2],m=p[3],y=p[4];if(y!==e.networkId){g.info(`Object ${u} is in scene ${y}, but we are on ${e.networkId}. Skipping.`);return}const I=Z({runtimeScene:e,objectName:u,instanceNetworkId:m}),P=Pe(a);if(!I){g.info("Instance was not found in the scene, sending acknowledgment anyway."),w([d],P,{});return}if(g.info(`Destroying object ${u} with instance network ID ${m}.`),I.deleteFromScene(),g.info(`Sending acknowledgment of destruction of object ${u} with instance network ID ${m} to ${d}.`),w([d],P,{}),s.multiplayer.isCurrentPlayerHost()){const b=s.multiplayerPeerJsHelper.getAllPeers().filter(N=>N!==d);if(!b.length)return;x({originalMessageName:a,originalData:i,expectedMessageName:P,otherPeerIds:b,shouldCancelMessageIfTimesOut:!1}),g.info(`Relaying instance destroyed message for object ${u} with instance network ID ${m} to ${b.join(", ")}.`),w(b,a,i)}})})},ae="#customMessage",ot=/#customMessage#(.+)/,X=e=>`${ae}#${e}`,it=({userMessageName:e,userMessageData:t,senderPlayerNumber:n})=>{const r=s.makeUuid();return{messageName:X(e),messageData:{data:t,uniqueId:r,senderPlayerNumber:n}}},re="#ackCustomMessage",ct=/#ackCustomMessage#(.+)/,Ne=e=>e.replace(ae,re),Oe=(e,t)=>{const n=s.multiplayerPeerJsHelper.getAllPeers(),r=s.multiplayer.getCurrentPlayerNumber(),{messageName:a,messageData:o}=it({userMessageName:e,userMessageData:t,senderPlayerNumber:r}),l=Ne(a);x({originalMessageName:a,originalData:o,expectedMessageName:l,otherPeerIds:n,shouldCancelMessageIfTimesOut:!1}),g.info(`Sending custom message ${e} with data ${JSON.stringify(t)}.`),w(n,a,o),s.multiplayer.isCurrentPlayerHost()&&s.multiplayerPeerJsHelper.getOrCreateMessagesList(a).pushMessage(o,s.multiplayerPeerJsHelper.getCurrentId())},lt=(e,t)=>{const n=t.toJSObject();g.info(`Sending custom message ${e} with data ${JSON.stringify(n)}.`),Oe(e,n)},gt=e=>{const t=X(e),r=s.multiplayerPeerJsHelper.getAllMessagesMap().get(t);if(!r)return;const a=r.getMessages();if(!a.length)return;g.info(`custom message ${e} has been received.`);let o=!1;return a.forEach(l=>{const i=l.getData().uniqueId,d=`${t}#${i}`;U.has(d)||(U.add(d),o=!0)}),o},Se=e=>{const t=X(e),r=s.multiplayerPeerJsHelper.getAllMessagesMap().get(t);if(!r)return;const a=r.getMessages();return a.length?a[a.length-1].getData().data:void 0},ut=(e,t)=>{const n=Se(e);!n||(g.info(`Received custom message ${e} with data ${JSON.stringify(n)}.`),t.fromJSObject(n))},mt=e=>{const t=X(e),r=s.multiplayerPeerJsHelper.getAllMessagesMap().get(t);if(!r)return 0;const a=r.getMessages();return a.length?a[a.length-1].getData().senderPlayerNumber:0},dt=()=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const e=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(e.keys()).filter(r=>r.startsWith(ae)).forEach(r=>{const a=e.get(r);if(!a){k.error(`No messages list found for ${r}.`);return}const o=a.getMessages();!o.length||o.forEach(l=>{const c=l.getData(),i=l.getSender(),d=c.uniqueId;if(g.info(`Received custom message ${r} with data ${JSON.stringify(c)}.`),!ot.exec(r)){k.error(`Invalid custom message ${r}.`);return}const f=`${r}#${d}`;if(U.has(f)){g.info(`Message ${r} has already been processed, skipping.`);return}const u=Ne(r);if(g.info(`Sending acknowledgment of custom message ${r} to ${i}.`),w([i],u,{}),s.multiplayer.isCurrentPlayerHost()){const m=s.multiplayerPeerJsHelper.getAllPeers();if(!m.length)return;x({originalMessageName:r,originalData:c,expectedMessageName:u,otherPeerIds:m,shouldCancelMessageIfTimesOut:!1}),w(m,r,c)}})})},De="#updateScene",ke=({sceneNetworkSyncData:e})=>({messageName:`${De}`,messageData:e}),pt=e=>e.var?Q?JSON.stringify(e.var)!==JSON.stringify(Q.var):!0:!1,ft=()=>v()-me<1e3/xe,yt=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=e.getNetworkSyncData({playerNumber:s.multiplayer.getCurrentPlayerNumber(),isHost:s.multiplayer.isCurrentPlayerHost()});if(!t)return;const n=pt(t),r=!ft()||n||W>0;if(n&&(W=3),!r)return;const a=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:o,messageData:l}=ke({sceneNetworkSyncData:t});w(a,o,l),me=v(),Q=t,W=Math.max(W-1,0)},ht=e=>{const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(De)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();!l.length||l.forEach(c=>{const i=c.getData(),d=c.getSender(),p=i.id;if(s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages()){if(p!==e.networkId){g.info(`Received update of scene ${p}, but we are on ${e.networkId}. Skipping.`);return}e.updateFromNetworkSyncData(i)}else{g.info(`Saving scene ${p} update message for later use.`),V.store(i);return}if(s.multiplayer.isCurrentPlayerHost()){const u=s.multiplayerPeerJsHelper.getAllPeers().filter(m=>m!==d);w(u,a,i)}})})},ve="#updateGame",$e=({gameNetworkSyncData:e})=>({messageName:`${ve}`,messageData:e}),bt=e=>{const t=e.var,n=e.ss;if(!t&&!n)return!1;if(!J||!J.var||!J.ss||t&&JSON.stringify(t)!==JSON.stringify(J.var))return!0;if(n){if(n.length!==J.ss.length)return!0;for(let r=0;r<n.length;++r){const a=n[r],o=J.ss[r];if(a.name!==o.name||a.networkId!==o.networkId)return!0}}return!1},Mt=()=>v()-de<1e3/Ge,wt=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=e.getGame().getNetworkSyncData({playerNumber:s.multiplayer.getCurrentPlayerNumber(),isHost:s.multiplayer.isCurrentPlayerHost()});if(!t)return;const n=bt(t),r=!Mt()||n||F>0;if(n&&(F=3),!r)return;const a=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:o,messageData:l}=$e({gameNetworkSyncData:t});w(a,o,l),de=v(),J=t,F=Math.max(F-1,0)},It=e=>{const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(ve)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();!l.length||l.forEach(c=>{const i=c.getData(),d=c.getSender();if(s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())e.getGame().updateFromNetworkSyncData(i);else{g.info("Saving game update message for later use."),B.store(i);return}if(s.multiplayer.isCurrentPlayerHost()){const f=s.multiplayerPeerJsHelper.getAllPeers().filter(u=>u!==d);w(f,a,i)}})})},Pt=e=>{B.getUpdates().forEach(t=>{g.info("Reapplying saved update of game."),e.getGame().updateFromNetworkSyncData(t)}),B.clear(),V.getUpdates().forEach(t=>{const n=t.id;if(n!==e.networkId){g.info(`Trying to apply saved update of scene ${n}, but we are on ${e.networkId}. Skipping.`);return}g.info(`Reapplying saved update of scene ${n}.`),e.updateFromNetworkSyncData(t),V.remove(t)})},oe="#heartbeat",Nt=/#heartbeat#(.+)/,ie=()=>{M[s.multiplayer.getCurrentPlayerNumber()]={ping:0,playerId:s.playerAuthentication.getUserId(),username:s.playerAuthentication.getUsername()};for(const e in M)M[e]={...M[e],ping:ce(parseInt(e,10))};return{messageName:`${oe}#${s.multiplayer.getCurrentPlayerNumber()}`,messageData:{now:v(),playersInfo:M}}},Ot=({heartbeatSentAt:e})=>({messageName:`${oe}#${s.multiplayer.getCurrentPlayerNumber()}`,messageData:{sentAt:e,playerId:s.playerAuthentication.getUserId(),username:s.playerAuthentication.getUsername()}}),St=()=>!!G&&v()-G<1e3/Ee,Dt=()=>{if(!s.multiplayer.isCurrentPlayerHost()||!!St())return;const t=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:n,messageData:r}=ie();w(t,n,r),G=v()},kt=()=>{const e=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(e.keys()).filter(r=>r.startsWith(oe)).forEach(r=>{const a=e.get(r);if(!a)return;const o=a.getMessages();!o.length||o.forEach(l=>{const c=l.getData(),i=l.getSender(),d=Nt.exec(r);if(!d)return;const p=parseInt(d[1],10);if(pe[i]=p,!s.multiplayer.isCurrentPlayerHost()){const h=s.multiplayer.getCurrentPlayerNumber(),b=Object.keys(M).map(R=>parseInt(R,10)),N=Object.keys(c.playersInfo).map(R=>parseInt(R,10)),_=M[h]&&M[h].ping;if(b.length){const R=N.filter(L=>!b.includes(L)&&L!==h);$.push(...R);const z=b.filter(L=>!N.includes(L));A.push(...z);for(const L of z)K[L]=le(L)}Te({source:c.playersInfo,target:M});const{messageName:T,messageData:j}=Ot({heartbeatSentAt:c.now});w([i],T,j),M[h]!==void 0&&M[h].ping!==void 0&&(s.multiplayer.markConnectionAsConnected(),_===void 0&&$.push(h));return}M[p]||$.push(p);const f=v(),u=c.sentAt,m=Math.round(f-u),y=E[p]||[];y.push(m),y.length>5&&y.shift(),E[p]=y;let I=0;for(const h of y)I+=h;const P=Math.round(I/y.length/2);if(M[p]={ping:P,playerId:c.playerId,username:c.username},$.length){const h=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:b,messageData:N}=ie();w(h,b,N),G=v()}})})},vt=e=>(E[e]||[]).length>0,ce=e=>{const t=M[e];return t&&t.ping||0},$t=()=>{const e=s.multiplayer.getCurrentPlayerNumber();return ce(e)},Re=({runtimeScene:e,playerNumber:t,peerId:n})=>{if(k.info(`Marking player ${t} as disconnected.`),A.push(t),K[t]=le(t),Qt(t),n&&n===s.multiplayer.hostPeerId)if(s.multiplayer.shouldEndLobbyWhenHostLeaves())k.info("Host has disconnected, ending the game."),ge(),s.multiplayer.handleLobbyGameEnded();else{k.info("Host has disconnected, switching host."),s.multiplayer.handleHostDisconnected({runtimeScene:e});return}if(s.multiplayer.isCurrentPlayerHost()){const r=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:a,messageData:o}=ie();w(r,a,o),G=v()}},le=e=>(M[e]||{}).username||K[e]||`Player ${e}`,Rt=e=>(M[e]||{}).playerId||"",Ct=e=>{if(!s.multiplayer.isLobbyGameRunning())return;const t=[],n=s.multiplayerPeerJsHelper.getJustDisconnectedPeers();if(n.length)for(const r of n){const a=pe[r];if(!a)return;k.info(`Player ${a} has disconnected.`),t.push({playerNumber:a,peerId:r})}for(const{playerNumber:r,peerId:a}of t){if(s.multiplayer.isCurrentPlayerHost()){const o=e.getAdhocListOfAllInstances();for(const l of o){const c=l.getBehavior("MultiplayerObject");if(c&&c.getPlayerObjectOwnership()===r){const i=c.getActionOnPlayerDisconnect();i==="DestroyObject"?l.deleteFromScene():i==="GiveOwnershipToHost"&&c.removeObjectOwnership()}}}Re({runtimeScene:e,playerNumber:r,peerId:a})}},At=()=>A.length>0,jt=e=>A.includes(e),Tt=()=>A,Ht=()=>A[0]||0,Jt=()=>{const e=A[0];e!==void 0&&(A=A.slice(1),delete K[e])},_t=()=>$.length>0,Lt=e=>$.includes(e),xt=()=>$,Gt=()=>$[0]||0,Et=()=>{$[0]!==void 0&&($=$.slice(1))},Ut=()=>Object.keys(M).map(e=>({playerNumber:parseInt(e,10),playerId:M[e].playerId})),Wt=()=>Object.keys(M).length,Vt=e=>M[e]!==void 0,Ft=()=>M,Ce="#endGame",Bt=()=>({messageName:Ce,messageData:{}}),Kt=()=>{if(!s.multiplayer.isCurrentPlayerHost())return;g.info("Sending endgame message.");const e=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:t,messageData:n}=Bt();w(e,t,n)},Yt=()=>{if(s.multiplayer.isCurrentPlayerHost())return;const t=s.multiplayerPeerJsHelper.getAllMessagesMap().get(Ce);!t||!t.getMessages().length||(k.info("Received endgame message."),ge(),s.multiplayer.handleLobbyGameEnded())},Ae="#resumeGame",qt=()=>({messageName:Ae,messageData:{}}),Xt=()=>{if(!s.multiplayer.isCurrentPlayerHost())return;g.info("Sending resumeGame message.");const e=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:t,messageData:n}=qt();w(e,t,n)},zt=e=>{if(s.multiplayer.isCurrentPlayerHost())return;const n=s.multiplayerPeerJsHelper.getAllMessagesMap().get(Ae);!n||!n.getMessages().length||(k.info("Received resumeGame message."),s.multiplayer.resumeGame(e))},ge=()=>{E={},M={},B.clear(),V.clear(),U.clear(),A=[],$=[],O={},H={}},Qt=e=>{delete E[e],delete M[e]};return{sendDataTo:w,addExpectedMessageAcknowledgement:x,handleAcknowledgeMessagesReceived:et,resendClearOrCancelAcknowledgedMessages:tt,createChangeInstanceOwnerMessage:We,createInstanceOwnerChangedMessageNameFromChangeInstanceOwnerMessage:be,handleChangeInstanceOwnerMessagesReceived:Fe,createUpdateInstanceMessage:Ke,handleUpdateInstanceMessagesReceived:Ye,createDestroyInstanceMessage:nt,createInstanceDestroyedMessageNameFromDestroyInstanceMessage:Pe,handleDestroyInstanceMessagesReceived:rt,createChangeVariableOwnerMessage:qe,createVariableOwnerChangedMessageNameFromChangeVariableOwnerMessage:Ie,handleChangeVariableOwnerMessagesReceived:ze,sendCustomMessage:Oe,getCustomMessageData:Se,sendVariableCustomMessage:lt,getVariableCustomMessageData:ut,hasCustomMessageBeenReceived:gt,handleCustomMessagesReceived:dt,getCustomMessageSender:mt,createUpdateSceneMessage:ke,handleUpdateSceneMessagesToSend:yt,handleUpdateSceneMessagesReceived:ht,createUpdateGameMessage:$e,handleUpdateGameMessagesToSend:wt,handleUpdateGameMessagesReceived:It,handleSavedUpdateMessages:Pt,handleHeartbeatsToSend:Dt,handleHeartbeatsReceived:kt,hasReceivedHeartbeatFromPlayer:vt,getPlayerPing:ce,getCurrentPlayerPing:$t,getPlayerUsername:le,getPlayerId:Rt,handleJustDisconnectedPeers:Ct,getConnectedPlayers:Ut,getNumberOfConnectedPlayers:Wt,isPlayerConnected:Vt,getPlayersInfo:Ft,hasAnyPlayerJustLeft:At,hasPlayerJustLeft:jt,getPlayersWhoJustLeft:Tt,getLatestPlayerWhoJustLeft:Ht,removePlayerWhoJustLeft:Jt,markPlayerAsDisconnected:Re,hasAnyPlayerJustJoined:_t,hasPlayerJustJoined:Lt,getPlayersWhoJustJoined:xt,getLatestPlayerWhoJustJoined:Gt,removePlayerWhoJustJoined:Et,sendEndGameMessage:Kt,handleEndGameMessagesReceived:Yt,clearAllMessagesTempData:ge,sendResumeGameMessage:Xt,handleResumeGameMessagesReceived:zt}},s.multiplayerMessageManager=s.makeMultiplayerMessageManager()})(gdjs||(gdjs={}));
1
+ var gdjs;(function(s){const k=new s.Logger("Multiplayer"),g=new s.Logger("Multiplayer - Debug");s.Logger.getDefaultConsoleLoggerOutput().discardGroup("Multiplayer - Debug");class je{constructor(S){this.clear=()=>{this.cache.clear(),this.keys=[]};this.maxSize=S,this.cache=new Set,this.keys=[]}has(S){return this.cache.has(S)}add(S){if(this.cache.size>=this.maxSize){const D=this.keys.shift();D&&this.cache.delete(D)}this.cache.add(S),this.keys.push(S)}}class ue{constructor(){this._updates=[]}store(S){this._updates.push(S),this._updates.length>10&&this._updates.shift()}getUpdates(){return this._updates}remove(S){const D=this._updates.indexOf(S);D!==-1&&this._updates.splice(D,1)}clear(){this._updates=[]}}const Te=({target:C,source:S})=>{for(const D in S)S.hasOwnProperty(D)&&!C.hasOwnProperty(D)&&(C[D]=S[D]);for(const D in C)C.hasOwnProperty(D)&&!S.hasOwnProperty(D)&&delete C[D]};s.makeMultiplayerMessageManager=()=>{const C=0,S=0,D=0,Je=0,v=window.performance&&typeof window.performance.now=="function"?window.performance.now.bind(window.performance):Date.now,_e=200,Le=4,U=new je(500);let O={},H={};const xe=1;let me=0,Q=null,W=0,V=new ue;const Ge=1;let de=0,J=null,F=0,B=new ue;const Ee=1;let G=0,E={},pe={},M={},A=[],$=[],K={};const x=({originalMessageName:e,originalData:t,expectedMessageName:n,otherPeerIds:r,shouldCancelMessageIfTimesOut:a,maxNumberOfRetries:o,messageRetryTime:l})=>{!s.multiplayer.isLobbyGameRunning()||(O[n]||(O[n]={}),g.info(`Adding expected message ${n} from ${r.join(", ")}.`),r.forEach(c=>{O[n][c]={acknowledged:!1,lastMessageSentAt:v(),originalMessageName:e,originalData:t,shouldCancelMessageIfTimesOut:a,numberOfRetries:0,maxNumberOfRetries:o||Le,messageRetryTime:l||_e}}))},fe=({sceneNetworkId:e,instanceNetworkId:t})=>(H[e]||(H[e]={}),H[e][t]||0),ye=({sceneNetworkId:e,instanceNetworkId:t,clock:n})=>{H[e]||(H[e]={}),H[e][t]=n},w=(e,t,n)=>{if(!(S>0&&Math.random()<S)){if(D>0&&Math.random()<D){setTimeout(()=>{s.multiplayerPeerJsHelper.sendDataTo(e,t,n)},Je);return}if(C>0){setTimeout(()=>{s.multiplayerPeerJsHelper.sendDataTo(e,t,n)},C);return}s.multiplayerPeerJsHelper.sendDataTo(e,t,n)}},Ue=(e,t,n)=>{if(!e.length)return null;let r=null,a=1/0;for(let o=0;o<e.length;++o){if(e[o].networkId)continue;const l=e[o],c=Math.pow(l.getX()-t,2)+Math.pow(l.getY()-n,2);c<a&&(r=l,a=c)}return r},Z=({runtimeScene:e,objectName:t,instanceNetworkId:n,instanceX:r,instanceY:a,shouldCreateIfNotFound:o})=>{const l=e.getInstancesOf(t);if(!l)return null;let c=l.find(i=>i.networkId===n)||null;if(!c&&r!==void 0&&a!==void 0){g.info(`instance ${t} ${n} not found with network ID, trying to find it with position ${r}/${a}.`);const i=Ue(l,r,a);i&&(g.info(`Found closest instance for object ${t} ${n} with no network ID.`),c=i,c.networkId=n)}if(!c&&o){g.info(`Instance ${n} still not found, Creating instance ${t}.`);const i=e.createObject(t);if(!i)return null;i.networkId=n,c=i}return c},Y="#changeInstanceOwner",he=/#changeInstanceOwner#owner_(\d+)#object_(.+)#instance_(.+)/,We=({objectOwner:e,objectName:t,instanceNetworkId:n,newObjectOwner:r,instanceX:a,instanceY:o,sceneNetworkId:l})=>({messageName:`${Y}#owner_${e}#object_${t}#instance_${n}`,messageData:{previousOwner:e,newOwner:r,instanceX:a,instanceY:o,sceneNetworkId:l}}),ee="#instanceOwnerChanged",Ve=/#instanceOwnerChanged#owner_(\d+)#object_(.+)#instance_(.+)/,be=e=>e.replace(Y,ee),Fe=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(Y)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();!l.length||l.forEach(c=>{const i=c.getData(),d=c.getSender(),p=he.exec(a);if(!p)return;const f=p[2],u=p[3],m=i.previousOwner,y=i.newOwner,I=i.sceneNetworkId;if(I!==e.networkId){g.info(`Object ${f} is in scene ${I}, but we are on ${e.networkId}. Skipping.`);return}const P=Z({runtimeScene:e,objectName:f,instanceNetworkId:u,instanceX:i.instanceX,instanceY:i.instanceY});if(!P){g.info(`Instance ${u} not found, it must have been destroyed.`);return}const h=P.getBehavior("MultiplayerObject");if(!h){g.info(`Object ${f} does not have the MultiplayerObjectBehavior, cannot change ownership.`);return}const b=h.getPlayerObjectOwnership(),N=b===m||b===y;if(s.multiplayer.isCurrentPlayerHost()&&!N){g.info(`Object ${f} with instance network ID ${u} does not have the expected owner. Wanted to change from ${m} to ${y}, but object has owner ${b}.`);return}g.info(`Changing ownership of object ${f} to ${y}.`),h.playerNumber=y;const _=be(a);if(g.info(`Sending acknowledgment of ownership change of object ${f} from ${m} to ${y} with instance network ID ${u} to ${d}.`),w([d],_,{}),s.multiplayer.isCurrentPlayerHost()){const j=s.multiplayerPeerJsHelper.getAllPeers().filter(R=>R!==d);if(!j.length)return;x({originalMessageName:a,originalData:i,expectedMessageName:_,otherPeerIds:j,shouldCancelMessageIfTimesOut:!1}),g.info(`Relaying ownership change of object ${f} with instance network ID ${u} to ${j.join(", ")}.`),w(j,a,i)}})})},Me="#updateInstance",Be=/#updateInstance#owner_(\d+)#object_(.+)#instance_(.+)#scene_(.+)/,Ke=({objectOwner:e,objectName:t,instanceNetworkId:n,objectNetworkSyncData:r,sceneNetworkId:a})=>({messageName:`${Me}#owner_${e}#object_${t}#instance_${n}#scene_${a}`,messageData:r}),Ye=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(Me)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();if(!l.length)return;l.slice().reverse().forEach(i=>{const d=i.getData(),p=i.getSender(),f=Be.exec(a);if(!f)return;const u=parseInt(f[1],10);if(u===s.multiplayer.playerNumber)return;const m=f[2],y=f[3],I=f[4];if(I!==e.networkId){g.info(`Object ${m} is in scene ${I}, but we are on ${e.networkId}. Skipping.`);return}const P=d._clock,h=fe({sceneNetworkId:I,instanceNetworkId:y});if(P<=h)return;const b=Z({runtimeScene:e,objectName:m,instanceNetworkId:y,shouldCreateIfNotFound:!0,instanceX:d.x,instanceY:d.y});if(!b){k.error("Instance could not be found or created.");return}const N=b.getBehavior("MultiplayerObject");if(!N){k.error(`Object ${m} does not have the MultiplayerObjectBehavior, cannot update it.`);return}if(N.getPlayerObjectOwnership()===s.multiplayer.playerNumber){g.info(`Object ${m} with instance network ID ${y} is owned by us ${s.multiplayer.playerNumber}, ignoring update message from ${u}.`);return}if(N.getPlayerObjectOwnership()!==u&&(g.info(`Object ${m} with instance network ID ${y} is owned by ${N.getPlayerObjectOwnership()} on our game, changing ownership to ${u} as part of the update event.`),N.playerNumber=u),b.updateFromNetworkSyncData(d,{clearInputs:!1}),ye({sceneNetworkId:I,instanceNetworkId:y,clock:P}),N._clock=P,s.multiplayer.isCurrentPlayerHost()){const T=s.multiplayerPeerJsHelper.getAllPeers().filter(j=>j!==p);if(!T.length)return;w(T,a,d)}})})},q="#changeVariableOwner",we=/#changeVariableOwner#owner_(\d+)#variable_(.+)/,qe=({variableOwner:e,variableNetworkId:t,newVariableOwner:n})=>({messageName:`${q}#owner_${e}#variable_${t}`,messageData:{previousOwner:e,newOwner:n}}),te="#variableOwnerChanged",Xe=/#variableOwnerChanged#owner_(\d+)#variable_(.+)/,Ie=e=>e.replace(q,te),ze=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(q)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();!l.length||l.forEach(c=>{const i=c.getData(),d=c.getSender(),p=we.exec(a);if(!p)return;const f=p[2],u=i.previousOwner,m=i.newOwner,{type:y,name:I,containerId:P}=s.multiplayerVariablesManager.getVariableTypeAndNameFromNetworkId(f);if(y==="scene"&&P!==e.networkId){g.info(`Variable ${I} is in scene ${P}, but we are on ${e.networkId}. Skipping.`);return}const h=P==="game"?e.getGame().getVariables():e.getVariables();if(!h.has(I)){k.error(`Variable with ID ${f} not found whilst syncing. This should not happen.`);return}const b=h.get(I),N=b.getPlayerOwnership(),_=N===u||N===m;if(s.multiplayer.isCurrentPlayerHost()&&!_){g.info(`Variable with ID ${f} does not have the expected owner. Wanted to change from ${u} to ${m}, but variable has owner ${N}.`);return}g.info(`Changing ownership of variable ${I} to ${m}.`),b.setPlayerOwnership(m);const T=Ie(a);if(g.info(`Sending acknowledgment of ownership change of variable with ID ${f} from ${u} to ${m} to ${d}.`),w([d],T,{}),s.multiplayer.isCurrentPlayerHost()){const R=s.multiplayerPeerJsHelper.getAllPeers().filter(z=>z!==d);if(!R.length)return;x({originalMessageName:a,originalData:i,expectedMessageName:T,otherPeerIds:R,shouldCancelMessageIfTimesOut:!1}),g.info(`Relaying ownership change of variable with Id ${f} to ${R.join(", ")}.`),w(R,a,i)}})})},Qe=e=>e.startsWith(ne)?at:e.startsWith(ee)?Ve:e.startsWith(te)?Xe:e.startsWith(re)?ct:null,Ze=e=>e.startsWith(ne)||e.startsWith(ee)||e.startsWith(te)||e.startsWith(re),et=()=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const e=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(e.keys()).filter(Ze).forEach(r=>{const a=e.get(r);if(!a)return;const o=a.getMessages();!o.length||o.forEach(l=>{const c=l.getData(),i=l.getSender();g.info(`Received acknowledgment for message ${r}.`);const d=Qe(r);if(!d){k.error(`Invalid acknowledgment message ${r}.`);return}const p=d.exec(r);if(!p){k.error(`Invalid acknowledgment message ${r}.`);return}if(!O[r]||!O[r][i])return;const f=c._clock;if(f!==void 0){const u=p[3],m=p[4],y=fe({sceneNetworkId:m,instanceNetworkId:u});if(f<=y)return;ye({sceneNetworkId:m,instanceNetworkId:u,clock:f})}g.info(`Marking message ${r} as acknowledged from ${i}.`),O[r][i].acknowledged=!0})})},tt=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;Object.keys(O).forEach(n=>{const r=O[n],a=Object.keys(r).filter(o=>!r[o].acknowledged);if(!a.length)g.info(`All peers have acknowledged message ${n}.`),delete O[n];else for(const o of a){const{lastMessageSentAt:l,originalMessageName:c,originalData:i,numberOfRetries:d,maxNumberOfRetries:p,messageRetryTime:f}=r[o];if(v()-l>f){if(d>=p){if(g.info(`Giving up on message ${n} for ${o}.`),r[o].shouldCancelMessageIfTimesOut){if(c.startsWith(Y)){const u=he.exec(c);if(!u){delete O[n];return}const m=u[2],y=u[3],I=e.getInstancesOf(m);if(!I){delete O[n];return}let P=I.find(N=>N.networkId===y);if(!P){delete O[n];return}const h=P.getBehavior("MultiplayerObject");if(!h){k.error(`Object ${m} does not have the MultiplayerObjectBehavior, cannot revert ownership.`),delete O[n];return}const b=i.previousOwner;if(b===void 0){delete O[n];return}h.playerNumber=b||0}if(c.startsWith(q)){const u=we.exec(c);if(!u){delete O[n];return}const m=u[2],y=i.previousOwner,{type:I,name:P,containerId:h}=s.multiplayerVariablesManager.getVariableTypeAndNameFromNetworkId(m);if(I==="scene"&&h!==e.networkId){g.info(`Variable ${P} is in scene ${h}, but we are on ${e.networkId}. Skipping ownership revert.`),delete O[n];return}const b=h==="game"?e.getGame().getVariables():e.getVariables();if(!b.has(P)){k.error(`Variable with ID ${m} not found while reverting ownership. This should not happen.`),delete O[n];return}const N=b.get(P);if(y===void 0){delete O[n];return}N.setPlayerOwnership(y||0)}}delete O[n];continue}w([o],c,i),r[o].lastMessageSentAt=v(),r[o].numberOfRetries=d+1}}})},se="#destroyInstance",st=/#destroyInstance#owner_(\d+)#object_(.+)#instance_(.+)#scene_(.+)/,nt=({objectOwner:e,objectName:t,instanceNetworkId:n,sceneNetworkId:r})=>({messageName:`${se}#owner_${e}#object_${t}#instance_${n}#scene_${r}`,messageData:{}}),ne="#instanceDestroyed",at=/#instanceDestroyed#owner_(\d+)#object_(.+)#instance_(.+)/,Pe=e=>e.replace(se,ne),rt=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(se)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();!l.length||l.forEach(c=>{const i=c.getData(),d=c.getSender();g.info(`Received message ${a} with data ${JSON.stringify(i)}.`);const p=st.exec(a);if(!p||parseInt(p[1],10)===s.multiplayer.playerNumber)return;const u=p[2],m=p[3],y=p[4];if(y!==e.networkId){g.info(`Object ${u} is in scene ${y}, but we are on ${e.networkId}. Skipping.`);return}const I=Z({runtimeScene:e,objectName:u,instanceNetworkId:m}),P=Pe(a);if(!I){g.info("Instance was not found in the scene, sending acknowledgment anyway."),w([d],P,{});return}if(g.info(`Destroying object ${u} with instance network ID ${m}.`),I.deleteFromScene(),g.info(`Sending acknowledgment of destruction of object ${u} with instance network ID ${m} to ${d}.`),w([d],P,{}),s.multiplayer.isCurrentPlayerHost()){const b=s.multiplayerPeerJsHelper.getAllPeers().filter(N=>N!==d);if(!b.length)return;x({originalMessageName:a,originalData:i,expectedMessageName:P,otherPeerIds:b,shouldCancelMessageIfTimesOut:!1}),g.info(`Relaying instance destroyed message for object ${u} with instance network ID ${m} to ${b.join(", ")}.`),w(b,a,i)}})})},ae="#customMessage",ot=/#customMessage#(.+)/,X=e=>`${ae}#${e}`,it=({userMessageName:e,userMessageData:t,senderPlayerNumber:n})=>{const r=s.makeUuid();return{messageName:X(e),messageData:{data:t,uniqueId:r,senderPlayerNumber:n}}},re="#ackCustomMessage",ct=/#ackCustomMessage#(.+)/,Ne=e=>e.replace(ae,re),Oe=(e,t)=>{const n=s.multiplayerPeerJsHelper.getAllPeers(),r=s.multiplayer.getCurrentPlayerNumber(),{messageName:a,messageData:o}=it({userMessageName:e,userMessageData:t,senderPlayerNumber:r}),l=Ne(a);x({originalMessageName:a,originalData:o,expectedMessageName:l,otherPeerIds:n,shouldCancelMessageIfTimesOut:!1}),g.info(`Sending custom message ${e} with data ${JSON.stringify(t)}.`),w(n,a,o),s.multiplayer.isCurrentPlayerHost()&&s.multiplayerPeerJsHelper.getOrCreateMessagesList(a).pushMessage(o,s.multiplayerPeerJsHelper.getCurrentId())},lt=(e,t)=>{const n=t.toJSObject();g.info(`Sending custom message ${e} with data ${JSON.stringify(n)}.`),Oe(e,n)},gt=e=>{const t=X(e),r=s.multiplayerPeerJsHelper.getAllMessagesMap().get(t);if(!r)return;const a=r.getMessages();if(!a.length)return;g.info(`custom message ${e} has been received.`);let o=!1;return a.forEach(l=>{const i=l.getData().uniqueId,d=`${t}#${i}`;U.has(d)||(U.add(d),o=!0)}),o},Se=e=>{const t=X(e),r=s.multiplayerPeerJsHelper.getAllMessagesMap().get(t);if(!r)return;const a=r.getMessages();return a.length?a[a.length-1].getData().data:void 0},ut=(e,t)=>{const n=Se(e);!n||(g.info(`Received custom message ${e} with data ${JSON.stringify(n)}.`),t.fromJSObject(n))},mt=e=>{const t=X(e),r=s.multiplayerPeerJsHelper.getAllMessagesMap().get(t);if(!r)return 0;const a=r.getMessages();return a.length?a[a.length-1].getData().senderPlayerNumber:0},dt=()=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const e=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(e.keys()).filter(r=>r.startsWith(ae)).forEach(r=>{const a=e.get(r);if(!a){k.error(`No messages list found for ${r}.`);return}const o=a.getMessages();!o.length||o.forEach(l=>{const c=l.getData(),i=l.getSender(),d=c.uniqueId;if(g.info(`Received custom message ${r} with data ${JSON.stringify(c)}.`),!ot.exec(r)){k.error(`Invalid custom message ${r}.`);return}const f=`${r}#${d}`;if(U.has(f)){g.info(`Message ${r} has already been processed, skipping.`);return}const u=Ne(r);if(g.info(`Sending acknowledgment of custom message ${r} to ${i}.`),w([i],u,{}),s.multiplayer.isCurrentPlayerHost()){const m=s.multiplayerPeerJsHelper.getAllPeers();if(!m.length)return;x({originalMessageName:r,originalData:c,expectedMessageName:u,otherPeerIds:m,shouldCancelMessageIfTimesOut:!1}),w(m,r,c)}})})},De="#updateScene",ke=({sceneNetworkSyncData:e})=>({messageName:`${De}`,messageData:e}),pt=e=>e.var?Q?JSON.stringify(e.var)!==JSON.stringify(Q.var):!0:!1,ft=()=>v()-me<1e3/xe,yt=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=e.getNetworkSyncData({playerNumber:s.multiplayer.getCurrentPlayerNumber(),isHost:s.multiplayer.isCurrentPlayerHost()});if(!t)return;const n=pt(t),r=!ft()||n||W>0;if(n&&(W=3),!r)return;const a=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:o,messageData:l}=ke({sceneNetworkSyncData:t});w(a,o,l),me=v(),Q=t,W=Math.max(W-1,0)},ht=e=>{const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(De)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();!l.length||l.forEach(c=>{const i=c.getData(),d=c.getSender(),p=i.id;if(s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages()){if(p!==e.networkId){g.info(`Received update of scene ${p}, but we are on ${e.networkId}. Skipping.`);return}e.updateFromNetworkSyncData(i,{})}else{g.info(`Saving scene ${p} update message for later use.`),V.store(i);return}if(s.multiplayer.isCurrentPlayerHost()){const u=s.multiplayerPeerJsHelper.getAllPeers().filter(m=>m!==d);w(u,a,i)}})})},ve="#updateGame",$e=({gameNetworkSyncData:e})=>({messageName:`${ve}`,messageData:e}),bt=e=>{const t=e.var,n=e.ss;if(!t&&!n)return!1;if(!J||!J.var||!J.ss||t&&JSON.stringify(t)!==JSON.stringify(J.var))return!0;if(n){if(n.length!==J.ss.length)return!0;for(let r=0;r<n.length;++r){const a=n[r],o=J.ss[r];if(a.name!==o.name||a.networkId!==o.networkId)return!0}}return!1},Mt=()=>v()-de<1e3/Ge,wt=e=>{if(!s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())return;const t=e.getGame().getNetworkSyncData({playerNumber:s.multiplayer.getCurrentPlayerNumber(),isHost:s.multiplayer.isCurrentPlayerHost()});if(!t)return;const n=bt(t),r=!Mt()||n||F>0;if(n&&(F=3),!r)return;const a=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:o,messageData:l}=$e({gameNetworkSyncData:t});w(a,o,l),de=v(),J=t,F=Math.max(F-1,0)},It=e=>{const t=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(t.keys()).filter(a=>a.startsWith(ve)).forEach(a=>{const o=t.get(a);if(!o)return;const l=o.getMessages();!l.length||l.forEach(c=>{const i=c.getData(),d=c.getSender();if(s.multiplayer.isReadyToSendOrReceiveGameUpdateMessages())e.getGame().updateFromNetworkSyncData(i,{});else{g.info("Saving game update message for later use."),B.store(i);return}if(s.multiplayer.isCurrentPlayerHost()){const f=s.multiplayerPeerJsHelper.getAllPeers().filter(u=>u!==d);w(f,a,i)}})})},Pt=e=>{B.getUpdates().forEach(t=>{g.info("Reapplying saved update of game."),e.getGame().updateFromNetworkSyncData(t,{})}),B.clear(),V.getUpdates().forEach(t=>{const n=t.id;if(n!==e.networkId){g.info(`Trying to apply saved update of scene ${n}, but we are on ${e.networkId}. Skipping.`);return}g.info(`Reapplying saved update of scene ${n}.`),e.updateFromNetworkSyncData(t,{}),V.remove(t)})},oe="#heartbeat",Nt=/#heartbeat#(.+)/,ie=()=>{M[s.multiplayer.getCurrentPlayerNumber()]={ping:0,playerId:s.playerAuthentication.getUserId(),username:s.playerAuthentication.getUsername()};for(const e in M)M[e]={...M[e],ping:ce(parseInt(e,10))};return{messageName:`${oe}#${s.multiplayer.getCurrentPlayerNumber()}`,messageData:{now:v(),playersInfo:M}}},Ot=({heartbeatSentAt:e})=>({messageName:`${oe}#${s.multiplayer.getCurrentPlayerNumber()}`,messageData:{sentAt:e,playerId:s.playerAuthentication.getUserId(),username:s.playerAuthentication.getUsername()}}),St=()=>!!G&&v()-G<1e3/Ee,Dt=()=>{if(!s.multiplayer.isCurrentPlayerHost()||!!St())return;const t=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:n,messageData:r}=ie();w(t,n,r),G=v()},kt=()=>{const e=s.multiplayerPeerJsHelper.getAllMessagesMap();Array.from(e.keys()).filter(r=>r.startsWith(oe)).forEach(r=>{const a=e.get(r);if(!a)return;const o=a.getMessages();!o.length||o.forEach(l=>{const c=l.getData(),i=l.getSender(),d=Nt.exec(r);if(!d)return;const p=parseInt(d[1],10);if(pe[i]=p,!s.multiplayer.isCurrentPlayerHost()){const h=s.multiplayer.getCurrentPlayerNumber(),b=Object.keys(M).map(R=>parseInt(R,10)),N=Object.keys(c.playersInfo).map(R=>parseInt(R,10)),_=M[h]&&M[h].ping;if(b.length){const R=N.filter(L=>!b.includes(L)&&L!==h);$.push(...R);const z=b.filter(L=>!N.includes(L));A.push(...z);for(const L of z)K[L]=le(L)}Te({source:c.playersInfo,target:M});const{messageName:T,messageData:j}=Ot({heartbeatSentAt:c.now});w([i],T,j),M[h]!==void 0&&M[h].ping!==void 0&&(s.multiplayer.markConnectionAsConnected(),_===void 0&&$.push(h));return}M[p]||$.push(p);const f=v(),u=c.sentAt,m=Math.round(f-u),y=E[p]||[];y.push(m),y.length>5&&y.shift(),E[p]=y;let I=0;for(const h of y)I+=h;const P=Math.round(I/y.length/2);if(M[p]={ping:P,playerId:c.playerId,username:c.username},$.length){const h=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:b,messageData:N}=ie();w(h,b,N),G=v()}})})},vt=e=>(E[e]||[]).length>0,ce=e=>{const t=M[e];return t&&t.ping||0},$t=()=>{const e=s.multiplayer.getCurrentPlayerNumber();return ce(e)},Re=({runtimeScene:e,playerNumber:t,peerId:n})=>{if(k.info(`Marking player ${t} as disconnected.`),A.push(t),K[t]=le(t),Qt(t),n&&n===s.multiplayer.hostPeerId)if(s.multiplayer.shouldEndLobbyWhenHostLeaves())k.info("Host has disconnected, ending the game."),ge(),s.multiplayer.handleLobbyGameEnded();else{k.info("Host has disconnected, switching host."),s.multiplayer.handleHostDisconnected({runtimeScene:e});return}if(s.multiplayer.isCurrentPlayerHost()){const r=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:a,messageData:o}=ie();w(r,a,o),G=v()}},le=e=>(M[e]||{}).username||K[e]||`Player ${e}`,Rt=e=>(M[e]||{}).playerId||"",Ct=e=>{if(!s.multiplayer.isLobbyGameRunning())return;const t=[],n=s.multiplayerPeerJsHelper.getJustDisconnectedPeers();if(n.length)for(const r of n){const a=pe[r];if(!a)return;k.info(`Player ${a} has disconnected.`),t.push({playerNumber:a,peerId:r})}for(const{playerNumber:r,peerId:a}of t){if(s.multiplayer.isCurrentPlayerHost()){const o=e.getAdhocListOfAllInstances();for(const l of o){const c=l.getBehavior("MultiplayerObject");if(c&&c.getPlayerObjectOwnership()===r){const i=c.getActionOnPlayerDisconnect();i==="DestroyObject"?l.deleteFromScene():i==="GiveOwnershipToHost"&&c.removeObjectOwnership()}}}Re({runtimeScene:e,playerNumber:r,peerId:a})}},At=()=>A.length>0,jt=e=>A.includes(e),Tt=()=>A,Ht=()=>A[0]||0,Jt=()=>{const e=A[0];e!==void 0&&(A=A.slice(1),delete K[e])},_t=()=>$.length>0,Lt=e=>$.includes(e),xt=()=>$,Gt=()=>$[0]||0,Et=()=>{$[0]!==void 0&&($=$.slice(1))},Ut=()=>Object.keys(M).map(e=>({playerNumber:parseInt(e,10),playerId:M[e].playerId})),Wt=()=>Object.keys(M).length,Vt=e=>M[e]!==void 0,Ft=()=>M,Ce="#endGame",Bt=()=>({messageName:Ce,messageData:{}}),Kt=()=>{if(!s.multiplayer.isCurrentPlayerHost())return;g.info("Sending endgame message.");const e=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:t,messageData:n}=Bt();w(e,t,n)},Yt=()=>{if(s.multiplayer.isCurrentPlayerHost())return;const t=s.multiplayerPeerJsHelper.getAllMessagesMap().get(Ce);!t||!t.getMessages().length||(k.info("Received endgame message."),ge(),s.multiplayer.handleLobbyGameEnded())},Ae="#resumeGame",qt=()=>({messageName:Ae,messageData:{}}),Xt=()=>{if(!s.multiplayer.isCurrentPlayerHost())return;g.info("Sending resumeGame message.");const e=s.multiplayerPeerJsHelper.getAllPeers(),{messageName:t,messageData:n}=qt();w(e,t,n)},zt=e=>{if(s.multiplayer.isCurrentPlayerHost())return;const n=s.multiplayerPeerJsHelper.getAllMessagesMap().get(Ae);!n||!n.getMessages().length||(k.info("Received resumeGame message."),s.multiplayer.resumeGame(e))},ge=()=>{E={},M={},B.clear(),V.clear(),U.clear(),A=[],$=[],O={},H={}},Qt=e=>{delete E[e],delete M[e]};return{sendDataTo:w,addExpectedMessageAcknowledgement:x,handleAcknowledgeMessagesReceived:et,resendClearOrCancelAcknowledgedMessages:tt,createChangeInstanceOwnerMessage:We,createInstanceOwnerChangedMessageNameFromChangeInstanceOwnerMessage:be,handleChangeInstanceOwnerMessagesReceived:Fe,createUpdateInstanceMessage:Ke,handleUpdateInstanceMessagesReceived:Ye,createDestroyInstanceMessage:nt,createInstanceDestroyedMessageNameFromDestroyInstanceMessage:Pe,handleDestroyInstanceMessagesReceived:rt,createChangeVariableOwnerMessage:qe,createVariableOwnerChangedMessageNameFromChangeVariableOwnerMessage:Ie,handleChangeVariableOwnerMessagesReceived:ze,sendCustomMessage:Oe,getCustomMessageData:Se,sendVariableCustomMessage:lt,getVariableCustomMessageData:ut,hasCustomMessageBeenReceived:gt,handleCustomMessagesReceived:dt,getCustomMessageSender:mt,createUpdateSceneMessage:ke,handleUpdateSceneMessagesToSend:yt,handleUpdateSceneMessagesReceived:ht,createUpdateGameMessage:$e,handleUpdateGameMessagesToSend:wt,handleUpdateGameMessagesReceived:It,handleSavedUpdateMessages:Pt,handleHeartbeatsToSend:Dt,handleHeartbeatsReceived:kt,hasReceivedHeartbeatFromPlayer:vt,getPlayerPing:ce,getCurrentPlayerPing:$t,getPlayerUsername:le,getPlayerId:Rt,handleJustDisconnectedPeers:Ct,getConnectedPlayers:Ut,getNumberOfConnectedPlayers:Wt,isPlayerConnected:Vt,getPlayersInfo:Ft,hasAnyPlayerJustLeft:At,hasPlayerJustLeft:jt,getPlayersWhoJustLeft:Tt,getLatestPlayerWhoJustLeft:Ht,removePlayerWhoJustLeft:Jt,markPlayerAsDisconnected:Re,hasAnyPlayerJustJoined:_t,hasPlayerJustJoined:Lt,getPlayersWhoJustJoined:xt,getLatestPlayerWhoJustJoined:Gt,removePlayerWhoJustJoined:Et,sendEndGameMessage:Kt,handleEndGameMessagesReceived:Yt,clearAllMessagesTempData:ge,sendResumeGameMessage:Xt,handleResumeGameMessagesReceived:zt}},s.multiplayerMessageManager=s.makeMultiplayerMessageManager()})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=messageManager.js.map