@woosh/meep-engine 2.53.0 → 2.55.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/package.json +1 -1
- package/src/core/__module.js +1 -1
- package/src/core/cache/Cache.js +1 -1
- package/src/core/collection/Stack.js +11 -14
- package/src/core/collection/array/array_contains_duplicates.js +5 -2
- package/src/core/collection/array/array_contains_duplicates.spec.js +14 -0
- package/src/core/collection/array/array_copy_entire.js +6 -11
- package/src/core/collection/array/array_get_index_in_range.js +5 -0
- package/src/core/collection/array/array_get_index_in_range.spec.js +16 -0
- package/src/core/collection/array/groupArrayBy.js +1 -1
- package/src/core/collection/array/isArrayEqual.js +4 -1
- package/src/core/collection/array/randomizeArrayElementOrder.js +1 -0
- package/src/core/collection/array/randomizeArrayElementOrder.spec.js +27 -0
- package/src/core/collection/heap/Uin32Heap.spec.js +64 -0
- package/src/core/collection/heap/Uint32Heap.js +6 -2
- package/src/core/collection/list/List.js +1 -0
- package/src/core/collection/{HashMap.js → map/HashMap.js} +10 -10
- package/src/core/collection/{HashMap.spec.js → map/HashMap.spec.js} +1 -1
- package/src/core/collection/{ObservedMap.js → map/ObservedMap.js} +1 -1
- package/src/core/collection/{HashSet.js → set/HashSet.js} +4 -3
- package/src/core/collection/{Set.d.ts → set/Set.d.ts} +1 -1
- package/src/core/collection/{Set.js → set/Set.js} +17 -14
- package/src/core/geom/2d/aabb/AABB2.js +1 -1
- package/src/core/geom/3d/aabb/AABB3.js +3 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_calc_edges.js +1 -1
- package/src/core/model/ObservedInteger.js +12 -7
- package/src/core/model/ObservedString.js +10 -8
- package/src/core/model/node-graph/visual/NodeGraphVisualData.js +1 -1
- package/src/core/model/object/ImmutableObjectPool.js +1 -1
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +1 -1
- package/src/engine/EngineConfiguration.js +24 -25
- package/src/engine/asset/AssetManager.js +3 -3
- package/src/engine/asset/loaders/GLTFAssetLoader.js +1 -1
- package/src/engine/ecs/EntityBlueprint.js +10 -14
- package/src/engine/ecs/EntityComponentDataset.spec.js +77 -0
- package/src/engine/ecs/animation/AnimationSerializationAdapter.js +2 -5
- package/src/engine/ecs/components/Motion.js +0 -27
- package/src/engine/ecs/components/MotionSerializationAdapter.js +26 -0
- package/src/engine/ecs/components/PropertySet.js +0 -29
- package/src/engine/ecs/components/PropertySetSerializationAdapter.js +29 -0
- package/src/engine/ecs/components/SerializationMetadata.js +0 -28
- package/src/engine/ecs/components/SerializationMetadataSerializationAdapter.js +26 -0
- package/src/engine/ecs/components/Steering.js +0 -35
- package/src/engine/ecs/components/SteeringSerializationAdapter.js +34 -0
- package/src/engine/ecs/components/Tag.js +6 -102
- package/src/engine/ecs/components/TagSerializationAdapter.js +44 -0
- package/src/engine/ecs/components/TagSerializationUpgrader_0_1.js +18 -0
- package/src/engine/ecs/components/Timer.js +1 -1
- package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +1 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleCooldownDescription.js +10 -14
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +31 -39
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescriptionTable.js +1 -1
- package/src/engine/ecs/dynamic_actions/{DynamicRuleDescriptionTable.spec.js → rules/DynamicRuleDescriptionTable.spec.js} +12 -12
- package/src/engine/ecs/foliage/ecs/InstancedMeshSerializationAdapter.js +2 -5
- package/src/engine/ecs/fow/serialization/FogOfWarRevealerSerializationAdapter.js +2 -5
- package/src/engine/ecs/fow/serialization/FogOfWarSerializationAdapter.js +5 -8
- package/src/engine/ecs/gui/GUIElementSerializationAdapter.js +2 -5
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySerializationAdapter.js +3 -6
- package/src/engine/ecs/gui/position/ViewportPosition.js +2 -5
- package/src/engine/ecs/ik/IKConstraint.js +95 -0
- package/src/engine/ecs/ik/InverseKinematics.js +10 -169
- package/src/engine/ecs/ik/InverseKinematicsSerializationAdapter.js +72 -0
- package/src/engine/ecs/speaker/Voice.js +5 -8
- package/src/engine/ecs/speaker/VoiceSystem.js +15 -19
- package/src/engine/ecs/speaker/lines/LineDescription.js +20 -25
- package/src/engine/ecs/speaker/lines/sets/LineSetDescription.js +15 -19
- package/src/engine/ecs/storage/binary/BinaryClassSerializationAdapter.js +7 -0
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +1 -1
- package/src/engine/ecs/storage/binary/object/ObjectBasedClassSerializationAdapter.js +6 -9
- package/src/engine/ecs/team/TeamSerializationAdapter.js +2 -5
- package/src/engine/ecs/terrain/ecs/Terrain.spec.js +5 -0
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js +23 -21
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationAdapter.js +2 -5
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +2 -40
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.spec.js +6 -0
- package/src/engine/ecs/terrain/serialization/TerrainSerializationAdapter.js +7 -10
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +79 -76
- package/src/engine/ecs/terrain/tiles/TerrainTile.spec.js +25 -0
- package/src/engine/ecs/tooltip/TooltipComponent.spec.js +47 -0
- package/src/engine/ecs/tooltip/TooltipComponentSerializationAdapter.js +2 -5
- package/src/engine/ecs/transform/Transform.spec.js +52 -0
- package/src/engine/ecs/transform/TransformSerializationAdapter.js +2 -5
- package/src/engine/ecs/transform-attachment/TransformAttachment.js +18 -19
- package/src/engine/graphics/ecs/animation/AnimationController.js +20 -129
- package/src/engine/graphics/ecs/animation/AnimationControllerSerializationAdapter.js +27 -0
- package/src/engine/graphics/ecs/animation/AnimationRule.js +79 -0
- package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraphSerializationAdapter.js +9 -11
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/AnimationGraphDefinitionSerializationAdapter.js +3 -5
- package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationAdapter.js +2 -6
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLander.js +3 -15
- package/src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.js +2 -4
- package/src/engine/graphics/ecs/highlight/HighlightSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/highlight/renderer/OutlineRenderer.js +1 -1
- package/src/engine/graphics/ecs/light/LightSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/mesh/serialization/MeshSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +3 -0
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/InstancedRendererAdapter.js +1 -1
- package/src/engine/graphics/ecs/water/WaterSerializationAdapter.js +2 -5
- package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +1 -1
- package/src/engine/graphics/material/manager/MaterialManager.js +1 -1
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -1
- package/src/engine/graphics/particles/node-based/codegen/CodeContext.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +2 -5
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationAdapter.js +2 -5
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.js +1 -1
- package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.js +1 -1
- package/src/engine/graphics/texture/sampler/serialization/Sampler2DSerializationAdapter.js +2 -5
- package/src/engine/grid/grid2transform/GridPosition2Transform.js +11 -13
- package/src/engine/grid/grid2transform/GridPosition2TransformSerializationAdapter.js +3 -5
- package/src/engine/grid/obstacle/GridObstacleSerializationAdapter.js +2 -5
- package/src/engine/grid/position/GridPositionSerializationAdapter.js +2 -5
- package/src/engine/grid/transform2grid/Transform2GridPosition.js +10 -13
- package/src/engine/input/devices/KeyboardDevice.js +5 -2
- package/src/engine/input/devices/KeyboardDevice.spec.js +12 -0
- package/src/engine/input/devices/PointerDevice.js +5 -1
- package/src/engine/input/ecs/components/Input.js +37 -11
- package/src/engine/input/ecs/ism/InputBinding.js +30 -12
- package/src/engine/intelligence/behavior/ecs/BehaviorComponentSerializationAdapter.js +7 -10
- package/src/engine/intelligence/behavior/ecs/WaitForEventBehaviorSerializationAdapter.js +2 -5
- package/src/engine/intelligence/behavior/primitive/FailingBehaviorSerializationAdapter.js +2 -6
- package/src/engine/intelligence/behavior/primitive/SucceedingBehaviorSerializationAdapter.js +2 -5
- package/src/engine/intelligence/blackboard/BlackboardSerializationAdapter.js +2 -5
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.js +12 -13
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.spec.js +23 -0
- package/src/engine/navigation/ecs/components/PathSerializationAdapter.js +2 -5
- package/src/engine/navigation/ecs/path_following/PathFollowerSerializationAdapter.js +2 -5
- package/src/engine/navigation/grid/find_path_on_grid_astar.spec.js +25 -0
- package/src/engine/options/OptionAbstract.js +6 -5
- package/src/engine/options/OptionGroup.js +13 -25
- package/src/engine/options/OptionGroup.spec.js +61 -0
- package/src/engine/platform/EnginePlatform.js +0 -4
- package/src/engine/save/storage/InMemoryStorage.js +3 -2
- package/src/engine/sound/ecs/SoundController.js +2 -6
- package/src/engine/sound/ecs/SoundListener.js +3 -21
- package/src/engine/sound/ecs/emitter/SoundEmitterSerializationAdapter.js +2 -6
- package/src/generation/theme/ThemeEngine.js +1 -1
- package/src/core/collection/LazyStream.js +0 -23
- package/src/core/collection/LazyStream.spec.js +0 -13
- package/src/core/collection/heap/BinaryHeap.js +0 -153
- package/src/engine/InputEngine.js +0 -94
- package/src/engine/PointerLock.js +0 -60
- package/src/engine/ecs/components/GeometryBVH.js +0 -44
- package/src/engine/ecs/systems/GeometryBVHSystem.js +0 -36
- package/src/engine/ecs/terrain/ecs/layers/loadLegacyTerrainLayers.js +0 -99
- package/src/engine/ecs/terrain/ecs/splat/loadLegacyTerrainSplats.js +0 -73
- /package/src/core/collection/{HashMap.d.ts → map/HashMap.d.ts} +0 -0
- /package/src/core/collection/{HashSet.d.ts → set/HashSet.d.ts} +0 -0
|
@@ -7,12 +7,9 @@ import { ParticleEmitterFlag } from "../ParticleEmitterFlag.js";
|
|
|
7
7
|
import { SimulationStepDefinition } from "../../simulator/SimulationStepDefinition.js";
|
|
8
8
|
|
|
9
9
|
export class ParticleEmitterSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
11
|
+
klass = ParticleEmitter;
|
|
12
|
+
version = 1;
|
|
16
13
|
|
|
17
14
|
/**
|
|
18
15
|
*
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
Vector2 as ThreeVector2
|
|
11
11
|
} from "three";
|
|
12
12
|
import Vector2 from "../../../../../../core/geom/Vector2.js";
|
|
13
|
-
import { HashMap } from "../../../../../../core/collection/HashMap.js";
|
|
13
|
+
import { HashMap } from "../../../../../../core/collection/map/HashMap.js";
|
|
14
14
|
import { ParticleEmitterFlag } from "../emitter/ParticleEmitterFlag.js";
|
|
15
15
|
import { writeSample2DDataToDataTexture } from "../../../../texture/sampler/writeSampler2DDataToDataTexture.js";
|
|
16
16
|
import { MaterialRecord } from "./MaterialRecord.js";
|
|
@@ -2,7 +2,7 @@ import { TextureAtlas } from "./TextureAtlas.js";
|
|
|
2
2
|
import { ReferenceManager } from "../../../reference/v1/ReferenceManager.js";
|
|
3
3
|
import { Sampler2D } from "../sampler/Sampler2D.js";
|
|
4
4
|
import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
5
|
-
import { HashMap } from "../../../../core/collection/HashMap.js";
|
|
5
|
+
import { HashMap } from "../../../../core/collection/map/HashMap.js";
|
|
6
6
|
import { strictEquals } from "../../../../core/function/Functions.js";
|
|
7
7
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
8
8
|
import { copy_Sampler2D_channel_data } from "../sampler/copy_Sampler2D_channel_data.js";
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../../ecs/storage/binary/
|
|
|
2
2
|
import { Sampler2D } from "../Sampler2D.js";
|
|
3
3
|
|
|
4
4
|
export class Sampler2DSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
version = 0;
|
|
7
|
+
klass = Sampler2D;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -9,19 +9,17 @@ import { GridPosition2TransformFlags } from "./GridPosition2TransformFlags.js";
|
|
|
9
9
|
const DEFAULT_FLAGS = GridPosition2TransformFlags.Immediate;
|
|
10
10
|
|
|
11
11
|
export class GridPosition2Transform {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.flags = DEFAULT_FLAGS;
|
|
24
|
-
}
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @type {Vector2}
|
|
15
|
+
*/
|
|
16
|
+
offset = new Vector2(0, 0);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {GridPosition2TransformFlags|number}
|
|
21
|
+
*/
|
|
22
|
+
flags = DEFAULT_FLAGS;
|
|
25
23
|
|
|
26
24
|
/**
|
|
27
25
|
*
|
|
@@ -2,12 +2,10 @@ import { BinaryClassSerializationAdapter } from "../../ecs/storage/binary/Binary
|
|
|
2
2
|
import { GridPosition2Transform } from "./GridPosition2Transform.js";
|
|
3
3
|
|
|
4
4
|
export class GridPosition2TransformSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
klass = GridPosition2Transform;
|
|
7
|
+
version = 1;
|
|
8
|
+
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
*
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../ecs/storage/binary/Binary
|
|
|
2
2
|
import GridObstacle from "./GridObstacle.js";
|
|
3
3
|
|
|
4
4
|
export class GridObstacleSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = GridObstacle;
|
|
7
|
+
version = 0;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../ecs/storage/binary/Binary
|
|
|
2
2
|
import GridPosition from "./GridPosition.js";
|
|
3
3
|
|
|
4
4
|
export class GridPositionSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = GridPosition;
|
|
7
|
+
version = 1;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { Transform2GridPositionMode } from "./Transform2GridPositionMode.js";
|
|
2
2
|
|
|
3
3
|
export class Transform2GridPosition {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
this.mode = Transform2GridPositionMode.Continuous;
|
|
16
|
-
}
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @type {Transform2GridPositionFlags|number}
|
|
7
|
+
*/
|
|
8
|
+
flags = 0;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
mode= Transform2GridPositionMode.Continuous;
|
|
17
14
|
|
|
18
15
|
/**
|
|
19
16
|
*
|
|
@@ -73,8 +73,11 @@ class KeyboardDevice {
|
|
|
73
73
|
/*
|
|
74
74
|
Only element in focus receives keyboard events, so the element supplied here must be focusable in order to be able to receive events
|
|
75
75
|
*/
|
|
76
|
-
if (
|
|
77
|
-
|
|
76
|
+
if (
|
|
77
|
+
!isFocusable(domElement)
|
|
78
|
+
&& domElement.getAttribute('tabindex') === null
|
|
79
|
+
) {
|
|
80
|
+
new TypeError('Supplied element is not inherently focusable and does not have tabindex attribute, so it must have a tabindex attribute in order to be able receive keyboard events. Something like tabindex=0 would suffice.');
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
/**
|
|
@@ -322,9 +322,13 @@ export function readPositionFromMouseEvent(result, event, source = event.target)
|
|
|
322
322
|
result.set(x, y);
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Abstracts Mouse and Touch interfaces as single "pointer" device.
|
|
327
|
+
*/
|
|
325
328
|
export class PointerDevice {
|
|
326
329
|
|
|
327
330
|
/**
|
|
331
|
+
* Current live position of the pointer
|
|
328
332
|
* @readonly
|
|
329
333
|
* @type {Vector2}
|
|
330
334
|
*/
|
|
@@ -373,7 +377,7 @@ export class PointerDevice {
|
|
|
373
377
|
isRunning = false;
|
|
374
378
|
|
|
375
379
|
/**
|
|
376
|
-
* The MouseEvent.buttons is a 32bit field, which means we can encode up to 32 buttons
|
|
380
|
+
* The {@link MouseEvent.buttons} is a 32bit field, which means we can encode up to 32 buttons
|
|
377
381
|
* @readonly
|
|
378
382
|
* @type {InputDeviceSwitch[]}
|
|
379
383
|
*/
|
|
@@ -4,12 +4,28 @@ import { InputBinding } from "../ism/InputBinding.js";
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export class Input {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @readonly
|
|
10
|
+
* @type {List<InputBinding>}
|
|
11
|
+
*/
|
|
12
|
+
bindings = new List();
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param {Input} other
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
equals(other) {
|
|
20
|
+
return this.bindings.equals(other.bindings);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @return {number}
|
|
26
|
+
*/
|
|
27
|
+
hash() {
|
|
28
|
+
return this.bindings.hash();
|
|
13
29
|
}
|
|
14
30
|
|
|
15
31
|
/**
|
|
@@ -19,10 +35,20 @@ export class Input {
|
|
|
19
35
|
* @returns {boolean}
|
|
20
36
|
*/
|
|
21
37
|
exists(path, event) {
|
|
22
|
-
assert.
|
|
23
|
-
assert.
|
|
38
|
+
assert.isString(path, "path");
|
|
39
|
+
assert.isString(event, "event");
|
|
40
|
+
|
|
41
|
+
const bindings = this.bindings;
|
|
42
|
+
const count = bindings.length;
|
|
43
|
+
for (let i = 0; i < count; i++) {
|
|
44
|
+
const binding = bindings.get(i);
|
|
45
|
+
|
|
46
|
+
if (binding.path === path && binding.event === event) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
24
50
|
|
|
25
|
-
return
|
|
51
|
+
return false;
|
|
26
52
|
}
|
|
27
53
|
|
|
28
54
|
/**
|
|
@@ -32,8 +58,8 @@ export class Input {
|
|
|
32
58
|
* @returns {boolean}
|
|
33
59
|
*/
|
|
34
60
|
bind(path, event) {
|
|
35
|
-
assert.
|
|
36
|
-
assert.
|
|
61
|
+
assert.isString(path, "path");
|
|
62
|
+
assert.isString(event, "event");
|
|
37
63
|
|
|
38
64
|
if (this.exists(path, event)) {
|
|
39
65
|
//binding exists
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
2
3
|
|
|
3
4
|
export class InputBinding {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @type {string}
|
|
9
|
+
*/
|
|
10
|
+
path = "";
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
event = "";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
*
|
|
@@ -27,6 +27,24 @@ export class InputBinding {
|
|
|
27
27
|
this.event = event;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param {InputBinding} other
|
|
33
|
+
* @returns {boolean}
|
|
34
|
+
*/
|
|
35
|
+
equals(other) {
|
|
36
|
+
return this.event === other.event
|
|
37
|
+
&& this.path === other.path;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @return {number}
|
|
43
|
+
*/
|
|
44
|
+
hash() {
|
|
45
|
+
return computeStringHash(this.event) ^ computeStringHash(this.path);
|
|
46
|
+
}
|
|
47
|
+
|
|
30
48
|
/**
|
|
31
49
|
*
|
|
32
50
|
* @param {BinaryBuffer} buffer
|
|
@@ -4,18 +4,15 @@ import { SequenceBehavior } from "../composite/SequenceBehavior.js";
|
|
|
4
4
|
import { SucceedingBehavior } from "../primitive/SucceedingBehavior.js";
|
|
5
5
|
|
|
6
6
|
export class BehaviorComponentSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
klass = BehaviorComponent;
|
|
9
|
+
version = 0;
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @type {BinaryObjectSerializationAdapter}
|
|
14
|
+
*/
|
|
15
|
+
objectAdapter = null;
|
|
19
16
|
|
|
20
17
|
/**
|
|
21
18
|
*
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/Bin
|
|
|
2
2
|
import { WaitForEventBehavior } from "./WaitForEventBehavior.js";
|
|
3
3
|
|
|
4
4
|
export class WaitForEventBehaviorSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = WaitForEventBehavior;
|
|
7
|
+
version = 0;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -2,12 +2,8 @@ import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/Bin
|
|
|
2
2
|
import { FailingBehavior } from "./FailingBehavior.js";
|
|
3
3
|
|
|
4
4
|
export class FailingBehaviorSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.klass = FailingBehavior;
|
|
9
|
-
this.version = 0;
|
|
10
|
-
}
|
|
5
|
+
klass = FailingBehavior;
|
|
6
|
+
version = 0;
|
|
11
7
|
|
|
12
8
|
/**
|
|
13
9
|
*
|
package/src/engine/intelligence/behavior/primitive/SucceedingBehaviorSerializationAdapter.js
CHANGED
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/Bin
|
|
|
2
2
|
import { SucceedingBehavior } from "./SucceedingBehavior.js";
|
|
3
3
|
|
|
4
4
|
export class SucceedingBehaviorSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = SucceedingBehavior;
|
|
7
|
+
version = 0;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -4,12 +4,9 @@ import { Blackboard } from "./Blackboard.js";
|
|
|
4
4
|
import { BlackboardValue } from "./BlackboardValue.js";
|
|
5
5
|
|
|
6
6
|
export class BlackboardSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
8
|
+
klass = Blackboard;
|
|
9
|
+
version = 0;
|
|
13
10
|
|
|
14
11
|
/**
|
|
15
12
|
*
|
|
@@ -18,22 +18,21 @@ export const StaticKnowledgeState = {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export class StaticKnowledgeDatabase {
|
|
21
|
-
constructor() {
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {ObservedEnum<StaticKnowledgeState>}
|
|
25
|
+
*/
|
|
26
|
+
__state = new ObservedEnum(StaticKnowledgeState.Initial, StaticKnowledgeState);
|
|
28
27
|
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @type {StaticKnowledgeDataTableDescriptor[]}
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
__specs = [];
|
|
35
|
+
|
|
37
36
|
|
|
38
37
|
/**
|
|
39
38
|
* Reset database, drop all table data
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StaticKnowledgeDatabase } from "./StaticKnowledgeDatabase.js";
|
|
2
|
+
import { StaticKnowledgeDataTable } from "./StaticKnowledgeDataTable.js";
|
|
3
|
+
|
|
4
|
+
test("constructor does not throw", () => {
|
|
5
|
+
new StaticKnowledgeDatabase()
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
test("reset empty", () => {
|
|
9
|
+
const database = new StaticKnowledgeDatabase();
|
|
10
|
+
|
|
11
|
+
database.reset();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test("add/get", () => {
|
|
15
|
+
const database = new StaticKnowledgeDatabase();
|
|
16
|
+
|
|
17
|
+
const table = new StaticKnowledgeDataTable();
|
|
18
|
+
database.add("x", "y", table)
|
|
19
|
+
|
|
20
|
+
const actual = database.getTable('x');
|
|
21
|
+
|
|
22
|
+
expect(actual).toBe(table);
|
|
23
|
+
});
|
|
@@ -6,12 +6,9 @@ import Path from "./Path.js";
|
|
|
6
6
|
const v0 = new Vector3();
|
|
7
7
|
|
|
8
8
|
export class PathSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
10
|
+
klass = Path;
|
|
11
|
+
version = 3;
|
|
15
12
|
|
|
16
13
|
/**
|
|
17
14
|
*
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/Bin
|
|
|
2
2
|
import PathFollower from "./PathFollower.js";
|
|
3
3
|
|
|
4
4
|
export class PathFollowerSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = PathFollower;
|
|
7
|
+
version = 3;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -5,3 +5,28 @@ test("sanity check on 1x1 grid", () => {
|
|
|
5
5
|
|
|
6
6
|
expect(path).toEqual([0]);
|
|
7
7
|
});
|
|
8
|
+
|
|
9
|
+
test("sanity check on 2x1 grid", () => {
|
|
10
|
+
const path = find_path_on_grid_astar(
|
|
11
|
+
[0, 0], 2, 1,
|
|
12
|
+
0, 1,
|
|
13
|
+
0, 0, 1
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(path).toEqual([0, 1]);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("sanity check on 2x2 grid", () => {
|
|
20
|
+
|
|
21
|
+
const path = find_path_on_grid_astar(
|
|
22
|
+
[
|
|
23
|
+
0, 0,
|
|
24
|
+
1, 0
|
|
25
|
+
],
|
|
26
|
+
2, 2,
|
|
27
|
+
0, 3,
|
|
28
|
+
0, 0, 1
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
expect(path).toEqual([0, 1, 3]);
|
|
32
|
+
});
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export class OptionAbstract {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @type {OptionGroup|null}
|
|
5
|
+
*/
|
|
6
|
+
parent = null;
|
|
7
|
+
|
|
2
8
|
/**
|
|
3
9
|
*
|
|
4
10
|
* @param {string} id
|
|
@@ -11,11 +17,6 @@ export class OptionAbstract {
|
|
|
11
17
|
*/
|
|
12
18
|
this.id = id;
|
|
13
19
|
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @type {OptionGroup|null}
|
|
17
|
-
*/
|
|
18
|
-
this.parent = null;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -8,20 +8,12 @@ function isOption(c) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export class OptionGroup extends OptionAbstract {
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
*
|
|
13
|
-
* @
|
|
14
|
-
* @constructor
|
|
14
|
+
* @type {Array<OptionGroup|Option>}
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
super(id);
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @type {Array<OptionGroup|Option>}
|
|
22
|
-
*/
|
|
23
|
-
this.children = [];
|
|
24
|
-
}
|
|
16
|
+
children = [];
|
|
25
17
|
|
|
26
18
|
/**
|
|
27
19
|
*
|
|
@@ -141,6 +133,7 @@ export class OptionGroup extends OptionAbstract {
|
|
|
141
133
|
*
|
|
142
134
|
* @param {string} path
|
|
143
135
|
* @param {Storage} storage
|
|
136
|
+
* @returns {Promise}
|
|
144
137
|
*/
|
|
145
138
|
attachToStorage(path, storage) {
|
|
146
139
|
const group = this;
|
|
@@ -151,20 +144,6 @@ export class OptionGroup extends OptionAbstract {
|
|
|
151
144
|
storage.load(key, resolve, reject);
|
|
152
145
|
});
|
|
153
146
|
|
|
154
|
-
p
|
|
155
|
-
.then((loaded) => {
|
|
156
|
-
try {
|
|
157
|
-
group.fromJSON(JSON.parse(loaded));
|
|
158
|
-
} catch (e) {
|
|
159
|
-
console.log('Failed to load options')
|
|
160
|
-
}
|
|
161
|
-
})
|
|
162
|
-
.catch(console.error)
|
|
163
|
-
.finally(() => {
|
|
164
|
-
|
|
165
|
-
group.traverseOptions(op => op.on.written.add(store));
|
|
166
|
-
});
|
|
167
|
-
|
|
168
147
|
|
|
169
148
|
function store() {
|
|
170
149
|
const json = group.toJSON();
|
|
@@ -174,6 +153,15 @@ export class OptionGroup extends OptionAbstract {
|
|
|
174
153
|
storage.store(key, value, noop, console.error, noop);
|
|
175
154
|
}
|
|
176
155
|
|
|
156
|
+
return p
|
|
157
|
+
.then((loaded) => {
|
|
158
|
+
group.fromJSON(JSON.parse(loaded));
|
|
159
|
+
})
|
|
160
|
+
.finally(() => {
|
|
161
|
+
|
|
162
|
+
group.traverseOptions(op => op.on.written.add(store));
|
|
163
|
+
});
|
|
164
|
+
|
|
177
165
|
}
|
|
178
166
|
}
|
|
179
167
|
|