bard-legends-framework 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/physics/entity-types/physics-entity.d.ts +4 -1
  2. package/dist/physics/entity-types/physics-entity.js +6 -0
  3. package/dist/physics/entity-types/physics-entity.js.map +1 -1
  4. package/dist/physics/libs/p2js.helper.d.ts +4 -1
  5. package/dist/physics/libs/p2js.helper.js +20 -0
  6. package/dist/physics/libs/p2js.helper.js.map +1 -1
  7. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.d.ts +6 -4
  8. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.js +9 -6
  9. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.js.map +1 -1
  10. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts +13 -8
  11. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js +22 -11
  12. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js.map +1 -1
  13. package/dist/physics/module//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +5 -0
  14. package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.d.ts +2 -1
  15. package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.js +4 -1
  16. package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.js.map +1 -1
  17. package/dist/physics/module//360/237/223/220services/collision/collisions.service.d.ts +10 -0
  18. package/dist/physics/module//360/237/223/220services/collision/collisions.service.js +106 -0
  19. package/dist/physics/module//360/237/223/220services/collision/collisions.service.js.map +1 -0
  20. package/dist/physics/module//360/237/223/220services/collision/hit-test.service.d.ts +13 -0
  21. package/dist/physics/module//360/237/223/220services/collision/hit-test.service.js +83 -0
  22. package/dist/physics/module//360/237/223/220services/collision/hit-test.service.js.map +1 -0
  23. package/dist/physics/module//360/237/223/220services/creation/border.service.d.ts +5 -0
  24. package/dist/physics/module//360/237/223/220services/creation/border.service.js +42 -0
  25. package/dist/physics/module//360/237/223/220services/creation/border.service.js.map +1 -0
  26. package/dist/physics/module//360/237/223/220services/creation/materials.service.d.ts +15 -0
  27. package/dist/physics/module//360/237/223/220services/creation/materials.service.js +120 -0
  28. package/dist/physics/module//360/237/223/220services/creation/materials.service.js.map +1 -0
  29. package/dist/physics/module//360/237/223/220services/creation/physics-world.service.d.ts +21 -0
  30. package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js +109 -0
  31. package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js.map +1 -0
  32. package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.d.ts +9 -0
  33. package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.js +97 -0
  34. package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.js.map +1 -0
  35. package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.d.ts +14 -0
  36. package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.js +102 -0
  37. package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.js.map +1 -0
  38. package/dist/physics/module//360/237/223/220services/explosions/explosion.service.d.ts +14 -0
  39. package/dist/physics/module//360/237/223/220services/explosions/explosion.service.js +87 -0
  40. package/dist/physics/module//360/237/223/220services/explosions/explosion.service.js.map +1 -0
  41. package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.d.ts +9 -0
  42. package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.js +73 -0
  43. package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.js.map +1 -0
  44. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.d.ts +12 -0
  45. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js +63 -0
  46. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js.map +1 -0
  47. package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.d.ts +15 -0
  48. package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js +92 -0
  49. package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js.map +1 -0
  50. package/dist/physics/module//360/237/223/220services/query/physics-query.service.d.ts +9 -0
  51. package/dist/physics/module//360/237/223/220services/query/physics-query.service.js +25 -0
  52. package/dist/physics/module//360/237/223/220services/query/physics-query.service.js.map +1 -0
  53. package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.d.ts +9 -0
  54. package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.js +92 -0
  55. package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.js.map +1 -0
  56. package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.d.ts +22 -0
  57. package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +135 -0
  58. package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js.map +1 -0
  59. package/dist/pixi/display-object/components/glow-filter.d.ts +2 -3
  60. package/dist/pixi/display-object/components/glow-filter.js +3 -5
  61. package/dist/pixi/display-object/components/glow-filter.js.map +1 -1
  62. package/dist/pixi/helpers/glow-sprite-generator.js +10 -16
  63. package/dist/pixi/helpers/glow-sprite-generator.js.map +1 -1
  64. package/dist/pixi/index.d.ts +6 -3
  65. package/package.json +1 -1
  66. package/package.json.bak +1 -1
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ExplosionService = void 0;
13
+ const helpers_lib_1 = require("helpers-lib");
14
+ const game_entities_1 = require("../../../../game-entities");
15
+ const physics_world_entity_1 = require("../../\uD83E\uDDCAentities/physics-world.entity");
16
+ const p2js_helper_1 = require("../../../libs/p2js.helper");
17
+ const ray_cast_hit_converter_1 = require("./helpers/ray-cast-hit-converter");
18
+ const test_visuals_service_1 = require("../test-visuals/test-visuals.service");
19
+ const ray_casting_service_1 = require("../ray-casting/ray-casting.service");
20
+ let ExplosionService = class ExplosionService {
21
+ constructor(rayCastingService, testVisualsService) {
22
+ this.rayCastingService = rayCastingService;
23
+ this.testVisualsService = testVisualsService;
24
+ }
25
+ createExplosion(physicsWorldId, explosionCenter, radius, physicsBodyGroup, severity, options) {
26
+ let physicsWorld = physics_world_entity_1.PhysicsWorldEntity.getInstanceByIdOrFail(physicsWorldId);
27
+ let totalCountOfRays = this.getTotalCountOfRays(radius);
28
+ let rayCasts = this.createRays(explosionCenter, radius, physicsBodyGroup, totalCountOfRays, options?.hitOnlyClosest === true, physicsWorld);
29
+ let explosionHits = ray_cast_hit_converter_1.RayCastHitConverter.toExplosionHits(rayCasts);
30
+ this.applyForcesToBodies(explosionCenter, radius, severity, totalCountOfRays, explosionHits);
31
+ if (options?.testLayerId) {
32
+ this.testVisualsService.createExplosionDebugVisual(physicsWorld, options.testLayerId, rayCasts, explosionCenter, radius, options.debugRayDuration);
33
+ }
34
+ return explosionHits;
35
+ }
36
+ createRays(explosionCenter, radius, physicsBodyGroup, totalCountOfRays, hitOnlyClosest, physicsWorld) {
37
+ let radianPerLine = helpers_lib_1.Radian.get360 / totalCountOfRays;
38
+ let directionVector = new helpers_lib_1.Vector(0, -radius);
39
+ let rotationVector = helpers_lib_1.Radian.toVector(radianPerLine);
40
+ return helpers_lib_1.ArrayHelper.createEmptyArray(totalCountOfRays)
41
+ .map(() => {
42
+ let to = explosionCenter.add(directionVector);
43
+ directionVector = directionVector.rotate(rotationVector);
44
+ return new helpers_lib_1.Line(explosionCenter, to);
45
+ })
46
+ .map(line => {
47
+ if (hitOnlyClosest) {
48
+ let hit = this.rayCastingService.castClosest(physicsWorld, line, physicsBodyGroup);
49
+ return { line, hits: hit ? [hit] : [] };
50
+ }
51
+ else {
52
+ let hits = this.rayCastingService.castAllFirstContacts(physicsWorld, line, physicsBodyGroup);
53
+ return { line, hits };
54
+ }
55
+ });
56
+ }
57
+ applyForcesToBodies(explosionCenter, radius, severity, totalCountOfRays, explosionHits) {
58
+ explosionHits.forEach(explosionHit => {
59
+ if (explosionHit.isExternal) {
60
+ explosionHit.raycastResults.forEach(rayCastResult => {
61
+ let force = severity * (1 - rayCastResult.fraction);
62
+ p2js_helper_1.P2JSHelper.pushBody(rayCastResult.body, rayCastResult.hitPosition(), rayCastResult.line.fromTo, force);
63
+ });
64
+ }
65
+ else {
66
+ let vectorToCenter = helpers_lib_1.Vector.fromTo(explosionCenter, p2js_helper_1.P2JSHelper.arrayToVector(explosionHit.p2Body.position));
67
+ let fractionToCenter = vectorToCenter.length / radius;
68
+ let force = (severity * totalCountOfRays * fractionToCenter) / 2;
69
+ p2js_helper_1.P2JSHelper.pushBody(explosionHit.p2Body, explosionHit.getHitPosition(), vectorToCenter, force);
70
+ }
71
+ });
72
+ }
73
+ getTotalCountOfRays(radius) {
74
+ if (radius > 100) {
75
+ return Math.floor(radius * 0.3);
76
+ }
77
+ else {
78
+ return Math.floor(radius * 0.26 + 4);
79
+ }
80
+ }
81
+ };
82
+ exports.ExplosionService = ExplosionService;
83
+ exports.ExplosionService = ExplosionService = __decorate([
84
+ (0, game_entities_1.ServiceDecorator)(),
85
+ __metadata("design:paramtypes", [ray_casting_service_1.RayCastingService, test_visuals_service_1.TestVisualsService])
86
+ ], ExplosionService);
87
+ //# sourceMappingURL=explosion.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explosion.service.js","sourceRoot":"","sources":["../../../../../src/physics/module/📐services/explosions/explosion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAgE;AAGhE,6DAA6D;AAE7D,0FAA2E;AAC3E,2DAAuD;AACvD,6EAA+F;AAC/F,+EAA0E;AAC1E,4EAAuE;AAGhE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YAAoB,iBAAoC,EAAU,kBAAsC;QAApF,sBAAiB,GAAjB,iBAAiB,CAAmB;QAAU,uBAAkB,GAAlB,kBAAkB,CAAoB;IAAG,CAAC;IAE5G,eAAe,CACb,cAAsB,EACtB,eAAuB,EACvB,MAAc,EACd,gBAAkC,EAClC,QAAgB,EAChB,OAAiC;QAEjC,IAAI,YAAY,GAAG,yCAAkB,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC;QAC5E,IAAI,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAExD,IAAI,QAAQ,GAAG,IAAI,CAAC,UAAU,CAC5B,eAAe,EACf,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EAAE,cAAc,KAAK,IAAI,EAChC,YAAY,CACb,CAAC;QACF,IAAI,aAAa,GAAG,4CAAmB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAClE,IAAI,CAAC,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;QAE7F,IAAI,OAAO,EAAE,WAAW,EAAE,CAAC;YACzB,IAAI,CAAC,kBAAkB,CAAC,0BAA0B,CAChD,YAAY,EACZ,OAAO,CAAC,WAAW,EACnB,QAAQ,EACR,eAAe,EACf,MAAM,EACN,OAAO,CAAC,gBAAgB,CACzB,CAAC;QACJ,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;IAEO,UAAU,CAChB,eAAuB,EACvB,MAAc,EACd,gBAAkC,EAClC,gBAA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ExplosionHit, RayCast } from '../../../⚜️gateways';
3
+ export interface ExplosionHitWithP2Body extends ExplosionHit {
4
+ p2Body: p2.Body;
5
+ }
6
+ export declare class RayCastHitConverter {
7
+ static toExplosionHits(rayCasts: RayCast[], allRaysStartingFromSamePosition?: boolean): ExplosionHitWithP2Body[];
8
+ private static convertRayResultGroupToExplosionHit;
9
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RayCastHitConverter = void 0;
4
+ const helpers_lib_1 = require("helpers-lib");
5
+ const physics_entity_1 = require("../../../../entity-types/physics-entity");
6
+ const p2js_helper_1 = require("../../../../libs/p2js.helper");
7
+ class RayCastHitConverter {
8
+ static toExplosionHits(rayCasts, allRaysStartingFromSamePosition = true) {
9
+ let bodyToHitResults = new Map();
10
+ rayCasts.forEach(rayCast => {
11
+ rayCast.hits.forEach(rayCastHit => {
12
+ let previousRecord = bodyToHitResults.get(rayCastHit.body);
13
+ if (previousRecord) {
14
+ let closestRaycastResult = rayCastHit.fraction < previousRecord.closestRaycastHit.fraction ? rayCastHit : previousRecord.closestRaycastHit;
15
+ previousRecord.rayCastHits.push(rayCastHit);
16
+ bodyToHitResults.set(rayCastHit.body, {
17
+ hitCount: previousRecord.hitCount + 1,
18
+ closestRaycastHit: closestRaycastResult,
19
+ rayCastHits: previousRecord.rayCastHits,
20
+ isExternal: allRaysStartingFromSamePosition
21
+ ? previousRecord.isExternal
22
+ : previousRecord.isExternal && rayCastHit.isExternal(),
23
+ explosionCenter: rayCastHit.line.from
24
+ });
25
+ }
26
+ else {
27
+ let isExternal = rayCastHit.isExternal();
28
+ bodyToHitResults.set(rayCastHit.body, {
29
+ hitCount: 1,
30
+ closestRaycastHit: rayCastHit,
31
+ rayCastHits: [rayCastHit],
32
+ isExternal,
33
+ explosionCenter: rayCastHit.line.from
34
+ });
35
+ }
36
+ });
37
+ });
38
+ return [...bodyToHitResults.values()].map(rayResultGroupOfABody => this.convertRayResultGroupToExplosionHit(rayResultGroupOfABody, rayCasts.length));
39
+ }
40
+ static convertRayResultGroupToExplosionHit(rayResultGroupOfABody, totalCountOfRays) {
41
+ let ratioOfHits = rayResultGroupOfABody.hitCount / totalCountOfRays;
42
+ let raycastResults = rayResultGroupOfABody.rayCastHits;
43
+ if (rayResultGroupOfABody.isExternal) {
44
+ return {
45
+ body: physics_entity_1.PhysicsEntity.getFromP2BodyIdOrFail(rayResultGroupOfABody.closestRaycastHit.body.id).convertToDTO(),
46
+ p2Body: rayResultGroupOfABody.closestRaycastHit.body,
47
+ isExternal: true,
48
+ normal: rayResultGroupOfABody.closestRaycastHit.normal,
49
+ fraction: rayResultGroupOfABody.closestRaycastHit.fraction,
50
+ ratioOfHits,
51
+ raycastResults,
52
+ getHitPosition: rayResultGroupOfABody.closestRaycastHit.hitPosition,
53
+ getHitDistance: rayResultGroupOfABody.closestRaycastHit.hitDistance
54
+ };
55
+ }
56
+ else {
57
+ let bodyPosition = p2js_helper_1.P2JSHelper.arrayToVector(rayResultGroupOfABody.closestRaycastHit.body.position);
58
+ return {
59
+ body: physics_entity_1.PhysicsEntity.getFromP2BodyIdOrFail(rayResultGroupOfABody.closestRaycastHit.body.id).convertToDTO(),
60
+ p2Body: rayResultGroupOfABody.closestRaycastHit.body,
61
+ isExternal: false,
62
+ normal: helpers_lib_1.Vector.fromTo(bodyPosition, rayResultGroupOfABody.explosionCenter).normalize(),
63
+ fraction: 0,
64
+ ratioOfHits,
65
+ raycastResults,
66
+ getHitPosition: () => rayResultGroupOfABody.explosionCenter,
67
+ getHitDistance: () => 0
68
+ };
69
+ }
70
+ }
71
+ }
72
+ exports.RayCastHitConverter = RayCastHitConverter;
73
+ //# sourceMappingURL=ray-cast-hit-converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ray-cast-hit-converter.js","sourceRoot":"","sources":["../../../../../../src/physics/module/📐services/explosions/helpers/ray-cast-hit-converter.ts"],"names":[],"mappings":";;;AAAA,6CAAqC;AA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C,CAAC,YAAY,EAAE;gBACzG,MAAM,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,IAAI;gBACpD,UAAU,EAAE,KAAK;gBACjB,MAAM,EAAE,oBAAM,CAAC,MAAM,CAAC,YAAY,EAAE,qBAAqB,CAAC,eAAe,CAAC,CAAC,SAAS,EAAE;gBACtF,QAAQ,EAAE,CAAC;gBACX,WAAW;gBACX,cAAc;gBACd,cAAc,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,eAAe;gBAC3D,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;aACxB,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA1ED,kDA0EC"}
@@ -0,0 +1,12 @@
1
+ /// <reference types="p2" />
2
+ import { Vector } from 'helpers-lib';
3
+ import { PhysicsBodyGroup } from '../../../libs/physics-body-groups';
4
+ import { PhysicsWorldEntity } from '../../🧊entities/physics-world.entity';
5
+ import { Grid } from '../../../../utilities/libraries/data-structures/grid/grid';
6
+ export declare class AvailabilityGridService {
7
+ onBodyAdded(physicsWorld: PhysicsWorldEntity, body: p2.Body, physicsBodyGroup: PhysicsBodyGroup): void;
8
+ findClosestAvailableSpace(physicsWorld: PhysicsWorldEntity, body: p2.Body, physicsBodyGroup: PhysicsBodyGroup, gridCellSize?: number): Vector | undefined;
9
+ getAvilabilityGrid(physicsWorld: PhysicsWorldEntity, cellSize: number, physicsBodyGroup?: PhysicsBodyGroup): Grid<boolean>;
10
+ private createGrid;
11
+ private getGridSpaceBoundingBox;
12
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AvailabilityGridService = void 0;
10
+ const helpers_lib_1 = require("helpers-lib");
11
+ const game_entities_1 = require("../../../../game-entities");
12
+ const p2js_helper_1 = require("../../../libs/p2js.helper");
13
+ const position_to_grid_position_converter_1 = require("../../../libs/position-to-grid-position-converter");
14
+ const physics_body_groups_1 = require("../../../libs/physics-body-groups");
15
+ const grid_1 = require("../../../../utilities/libraries/data-structures/grid/grid");
16
+ const physics_entity_1 = require("../../../entity-types/physics-entity");
17
+ const path_finder_service_1 = require("./path-finder.service");
18
+ const utilities_1 = require("../../../../utilities");
19
+ let AvailabilityGridService = class AvailabilityGridService {
20
+ onBodyAdded(physicsWorld, body, physicsBodyGroup) {
21
+ body.aabbNeedsUpdate = true;
22
+ body.updateAABB();
23
+ let boundingBox = p2js_helper_1.P2JSHelper.aabbToBoundingBox(body.aabb);
24
+ physicsWorld.availabilityGridCache.getCollidableGrids(physicsBodyGroup).forEach(item => {
25
+ let gridSpaceBoundingBox = position_to_grid_position_converter_1.PositionToGridPositionConverter.areaToGridArea(boundingBox, item.cellSize);
26
+ item.grid.safeSetArea(gridSpaceBoundingBox, false);
27
+ });
28
+ }
29
+ findClosestAvailableSpace(physicsWorld, body, physicsBodyGroup, gridCellSize = path_finder_service_1.DEFAULT_GRID_CELL_SIZE) {
30
+ body.aabbNeedsUpdate = true;
31
+ body.updateAABB();
32
+ let changeVector = utilities_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(this.getAvilabilityGrid(physicsWorld, gridCellSize, physicsBodyGroup), p2js_helper_1.P2JSHelper.aabbToBoundingBox(body.aabb), gridCellSize);
33
+ return changeVector;
34
+ }
35
+ getAvilabilityGrid(physicsWorld, cellSize, physicsBodyGroup = physics_body_groups_1.PhysicsBodyGroup.none) {
36
+ let grid = physicsWorld.availabilityGridCache.get(cellSize, physicsBodyGroup);
37
+ if (!grid) {
38
+ grid = this.createGrid(physicsWorld, cellSize, physicsBodyGroup);
39
+ physicsWorld.availabilityGridCache.set(cellSize, physicsBodyGroup, grid);
40
+ }
41
+ return grid;
42
+ }
43
+ createGrid(physicsWorld, cellSize, physicsBodyGroup) {
44
+ let grid = grid_1.Grid.createNew(new helpers_lib_1.Vector(Math.floor(physicsWorld.mapSize.x / cellSize), Math.floor(physicsWorld.mapSize.y / cellSize)), true);
45
+ physicsWorld.p2World.bodies.forEach(p2Body => {
46
+ let physicsEntity = physics_entity_1.PhysicsEntity.getFromP2BodyIdOrFail(p2Body.id);
47
+ if (physicsEntity.includeInPathfinding && physics_body_groups_1.PhysicsBodyGroups.canCollide(physicsEntity.physicsBodyGroup, physicsBodyGroup)) {
48
+ let gridSpaceBoundingBox = this.getGridSpaceBoundingBox(p2Body, cellSize);
49
+ grid?.safeSetArea(gridSpaceBoundingBox, false);
50
+ }
51
+ });
52
+ return grid;
53
+ }
54
+ getGridSpaceBoundingBox(p2Body, cellSize) {
55
+ let boundingBox = p2js_helper_1.P2JSHelper.aabbToBoundingBox(p2Body.aabb);
56
+ return position_to_grid_position_converter_1.PositionToGridPositionConverter.areaToGridArea(boundingBox, cellSize);
57
+ }
58
+ };
59
+ exports.AvailabilityGridService = AvailabilityGridService;
60
+ exports.AvailabilityGridService = AvailabilityGridService = __decorate([
61
+ (0, game_entities_1.ServiceDecorator)()
62
+ ], AvailabilityGridService);
63
+ //# sourceMappingURL=availability-grid.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"availability-grid.service.js","sourceRoot":"","sources":["../../../../../src/physics/module/📐services/path-finding/availability-grid.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6CAAgD;AAEhD,6DAA6D;AAC7D,2DAAuD;AACvD,2GAAoG;AACpG,2EAAwF;AAExF,oFAAiF;AACjF,yEAAqE;AACrE,+DAA+D;AAC/D,qDAAoE;AAG7D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IACl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from 'helpers-lib';
2
+ import { PhysicsBodyGroup } from '../../../libs/physics-body-groups';
3
+ import { AvailabilityGridService } from './availability-grid.service';
4
+ import { PathFinderResult } from '../../../../utilities';
5
+ export declare const DEFAULT_GRID_CELL_SIZE = 50;
6
+ export declare class PathFinderService {
7
+ private physicsAvailabilityGrid;
8
+ constructor(physicsAvailabilityGrid: AvailabilityGridService);
9
+ findPathAStar(physicsWorldId: string, startingPosition: Vector, target: Vector | string, options?: {
10
+ includeDiagonals?: boolean;
11
+ collidableWithGroup?: PhysicsBodyGroup;
12
+ gridCellSize?: number;
13
+ }): PathFinderResult;
14
+ findPathDirection(physicsWorldId: string, startingPosition: Vector, target: Vector | string, collidableWithGroup: PhysicsBodyGroup, gridCellSize?: number): number | undefined;
15
+ }
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PathFinderService = exports.DEFAULT_GRID_CELL_SIZE = void 0;
13
+ const helpers_lib_1 = require("helpers-lib");
14
+ const game_entities_1 = require("../../../../game-entities");
15
+ const physics_body_groups_1 = require("../../../libs/physics-body-groups");
16
+ const physics_entity_1 = require("../../../entity-types/physics-entity");
17
+ const p2js_helper_1 = require("../../../libs/p2js.helper");
18
+ const position_to_grid_position_converter_1 = require("../../../libs/position-to-grid-position-converter");
19
+ const availability_grid_service_1 = require("./availability-grid.service");
20
+ const physics_world_entity_1 = require("../../\uD83E\uDDCAentities/physics-world.entity");
21
+ const utilities_1 = require("../../../../utilities");
22
+ exports.DEFAULT_GRID_CELL_SIZE = 50;
23
+ let PathFinderService = class PathFinderService {
24
+ constructor(physicsAvailabilityGrid) {
25
+ this.physicsAvailabilityGrid = physicsAvailabilityGrid;
26
+ }
27
+ findPathAStar(physicsWorldId, startingPosition, target, options) {
28
+ if (!options) {
29
+ options = {};
30
+ }
31
+ if (options.includeDiagonals === undefined) {
32
+ options.includeDiagonals = false;
33
+ }
34
+ if (options.collidableWithGroup === undefined) {
35
+ options.collidableWithGroup = physics_body_groups_1.PhysicsBodyGroup.none;
36
+ }
37
+ if (options.gridCellSize === undefined) {
38
+ options.gridCellSize = exports.DEFAULT_GRID_CELL_SIZE;
39
+ }
40
+ let physicsWorld = physics_world_entity_1.PhysicsWorldEntity.getInstanceByIdOrFail(physicsWorldId);
41
+ let targetPosition;
42
+ let targetP2Body;
43
+ if (helpers_lib_1.Comparator.isString(target)) {
44
+ let targetEntity = physics_entity_1.PhysicsEntity.getPhysicsInstanceOrFail(target);
45
+ targetP2Body = targetEntity['p2Body'];
46
+ targetPosition = p2js_helper_1.P2JSHelper.arrayToVector(targetP2Body.position);
47
+ }
48
+ else {
49
+ targetPosition = target;
50
+ }
51
+ let startingGridPosition = position_to_grid_position_converter_1.PositionToGridPositionConverter.positionToGridPosition(startingPosition, options.gridCellSize);
52
+ let targetGridPosition = position_to_grid_position_converter_1.PositionToGridPositionConverter.positionToGridPosition(targetPosition, options.gridCellSize);
53
+ let availabilityGrid = this.physicsAvailabilityGrid.getAvilabilityGrid(physicsWorld, options.gridCellSize, options.collidableWithGroup);
54
+ if (targetP2Body) {
55
+ let boundingBox = p2js_helper_1.P2JSHelper.aabbToBoundingBox(targetP2Body.aabb);
56
+ let gridSpaceBoundingBox = position_to_grid_position_converter_1.PositionToGridPositionConverter.areaToGridArea(boundingBox, options.gridCellSize);
57
+ availabilityGrid.safeSetArea(gridSpaceBoundingBox, true);
58
+ }
59
+ let result = utilities_1.PathFinder.findPath(availabilityGrid, startingGridPosition, targetGridPosition, {
60
+ includeDiagonals: options.includeDiagonals
61
+ });
62
+ result.path = result.path.map(gridPosition => position_to_grid_position_converter_1.PositionToGridPositionConverter.gridPositionToPosition(gridPosition, options.gridCellSize));
63
+ return result;
64
+ }
65
+ findPathDirection(physicsWorldId, startingPosition, target, collidableWithGroup, gridCellSize = exports.DEFAULT_GRID_CELL_SIZE) {
66
+ let physicsWorld = physics_world_entity_1.PhysicsWorldEntity.getInstanceByIdOrFail(physicsWorldId);
67
+ let targetArea;
68
+ if (helpers_lib_1.Comparator.isString(target)) {
69
+ let targetEntity = physics_entity_1.PhysicsEntity.getPhysicsInstanceOrFail(target);
70
+ targetArea = p2js_helper_1.P2JSHelper.aabbToBoundingBox(targetEntity['p2Body'].aabb);
71
+ }
72
+ else {
73
+ targetArea = new helpers_lib_1.Rectangle(target, target);
74
+ }
75
+ let targetGridArea = position_to_grid_position_converter_1.PositionToGridPositionConverter.areaToGridArea(targetArea, gridCellSize);
76
+ let cacheName = JSON.stringify({ targetGridArea, collidableWithGroup });
77
+ let vectorField = physicsWorld.vectorFieldCache.get(cacheName);
78
+ if (!vectorField) {
79
+ let availabilityGrid = this.physicsAvailabilityGrid.getAvilabilityGrid(physicsWorld, gridCellSize, collidableWithGroup);
80
+ vectorField = new utilities_1.VectorFieldPathFinder(targetGridArea, availabilityGrid);
81
+ physicsWorld.vectorFieldCache.set(cacheName, vectorField);
82
+ }
83
+ let startingGridPosition = position_to_grid_position_converter_1.PositionToGridPositionConverter.positionToGridPosition(startingPosition, gridCellSize);
84
+ return vectorField.getDirectionToTarget(startingGridPosition);
85
+ }
86
+ };
87
+ exports.PathFinderService = PathFinderService;
88
+ exports.PathFinderService = PathFinderService = __decorate([
89
+ (0, game_entities_1.ServiceDecorator)(),
90
+ __metadata("design:paramtypes", [availability_grid_service_1.AvailabilityGridService])
91
+ ], PathFinderService);
92
+ //# sourceMappingURL=path-finder.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-finder.service.js","sourceRoot":"","sources":["../../../../../src/physics/module/📐services/path-finding/path-finder.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA4D;AAE5D,6DAA6D;AAC7D,2EAAqE;AACrE,yEAAqE;AACrE,2DAAuD;AACvD,2GAAoG;AACpG,2EAAsE;AACtE,0FAA2E;AAC3E,qDAA4F;AAE/E,QAAA,sBAAsB,GAAG,EAAE,CAAC;AAGlC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,YAAoB,uBAAgD;QAAhD,4BAAuB,GAAvB,uBAAuB,CAAyB;IAAG,CAAC;IAExE,aAAa,CACX,cAAsB,EACtB,gBAAwB,EACxB,MAAuB,EACvB,OAAuG;QAEvG,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;QACD,IAAI,OAAO,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;YAC3C,OAAO,CAAC,gBAAgB,GAAG,KAAK,CAAC;QACnC,CAAC;QACD,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;YAC9C,OAAO,CAAC,mBAAmB,GAAG,sCAAgB,CAAC,IAAI,CAAC;QACtD,CAAC;QACD,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACvC,OAAO,CAAC,YAAY,GAAG,8BAAsB,CAAC;QAChD,CAAC;QAED,IAAI,YAAY,GAAG,yCAAkB,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC;QAE5E,IAAI,cAAsB,CAAC;QAC3B,IAAI,YAAiC,CAAC;QACtC,IAAI,wBAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAChC,IAAI,YAAY,GAAG,8BAAa,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;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IAAA,gCAAgB,GAAE;qCAE4B,mDAAuB;GADzD,iBAAiB,CA2F7B"}
@@ -0,0 +1,9 @@
1
+ import { ActionListenerCallbackFunction, ActionSubscription } from 'actions-lib';
2
+ import { MapSizeDTO } from '../../⚜️gateways';
3
+ export declare class PhysicsQueryService {
4
+ getMapSize(physicsWorldId: string): MapSizeDTO;
5
+ subscribeToPhysicsStep(physicsWorldId: string, callback: ActionListenerCallbackFunction<{
6
+ time: number;
7
+ delta: number;
8
+ }>): ActionSubscription;
9
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.PhysicsQueryService = void 0;
10
+ const game_entities_1 = require("../../../../game-entities");
11
+ const physics_world_entity_1 = require("../../\uD83E\uDDCAentities/physics-world.entity");
12
+ let PhysicsQueryService = class PhysicsQueryService {
13
+ getMapSize(physicsWorldId) {
14
+ let physicsWorld = physics_world_entity_1.PhysicsWorldEntity.getInstanceByIdOrFail(physicsWorldId);
15
+ return { dimentions: physicsWorld.mapSize, center: physicsWorld.mapSizeCenter };
16
+ }
17
+ subscribeToPhysicsStep(physicsWorldId, callback) {
18
+ return physics_world_entity_1.PhysicsWorldEntity.getInstanceByIdOrFail(physicsWorldId).onPhysicsStep.subscribe(callback);
19
+ }
20
+ };
21
+ exports.PhysicsQueryService = PhysicsQueryService;
22
+ exports.PhysicsQueryService = PhysicsQueryService = __decorate([
23
+ (0, game_entities_1.ServiceDecorator)()
24
+ ], PhysicsQueryService);
25
+ //# sourceMappingURL=physics-query.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"physics-query.service.js","sourceRoot":"","sources":["../../../../../src/physics/module/📐services/query/physics-query.service.ts"],"names":[],"mappings":";;;;;;;;;AAEA,6DAA6D;AAE7D,0FAA2E;AAGpE,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,UAAU,CAAC,cAAsB;QAC/B,IAAI,YAAY,GAAG,yCAAkB,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC;QAC5E,OAAO,EAAE,UAAU,EAAE,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,aAAa,EAAE,CAAC;IAClF,CAAC;IAED,sBAAsB,CACpB,cAAsB,EACtB,QAAyE;QAEzE,OAAO,yCAAkB,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACpG,CAAC;CACF,CAAA;AAZY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,gCAAgB,GAAE;GACN,mBAAmB,CAY/B"}
@@ -0,0 +1,9 @@
1
+ import { Line } from 'helpers-lib';
2
+ import { RayCastHit } from '../../⚜️gateways';
3
+ import { PhysicsBodyGroup } from '../../../libs/physics-body-groups';
4
+ import { PhysicsWorldEntity } from '../../🧊entities/physics-world.entity';
5
+ export declare class RayCastingService {
6
+ castClosest(physicsWorld: PhysicsWorldEntity, line: Line, physicsBodyGroup: PhysicsBodyGroup): RayCastHit | undefined;
7
+ castAllFirstContacts(physicsWorld: PhysicsWorldEntity, line: Line, physicsBodyGroup: PhysicsBodyGroup): RayCastHit[];
8
+ private convertP2RaycastResultToRaycastResult;
9
+ }
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RayCastingService = void 0;
13
+ const p2_1 = __importDefault(require("p2"));
14
+ const game_entities_1 = require("../../../../game-entities");
15
+ const p2js_helper_1 = require("../../../libs/p2js.helper");
16
+ const physics_body_groups_1 = require("../../../libs/physics-body-groups");
17
+ let RayCastingService = class RayCastingService {
18
+ castClosest(physicsWorld, line, physicsBodyGroup) {
19
+ let p2RaycastResult = new p2_1.default.RaycastResult();
20
+ let p2Ray = new p2_1.default.Ray({
21
+ mode: p2_1.default.Ray.CLOSEST,
22
+ from: p2js_helper_1.P2JSHelper.vectorToArray(line.from),
23
+ to: p2js_helper_1.P2JSHelper.vectorToArray(line.to),
24
+ collisionGroup: physics_body_groups_1.PhysicsBodyGroups.getGroupConstant(physicsBodyGroup),
25
+ collisionMask: physics_body_groups_1.PhysicsBodyGroups.getMaskConstant(physicsBodyGroup)
26
+ });
27
+ physicsWorld['p2World'].raycast(p2RaycastResult, p2Ray);
28
+ if (p2RaycastResult.hasHit()) {
29
+ let rayCastResult = this.convertP2RaycastResultToRaycastResult(p2RaycastResult, line);
30
+ return rayCastResult;
31
+ }
32
+ }
33
+ castAllFirstContacts(physicsWorld, line, physicsBodyGroup) {
34
+ let p2BodyToClosestRaycastResult = new Map();
35
+ let p2Ray = new p2_1.default.Ray({
36
+ mode: p2_1.default.Ray.ALL,
37
+ from: p2js_helper_1.P2JSHelper.vectorToArray(line.from),
38
+ to: p2js_helper_1.P2JSHelper.vectorToArray(line.to),
39
+ collisionGroup: physics_body_groups_1.PhysicsBodyGroups.getGroupConstant(physicsBodyGroup),
40
+ collisionMask: physics_body_groups_1.PhysicsBodyGroups.getMaskConstant(physicsBodyGroup),
41
+ callback: callbackResult => {
42
+ let previousItem = p2BodyToClosestRaycastResult.get(callbackResult.body);
43
+ if (!p2BodyToClosestRaycastResult.has(callbackResult.body) || callbackResult.fraction < previousItem.fraction) {
44
+ p2BodyToClosestRaycastResult.set(callbackResult.body, this.convertP2RaycastResultToRaycastResult(callbackResult, line));
45
+ }
46
+ else if (callbackResult.fraction === previousItem.fraction && previousItem.isExternal()) {
47
+ // If the raycast starts from inside an object with multiple shapes, there is a chance that first hit is wrongfuly seen as external hit.
48
+ // Therefore, we need to check if the previous hit was external and if the current hit is internal.
49
+ p2BodyToClosestRaycastResult.set(callbackResult.body, this.convertP2RaycastResultToRaycastResult(callbackResult, line));
50
+ }
51
+ }
52
+ });
53
+ physicsWorld['p2World'].raycast(new p2_1.default.RaycastResult(), p2Ray);
54
+ return Array.from(p2BodyToClosestRaycastResult.values());
55
+ }
56
+ convertP2RaycastResultToRaycastResult(p2RaycastResult, line) {
57
+ let fraction = p2RaycastResult.fraction;
58
+ let normal = p2js_helper_1.P2JSHelper.arrayToVector(p2RaycastResult.normal);
59
+ let hitPosition;
60
+ let hitDistance;
61
+ let isExternal;
62
+ return {
63
+ body: p2RaycastResult.body,
64
+ hitPosition: () => {
65
+ if (hitPosition === undefined) {
66
+ hitPosition = line.from.lerp(line.to, fraction);
67
+ }
68
+ return hitPosition;
69
+ },
70
+ hitDistance: () => {
71
+ if (hitDistance === undefined) {
72
+ hitDistance = line.length * fraction;
73
+ }
74
+ return hitDistance;
75
+ },
76
+ isExternal: () => {
77
+ if (isExternal === undefined) {
78
+ isExternal = line.fromTo.dotProduct(normal) < 0;
79
+ }
80
+ return isExternal;
81
+ },
82
+ normal,
83
+ fraction,
84
+ line
85
+ };
86
+ }
87
+ };
88
+ exports.RayCastingService = RayCastingService;
89
+ exports.RayCastingService = RayCastingService = __decorate([
90
+ (0, game_entities_1.ServiceDecorator)()
91
+ ], RayCastingService);
92
+ //# sourceMappingURL=ray-casting.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ray-casting.service.js","sourceRoot":"","sources":["../../../../../src/physics/module/📐services/ray-casting/ray-casting.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAoB;AAIpB,6DAA6D;AAC7D,2DAAuD;AACvD,2EAAwF;AAIjF,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,WAAW,CAAC,YAAgC,EAAE,IAAU,EAAE,gBAAkC;QAC1F,IAAI,eAAe,GAAG,IAAI,YAAE,CAAC,aAAa,EAAE,CAAC;QAC7C,IAAI,KAAK,GAAG,IAAI,YAAE,CAAC,GAAG,CAAC;YACrB,IAAI,EAAE,YAAE,CAAC,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,wBAAU,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;YACzC,EAAE,EAAE,wBAAU,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,cAAc,EAAE,uCAAiB,CAAC,gBAAgB,CAAC,gBAAgB,CAAC;YACpE,aAAa,EAAE,uCAAiB,CAAC,eAAe,CAAC,gBAAgB,CAAC;SACnE,CAAC,CAAC;QAEH,YAAY,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACxD,IAAI,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC;YAC7B,IAAI,aAAa,GAAG,IAAI,CAAC,qCAAqC,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;YAEtF,OAAO,aAAa,CAAC;QACvB,CAAC;IACH,CAAC;IAED,oBAAoB,CAAC,YAAgC,EAAE,IAAU,EAAE,gBAAkC;QACnG,IAAI,4BAA4B,GAAG,IAAI,GAAG,EAAuB,CAAC;QAClE,IAAI,KAAK,GAAG,IAAI,YAAE,CAAC,GAAG,CA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QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC;QACxC,IAAI,MAAM,GAAG,wBAAU,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAE9D,IAAI,WAA+B,CAAC;QACpC,IAAI,WAA+B,CAAC;QACpC,IAAI,UAA+B,CAAC;QAEpC,OAAO;YACL,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,WAAW,EAAE,GAAG,EAAE;gBAChB,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;oBAC9B,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;gBAClD,CAAC;gBACD,OAAO,WAAW,CAAC;YACrB,CAAC;YACD,WAAW,EAAE,GAAG,EAAE;gBAChB,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;oBAC9B,WAAW,GAAG,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;gBACvC,CAAC;gBACD,OAAO,WAAW,CAAC;YACrB,CAAC;YACD,UAAU,EAAE,GAAG,EAAE;gBACf,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;oBAC7B,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAClD,CAAC;gBACD,OAAO,UAAU,CAAC;YACpB,CAAC;YACD,MAAM;YACN,QAAQ;YACR,IAAI;SACL,CAAC;IACJ,CAAC;CACF,CAAA;AA5EY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,gCAAgB,GAAE;GACN,iBAAiB,CA4E7B"}
@@ -0,0 +1,22 @@
1
+ import { RGBColor, Rectangle, Vector } from 'helpers-lib';
2
+ import p2 from 'p2';
3
+ import { AvailabilityGridService } from '../path-finding/availability-grid.service';
4
+ import { PhysicsWorldEntity } from '../../🧊entities/physics-world.entity';
5
+ import { PhysicsBodyGroup } from '../../../libs/physics-body-groups';
6
+ import { PathFinderService } from '../path-finding/path-finder.service';
7
+ import { RayCast } from '../../⚜️gateways';
8
+ export declare class TestVisualsService {
9
+ private availabilityGridService;
10
+ private pathFinderService;
11
+ constructor(availabilityGridService: AvailabilityGridService, pathFinderService: PathFinderService);
12
+ printPathfindingTestGrid(physicsWorldId: string, testLayerId: string, target: Vector | string, physicsBodyGroup: PhysicsBodyGroup, area: Rectangle, gridCellSize: number): void;
13
+ createExplosionDebugVisual(physicsWorld: PhysicsWorldEntity, testLayerId: string, rayCasts: RayCast[], explosionCenter: Vector, radius: number, duration?: number): void;
14
+ createElipticExplosionDebugVisual(physicsWorld: PhysicsWorldEntity, testLayerId: string, rayCasts: RayCast[], explosionCenter: Vector, rotation: number, size: Vector, duration?: number): void;
15
+ createPhysicsEntityShapeVisual(p2Body: p2.Body, testLayerId: string, options?: {
16
+ overridePosition?: Vector;
17
+ overrideRotation?: number;
18
+ color?: RGBColor;
19
+ }): void;
20
+ private drawShape;
21
+ private drawConvexShape;
22
+ }