bard-legends-framework 1.5.2 → 1.6.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/index.d.mts CHANGED
@@ -1,15 +1,27 @@
1
1
  import * as actions_lib from 'actions-lib';
2
- import { IDAttachable, Attachable, AttachmentID, IdleSingleEvent, IdleSequence, Sequence, SingleNotifier, Notifier, SingleEvent, Reducer, Variable, Action, ClassID } from 'actions-lib';
2
+ import { IDAttachable, Attachable, AttachmentID, IdleSingleEvent, IdleSequence, Sequence, SingleNotifier, Notifier, SingleEvent, Variable, Reducer, Action, ClassID, NotifierCallbackFunction, IAttachment } from 'actions-lib';
3
3
  import { Vector, Radian, Rectangle, Vec2, RGBColor, Grid, GridNeighborType, Line } from 'helpers-lib';
4
+ import p2$1 from 'p2';
4
5
  import * as Pixi from 'pixi.js';
5
6
 
6
- declare class ControllerLink {
7
- trigger<T>(functionName: string, ...args: any[]): T;
8
- }
9
- interface ControllerDecoratorMeta {
10
- controllerLink: ControllerLink;
11
- }
12
- declare function ControllerDecorator(meta: ControllerDecoratorMeta): (ControllerClass: any) => any;
7
+ /**
8
+ * Binds a controller to its gateway (the class produced by `Gateway<T>()`). The controller must
9
+ * structurally match the gateway's controller type, so wiring the wrong controller to a gateway is
10
+ * a compile error.
11
+ *
12
+ * The controller is instantiated now — its constructor dependencies are resolved through the DI
13
+ * container and its methods are bound straight onto the gateway prototype, so a later
14
+ * `gateway.method(...)` is a direct call into the controller with no proxy and no per-call lookup.
15
+ *
16
+ * ```ts
17
+ * @ControllerDecorator(SampleGateway)
18
+ * export class SampleController {
19
+ * constructor(private store: SampleStore) {}
20
+ * ...
21
+ * }
22
+ * ```
23
+ */
24
+ declare function ControllerDecorator<TController>(gateway: new () => TController): (ControllerClass: new (...args: any[]) => TController) => void;
13
25
 
14
26
  type EntityClassType<T extends Entity = Entity> = (new (...args: any[]) => T) & {
15
27
  id: number;
@@ -40,6 +52,30 @@ declare abstract class SingletonEntity extends Entity {
40
52
  constructor();
41
53
  }
42
54
 
55
+ /**
56
+ * Base class factory for a module's public Gateway. Use it as:
57
+ *
58
+ * ```ts
59
+ * @ServiceDecorator()
60
+ * export class SampleGateway extends Gateway<SampleController>() {}
61
+ * ```
62
+ *
63
+ * The gateway body stays empty:
64
+ * - its instance type is its Controller, so calls are type-checked against the controller and
65
+ * "go to definition" / F12 jumps straight to the controller method;
66
+ * - its methods are installed once, at registration time, by `@ControllerDecorator(ThisGateway)`,
67
+ * as bound references to the controller's methods (see `bindControllerToGateway`).
68
+ *
69
+ * The controller is referenced here only as a *type* (`Gateway<SampleController>()`), so importing
70
+ * a gateway never pulls in its controller. That keeps two modules that use each other's gateways
71
+ * free of import/injection cycles: the gateway is a dependency-free runtime sink.
72
+ *
73
+ * Performance: there is no Proxy and no per-call dispatch table. After registration a call is a
74
+ * prototype-method lookup (monomorphic, inline-cacheable) plus one bound-function call into the
75
+ * controller — effectively a direct method call.
76
+ */
77
+ declare function Gateway<TController>(): new () => TController;
78
+
43
79
  declare class BardLegendsHardReset {
44
80
  static readonly onHardReset: actions_lib.Notifier<void>;
45
81
  static hardReset(): void;
@@ -711,6 +747,29 @@ declare class ScrollMaskUI extends Container {
711
747
  constructor(container: Container, size: Vector, padding: number, direction?: ScrollDirection);
712
748
  }
713
749
 
750
+ interface FocusingNewTargetInfo {
751
+ time: number;
752
+ duration: number;
753
+ position: Vector;
754
+ roundPosition: boolean;
755
+ roundPositionThreshold: number;
756
+ focusingAnimation: FocusingAnimation;
757
+ }
758
+ declare class CameraEntity extends SingletonEntity {
759
+ readonly position: Variable<Vector>;
760
+ readonly offset: Variable<Vector>;
761
+ readonly targetPosition: Variable<Vector | undefined>;
762
+ readonly focusingNewTargetInfo: Variable<FocusingNewTargetInfo | undefined>;
763
+ }
764
+
765
+ declare class CameraService {
766
+ createCamera(): CameraEntity;
767
+ getCameraPosition(): Vector;
768
+ setPosition(position: Vector): void;
769
+ setTransition(options: FocusingOptions): void;
770
+ update(time: number, delta: number): void;
771
+ }
772
+
714
773
  declare enum CameraLayer {
715
774
  BackgroundScreen = "backgroundScreen",
716
775
  Background = "background",
@@ -731,14 +790,19 @@ interface FocusingOptions {
731
790
  }
732
791
  type CameraAppearTransitionType = 'alpha' | 'pureBlack' | 'instant';
733
792
 
734
- declare class CameraGateway {
735
- createCamera(): string;
793
+ declare class CameraController {
794
+ constructor(_cameraService: CameraService);
795
+ createCamera(): number;
736
796
  update(time: number, delta: number): void;
737
797
  setPosition(position: Vector): void;
738
798
  setTransition(options: FocusingOptions): void;
739
799
  getCameraPosition(): Vector;
740
800
  }
741
801
 
802
+ declare const CameraGateway_base: new () => CameraController;
803
+ declare class CameraGateway extends CameraGateway_base {
804
+ }
805
+
742
806
  declare class Camera {
743
807
  readonly layers: Record<CameraLayer, number>;
744
808
  get position(): Vector;
@@ -995,7 +1059,147 @@ interface MapSizeDTO {
995
1059
  readonly center: Vector;
996
1060
  }
997
1061
 
998
- declare class PhysicsGateway {
1062
+ declare class PhysicsWorldEntity extends Entity {
1063
+ readonly mapSize: Vector;
1064
+ readonly mapSizeCenter: Vector;
1065
+ readonly modifyUpdateCycle: boolean;
1066
+ readonly p2World: p2$1.World;
1067
+ readonly materials: Readonly<Map<string, p2$1.Material>>;
1068
+ readonly materialDefinitions: Map<string, MaterialDefinition>;
1069
+ readonly physicsBodyGroupToP2Group: Map<string, number>;
1070
+ readonly physicsBodyGroupToP2Mask: Map<string, number>;
1071
+ readonly availabilityGridCache: Map<number, Map<PhysicsBodyGroup, Grid<boolean>>>;
1072
+ readonly vectorFieldCache: Map<string, VectorFieldPathFinder>;
1073
+ readonly bodiesInContactWith: Map<number, {
1074
+ p2Body: p2$1.Body;
1075
+ entity: PhysicsEntity;
1076
+ }>;
1077
+ readonly collisionReports: Map<number, CollisionReport[]>;
1078
+ readonly paused: Variable<boolean>;
1079
+ readonly lastP2Time: Variable<number>;
1080
+ readonly onPhysicsStep: Action<{
1081
+ time: number;
1082
+ delta: number;
1083
+ }>;
1084
+ constructor(mapSize: Vector, modifyUpdateCycle: boolean, p2World: p2$1.World, materials: Map<string, p2$1.Material>, materialContactDefinitions: Map<string, MaterialDefinition>, physicsBodyGroupToP2Group: Map<PhysicsBodyGroup, number>, physicsBodyGroupToP2Mask: Map<PhysicsBodyGroup, number>);
1085
+ }
1086
+
1087
+ declare class PhysicsBodyGroupService {
1088
+ createBodyGroupsAndMasks(physicsBodyGroups: readonly PhysicsBodyGroup[], interactingBodyGroups: InteractingBodyGroups): {
1089
+ readonly physicsBodyGroupToP2Group: Map<PhysicsBodyGroup, number>;
1090
+ readonly physicsBodyGroupToP2Mask: Map<PhysicsBodyGroup, number>;
1091
+ };
1092
+ getGroupConstant(physicsWorldID: number, group: PhysicsBodyGroup): number;
1093
+ getMaskConstant(physicsWorldID: number, group: PhysicsBodyGroup): number;
1094
+ canCollide(physicsWorld: PhysicsWorldEntity, groupType1: PhysicsBodyGroup, groupType2: PhysicsBodyGroup): boolean;
1095
+ }
1096
+
1097
+ declare class AvailabilityGridCacheService {
1098
+ constructor(_physicsBodyGroupService: PhysicsBodyGroupService);
1099
+ getCollidableGrids(physicsWorld: PhysicsWorldEntity, physicsBodyGroup: PhysicsBodyGroup): {
1100
+ grid: Grid<boolean>;
1101
+ cellSize: number;
1102
+ }[];
1103
+ get(physicsWorld: PhysicsWorldEntity, cellSize: number, group: PhysicsBodyGroup): Grid<boolean> | undefined;
1104
+ set(physicsWorld: PhysicsWorldEntity, cellSize: number, group: PhysicsBodyGroup, grid: Grid<boolean>): void;
1105
+ clear(physicsWorld: PhysicsWorldEntity): void;
1106
+ }
1107
+
1108
+ declare class AvailabilityGridService {
1109
+ constructor(_physicsBodyGroupService: PhysicsBodyGroupService, _availabilityGridCacheService: AvailabilityGridCacheService);
1110
+ onBodyAdded(physicsWorld: PhysicsWorldEntity, body: p2.Body, physicsBodyGroup: PhysicsBodyGroup): void;
1111
+ findClosestAvailableSpace(physicsWorld: PhysicsWorldEntity, body: p2.Body, physicsBodyGroup: PhysicsBodyGroup, gridCellSize?: number): Vector | undefined;
1112
+ getAvilabilityGrid(physicsWorld: PhysicsWorldEntity, cellSize: number, physicsBodyGroup: PhysicsBodyGroup): Grid<boolean>;
1113
+ }
1114
+
1115
+ declare class PathFinderService {
1116
+ constructor(_physicsAvailabilityGrid: AvailabilityGridService);
1117
+ findPathAStar(physicsWorldID: number, startingPosition: Vector, target: Vector | number, collidableWithGroup: PhysicsBodyGroup, options?: {
1118
+ neighborType?: GridNeighborType;
1119
+ gridCellSize?: number;
1120
+ }): PathFinderResult;
1121
+ findPathDirection(physicsWorldID: number, startingPosition: Vector, target: Vector | number, collidableWithGroup: PhysicsBodyGroup, gridCellSize?: number): Radian | undefined;
1122
+ }
1123
+
1124
+ declare class TestVisualsService {
1125
+ constructor(_availabilityGridService: AvailabilityGridService, _pathFinderService: PathFinderService);
1126
+ printPathfindingTestGrid(physicsWorldID: number, testLayerID: number, target: Vector | number, physicsBodyGroup: PhysicsBodyGroup, area: Rectangle, gridCellSize: number): void;
1127
+ createExplosionDebugVisual(physicsWorld: PhysicsWorldEntity, testLayerID: number, rayCasts: RayCast[], explosionCenter: Vector, radius: number, duration?: number): void;
1128
+ createElipticExplosionDebugVisual(physicsWorld: PhysicsWorldEntity, testLayerID: number, rayCasts: RayCast[], explosionCenter: Vector, rotation: Radian, size: Vector, duration?: number): void;
1129
+ createPhysicsEntityShapeVisual(p2Body: p2$1.Body, testLayerID: number, options?: {
1130
+ overridePosition?: Vector | undefined;
1131
+ overrideRotation?: Radian | undefined;
1132
+ color?: RGBColor | undefined;
1133
+ }): void;
1134
+ }
1135
+
1136
+ declare class HitTestService {
1137
+ constructor(_testVisualsService: TestVisualsService);
1138
+ hitTest(p2Body: p2$1.Body, options?: Partial<HitTestOptions>): boolean;
1139
+ }
1140
+
1141
+ declare class CollisionsService {
1142
+ registerPhysicsWorld(physicsWorld: PhysicsWorldEntity): void;
1143
+ step(physicsWorld: PhysicsWorldEntity, time: number, delta: number): void;
1144
+ }
1145
+
1146
+ declare class BorderService {
1147
+ createBorders(physicsWorldID: AttachmentID, mapSize: Vector, borderBodyGroup: PhysicsBodyGroup): void;
1148
+ }
1149
+
1150
+ declare class MaterialsService {
1151
+ createMaterials(p2World: p2$1.World, borderProperties: BorderProperties, materialDefinitions: readonly MaterialDefinition[], materialContactDefinitions: readonly MaterialContactDefinition[]): {
1152
+ materials: Map<string, p2$1.Material>;
1153
+ materialDefinitions: Map<string, MaterialDefinition>;
1154
+ };
1155
+ getMaterial(physicsWorldID: number, name: string): p2$1.Material;
1156
+ getMaterialDefinition(physicsWorldID: number, name: string): MaterialDefinition;
1157
+ }
1158
+
1159
+ declare class PhysicsWorldService {
1160
+ constructor(_materialsService: MaterialsService, _borderService: BorderService, _availabilityGridService: AvailabilityGridService, _collisionsService: CollisionsService, _physicsBodyGroupService: PhysicsBodyGroupService);
1161
+ createPhysicsWorld(request: CreatePhysicsWorldRequestDTO): number;
1162
+ addBody(physicsWorldID: number, body: p2$1.Body, addInEmptySpace: boolean, physicsBodyGroup: PhysicsBodyGroup, includeOnPathfinding: boolean): boolean;
1163
+ removeBody(physicsWorldID: number, body: p2$1.Body): void;
1164
+ setPaused(pause: boolean, physicsWorldID: number): void;
1165
+ }
1166
+
1167
+ declare class RayCastingService {
1168
+ castClosest(physicsWorld: PhysicsWorldEntity, line: Line, physicsBodyGroup: PhysicsBodyGroup): RayCastHit | undefined;
1169
+ castAllFirstContacts(physicsWorld: PhysicsWorldEntity, line: Line, physicsBodyGroup: PhysicsBodyGroup): RayCastHit[];
1170
+ }
1171
+
1172
+ declare class ImpactService {
1173
+ applyImpulse(body: p2.Body, hitPosition: Vector, hitDirection: Vector, severity: number): void;
1174
+ }
1175
+
1176
+ interface ExplosionHitWithP2Body extends ExplosionHit {
1177
+ p2Body: p2.Body;
1178
+ }
1179
+ declare class RayCastHitConverterService {
1180
+ toExplosionHits(rayCasts: RayCast[], allRaysStartingFromSamePosition?: boolean): ExplosionHitWithP2Body[];
1181
+ }
1182
+
1183
+ declare class ElipticExplosionService {
1184
+ constructor(_rayCastingService: RayCastingService, _testVisualsService: TestVisualsService, _rayCastHitConverterService: RayCastHitConverterService, _impactService: ImpactService);
1185
+ createElipticExplosion(physicsWorldID: number, explosionCenter: Vector, rotation: Radian, size: Vector, physicsBodyGroup: PhysicsBodyGroup, severity: number, options?: PhysicsExplosionOptions): ExplosionHit[];
1186
+ }
1187
+
1188
+ declare class ExplosionService {
1189
+ constructor(_rayCastingService: RayCastingService, _testVisualsService: TestVisualsService, _rayCastHitConverterService: RayCastHitConverterService, _impactService: ImpactService);
1190
+ createExplosion(physicsWorldID: number, explosionCenter: Vector, radius: number, physicsBodyGroup: PhysicsBodyGroup, severity: number, options?: PhysicsExplosionOptions): ExplosionHit[];
1191
+ }
1192
+
1193
+ declare class PhysicsQueryService {
1194
+ getMapSize(physicsWorldID: number): MapSizeDTO;
1195
+ subscribeToPhysicsStep(physicsWorldID: number, callback: NotifierCallbackFunction<{
1196
+ time: number;
1197
+ delta: number;
1198
+ }>): IAttachment;
1199
+ }
1200
+
1201
+ declare class PhysicsController {
1202
+ constructor(_physicsWorldService: PhysicsWorldService, _pathFinderService: PathFinderService, _testVisualsService: TestVisualsService, _explosionService: ExplosionService, _elipticExplosionService: ElipticExplosionService, _hitTestService: HitTestService, _physicsQueryService: PhysicsQueryService, _impactService: ImpactService);
999
1203
  createPhysicsWorld(request: CreatePhysicsWorldRequestDTO): number;
1000
1204
  getMapSize(physicsWorldID: number): MapSizeDTO;
1001
1205
  setPaused(pause: boolean, physicsWorldID: number): void;
@@ -1008,4 +1212,8 @@ declare class PhysicsGateway {
1008
1212
  printPathfindingTestGrid(physicsWorldID: number, testLayerID: number, target: Vector | number, physicsBodyGroup: PhysicsBodyGroup, area: Rectangle, gridCellSize?: number): void;
1009
1213
  }
1010
1214
 
1011
- export { AnimationFlicker, AnimationInterpolationFunctions, type AnimationOptions, Animations, AnimationsCompletionHandlingType, Animator, type AnimatorAnimation, type AssetDefinition, BORDER_MATERIAL_NAME, BardLegendsHardReset, BlendMode, type BorderProperties, Camera, CameraGateway, type CircleShapeData, ClosestAvailableSpaceHelper, type CollisionDetails, type CollisionReport, Container, ContainerEventType, ControllerDecorator, type ControllerDecoratorMeta, ControllerLink, type CreateDashedLineOptions, type CreatePhysicsWorldRequestDTO, Cursor, DEFAULT_SHADER_RESOLUTION, DeltaTime, DisplayObjectArray, type DisplayObjectArrayOptions, type DropShadowOptions, Entity, EntityDecorator, type ExplosionHit, FadeInContent, type FadeInContentOptions, FadeInStateAnimation, FocusingAnimation, Game, type GlowEffectOptions, type GlowOptions, type GlowingShapeDefinition, Graphics, type HitTestOptions, ImmovablePhysicsEntity, type InteractingBodyGroups, type KeyboardKeyInfo, KeyboardService, type MapSizeDTO, type MaterialContactDefinition, type MaterialDefinition, MenuEntity, type MenuOptions, MenuUI, MenuView, MouseService, MouseTargetFocusService, MovableEntity, MovablePhysicsEntity, type PartialTextOptions, PathFinder, type PathFinderResult, type PhysicsBodyDTO, PhysicsEntity, type PhysicsEntityDefinition, type PhysicsExplosionOptions, PhysicsGateway, PhysicsShapeType, Placeholder, type PolygonDefinition, type PolygonShapeData, PositionConversionHelper, ROTATIONAL_SPEED_LIMIT, type RayCast, type RayCastHit, ReAnimateHandlingType, type RectangleShapeData, RichText, type RichTextOptions, type RichTextRectangleCut, type RichTextStyles, SPEED_LIMIT, Scene, SceneDecorator, ScrollAreaUI, ScrollDirection, type ScrollInContentOptions, ScrollMaskUI, Service, ServiceDecorator, type SetParentOptions, type ShapeDefinition, SingletonEntity, SlideInContent, SlideInContentByIndex, SlideStateAnimation, SlideStateAnimationState, Sprite, type SpriteDefinition, StateAnimation, type StateAnimationOptions, Text, type TextAlignment, type TextOptions, UpdatableContainer, UpdateCycle, VectorFieldPathFinder, VectorSet, View, ViewDecorator, type ViewDecoratorMeta };
1215
+ declare const PhysicsGateway_base: new () => PhysicsController;
1216
+ declare class PhysicsGateway extends PhysicsGateway_base {
1217
+ }
1218
+
1219
+ export { AnimationFlicker, AnimationInterpolationFunctions, type AnimationOptions, Animations, AnimationsCompletionHandlingType, Animator, type AnimatorAnimation, type AssetDefinition, BORDER_MATERIAL_NAME, BardLegendsHardReset, BlendMode, type BorderProperties, Camera, CameraGateway, type CircleShapeData, ClosestAvailableSpaceHelper, type CollisionDetails, type CollisionReport, Container, ContainerEventType, ControllerDecorator, type CreateDashedLineOptions, type CreatePhysicsWorldRequestDTO, Cursor, DEFAULT_SHADER_RESOLUTION, DeltaTime, DisplayObjectArray, type DisplayObjectArrayOptions, type DropShadowOptions, Entity, EntityDecorator, type ExplosionHit, FadeInContent, type FadeInContentOptions, FadeInStateAnimation, FocusingAnimation, Game, Gateway, type GlowEffectOptions, type GlowOptions, type GlowingShapeDefinition, Graphics, type HitTestOptions, ImmovablePhysicsEntity, type InteractingBodyGroups, type KeyboardKeyInfo, KeyboardService, type MapSizeDTO, type MaterialContactDefinition, type MaterialDefinition, MenuEntity, type MenuOptions, MenuUI, MenuView, MouseService, MouseTargetFocusService, MovableEntity, MovablePhysicsEntity, type PartialTextOptions, PathFinder, type PathFinderResult, type PhysicsBodyDTO, PhysicsEntity, type PhysicsEntityDefinition, type PhysicsExplosionOptions, PhysicsGateway, PhysicsShapeType, Placeholder, type PolygonDefinition, type PolygonShapeData, PositionConversionHelper, ROTATIONAL_SPEED_LIMIT, type RayCast, type RayCastHit, ReAnimateHandlingType, type RectangleShapeData, RichText, type RichTextOptions, type RichTextRectangleCut, type RichTextStyles, SPEED_LIMIT, Scene, SceneDecorator, ScrollAreaUI, ScrollDirection, type ScrollInContentOptions, ScrollMaskUI, Service, ServiceDecorator, type SetParentOptions, type ShapeDefinition, SingletonEntity, SlideInContent, SlideInContentByIndex, SlideStateAnimation, SlideStateAnimationState, Sprite, type SpriteDefinition, StateAnimation, type StateAnimationOptions, Text, type TextAlignment, type TextOptions, UpdatableContainer, UpdateCycle, VectorFieldPathFinder, VectorSet, View, ViewDecorator, type ViewDecoratorMeta };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,27 @@
1
1
  import * as actions_lib from 'actions-lib';
2
- import { IDAttachable, Attachable, AttachmentID, IdleSingleEvent, IdleSequence, Sequence, SingleNotifier, Notifier, SingleEvent, Reducer, Variable, Action, ClassID } from 'actions-lib';
2
+ import { IDAttachable, Attachable, AttachmentID, IdleSingleEvent, IdleSequence, Sequence, SingleNotifier, Notifier, SingleEvent, Variable, Reducer, Action, ClassID, NotifierCallbackFunction, IAttachment } from 'actions-lib';
3
3
  import { Vector, Radian, Rectangle, Vec2, RGBColor, Grid, GridNeighborType, Line } from 'helpers-lib';
4
+ import p2$1 from 'p2';
4
5
  import * as Pixi from 'pixi.js';
5
6
 
6
- declare class ControllerLink {
7
- trigger<T>(functionName: string, ...args: any[]): T;
8
- }
9
- interface ControllerDecoratorMeta {
10
- controllerLink: ControllerLink;
11
- }
12
- declare function ControllerDecorator(meta: ControllerDecoratorMeta): (ControllerClass: any) => any;
7
+ /**
8
+ * Binds a controller to its gateway (the class produced by `Gateway<T>()`). The controller must
9
+ * structurally match the gateway's controller type, so wiring the wrong controller to a gateway is
10
+ * a compile error.
11
+ *
12
+ * The controller is instantiated now — its constructor dependencies are resolved through the DI
13
+ * container and its methods are bound straight onto the gateway prototype, so a later
14
+ * `gateway.method(...)` is a direct call into the controller with no proxy and no per-call lookup.
15
+ *
16
+ * ```ts
17
+ * @ControllerDecorator(SampleGateway)
18
+ * export class SampleController {
19
+ * constructor(private store: SampleStore) {}
20
+ * ...
21
+ * }
22
+ * ```
23
+ */
24
+ declare function ControllerDecorator<TController>(gateway: new () => TController): (ControllerClass: new (...args: any[]) => TController) => void;
13
25
 
14
26
  type EntityClassType<T extends Entity = Entity> = (new (...args: any[]) => T) & {
15
27
  id: number;
@@ -40,6 +52,30 @@ declare abstract class SingletonEntity extends Entity {
40
52
  constructor();
41
53
  }
42
54
 
55
+ /**
56
+ * Base class factory for a module's public Gateway. Use it as:
57
+ *
58
+ * ```ts
59
+ * @ServiceDecorator()
60
+ * export class SampleGateway extends Gateway<SampleController>() {}
61
+ * ```
62
+ *
63
+ * The gateway body stays empty:
64
+ * - its instance type is its Controller, so calls are type-checked against the controller and
65
+ * "go to definition" / F12 jumps straight to the controller method;
66
+ * - its methods are installed once, at registration time, by `@ControllerDecorator(ThisGateway)`,
67
+ * as bound references to the controller's methods (see `bindControllerToGateway`).
68
+ *
69
+ * The controller is referenced here only as a *type* (`Gateway<SampleController>()`), so importing
70
+ * a gateway never pulls in its controller. That keeps two modules that use each other's gateways
71
+ * free of import/injection cycles: the gateway is a dependency-free runtime sink.
72
+ *
73
+ * Performance: there is no Proxy and no per-call dispatch table. After registration a call is a
74
+ * prototype-method lookup (monomorphic, inline-cacheable) plus one bound-function call into the
75
+ * controller — effectively a direct method call.
76
+ */
77
+ declare function Gateway<TController>(): new () => TController;
78
+
43
79
  declare class BardLegendsHardReset {
44
80
  static readonly onHardReset: actions_lib.Notifier<void>;
45
81
  static hardReset(): void;
@@ -711,6 +747,29 @@ declare class ScrollMaskUI extends Container {
711
747
  constructor(container: Container, size: Vector, padding: number, direction?: ScrollDirection);
712
748
  }
713
749
 
750
+ interface FocusingNewTargetInfo {
751
+ time: number;
752
+ duration: number;
753
+ position: Vector;
754
+ roundPosition: boolean;
755
+ roundPositionThreshold: number;
756
+ focusingAnimation: FocusingAnimation;
757
+ }
758
+ declare class CameraEntity extends SingletonEntity {
759
+ readonly position: Variable<Vector>;
760
+ readonly offset: Variable<Vector>;
761
+ readonly targetPosition: Variable<Vector | undefined>;
762
+ readonly focusingNewTargetInfo: Variable<FocusingNewTargetInfo | undefined>;
763
+ }
764
+
765
+ declare class CameraService {
766
+ createCamera(): CameraEntity;
767
+ getCameraPosition(): Vector;
768
+ setPosition(position: Vector): void;
769
+ setTransition(options: FocusingOptions): void;
770
+ update(time: number, delta: number): void;
771
+ }
772
+
714
773
  declare enum CameraLayer {
715
774
  BackgroundScreen = "backgroundScreen",
716
775
  Background = "background",
@@ -731,14 +790,19 @@ interface FocusingOptions {
731
790
  }
732
791
  type CameraAppearTransitionType = 'alpha' | 'pureBlack' | 'instant';
733
792
 
734
- declare class CameraGateway {
735
- createCamera(): string;
793
+ declare class CameraController {
794
+ constructor(_cameraService: CameraService);
795
+ createCamera(): number;
736
796
  update(time: number, delta: number): void;
737
797
  setPosition(position: Vector): void;
738
798
  setTransition(options: FocusingOptions): void;
739
799
  getCameraPosition(): Vector;
740
800
  }
741
801
 
802
+ declare const CameraGateway_base: new () => CameraController;
803
+ declare class CameraGateway extends CameraGateway_base {
804
+ }
805
+
742
806
  declare class Camera {
743
807
  readonly layers: Record<CameraLayer, number>;
744
808
  get position(): Vector;
@@ -995,7 +1059,147 @@ interface MapSizeDTO {
995
1059
  readonly center: Vector;
996
1060
  }
997
1061
 
998
- declare class PhysicsGateway {
1062
+ declare class PhysicsWorldEntity extends Entity {
1063
+ readonly mapSize: Vector;
1064
+ readonly mapSizeCenter: Vector;
1065
+ readonly modifyUpdateCycle: boolean;
1066
+ readonly p2World: p2$1.World;
1067
+ readonly materials: Readonly<Map<string, p2$1.Material>>;
1068
+ readonly materialDefinitions: Map<string, MaterialDefinition>;
1069
+ readonly physicsBodyGroupToP2Group: Map<string, number>;
1070
+ readonly physicsBodyGroupToP2Mask: Map<string, number>;
1071
+ readonly availabilityGridCache: Map<number, Map<PhysicsBodyGroup, Grid<boolean>>>;
1072
+ readonly vectorFieldCache: Map<string, VectorFieldPathFinder>;
1073
+ readonly bodiesInContactWith: Map<number, {
1074
+ p2Body: p2$1.Body;
1075
+ entity: PhysicsEntity;
1076
+ }>;
1077
+ readonly collisionReports: Map<number, CollisionReport[]>;
1078
+ readonly paused: Variable<boolean>;
1079
+ readonly lastP2Time: Variable<number>;
1080
+ readonly onPhysicsStep: Action<{
1081
+ time: number;
1082
+ delta: number;
1083
+ }>;
1084
+ constructor(mapSize: Vector, modifyUpdateCycle: boolean, p2World: p2$1.World, materials: Map<string, p2$1.Material>, materialContactDefinitions: Map<string, MaterialDefinition>, physicsBodyGroupToP2Group: Map<PhysicsBodyGroup, number>, physicsBodyGroupToP2Mask: Map<PhysicsBodyGroup, number>);
1085
+ }
1086
+
1087
+ declare class PhysicsBodyGroupService {
1088
+ createBodyGroupsAndMasks(physicsBodyGroups: readonly PhysicsBodyGroup[], interactingBodyGroups: InteractingBodyGroups): {
1089
+ readonly physicsBodyGroupToP2Group: Map<PhysicsBodyGroup, number>;
1090
+ readonly physicsBodyGroupToP2Mask: Map<PhysicsBodyGroup, number>;
1091
+ };
1092
+ getGroupConstant(physicsWorldID: number, group: PhysicsBodyGroup): number;
1093
+ getMaskConstant(physicsWorldID: number, group: PhysicsBodyGroup): number;
1094
+ canCollide(physicsWorld: PhysicsWorldEntity, groupType1: PhysicsBodyGroup, groupType2: PhysicsBodyGroup): boolean;
1095
+ }
1096
+
1097
+ declare class AvailabilityGridCacheService {
1098
+ constructor(_physicsBodyGroupService: PhysicsBodyGroupService);
1099
+ getCollidableGrids(physicsWorld: PhysicsWorldEntity, physicsBodyGroup: PhysicsBodyGroup): {
1100
+ grid: Grid<boolean>;
1101
+ cellSize: number;
1102
+ }[];
1103
+ get(physicsWorld: PhysicsWorldEntity, cellSize: number, group: PhysicsBodyGroup): Grid<boolean> | undefined;
1104
+ set(physicsWorld: PhysicsWorldEntity, cellSize: number, group: PhysicsBodyGroup, grid: Grid<boolean>): void;
1105
+ clear(physicsWorld: PhysicsWorldEntity): void;
1106
+ }
1107
+
1108
+ declare class AvailabilityGridService {
1109
+ constructor(_physicsBodyGroupService: PhysicsBodyGroupService, _availabilityGridCacheService: AvailabilityGridCacheService);
1110
+ onBodyAdded(physicsWorld: PhysicsWorldEntity, body: p2.Body, physicsBodyGroup: PhysicsBodyGroup): void;
1111
+ findClosestAvailableSpace(physicsWorld: PhysicsWorldEntity, body: p2.Body, physicsBodyGroup: PhysicsBodyGroup, gridCellSize?: number): Vector | undefined;
1112
+ getAvilabilityGrid(physicsWorld: PhysicsWorldEntity, cellSize: number, physicsBodyGroup: PhysicsBodyGroup): Grid<boolean>;
1113
+ }
1114
+
1115
+ declare class PathFinderService {
1116
+ constructor(_physicsAvailabilityGrid: AvailabilityGridService);
1117
+ findPathAStar(physicsWorldID: number, startingPosition: Vector, target: Vector | number, collidableWithGroup: PhysicsBodyGroup, options?: {
1118
+ neighborType?: GridNeighborType;
1119
+ gridCellSize?: number;
1120
+ }): PathFinderResult;
1121
+ findPathDirection(physicsWorldID: number, startingPosition: Vector, target: Vector | number, collidableWithGroup: PhysicsBodyGroup, gridCellSize?: number): Radian | undefined;
1122
+ }
1123
+
1124
+ declare class TestVisualsService {
1125
+ constructor(_availabilityGridService: AvailabilityGridService, _pathFinderService: PathFinderService);
1126
+ printPathfindingTestGrid(physicsWorldID: number, testLayerID: number, target: Vector | number, physicsBodyGroup: PhysicsBodyGroup, area: Rectangle, gridCellSize: number): void;
1127
+ createExplosionDebugVisual(physicsWorld: PhysicsWorldEntity, testLayerID: number, rayCasts: RayCast[], explosionCenter: Vector, radius: number, duration?: number): void;
1128
+ createElipticExplosionDebugVisual(physicsWorld: PhysicsWorldEntity, testLayerID: number, rayCasts: RayCast[], explosionCenter: Vector, rotation: Radian, size: Vector, duration?: number): void;
1129
+ createPhysicsEntityShapeVisual(p2Body: p2$1.Body, testLayerID: number, options?: {
1130
+ overridePosition?: Vector | undefined;
1131
+ overrideRotation?: Radian | undefined;
1132
+ color?: RGBColor | undefined;
1133
+ }): void;
1134
+ }
1135
+
1136
+ declare class HitTestService {
1137
+ constructor(_testVisualsService: TestVisualsService);
1138
+ hitTest(p2Body: p2$1.Body, options?: Partial<HitTestOptions>): boolean;
1139
+ }
1140
+
1141
+ declare class CollisionsService {
1142
+ registerPhysicsWorld(physicsWorld: PhysicsWorldEntity): void;
1143
+ step(physicsWorld: PhysicsWorldEntity, time: number, delta: number): void;
1144
+ }
1145
+
1146
+ declare class BorderService {
1147
+ createBorders(physicsWorldID: AttachmentID, mapSize: Vector, borderBodyGroup: PhysicsBodyGroup): void;
1148
+ }
1149
+
1150
+ declare class MaterialsService {
1151
+ createMaterials(p2World: p2$1.World, borderProperties: BorderProperties, materialDefinitions: readonly MaterialDefinition[], materialContactDefinitions: readonly MaterialContactDefinition[]): {
1152
+ materials: Map<string, p2$1.Material>;
1153
+ materialDefinitions: Map<string, MaterialDefinition>;
1154
+ };
1155
+ getMaterial(physicsWorldID: number, name: string): p2$1.Material;
1156
+ getMaterialDefinition(physicsWorldID: number, name: string): MaterialDefinition;
1157
+ }
1158
+
1159
+ declare class PhysicsWorldService {
1160
+ constructor(_materialsService: MaterialsService, _borderService: BorderService, _availabilityGridService: AvailabilityGridService, _collisionsService: CollisionsService, _physicsBodyGroupService: PhysicsBodyGroupService);
1161
+ createPhysicsWorld(request: CreatePhysicsWorldRequestDTO): number;
1162
+ addBody(physicsWorldID: number, body: p2$1.Body, addInEmptySpace: boolean, physicsBodyGroup: PhysicsBodyGroup, includeOnPathfinding: boolean): boolean;
1163
+ removeBody(physicsWorldID: number, body: p2$1.Body): void;
1164
+ setPaused(pause: boolean, physicsWorldID: number): void;
1165
+ }
1166
+
1167
+ declare class RayCastingService {
1168
+ castClosest(physicsWorld: PhysicsWorldEntity, line: Line, physicsBodyGroup: PhysicsBodyGroup): RayCastHit | undefined;
1169
+ castAllFirstContacts(physicsWorld: PhysicsWorldEntity, line: Line, physicsBodyGroup: PhysicsBodyGroup): RayCastHit[];
1170
+ }
1171
+
1172
+ declare class ImpactService {
1173
+ applyImpulse(body: p2.Body, hitPosition: Vector, hitDirection: Vector, severity: number): void;
1174
+ }
1175
+
1176
+ interface ExplosionHitWithP2Body extends ExplosionHit {
1177
+ p2Body: p2.Body;
1178
+ }
1179
+ declare class RayCastHitConverterService {
1180
+ toExplosionHits(rayCasts: RayCast[], allRaysStartingFromSamePosition?: boolean): ExplosionHitWithP2Body[];
1181
+ }
1182
+
1183
+ declare class ElipticExplosionService {
1184
+ constructor(_rayCastingService: RayCastingService, _testVisualsService: TestVisualsService, _rayCastHitConverterService: RayCastHitConverterService, _impactService: ImpactService);
1185
+ createElipticExplosion(physicsWorldID: number, explosionCenter: Vector, rotation: Radian, size: Vector, physicsBodyGroup: PhysicsBodyGroup, severity: number, options?: PhysicsExplosionOptions): ExplosionHit[];
1186
+ }
1187
+
1188
+ declare class ExplosionService {
1189
+ constructor(_rayCastingService: RayCastingService, _testVisualsService: TestVisualsService, _rayCastHitConverterService: RayCastHitConverterService, _impactService: ImpactService);
1190
+ createExplosion(physicsWorldID: number, explosionCenter: Vector, radius: number, physicsBodyGroup: PhysicsBodyGroup, severity: number, options?: PhysicsExplosionOptions): ExplosionHit[];
1191
+ }
1192
+
1193
+ declare class PhysicsQueryService {
1194
+ getMapSize(physicsWorldID: number): MapSizeDTO;
1195
+ subscribeToPhysicsStep(physicsWorldID: number, callback: NotifierCallbackFunction<{
1196
+ time: number;
1197
+ delta: number;
1198
+ }>): IAttachment;
1199
+ }
1200
+
1201
+ declare class PhysicsController {
1202
+ constructor(_physicsWorldService: PhysicsWorldService, _pathFinderService: PathFinderService, _testVisualsService: TestVisualsService, _explosionService: ExplosionService, _elipticExplosionService: ElipticExplosionService, _hitTestService: HitTestService, _physicsQueryService: PhysicsQueryService, _impactService: ImpactService);
999
1203
  createPhysicsWorld(request: CreatePhysicsWorldRequestDTO): number;
1000
1204
  getMapSize(physicsWorldID: number): MapSizeDTO;
1001
1205
  setPaused(pause: boolean, physicsWorldID: number): void;
@@ -1008,4 +1212,8 @@ declare class PhysicsGateway {
1008
1212
  printPathfindingTestGrid(physicsWorldID: number, testLayerID: number, target: Vector | number, physicsBodyGroup: PhysicsBodyGroup, area: Rectangle, gridCellSize?: number): void;
1009
1213
  }
1010
1214
 
1011
- export { AnimationFlicker, AnimationInterpolationFunctions, type AnimationOptions, Animations, AnimationsCompletionHandlingType, Animator, type AnimatorAnimation, type AssetDefinition, BORDER_MATERIAL_NAME, BardLegendsHardReset, BlendMode, type BorderProperties, Camera, CameraGateway, type CircleShapeData, ClosestAvailableSpaceHelper, type CollisionDetails, type CollisionReport, Container, ContainerEventType, ControllerDecorator, type ControllerDecoratorMeta, ControllerLink, type CreateDashedLineOptions, type CreatePhysicsWorldRequestDTO, Cursor, DEFAULT_SHADER_RESOLUTION, DeltaTime, DisplayObjectArray, type DisplayObjectArrayOptions, type DropShadowOptions, Entity, EntityDecorator, type ExplosionHit, FadeInContent, type FadeInContentOptions, FadeInStateAnimation, FocusingAnimation, Game, type GlowEffectOptions, type GlowOptions, type GlowingShapeDefinition, Graphics, type HitTestOptions, ImmovablePhysicsEntity, type InteractingBodyGroups, type KeyboardKeyInfo, KeyboardService, type MapSizeDTO, type MaterialContactDefinition, type MaterialDefinition, MenuEntity, type MenuOptions, MenuUI, MenuView, MouseService, MouseTargetFocusService, MovableEntity, MovablePhysicsEntity, type PartialTextOptions, PathFinder, type PathFinderResult, type PhysicsBodyDTO, PhysicsEntity, type PhysicsEntityDefinition, type PhysicsExplosionOptions, PhysicsGateway, PhysicsShapeType, Placeholder, type PolygonDefinition, type PolygonShapeData, PositionConversionHelper, ROTATIONAL_SPEED_LIMIT, type RayCast, type RayCastHit, ReAnimateHandlingType, type RectangleShapeData, RichText, type RichTextOptions, type RichTextRectangleCut, type RichTextStyles, SPEED_LIMIT, Scene, SceneDecorator, ScrollAreaUI, ScrollDirection, type ScrollInContentOptions, ScrollMaskUI, Service, ServiceDecorator, type SetParentOptions, type ShapeDefinition, SingletonEntity, SlideInContent, SlideInContentByIndex, SlideStateAnimation, SlideStateAnimationState, Sprite, type SpriteDefinition, StateAnimation, type StateAnimationOptions, Text, type TextAlignment, type TextOptions, UpdatableContainer, UpdateCycle, VectorFieldPathFinder, VectorSet, View, ViewDecorator, type ViewDecoratorMeta };
1215
+ declare const PhysicsGateway_base: new () => PhysicsController;
1216
+ declare class PhysicsGateway extends PhysicsGateway_base {
1217
+ }
1218
+
1219
+ export { AnimationFlicker, AnimationInterpolationFunctions, type AnimationOptions, Animations, AnimationsCompletionHandlingType, Animator, type AnimatorAnimation, type AssetDefinition, BORDER_MATERIAL_NAME, BardLegendsHardReset, BlendMode, type BorderProperties, Camera, CameraGateway, type CircleShapeData, ClosestAvailableSpaceHelper, type CollisionDetails, type CollisionReport, Container, ContainerEventType, ControllerDecorator, type CreateDashedLineOptions, type CreatePhysicsWorldRequestDTO, Cursor, DEFAULT_SHADER_RESOLUTION, DeltaTime, DisplayObjectArray, type DisplayObjectArrayOptions, type DropShadowOptions, Entity, EntityDecorator, type ExplosionHit, FadeInContent, type FadeInContentOptions, FadeInStateAnimation, FocusingAnimation, Game, Gateway, type GlowEffectOptions, type GlowOptions, type GlowingShapeDefinition, Graphics, type HitTestOptions, ImmovablePhysicsEntity, type InteractingBodyGroups, type KeyboardKeyInfo, KeyboardService, type MapSizeDTO, type MaterialContactDefinition, type MaterialDefinition, MenuEntity, type MenuOptions, MenuUI, MenuView, MouseService, MouseTargetFocusService, MovableEntity, MovablePhysicsEntity, type PartialTextOptions, PathFinder, type PathFinderResult, type PhysicsBodyDTO, PhysicsEntity, type PhysicsEntityDefinition, type PhysicsExplosionOptions, PhysicsGateway, PhysicsShapeType, Placeholder, type PolygonDefinition, type PolygonShapeData, PositionConversionHelper, ROTATIONAL_SPEED_LIMIT, type RayCast, type RayCastHit, ReAnimateHandlingType, type RectangleShapeData, RichText, type RichTextOptions, type RichTextRectangleCut, type RichTextStyles, SPEED_LIMIT, Scene, SceneDecorator, ScrollAreaUI, ScrollDirection, type ScrollInContentOptions, ScrollMaskUI, Service, ServiceDecorator, type SetParentOptions, type ShapeDefinition, SingletonEntity, SlideInContent, SlideInContentByIndex, SlideStateAnimation, SlideStateAnimationState, Sprite, type SpriteDefinition, StateAnimation, type StateAnimationOptions, Text, type TextAlignment, type TextOptions, UpdatableContainer, UpdateCycle, VectorFieldPathFinder, VectorSet, View, ViewDecorator, type ViewDecoratorMeta };