bard-legends-framework 0.11.0 → 0.12.0
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/actions-performance.test.d.ts +1 -0
- package/dist/actions-performance.test.js +83 -0
- package/dist/game-entities/controller/controller.d.ts +2 -2
- package/dist/game-entities/controller/controller.js +8 -8
- package/dist/game-entities/controller/controller.test.js +2 -2
- package/dist/game-entities/entity/entity.d.ts +7 -7
- package/dist/game-entities/entity/entity.js +18 -12
- package/dist/game-entities/entity/entity.test.js +93 -30
- package/dist/game-entities/entity/helpers/entity-store.helper.d.ts +3 -3
- package/dist/game-entities/entity/helpers/entity-store.helper.js +12 -12
- package/dist/game-entities/entity/helpers/entity-store.helper.test.js +11 -11
- package/dist/game-entities/entity/helpers/entity-views.helper.d.ts +6 -6
- package/dist/game-entities/entity/helpers/entity-views.helper.js +25 -22
- package/dist/game-entities/entity/singleton-entity.test.js +9 -4
- package/dist/game-entities/hard-reset.d.ts +5 -0
- package/dist/game-entities/hard-reset.js +14 -0
- package/dist/game-entities/index.d.ts +1 -1
- package/dist/game-entities/index.js +3 -3
- package/dist/game-entities/scene/scene.d.ts +13 -13
- package/dist/game-entities/scene/scene.js +41 -46
- package/dist/game-entities/scene/scene.test.js +95 -37
- package/dist/game-entities/service/service.d.ts +1 -4
- package/dist/game-entities/service/service.js +12 -13
- package/dist/game-entities/service/service.test.js +33 -12
- package/dist/game-entities/unit-test.helper.js +1 -1
- package/dist/game-entities/update-cycle.d.ts +7 -17
- package/dist/game-entities/update-cycle.js +25 -19
- package/dist/game-entities/view/view.d.ts +6 -6
- package/dist/game-entities/view/view.js +15 -21
- package/dist/game-entities/view/view.test.js +40 -9
- package/dist/physics/entity-types/immovable-physics-entity.d.ts +1 -1
- package/dist/physics/entity-types/immovable-physics-entity.js +4 -4
- package/dist/physics/entity-types/movable-entity.d.ts +1 -1
- package/dist/physics/entity-types/movable-entity.js +2 -2
- package/dist/physics/entity-types/movable-physics-entity.d.ts +8 -8
- package/dist/physics/entity-types/movable-physics-entity.js +27 -27
- package/dist/physics/entity-types/physics-entity.d.ts +10 -14
- package/dist/physics/entity-types/physics-entity.js +27 -26
- package/dist/physics/interfaces.d.ts +6 -6
- package/dist/physics/interfaces.js +4 -4
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.d.ts +16 -16
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.js +22 -22
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts +19 -19
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js +30 -30
- package/dist/physics/module//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +3 -3
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.d.ts +10 -10
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.js +16 -16
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.d.ts +10 -10
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.js +18 -18
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.d.ts +5 -5
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.js +17 -17
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.js +11 -11
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js +4 -4
- package/dist/physics/module//360/237/223/220services/creation/border.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/creation/border.service.js +9 -9
- package/dist/physics/module//360/237/223/220services/creation/materials.service.d.ts +7 -7
- package/dist/physics/module//360/237/223/220services/creation/materials.service.js +17 -17
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.d.ts +11 -11
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js +27 -26
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.js +13 -13
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js +19 -19
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.js +20 -20
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.d.ts +1 -1
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.js +4 -4
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.js +3 -3
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.d.ts +5 -5
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js +12 -12
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js +12 -12
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.js +4 -4
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.d.ts +1 -4
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.js +7 -15
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +43 -42
- package/dist/physics/module//360/237/247/212entities/border.entity.d.ts +1 -1
- package/dist/physics/module//360/237/247/212entities/border.entity.js +3 -3
- package/dist/pixi/components/display-object-array.d.ts +5 -5
- package/dist/pixi/components/display-object-array.js +14 -14
- package/dist/pixi/components/helpers/smooth-scroller.d.ts +7 -7
- package/dist/pixi/components/helpers/smooth-scroller.js +23 -23
- package/dist/pixi/components/helpers/smooth-scroller.test.js +14 -14
- package/dist/pixi/components/menu/menu-entity.d.ts +14 -0
- package/dist/pixi/components/menu/menu-entity.js +48 -0
- package/dist/pixi/components/menu/menu.ui.d.ts +23 -0
- package/dist/pixi/components/menu/menu.ui.js +97 -0
- package/dist/pixi/components/mouse-wheel-listener.ui.d.ts +2 -2
- package/dist/pixi/components/mouse-wheel-listener.ui.js +11 -11
- package/dist/pixi/components/scroll-area.ui.d.ts +1 -1
- package/dist/pixi/components/scroll-area.ui.js +9 -9
- package/dist/pixi/components/scroll-mask.ui.d.ts +9 -8
- package/dist/pixi/components/scroll-mask.ui.js +25 -24
- package/dist/pixi/display-object/container-attributes.d.ts +24 -25
- package/dist/pixi/display-object/container-attributes.js +26 -26
- package/dist/pixi/display-object/container.d.ts +3 -3
- package/dist/pixi/display-object/container.js +2 -2
- package/dist/pixi/display-object/filters/base-filters/blur.filter.d.ts +9 -9
- package/dist/pixi/display-object/filters/base-filters/blur.filter.js +25 -25
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.d.ts +7 -7
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js +17 -17
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.d.ts +6 -6
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.js +10 -11
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.d.ts +2 -2
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.js +5 -5
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.d.ts +5 -5
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js +8 -8
- package/dist/pixi/display-object/filters/templates/plane.template.d.ts +5 -5
- package/dist/pixi/display-object/filters/templates/plane.template.js +7 -7
- package/dist/pixi/display-object/filters.d.ts +7 -7
- package/dist/pixi/display-object/filters.js +34 -34
- package/dist/pixi/display-object/index.d.ts +1 -1
- package/dist/pixi/display-object/objects/graphics/graphics.d.ts +9 -9
- package/dist/pixi/display-object/objects/graphics/graphics.js +25 -25
- package/dist/pixi/display-object/objects/placeholder.d.ts +1 -1
- package/dist/pixi/display-object/objects/placeholder.js +7 -7
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.d.ts +9 -9
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js +26 -25
- package/dist/pixi/display-object/objects/sprite/sprite.d.ts +10 -9
- package/dist/pixi/display-object/objects/sprite/sprite.js +62 -53
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/pixi-text-style-converter.d.ts +4 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.d.ts +6 -6
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +16 -16
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +28 -28
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.d.ts +1 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.js +3 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.d.ts +17 -17
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.js +62 -62
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.test.js +2 -2
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.d.ts +3 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.js +6 -6
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.test.js +12 -12
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.d.ts +2 -2
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.test.js +5 -5
- package/dist/pixi/display-object/objects/text/rich-text.d.ts +0 -1
- package/dist/pixi/display-object/objects/text/rich-text.js +0 -1
- package/dist/pixi/display-object/objects/text/text.d.ts +9 -10
- package/dist/pixi/display-object/objects/text/text.js +34 -35
- package/dist/pixi/game.d.ts +20 -15
- package/dist/pixi/game.js +40 -35
- package/dist/pixi/helpers/game-assets.d.ts +5 -5
- package/dist/pixi/helpers/game-assets.js +14 -11
- package/dist/pixi/helpers/position-conversion.helper.d.ts +4 -4
- package/dist/pixi/helpers/position-conversion.helper.js +3 -3
- package/dist/pixi/index.d.ts +3 -37
- package/dist/pixi/index.js +6 -22
- package/dist/pixi/modules/CAMERA/camera.d.ts +5 -4
- package/dist/pixi/modules/CAMERA/camera.js +9 -9
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.d.ts +3 -2
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.js +1 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.d.ts +3 -2
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.js +5 -5
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.d.ts +3 -3
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.js +7 -7
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +8 -8
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.js +8 -8
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.d.ts +2 -2
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.js +12 -12
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.d.ts +17 -16
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +49 -48
- package/dist/pixi/pixi-definitions.d.ts +38 -0
- package/dist/pixi/pixi-definitions.js +37 -0
- package/dist/pixi/services/keyboard/keyboard.d.ts +2 -2
- package/dist/pixi/services/keyboard/keyboard.js +9 -9
- package/dist/pixi/services/mouse/mouse-target-focus.service.d.ts +10 -10
- package/dist/pixi/services/mouse/mouse-target-focus.service.js +28 -28
- package/dist/pixi/services/mouse/mouse.service.d.ts +1 -1
- package/dist/pixi/services/mouse/mouse.service.js +5 -5
- package/dist/utilities/animator/animating-content/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/animating-content/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/animating-content/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/animating-content/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/animations.d.ts +14 -6
- package/dist/utilities/animator/animations.js +15 -11
- package/dist/utilities/animator/animator/animator.d.ts +44 -0
- package/dist/utilities/animator/animator/animator.js +234 -0
- package/dist/utilities/animator/animator/animator.memory-leak.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.memory-leak.test.js +73 -0
- package/dist/utilities/animator/animator/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.performance.test.js +116 -0
- package/dist/utilities/animator/animator/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.test.js +1046 -0
- package/dist/utilities/animator/animator.d.ts +2 -3
- package/dist/utilities/animator/animator.js +66 -59
- package/dist/utilities/animator/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator.performance.test.js +46 -0
- package/dist/utilities/animator/animator.test.js +89 -28
- package/dist/utilities/animator/animator2/animator.d.ts +42 -0
- package/dist/utilities/animator/animator2/animator.js +222 -0
- package/dist/utilities/animator/animator2/animator.memory-leak.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.memory-leak.test.js +73 -0
- package/dist/utilities/animator/animator2/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.performance.test.js +65 -0
- package/dist/utilities/animator/animator2/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.test.js +1007 -0
- package/dist/utilities/animator/animator_old/animator.d.ts +60 -0
- package/dist/utilities/animator/animator_old/animator.js +337 -0
- package/dist/utilities/animator/animator_old/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator_old/animator.performance.test.js +121 -0
- package/dist/utilities/animator/animator_old/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator_old/animator.test.js +996 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.js +37 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.d.ts +38 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.js +208 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.js +439 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.d.ts +41 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.js +107 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.js +138 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.js +307 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.d.ts +37 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.js +170 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.test.js +340 -0
- package/dist/utilities/animator/index.d.ts +6 -6
- package/dist/utilities/animator/index.js +6 -6
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.js +37 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.d.ts +32 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.js +168 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.js +431 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.d.ts +37 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.js +100 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.js +130 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.js +301 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.test.js +30 -30
- package/dist/utilities/animator/state-animation/state-animation.js +7 -7
- package/dist/utilities/animator/state-animation/state-animation.test.js +24 -24
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.js +30 -30
- package/dist/utilities/data-structures/vector-set/vector-set.d.ts +1 -1
- package/dist/utilities/data-structures/vector-set/vector-set.js +5 -5
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.d.ts +1 -1
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.js +5 -5
- package/dist/utilities/grid-algorithms/path-finder/path-finder.js +21 -21
- package/dist/utilities/grid-algorithms/path-finder/path-finder.test.js +9 -9
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.d.ts +14 -14
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js +43 -43
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js +21 -21
- package/package.json +7 -5
|
@@ -8,50 +8,50 @@ const p2js_helper_1 = require("../libs/p2js.helper");
|
|
|
8
8
|
const physics_internal_gateway_1 = require("../module/\u269C\uFE0Fgateways/physics-internal.gateway");
|
|
9
9
|
const physics_entity_1 = require("./physics-entity");
|
|
10
10
|
class MovablePhysicsEntity extends physics_entity_1.PhysicsEntity {
|
|
11
|
-
constructor(
|
|
12
|
-
super(
|
|
11
|
+
constructor(physicsWorldID, physicsEntityDefinition) {
|
|
12
|
+
super(physicsWorldID, physicsEntityDefinition, 'dynamic');
|
|
13
13
|
this.position = new actions_lib_1.Variable(helpers_lib_1.Vector.zero);
|
|
14
14
|
this.rotation = new actions_lib_1.Variable(helpers_lib_1.Radian.get0);
|
|
15
15
|
this.velocity = new actions_lib_1.Variable(helpers_lib_1.Vector.zero);
|
|
16
16
|
this.rotationalSpeed = new actions_lib_1.Variable(0);
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
17
|
+
this._ignorePositionUpdate = false;
|
|
18
|
+
this._ignoreRotationUpdate = false;
|
|
19
|
+
this._ignoreVelocityUpdate = false;
|
|
20
|
+
this._ignoreRotationalSpeedUpdate = false;
|
|
21
|
+
this._phsicsToLocalSync();
|
|
22
|
+
this._localToPhsicsSync();
|
|
23
23
|
game_entities_1.Service.get(physics_internal_gateway_1.PhysicsInternalGateway)
|
|
24
|
-
.subscribeToPhysicsStep(
|
|
24
|
+
.subscribeToPhysicsStep(physicsWorldID, ({ time, delta }) => this._step(time, delta))
|
|
25
25
|
.attach(this);
|
|
26
26
|
}
|
|
27
27
|
convertToDTO() {
|
|
28
28
|
return {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
entityID: this.id,
|
|
30
|
+
classID: this.classID,
|
|
31
31
|
position: this.position.value,
|
|
32
32
|
rotation: this.rotation.value,
|
|
33
33
|
velocity: this.velocity.value,
|
|
34
34
|
rotationalSpeed: this.rotationalSpeed.value
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
37
|
+
_step(time, delta) {
|
|
38
|
+
this._ignorePositionUpdate = true;
|
|
39
|
+
this._ignoreRotationUpdate = true;
|
|
40
|
+
this._ignoreVelocityUpdate = true;
|
|
41
|
+
this._ignoreRotationalSpeedUpdate = true;
|
|
42
|
+
this._phsicsToLocalSync();
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
_phsicsToLocalSync() {
|
|
45
45
|
this.position.value = p2js_helper_1.P2JSHelper.arrayToVector(this.p2Body.position);
|
|
46
46
|
this.rotation.value = new helpers_lib_1.Radian(this.p2Body.angle);
|
|
47
47
|
this.velocity.value = p2js_helper_1.P2JSHelper.arrayToVector(this.p2Body.velocity);
|
|
48
48
|
this.rotationalSpeed.value = this.p2Body.angularVelocity;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
_localToPhsicsSync() {
|
|
51
51
|
this.position
|
|
52
52
|
.subscribe(position => {
|
|
53
|
-
if (this.
|
|
54
|
-
this.
|
|
53
|
+
if (this._ignorePositionUpdate) {
|
|
54
|
+
this._ignorePositionUpdate = false;
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
57
|
this.p2Body.position = [position.x, position.y];
|
|
@@ -60,8 +60,8 @@ class MovablePhysicsEntity extends physics_entity_1.PhysicsEntity {
|
|
|
60
60
|
.attach(this);
|
|
61
61
|
this.rotation
|
|
62
62
|
.subscribe(rotation => {
|
|
63
|
-
if (this.
|
|
64
|
-
this.
|
|
63
|
+
if (this._ignoreRotationUpdate) {
|
|
64
|
+
this._ignoreRotationUpdate = false;
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
67
|
this.p2Body.angle = rotation.value;
|
|
@@ -70,8 +70,8 @@ class MovablePhysicsEntity extends physics_entity_1.PhysicsEntity {
|
|
|
70
70
|
.attach(this);
|
|
71
71
|
this.velocity
|
|
72
72
|
.subscribe(velocity => {
|
|
73
|
-
if (this.
|
|
74
|
-
this.
|
|
73
|
+
if (this._ignoreVelocityUpdate) {
|
|
74
|
+
this._ignoreVelocityUpdate = false;
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
77
|
this.p2Body.velocity = [velocity.x, velocity.y];
|
|
@@ -80,8 +80,8 @@ class MovablePhysicsEntity extends physics_entity_1.PhysicsEntity {
|
|
|
80
80
|
.attach(this);
|
|
81
81
|
this.rotationalSpeed
|
|
82
82
|
.subscribe(rotationalSpeed => {
|
|
83
|
-
if (this.
|
|
84
|
-
this.
|
|
83
|
+
if (this._ignoreRotationalSpeedUpdate) {
|
|
84
|
+
this._ignoreRotationalSpeedUpdate = false;
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
87
87
|
this.p2Body.angularVelocity = rotationalSpeed;
|
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
import { Action } from 'actions-lib';
|
|
2
|
-
import p2 from 'p2';
|
|
3
2
|
import { Entity } from '../../game-entities';
|
|
4
3
|
import { CollisionReport, PhysicsBodyDTO, PhysicsEntityDefinition } from '../interfaces';
|
|
5
4
|
import { PhysicsBodyGroup } from '../libs/physics-body-groups';
|
|
6
5
|
export declare abstract class PhysicsEntity extends Entity {
|
|
7
|
-
private static
|
|
8
|
-
private static
|
|
9
|
-
static
|
|
10
|
-
static
|
|
11
|
-
static getPhysicsInstanceOrFail(id:
|
|
6
|
+
private static _p2BodyIDToPhysicsBody;
|
|
7
|
+
private static _physicsEntities;
|
|
8
|
+
static getFromP2BodyID(p2BodyID: number): PhysicsEntity | undefined;
|
|
9
|
+
static getFromP2BodyIDOrFail(p2BodyID: number): PhysicsEntity;
|
|
10
|
+
static getPhysicsInstanceOrFail(id: number): PhysicsEntity;
|
|
12
11
|
static getPhysicsEntities(): PhysicsEntity[];
|
|
13
12
|
readonly _onCollision: Action<readonly CollisionReport[]>;
|
|
14
13
|
readonly onCollision: import("actions-lib").Notifier<readonly CollisionReport[]>;
|
|
15
14
|
get area(): number;
|
|
16
15
|
get mass(): number;
|
|
17
16
|
get collisions(): readonly CollisionReport[];
|
|
18
|
-
readonly
|
|
17
|
+
readonly physicsWorldID: number;
|
|
19
18
|
readonly physicsBodyGroup: PhysicsBodyGroup;
|
|
20
19
|
readonly includeInPathfinding: boolean;
|
|
21
|
-
protected readonly p2Body: p2.Body;
|
|
22
20
|
protected readonly type: 'dynamic' | 'static';
|
|
23
|
-
private readonly
|
|
24
|
-
private
|
|
25
|
-
private
|
|
21
|
+
private readonly _physicsInternalGateway;
|
|
22
|
+
private _physicsGroup;
|
|
23
|
+
private _physicsMask;
|
|
26
24
|
private _area;
|
|
27
25
|
private _mass;
|
|
28
|
-
|
|
29
|
-
constructor(physicsWorldId: string, physicsEntityDefinition: PhysicsEntityDefinition, type: 'dynamic' | 'static');
|
|
26
|
+
constructor(physicsWorldID: number, physicsEntityDefinition: PhysicsEntityDefinition, type: 'dynamic' | 'static');
|
|
30
27
|
abstract convertToDTO(): PhysicsBodyDTO;
|
|
31
28
|
destroy(): void;
|
|
32
29
|
canCollideWith(target: PhysicsEntity): boolean;
|
|
33
|
-
protected setCollisionReports(collisionReports: CollisionReport[]): void;
|
|
34
30
|
}
|
|
@@ -6,27 +6,27 @@ const game_entities_1 = require("../../game-entities");
|
|
|
6
6
|
const p2js_helper_1 = require("../libs/p2js.helper");
|
|
7
7
|
const physics_internal_gateway_1 = require("../module/\u269C\uFE0Fgateways/physics-internal.gateway");
|
|
8
8
|
class PhysicsEntity extends game_entities_1.Entity {
|
|
9
|
-
static { this.
|
|
10
|
-
static { this.
|
|
11
|
-
static
|
|
12
|
-
return PhysicsEntity.
|
|
9
|
+
static { this._p2BodyIDToPhysicsBody = new Map(); }
|
|
10
|
+
static { this._physicsEntities = new Map(); }
|
|
11
|
+
static getFromP2BodyID(p2BodyID) {
|
|
12
|
+
return PhysicsEntity._p2BodyIDToPhysicsBody.get(p2BodyID);
|
|
13
13
|
}
|
|
14
|
-
static
|
|
15
|
-
let physicsBody = PhysicsEntity.
|
|
14
|
+
static getFromP2BodyIDOrFail(p2BodyID) {
|
|
15
|
+
let physicsBody = PhysicsEntity._p2BodyIDToPhysicsBody.get(p2BodyID);
|
|
16
16
|
if (!physicsBody) {
|
|
17
|
-
throw new Error(`PhysicsEntity with
|
|
17
|
+
throw new Error(`PhysicsEntity with p2BodyID ${p2BodyID} not found`);
|
|
18
18
|
}
|
|
19
19
|
return physicsBody;
|
|
20
20
|
}
|
|
21
21
|
static getPhysicsInstanceOrFail(id) {
|
|
22
|
-
let physicsEntity = PhysicsEntity.
|
|
22
|
+
let physicsEntity = PhysicsEntity._physicsEntities.get(id);
|
|
23
23
|
if (!physicsEntity) {
|
|
24
24
|
throw new Error(`PhysicsEntity with id ${id} not found`);
|
|
25
25
|
}
|
|
26
26
|
return physicsEntity;
|
|
27
27
|
}
|
|
28
28
|
static getPhysicsEntities() {
|
|
29
|
-
return Array.from(PhysicsEntity.
|
|
29
|
+
return Array.from(PhysicsEntity._physicsEntities.values());
|
|
30
30
|
}
|
|
31
31
|
get area() {
|
|
32
32
|
return this._area;
|
|
@@ -37,48 +37,49 @@ class PhysicsEntity extends game_entities_1.Entity {
|
|
|
37
37
|
get collisions() {
|
|
38
38
|
return this._collisions;
|
|
39
39
|
}
|
|
40
|
-
constructor(
|
|
40
|
+
constructor(physicsWorldID, physicsEntityDefinition, type) {
|
|
41
41
|
super();
|
|
42
42
|
this._onCollision = new actions_lib_1.Action();
|
|
43
43
|
this.onCollision = this._onCollision.notifier;
|
|
44
44
|
this.type = 'dynamic';
|
|
45
45
|
this._area = 0;
|
|
46
46
|
this._mass = 0;
|
|
47
|
+
/** @internal */
|
|
47
48
|
this._collisions = [];
|
|
48
|
-
this.
|
|
49
|
-
this.
|
|
50
|
-
let material = this.
|
|
51
|
-
let materialDefinition = this.
|
|
49
|
+
this.physicsWorldID = physicsWorldID;
|
|
50
|
+
this._physicsInternalGateway = game_entities_1.Service.get(physics_internal_gateway_1.PhysicsInternalGateway);
|
|
51
|
+
let material = this._physicsInternalGateway.getMaterial(this.physicsWorldID, physicsEntityDefinition.shapeDefinition.materialName);
|
|
52
|
+
let materialDefinition = this._physicsInternalGateway.getMaterialDefinition(this.physicsWorldID, physicsEntityDefinition.shapeDefinition.materialName);
|
|
52
53
|
this.type = type;
|
|
53
54
|
this.physicsBodyGroup = physicsEntityDefinition.shapeDefinition.group;
|
|
54
55
|
this.includeInPathfinding = physicsEntityDefinition.includeOnPathfinding;
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
57
|
-
this.p2Body = this.
|
|
56
|
+
this._physicsGroup = this._physicsInternalGateway.getGroupConstant(this.physicsWorldID, this.physicsBodyGroup);
|
|
57
|
+
this._physicsMask = this._physicsInternalGateway.getMaskConstant(this.physicsWorldID, this.physicsBodyGroup);
|
|
58
|
+
this.p2Body = this._physicsInternalGateway.createBody(this.physicsWorldID, physicsEntityDefinition, material, materialDefinition, this.type);
|
|
58
59
|
this._area = this.p2Body.getArea();
|
|
59
60
|
this._mass = this.p2Body.mass;
|
|
60
61
|
this.p2Body.position = p2js_helper_1.P2JSHelper.vectorToArray(physicsEntityDefinition.position);
|
|
61
62
|
this.p2Body.angle = physicsEntityDefinition.rotation.value;
|
|
62
|
-
let addedToTheWorld = this.
|
|
63
|
+
let addedToTheWorld = this._physicsInternalGateway.addBody(this.physicsWorldID, this.p2Body, physicsEntityDefinition.addInEmptySpace, physicsEntityDefinition.shapeDefinition.group, physicsEntityDefinition.includeOnPathfinding);
|
|
63
64
|
if (!addedToTheWorld) {
|
|
64
65
|
throw new Error('PhysicsEntity was not able to be added to the world!');
|
|
65
66
|
}
|
|
66
|
-
PhysicsEntity.
|
|
67
|
-
PhysicsEntity.
|
|
67
|
+
PhysicsEntity._p2BodyIDToPhysicsBody.set(this.p2Body.id, this);
|
|
68
|
+
PhysicsEntity._physicsEntities.set(this.id, this);
|
|
68
69
|
}
|
|
69
70
|
destroy() {
|
|
70
71
|
if (!this.destroyed) {
|
|
71
|
-
this.physicsInternalGateway.removeBody(this.physicsWorldId, this.p2Body);
|
|
72
|
-
PhysicsEntity.p2BodyIdToPhysicsBody.delete(this.p2Body.id);
|
|
73
|
-
PhysicsEntity.physicsEntities.delete(this.id);
|
|
74
72
|
super.destroy();
|
|
73
|
+
this._physicsInternalGateway.removeBody(this.physicsWorldID, this.p2Body);
|
|
74
|
+
PhysicsEntity._p2BodyIDToPhysicsBody.delete(this.p2Body.id);
|
|
75
|
+
PhysicsEntity._physicsEntities.delete(this.id);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
canCollideWith(target) {
|
|
78
|
-
return p2js_helper_1.P2JSHelper.arePhysicsGroupsCollidable(this.
|
|
79
|
+
return p2js_helper_1.P2JSHelper.arePhysicsGroupsCollidable(this._physicsGroup, this._physicsMask, target._physicsGroup, target._physicsMask);
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
/** @internal */
|
|
82
|
+
_setCollisionReports(collisionReports) {
|
|
82
83
|
this._collisions = collisionReports;
|
|
83
84
|
if (collisionReports.length > 0) {
|
|
84
85
|
this._onCollision.trigger(collisionReports);
|
|
@@ -4,8 +4,8 @@ import { PhysicsBodyGroup } from './libs/physics-body-groups';
|
|
|
4
4
|
export declare const SPEED_LIMIT = 10.8;
|
|
5
5
|
export declare const ROTATIONAL_SPEED_LIMIT = 10.01;
|
|
6
6
|
export interface PhysicsBodyDTO {
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
7
|
+
readonly entityID: number;
|
|
8
|
+
readonly classID: number;
|
|
9
9
|
readonly position: Vector;
|
|
10
10
|
readonly rotation: Radian;
|
|
11
11
|
readonly velocity: Vector;
|
|
@@ -25,10 +25,10 @@ export interface CollisionReport {
|
|
|
25
25
|
readonly target: CollisionDetails;
|
|
26
26
|
}
|
|
27
27
|
export declare enum PhysicsShapeType {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
Point = 1,
|
|
29
|
+
Circle = 2,
|
|
30
|
+
Polygon = 3,
|
|
31
|
+
Rectangle = 4
|
|
32
32
|
}
|
|
33
33
|
export type CircleShapeData = number;
|
|
34
34
|
export type RectangleShapeData = Vector;
|
|
@@ -5,9 +5,9 @@ exports.SPEED_LIMIT = 10.8;
|
|
|
5
5
|
exports.ROTATIONAL_SPEED_LIMIT = 10.01;
|
|
6
6
|
var PhysicsShapeType;
|
|
7
7
|
(function (PhysicsShapeType) {
|
|
8
|
-
PhysicsShapeType["
|
|
9
|
-
PhysicsShapeType["
|
|
10
|
-
PhysicsShapeType["
|
|
11
|
-
PhysicsShapeType["
|
|
8
|
+
PhysicsShapeType[PhysicsShapeType["Point"] = 1] = "Point";
|
|
9
|
+
PhysicsShapeType[PhysicsShapeType["Circle"] = 2] = "Circle";
|
|
10
|
+
PhysicsShapeType[PhysicsShapeType["Polygon"] = 3] = "Polygon";
|
|
11
|
+
PhysicsShapeType[PhysicsShapeType["Rectangle"] = 4] = "Rectangle";
|
|
12
12
|
})(PhysicsShapeType || (exports.PhysicsShapeType = PhysicsShapeType = {}));
|
|
13
13
|
//# sourceMappingURL=interfaces.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="p2" />
|
|
2
|
-
import {
|
|
2
|
+
import { IAttachment, NotifierCallbackFunction } from 'actions-lib';
|
|
3
3
|
import { PhysicsEntityDefinition } from '../../../interfaces';
|
|
4
4
|
import { PhysicsBodyGroup } from '../../../libs/physics-body-groups';
|
|
5
5
|
import { PhysicsBodyGroupService } from '../../📐services/collision/physics-body-group.service';
|
|
@@ -9,21 +9,21 @@ import { ShapeCreationService } from '../../📐services/creation/shape-creation
|
|
|
9
9
|
import { PhysicsQueryService } from '../../📐services/query/physics-query.service';
|
|
10
10
|
import { MaterialDefinition } from '../dtos/shared-interfaces.dto';
|
|
11
11
|
export declare class PhysicsInternalController {
|
|
12
|
-
private
|
|
13
|
-
private
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
constructor(
|
|
18
|
-
createBody(
|
|
19
|
-
getMaterial(
|
|
20
|
-
getMaterialDefinition(
|
|
21
|
-
getGroupConstant(
|
|
22
|
-
getMaskConstant(
|
|
23
|
-
addBody(
|
|
24
|
-
removeBody(
|
|
25
|
-
subscribeToPhysicsStep(
|
|
12
|
+
private _physicsWorldService;
|
|
13
|
+
private _physicsMaterialsService;
|
|
14
|
+
private _shapeCreationService;
|
|
15
|
+
private _physicsQueryService;
|
|
16
|
+
private _physicsBodyGroupService;
|
|
17
|
+
constructor(_physicsWorldService: PhysicsWorldService, _physicsMaterialsService: MaterialsService, _shapeCreationService: ShapeCreationService, _physicsQueryService: PhysicsQueryService, _physicsBodyGroupService: PhysicsBodyGroupService);
|
|
18
|
+
createBody(physicsWorldID: number, physicsEntityDefinition: PhysicsEntityDefinition, material: p2.Material, materialDefinition: MaterialDefinition, type: 'dynamic' | 'static'): p2.Body;
|
|
19
|
+
getMaterial(physicsWorldID: number, name: string): p2.Material;
|
|
20
|
+
getMaterialDefinition(physicsWorldID: number, name: string): MaterialDefinition;
|
|
21
|
+
getGroupConstant(physicsWorldID: number, group: PhysicsBodyGroup): number;
|
|
22
|
+
getMaskConstant(physicsWorldID: number, group: PhysicsBodyGroup): number;
|
|
23
|
+
addBody(physicsWorldID: number, body: p2.Body, addInEmptySpace: boolean, physicsBodyGroup: PhysicsBodyGroup, includeOnPathfinding: boolean): boolean;
|
|
24
|
+
removeBody(physicsWorldID: number, p2Body: p2.Body): void;
|
|
25
|
+
subscribeToPhysicsStep(physicsWorldID: number, callback: NotifierCallbackFunction<{
|
|
26
26
|
time: number;
|
|
27
27
|
delta: number;
|
|
28
|
-
}>):
|
|
28
|
+
}>): IAttachment;
|
|
29
29
|
}
|
|
@@ -18,36 +18,36 @@ const shape_creation_service_1 = require("../../\uD83D\uDCD0services/creation/sh
|
|
|
18
18
|
const physics_query_service_1 = require("../../\uD83D\uDCD0services/query/physics-query.service");
|
|
19
19
|
const physics_internal_gateway_1 = require("../physics-internal.gateway");
|
|
20
20
|
let PhysicsInternalController = class PhysicsInternalController {
|
|
21
|
-
constructor(
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
21
|
+
constructor(_physicsWorldService, _physicsMaterialsService, _shapeCreationService, _physicsQueryService, _physicsBodyGroupService) {
|
|
22
|
+
this._physicsWorldService = _physicsWorldService;
|
|
23
|
+
this._physicsMaterialsService = _physicsMaterialsService;
|
|
24
|
+
this._shapeCreationService = _shapeCreationService;
|
|
25
|
+
this._physicsQueryService = _physicsQueryService;
|
|
26
|
+
this._physicsBodyGroupService = _physicsBodyGroupService;
|
|
27
27
|
}
|
|
28
|
-
createBody(
|
|
29
|
-
return this.
|
|
28
|
+
createBody(physicsWorldID, physicsEntityDefinition, material, materialDefinition, type) {
|
|
29
|
+
return this._shapeCreationService.createBody(physicsWorldID, physicsEntityDefinition, material, materialDefinition, type);
|
|
30
30
|
}
|
|
31
|
-
getMaterial(
|
|
32
|
-
return this.
|
|
31
|
+
getMaterial(physicsWorldID, name) {
|
|
32
|
+
return this._physicsMaterialsService.getMaterial(physicsWorldID, name);
|
|
33
33
|
}
|
|
34
|
-
getMaterialDefinition(
|
|
35
|
-
return this.
|
|
34
|
+
getMaterialDefinition(physicsWorldID, name) {
|
|
35
|
+
return this._physicsMaterialsService.getMaterialDefinition(physicsWorldID, name);
|
|
36
36
|
}
|
|
37
|
-
getGroupConstant(
|
|
38
|
-
return this.
|
|
37
|
+
getGroupConstant(physicsWorldID, group) {
|
|
38
|
+
return this._physicsBodyGroupService.getGroupConstant(physicsWorldID, group);
|
|
39
39
|
}
|
|
40
|
-
getMaskConstant(
|
|
41
|
-
return this.
|
|
40
|
+
getMaskConstant(physicsWorldID, group) {
|
|
41
|
+
return this._physicsBodyGroupService.getMaskConstant(physicsWorldID, group);
|
|
42
42
|
}
|
|
43
|
-
addBody(
|
|
44
|
-
return this.
|
|
43
|
+
addBody(physicsWorldID, body, addInEmptySpace, physicsBodyGroup, includeOnPathfinding) {
|
|
44
|
+
return this._physicsWorldService.addBody(physicsWorldID, body, addInEmptySpace, physicsBodyGroup, includeOnPathfinding);
|
|
45
45
|
}
|
|
46
|
-
removeBody(
|
|
47
|
-
this.
|
|
46
|
+
removeBody(physicsWorldID, p2Body) {
|
|
47
|
+
this._physicsWorldService.removeBody(physicsWorldID, p2Body);
|
|
48
48
|
}
|
|
49
|
-
subscribeToPhysicsStep(
|
|
50
|
-
return this.
|
|
49
|
+
subscribeToPhysicsStep(physicsWorldID, callback) {
|
|
50
|
+
return this._physicsQueryService.subscribeToPhysicsStep(physicsWorldID, callback);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
exports.PhysicsInternalController = PhysicsInternalController;
|
package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts
CHANGED
|
@@ -12,23 +12,23 @@ import { TestVisualsService } from '../../📐services/test-visuals/test-visuals
|
|
|
12
12
|
import { CreatePhysicsWorldRequestDTO, HitTestOptions, PhysicsExplosionOptions } from '../dtos/requests.dto';
|
|
13
13
|
import { ExplosionHit, MapSizeDTO } from '../dtos/responses.dto';
|
|
14
14
|
export declare class PhysicsController {
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
constructor(
|
|
24
|
-
createPhysicsWorld(request: CreatePhysicsWorldRequestDTO):
|
|
25
|
-
getMapSize(
|
|
26
|
-
setPaused(pause: boolean,
|
|
27
|
-
hitTest(
|
|
28
|
-
findPath(
|
|
29
|
-
findPathDirection(
|
|
30
|
-
applyImpulse(
|
|
31
|
-
createExplosion(
|
|
32
|
-
createElipticExplosion(
|
|
33
|
-
printPathfindingTestGrid(
|
|
15
|
+
private _physicsWorldService;
|
|
16
|
+
private _pathFinderService;
|
|
17
|
+
private _testVisualsService;
|
|
18
|
+
private _explosionService;
|
|
19
|
+
private _elipticExplosionService;
|
|
20
|
+
private _hitTestService;
|
|
21
|
+
private _physicsQueryService;
|
|
22
|
+
private _impactService;
|
|
23
|
+
constructor(_physicsWorldService: PhysicsWorldService, _pathFinderService: PathFinderService, _testVisualsService: TestVisualsService, _explosionService: ExplosionService, _elipticExplosionService: ElipticExplosionService, _hitTestService: HitTestService, _physicsQueryService: PhysicsQueryService, _impactService: ImpactService);
|
|
24
|
+
createPhysicsWorld(request: CreatePhysicsWorldRequestDTO): number;
|
|
25
|
+
getMapSize(physicsWorldID: number): MapSizeDTO;
|
|
26
|
+
setPaused(pause: boolean, physicsWorldID: number): void;
|
|
27
|
+
hitTest(physicsEntityID: number, options?: HitTestOptions): boolean;
|
|
28
|
+
findPath(physicsWorldID: number, startingPosition: Vector, target: Vector | number, collidableWithGroup: PhysicsBodyGroup, neighborType: GridNeighborType): PathFinderResult;
|
|
29
|
+
findPathDirection(physicsWorldID: number, startingPosition: Vector, target: Vector | number, collidableWithGroup: PhysicsBodyGroup): Radian | undefined;
|
|
30
|
+
applyImpulse(physicsEntityID: number, hitPosition: Vector, hitDirection: Vector, severity: number): void;
|
|
31
|
+
createExplosion(physicsWorldID: number, explosionCenter: Vector, radius: number, physicsBodyGroup: PhysicsBodyGroup, severity: number, options?: PhysicsExplosionOptions): ExplosionHit[];
|
|
32
|
+
createElipticExplosion(physicsWorldID: number, explosionCenter: Vector, rotation: Radian, size: Vector, physicsBodyGroup: PhysicsBodyGroup, severity: number, options?: PhysicsExplosionOptions): ExplosionHit[];
|
|
33
|
+
printPathfindingTestGrid(physicsWorldID: number, testLayerID: number, target: Vector | number, physicsBodyGroup: PhysicsBodyGroup, area: Rectangle, gridCellSize: number): void;
|
|
34
34
|
}
|
package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js
CHANGED
|
@@ -22,47 +22,47 @@ const physics_query_service_1 = require("../../\uD83D\uDCD0services/query/physic
|
|
|
22
22
|
const test_visuals_service_1 = require("../../\uD83D\uDCD0services/test-visuals/test-visuals.service");
|
|
23
23
|
const physics_gateway_1 = require("../physics.gateway");
|
|
24
24
|
let PhysicsController = class PhysicsController {
|
|
25
|
-
constructor(
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
25
|
+
constructor(_physicsWorldService, _pathFinderService, _testVisualsService, _explosionService, _elipticExplosionService, _hitTestService, _physicsQueryService, _impactService) {
|
|
26
|
+
this._physicsWorldService = _physicsWorldService;
|
|
27
|
+
this._pathFinderService = _pathFinderService;
|
|
28
|
+
this._testVisualsService = _testVisualsService;
|
|
29
|
+
this._explosionService = _explosionService;
|
|
30
|
+
this._elipticExplosionService = _elipticExplosionService;
|
|
31
|
+
this._hitTestService = _hitTestService;
|
|
32
|
+
this._physicsQueryService = _physicsQueryService;
|
|
33
|
+
this._impactService = _impactService;
|
|
34
34
|
}
|
|
35
35
|
createPhysicsWorld(request) {
|
|
36
|
-
return this.
|
|
36
|
+
return this._physicsWorldService.createPhysicsWorld(request);
|
|
37
37
|
}
|
|
38
|
-
getMapSize(
|
|
39
|
-
return this.
|
|
38
|
+
getMapSize(physicsWorldID) {
|
|
39
|
+
return this._physicsQueryService.getMapSize(physicsWorldID);
|
|
40
40
|
}
|
|
41
|
-
setPaused(pause,
|
|
42
|
-
this.
|
|
41
|
+
setPaused(pause, physicsWorldID) {
|
|
42
|
+
this._physicsWorldService.setPaused(pause, physicsWorldID);
|
|
43
43
|
}
|
|
44
|
-
hitTest(
|
|
45
|
-
let physicsEntity = physics_entity_1.PhysicsEntity.getPhysicsInstanceOrFail(
|
|
46
|
-
return this.
|
|
44
|
+
hitTest(physicsEntityID, options) {
|
|
45
|
+
let physicsEntity = physics_entity_1.PhysicsEntity.getPhysicsInstanceOrFail(physicsEntityID);
|
|
46
|
+
return this._hitTestService.hitTest(physicsEntity.p2Body, options);
|
|
47
47
|
}
|
|
48
|
-
findPath(
|
|
49
|
-
return this.
|
|
48
|
+
findPath(physicsWorldID, startingPosition, target, collidableWithGroup, neighborType) {
|
|
49
|
+
return this._pathFinderService.findPathAStar(physicsWorldID, startingPosition, target, collidableWithGroup, { neighborType });
|
|
50
50
|
}
|
|
51
|
-
findPathDirection(
|
|
52
|
-
return this.
|
|
51
|
+
findPathDirection(physicsWorldID, startingPosition, target, collidableWithGroup) {
|
|
52
|
+
return this._pathFinderService.findPathDirection(physicsWorldID, startingPosition, target, collidableWithGroup);
|
|
53
53
|
}
|
|
54
|
-
applyImpulse(
|
|
55
|
-
let entity = physics_entity_1.PhysicsEntity.getPhysicsInstanceOrFail(
|
|
56
|
-
this.
|
|
54
|
+
applyImpulse(physicsEntityID, hitPosition, hitDirection, severity) {
|
|
55
|
+
let entity = physics_entity_1.PhysicsEntity.getPhysicsInstanceOrFail(physicsEntityID);
|
|
56
|
+
this._impactService.applyImpulse(entity.p2Body, hitPosition, hitDirection, severity);
|
|
57
57
|
}
|
|
58
|
-
createExplosion(
|
|
59
|
-
return this.
|
|
58
|
+
createExplosion(physicsWorldID, explosionCenter, radius, physicsBodyGroup, severity, options) {
|
|
59
|
+
return this._explosionService.createExplosion(physicsWorldID, explosionCenter, radius, physicsBodyGroup, severity, options);
|
|
60
60
|
}
|
|
61
|
-
createElipticExplosion(
|
|
62
|
-
return this.
|
|
61
|
+
createElipticExplosion(physicsWorldID, explosionCenter, rotation, size, physicsBodyGroup, severity, options) {
|
|
62
|
+
return this._elipticExplosionService.createElipticExplosion(physicsWorldID, explosionCenter, rotation, size, physicsBodyGroup, severity, options);
|
|
63
63
|
}
|
|
64
|
-
printPathfindingTestGrid(
|
|
65
|
-
this.
|
|
64
|
+
printPathfindingTestGrid(physicsWorldID, testLayerID, target, physicsBodyGroup, area, gridCellSize) {
|
|
65
|
+
this._testVisualsService.printPathfindingTestGrid(physicsWorldID, testLayerID, target, physicsBodyGroup, area, gridCellSize);
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
exports.PhysicsController = PhysicsController;
|
|
@@ -3,7 +3,7 @@ import { PhysicsBodyGroup } from '../../../libs/physics-body-groups';
|
|
|
3
3
|
import { BorderProperties, MaterialContactDefinition, MaterialDefinition } from './shared-interfaces.dto';
|
|
4
4
|
export type InteractingBodyGroups = readonly (readonly [PhysicsBodyGroup, PhysicsBodyGroup])[];
|
|
5
5
|
export interface CreatePhysicsWorldRequestDTO {
|
|
6
|
-
readonly attachTo:
|
|
6
|
+
readonly attachTo: number;
|
|
7
7
|
readonly mapSize: Vector;
|
|
8
8
|
readonly modifyUpdateCycle: boolean;
|
|
9
9
|
readonly borderProperties: BorderProperties;
|
|
@@ -13,12 +13,12 @@ export interface CreatePhysicsWorldRequestDTO {
|
|
|
13
13
|
readonly interactingBodyGroups: InteractingBodyGroups;
|
|
14
14
|
}
|
|
15
15
|
export interface PhysicsExplosionOptions {
|
|
16
|
-
readonly
|
|
16
|
+
readonly testLayerID?: number;
|
|
17
17
|
readonly debugRayDuration?: number;
|
|
18
18
|
readonly hitOnlyClosest?: boolean;
|
|
19
19
|
}
|
|
20
20
|
export interface HitTestOptions {
|
|
21
21
|
readonly overridePosition?: Vector;
|
|
22
22
|
readonly overrideRotation?: Radian;
|
|
23
|
-
readonly
|
|
23
|
+
readonly testLayerID?: number;
|
|
24
24
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/// <reference types="p2" />
|
|
2
|
-
import {
|
|
2
|
+
import { IAttachment, NotifierCallbackFunction } from 'actions-lib';
|
|
3
3
|
import { ControllerLink } from '../../../game-entities';
|
|
4
4
|
import { PhysicsEntityDefinition } from '../../interfaces';
|
|
5
5
|
import { PhysicsBodyGroup } from '../../libs/physics-body-groups';
|
|
6
6
|
import { MaterialDefinition } from './dtos/shared-interfaces.dto';
|
|
7
7
|
export declare const PhysicsInternalControllerLink: ControllerLink;
|
|
8
8
|
export declare class PhysicsInternalGateway {
|
|
9
|
-
createBody(
|
|
10
|
-
getMaterial(
|
|
11
|
-
getMaterialDefinition(
|
|
12
|
-
getGroupConstant(
|
|
13
|
-
getMaskConstant(
|
|
14
|
-
addBody(
|
|
15
|
-
removeBody(
|
|
16
|
-
subscribeToPhysicsStep(
|
|
9
|
+
createBody(physicsWorldID: number, physicsEntityDefinition: PhysicsEntityDefinition, material: p2.Material, materialDefinition: MaterialDefinition, type: 'dynamic' | 'static'): p2.Body;
|
|
10
|
+
getMaterial(physicsWorldID: number, name: string): p2.Material;
|
|
11
|
+
getMaterialDefinition(physicsWorldID: number, name: string): MaterialDefinition;
|
|
12
|
+
getGroupConstant(physicsWorldID: number, group: PhysicsBodyGroup): number;
|
|
13
|
+
getMaskConstant(physicsWorldID: number, group: PhysicsBodyGroup): number;
|
|
14
|
+
addBody(physicsWorldID: number, body: p2.Body, addInEmptySpace: boolean, physicsBodyGroup: PhysicsBodyGroup, includeOnPathfinding: boolean): boolean;
|
|
15
|
+
removeBody(physicsWorldID: number, p2Body: p2.Body): void;
|
|
16
|
+
subscribeToPhysicsStep(physicsWorldID: number, callback: NotifierCallbackFunction<{
|
|
17
17
|
time: number;
|
|
18
18
|
delta: number;
|
|
19
|
-
}>):
|
|
19
|
+
}>): IAttachment;
|
|
20
20
|
}
|