gdcore-tools 2.0.0-beta2 → 2.0.0-beta4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Runtime/AsyncTasksManager.js +2 -2
- package/dist/Runtime/AsyncTasksManager.js.map +2 -2
- package/dist/Runtime/Cordova/config.xml +23 -1
- package/dist/Runtime/Cordova/www/LICENSE.GDevelop.txt +2 -0
- package/dist/Runtime/Cordova/www/index.html +1 -1
- package/dist/Runtime/CustomRuntimeObject.js +1 -1
- package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
- package/dist/Runtime/CustomRuntimeObject2D.js +2 -0
- package/dist/Runtime/CustomRuntimeObject2D.js.map +7 -0
- package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js +1 -1
- package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js.map +2 -2
- package/dist/Runtime/Electron/LICENSE.GDevelop.txt +2 -0
- package/dist/Runtime/Electron/package.json +3 -0
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js +1 -1
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3DRenderer.js +1 -1
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3DRenderer.js.map +2 -2
- package/dist/Runtime/Extensions/3D/AmbientLight.js +1 -1
- package/dist/Runtime/Extensions/3D/AmbientLight.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Base3DBehavior.js +1 -1
- package/dist/Runtime/Extensions/3D/Base3DBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/3D/BloomEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/BloomEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/BrightnessAndContrastEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/BrightnessAndContrastEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js +1 -1
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js.map +2 -2
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js +2 -0
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +7 -0
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js +2 -0
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js.map +7 -0
- package/dist/Runtime/Extensions/3D/DirectionalLight.js +1 -1
- package/dist/Runtime/Extensions/3D/DirectionalLight.js.map +2 -2
- package/dist/Runtime/Extensions/3D/ExponentialFog.js +1 -1
- package/dist/Runtime/Extensions/3D/ExponentialFog.js.map +2 -2
- package/dist/Runtime/Extensions/3D/ExposureEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/ExposureEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/HemisphereLight.js +1 -1
- package/dist/Runtime/Extensions/3D/HemisphereLight.js.map +2 -2
- package/dist/Runtime/Extensions/3D/HueAndSaturationEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/HueAndSaturationEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/JsExtension.js +56 -24
- package/dist/Runtime/Extensions/3D/LinearFog.js +1 -1
- package/dist/Runtime/Extensions/3D/LinearFog.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js +1 -1
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js +1 -1
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js.map +2 -2
- package/dist/Runtime/Extensions/AdMob/JsExtension.js +11 -10
- package/dist/Runtime/Extensions/AdMob/admobtools.js +1 -1
- package/dist/Runtime/Extensions/AdMob/admobtools.js.map +2 -2
- package/dist/Runtime/Extensions/AnchorBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/BBText/JsExtension.js +20 -11
- package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/BitmapText/JsExtension.js +2 -8
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/CMakeLists.txt +35 -0
- package/dist/Runtime/Extensions/CMakeUtils.txt +81 -0
- package/dist/Runtime/Extensions/DestroyOutsideBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/DestroyOutsideBehavior/destroyoutsideruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/DialogueTree/bondage.js/version.txt +5 -0
- package/dist/Runtime/Extensions/DraggableBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/Effects/adjustment-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/adjustment-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/advanced-bloom-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/advanced-bloom-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/ascii-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/ascii-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/black-and-white-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/black-and-white-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/blending-mode-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/blending-mode-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/brightness-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/brightness-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/bulge-pinch-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/bulge-pinch-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/color-map-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/color-map-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/crt-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/crt-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/displacement-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/displacement-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/dot-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/dot-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/glitch-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/glitch-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/godray-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/godray-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/hsl-adjustment-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/hsl-adjustment-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/kawase-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/kawase-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/light-night-pixi-filter.js +2 -2
- package/dist/Runtime/Extensions/Effects/light-night-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/motion-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/motion-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/night-pixi-filter.js +2 -2
- package/dist/Runtime/Extensions/Effects/night-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/noise-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/noise-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/old-film-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/old-film-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/pixelate-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/pixelate-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/radial-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/radial-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/reflection-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/reflection-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/rgb-split-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/rgb-split-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/sepia-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/sepia-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/shockwave-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/shockwave-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/tilt-shift-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/tilt-shift-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/twist-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/twist-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/zoom-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/zoom-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/ExampleJsExtension/JsExtension.js +2 -11
- package/dist/Runtime/Extensions/ExampleJsExtension/dummyeffect.js +1 -1
- package/dist/Runtime/Extensions/ExampleJsExtension/dummyeffect.js.map +2 -2
- package/dist/Runtime/Extensions/FileSystem/JsExtension.js +22 -0
- package/dist/Runtime/Extensions/FileSystem/filesystemtools.js +1 -1
- package/dist/Runtime/Extensions/FileSystem/filesystemtools.js.map +2 -2
- package/dist/Runtime/Extensions/Firebase/A_firebasejs/NOTICE.txt +6 -0
- package/dist/Runtime/Extensions/Inventory/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/JsExtensionTypes.d.ts +13 -4
- package/dist/Runtime/Extensions/Leaderboards/JsExtension.js +42 -1
- package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js +1 -1
- package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js.map +2 -2
- package/dist/Runtime/Extensions/Lighting/JsExtension.js +2 -11
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/LinkedObjects/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/LinkedObjects/linkedobjects.js +1 -1
- package/dist/Runtime/Extensions/LinkedObjects/linkedobjects.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +1130 -0
- package/dist/Runtime/Extensions/Multiplayer/messageManager.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/messageManager.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerVariablesManager.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerVariablesManager.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/peer.js +10 -0
- package/dist/Runtime/Extensions/Multiplayer/peer.js.map +1 -0
- package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/peerjs.d.ts +509 -0
- package/dist/Runtime/Extensions/P2P/A_peer.js +8 -2
- package/dist/Runtime/Extensions/P2P/A_peer.js.map +1 -1
- package/dist/Runtime/Extensions/P2P/B_p2ptools.js +1 -1
- package/dist/Runtime/Extensions/P2P/B_p2ptools.js.map +2 -2
- package/dist/Runtime/Extensions/P2P/JsExtension.js +27 -0
- package/dist/Runtime/Extensions/PanelSpriteObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js +1 -1
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
- package/dist/Runtime/Extensions/PathfindingBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +47 -4
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PhysicsBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PlatformBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlayerAuthentication/JsExtension.js +6 -3
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationcomponents.js +4 -4
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationcomponents.js.map +2 -2
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js +1 -1
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js.map +2 -2
- package/dist/Runtime/Extensions/PrimitiveDrawing/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/Shopify/CMakeLists.txt +26 -0
- package/dist/Runtime/Extensions/Spine/CMakeLists.txt +20 -0
- package/dist/Runtime/Extensions/Spine/JsExtension.js +11 -2
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js +1 -1
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js.map +2 -2
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js +1 -1
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js.map +2 -2
- package/dist/Runtime/Extensions/Spine/pixi-spine/Spine-Runtimes-License-Agreement.txt +11 -0
- package/dist/Runtime/Extensions/Spine/pixi-spine/pixi-spine.js +5 -3
- package/dist/Runtime/Extensions/Spine/spineruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/SystemInfo/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TextEntryObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TextInput/JsExtension.js +3 -10
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TextObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TextObject/textruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/JsExtension.js +834 -23
- package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js +1 -1
- package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js +1 -1
- package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.d.ts +2 -0
- package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/CommonTypes.d.ts +12 -0
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/CommonTypes.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts +119 -5
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapManager.d.ts +25 -0
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapManager.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts +16 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js +2 -0
- package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +7 -0
- package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TiledSpriteObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TopDownMovementBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/JsExtension.js +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Video/JsExtension.js +2 -11
- package/dist/Runtime/Extensions/Video/videoruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
- package/dist/Runtime/RuntimeInstanceContainer.js +1 -1
- package/dist/Runtime/RuntimeInstanceContainer.js.map +2 -2
- package/dist/Runtime/SpriteAnimator.js +2 -0
- package/dist/Runtime/SpriteAnimator.js.map +7 -0
- package/dist/Runtime/debugger-client/hot-reloader.js +1 -1
- package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
- package/dist/Runtime/events-tools/objecttools.js +1 -1
- package/dist/Runtime/events-tools/objecttools.js.map +2 -2
- package/dist/Runtime/events-tools/runtimescenetools.js +1 -1
- package/dist/Runtime/events-tools/runtimescenetools.js.map +2 -2
- package/dist/Runtime/force.js +1 -1
- package/dist/Runtime/force.js.map +2 -2
- package/dist/Runtime/object-capabilities/TextContainerBehavior.js.map +1 -1
- package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js +2 -0
- package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js.map +7 -0
- package/dist/Runtime/pixi-renderers/DebuggerPixiRenderer.js +1 -1
- package/dist/Runtime/pixi-renderers/DebuggerPixiRenderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/layer-pixi-renderer.js +2 -2
- package/dist/Runtime/pixi-renderers/layer-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-filters-tools.js +1 -1
- package/dist/Runtime/pixi-renderers/pixi-filters-tools.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-image-manager.js.map +2 -2
- package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +1 -1
- package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/polygon.js +1 -1
- package/dist/Runtime/polygon.js.map +2 -2
- package/dist/Runtime/runtimebehavior.js +1 -1
- package/dist/Runtime/runtimebehavior.js.map +2 -2
- package/dist/Runtime/runtimegame.js +1 -1
- package/dist/Runtime/runtimegame.js.map +2 -2
- package/dist/Runtime/runtimeobject.js +1 -1
- package/dist/Runtime/runtimeobject.js.map +2 -2
- package/dist/Runtime/runtimescene.js +1 -1
- package/dist/Runtime/runtimescene.js.map +2 -2
- package/dist/Runtime/scenestack.js +1 -1
- package/dist/Runtime/scenestack.js.map +2 -2
- package/dist/Runtime/spriteruntimeobject.js +1 -1
- package/dist/Runtime/spriteruntimeobject.js.map +2 -2
- package/dist/Runtime/timer.js +1 -1
- package/dist/Runtime/timer.js.map +2 -2
- package/dist/Runtime/types/project-data.d.ts +115 -0
- package/dist/Runtime/variable.js +1 -1
- package/dist/Runtime/variable.js.map +2 -2
- package/dist/Runtime/variablescontainer.js +1 -1
- package/dist/Runtime/variablescontainer.js.map +2 -2
- package/dist/lib/libGD.cjs +2 -1
- package/dist/lib/libGD.wasm +0 -0
- package/dist/loaders.cjs +2 -1
- package/gd.d.ts +217 -223
- package/package.json +15 -7
- package/src/index.js +2 -0
- package/src/open_project.js +1 -1
- package/types/index.d.ts +2 -2
- package/types/open_project.d.ts +5 -5
- package/dist/Runtime/Extensions/Spine/pixi-spine/pixi-spine.js.map +0 -7
- package/dist/Runtime/pixi-renderers/CustomObjectPixiRenderer.js +0 -2
- package/dist/Runtime/pixi-renderers/CustomObjectPixiRenderer.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../GDevelop/GDJS/Runtime/spriteruntimeobject.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n /** Represents a point in a coordinate system. */\n export type SpritePoint = {\n /** X position of the point. */\n x: number;\n /** Y position of the point. */\n y: number;\n };\n\n /** Represents a custom point in a frame. */\n export type SpriteCustomPointData = {\n /** Name of the point. */\n name: string;\n /** X position of the point. */\n x: number;\n /** Y position of the point. */\n y: number;\n };\n\n /** Represents the center point in a frame. */\n export type SpriteCenterPointData = {\n /** Name of the point. */\n name: string;\n /** Is the center automatically computed? */\n automatic: boolean;\n /** X position of the point. */\n x: number;\n /** Y position of the point. */\n y: number;\n };\n\n /** Represents a {@link gdjs.SpriteAnimationFrame}. */\n export type SpriteFrameData = {\n /** The resource name of the image used in this frame. */\n image: string;\n /** The points of the frame. */\n points: Array<SpriteCustomPointData>;\n /** The origin point. */\n originPoint: SpriteCustomPointData;\n /** The center of the frame. */\n centerPoint: SpriteCenterPointData;\n /** Is The collision mask custom? */\n hasCustomCollisionMask: boolean;\n /** The collision mask if it is custom. */\n customCollisionMask: Array<Array<SpritePoint>>;\n };\n\n /** Represents the data of a {@link gdjs.SpriteAnimationDirection}. */\n export type SpriteDirectionData = {\n /** Time between each frame, in seconds. */\n timeBetweenFrames: number;\n /** Is the animation looping? */\n looping: boolean;\n /** The list of frames. */\n sprites: Array<SpriteFrameData>;\n };\n\n /** Represents the data of a {@link gdjs.SpriteAnimation}. */\n export type SpriteAnimationData = {\n /** The name of the animation. */\n name: string;\n /** Does the animation use multiple {@link gdjs.SpriteAnimationDirection}? */\n useMultipleDirections: boolean;\n /** The list of {@link SpriteDirectionData} representing {@link gdjs.SpriteAnimationDirection} instances. */\n directions: Array<SpriteDirectionData>;\n };\n\n /** Represents the data of a {@link gdjs.SpriteRuntimeObject}. */\n export type SpriteObjectDataType = {\n /** Update the object even if he is not visible?. */\n updateIfNotVisible: boolean;\n /** The list of {@link SpriteAnimationData} representing {@link gdjs.SpriteAnimation} instances. */\n animations: Array<SpriteAnimationData>;\n };\n\n export type SpriteObjectData = ObjectData & SpriteObjectDataType;\n\n /**\n * A frame used by a SpriteAnimation in a {@link gdjs.SpriteRuntimeObject}.\n *\n * It contains the texture displayed as well as information like the points position\n * or the collision mask.\n */\n export class SpriteAnimationFrame {\n image: string;\n\n //TODO: Rename in imageName, and do not store it in the object?\n texture: any;\n center: SpritePoint = { x: 0, y: 0 };\n origin: SpritePoint = { x: 0, y: 0 };\n hasCustomHitBoxes: boolean = false;\n customHitBoxes: gdjs.Polygon[] = [];\n points: Hashtable<SpritePoint>;\n\n /**\n * @param imageManager The game image manager\n * @param frameData The frame data used to initialize the frame\n */\n constructor(imageManager: gdjs.ImageManager, frameData: SpriteFrameData) {\n this.image = frameData ? frameData.image : '';\n this.texture = gdjs.SpriteRuntimeObjectRenderer.getAnimationFrame(\n imageManager,\n this.image\n );\n this.points = new Hashtable();\n this.reinitialize(imageManager, frameData);\n }\n\n /**\n * @param imageManager The game image manager\n * @param frameData The frame data used to initialize the frame\n */\n reinitialize(imageManager: gdjs.ImageManager, frameData: SpriteFrameData) {\n this.points.clear();\n for (let i = 0, len = frameData.points.length; i < len; ++i) {\n const ptData = frameData.points[i];\n const point = { x: ptData.x, y: ptData.y };\n this.points.put(ptData.name, point);\n }\n const origin = frameData.originPoint;\n this.origin.x = origin.x;\n this.origin.y = origin.y;\n const center = frameData.centerPoint;\n if (center.automatic !== true) {\n this.center.x = center.x;\n this.center.y = center.y;\n } else {\n this.center.x =\n gdjs.SpriteRuntimeObjectRenderer.getAnimationFrameWidth(\n this.texture\n ) / 2;\n this.center.y =\n gdjs.SpriteRuntimeObjectRenderer.getAnimationFrameHeight(\n this.texture\n ) / 2;\n }\n\n //Load the custom collision mask, if any:\n if (frameData.hasCustomCollisionMask) {\n this.hasCustomHitBoxes = true;\n let i = 0;\n for (let len = frameData.customCollisionMask.length; i < len; ++i) {\n const polygonData: SpritePoint[] = frameData.customCollisionMask[i];\n\n //Add a polygon, if necessary (Avoid recreating a polygon if it already exists).\n if (i >= this.customHitBoxes.length) {\n this.customHitBoxes.push(new gdjs.Polygon());\n }\n let j = 0;\n for (const len2 = polygonData.length; j < len2; ++j) {\n const pointData: SpritePoint = polygonData[j];\n\n //Add a point, if necessary (Avoid recreating a point if it already exists).\n if (j >= this.customHitBoxes[i].vertices.length) {\n this.customHitBoxes[i].vertices.push([0, 0]);\n }\n this.customHitBoxes[i].vertices[j][0] = pointData.x;\n this.customHitBoxes[i].vertices[j][1] = pointData.y;\n }\n this.customHitBoxes[i].vertices.length = j;\n }\n this.customHitBoxes.length = i;\n } else {\n this.customHitBoxes.length = 0;\n }\n }\n\n /**\n * Get a point of the frame.<br>\n * If the point does not exist, the origin is returned.\n * @param name The point's name\n * @return The requested point. If it doesn't exists returns the origin point.\n */\n getPoint(name: string): SpritePoint {\n if (name === 'Centre' || name === 'Center') {\n return this.center;\n } else {\n if (name === 'Origin') {\n return this.origin;\n }\n }\n return this.points.containsKey(name)\n ? this.points.get(name)\n : this.origin;\n }\n }\n\n /**\n * Represents a direction of an animation of a {@link gdjs.SpriteRuntimeObject}.\n *\n * @param imageManager The game image manager\n * @param directionData The direction data used to initialize the direction\n */\n export class SpriteAnimationDirection {\n timeBetweenFrames: number;\n loop: boolean;\n frames: SpriteAnimationFrame[] = [];\n\n constructor(\n imageManager: gdjs.PixiImageManager,\n directionData: SpriteDirectionData\n ) {\n this.timeBetweenFrames = directionData\n ? directionData.timeBetweenFrames\n : 1.0;\n this.loop = !!directionData.looping;\n this.reinitialize(imageManager, directionData);\n }\n\n /**\n * @param imageManager The game image manager\n * @param directionData The direction data used to initialize the direction\n */\n reinitialize(\n imageManager: gdjs.ImageManager,\n directionData: SpriteDirectionData\n ) {\n this.timeBetweenFrames = directionData\n ? directionData.timeBetweenFrames\n : 1.0;\n this.loop = !!directionData.looping;\n let i = 0;\n for (const len = directionData.sprites.length; i < len; ++i) {\n const frameData = directionData.sprites[i];\n if (i < this.frames.length) {\n this.frames[i].reinitialize(imageManager, frameData);\n } else {\n this.frames.push(\n new gdjs.SpriteAnimationFrame(imageManager, frameData)\n );\n }\n }\n this.frames.length = i;\n }\n }\n\n /**\n * Represents an animation of a {@link SpriteRuntimeObject}.\n *\n * @param imageManager The game image manager\n * @param animData The animation data used to initialize the animation\n */\n export class SpriteAnimation {\n hasMultipleDirections: boolean;\n name: string;\n directions: gdjs.SpriteAnimationDirection[] = [];\n\n constructor(\n imageManager: gdjs.PixiImageManager,\n animData: SpriteAnimationData\n ) {\n this.hasMultipleDirections = !!animData.useMultipleDirections;\n this.name = animData.name || '';\n this.reinitialize(imageManager, animData);\n }\n\n /**\n * @param imageManager The game image manager\n * @param animData The animation data used to initialize the animation\n */\n reinitialize(\n imageManager: gdjs.ImageManager,\n animData: SpriteAnimationData\n ) {\n this.hasMultipleDirections = !!animData.useMultipleDirections;\n this.name = animData.name || '';\n let i = 0;\n for (const len = animData.directions.length; i < len; ++i) {\n const directionData = animData.directions[i];\n if (i < this.directions.length) {\n this.directions[i].reinitialize(imageManager, directionData);\n } else {\n this.directions.push(\n new gdjs.SpriteAnimationDirection(imageManager, directionData)\n );\n }\n }\n // Make sure to delete already existing directions which are not used anymore.\n this.directions.length = i;\n }\n }\n\n /**\n * The SpriteRuntimeObject represents an object that can display images.\n */\n export class SpriteRuntimeObject\n extends gdjs.RuntimeObject\n implements\n gdjs.Resizable,\n gdjs.Scalable,\n gdjs.Flippable,\n gdjs.Animatable,\n gdjs.OpacityHandler {\n _currentAnimation: number = 0;\n _currentDirection: number = 0;\n _currentFrame: number = 0;\n /** In seconds */\n _animationElapsedTime: float = 0;\n _animationSpeedScale: number = 1;\n _animationPaused: boolean = false;\n _scaleX: number = 1;\n _scaleY: number = 1;\n _blendMode: number = 0;\n _flippedX: boolean = false;\n _flippedY: boolean = false;\n opacity: float = 255;\n _updateIfNotVisible: boolean;\n\n //Animations:\n _animations: gdjs.SpriteAnimation[] = [];\n\n /**\n * Reference to the current SpriteAnimationFrame that is displayed.\n * Verify is `this._animationFrameDirty === true` before using it, and if so\n * call `this._updateAnimationFrame()`.\n * Can be null, so ensure that this case is handled properly.\n */\n _animationFrame: gdjs.SpriteAnimationFrame | null = null;\n _renderer: gdjs.SpriteRuntimeObjectRenderer;\n _animationFrameDirty: boolean = true;\n\n /**\n * @param instanceContainer The container the object belongs to\n * @param spriteObjectData The object data used to initialize the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n spriteObjectData: ObjectData & SpriteObjectDataType\n ) {\n super(instanceContainer, spriteObjectData);\n this._updateIfNotVisible = !!spriteObjectData.updateIfNotVisible;\n for (let i = 0, len = spriteObjectData.animations.length; i < len; ++i) {\n this._animations.push(\n new gdjs.SpriteAnimation(\n instanceContainer.getGame().getImageManager(),\n spriteObjectData.animations[i]\n )\n );\n }\n this._renderer = new gdjs.SpriteRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n this._updateAnimationFrame();\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n reinitialize(spriteObjectData: SpriteObjectData) {\n super.reinitialize(spriteObjectData);\n const instanceContainer = this.getInstanceContainer();\n this._currentAnimation = 0;\n this._currentDirection = 0;\n this._currentFrame = 0;\n this._animationElapsedTime = 0;\n this._animationSpeedScale = 1;\n this._animationPaused = false;\n this._scaleX = 1;\n this._scaleY = 1;\n this._blendMode = 0;\n this._flippedX = false;\n this._flippedY = false;\n this.opacity = 255;\n this._updateIfNotVisible = !!spriteObjectData.updateIfNotVisible;\n let i = 0;\n for (const len = spriteObjectData.animations.length; i < len; ++i) {\n const animData = spriteObjectData.animations[i];\n if (i < this._animations.length) {\n this._animations[i].reinitialize(\n instanceContainer.getGame().getImageManager(),\n animData\n );\n } else {\n this._animations.push(\n new gdjs.SpriteAnimation(\n instanceContainer.getGame().getImageManager(),\n animData\n )\n );\n }\n }\n this._animations.length = i;\n\n //Make sure to delete already existing animations which are not used anymore.\n this._animationFrame = null;\n this._renderer.reinitialize(this, instanceContainer);\n this._updateAnimationFrame();\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object reinitialize method.\n this.onCreated();\n }\n\n updateFromObjectData(\n oldObjectData: SpriteObjectData,\n newObjectData: SpriteObjectData\n ): boolean {\n const instanceContainer = this.getInstanceContainer();\n let i = 0;\n for (const len = newObjectData.animations.length; i < len; ++i) {\n const animData = newObjectData.animations[i];\n if (i < this._animations.length) {\n this._animations[i].reinitialize(\n instanceContainer.getGame().getImageManager(),\n animData\n );\n } else {\n this._animations.push(\n new gdjs.SpriteAnimation(\n instanceContainer.getGame().getImageManager(),\n animData\n )\n );\n }\n }\n this._animations.length = i;\n\n //Make sure to delete already existing animations which are not used anymore.\n this._updateAnimationFrame();\n if (!this._animationFrame) {\n this.setAnimationIndex(0);\n }\n this.invalidateHitboxes();\n return true;\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n * @param initialInstanceData The extra parameters\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.numberProperties) {\n for (\n let i = 0, len = initialInstanceData.numberProperties.length;\n i < len;\n ++i\n ) {\n const extraData = initialInstanceData.numberProperties[i];\n if (extraData.name === 'animation') {\n this.setAnimationIndex(extraData.value);\n }\n }\n }\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n }\n\n /**\n * Update the current frame of the object according to the elapsed time on the scene.\n */\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n //Playing the animation of all objects including the ones outside the screen can be\n //costly when the scene is big with a lot of animated objects. By default, we skip\n //updating the object if it is not visible.\n if (\n !this._updateIfNotVisible &&\n !this._renderer.getRendererObject().visible\n ) {\n return;\n }\n if (\n this._currentAnimation >= this._animations.length ||\n this._currentDirection >=\n this._animations[this._currentAnimation].directions.length\n ) {\n return;\n }\n const direction = this._animations[this._currentAnimation].directions[\n this._currentDirection\n ];\n const animationDuration = this.getAnimationDuration();\n if (\n !this._animationPaused &&\n (direction.loop || this._animationElapsedTime !== animationDuration) &&\n direction.timeBetweenFrames\n ) {\n const animationElapsedTime =\n this._animationElapsedTime +\n (this.getElapsedTime() / 1000) * this._animationSpeedScale;\n this.setAnimationElapsedTime(\n direction.loop\n ? gdjs.evtTools.common.mod(animationElapsedTime, animationDuration)\n : gdjs.evtTools.common.clamp(\n animationElapsedTime,\n 0,\n animationDuration\n )\n );\n }\n\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n this._renderer.ensureUpToDate();\n }\n\n /**\n * Ensure the sprite is ready to be displayed: the proper animation frame\n * is set and the renderer is up to date (position, angle, alpha, flip, blend mode...).\n */\n updatePreRender(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n this._renderer.ensureUpToDate();\n }\n\n /**\n * Update `this._animationFrame` according to the current animation/direction/frame values\n * (`this._currentAnimation`, `this._currentDirection`, `this._currentFrame`) and set\n * `this._animationFrameDirty` back to false.\n *\n * Trigger a call to the renderer to change the texture being shown (if the animation/direction/frame\n * is valid).\n * If invalid, `this._animationFrame` will be `null` after calling this function.\n */\n _updateAnimationFrame() {\n this._animationFrameDirty = false;\n if (\n this._currentAnimation < this._animations.length &&\n this._currentDirection <\n this._animations[this._currentAnimation].directions.length\n ) {\n const direction = this._animations[this._currentAnimation].directions[\n this._currentDirection\n ];\n if (this._currentFrame < direction.frames.length) {\n this._animationFrame = direction.frames[this._currentFrame];\n if (this._animationFrame !== null) {\n this._renderer.updateFrame(this._animationFrame);\n }\n return;\n }\n }\n\n //Invalid animation/direction/frame:\n this._animationFrame = null;\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n /**\n * Update the hit boxes for the object.\n * Fallback to the default implementation (rotated bounding box) if there is no custom\n * hitboxes defined for the current animation frame.\n */\n updateHitBoxes(): void {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n //Beware, `this._animationFrame` can still be null.\n if (this._animationFrame === null) {\n return;\n }\n\n if (!this._animationFrame.hasCustomHitBoxes) {\n return super.updateHitBoxes();\n }\n\n //logger.log(\"Update for \"+this.name); //Uncomment to track updates\n //(and in particular be sure that unnecessary update are avoided).\n\n //Update the current hitboxes with the frame custom hit boxes\n //and apply transformations.\n for (let i = 0; i < this._animationFrame.customHitBoxes.length; ++i) {\n if (i >= this.hitBoxes.length) {\n this.hitBoxes.push(new gdjs.Polygon());\n }\n for (\n let j = 0;\n j < this._animationFrame.customHitBoxes[i].vertices.length;\n ++j\n ) {\n if (j >= this.hitBoxes[i].vertices.length) {\n this.hitBoxes[i].vertices.push([0, 0]);\n }\n this._transformToGlobal(\n this._animationFrame.customHitBoxes[i].vertices[j][0],\n this._animationFrame.customHitBoxes[i].vertices[j][1],\n this.hitBoxes[i].vertices[j]\n );\n }\n this.hitBoxes[i].vertices.length = this._animationFrame.customHitBoxes[\n i\n ].vertices.length;\n }\n this.hitBoxes.length = this._animationFrame.customHitBoxes.length;\n }\n\n //Rotate and scale and flipping have already been applied to the point by _transformToGlobal.\n //Animations :\n /**\n * Change the animation being played.\n * @param newAnimation The index of the new animation to be played\n * @deprecated Use `setAnimationIndex` instead\n */\n setAnimation(newAnimation: number): void {\n this.setAnimationIndex(newAnimation);\n }\n\n setAnimationIndex(newAnimation: number): void {\n newAnimation = newAnimation | 0;\n if (\n newAnimation < this._animations.length &&\n this._currentAnimation !== newAnimation &&\n newAnimation >= 0\n ) {\n this._currentAnimation = newAnimation;\n this._currentFrame = 0;\n this._animationElapsedTime = 0;\n\n //TODO: This may be unnecessary.\n this._renderer.update();\n this._animationFrameDirty = true;\n this.invalidateHitboxes();\n }\n }\n\n setAnimationName(newAnimationName: string): void {\n if (!newAnimationName) {\n return;\n }\n for (let i = 0; i < this._animations.length; ++i) {\n if (this._animations[i].name === newAnimationName) {\n this.setAnimationIndex(i);\n return;\n }\n }\n }\n\n /**\n * Get the index of the animation being played.\n * @return The index of the new animation being played\n * @deprecated Use `getAnimationIndex` instead\n */\n getAnimation(): number {\n return this.getAnimationIndex();\n }\n\n getAnimationIndex(): number {\n return this._currentAnimation;\n }\n\n getAnimationName(): string {\n if (this._currentAnimation >= this._animations.length) {\n return '';\n }\n return this._animations[this._currentAnimation].name;\n }\n\n isCurrentAnimationName(name: string): boolean {\n return this.getAnimationName() === name;\n }\n\n /**\n * Change the angle (or direction index) of the object\n * @param The new angle (or direction index) to be applied\n */\n setDirectionOrAngle(newValue): void {\n if (this._currentAnimation >= this._animations.length) {\n return;\n }\n const anim = this._animations[this._currentAnimation];\n if (!anim.hasMultipleDirections) {\n if (this.angle === newValue) {\n return;\n }\n this.angle = newValue;\n this.invalidateHitboxes();\n this._renderer.updateAngle();\n } else {\n newValue = newValue | 0;\n if (\n newValue === this._currentDirection ||\n newValue >= anim.directions.length ||\n anim.directions[newValue].frames.length === 0\n ) {\n return;\n }\n this._currentDirection = newValue;\n this._currentFrame = 0;\n this._animationElapsedTime = 0;\n this.angle = 0;\n\n //TODO: This may be unnecessary.\n this._renderer.update();\n this._animationFrameDirty = true;\n this.invalidateHitboxes();\n }\n }\n\n getDirectionOrAngle(): float {\n if (this._currentAnimation >= this._animations.length) {\n return 0;\n }\n if (!this._animations[this._currentAnimation].hasMultipleDirections) {\n return this.angle;\n } else {\n return this._currentDirection;\n }\n }\n\n /**\n * Change the current frame displayed by the animation\n * @param newFrame The index of the frame to be displayed\n */\n setAnimationFrame(newFrame: number): void {\n if (\n this._currentAnimation >= this._animations.length ||\n this._currentDirection >=\n this._animations[this._currentAnimation].directions.length\n ) {\n return;\n }\n const direction = this._animations[this._currentAnimation].directions[\n this._currentDirection\n ];\n if (\n newFrame >= 0 &&\n newFrame < direction.frames.length &&\n newFrame !== this._currentFrame\n ) {\n this._currentFrame = newFrame;\n this._animationElapsedTime = newFrame * direction.timeBetweenFrames;\n this._animationFrameDirty = true;\n this.invalidateHitboxes();\n }\n }\n\n /**\n * Get the index of the current frame displayed by the animation\n * @return newFrame The index of the frame being displayed\n */\n getAnimationFrame(): number {\n return this._currentFrame;\n }\n\n getAnimationElapsedTime(): float {\n return this._animationElapsedTime;\n }\n\n setAnimationElapsedTime(time: float): void {\n const direction = this._animations[this._currentAnimation].directions[\n this._currentDirection\n ];\n this._animationElapsedTime = gdjs.evtTools.common.clamp(\n time,\n 0,\n this.getAnimationDuration()\n );\n\n const oldFrame = this._currentFrame;\n this._currentFrame = Math.min(\n Math.floor(this._animationElapsedTime / direction.timeBetweenFrames),\n direction.frames.length - 1\n );\n if (oldFrame !== this._currentFrame) {\n this._updateAnimationFrame();\n this.invalidateHitboxes();\n }\n }\n\n getAnimationDuration(): number {\n const direction = this._animations[this._currentAnimation].directions[\n this._currentDirection\n ];\n return direction.frames.length * direction.timeBetweenFrames;\n }\n\n getAnimationFrameCount(): number {\n if (this._currentAnimation >= this._animations.length) {\n return 0;\n }\n const currentAnimation = this._animations[this._currentAnimation];\n if (this._currentDirection >= currentAnimation.directions.length) {\n return 0;\n }\n return currentAnimation.directions[this._currentDirection].frames.length;\n }\n\n /**\n * @deprecated\n * Return true if animation has ended.\n * Prefer using `hasAnimationEnded2`. This method returns true as soon as\n * the animation enters the last frame, not at the end of the last frame.\n */\n hasAnimationEndedLegacy(): boolean {\n if (\n this._currentAnimation >= this._animations.length ||\n this._currentDirection >=\n this._animations[this._currentAnimation].directions.length\n ) {\n return true;\n }\n const direction = this._animations[this._currentAnimation].directions[\n this._currentDirection\n ];\n if (direction.loop) {\n return false;\n }\n return this._currentFrame === direction.frames.length - 1;\n }\n\n /**\n * Return true if animation has ended.\n * The animation had ended if:\n * - it's not configured as a loop;\n * - the current frame is the last frame;\n * - the last frame has been displayed long enough.\n *\n * @deprecated Use `hasAnimationEnded` instead.\n */\n hasAnimationEnded2(): boolean {\n return this.hasAnimationEnded();\n }\n\n hasAnimationEnded(): boolean {\n if (\n this._currentAnimation >= this._animations.length ||\n this._currentDirection >=\n this._animations[this._currentAnimation].directions.length\n ) {\n return true;\n }\n const direction = this._animations[this._currentAnimation].directions[\n this._currentDirection\n ];\n if (direction.loop) {\n return false;\n }\n return (\n this._currentFrame === direction.frames.length - 1 &&\n this._animationElapsedTime ===\n direction.frames.length * direction.timeBetweenFrames\n );\n }\n\n /**\n * @deprecated Use `isAnimationPaused` instead.\n */\n animationPaused(): boolean {\n return this.isAnimationPaused();\n }\n\n isAnimationPaused(): boolean {\n return this._animationPaused;\n }\n\n pauseAnimation(): void {\n this._animationPaused = true;\n }\n\n /**\n * @deprecated Use `resumeAnimation` instead.\n */\n playAnimation(): void {\n this.resumeAnimation();\n }\n\n resumeAnimation(): void {\n this._animationPaused = false;\n }\n\n getAnimationSpeedScale() {\n return this._animationSpeedScale;\n }\n\n setAnimationSpeedScale(ratio: float): void {\n this._animationSpeedScale = ratio;\n }\n\n //Position :\n /**\n * Get the position on X axis on the scene of the given point.\n * @param name The point name\n * @return the position on X axis on the scene of the given point.\n */\n getPointX(name: string): float {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n if (name.length === 0 || this._animationFrame === null) {\n return this.getX();\n }\n const pt = this._animationFrame.getPoint(name);\n const pos = gdjs.staticArray(SpriteRuntimeObject.prototype.getPointX);\n this._transformToGlobal(pt.x, pt.y, pos);\n return pos[0];\n }\n\n /**\n * Get the position on Y axis on the scene of the given point.\n * @param name The point name\n * @return the position on Y axis on the scene of the given point.\n */\n getPointY(name: string): float {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n if (name.length === 0 || this._animationFrame === null) {\n return this.getY();\n }\n const pt = this._animationFrame.getPoint(name);\n const pos = gdjs.staticArray(SpriteRuntimeObject.prototype.getPointY);\n this._transformToGlobal(pt.x, pt.y, pos);\n return pos[1];\n }\n /**\n * Get the positions on X and Y axis on the scene of the given point.\n * @param name The point name\n * @return An array of the position on X and Y axis on the scene of the given point.\n */\n getPointPosition(name: string): [x: float, y: float] {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n if (name.length === 0 || this._animationFrame === null) {\n return [this.getX(), this.getY()];\n }\n const pt = this._animationFrame.getPoint(name);\n const pos = gdjs.staticArray(SpriteRuntimeObject.prototype.getPointX);\n this._transformToGlobal(pt.x, pt.y, pos);\n return [pos[0], pos[1]];\n }\n\n /**\n * Return an array containing the coordinates of the point passed as parameter\n * in world coordinates (as opposed to the object local coordinates).\n *\n * Beware: this._animationFrame and this._sprite must *not* be null!\n *\n * All transformations (flipping, scale, rotation) are supported.\n *\n * @param x The X position of the point, in object coordinates.\n * @param y The Y position of the point, in object coordinates.\n * @param result Array that will be updated with the result\n * (x and y position of the point in global coordinates).\n */\n private _transformToGlobal(x: float, y: float, result: number[]) {\n const animationFrame = this._animationFrame as SpriteAnimationFrame;\n let cx = animationFrame.center.x;\n let cy = animationFrame.center.y;\n\n //Flipping\n if (this._flippedX) {\n x = x + (cx - x) * 2;\n }\n if (this._flippedY) {\n y = y + (cy - y) * 2;\n }\n\n //Scale\n const absScaleX = Math.abs(this._scaleX);\n const absScaleY = Math.abs(this._scaleY);\n x *= absScaleX;\n y *= absScaleY;\n cx *= absScaleX;\n cy *= absScaleY;\n\n //Rotation\n const angleInRadians = (this.angle / 180) * Math.PI;\n const cosValue = Math.cos(\n // Only compute cos and sin once (10% faster than doing it twice)\n angleInRadians\n );\n const sinValue = Math.sin(angleInRadians);\n const xToCenterXDelta = x - cx;\n const yToCenterYDelta = y - cy;\n x = cx + cosValue * xToCenterXDelta - sinValue * yToCenterYDelta;\n y = cy + sinValue * xToCenterXDelta + cosValue * yToCenterYDelta;\n result.length = 2;\n result[0] = x + (this.x - animationFrame.origin.x * absScaleX);\n result[1] = y + (this.y - animationFrame.origin.y * absScaleY);\n }\n\n /**\n * Get the X position, on the scene, of the origin of the texture of the object.\n * @return the X position, on the scene, of the origin of the texture of the object.\n */\n getDrawableX(): float {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n if (this._animationFrame === null) {\n return this.x;\n }\n const absScaleX = Math.abs(this._scaleX);\n if (!this._flippedX) {\n return this.x - this._animationFrame.origin.x * absScaleX;\n } else {\n return (\n this.x +\n (-this._animationFrame.origin.x -\n this._renderer.getUnscaledWidth() +\n 2 * this._animationFrame.center.x) *\n absScaleX\n );\n }\n }\n\n /**\n * Get the Y position, on the scene, of the origin of the texture of the object.\n * @return the Y position, on the scene, of the origin of the texture of the object.\n */\n getDrawableY(): float {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n if (this._animationFrame === null) {\n return this.y;\n }\n const absScaleY = Math.abs(this._scaleY);\n if (!this._flippedY) {\n return this.y - this._animationFrame.origin.y * absScaleY;\n } else {\n return (\n this.y +\n (-this._animationFrame.origin.y -\n this._renderer.getUnscaledHeight() +\n 2 * this._animationFrame.center.y) *\n absScaleY\n );\n }\n }\n\n /**\n * Get the X position of the center of the object, relative to top-left of the texture of the object (`getDrawableX`).\n * @return X position of the center of the object, relative to `getDrawableX()`.\n */\n getCenterX(): float {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n if (this._animationFrame === null) {\n return 0;\n }\n if (!this._flippedX) {\n //Just need to multiply by the scale as it is the center.\n return this._animationFrame.center.x * Math.abs(this._scaleX);\n } else {\n return (\n (this._renderer.getUnscaledWidth() - this._animationFrame.center.x) *\n Math.abs(this._scaleX)\n );\n }\n }\n\n /**\n * Get the Y position of the center of the object, relative to top-left of the texture of the object (`getDrawableY`).\n * @return Y position of the center of the object, relative to `getDrawableY()`.\n */\n getCenterY(): float {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n if (this._animationFrame === null) {\n return 0;\n }\n if (!this._flippedY) {\n //Just need to multiply by the scale as it is the center.\n return this._animationFrame.center.y * Math.abs(this._scaleY);\n } else {\n return (\n (this._renderer.getUnscaledHeight() - this._animationFrame.center.y) *\n Math.abs(this._scaleY)\n );\n }\n }\n\n /**\n * Set the X position of the (origin of the) object.\n * @param x The new X position.\n */\n setX(x: float): void {\n if (x === this.x) {\n return;\n }\n this.x = x;\n if (this._animationFrame !== null) {\n this.invalidateHitboxes();\n this._renderer.updateX();\n }\n }\n\n /**\n * Set the Y position of the (origin of the) object.\n * @param y The new Y position.\n */\n setY(y: float): void {\n if (y === this.y) {\n return;\n }\n this.y = y;\n if (this._animationFrame !== null) {\n this.invalidateHitboxes();\n this._renderer.updateY();\n }\n }\n\n /**\n * Set the angle of the object.\n * @param angle The new angle, in degrees.\n */\n setAngle(angle: float): void {\n if (this._currentAnimation >= this._animations.length) {\n return;\n }\n if (!this._animations[this._currentAnimation].hasMultipleDirections) {\n if (this.angle === angle) {\n return;\n }\n this.angle = angle;\n this._renderer.updateAngle();\n this.invalidateHitboxes();\n } else {\n angle = angle % 360;\n if (angle < 0) {\n angle += 360;\n }\n this.setDirectionOrAngle(Math.round(angle / 45) % 8);\n }\n }\n\n /**\n * Get the angle of the object.\n * @return The angle, in degrees.\n */\n getAngle(): float {\n if (this._currentAnimation >= this._animations.length) {\n return 0;\n }\n if (!this._animations[this._currentAnimation].hasMultipleDirections) {\n return this.angle;\n } else {\n return this._currentDirection * 45;\n }\n }\n\n //Visibility and display :\n setBlendMode(newMode): void {\n if (this._blendMode === newMode) {\n return;\n }\n this._blendMode = newMode;\n this._renderer.update();\n }\n\n getBlendMode() {\n return this._blendMode;\n }\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 getOpacity(): number {\n return this.opacity;\n }\n\n /**\n * Hide (or show) the object\n * @param enable true to hide the object, false to show it again.\n */\n hide(enable: boolean): void {\n if (enable === undefined) {\n enable = true;\n }\n this.hidden = enable;\n this._renderer.updateVisibility();\n }\n\n /**\n * Change the tint of the sprite object.\n *\n * @param rgbColor The color, in RGB format (\"128;200;255\").\n */\n setColor(rgbColor: string): void {\n this._renderer.setColor(rgbColor);\n }\n\n /**\n * Get the tint of the sprite object.\n *\n * @returns The color, in RGB format (\"128;200;255\").\n */\n getColor(): string {\n return this._renderer.getColor();\n }\n\n flipX(enable: boolean) {\n if (enable !== this._flippedX) {\n this._scaleX *= -1;\n this._flippedX = enable;\n this.invalidateHitboxes();\n this._renderer.update();\n }\n }\n\n flipY(enable: boolean) {\n if (enable !== this._flippedY) {\n this._scaleY *= -1;\n this._flippedY = enable;\n this.invalidateHitboxes();\n this._renderer.update();\n }\n }\n\n isFlippedX(): boolean {\n return this._flippedX;\n }\n\n isFlippedY(): boolean {\n return this._flippedY;\n }\n\n //Scale and size :\n /**\n * Get the width of the object.\n *\n * @return The width of the object, in pixels.\n */\n getWidth(): float {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n return this._renderer.getWidth();\n }\n\n /**\n * Get the height of the object.\n *\n * @return The height of the object, in pixels.\n */\n getHeight(): float {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n return this._renderer.getHeight();\n }\n\n setWidth(newWidth: float): void {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n const unscaledWidth = this._renderer.getUnscaledWidth();\n if (unscaledWidth !== 0) {\n this.setScaleX(newWidth / unscaledWidth);\n }\n }\n\n setHeight(newHeight: float): void {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n const unscaledHeight = this._renderer.getUnscaledHeight();\n if (unscaledHeight !== 0) {\n this.setScaleY(newHeight / unscaledHeight);\n }\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScale(newScale: float): void {\n if (newScale < 0) {\n newScale = 0;\n }\n if (\n newScale === Math.abs(this._scaleX) &&\n newScale === Math.abs(this._scaleY)\n ) {\n return;\n }\n this._scaleX = newScale * (this._flippedX ? -1 : 1);\n this._scaleY = newScale * (this._flippedY ? -1 : 1);\n this._renderer.update();\n this.invalidateHitboxes();\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleX(newScale: float): void {\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleX)) {\n return;\n }\n this._scaleX = newScale * (this._flippedX ? -1 : 1);\n this._renderer.update();\n this.invalidateHitboxes();\n }\n\n /**\n * Change the scale on Y axis of the object (changing its height).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleY(newScale: float): void {\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleY)) {\n return;\n }\n this._scaleY = newScale * (this._flippedY ? -1 : 1);\n this._renderer.update();\n this.invalidateHitboxes();\n }\n\n /**\n * Get the scale of the object (or the arithmetic mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the arithmetic mean of the X and Y scale in case they are different).\n * @deprecated Use `getScale` instead.\n */\n getScaleMean(): float {\n return (Math.abs(this._scaleX) + Math.abs(this._scaleY)) / 2.0;\n }\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): float {\n const scaleX = Math.abs(this._scaleX);\n const scaleY = Math.abs(this._scaleY);\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get the scale of the object on Y axis.\n *\n * @return the scale of the object on Y axis\n */\n getScaleY(): float {\n return Math.abs(this._scaleY);\n }\n\n /**\n * Get the scale of the object on X axis.\n *\n * @return the scale of the object on X axis\n */\n getScaleX(): float {\n return Math.abs(this._scaleX);\n }\n\n //Other :\n /**\n * @param obj The target object\n * @param scene The scene containing the object\n * @deprecated\n */\n turnTowardObject(obj: gdjs.RuntimeObject | null, scene: gdjs.RuntimeScene) {\n if (obj === null) {\n return;\n }\n this.rotateTowardPosition(\n obj.getDrawableX() + obj.getCenterX(),\n obj.getDrawableY() + obj.getCenterY(),\n 0,\n scene\n );\n }\n }\n gdjs.registerObject(\n 'Sprite',\n //Notify gdjs of the object existence.\n gdjs.SpriteRuntimeObject\n );\n\n //Others initialization and internal state management :\n SpriteRuntimeObject.supportsReinitialization = true;\n}\n"],
|
|
5
|
-
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAmFS,OAA2B,CAehC,YAAY,EAAiC,EAA4B,CAVzE,YAAsB,CAAE,EAAG,EAAG,EAAG,GACjC,YAAsB,CAAE,EAAG,EAAG,EAAG,GACjC,uBAA6B,GAC7B,oBAAiC,GAQ/B,KAAK,MAAQ,EAAY,EAAU,MAAQ,GAC3C,KAAK,QAAU,EAAK,4BAA4B,kBAC9C,EACA,KAAK,OAEP,KAAK,OAAS,GAAI,WAClB,KAAK,aAAa,EAAc,GAOlC,aAAa,EAAiC,EAA4B,CACxE,KAAK,OAAO,QACZ,OAAS,GAAI,EAAG,EAAM,EAAU,OAAO,OAAQ,EAAI,EAAK,EAAE,EAAG,CAC3D,KAAM,GAAS,EAAU,OAAO,GAC1B,EAAQ,CAAE,EAAG,EAAO,EAAG,EAAG,EAAO,GACvC,KAAK,OAAO,IAAI,EAAO,KAAM,GAE/B,KAAM,GAAS,EAAU,YACzB,KAAK,OAAO,EAAI,EAAO,EACvB,KAAK,OAAO,EAAI,EAAO,EACvB,KAAM,GAAS,EAAU,YAgBzB,GAfA,AAAI,EAAO,YAAc,GACvB,MAAK,OAAO,EAAI,EAAO,EACvB,KAAK,OAAO,EAAI,EAAO,GAEvB,MAAK,OAAO,EACV,EAAK,4BAA4B,uBAC/B,KAAK,SACH,EACN,KAAK,OAAO,EACV,EAAK,4BAA4B,wBAC/B,KAAK,SACH,GAIJ,EAAU,uBAAwB,CACpC,KAAK,kBAAoB,GACzB,GAAI,GAAI,EACR,OAAS,GAAM,EAAU,oBAAoB,OAAQ,EAAI,EAAK,EAAE,EAAG,CACjE,KAAM,GAA6B,EAAU,oBAAoB,GAGjE,AAAI,GAAK,KAAK,eAAe,QAC3B,KAAK,eAAe,KAAK,GAAI,GAAK,SAEpC,GAAI,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AAU,GAQjB,SAAS,EAAuB,CAI9B,AAHI,EAAW,GACb,GAAW,GAGX,MAAa,KAAK,IAAI,KAAK,UAC3B,IAAa,KAAK,IAAI,KAAK,WAI7B,MAAK,QAAU,EAAY,MAAK,UAAY,GAAK,GACjD,KAAK,QAAU,EAAY,MAAK,UAAY,GAAK,GACjD,KAAK,UAAU,SACf,KAAK,sBAQP,UAAU,EAAuB,CAI/B,AAHI,EAAW,GACb,GAAW,GAET,IAAa,KAAK,IAAI,KAAK,UAG/B,MAAK,QAAU,EAAY,MAAK,UAAY,GAAK,GACjD,KAAK,UAAU,SACf,KAAK,sBAQP,UAAU,EAAuB,CAI/B,AAHI,EAAW,GACb,GAAW,GAET,IAAa,KAAK,IAAI,KAAK,UAG/B,MAAK,QAAU,EAAY,MAAK,UAAY,GAAK,GACjD,KAAK,UAAU,SACf,KAAK,sBASP,cAAsB,CACpB,MAAQ,MAAK,IAAI,KAAK,SAAW,KAAK,IAAI,KAAK,UAAY,EAQ7D,UAAkB,CAChB,KAAM,GAAS,KAAK,IAAI,KAAK,SACvB,EAAS,KAAK,IAAI,KAAK,SAC7B,MAAO,KAAW,EAAS,EAAS,KAAK,KAAK,EAAS,GAQzD,WAAmB,CACjB,MAAO,MAAK,IAAI,KAAK,SAQvB,WAAmB,CACjB,MAAO,MAAK,IAAI,KAAK,SASvB,iBAAiB,EAAgC,EAA0B,CACzE,AAAI,IAAQ,MAGZ,KAAK,qBACH,EAAI,eAAiB,EAAI,aACzB,EAAI,eAAiB,EAAI,aACzB,EACA,IA3kCC,EAAM,sBA+kCb,EAAK,eACH,SAEA,EAAK,qBAIP,EAAoB,yBAA2B,KAn3CvC",
|
|
4
|
+
"sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n /** Represents the data of a {@link gdjs.SpriteRuntimeObject}. */\n export type SpriteObjectDataType = {\n /** Update the object even if he is not visible?. */\n updateIfNotVisible: boolean;\n /** The list of {@link SpriteAnimationData} representing {@link gdjs.SpriteAnimation} instances. */\n animations: Array<SpriteAnimationData>;\n };\n\n export type SpriteObjectData = ObjectData & SpriteObjectDataType;\n\n export type SpriteNetworkSyncDataType = {\n anim: SpriteAnimatorNetworkSyncData;\n ifx: boolean;\n ify: boolean;\n sx: float;\n sy: float;\n op: float;\n color: string;\n };\n\n export type SpriteNetworkSyncData = ObjectNetworkSyncData &\n SpriteNetworkSyncDataType;\n\n /**\n * The SpriteRuntimeObject represents an object that can display images.\n */\n export class SpriteRuntimeObject\n extends gdjs.RuntimeObject\n implements\n gdjs.Resizable,\n gdjs.Scalable,\n gdjs.Flippable,\n gdjs.Animatable,\n gdjs.OpacityHandler {\n _animator: gdjs.SpriteAnimator<any>;\n _scaleX: float = 1;\n _scaleY: float = 1;\n _blendMode: integer = 0;\n _flippedX: boolean = false;\n _flippedY: boolean = false;\n opacity: float = 255;\n _updateIfNotVisible: boolean;\n\n _renderer: gdjs.SpriteRuntimeObjectRenderer;\n _animationFrameDirty = true;\n\n /**\n * @param instanceContainer The container the object belongs to\n * @param spriteObjectData The object data used to initialize the object\n */\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n spriteObjectData: ObjectData & SpriteObjectDataType\n ) {\n super(instanceContainer, spriteObjectData);\n this._updateIfNotVisible = !!spriteObjectData.updateIfNotVisible;\n this._renderer = new gdjs.SpriteRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n this._animator = new gdjs.SpriteAnimator(\n spriteObjectData.animations,\n gdjs.SpriteRuntimeObjectRenderer.getAnimationFrameTextureManager(\n instanceContainer.getGame().getImageManager()\n )\n );\n this._updateAnimationFrame();\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n reinitialize(spriteObjectData: SpriteObjectData) {\n super.reinitialize(spriteObjectData);\n const instanceContainer = this.getInstanceContainer();\n this._animator.reinitialize(spriteObjectData.animations);\n this._scaleX = 1;\n this._scaleY = 1;\n this._blendMode = 0;\n this._flippedX = false;\n this._flippedY = false;\n this.opacity = 255;\n this._updateIfNotVisible = !!spriteObjectData.updateIfNotVisible;\n this._renderer.reinitialize(this, instanceContainer);\n this._updateAnimationFrame();\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object reinitialize method.\n this.onCreated();\n }\n\n updateFromObjectData(\n oldObjectData: SpriteObjectData,\n newObjectData: SpriteObjectData\n ): boolean {\n this._animator.updateFromObjectData(\n oldObjectData.animations,\n newObjectData.animations\n );\n this._updateIfNotVisible = !!newObjectData.updateIfNotVisible;\n this.invalidateHitboxes();\n return true;\n }\n\n getNetworkSyncData(): SpriteNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n anim: this._animator.getNetworkSyncData(),\n ifx: this.isFlippedX(),\n ify: this.isFlippedY(),\n sx: this._scaleX,\n sy: this._scaleY,\n op: this.opacity,\n color: this.getColor(),\n };\n }\n\n updateFromNetworkSyncData(newNetworkSyncData: SpriteNetworkSyncData) {\n super.updateFromNetworkSyncData(newNetworkSyncData);\n if (newNetworkSyncData.ifx !== undefined) {\n this.flipX(newNetworkSyncData.ifx);\n }\n if (newNetworkSyncData.ify !== undefined) {\n this.flipY(newNetworkSyncData.ify);\n }\n if (newNetworkSyncData.sx !== undefined) {\n this.setScaleX(Math.abs(newNetworkSyncData.sx));\n }\n if (newNetworkSyncData.sy !== undefined) {\n this.setScaleY(Math.abs(newNetworkSyncData.sy));\n }\n if (newNetworkSyncData.op !== undefined) {\n this.setOpacity(newNetworkSyncData.op);\n }\n if (newNetworkSyncData.anim) {\n this._animator.updateFromNetworkSyncData(newNetworkSyncData.anim);\n // TODO: optimize updating the animation frame only if needed.\n this._updateAnimationFrame();\n }\n if (\n newNetworkSyncData.ifx !== undefined ||\n newNetworkSyncData.ify !== undefined ||\n newNetworkSyncData.sx !== undefined ||\n newNetworkSyncData.sy !== undefined ||\n newNetworkSyncData.anim !== undefined\n ) {\n this.invalidateHitboxes();\n }\n if (newNetworkSyncData.color !== undefined) {\n this.setColor(newNetworkSyncData.color);\n }\n }\n\n /**\n * Initialize the extra parameters that could be set for an instance.\n * @param initialInstanceData The extra parameters\n */\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.numberProperties) {\n for (\n let i = 0, len = initialInstanceData.numberProperties.length;\n i < len;\n ++i\n ) {\n const extraData = initialInstanceData.numberProperties[i];\n if (extraData.name === 'animation') {\n this.setAnimationIndex(extraData.value);\n }\n }\n }\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n }\n\n /**\n * Update the current frame of the object according to the elapsed time on the scene.\n */\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n //Playing the animation of all objects including the ones outside the screen can be\n //costly when the scene is big with a lot of animated objects. By default, we skip\n //updating the object if it is not visible.\n if (\n !this._updateIfNotVisible &&\n !this._renderer.getRendererObject().visible\n ) {\n return;\n }\n const hasFrameChanged = this._animator.step(this.getElapsedTime() / 1000);\n if (hasFrameChanged) {\n this._updateAnimationFrame();\n // TODO: Hitboxes may not need an update if every frames has the same ones.\n this.invalidateHitboxes();\n }\n this._renderer.ensureUpToDate();\n }\n\n /**\n * Ensure the sprite is ready to be displayed: the proper animation frame\n * is set and the renderer is up to date (position, angle, alpha, flip, blend mode...).\n */\n updatePreRender(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n this._renderer.ensureUpToDate();\n }\n\n /**\n * Update `this._animationFrame` according to the current animation/direction/frame values\n * (`this._currentAnimation`, `this._currentDirection`, `this._currentFrame`) and set\n * `this._animationFrameDirty` back to false.\n *\n * Trigger a call to the renderer to change the texture being shown (if the animation/direction/frame\n * is valid).\n * If invalid, `this._animationFrame` will be `null` after calling this function.\n */\n _updateAnimationFrame() {\n this._animationFrameDirty = false;\n const animationFrame = this._animator.getCurrentFrame();\n if (animationFrame) {\n this._renderer.updateFrame(animationFrame);\n }\n }\n\n getRendererObject() {\n return this._renderer.getRendererObject();\n }\n\n /**\n * Update the hit boxes for the object.\n * Fallback to the default implementation (rotated bounding box) if there is no custom\n * hitboxes defined for the current animation frame.\n */\n updateHitBoxes(): void {\n const animationFrame = this._animator.getCurrentFrame();\n if (!animationFrame) {\n return;\n }\n\n if (!animationFrame.hasCustomHitBoxes) {\n return super.updateHitBoxes();\n }\n\n //logger.log(\"Update for \"+this.name); //Uncomment to track updates\n //(and in particular be sure that unnecessary update are avoided).\n\n //Update the current hitboxes with the frame custom hit boxes\n //and apply transformations.\n for (let i = 0; i < animationFrame.customHitBoxes.length; ++i) {\n if (i >= this.hitBoxes.length) {\n this.hitBoxes.push(new gdjs.Polygon());\n }\n for (\n let j = 0;\n j < animationFrame.customHitBoxes[i].vertices.length;\n ++j\n ) {\n if (j >= this.hitBoxes[i].vertices.length) {\n this.hitBoxes[i].vertices.push([0, 0]);\n }\n this._transformToGlobal(\n animationFrame.customHitBoxes[i].vertices[j][0],\n animationFrame.customHitBoxes[i].vertices[j][1],\n this.hitBoxes[i].vertices[j]\n );\n }\n this.hitBoxes[i].vertices.length =\n animationFrame.customHitBoxes[i].vertices.length;\n }\n this.hitBoxes.length = animationFrame.customHitBoxes.length;\n }\n\n //Rotate and scale and flipping have already been applied to the point by _transformToGlobal.\n //Animations :\n /**\n * Change the animation being played.\n * @param newAnimation The index of the new animation to be played\n * @deprecated Use `setAnimationIndex` instead\n */\n setAnimation(newAnimation: integer): void {\n this.setAnimationIndex(newAnimation);\n }\n\n setAnimationIndex(newAnimation: integer): void {\n const hasAnimationChanged = this._animator.setAnimationIndex(\n newAnimation\n );\n if (hasAnimationChanged) {\n //TODO: This may be unnecessary.\n this._renderer.update();\n this._animationFrameDirty = true;\n this.invalidateHitboxes();\n }\n }\n\n setAnimationName(newAnimationName: string): void {\n const hasAnimationChanged = this._animator.setAnimationName(\n newAnimationName\n );\n if (hasAnimationChanged) {\n //TODO: This may be unnecessary.\n this._renderer.update();\n this._animationFrameDirty = true;\n this.invalidateHitboxes();\n }\n }\n\n /**\n * Get the index of the animation being played.\n * @return The index of the new animation being played\n * @deprecated Use `getAnimationIndex` instead\n */\n getAnimation(): integer {\n return this.getAnimationIndex();\n }\n\n getAnimationIndex(): integer {\n return this._animator.getAnimationIndex();\n }\n\n getAnimationName(): string {\n return this._animator.getAnimationName();\n }\n\n isCurrentAnimationName(name: string): boolean {\n return this.getAnimationName() === name;\n }\n\n /**\n * Change the angle (or direction index) of the object\n * @param The new angle (or direction index) to be applied\n */\n setDirectionOrAngle(newValue: float): void {\n const actualValue = this._animator.setDirectionOrAngle(\n this.angle,\n newValue\n );\n if (actualValue !== null) {\n this.angle = actualValue;\n //TODO: This may be unnecessary.\n this._renderer.update();\n this._animationFrameDirty = true;\n this.invalidateHitboxes();\n this._renderer.updateAngle();\n }\n }\n\n getDirectionOrAngle(): float {\n return this._animator.getDirectionOrAngle(this.angle);\n }\n\n /**\n * Change the current frame displayed by the animation\n * @param newFrame The index of the frame to be displayed\n */\n setAnimationFrame(newFrame: integer): void {\n const hasFrameChanged = this._animator.setAnimationFrameIndex(newFrame);\n if (hasFrameChanged) {\n this._animationFrameDirty = true;\n this.invalidateHitboxes();\n }\n }\n\n /**\n * Get the index of the current frame displayed by the animation\n * @return newFrame The index of the frame being displayed\n */\n getAnimationFrame(): integer {\n return this._animator.getAnimationFrameIndex();\n }\n\n getAnimationElapsedTime(): float {\n return this._animator.getAnimationElapsedTime();\n }\n\n setAnimationElapsedTime(time: float): void {\n const hasFrameChanged = this._animator.getAnimationElapsedTime();\n if (hasFrameChanged) {\n this._animationFrameDirty = true;\n this.invalidateHitboxes();\n }\n }\n\n getAnimationDuration(): float {\n return this._animator.getAnimationDuration();\n }\n\n getAnimationFrameCount(): integer {\n return this._animator.getAnimationFrameCount();\n }\n\n /**\n * @deprecated\n * Return true if animation has ended.\n * Prefer using `hasAnimationEnded2`. This method returns true as soon as\n * the animation enters the last frame, not at the end of the last frame.\n */\n hasAnimationEndedLegacy(): boolean {\n return this._animator.hasAnimationEndedLegacy();\n }\n\n /**\n * Return true if animation has ended.\n * The animation had ended if:\n * - it's not configured as a loop;\n * - the current frame is the last frame;\n * - the last frame has been displayed long enough.\n *\n * @deprecated Use `hasAnimationEnded` instead.\n */\n hasAnimationEnded2(): boolean {\n return this._animator.hasAnimationEnded();\n }\n\n hasAnimationEnded(): boolean {\n return this._animator.hasAnimationEnded();\n }\n\n /**\n * @deprecated Use `isAnimationPaused` instead.\n */\n animationPaused(): boolean {\n return this._animator.isAnimationPaused();\n }\n\n isAnimationPaused(): boolean {\n return this._animator.isAnimationPaused();\n }\n\n pauseAnimation(): void {\n this._animator.pauseAnimation();\n }\n\n /**\n * @deprecated Use `resumeAnimation` instead.\n */\n playAnimation(): void {\n this._animator.resumeAnimation();\n }\n\n resumeAnimation(): void {\n this._animator.resumeAnimation();\n }\n\n getAnimationSpeedScale(): float {\n return this._animator.getAnimationSpeedScale();\n }\n\n setAnimationSpeedScale(ratio: float): void {\n this._animator.setAnimationSpeedScale(ratio);\n }\n\n //Position :\n /**\n * Get the position on X axis on the scene of the given point.\n * @param name The point name\n * @return the position on X axis on the scene of the given point.\n */\n getPointX(name: string): float {\n const animationFrame = this._animator.getCurrentFrame();\n if (name.length === 0 || animationFrame === null) {\n return this.getX();\n }\n const pt = animationFrame.getPoint(name);\n const pos = gdjs.staticArray(SpriteRuntimeObject.prototype.getPointX);\n this._transformToGlobal(pt.x, pt.y, pos);\n return pos[0];\n }\n\n /**\n * Get the position on Y axis on the scene of the given point.\n * @param name The point name\n * @return the position on Y axis on the scene of the given point.\n */\n getPointY(name: string): float {\n const animationFrame = this._animator.getCurrentFrame();\n if (name.length === 0 || animationFrame === null) {\n return this.getY();\n }\n const pt = animationFrame.getPoint(name);\n const pos = gdjs.staticArray(SpriteRuntimeObject.prototype.getPointY);\n this._transformToGlobal(pt.x, pt.y, pos);\n return pos[1];\n }\n /**\n * Get the positions on X and Y axis on the scene of the given point.\n * @param name The point name\n * @return An array of the position on X and Y axis on the scene of the given point.\n */\n getPointPosition(name: string): [x: float, y: float] {\n const animationFrame = this._animator.getCurrentFrame();\n if (name.length === 0 || animationFrame === null) {\n return [this.getX(), this.getY()];\n }\n const pt = animationFrame.getPoint(name);\n const pos = gdjs.staticArray(SpriteRuntimeObject.prototype.getPointX);\n this._transformToGlobal(pt.x, pt.y, pos);\n return [pos[0], pos[1]];\n }\n\n /**\n * Return an array containing the coordinates of the point passed as parameter\n * in world coordinates (as opposed to the object local coordinates).\n *\n * Beware: this._animationFrame and this._sprite must *not* be null!\n *\n * All transformations (flipping, scale, rotation) are supported.\n *\n * @param x The X position of the point, in object coordinates.\n * @param y The Y position of the point, in object coordinates.\n * @param result Array that will be updated with the result\n * (x and y position of the point in global coordinates).\n */\n private _transformToGlobal(x: float, y: float, result: float[]) {\n const animationFrame = this._animator.getCurrentFrame() as SpriteAnimationFrame<\n any\n >;\n let cx = animationFrame.center.x;\n let cy = animationFrame.center.y;\n\n //Flipping\n if (this._flippedX) {\n x = x + (cx - x) * 2;\n }\n if (this._flippedY) {\n y = y + (cy - y) * 2;\n }\n\n //Scale\n const absScaleX = Math.abs(this._scaleX);\n const absScaleY = Math.abs(this._scaleY);\n x *= absScaleX;\n y *= absScaleY;\n cx *= absScaleX;\n cy *= absScaleY;\n\n //Rotation\n const angleInRadians = (this.angle / 180) * Math.PI;\n const cosValue = Math.cos(\n // Only compute cos and sin once (10% faster than doing it twice)\n angleInRadians\n );\n const sinValue = Math.sin(angleInRadians);\n const xToCenterXDelta = x - cx;\n const yToCenterYDelta = y - cy;\n x = cx + cosValue * xToCenterXDelta - sinValue * yToCenterYDelta;\n y = cy + sinValue * xToCenterXDelta + cosValue * yToCenterYDelta;\n result.length = 2;\n result[0] = x + (this.x - animationFrame.origin.x * absScaleX);\n result[1] = y + (this.y - animationFrame.origin.y * absScaleY);\n }\n\n /**\n * Get the X position, on the scene, of the origin of the texture of the object.\n * @return the X position, on the scene, of the origin of the texture of the object.\n */\n getDrawableX(): float {\n const animationFrame = this._animator.getCurrentFrame();\n if (animationFrame === null) {\n return this.x;\n }\n const absScaleX = Math.abs(this._scaleX);\n if (!this._flippedX) {\n return this.x - animationFrame.origin.x * absScaleX;\n } else {\n return (\n this.x +\n (-animationFrame.origin.x -\n this._renderer.getUnscaledWidth() +\n 2 * animationFrame.center.x) *\n absScaleX\n );\n }\n }\n\n /**\n * Get the Y position, on the scene, of the origin of the texture of the object.\n * @return the Y position, on the scene, of the origin of the texture of the object.\n */\n getDrawableY(): float {\n const animationFrame = this._animator.getCurrentFrame();\n if (animationFrame === null) {\n return this.y;\n }\n const absScaleY = Math.abs(this._scaleY);\n if (!this._flippedY) {\n return this.y - animationFrame.origin.y * absScaleY;\n } else {\n return (\n this.y +\n (-animationFrame.origin.y -\n this._renderer.getUnscaledHeight() +\n 2 * animationFrame.center.y) *\n absScaleY\n );\n }\n }\n\n /**\n * Get the X position of the center of the object, relative to top-left of the texture of the object (`getDrawableX`).\n * @return X position of the center of the object, relative to `getDrawableX()`.\n */\n getCenterX(): float {\n const animationFrame = this._animator.getCurrentFrame();\n if (animationFrame === null) {\n return 0;\n }\n if (!this._flippedX) {\n //Just need to multiply by the scale as it is the center.\n return animationFrame.center.x * Math.abs(this._scaleX);\n } else {\n return (\n (this._renderer.getUnscaledWidth() - animationFrame.center.x) *\n Math.abs(this._scaleX)\n );\n }\n }\n\n /**\n * Get the Y position of the center of the object, relative to top-left of the texture of the object (`getDrawableY`).\n * @return Y position of the center of the object, relative to `getDrawableY()`.\n */\n getCenterY(): float {\n const animationFrame = this._animator.getCurrentFrame();\n if (animationFrame === null) {\n return 0;\n }\n if (!this._flippedY) {\n //Just need to multiply by the scale as it is the center.\n return animationFrame.center.y * Math.abs(this._scaleY);\n } else {\n return (\n (this._renderer.getUnscaledHeight() - animationFrame.center.y) *\n Math.abs(this._scaleY)\n );\n }\n }\n\n /**\n * Set the X position of the (origin of the) object.\n * @param x The new X position.\n */\n setX(x: float): void {\n if (x === this.x) {\n return;\n }\n this.x = x;\n const animationFrame = this._animator.getCurrentFrame();\n if (animationFrame !== null) {\n this.invalidateHitboxes();\n this._renderer.updateX();\n }\n }\n\n /**\n * Set the Y position of the (origin of the) object.\n * @param y The new Y position.\n */\n setY(y: float): void {\n if (y === this.y) {\n return;\n }\n this.y = y;\n const animationFrame = this._animator.getCurrentFrame();\n if (animationFrame !== null) {\n this.invalidateHitboxes();\n this._renderer.updateY();\n }\n }\n\n /**\n * Set the angle of the object.\n * @param angle The new angle, in degrees.\n */\n setAngle(angle: float): void {\n const actualValue = this._animator.setAngle(this.angle, angle);\n if (actualValue !== null) {\n this.angle = actualValue;\n this.invalidateHitboxes();\n this._renderer.updateAngle();\n }\n }\n\n /**\n * Get the angle of the object.\n * @return The angle, in degrees.\n */\n getAngle(): float {\n return this._animator.getAngle(this.angle);\n }\n\n //Visibility and display :\n setBlendMode(newMode): void {\n if (this._blendMode === newMode) {\n return;\n }\n this._blendMode = newMode;\n this._renderer.update();\n }\n\n getBlendMode() {\n return this._blendMode;\n }\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 getOpacity(): float {\n return this.opacity;\n }\n\n /**\n * Hide (or show) the object\n * @param enable true to hide the object, false to show it again.\n */\n hide(enable: boolean): void {\n if (enable === undefined) {\n enable = true;\n }\n this.hidden = enable;\n this._renderer.updateVisibility();\n }\n\n /**\n * Change the tint of the sprite object.\n *\n * @param rgbColor The color, in RGB format (\"128;200;255\").\n */\n setColor(rgbColor: string): void {\n this._renderer.setColor(rgbColor);\n }\n\n /**\n * Get the tint of the sprite object.\n *\n * @returns The color, in RGB format (\"128;200;255\").\n */\n getColor(): string {\n return this._renderer.getColor();\n }\n\n flipX(enable: boolean) {\n if (enable !== this._flippedX) {\n this._scaleX *= -1;\n this._flippedX = enable;\n this.invalidateHitboxes();\n this._renderer.update();\n }\n }\n\n flipY(enable: boolean) {\n if (enable !== this._flippedY) {\n this._scaleY *= -1;\n this._flippedY = enable;\n this.invalidateHitboxes();\n this._renderer.update();\n }\n }\n\n isFlippedX(): boolean {\n return this._flippedX;\n }\n\n isFlippedY(): boolean {\n return this._flippedY;\n }\n\n //Scale and size :\n /**\n * Get the width of the object.\n *\n * @return The width of the object, in pixels.\n */\n getWidth(): float {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n return this._renderer.getWidth();\n }\n\n /**\n * Get the height of the object.\n *\n * @return The height of the object, in pixels.\n */\n getHeight(): float {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n return this._renderer.getHeight();\n }\n\n setWidth(newWidth: float): void {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n const unscaledWidth = this._renderer.getUnscaledWidth();\n if (unscaledWidth !== 0) {\n this.setScaleX(newWidth / unscaledWidth);\n }\n }\n\n setHeight(newHeight: float): void {\n if (this._animationFrameDirty) {\n this._updateAnimationFrame();\n }\n const unscaledHeight = this._renderer.getUnscaledHeight();\n if (unscaledHeight !== 0) {\n this.setScaleY(newHeight / unscaledHeight);\n }\n }\n\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScale(newScale: float): void {\n if (newScale < 0) {\n newScale = 0;\n }\n if (\n newScale === Math.abs(this._scaleX) &&\n newScale === Math.abs(this._scaleY)\n ) {\n return;\n }\n this._scaleX = newScale * (this._flippedX ? -1 : 1);\n this._scaleY = newScale * (this._flippedY ? -1 : 1);\n this._renderer.update();\n this.invalidateHitboxes();\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleX(newScale: float): void {\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleX)) {\n return;\n }\n this._scaleX = newScale * (this._flippedX ? -1 : 1);\n this._renderer.update();\n this.invalidateHitboxes();\n }\n\n /**\n * Change the scale on Y axis of the object (changing its height).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleY(newScale: float): void {\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleY)) {\n return;\n }\n this._scaleY = newScale * (this._flippedY ? -1 : 1);\n this._renderer.update();\n this.invalidateHitboxes();\n }\n\n /**\n * Get the scale of the object (or the arithmetic mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the arithmetic mean of the X and Y scale in case they are different).\n * @deprecated Use `getScale` instead.\n */\n getScaleMean(): float {\n return (Math.abs(this._scaleX) + Math.abs(this._scaleY)) / 2.0;\n }\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): float {\n const scaleX = Math.abs(this._scaleX);\n const scaleY = Math.abs(this._scaleY);\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get the scale of the object on Y axis.\n *\n * @return the scale of the object on Y axis\n */\n getScaleY(): float {\n return Math.abs(this._scaleY);\n }\n\n /**\n * Get the scale of the object on X axis.\n *\n * @return the scale of the object on X axis\n */\n getScaleX(): float {\n return Math.abs(this._scaleX);\n }\n\n //Other :\n /**\n * @param obj The target object\n * @param scene The scene containing the object\n * @deprecated\n */\n turnTowardObject(obj: gdjs.RuntimeObject | null, scene: gdjs.RuntimeScene) {\n if (obj === null) {\n return;\n }\n this.rotateTowardPosition(\n obj.getDrawableX() + obj.getCenterX(),\n obj.getDrawableY() + obj.getCenterY(),\n 0,\n scene\n );\n }\n }\n gdjs.registerObject(\n 'Sprite',\n //Notify gdjs of the object existence.\n gdjs.SpriteRuntimeObject\n );\n\n //Others initialization and internal state management :\n SpriteRuntimeObject.supportsReinitialization = true;\n}\n"],
|
|
5
|
+
"mappings": "AAKA,GAAU,MA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AU,SACf,KAAK,sBASP,cAAsB,CACpB,MAAQ,MAAK,IAAI,KAAK,SAAW,KAAK,IAAI,KAAK,UAAY,EAQ7D,UAAkB,CAChB,KAAM,GAAS,KAAK,IAAI,KAAK,SACvB,EAAS,KAAK,IAAI,KAAK,SAC7B,MAAO,KAAW,EAAS,EAAS,KAAK,KAAK,EAAS,GAQzD,WAAmB,CACjB,MAAO,MAAK,IAAI,KAAK,SAQvB,WAAmB,CACjB,MAAO,MAAK,IAAI,KAAK,SASvB,iBAAiB,EAAgC,EAA0B,CACzE,AAAI,IAAQ,MAGZ,KAAK,qBACH,EAAI,eAAiB,EAAI,aACzB,EAAI,eAAiB,EAAI,aACzB,EACA,IA54BC,EAAM,sBAg5Bb,EAAK,eACH,SAEA,EAAK,qBAIP,EAAoB,yBAA2B,KAl7BvC",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/Runtime/timer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(i){class t{constructor(e){this._time=0;this._paused=!1;this._name=e}getName(){return this._name}getTime(){return this._time}updateTime(e){this._paused||(this._time+=e)}setTime(e){this._time=e}reset(){this.setTime(0)}setPaused(e){this._paused=e}isPaused(){return this._paused}}i.Timer=t})(gdjs||(gdjs={}));
|
|
1
|
+
var gdjs;(function(i){class t{constructor(e){this._time=0;this._paused=!1;this._name=e}getName(){return this._name}getTime(){return this._time}updateTime(e){this._paused||(this._time+=e)}setTime(e){this._time=e}reset(){this.setTime(0)}setPaused(e){this._paused=e}isPaused(){return this._paused}getNetworkSyncData(){return{time:this._time,paused:this._paused}}updateFromNetworkSyncData(e){this._time=e.time,this._paused=e.paused}}i.Timer=t})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=timer.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../GDevelop/GDJS/Runtime/timer.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n /**\n * Represents a timer, which must be updated manually with {@link gdjs.Timer.updateTime}.\n */\n export class Timer {\n _name: string;\n _time: float = 0;\n _paused: boolean = false;\n\n /**\n * @param name The name of the timer.\n */\n constructor(name: string) {\n this._name = name;\n }\n\n /**\n * Get the name of the timer\n * @return The name of the timer\n */\n getName(): string {\n return this._name;\n }\n\n /**\n * Get the time of the timer, in milliseconds.\n * @return The time of the timer, in milliseconds.\n */\n getTime(): float {\n return this._time;\n }\n\n /**\n * Notify the timer that some time has passed.\n * @param time The elapsed time, in milliseconds.\n */\n updateTime(time: float): void {\n if (!this._paused) {\n this._time += time;\n }\n }\n\n /**\n * Change the time.\n * @param time The new time, in milliseconds.\n */\n setTime(time: float): void {\n this._time = time;\n }\n\n /**\n * Reset the time to zero.\n */\n reset(): void {\n this.setTime(0);\n }\n\n /**\n * Set if the timer is paused.\n * @param enable true to pause the timer, false otherwise.\n */\n setPaused(enable: boolean): void {\n this._paused = enable;\n }\n\n /**\n * Check if the timer is paused.\n */\n isPaused(): boolean {\n return this._paused;\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAIS,OAAY,CAQjB,YAAY,EAAc,CAN1B,WAAe,EACf,aAAmB,GAMjB,KAAK,MAAQ,EAOf,SAAkB,CAChB,MAAO,MAAK,MAOd,SAAiB,CACf,MAAO,MAAK,MAOd,WAAW,EAAmB,CAC5B,AAAK,KAAK,SACR,MAAK,OAAS,GAQlB,QAAQ,EAAmB,CACzB,KAAK,MAAQ,EAMf,OAAc,CACZ,KAAK,QAAQ,GAOf,UAAU,EAAuB,CAC/B,KAAK,QAAU,EAMjB,UAAoB,CAClB,MAAO,MAAK,
|
|
4
|
+
"sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n /**\n * Represents a timer, which must be updated manually with {@link gdjs.Timer.updateTime}.\n */\n export class Timer {\n _name: string;\n _time: float = 0;\n _paused: boolean = false;\n\n /**\n * @param name The name of the timer.\n */\n constructor(name: string) {\n this._name = name;\n }\n\n /**\n * Get the name of the timer\n * @return The name of the timer\n */\n getName(): string {\n return this._name;\n }\n\n /**\n * Get the time of the timer, in milliseconds.\n * @return The time of the timer, in milliseconds.\n */\n getTime(): float {\n return this._time;\n }\n\n /**\n * Notify the timer that some time has passed.\n * @param time The elapsed time, in milliseconds.\n */\n updateTime(time: float): void {\n if (!this._paused) {\n this._time += time;\n }\n }\n\n /**\n * Change the time.\n * @param time The new time, in milliseconds.\n */\n setTime(time: float): void {\n this._time = time;\n }\n\n /**\n * Reset the time to zero.\n */\n reset(): void {\n this.setTime(0);\n }\n\n /**\n * Set if the timer is paused.\n * @param enable true to pause the timer, false otherwise.\n */\n setPaused(enable: boolean): void {\n this._paused = enable;\n }\n\n /**\n * Check if the timer is paused.\n */\n isPaused(): boolean {\n return this._paused;\n }\n\n getNetworkSyncData(): TimerNetworkSyncData {\n return {\n time: this._time,\n paused: this._paused,\n };\n }\n\n updateFromNetworkSyncData(syncData: TimerNetworkSyncData) {\n this._time = syncData.time;\n this._paused = syncData.paused;\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAIS,OAAY,CAQjB,YAAY,EAAc,CAN1B,WAAe,EACf,aAAmB,GAMjB,KAAK,MAAQ,EAOf,SAAkB,CAChB,MAAO,MAAK,MAOd,SAAiB,CACf,MAAO,MAAK,MAOd,WAAW,EAAmB,CAC5B,AAAK,KAAK,SACR,MAAK,OAAS,GAQlB,QAAQ,EAAmB,CACzB,KAAK,MAAQ,EAMf,OAAc,CACZ,KAAK,QAAQ,GAOf,UAAU,EAAuB,CAC/B,KAAK,QAAU,EAMjB,UAAoB,CAClB,MAAO,MAAK,QAGd,oBAA2C,CACzC,MAAO,CACL,KAAM,KAAK,MACX,OAAQ,KAAK,SAIjB,0BAA0B,EAAgC,CACxD,KAAK,MAAQ,EAAS,KACtB,KAAK,QAAU,EAAS,QA7ErB,EAAM,UAJL",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,6 +20,11 @@ declare interface ProjectData {
|
|
|
20
20
|
eventsFunctionsExtensions: EventsFunctionsExtensionData[];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
declare interface EventsFunctionsVariablesData {
|
|
24
|
+
name: string;
|
|
25
|
+
variables: RootVariableData[];
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
/** Object containing initial properties for all objects extending {@link gdjs.RuntimeObject}. */
|
|
24
29
|
declare type ObjectData = {
|
|
25
30
|
/** The name of the object. During the game, objects can be queried by their name (see {@link gdjs.RuntimeScene.prototype.getObjects} for example). */
|
|
@@ -34,6 +39,66 @@ declare type ObjectData = {
|
|
|
34
39
|
effects: Array<EffectData>;
|
|
35
40
|
};
|
|
36
41
|
|
|
42
|
+
declare type GetNetworkSyncDataOptions = { playerNumber?: number };
|
|
43
|
+
|
|
44
|
+
/** Object containing basic properties for all objects synchronizing over the network. */
|
|
45
|
+
declare type BasicObjectNetworkSyncData = {
|
|
46
|
+
/** The position of the instance on the X axis. */
|
|
47
|
+
x: number;
|
|
48
|
+
/** The position of the instance on the Y axis. */
|
|
49
|
+
y: number;
|
|
50
|
+
/** The position of the instance on the Z axis. Defined only for 3D games */
|
|
51
|
+
z?: number;
|
|
52
|
+
/** Z order of the instance */
|
|
53
|
+
zo: number;
|
|
54
|
+
/** The angle of the instance. */
|
|
55
|
+
a: number;
|
|
56
|
+
/** If the instance is hidden */
|
|
57
|
+
hid: boolean;
|
|
58
|
+
/** The layer where the instance lives */
|
|
59
|
+
lay: string;
|
|
60
|
+
/** All the instant forces */
|
|
61
|
+
if: Array<ForceNetworkSyncData>;
|
|
62
|
+
/** Permanent force on X */
|
|
63
|
+
pfx: number;
|
|
64
|
+
/** Permanent force on Y */
|
|
65
|
+
pfy: number;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Object containing properties, behaviors, variables, effects and timers
|
|
70
|
+
* for all objects synchronizing over the network.
|
|
71
|
+
**/
|
|
72
|
+
declare interface ObjectNetworkSyncData extends BasicObjectNetworkSyncData {
|
|
73
|
+
/** The behaviors of the object */
|
|
74
|
+
beh: {
|
|
75
|
+
[behaviorName: string]: any;
|
|
76
|
+
};
|
|
77
|
+
/** The variables of the object */
|
|
78
|
+
var?: VariableNetworkSyncData[];
|
|
79
|
+
/** The effects of the object */
|
|
80
|
+
eff?: {
|
|
81
|
+
[effectName: string]: EffectNetworkSyncData;
|
|
82
|
+
};
|
|
83
|
+
/** The timers of the object */
|
|
84
|
+
tim?: {
|
|
85
|
+
[timerName: string]: TimerNetworkSyncData;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare type ForceNetworkSyncData = {
|
|
90
|
+
x: float;
|
|
91
|
+
y: float;
|
|
92
|
+
a: float;
|
|
93
|
+
l: float;
|
|
94
|
+
m: number;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
declare type TimerNetworkSyncData = {
|
|
98
|
+
time: float;
|
|
99
|
+
paused: boolean;
|
|
100
|
+
};
|
|
101
|
+
|
|
37
102
|
declare type VariableType =
|
|
38
103
|
| 'string'
|
|
39
104
|
| 'number'
|
|
@@ -56,6 +121,14 @@ declare type VariableData = Readonly<{
|
|
|
56
121
|
/** A variable child of a container. Those always have a name. */
|
|
57
122
|
declare type RootVariableData = Omit<VariableData, 'name'> & { name: string };
|
|
58
123
|
|
|
124
|
+
declare type VariableNetworkSyncData = {
|
|
125
|
+
name: string;
|
|
126
|
+
value: string | float | boolean;
|
|
127
|
+
children?: VariableNetworkSyncData[];
|
|
128
|
+
type: VariableType;
|
|
129
|
+
owner: number;
|
|
130
|
+
};
|
|
131
|
+
|
|
59
132
|
/** Properties to set up a behavior. */
|
|
60
133
|
declare type BehaviorData = {
|
|
61
134
|
/** The name of the behavior (for getting from an object (object.getBehavior) for example) */
|
|
@@ -64,6 +137,11 @@ declare type BehaviorData = {
|
|
|
64
137
|
type: string;
|
|
65
138
|
};
|
|
66
139
|
|
|
140
|
+
declare type BehaviorNetworkSyncData = {
|
|
141
|
+
act: boolean;
|
|
142
|
+
props: any;
|
|
143
|
+
};
|
|
144
|
+
|
|
67
145
|
declare interface GdVersionData {
|
|
68
146
|
build: number;
|
|
69
147
|
major: number;
|
|
@@ -87,9 +165,39 @@ declare interface LayoutData {
|
|
|
87
165
|
usedResources: ResourceReference[];
|
|
88
166
|
}
|
|
89
167
|
|
|
168
|
+
declare interface LayoutNetworkSyncData {
|
|
169
|
+
id: string;
|
|
170
|
+
var?: VariableNetworkSyncData[];
|
|
171
|
+
extVar?: {
|
|
172
|
+
[extensionName: string]: VariableNetworkSyncData[];
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare interface SceneStackSceneNetworkSyncData {
|
|
177
|
+
name: string;
|
|
178
|
+
networkId: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare type SceneStackNetworkSyncData = SceneStackSceneNetworkSyncData[];
|
|
182
|
+
|
|
183
|
+
declare interface GameNetworkSyncData {
|
|
184
|
+
var?: VariableNetworkSyncData[];
|
|
185
|
+
ss?: SceneStackNetworkSyncData;
|
|
186
|
+
extVar?: {
|
|
187
|
+
[extensionName: string]: VariableNetworkSyncData[];
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
90
191
|
declare interface EventsFunctionsExtensionData {
|
|
91
192
|
name: string;
|
|
92
193
|
eventsBasedObjects: EventsBasedObjectData[];
|
|
194
|
+
globalVariables: RootVariableData[];
|
|
195
|
+
sceneVariables: RootVariableData[];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare interface SceneAndExtensionsData {
|
|
199
|
+
sceneData: LayoutData;
|
|
200
|
+
usedExtensionsWithVariablesData: EventsFunctionsExtensionData[];
|
|
93
201
|
}
|
|
94
202
|
|
|
95
203
|
declare interface EventsBasedObjectData {
|
|
@@ -185,6 +293,13 @@ declare interface EffectData {
|
|
|
185
293
|
};
|
|
186
294
|
}
|
|
187
295
|
|
|
296
|
+
declare interface EffectNetworkSyncData {
|
|
297
|
+
ena: boolean;
|
|
298
|
+
fc: {
|
|
299
|
+
[name: string]: any;
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
188
303
|
declare interface ProjectPropertiesData {
|
|
189
304
|
adaptGameResolutionAtRuntime: boolean;
|
|
190
305
|
folderProject: boolean;
|
package/dist/Runtime/variable.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(i){const n=new i.Logger("Variables");class l{constructor(e){this._type="number";this._value=0;this._str="0";this._bool=!1;this._children={};this._childrenArray=[];this._undefinedInContainer=!1;this.reinitialize(e)}reinitialize(e){if(this._type="number",this._value=0,this._str="0",this._bool=!1,this._children={},this._childrenArray=[],this._undefinedInContainer=!1,e!==void 0){if(this._type=e.type||"number",this._type==="number")this._value=parseFloat(e.value||"0"),this._value!==this._value&&(this._value=0);else if(this._type==="string")this._str=""+e.value||"0";else if(this._type==="boolean")this._bool=!!e.value;else if(this._type==="structure"){if(e.children!==void 0)for(var t=0,r=e.children.length;t<r;++t){var s=e.children[t];s.name!==void 0&&(this._children[s.name]=new i.Variable(s))}}else if(this._type==="array"&&e.children)for(const a of e.children)this._childrenArray.push(new i.Variable(a))}}static isPrimitive(e){return e==="string"||e==="number"||e==="boolean"}static copy(e,t,r){if(r||t.clearChildren(),t.castTo(e.getType()),e.isPrimitive())t.setValue(e.getValue());else if(e.getType()==="structure"){const s=e.getAllChildren();for(const a in s)s.hasOwnProperty(a)&&t.addChild(a,s[a].clone())}else if(e.getType()==="array")for(const s of e.getAllChildrenArray())t.pushVariableCopy(s);return t}fromJSObject(e){if(e===null)this.setString("null");else if(typeof e=="number")Number.isNaN(e)?(n.warn("Variables cannot be set to NaN, setting it to 0."),this.setNumber(0)):this.setNumber(e);else if(typeof e=="string")this.setString(e);else if(typeof e!="undefined")if(typeof e=="boolean")this.setBoolean(e);else if(Array.isArray(e)){this.castTo("array"),this.clearChildren();for(const r in e)this.getChild(r).fromJSObject(e[r])}else if(typeof e=="object"){this.castTo("structure"),this.clearChildren();for(var t in e)e.hasOwnProperty(t)&&this.getChild(t).fromJSObject(e[t])}else typeof e=="symbol"?this.setString(e.toString()):typeof e=="bigint"?(e>Number.MAX_SAFE_INTEGER&&n.warn("Error while converting JS variable to GDevelop variable: Integers bigger than "+Number.MAX_SAFE_INTEGER+" aren't supported by GDevelop variables, it will be reduced to that size."),variable.setNumber(parseInt(e,10))):typeof e=="function"?n.error("Error while converting JS variable to GDevelop variable: Impossible to set variable value to a function."):n.error("Error while converting JS variable to GDevelop variable: Cannot identify type of object "+e);return this}fromJSON(e){try{var t=JSON.parse(e)}catch(r){return n.error("Unable to parse JSON: "+e+r),this}return this.fromJSObject(t),this}toJSObject(){switch(this._type){case"string":return this.getAsString();case"number":return this.getAsNumber();case"boolean":return this.getAsBoolean();case"structure":const e={};for(const r in this._children)e[r]=this._children[r].toJSObject();return e;case"array":const t=[];for(const r of this._childrenArray)t.push(r===void 0?void 0:r.toJSObject());return t}}isPrimitive(){return i.Variable.isPrimitive(this._type)}clone(){return i.Variable.copy(this,new i.Variable)}setUndefinedInContainer(){this._undefinedInContainer=!0}isUndefinedInContainer(){return this._undefinedInContainer}castTo(e){if(e==="string")this.setString(this.getAsString());else if(e==="number")this.setNumber(this.getAsNumber());else if(e==="boolean")this.setBoolean(this.getAsBoolean());else if(e==="structure"){if(this._type==="structure")return;this._children=this.getAllChildren(),this._type="structure"}else if(e==="array"){if(this._type==="array")return;this._childrenArray=this.getAllChildrenArray(),this._type="array"}}getChild(e){return this._type==="array"?this.getChildAt(Number.isInteger(e)?e:parseInt(e,10)||0):(this._type!=="structure"&&this.castTo("structure"),this.getChildNamed(""+e))}getChildNamed(e){const t=this._children[e];return t??(this._children[e]=new i.Variable)}addChild(e,t){return this._type!=="structure"&&this.castTo("structure"),this._children[e]=t,this}hasChild(e){return this._type==="structure"&&this._children.hasOwnProperty(e)}removeChild(e){this._type==="structure"&&delete this._children[e]}clearChildren(){this._children={},this._childrenArray=[]}replaceChildren(e){this._type="structure",this._children=e}replaceChildrenArray(e){this._type="array",this._childrenArray=e}getAsNumber(){if(this._type!=="number"){let e=0;return this._type==="string"?e=parseFloat(this._str):this._type==="boolean"&&(e=this._bool?1:0),e===e?e:0}return this._value}setNumber(e){this._type="number",e=parseFloat(e),this._value=e===e?e:0}getAsString(){return this._type!=="string"?this._type==="number"?this._value.toString():this._type==="boolean"?this._bool?"true":"false":this._type==="structure"?"[Structure]":this._type==="array"?"[Array]":"":this._str}setString(e){this._type="string",this._str=""+e}getAsNumberOrString(){return this._type==="number"?this._value:this.getAsString()}getAsBoolean(){return this._type!=="boolean"?this._type==="number"?this._value!==0:this._type==="string"?this._str!=="0"&&this._str!==""&&this._str!=="false":!0:this._bool}setBoolean(e){this._type="boolean",this._bool=!!e}setValue(e){this._type==="string"?this.setString(e):this._type==="number"?this.setNumber(e):this._type==="boolean"&&this.setBoolean(e)}getValue(){return this._type==="number"?this.getAsNumber():this._type==="boolean"?this.getAsBoolean():this.getAsString()}isStructure(){return this._type==="structure"}isNumber(){return this._type==="number"}getType(){return this._type}getAllChildren(){return this._type==="structure"?this._children:this._type==="array"?Object.assign({},this._childrenArray):{}}getAllChildrenArray(){return this._type==="structure"?Object.values(this._children):this._type==="array"?this._childrenArray:[]}getChildrenCount(){return this._type==="structure"?Object.keys(this._children).length:this._type==="array"?this._childrenArray.length:0}add(e){this.setNumber(this.getAsNumber()+e)}sub(e){this.setNumber(this.getAsNumber()-e)}mul(e){this.setNumber(this.getAsNumber()*e)}div(e){this.setNumber(this.getAsNumber()/e)}concatenateString(e){this.setString(this.getAsString()+e)}concatenate(e){this.setString(this.getAsString()+e)}getChildAt(e){return this._type!=="array"&&this.castTo("array"),(this._childrenArray[e]===void 0||this._childrenArray[e]===null)&&(this._childrenArray[e]=new i.Variable),this._childrenArray[e]}removeAtIndex(e){this._type==="array"&&this._childrenArray.splice(e,1)}pushVariableCopy(e){this._type!=="array"&&this.castTo("array"),this._childrenArray.push(e.clone())}pushValue(e){this._type!=="array"&&this.castTo("array"),this._childrenArray.push(new i.Variable({type:typeof e,value:e}))}}i.Variable=l})(gdjs||(gdjs={}));
|
|
1
|
+
var gdjs;(function(i){const n=new i.Logger("Variables");class l{constructor(e){this._type="number";this._value=0;this._str="0";this._bool=!1;this._children={};this._childrenArray=[];this._undefinedInContainer=!1;this._playerNumber=0;this.reinitialize(e)}reinitialize(e){if(this._type="number",this._value=0,this._str="0",this._bool=!1,this._children={},this._childrenArray=[],this._undefinedInContainer=!1,e!==void 0){if(this._type=e.type||"number",this._type==="number")this._value=parseFloat(e.value||"0"),this._value!==this._value&&(this._value=0);else if(this._type==="string")this._str=""+e.value||"0";else if(this._type==="boolean")this._bool=!!e.value;else if(this._type==="structure"){if(e.children!==void 0)for(var t=0,r=e.children.length;t<r;++t){var s=e.children[t];s.name!==void 0&&(this._children[s.name]=new i.Variable(s))}}else if(this._type==="array"&&e.children)for(const a of e.children)this._childrenArray.push(new i.Variable(a))}}static isPrimitive(e){return e==="string"||e==="number"||e==="boolean"}static copy(e,t,r){if(r||t.clearChildren(),t.castTo(e.getType()),e.isPrimitive())t.setValue(e.getValue());else if(e.getType()==="structure"){const s=e.getAllChildren();for(const a in s)s.hasOwnProperty(a)&&t.addChild(a,s[a].clone())}else if(e.getType()==="array")for(const s of e.getAllChildrenArray())t.pushVariableCopy(s);return t}fromJSObject(e){if(e===null)this.setString("null");else if(typeof e=="number")Number.isNaN(e)?(n.warn("Variables cannot be set to NaN, setting it to 0."),this.setNumber(0)):this.setNumber(e);else if(typeof e=="string")this.setString(e);else if(typeof e!="undefined")if(typeof e=="boolean")this.setBoolean(e);else if(Array.isArray(e)){this.castTo("array"),this.clearChildren();for(const r in e)this.getChild(r).fromJSObject(e[r])}else if(typeof e=="object"){this.castTo("structure"),this.clearChildren();for(var t in e)e.hasOwnProperty(t)&&this.getChild(t).fromJSObject(e[t])}else typeof e=="symbol"?this.setString(e.toString()):typeof e=="bigint"?(e>Number.MAX_SAFE_INTEGER&&n.warn("Error while converting JS variable to GDevelop variable: Integers bigger than "+Number.MAX_SAFE_INTEGER+" aren't supported by GDevelop variables, it will be reduced to that size."),variable.setNumber(parseInt(e,10))):typeof e=="function"?n.error("Error while converting JS variable to GDevelop variable: Impossible to set variable value to a function."):n.error("Error while converting JS variable to GDevelop variable: Cannot identify type of object "+e);return this}fromJSON(e){try{var t=JSON.parse(e)}catch(r){return n.error("Unable to parse JSON: "+e+r),this}return this.fromJSObject(t),this}toJSObject(){switch(this._type){case"string":return this.getAsString();case"number":return this.getAsNumber();case"boolean":return this.getAsBoolean();case"structure":const e={};for(const r in this._children)e[r]=this._children[r].toJSObject();return e;case"array":const t=[];for(const r of this._childrenArray)t.push(r===void 0?void 0:r.toJSObject());return t}}isPrimitive(){return i.Variable.isPrimitive(this._type)}clone(){return i.Variable.copy(this,new i.Variable)}setUndefinedInContainer(){this._undefinedInContainer=!0}isUndefinedInContainer(){return this._undefinedInContainer}castTo(e){if(e==="string")this.setString(this.getAsString());else if(e==="number")this.setNumber(this.getAsNumber());else if(e==="boolean")this.setBoolean(this.getAsBoolean());else if(e==="structure"){if(this._type==="structure")return;this._children=this.getAllChildren(),this._type="structure"}else if(e==="array"){if(this._type==="array")return;this._childrenArray=this.getAllChildrenArray(),this._type="array"}}getChild(e){return this._type==="array"?this.getChildAt(Number.isInteger(e)?e:parseInt(e,10)||0):(this._type!=="structure"&&this.castTo("structure"),this.getChildNamed(""+e))}getChildNamed(e){const t=this._children[e];return t??(this._children[e]=new i.Variable)}addChild(e,t){return this._type!=="structure"&&this.castTo("structure"),this._children[e]=t,this}hasChild(e){return this._type==="structure"&&this._children.hasOwnProperty(e)}removeChild(e){this._type==="structure"&&delete this._children[e]}clearChildren(){this._children={},this._childrenArray=[]}replaceChildren(e){this._type="structure",this._children=e}replaceChildrenArray(e){this._type="array",this._childrenArray=e}getAsNumber(){if(this._type!=="number"){let e=0;return this._type==="string"?e=parseFloat(this._str):this._type==="boolean"&&(e=this._bool?1:0),e===e?e:0}return this._value}setNumber(e){this._type="number",e=parseFloat(e),this._value=e===e?e:0}getAsString(){return this._type!=="string"?this._type==="number"?this._value.toString():this._type==="boolean"?this._bool?"true":"false":this._type==="structure"?"[Structure]":this._type==="array"?"[Array]":"":this._str}setString(e){this._type="string",this._str=""+e}getAsNumberOrString(){return this._type==="number"?this._value:this.getAsString()}getAsBoolean(){return this._type!=="boolean"?this._type==="number"?this._value!==0:this._type==="string"?this._str!=="0"&&this._str!==""&&this._str!=="false":!0:this._bool}setBoolean(e){this._type="boolean",this._bool=!!e}toggle(){this.setBoolean(!this.getAsBoolean())}setValue(e){this._type==="string"?this.setString(e):this._type==="number"?this.setNumber(e):this._type==="boolean"&&this.setBoolean(e)}getValue(){return this._type==="number"?this.getAsNumber():this._type==="boolean"?this.getAsBoolean():this.getAsString()}isStructure(){return this._type==="structure"}isNumber(){return this._type==="number"}getType(){return this._type}getAllChildren(){return this._type==="structure"?this._children:this._type==="array"?Object.assign({},this._childrenArray):{}}getAllChildrenArray(){return this._type==="structure"?Object.values(this._children):this._type==="array"?this._childrenArray:[]}getChildrenCount(){return this._type==="structure"?Object.keys(this._children).length:this._type==="array"?this._childrenArray.length:0}add(e){this.setNumber(this.getAsNumber()+e)}sub(e){this.setNumber(this.getAsNumber()-e)}mul(e){this.setNumber(this.getAsNumber()*e)}div(e){this.setNumber(this.getAsNumber()/e)}concatenateString(e){this.setString(this.getAsString()+e)}concatenate(e){this.setString(this.getAsString()+e)}getChildAt(e){return this._type!=="array"&&this.castTo("array"),(this._childrenArray[e]===void 0||this._childrenArray[e]===null)&&(this._childrenArray[e]=new i.Variable),this._childrenArray[e]}removeAtIndex(e){this._type==="array"&&this._childrenArray.splice(e,1)}pushVariableCopy(e){this._type!=="array"&&this.castTo("array"),this._childrenArray.push(e.clone())}_pushVariable(e){this._type!=="array"&&this.castTo("array"),this._childrenArray.push(e)}pushValue(e){this._type!=="array"&&this.castTo("array"),this._childrenArray.push(new i.Variable({type:typeof e,value:e}))}getPlayerOwnership(){return this._playerNumber}setPlayerOwnership(e){this._playerNumber=e}disableSynchronization(){this._playerNumber=null}}i.Variable=l})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=variable.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../GDevelop/GDJS/Runtime/variable.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n const logger = new gdjs.Logger('Variables');\n\n /**\n * Children of a structure.\n */\n type Children = Record<string, gdjs.Variable>;\n\n /**\n * A Variable is an object storing a value (number or a string) or children variables.\n */\n export class Variable {\n // TODO: convert this to an integer to speed up the type checks at runtime.\n _type: VariableType = 'number';\n _value: float = 0;\n _str: string = '0';\n _bool: boolean = false;\n _children: Children = {};\n _childrenArray: gdjs.Variable[] = [];\n _undefinedInContainer: boolean = false;\n\n /**\n * @param [varData] The optional initial content of the variable.\n */\n constructor(varData?: VariableData) {\n this.reinitialize(varData);\n }\n\n reinitialize(varData?: VariableData | undefined) {\n this._type = 'number';\n this._value = 0;\n this._str = '0';\n this._bool = false;\n this._children = {};\n this._childrenArray = [];\n this._undefinedInContainer = false;\n\n if (varData !== undefined) {\n this._type = varData.type || 'number';\n if (this._type === 'number') {\n this._value = parseFloat((varData.value as string) || '0');\n // Protect against NaN.\n if (this._value !== this._value) this._value = 0;\n } else if (this._type === 'string') {\n this._str = '' + varData.value || '0';\n } else if (this._type === 'boolean') {\n this._bool = !!varData.value;\n } else if (this._type === 'structure') {\n if (varData.children !== undefined) {\n for (var i = 0, len = varData.children.length; i < len; ++i) {\n var childData = varData.children[i];\n if (childData.name === undefined) continue;\n this._children[childData.name] = new gdjs.Variable(childData);\n }\n }\n } else if (this._type === 'array' && varData.children) {\n for (const childData of varData.children)\n this._childrenArray.push(new gdjs.Variable(childData));\n }\n }\n }\n\n /**\n * Return true if the variable type is a primitive type.\n */\n static isPrimitive(\n type: VariableType\n ): type is 'string' | 'number' | 'boolean' {\n return type === 'string' || type === 'number' || type === 'boolean';\n }\n\n /**\n * Deeply copies a variable into another.\n * @param source The source variable.\n * @param target The target variable.\n * @param merge Should the target be merged with the source, or be an exact copy?\n * @returns The target variable.\n */\n static copy(\n source: gdjs.Variable,\n target: gdjs.Variable,\n merge?: boolean\n ): gdjs.Variable {\n if (!merge) target.clearChildren();\n target.castTo(source.getType());\n if (source.isPrimitive()) {\n target.setValue(source.getValue());\n } else if (source.getType() === 'structure') {\n const children = source.getAllChildren();\n for (const p in children) {\n if (children.hasOwnProperty(p))\n target.addChild(p, children[p].clone());\n }\n } else if (source.getType() === 'array') {\n for (const p of source.getAllChildrenArray())\n target.pushVariableCopy(p);\n }\n return target;\n }\n\n /**\n * Converts a JavaScript object into a value compatible\n * with GDevelop variables and store it inside this variable.\n * @param obj - The value to convert.\n */\n fromJSObject(obj: any): this {\n if (obj === null) {\n this.setString('null');\n } else if (typeof obj === 'number') {\n if (Number.isNaN(obj)) {\n logger.warn('Variables cannot be set to NaN, setting it to 0.');\n this.setNumber(0);\n } else {\n this.setNumber(obj);\n }\n } else if (typeof obj === 'string') {\n this.setString(obj);\n } else if (typeof obj === 'undefined') {\n // Do not modify the variable, as there is no value to set it to.\n } else if (typeof obj === 'boolean') {\n this.setBoolean(obj);\n } else if (Array.isArray(obj)) {\n this.castTo('array');\n this.clearChildren();\n for (const i in obj) this.getChild(i).fromJSObject(obj[i]);\n } else if (typeof obj === 'object') {\n this.castTo('structure');\n this.clearChildren();\n for (var p in obj)\n if (obj.hasOwnProperty(p)) this.getChild(p).fromJSObject(obj[p]);\n } else if (typeof obj === 'symbol') {\n this.setString(obj.toString());\n } else if (typeof obj === 'bigint') {\n if (obj > Number.MAX_SAFE_INTEGER)\n logger.warn(\n 'Error while converting JS variable to GDevelop variable: Integers bigger than ' +\n Number.MAX_SAFE_INTEGER +\n \" aren't supported by GDevelop variables, it will be reduced to that size.\"\n );\n // @ts-ignore\n variable.setNumber(parseInt(obj, 10));\n } else if (typeof obj === 'function') {\n logger.error(\n 'Error while converting JS variable to GDevelop variable: Impossible to set variable value to a function.'\n );\n } else {\n logger.error(\n 'Error while converting JS variable to GDevelop variable: Cannot identify type of object ' +\n obj\n );\n }\n return this;\n }\n\n /**\n * Unserialize a JSON string into this variable.\n *\n * This just logs an error if the JSON is invalid.\n *\n * @param json - A JSON string.\n */\n fromJSON(json: string): this {\n try {\n var obj = JSON.parse(json);\n } catch (e) {\n logger.error('Unable to parse JSON: ' + json + e);\n return this;\n }\n this.fromJSObject(obj);\n return this;\n }\n\n /**\n * Converts this variable into an equivalent JavaScript object.\n * @returns A JavaScript object equivalent to the variable.\n */\n toJSObject(): any {\n switch (this._type) {\n case 'string':\n return this.getAsString();\n case 'number':\n return this.getAsNumber();\n case 'boolean':\n return this.getAsBoolean();\n case 'structure':\n const obj = {};\n for (const name in this._children)\n obj[name] = this._children[name].toJSObject();\n return obj;\n case 'array':\n const arr: any[] = [];\n for (const item of this._childrenArray) {\n // item can be undefined if there are empty elements in the array.\n // A variable can have empty items in its children array if one inserts\n // a variable at an index greater than highest index. All the array elements\n // in the gap will be empty elements.\n arr.push(item === undefined ? undefined : item.toJSObject());\n }\n return arr;\n }\n }\n\n /**\n * Return true if the type of the variable is a primitive type.\n */\n isPrimitive() {\n return gdjs.Variable.isPrimitive(this._type);\n }\n\n /**\n * Returns a deep copy of this variable.\n */\n clone(): gdjs.Variable {\n return gdjs.Variable.copy(this, new gdjs.Variable());\n }\n\n /**\n * Used (usually by gdjs.VariablesContainer) to set that the variable must be\n * considered as not existing in the container.\n */\n setUndefinedInContainer() {\n this._undefinedInContainer = true;\n }\n\n /**\n * Check if the variable must be considered as not existing in its container\n * (usually a gdjs.VariablesContainer).\n * @return true if the container must consider that the variable does not exist.\n */\n isUndefinedInContainer(): boolean {\n return this._undefinedInContainer;\n }\n\n /**\n * Converts the variable into another type.\n * @param newType The new type of the variable\n */\n castTo(newType: VariableType) {\n if (newType === 'string') this.setString(this.getAsString());\n else if (newType === 'number') this.setNumber(this.getAsNumber());\n else if (newType === 'boolean') this.setBoolean(this.getAsBoolean());\n else if (newType === 'structure') {\n if (this._type === 'structure') return;\n this._children = this.getAllChildren();\n this._type = 'structure';\n } else if (newType === 'array') {\n if (this._type === 'array') return;\n this._childrenArray = this.getAllChildrenArray();\n this._type = 'array';\n }\n }\n\n /**\n * Get the child with the specified name or at the specified index.\n *\n * If the variable is an array, prefer `getChildAt`.\n * If the variable is a structure, prefer `getChildNamed`.\n *\n * If the variable has not the specified child, an empty variable with the specified name\n * (or index) is added as child.\n *\n * @returns The child variable\n */\n getChild(childName: string | number): gdjs.Variable {\n if (this._type === 'array')\n return this.getChildAt(\n // @ts-ignore\n Number.isInteger(childName) ? childName : parseInt(childName, 10) || 0\n );\n else {\n if (this._type !== 'structure') this.castTo('structure');\n return this.getChildNamed('' + childName);\n }\n }\n\n /**\n * Get the child with the specified name.\n *\n * If the variable has not the specified child, an empty variable with the specified name\n * is added as child.\n *\n * @returns The child variable\n */\n getChildNamed(childName: string): gdjs.Variable {\n const child = this._children[childName];\n if (child === undefined || child === null)\n return (this._children[childName] = new gdjs.Variable());\n\n return child;\n }\n\n /**\n * Add a child variable with the specified name.\n *\n * If there is an existing child variable with this name, it is erased.\n * @param childName The name of the variable to add\n * @param childVariable The variable to add as a child\n * @returns The variable (for chaining calls)\n */\n addChild(childName: string, childVariable: gdjs.Variable): this {\n if (this._type !== 'structure') this.castTo('structure');\n\n this._children[childName] = childVariable;\n return this;\n }\n\n /**\n * Return the child in a variable.\n *\n * Check if the variable has the specified children\n * @return true if variable has the children with the specified name\n */\n hasChild(childName: string): boolean {\n return (\n this._type === 'structure' && this._children.hasOwnProperty(childName)\n );\n }\n\n /**\n * Remove the child with the specified name.\n *\n * If the variable has not the specified child, nothing is done.\n * @param childName The name of the child to be removed\n */\n removeChild(childName: string) {\n if (this._type !== 'structure') return;\n delete this._children[childName];\n }\n\n /**\n * Remove all the children.\n */\n clearChildren() {\n this._children = {};\n this._childrenArray = [];\n }\n\n /**\n * Replaces all the children with a new map of children.\n * @param newChildren The map of new children.\n */\n replaceChildren(newChildren: Children) {\n this._type = 'structure';\n this._children = newChildren;\n }\n\n /**\n * Replaces all the children with a new array of children.\n * @param newChildren The array of new children.\n */\n replaceChildrenArray(newChildren: gdjs.Variable[]) {\n this._type = 'array';\n this._childrenArray = newChildren;\n }\n\n /**\n * Get the value of the variable, considered as a number\n * @return The number stored in the variable\n */\n getAsNumber(): float {\n if (this._type !== 'number') {\n let number = 0;\n if (this._type === 'string') number = parseFloat(this._str);\n else if (this._type === 'boolean') number = this._bool ? 1 : 0;\n\n return number === number ? number : 0; //Ensure NaN is not returned as a value.\n }\n\n return this._value;\n }\n\n /**\n * Change the value of the variable, considered as a number\n * @param newValue The new value to be set\n */\n setNumber(newValue: float) {\n this._type = 'number';\n //@ts-ignore parseFloat does accept numbers.\n newValue = parseFloat(newValue);\n this._value = newValue === newValue ? newValue : 0; // Prevent NaN\n }\n\n /**\n * Get the value of the variable, considered as a string\n * @return The string stored in the variable\n */\n getAsString(): string {\n if (this._type !== 'string') {\n if (this._type === 'number') return this._value.toString();\n else if (this._type === 'boolean') return this._bool ? 'true' : 'false';\n else if (this._type === 'structure') return '[Structure]';\n else if (this._type === 'array') return '[Array]';\n else return '';\n }\n\n return this._str;\n }\n\n /**\n * Change the value of the variable, considered as a string\n * @param newValue The new string to be set\n */\n setString(newValue: string): void {\n this._type = 'string';\n this._str = '' + newValue;\n }\n\n /**\n * Get the value of the variable, as a number if it's one,\n * or as a string (if it's a string or something else)\n *\n * In most cases, prefer calling `getAsNumber` or `getAsString` directly.\n * This is a fallback in case a variable type can't be known statically for sure,\n * like `getValue`.\n *\n * @private\n */\n getAsNumberOrString(): number | string {\n if (this._type === 'number') return this._value;\n return this.getAsString();\n }\n\n /**\n * Get the value of the variable, considered as a boolean\n * @return The boolean value of the variable.\n */\n getAsBoolean(): boolean {\n if (this._type !== 'boolean') {\n if (this._type === 'number') return this._value !== 0;\n else if (this._type === 'string')\n return this._str !== '0' && this._str !== '' && this._str !== 'false';\n else return true;\n }\n\n return this._bool;\n }\n\n /**\n * Change the value of the variable, considered as a boolean\n * @param newValue The new boolean to be set.\n */\n setBoolean(newValue: boolean) {\n this._type = 'boolean';\n this._bool = !!newValue;\n }\n\n /**\n * Sets the primitive value using the setter of the current type.\n * @param newValue The primitive value of the variable.\n */\n setValue(newValue: string | float | boolean) {\n if (this._type === 'string') this.setString(newValue as string);\n else if (this._type === 'number') this.setNumber(newValue as float);\n else if (this._type === 'boolean') this.setBoolean(newValue as boolean);\n }\n\n /**\n * Gets the primitive value using the getter of the current type.\n */\n getValue(): string | float | boolean {\n return this._type === 'number'\n ? this.getAsNumber()\n : this._type === 'boolean'\n ? this.getAsBoolean()\n : this.getAsString();\n }\n\n /**\n * Return true if the variable is a structure.\n * @return true if the variable is a structure.\n * @deprecated Use {@link gdjs.Variable.getType} instead.\n */\n isStructure(): boolean {\n return this._type === 'structure';\n }\n\n /**\n * Return true if the variable is a number.\n * @return true if the variable is a number.\n * @deprecated Use {@link gdjs.Variable.getType} instead.\n */\n isNumber(): boolean {\n return this._type === 'number';\n }\n\n /**\n * Returns the type of the variable.\n */\n getType(): VariableType {\n return this._type;\n }\n\n /**\n * Return the object containing all the children of the variable.\n * @return All the children of the variable\n */\n getAllChildren(): Children {\n return this._type === 'structure'\n ? this._children\n : this._type === 'array'\n ? ((Object.assign({}, this._childrenArray) as unknown) as Children)\n : {};\n }\n\n /**\n * Return an Array containing all the children of the variable.\n */\n getAllChildrenArray(): gdjs.Variable[] {\n return this._type === 'structure'\n ? Object.values(this._children)\n : this._type === 'array'\n ? this._childrenArray\n : [];\n }\n\n /**\n * Return the length of the collection.\n */\n getChildrenCount(): integer {\n return this._type === 'structure'\n ? Object.keys(this._children).length\n : this._type === 'array'\n ? this._childrenArray.length\n : 0;\n }\n\n /**\n * Add the given number to the variable value\n * @param val the number to add\n */\n add(val: float) {\n this.setNumber(this.getAsNumber() + val);\n }\n\n /**\n * Subtract the given number to the variable value\n * @param val the number to subtract\n */\n sub(val: float) {\n this.setNumber(this.getAsNumber() - val);\n }\n\n /**\n * Multiply the variable value by the given number\n * @param val the factor\n */\n mul(val: float) {\n this.setNumber(this.getAsNumber() * val);\n }\n\n /**\n * Divide the variable value by the given number\n * @param val the divisor\n */\n div(val: float) {\n this.setNumber(this.getAsNumber() / val);\n }\n\n /**\n * Concatenate the given string at the end of the variable value\n * @param str the string to append\n */\n concatenateString(str: string) {\n this.setString(this.getAsString() + str);\n }\n\n /**\n * @deprecated\n * @private\n * @alias concatenateString\n */\n concatenate(str: string) {\n this.setString(this.getAsString() + str);\n }\n\n /**\n * Get a variable at a given index of the array.\n */\n getChildAt(index: integer) {\n if (this._type !== 'array') this.castTo('array');\n\n if (\n this._childrenArray[index] === undefined ||\n this._childrenArray[index] === null\n )\n this._childrenArray[index] = new gdjs.Variable();\n return this._childrenArray[index];\n }\n\n /**\n * Removes a variable at a given index of the array.\n */\n removeAtIndex(index: integer) {\n if (this._type === 'array') this._childrenArray.splice(index, 1);\n }\n\n /**\n * Pushes a copy of a variable into the array.\n */\n pushVariableCopy(variable: gdjs.Variable) {\n if (this._type !== 'array') this.castTo('array');\n\n this._childrenArray.push(variable.clone());\n }\n\n /**\n * Pushes a value into the array.\n */\n pushValue(value: string | float | boolean) {\n if (this._type !== 'array') this.castTo('array');\n\n this._childrenArray.push(\n new gdjs.Variable({\n type: typeof value as 'string' | 'number' | 'boolean',\n value,\n })\n );\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,aAUxB,OAAe,
|
|
4
|
+
"sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n const logger = new gdjs.Logger('Variables');\n\n /**\n * Children of a structure.\n */\n type Children = Record<string, gdjs.Variable>;\n\n /**\n * A Variable is an object storing a value (number or a string) or children variables.\n */\n export class Variable {\n // TODO: convert this to an integer to speed up the type checks at runtime.\n _type: VariableType = 'number';\n _value: float = 0;\n _str: string = '0';\n _bool: boolean = false;\n _children: Children = {};\n _childrenArray: gdjs.Variable[] = [];\n _undefinedInContainer: boolean = false;\n\n // When synchronised over the network, this defines which player is the owner of the variable.\n // Default is 0, meaning that the variable is owned by the host.\n // If null, the variable is not synchronised over the network.\n _playerNumber: number | null = 0;\n\n /**\n * @param [varData] The optional initial content of the variable.\n */\n constructor(varData?: VariableData) {\n this.reinitialize(varData);\n }\n\n reinitialize(varData?: VariableData | undefined) {\n this._type = 'number';\n this._value = 0;\n this._str = '0';\n this._bool = false;\n this._children = {};\n this._childrenArray = [];\n this._undefinedInContainer = false;\n\n if (varData !== undefined) {\n this._type = varData.type || 'number';\n if (this._type === 'number') {\n this._value = parseFloat((varData.value as string) || '0');\n // Protect against NaN.\n if (this._value !== this._value) this._value = 0;\n } else if (this._type === 'string') {\n this._str = '' + varData.value || '0';\n } else if (this._type === 'boolean') {\n this._bool = !!varData.value;\n } else if (this._type === 'structure') {\n if (varData.children !== undefined) {\n for (var i = 0, len = varData.children.length; i < len; ++i) {\n var childData = varData.children[i];\n if (childData.name === undefined) continue;\n this._children[childData.name] = new gdjs.Variable(childData);\n }\n }\n } else if (this._type === 'array' && varData.children) {\n for (const childData of varData.children)\n this._childrenArray.push(new gdjs.Variable(childData));\n }\n }\n }\n\n /**\n * Return true if the variable type is a primitive type.\n */\n static isPrimitive(\n type: VariableType\n ): type is 'string' | 'number' | 'boolean' {\n return type === 'string' || type === 'number' || type === 'boolean';\n }\n\n /**\n * Deeply copies a variable into another.\n * @param source The source variable.\n * @param target The target variable.\n * @param merge Should the target be merged with the source, or be an exact copy?\n * @returns The target variable.\n */\n static copy(\n source: gdjs.Variable,\n target: gdjs.Variable,\n merge?: boolean\n ): gdjs.Variable {\n if (!merge) target.clearChildren();\n target.castTo(source.getType());\n if (source.isPrimitive()) {\n target.setValue(source.getValue());\n } else if (source.getType() === 'structure') {\n const children = source.getAllChildren();\n for (const p in children) {\n if (children.hasOwnProperty(p))\n target.addChild(p, children[p].clone());\n }\n } else if (source.getType() === 'array') {\n for (const p of source.getAllChildrenArray())\n target.pushVariableCopy(p);\n }\n return target;\n }\n\n /**\n * Converts a JavaScript object into a value compatible\n * with GDevelop variables and store it inside this variable.\n * @param obj - The value to convert.\n */\n fromJSObject(obj: any): this {\n if (obj === null) {\n this.setString('null');\n } else if (typeof obj === 'number') {\n if (Number.isNaN(obj)) {\n logger.warn('Variables cannot be set to NaN, setting it to 0.');\n this.setNumber(0);\n } else {\n this.setNumber(obj);\n }\n } else if (typeof obj === 'string') {\n this.setString(obj);\n } else if (typeof obj === 'undefined') {\n // Do not modify the variable, as there is no value to set it to.\n } else if (typeof obj === 'boolean') {\n this.setBoolean(obj);\n } else if (Array.isArray(obj)) {\n this.castTo('array');\n this.clearChildren();\n for (const i in obj) this.getChild(i).fromJSObject(obj[i]);\n } else if (typeof obj === 'object') {\n this.castTo('structure');\n this.clearChildren();\n for (var p in obj)\n if (obj.hasOwnProperty(p)) this.getChild(p).fromJSObject(obj[p]);\n } else if (typeof obj === 'symbol') {\n this.setString(obj.toString());\n } else if (typeof obj === 'bigint') {\n if (obj > Number.MAX_SAFE_INTEGER)\n logger.warn(\n 'Error while converting JS variable to GDevelop variable: Integers bigger than ' +\n Number.MAX_SAFE_INTEGER +\n \" aren't supported by GDevelop variables, it will be reduced to that size.\"\n );\n // @ts-ignore\n variable.setNumber(parseInt(obj, 10));\n } else if (typeof obj === 'function') {\n logger.error(\n 'Error while converting JS variable to GDevelop variable: Impossible to set variable value to a function.'\n );\n } else {\n logger.error(\n 'Error while converting JS variable to GDevelop variable: Cannot identify type of object ' +\n obj\n );\n }\n return this;\n }\n\n /**\n * Unserialize a JSON string into this variable.\n *\n * This just logs an error if the JSON is invalid.\n *\n * @param json - A JSON string.\n */\n fromJSON(json: string): this {\n try {\n var obj = JSON.parse(json);\n } catch (e) {\n logger.error('Unable to parse JSON: ' + json + e);\n return this;\n }\n this.fromJSObject(obj);\n return this;\n }\n\n /**\n * Converts this variable into an equivalent JavaScript object.\n * @returns A JavaScript object equivalent to the variable.\n */\n toJSObject(): any {\n switch (this._type) {\n case 'string':\n return this.getAsString();\n case 'number':\n return this.getAsNumber();\n case 'boolean':\n return this.getAsBoolean();\n case 'structure':\n const obj = {};\n for (const name in this._children)\n obj[name] = this._children[name].toJSObject();\n return obj;\n case 'array':\n const arr: any[] = [];\n for (const item of this._childrenArray) {\n // item can be undefined if there are empty elements in the array.\n // A variable can have empty items in its children array if one inserts\n // a variable at an index greater than highest index. All the array elements\n // in the gap will be empty elements.\n arr.push(item === undefined ? undefined : item.toJSObject());\n }\n return arr;\n }\n }\n\n /**\n * Return true if the type of the variable is a primitive type.\n */\n isPrimitive() {\n return gdjs.Variable.isPrimitive(this._type);\n }\n\n /**\n * Returns a deep copy of this variable.\n */\n clone(): gdjs.Variable {\n return gdjs.Variable.copy(this, new gdjs.Variable());\n }\n\n /**\n * Used (usually by gdjs.VariablesContainer) to set that the variable must be\n * considered as not existing in the container.\n */\n setUndefinedInContainer() {\n this._undefinedInContainer = true;\n }\n\n /**\n * Check if the variable must be considered as not existing in its container\n * (usually a gdjs.VariablesContainer).\n * @return true if the container must consider that the variable does not exist.\n */\n isUndefinedInContainer(): boolean {\n return this._undefinedInContainer;\n }\n\n /**\n * Converts the variable into another type.\n * @param newType The new type of the variable\n */\n castTo(newType: VariableType) {\n if (newType === 'string') this.setString(this.getAsString());\n else if (newType === 'number') this.setNumber(this.getAsNumber());\n else if (newType === 'boolean') this.setBoolean(this.getAsBoolean());\n else if (newType === 'structure') {\n if (this._type === 'structure') return;\n this._children = this.getAllChildren();\n this._type = 'structure';\n } else if (newType === 'array') {\n if (this._type === 'array') return;\n this._childrenArray = this.getAllChildrenArray();\n this._type = 'array';\n }\n }\n\n /**\n * Get the child with the specified name or at the specified index.\n *\n * If the variable is an array, prefer `getChildAt`.\n * If the variable is a structure, prefer `getChildNamed`.\n *\n * If the variable has not the specified child, an empty variable with the specified name\n * (or index) is added as child.\n *\n * @returns The child variable\n */\n getChild(childName: string | number): gdjs.Variable {\n if (this._type === 'array')\n return this.getChildAt(\n // @ts-ignore\n Number.isInteger(childName) ? childName : parseInt(childName, 10) || 0\n );\n else {\n if (this._type !== 'structure') this.castTo('structure');\n return this.getChildNamed('' + childName);\n }\n }\n\n /**\n * Get the child with the specified name.\n *\n * If the variable has not the specified child, an empty variable with the specified name\n * is added as child.\n *\n * @returns The child variable\n */\n getChildNamed(childName: string): gdjs.Variable {\n const child = this._children[childName];\n if (child === undefined || child === null)\n return (this._children[childName] = new gdjs.Variable());\n\n return child;\n }\n\n /**\n * Add a child variable with the specified name.\n *\n * If there is an existing child variable with this name, it is erased.\n * @param childName The name of the variable to add\n * @param childVariable The variable to add as a child\n * @returns The variable (for chaining calls)\n */\n addChild(childName: string, childVariable: gdjs.Variable): this {\n if (this._type !== 'structure') this.castTo('structure');\n\n this._children[childName] = childVariable;\n return this;\n }\n\n /**\n * Return the child in a variable.\n *\n * Check if the variable has the specified children\n * @return true if variable has the children with the specified name\n */\n hasChild(childName: string): boolean {\n return (\n this._type === 'structure' && this._children.hasOwnProperty(childName)\n );\n }\n\n /**\n * Remove the child with the specified name.\n *\n * If the variable has not the specified child, nothing is done.\n * @param childName The name of the child to be removed\n */\n removeChild(childName: string) {\n if (this._type !== 'structure') return;\n delete this._children[childName];\n }\n\n /**\n * Remove all the children.\n */\n clearChildren() {\n this._children = {};\n this._childrenArray = [];\n }\n\n /**\n * Replaces all the children with a new map of children.\n * @param newChildren The map of new children.\n */\n replaceChildren(newChildren: Children) {\n this._type = 'structure';\n this._children = newChildren;\n }\n\n /**\n * Replaces all the children with a new array of children.\n * @param newChildren The array of new children.\n */\n replaceChildrenArray(newChildren: gdjs.Variable[]) {\n this._type = 'array';\n this._childrenArray = newChildren;\n }\n\n /**\n * Get the value of the variable, considered as a number\n * @return The number stored in the variable\n */\n getAsNumber(): float {\n if (this._type !== 'number') {\n let number = 0;\n if (this._type === 'string') number = parseFloat(this._str);\n else if (this._type === 'boolean') number = this._bool ? 1 : 0;\n\n return number === number ? number : 0; //Ensure NaN is not returned as a value.\n }\n\n return this._value;\n }\n\n /**\n * Change the value of the variable, considered as a number\n * @param newValue The new value to be set\n */\n setNumber(newValue: float) {\n this._type = 'number';\n //@ts-ignore parseFloat does accept numbers.\n newValue = parseFloat(newValue);\n this._value = newValue === newValue ? newValue : 0; // Prevent NaN\n }\n\n /**\n * Get the value of the variable, considered as a string\n * @return The string stored in the variable\n */\n getAsString(): string {\n if (this._type !== 'string') {\n if (this._type === 'number') return this._value.toString();\n else if (this._type === 'boolean') return this._bool ? 'true' : 'false';\n else if (this._type === 'structure') return '[Structure]';\n else if (this._type === 'array') return '[Array]';\n else return '';\n }\n\n return this._str;\n }\n\n /**\n * Change the value of the variable, considered as a string\n * @param newValue The new string to be set\n */\n setString(newValue: string): void {\n this._type = 'string';\n this._str = '' + newValue;\n }\n\n /**\n * Get the value of the variable, as a number if it's one,\n * or as a string (if it's a string or something else)\n *\n * In most cases, prefer calling `getAsNumber` or `getAsString` directly.\n * This is a fallback in case a variable type can't be known statically for sure,\n * like `getValue`.\n *\n * @private\n */\n getAsNumberOrString(): number | string {\n if (this._type === 'number') return this._value;\n return this.getAsString();\n }\n\n /**\n * Get the value of the variable, considered as a boolean\n * @return The boolean value of the variable.\n */\n getAsBoolean(): boolean {\n if (this._type !== 'boolean') {\n if (this._type === 'number') return this._value !== 0;\n else if (this._type === 'string')\n return this._str !== '0' && this._str !== '' && this._str !== 'false';\n else return true;\n }\n\n return this._bool;\n }\n\n /**\n * Change the value of the variable, considered as a boolean\n * @param newValue The new boolean to be set.\n */\n setBoolean(newValue: boolean) {\n this._type = 'boolean';\n this._bool = !!newValue;\n }\n\n /**\n * Toggle the value of the variable, considered as a boolean.\n */\n toggle() {\n this.setBoolean(!this.getAsBoolean());\n }\n\n /**\n * Sets the primitive value using the setter of the current type.\n * @param newValue The primitive value of the variable.\n */\n setValue(newValue: string | float | boolean) {\n if (this._type === 'string') this.setString(newValue as string);\n else if (this._type === 'number') this.setNumber(newValue as float);\n else if (this._type === 'boolean') this.setBoolean(newValue as boolean);\n }\n\n /**\n * Gets the primitive value using the getter of the current type.\n */\n getValue(): string | float | boolean {\n return this._type === 'number'\n ? this.getAsNumber()\n : this._type === 'boolean'\n ? this.getAsBoolean()\n : this.getAsString();\n }\n\n /**\n * Return true if the variable is a structure.\n * @return true if the variable is a structure.\n * @deprecated Use {@link gdjs.Variable.getType} instead.\n */\n isStructure(): boolean {\n return this._type === 'structure';\n }\n\n /**\n * Return true if the variable is a number.\n * @return true if the variable is a number.\n * @deprecated Use {@link gdjs.Variable.getType} instead.\n */\n isNumber(): boolean {\n return this._type === 'number';\n }\n\n /**\n * Returns the type of the variable.\n */\n getType(): VariableType {\n return this._type;\n }\n\n /**\n * Return the object containing all the children of the variable.\n * @return All the children of the variable\n */\n getAllChildren(): Children {\n return this._type === 'structure'\n ? this._children\n : this._type === 'array'\n ? ((Object.assign({}, this._childrenArray) as unknown) as Children)\n : {};\n }\n\n /**\n * Return an Array containing all the children of the variable.\n */\n getAllChildrenArray(): gdjs.Variable[] {\n return this._type === 'structure'\n ? Object.values(this._children)\n : this._type === 'array'\n ? this._childrenArray\n : [];\n }\n\n /**\n * Return the length of the collection.\n */\n getChildrenCount(): integer {\n return this._type === 'structure'\n ? Object.keys(this._children).length\n : this._type === 'array'\n ? this._childrenArray.length\n : 0;\n }\n\n /**\n * Add the given number to the variable value\n * @param val the number to add\n */\n add(val: float) {\n this.setNumber(this.getAsNumber() + val);\n }\n\n /**\n * Subtract the given number to the variable value\n * @param val the number to subtract\n */\n sub(val: float) {\n this.setNumber(this.getAsNumber() - val);\n }\n\n /**\n * Multiply the variable value by the given number\n * @param val the factor\n */\n mul(val: float) {\n this.setNumber(this.getAsNumber() * val);\n }\n\n /**\n * Divide the variable value by the given number\n * @param val the divisor\n */\n div(val: float) {\n this.setNumber(this.getAsNumber() / val);\n }\n\n /**\n * Concatenate the given string at the end of the variable value\n * @param str the string to append\n */\n concatenateString(str: string) {\n this.setString(this.getAsString() + str);\n }\n\n /**\n * @deprecated\n * @private\n * @alias concatenateString\n */\n concatenate(str: string) {\n this.setString(this.getAsString() + str);\n }\n\n /**\n * Get a variable at a given index of the array.\n */\n getChildAt(index: integer) {\n if (this._type !== 'array') this.castTo('array');\n\n if (\n this._childrenArray[index] === undefined ||\n this._childrenArray[index] === null\n )\n this._childrenArray[index] = new gdjs.Variable();\n return this._childrenArray[index];\n }\n\n /**\n * Removes a variable at a given index of the array.\n */\n removeAtIndex(index: integer) {\n if (this._type === 'array') this._childrenArray.splice(index, 1);\n }\n\n /**\n * Pushes a copy of a variable into the array.\n */\n pushVariableCopy(variable: gdjs.Variable) {\n if (this._type !== 'array') this.castTo('array');\n\n this._childrenArray.push(variable.clone());\n }\n\n /**\n * Pushes a variable into the array without duplicating it first.\n * This should only be used by generated code.\n */\n _pushVariable(variable: gdjs.Variable) {\n if (this._type !== 'array') this.castTo('array');\n\n this._childrenArray.push(variable);\n }\n\n /**\n * Pushes a value into the array.\n */\n pushValue(value: string | float | boolean) {\n if (this._type !== 'array') this.castTo('array');\n\n this._childrenArray.push(\n new gdjs.Variable({\n type: typeof value as 'string' | 'number' | 'boolean',\n value,\n })\n );\n }\n\n getPlayerOwnership(): number | null {\n return this._playerNumber;\n }\n\n setPlayerOwnership(playerNumber: number) {\n this._playerNumber = playerNumber;\n }\n\n disableSynchronization() {\n this._playerNumber = null;\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,aAUxB,OAAe,CAkBpB,YAAY,EAAwB,CAhBpC,WAAsB,SACtB,YAAgB,EAChB,UAAe,IACf,WAAiB,GACjB,eAAsB,GACtB,oBAAkC,GAClC,2BAAiC,GAKjC,mBAA+B,EAM7B,KAAK,aAAa,GAGpB,aAAa,EAAoC,CAS/C,GARA,KAAK,MAAQ,SACb,KAAK,OAAS,EACd,KAAK,KAAO,IACZ,KAAK,MAAQ,GACb,KAAK,UAAY,GACjB,KAAK,eAAiB,GACtB,KAAK,sBAAwB,GAEzB,IAAY,QAEd,GADA,KAAK,MAAQ,EAAQ,MAAQ,SACzB,KAAK,QAAU,SACjB,KAAK,OAAS,WAAY,EAAQ,OAAoB,KAElD,KAAK,SAAW,KAAK,QAAQ,MAAK,OAAS,WACtC,KAAK,QAAU,SACxB,KAAK,KAAO,GAAK,EAAQ,OAAS,YACzB,KAAK,QAAU,UACxB,KAAK,MAAQ,CAAC,CAAC,EAAQ,cACd,KAAK,QAAU,aACxB,GAAI,EAAQ,WAAa,OACvB,OAAS,GAAI,EAAG,EAAM,EAAQ,SAAS,OAAQ,EAAI,EAAK,EAAE,EAAG,CAC3D,GAAI,GAAY,EAAQ,SAAS,GACjC,AAAI,EAAU,OAAS,QACvB,MAAK,UAAU,EAAU,MAAQ,GAAI,GAAK,SAAS,aAG9C,KAAK,QAAU,SAAW,EAAQ,SAC3C,SAAW,KAAa,GAAQ,SAC9B,KAAK,eAAe,KAAK,GAAI,GAAK,SAAS,WAQ5C,aACL,EACyC,CACzC,MAAO,KAAS,UAAY,IAAS,UAAY,IAAS,gBAUrD,MACL,EACA,EACA,EACe,CAGf,GAFK,GAAO,EAAO,gBACnB,EAAO,OAAO,EAAO,WAC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ExC,KAAK,eAAe,KAClB,GAAI,GAAK,SAAS,CAChB,KAAM,MAAO,GACb,WAKN,oBAAoC,CAClC,MAAO,MAAK,cAGd,mBAAmB,EAAsB,CACvC,KAAK,cAAgB,EAGvB,wBAAyB,CACvB,KAAK,cAAgB,MA/nBlB,EAAM,aAXL",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(
|
|
1
|
+
var gdjs;(function(o){const u=class{constructor(r){this._variablesArray=[];this._variables=new Hashtable,r!==void 0&&this.initFrom(r)}initFrom(r,e){e===void 0&&(e=!1),e||(u._deletedVars=u._deletedVars||[],this._variables.keys(u._deletedVars));const n=this;let i=0;for(let a=0;a<r.length;++a){const t=r[a];if(!t.name)continue;const l=n.get(t.name);if(l.reinitialize(t),!e){i<n._variablesArray.length?n._variablesArray[i]=l:n._variablesArray.push(l),++i;const s=u._deletedVars.indexOf(t.name);s!==-1&&(u._deletedVars[s]=void 0)}}if(!e){this._variablesArray.length=i;for(let a=0,t=u._deletedVars.length;a<t;++a){const l=u._deletedVars[a];l!==void 0&&this._variables.get(l).setUndefinedInContainer()}}}_declare(r,e){this._variables.put(r,e),this._variablesArray.push(e)}add(r,e){const n=this._variables.get(r);if(this._variables.put(r,e),n){const i=this._variablesArray.indexOf(n);i!==-1&&(this._variablesArray[i]=e)}}remove(r){const e=this._variables.get(r);e&&e.setUndefinedInContainer()}get(r){let e=this._variables.get(r);return e?e.isUndefinedInContainer()&&e.reinitialize():(e=new o.Variable,this._variables.put(r,e)),e}getFromIndex(r){if(r>=this._variablesArray.length){let e=new o.Variable;return this._variables.put("",e),e}else{let e=this._variablesArray[r];return e.isUndefinedInContainer()&&e.reinitialize(),e}}has(r){const e=this._variables.get(r);return!!e&&!e.isUndefinedInContainer()}hasVariable(r){const e=this._variablesArray.find(n=>n===r);return!!e&&!e.isUndefinedInContainer()}getVariableNameInContainerByLoopingThroughAllVariables(r){const e=this._variables.items;for(const n in e)if(e.hasOwnProperty(n)&&e[n]===r)return n;return null}getNetworkSyncData(r){const e=r.playerNumber,n=[],i=[];return this._variables.keys(i),i.forEach(a=>{const t=this._variables.get(a),l=t.getPlayerOwnership();if(t.isUndefinedInContainer()||l===null||e!==void 0&&l===0&&e!==1||l!==0&&e!==l)return;const s=t.getType(),b=s==="structure"||s==="array"?"":t.getValue();n.push({name:a,value:b,type:s,children:this.getStructureNetworkSyncData(t),owner:l})}),n}getStructureNetworkSyncData(r){if(r.getType()==="array"){const e=[];return r.getAllChildrenArray().forEach(n=>{const i=n.getType(),a=i==="structure"||i==="array"?"":n.getValue(),t=n.getPlayerOwnership();n.isUndefinedInContainer()||t===null||e.push({name:"",value:a,type:i,children:this.getStructureNetworkSyncData(n),owner:t})}),e}if(r.getType()==="structure"){const e=r.getAllChildren();if(!e)return;const n=[];return Object.entries(e).forEach(([i,a])=>{const t=a.getType(),l=t==="structure"||t==="array"?"":a.getValue(),s=a.getPlayerOwnership();a.isUndefinedInContainer()||s===null||n.push({name:i,value:l,type:t,children:this.getStructureNetworkSyncData(a),owner:s})}),n}}updateFromNetworkSyncData(r){const e=this;for(let n=0;n<r.length;++n){const i=r[n],a=e._getVariableDataFromNetworkSyncData(i),t=a.name;if(!t)continue;const l=e.get(t),s=i.owner,b=o.multiplayer.getCurrentPlayerNumber(),d=l.getPlayerOwnership();if(b===d){console.info(`Variable ${t} is owned by us ${o.multiplayer.playerNumber}, ignoring update message from ${s}.`);return}s!==d&&(console.info(`Variable ${t} is owned by ${d} on our game, changing ownership to ${s} as part of the update event.`),l.setPlayerOwnership(s)),l.reinitialize(a)}}_getVariableDataFromNetworkSyncData(r){return{name:r.name,value:r.value,type:r.type,children:r.children?r.children.map(e=>this._getVariableDataFromNetworkSyncData(e)):void 0}}};let c=u;c._deletedVars=[],c.badVariablesContainer={_variables:new Hashtable,_variablesArray:[],has:function(){return!1},getFromIndex:function(){return u.badVariable},get:function(){return u.badVariable},remove:function(){},add:function(){},_declare:function(){},initFrom:function(){},getNetworkSyncData:function(){return[]},updateFromNetworkSyncData:function(){},getStructureNetworkSyncData:function(){},_getVariableDataFromNetworkSyncData:function(){return{}},hasVariable:function(){return!1},getVariableNameInContainerByLoopingThroughAllVariables:function(){return""}},c.badVariable={_type:"number",_bool:!1,_children:{},_childrenArray:[],_str:"",_undefinedInContainer:!0,_value:0,_playerNumber:0,fromJSON:()=>o.VariablesContainer.badVariable,toJSObject:()=>0,fromJSObject:()=>o.VariablesContainer.badVariable,reinitialize:()=>{},addChild:()=>o.VariablesContainer.badVariable,castTo:()=>{},clearChildren:()=>{},clone:()=>o.VariablesContainer.badVariable,getChildrenCount:()=>0,replaceChildren:()=>{},replaceChildrenArray:()=>{},getType:function(){return"number"},isPrimitive:function(){return!0},setValue:()=>{},toggle:()=>{},getValue:()=>0,getChild:()=>o.VariablesContainer.badVariable,getChildAt:()=>o.VariablesContainer.badVariable,getChildNamed:()=>o.VariablesContainer.badVariable,hasChild:function(){return!1},isStructure:function(){return!1},isNumber:function(){return!0},removeChild:function(){},setNumber:function(){},setString:function(){},setBoolean:function(){},getAsString:function(){return"0"},getAsNumber:function(){return 0},getAsNumberOrString:function(){return 0},getAsBoolean:function(){return!1},getAllChildren:function(){return{}},getAllChildrenArray:function(){return[]},pushVariableCopy:()=>{},_pushVariable:()=>{},pushValue:()=>{},removeAtIndex:function(){},add:function(){},sub:function(){},mul:function(){},div:function(){},concatenate:function(){},concatenateString:function(){},setUndefinedInContainer:function(){},isUndefinedInContainer:function(){return!0},getPlayerOwnership:function(){return 0},setPlayerOwnership:function(){},disableSynchronization:function(){}},o.VariablesContainer=c})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=variablescontainer.js.map
|