@daneren2005/shared-memory-physics 1.7.3 → 1.8.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/README.md +15 -0
- package/dist/actions/add-physical-world-data.d.ts +2 -0
- package/dist/actions/combine-dynamics-commands.d.ts +2 -0
- package/dist/{systems/dynamics.d.ts → actions/dynamics-commands.d.ts} +1 -7
- package/dist/actions/find-dynamics-command-offset.d.ts +2 -0
- package/dist/actions/find-dynamics-command.d.ts +2 -0
- package/dist/actions/get-spatial-map.d.ts +3 -0
- package/dist/actions/integrate-dynamics.d.ts +3 -0
- package/dist/actions/queue-dynamics-vector.d.ts +2 -0
- package/dist/actions/queue-velocity-assignment.d.ts +2 -0
- package/dist/actions/set-entity-position.d.ts +7 -0
- package/dist/actions/snap-entity.d.ts +9 -0
- package/dist/actions/start-spawn-interpolation.d.ts +16 -0
- package/dist/actions/update-spatial-map.d.ts +3 -0
- package/dist/components/body-component-constants.d.ts +15 -0
- package/dist/components/body-component.d.ts +0 -15
- package/dist/components/bounciness-component-constants.d.ts +2 -0
- package/dist/components/bounciness-component.d.ts +0 -2
- package/dist/components/dynamics-component-constants.d.ts +4 -0
- package/dist/components/dynamics-component.d.ts +0 -4
- package/dist/components/interpolation-component-constants.d.ts +18 -0
- package/dist/components/interpolation-component.d.ts +0 -40
- package/dist/components/polygon-component-constants.d.ts +4 -0
- package/dist/components/polygon-component.d.ts +0 -4
- package/dist/components/transform-component-constants.d.ts +6 -0
- package/dist/components/transform-component.d.ts +0 -6
- package/dist/components/velocity-component-constants.d.ts +4 -0
- package/dist/components/velocity-component.d.ts +0 -4
- package/dist/constants.d.ts +5 -0
- package/dist/index.d.ts +24 -15
- package/dist/index.js +395 -360
- package/dist/index.js.map +1 -1
- package/dist/systems/collision.d.ts +1 -2
- package/dist/systems/interpolation-update.d.ts +0 -2
- package/dist/systems/physics-system.d.ts +4 -5
- package/dist/systems/physics-update.d.ts +2 -5
- package/dist/world.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ComponentMap, EntityWorkerSystemCallbacks, EntityWorkerSystemWorld, EntityQueryComponents, EntityUpdateComponents } from '@daneren2005/shared-memory-ecs';
|
|
2
2
|
import type { PhysicsUpdateComponents } from '../components/registry';
|
|
3
3
|
import type { Vector } from '../math/shapes';
|
|
4
|
-
import type { DynamicsCommands } from '
|
|
5
|
-
export declare const COLLIDABLE_QUERY = "collidable";
|
|
4
|
+
import type { DynamicsCommands } from '../actions/dynamics-commands';
|
|
6
5
|
export type CollisionComponents<T extends PhysicsUpdateComponents> = Partial<T> & {
|
|
7
6
|
transform: Float32Array;
|
|
8
7
|
body: Uint32Array;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { EntityUpdateFunction, EntityWorkerSystemWorld } from '@daneren2005/shared-memory-ecs';
|
|
2
2
|
import type { InterpolationComponents, InterpolationUpdateComponents } from '../components/registry';
|
|
3
|
-
export declare const BACKLOG_TARGET_STEPS = 1.5;
|
|
4
|
-
export declare const BACKLOG_CATCHUP_RATE = 0.5;
|
|
5
3
|
export interface InterpolationWorld extends EntityWorkerSystemWorld {
|
|
6
4
|
committedTicks?: Array<number>;
|
|
7
5
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { EntityWorkerSystem } from '@daneren2005/shared-memory-ecs';
|
|
2
2
|
import type { BaseEntity, BaseWorld, ComponentDefinitionMap, ComponentMap, EntityWorkerSystemQuery, EntityUpdateComponents, EntityUpdateFunction, SystemConfig } from '@daneren2005/shared-memory-ecs';
|
|
3
|
-
import { type SpawnableEntity } from '../
|
|
3
|
+
import { type SpawnableEntity } from '../actions/start-spawn-interpolation';
|
|
4
4
|
import type { PhysicsComponents, PhysicsUpdateComponents } from '../components/registry';
|
|
5
5
|
import { type PhysicsUpdateMetadata, type PhysicsWorld } from './physics-update';
|
|
6
|
-
import {
|
|
7
|
-
import type { VelocityAssignment } from '
|
|
8
|
-
export
|
|
9
|
-
export type { VelocityAssignment } from './dynamics';
|
|
6
|
+
import type { PhysicalWorldSource } from '../world';
|
|
7
|
+
import type { VelocityAssignment } from '../actions/dynamics-commands';
|
|
8
|
+
export type { VelocityAssignment } from '../actions/dynamics-commands';
|
|
10
9
|
export interface PhysicsSystemConfig<C extends ComponentMap & PhysicsComponents, T extends PhysicsUpdateComponents & EntityUpdateComponents<C>, W extends PhysicsWorld = PhysicsWorld> extends Partial<SystemConfig> {
|
|
11
10
|
getWorker?: () => Worker;
|
|
12
11
|
forceMainThread?: boolean;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { ComponentMap, EntityWorkerSystemCallbacks, EntityWorkerSystemWorld, EntityQueryComponents, EntityUpdateComponents, EntityUpdateFunction } from '@daneren2005/shared-memory-ecs';
|
|
2
2
|
import type { PhysicsComponents, PhysicsUpdateComponents } from '../components/registry';
|
|
3
3
|
import { type CollisionFunction } from './collision';
|
|
4
|
-
import type { DynamicsCommandQueue, DynamicsWorld } from '
|
|
5
|
-
import {
|
|
6
|
-
import { type PhysicalSystemWorld } from '../world';
|
|
4
|
+
import type { DynamicsCommandQueue, DynamicsWorld } from '../actions/dynamics-commands';
|
|
5
|
+
import type { PhysicalSystemWorld } from '../world';
|
|
7
6
|
export interface PhysicsWorld extends EntityWorkerSystemWorld, PhysicalSystemWorld, DynamicsWorld {
|
|
8
7
|
tick: number;
|
|
9
8
|
interpolationChannel?: number;
|
|
@@ -14,7 +13,6 @@ export interface PhysicsWorld extends EntityWorkerSystemWorld, PhysicalSystemWor
|
|
|
14
13
|
}
|
|
15
14
|
export interface PhysicsCallbackWorld extends PhysicsWorld, DynamicsCommandQueue {
|
|
16
15
|
}
|
|
17
|
-
export declare function updateSpatialMap(world: PhysicalSystemWorld, entityId: number, components: SpatialBlockComponents): void;
|
|
18
16
|
export interface DeathInterpolationEntity {
|
|
19
17
|
entityId: number;
|
|
20
18
|
components: {
|
|
@@ -23,7 +21,6 @@ export interface DeathInterpolationEntity {
|
|
|
23
21
|
body?: Uint32Array;
|
|
24
22
|
};
|
|
25
23
|
}
|
|
26
|
-
export declare const POSITION_UPDATED_EVENT = "position-updated";
|
|
27
24
|
export interface PhysicsUpdateOptions<C extends ComponentMap, T extends PhysicsUpdateComponents & EntityUpdateComponents<C>, W extends PhysicsWorld = PhysicsWorld> {
|
|
28
25
|
onCollision?: CollisionFunction<C, T, W & PhysicsCallbackWorld>;
|
|
29
26
|
optional?: Array<keyof C & string>;
|
package/dist/world.d.ts
CHANGED
|
@@ -16,8 +16,6 @@ export type PhysicalWorldOptions<R extends ComponentDefinitionMap, E extends Bas
|
|
|
16
16
|
};
|
|
17
17
|
export type PhysicalWorldEntity<R extends ComponentDefinitionMap, E extends BaseEntity<ComponentsOf<R>, EntityConfigOf<R>> = BaseEntity<ComponentsOf<R>, EntityConfigOf<R>>> = E;
|
|
18
18
|
export type PhysicalWorldFilter<R extends ComponentDefinitionMap, E extends BaseEntity<ComponentsOf<R>, EntityConfigOf<R>> = BaseEntity<ComponentsOf<R>, EntityConfigOf<R>>> = (entity: PhysicalWorldEntity<R, E>) => boolean;
|
|
19
|
-
export declare function addPhysicalWorldData(source: PhysicalWorldSource, target: PhysicalWorldData): void;
|
|
20
|
-
export declare function getSpatialMap(world: PhysicalSystemWorld): SharedSpatialMap;
|
|
21
19
|
export default class PhysicalWorld<R extends ComponentDefinitionMap, E extends BaseEntity<ComponentsOf<R>, EntityConfigOf<R>> = BaseEntity<ComponentsOf<R>, EntityConfigOf<R>>> extends BaseWorld<R, ComponentsOf<R>, EntityConfigOf<R>, E> implements PhysicalWorldSource {
|
|
22
20
|
readonly spatialMap: SharedSpatialMap;
|
|
23
21
|
private spatialIds;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@daneren2005/shared-memory-physics",
|
|
3
3
|
"description": "2D physics components and systems built on the shared-memory ECS.",
|
|
4
4
|
"author": "Scott Jackson",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.8.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"license": "MIT",
|