@daneren2005/shared-memory-physics 1.7.3 → 1.9.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.
Files changed (52) hide show
  1. package/README.md +125 -2
  2. package/dist/actions/add-physical-world-data.d.ts +2 -0
  3. package/dist/actions/combine-dynamics-commands.d.ts +2 -0
  4. package/dist/{systems/dynamics.d.ts → actions/dynamics-commands.d.ts} +1 -7
  5. package/dist/actions/find-dynamics-command-offset.d.ts +2 -0
  6. package/dist/actions/find-dynamics-command.d.ts +2 -0
  7. package/dist/actions/get-spatial-map.d.ts +3 -0
  8. package/dist/actions/integrate-dynamics.d.ts +3 -0
  9. package/dist/actions/queue-dynamics-vector.d.ts +2 -0
  10. package/dist/actions/queue-velocity-assignment.d.ts +2 -0
  11. package/dist/actions/set-entity-position.d.ts +7 -0
  12. package/dist/actions/snap-entity.d.ts +9 -0
  13. package/dist/actions/start-spawn-interpolation.d.ts +16 -0
  14. package/dist/actions/update-spatial-map.d.ts +3 -0
  15. package/dist/components/body-component-constants.d.ts +15 -0
  16. package/dist/components/body-component.d.ts +0 -15
  17. package/dist/components/bounciness-component-constants.d.ts +2 -0
  18. package/dist/components/bounciness-component.d.ts +0 -2
  19. package/dist/components/dynamics-component-constants.d.ts +4 -0
  20. package/dist/components/dynamics-component.d.ts +0 -4
  21. package/dist/components/interpolation-component-constants.d.ts +18 -0
  22. package/dist/components/interpolation-component.d.ts +0 -40
  23. package/dist/components/navigation-component-constants.d.ts +11 -0
  24. package/dist/components/navigation-component.d.ts +31 -0
  25. package/dist/components/polygon-component-constants.d.ts +4 -0
  26. package/dist/components/polygon-component.d.ts +0 -4
  27. package/dist/components/registry.d.ts +9 -0
  28. package/dist/components/transform-component-constants.d.ts +6 -0
  29. package/dist/components/transform-component.d.ts +0 -6
  30. package/dist/components/velocity-component-constants.d.ts +4 -0
  31. package/dist/components/velocity-component.d.ts +0 -4
  32. package/dist/constants.d.ts +5 -0
  33. package/dist/index.d.ts +48 -17
  34. package/dist/index.js +1156 -420
  35. package/dist/index.js.map +1 -1
  36. package/dist/pathfinding/follow-path.d.ts +9 -0
  37. package/dist/pathfinding/grid-a-star.d.ts +29 -0
  38. package/dist/pathfinding/line-of-sight.d.ts +2 -0
  39. package/dist/pathfinding/min-heap.d.ts +14 -0
  40. package/dist/pathfinding/nav-grid.d.ts +42 -0
  41. package/dist/pathfinding/navigation-state.d.ts +20 -0
  42. package/dist/pathfinding/path-blockers.d.ts +29 -0
  43. package/dist/pathfinding/path-search.d.ts +27 -0
  44. package/dist/pathfinding/pathfinding-system.d.ts +27 -0
  45. package/dist/pathfinding/pathfinding-update.d.ts +36 -0
  46. package/dist/pathfinding/smooth-path.d.ts +3 -0
  47. package/dist/systems/collision.d.ts +1 -2
  48. package/dist/systems/interpolation-update.d.ts +0 -2
  49. package/dist/systems/physics-system.d.ts +4 -5
  50. package/dist/systems/physics-update.d.ts +2 -5
  51. package/dist/world.d.ts +0 -2
  52. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -1,41 +1,72 @@
1
+ export { COLLIDABLE_QUERY, DEFAULT_PHYSICS_STEP_MS, POSITION_UPDATED_EVENT } from './constants';
1
2
  export { default as transformDefinition } from './components/transform-component';
2
- export { TRANSFORM_X_INDEX, TRANSFORM_Y_INDEX, TRANSFORM_WIDTH_INDEX, TRANSFORM_HEIGHT_INDEX, TRANSFORM_ANGLE_INDEX, TRANSFORM_SIZE, } from './components/transform-component';
3
+ export { TRANSFORM_X_INDEX, TRANSFORM_Y_INDEX, TRANSFORM_WIDTH_INDEX, TRANSFORM_HEIGHT_INDEX, TRANSFORM_ANGLE_INDEX, TRANSFORM_SIZE, } from './components/transform-component-constants';
3
4
  export type { TransformComponent, TransformConfig, TransformSerialization, } from './components/transform-component';
4
5
  export { default as velocityDefinition } from './components/velocity-component';
5
- export { VELOCITY_X_INDEX, VELOCITY_Y_INDEX, VELOCITY_DAMPING_INDEX, VELOCITY_SIZE, } from './components/velocity-component';
6
+ export { VELOCITY_X_INDEX, VELOCITY_Y_INDEX, VELOCITY_DAMPING_INDEX, VELOCITY_SIZE, } from './components/velocity-component-constants';
6
7
  export type { VelocityComponent, VelocityConfig, VelocitySerialization, } from './components/velocity-component';
7
8
  export { default as dynamicsDefinition } from './components/dynamics-component';
8
- export { DYNAMICS_ACCELERATION_X_INDEX, DYNAMICS_ACCELERATION_Y_INDEX, DYNAMICS_INVERSE_MASS_INDEX, DYNAMICS_SIZE, } from './components/dynamics-component';
9
+ export { DYNAMICS_ACCELERATION_X_INDEX, DYNAMICS_ACCELERATION_Y_INDEX, DYNAMICS_INVERSE_MASS_INDEX, DYNAMICS_SIZE, } from './components/dynamics-component-constants';
9
10
  export type { DynamicsComponent, DynamicsConfig, DynamicsSerialization, } from './components/dynamics-component';
10
11
  export { default as bodyDefinition, canCollide, isSensor, isContinuous, blocksPath, isDying, markDying, bodyShape } from './components/body-component';
11
- export { SHAPE_RECTANGLE, SHAPE_CIRCLE, SHAPE_CAPSULE, SHAPE_POLYGON, DEFAULT_COLLIDE_CATEGORY, DEFAULT_COLLIDE_MASK, BODY_FLAGS_INDEX, BODY_SHAPE_MASK, BODY_SENSOR_FLAG, BODY_CCD_FLAG, BODY_DYING_FLAG, BODY_BLOCKS_PATH_FLAG, BODY_CATEGORY_INDEX, BODY_MASK_INDEX, BODY_SIZE, } from './components/body-component';
12
+ export { SHAPE_RECTANGLE, SHAPE_CIRCLE, SHAPE_CAPSULE, SHAPE_POLYGON, DEFAULT_COLLIDE_CATEGORY, DEFAULT_COLLIDE_MASK, BODY_FLAGS_INDEX, BODY_SHAPE_MASK, BODY_SENSOR_FLAG, BODY_CCD_FLAG, BODY_DYING_FLAG, BODY_BLOCKS_PATH_FLAG, BODY_CATEGORY_INDEX, BODY_MASK_INDEX, BODY_SIZE, } from './components/body-component-constants';
12
13
  export type { BodyComponent, BodyConfig, } from './components/body-component';
13
14
  export { default as polygonDefinition, preparePolygon } from './components/polygon-component';
14
- export { MAX_POLYGON_VERTICES, POLYGON_VERTEX_COUNT_INDEX, POLYGON_VERTICES_INDEX, POLYGON_SIZE, } from './components/polygon-component';
15
+ export { MAX_POLYGON_VERTICES, POLYGON_VERTEX_COUNT_INDEX, POLYGON_VERTICES_INDEX, POLYGON_SIZE, } from './components/polygon-component-constants';
15
16
  export type { PolygonComponent, PolygonConfig, PolygonVertex, PreparedPolygon } from './components/polygon-component';
16
17
  export { default as bouncinessDefinition } from './components/bounciness-component';
17
- export { BOUNCINESS_INDEX, BOUNCINESS_SIZE, } from './components/bounciness-component';
18
+ export { BOUNCINESS_INDEX, BOUNCINESS_SIZE, } from './components/bounciness-component-constants';
18
19
  export type { BouncinessComponent, BouncinessConfig, } from './components/bounciness-component';
19
- export { default as interpolationDefinition, snapEntity, startSpawnInterpolation } from './components/interpolation-component';
20
- export { INTERPOLATION_X_INDEX, INTERPOLATION_Y_INDEX, INTERPOLATION_SYNCED_TICK_INDEX, INTERPOLATION_DURATION_INDEX, INTERPOLATION_TICK_INDEX, INTERPOLATION_TOTAL_DURATION_INDEX, INTERPOLATION_SYNCED_DURATION_INDEX, INTERPOLATION_REMAINING_DURATION_INDEX, INTERPOLATION_TARGET_X_INDEX, INTERPOLATION_TARGET_Y_INDEX, INTERPOLATION_SYNCED_STEP_DURATION_INDEX, INTERPOLATION_CHANNEL_INDEX, INTERPOLATION_PREVIOUS_X_INDEX, INTERPOLATION_PREVIOUS_Y_INDEX, INTERPOLATION_PREVIOUS_DURATION_INDEX, INTERPOLATION_PREVIOUS_TOTAL_DURATION_INDEX, INTERPOLATION_PREVIOUS_TICK_INDEX, INTERPOLATION_SIZE, } from './components/interpolation-component';
21
- export type { InterpolationComponent, InterpolationConfig, SnappableEntity, SpawnableEntity, SpawnInterpolationOptions, } from './components/interpolation-component';
22
- export { physicsRegistry } from './components/registry';
23
- export type { PhysicsComponents, PhysicsUpdateComponents, InterpolationComponents, InterpolationUpdateComponents, } from './components/registry';
24
- export { default as PhysicalWorld, addPhysicalWorldData, getSpatialMap } from './world';
20
+ export { default as interpolationDefinition } from './components/interpolation-component';
21
+ export { INTERPOLATION_X_INDEX, INTERPOLATION_Y_INDEX, INTERPOLATION_SYNCED_TICK_INDEX, INTERPOLATION_DURATION_INDEX, INTERPOLATION_TICK_INDEX, INTERPOLATION_TOTAL_DURATION_INDEX, INTERPOLATION_SYNCED_DURATION_INDEX, INTERPOLATION_REMAINING_DURATION_INDEX, INTERPOLATION_TARGET_X_INDEX, INTERPOLATION_TARGET_Y_INDEX, INTERPOLATION_SYNCED_STEP_DURATION_INDEX, INTERPOLATION_CHANNEL_INDEX, INTERPOLATION_PREVIOUS_X_INDEX, INTERPOLATION_PREVIOUS_Y_INDEX, INTERPOLATION_PREVIOUS_DURATION_INDEX, INTERPOLATION_PREVIOUS_TOTAL_DURATION_INDEX, INTERPOLATION_PREVIOUS_TICK_INDEX, INTERPOLATION_SIZE, } from './components/interpolation-component-constants';
22
+ export type { InterpolationComponent, InterpolationConfig, } from './components/interpolation-component';
23
+ export { default as navigationDefinition, isNavigating, isPathPending, isUnreachable, navigateTo, navigationGoal, requestPath, setNavigationGoal, stopNavigating, waypoint, waypointX, waypointY, writePath, } from './components/navigation-component';
24
+ export { NAVIGATION_REQUEST_INDEX, NAVIGATION_RESULT_INDEX, NAVIGATION_OUTCOME_INDEX, NAVIGATION_WAYPOINT_INDEX, NAVIGATION_WAYPOINT_COUNT_INDEX, NAVIGATION_ACTIVE_INDEX, NAVIGATION_GOAL_X_INDEX, NAVIGATION_GOAL_Y_INDEX, NAVIGATION_WAYPOINTS_INDEX, NAVIGATION_MAX_WAYPOINTS, NAVIGATION_SIZE, } from './components/navigation-component-constants';
25
+ export type { NavigationComponent, NavigationConfig } from './components/navigation-component';
26
+ export { physicsRegistry, navigationRegistry } from './components/registry';
27
+ export type { NavigationComponents, PhysicsComponents, PhysicsUpdateComponents, InterpolationComponents, InterpolationUpdateComponents, } from './components/registry';
28
+ export { default as PhysicalWorld } from './world';
25
29
  export type { PhysicalSystemWorld, PhysicalWorldData, PhysicalWorldSource, PhysicalWorldEntity, PhysicalWorldFilter, PhysicalWorldOptions, } from './world';
26
30
  export { shapesOverlap, contactNormal, shapeHalfWidth, shapeHalfHeight, shapeIsEmpty, shapeRadius, capsuleHalfLength, capsuleCoreAngle, boundsHalfWidth, boundsHalfHeight, orientedBoxesOverlap, segmentSegmentDistanceSquared, segmentBoxDistanceSquared, pointSegmentDistanceSquared, } from './math/shapes';
27
31
  export type { Vector } from './math/shapes';
28
32
  export { polygonShapesOverlap, polygonContactNormal } from './math/polygons';
29
- export { default as CollisionBroadphase, COLLIDABLE_QUERY } from './systems/collision';
33
+ export { default as CollisionBroadphase } from './systems/collision';
30
34
  export type { CollisionComponents, CollisionContact, CollisionEntity, CollisionFunction, MoveResult, MovingEntity, SweepResult } from './systems/collision';
31
35
  export { default as SpatialIndex } from './systems/spatial-index';
32
36
  export type { SpatialComponents, SpatialEntity, SpatialFilter } from './systems/spatial-index';
33
- export { default as physicsUpdate, createPhysicsUpdate, POSITION_UPDATED_EVENT, updateSpatialMap } from './systems/physics-update';
37
+ export { setEntityPosition } from './actions/set-entity-position';
38
+ export { updateSpatialMap } from './actions/update-spatial-map';
39
+ export { getSpatialMap } from './actions/get-spatial-map';
40
+ export { addPhysicalWorldData } from './actions/add-physical-world-data';
41
+ export { snapEntity } from './actions/snap-entity';
42
+ export type { SnappableEntity } from './actions/snap-entity';
43
+ export { startSpawnInterpolation } from './actions/start-spawn-interpolation';
44
+ export type { SpawnableEntity, SpawnInterpolationOptions } from './actions/start-spawn-interpolation';
45
+ export { default as integrateDynamics } from './actions/integrate-dynamics';
46
+ export type { DynamicsCommand, DynamicsCommandBuffer, DynamicsCommandQueue, DynamicsCommands, DynamicsWorld } from './actions/dynamics-commands';
47
+ export { default as physicsUpdate, createPhysicsUpdate } from './systems/physics-update';
34
48
  export type { DeathInterpolationEntity, PhysicsCallbackWorld, PhysicsGroupConfig, PhysicsUpdateFunction, PhysicsUpdateMetadata, PhysicsUpdateOptions, PhysicsWorld } from './systems/physics-update';
35
- export { default as PhysicsSystem, DEFAULT_PHYSICS_STEP_MS } from './systems/physics-system';
49
+ export { default as PhysicsSystem } from './systems/physics-system';
36
50
  export type { PhysicsSystemConfig, VelocityAssignment } from './systems/physics-system';
37
- export { default as integrateDynamics } from './systems/dynamics';
38
- export type { DynamicsCommand, DynamicsCommandBuffer, DynamicsCommandQueue, DynamicsCommands, DynamicsWorld } from './systems/dynamics';
51
+ export { default as NavGrid } from './pathfinding/nav-grid';
52
+ export type { Rect, TileRange } from './pathfinding/nav-grid';
53
+ export { default as GridAStar } from './pathfinding/grid-a-star';
54
+ export type { GridAStarOptions } from './pathfinding/grid-a-star';
55
+ export { default as MinHeap } from './pathfinding/min-heap';
56
+ export { PathStatus } from './pathfinding/path-search';
57
+ export type { PathRequest, PathResult, PathSearch, PathStatusValue, Point } from './pathfinding/path-search';
58
+ export { sweepCost } from './pathfinding/line-of-sight';
59
+ export { smoothPath } from './pathfinding/smooth-path';
60
+ export { FollowStep, followPath } from './pathfinding/follow-path';
61
+ export type { FollowStepValue } from './pathfinding/follow-path';
62
+ export { PATH_BLOCKERS_QUERY, PATH_GATES_QUERY, applyRectChanges, blockerRect, pathBlockerQueries, } from './pathfinding/path-blockers';
63
+ export type { PathBlockerComponents, PathBlockerDelta, PathBlockerQueryOptions } from './pathfinding/path-blockers';
64
+ export { applyPathBlockerChanges, applyPathGateChanges, blockingRects, createNavigationState, navigationGridFor, setNavigationTerrainSpeed, } from './pathfinding/navigation-state';
65
+ export type { NavigationState } from './pathfinding/navigation-state';
66
+ export { DEFAULT_PATH_SEARCH_ITERATION_BUDGET, createPathfindingUpdate, pathfindingUpdate } from './pathfinding/pathfinding-update';
67
+ export type { PathfindingInitData, PathfindingUpdateComponents, PathfindingUpdateFunction, PathfindingUpdateMetadata, PathfindingUpdateOptions, PathfindingWorld, } from './pathfinding/pathfinding-update';
68
+ export { default as PathfindingSystem } from './pathfinding/pathfinding-system';
69
+ export type { PathfindingSystemConfig } from './pathfinding/pathfinding-system';
39
70
  export { default as interpolationUpdate } from './systems/interpolation-update';
40
71
  export type { InterpolationWorld } from './systems/interpolation-update';
41
72
  export { default as InterpolationSystem } from './systems/interpolation-system';