@woosh/meep-engine 2.54.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.
Files changed (139) hide show
  1. package/package.json +1 -1
  2. package/src/core/__module.js +1 -1
  3. package/src/core/cache/Cache.js +1 -1
  4. package/src/core/collection/Stack.js +11 -14
  5. package/src/core/collection/array/array_contains_duplicates.js +5 -2
  6. package/src/core/collection/array/array_contains_duplicates.spec.js +14 -0
  7. package/src/core/collection/array/array_copy_entire.js +6 -11
  8. package/src/core/collection/array/array_get_index_in_range.js +5 -0
  9. package/src/core/collection/array/array_get_index_in_range.spec.js +16 -0
  10. package/src/core/collection/array/groupArrayBy.js +1 -1
  11. package/src/core/collection/array/isArrayEqual.js +4 -1
  12. package/src/core/collection/array/randomizeArrayElementOrder.js +1 -0
  13. package/src/core/collection/array/randomizeArrayElementOrder.spec.js +27 -0
  14. package/src/core/collection/heap/Uin32Heap.spec.js +64 -0
  15. package/src/core/collection/heap/Uint32Heap.js +6 -2
  16. package/src/core/collection/list/List.js +1 -0
  17. package/src/core/collection/{HashMap.js → map/HashMap.js} +10 -10
  18. package/src/core/collection/{HashMap.spec.js → map/HashMap.spec.js} +1 -1
  19. package/src/core/collection/{ObservedMap.js → map/ObservedMap.js} +1 -1
  20. package/src/core/collection/{HashSet.js → set/HashSet.js} +4 -3
  21. package/src/core/collection/{Set.d.ts → set/Set.d.ts} +1 -1
  22. package/src/core/collection/{Set.js → set/Set.js} +17 -14
  23. package/src/core/geom/2d/aabb/AABB2.js +1 -1
  24. package/src/core/geom/3d/aabb/AABB3.js +3 -1
  25. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_calc_edges.js +1 -1
  26. package/src/core/model/ObservedInteger.js +12 -7
  27. package/src/core/model/ObservedString.js +10 -8
  28. package/src/core/model/node-graph/visual/NodeGraphVisualData.js +1 -1
  29. package/src/core/model/object/ImmutableObjectPool.js +1 -1
  30. package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +1 -1
  31. package/src/engine/asset/AssetManager.js +3 -3
  32. package/src/engine/asset/loaders/GLTFAssetLoader.js +1 -1
  33. package/src/engine/ecs/EntityBlueprint.js +8 -10
  34. package/src/engine/ecs/animation/AnimationSerializationAdapter.js +2 -5
  35. package/src/engine/ecs/components/Motion.js +0 -27
  36. package/src/engine/ecs/components/MotionSerializationAdapter.js +26 -0
  37. package/src/engine/ecs/components/PropertySet.js +0 -29
  38. package/src/engine/ecs/components/PropertySetSerializationAdapter.js +29 -0
  39. package/src/engine/ecs/components/SerializationMetadata.js +0 -28
  40. package/src/engine/ecs/components/SerializationMetadataSerializationAdapter.js +26 -0
  41. package/src/engine/ecs/components/Steering.js +0 -35
  42. package/src/engine/ecs/components/SteeringSerializationAdapter.js +34 -0
  43. package/src/engine/ecs/components/Tag.js +6 -102
  44. package/src/engine/ecs/components/TagSerializationAdapter.js +44 -0
  45. package/src/engine/ecs/components/TagSerializationUpgrader_0_1.js +18 -0
  46. package/src/engine/ecs/components/Timer.js +1 -1
  47. package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +1 -1
  48. package/src/engine/ecs/dynamic_actions/rules/DynamicRuleCooldownDescription.js +10 -14
  49. package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +31 -39
  50. package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescriptionTable.js +1 -1
  51. package/src/engine/ecs/dynamic_actions/{DynamicRuleDescriptionTable.spec.js → rules/DynamicRuleDescriptionTable.spec.js} +12 -12
  52. package/src/engine/ecs/foliage/ecs/InstancedMeshSerializationAdapter.js +2 -5
  53. package/src/engine/ecs/fow/serialization/FogOfWarRevealerSerializationAdapter.js +2 -5
  54. package/src/engine/ecs/fow/serialization/FogOfWarSerializationAdapter.js +5 -8
  55. package/src/engine/ecs/gui/GUIElementSerializationAdapter.js +2 -5
  56. package/src/engine/ecs/gui/hud/HeadsUpDisplaySerializationAdapter.js +3 -6
  57. package/src/engine/ecs/gui/position/ViewportPosition.js +2 -5
  58. package/src/engine/ecs/ik/IKConstraint.js +95 -0
  59. package/src/engine/ecs/ik/InverseKinematics.js +10 -169
  60. package/src/engine/ecs/ik/InverseKinematicsSerializationAdapter.js +72 -0
  61. package/src/engine/ecs/speaker/Voice.js +5 -8
  62. package/src/engine/ecs/speaker/VoiceSystem.js +15 -19
  63. package/src/engine/ecs/speaker/lines/LineDescription.js +20 -25
  64. package/src/engine/ecs/speaker/lines/sets/LineSetDescription.js +15 -19
  65. package/src/engine/ecs/storage/binary/BinaryClassSerializationAdapter.js +7 -0
  66. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +1 -1
  67. package/src/engine/ecs/storage/binary/object/ObjectBasedClassSerializationAdapter.js +6 -9
  68. package/src/engine/ecs/team/TeamSerializationAdapter.js +2 -5
  69. package/src/engine/ecs/terrain/ecs/Terrain.spec.js +5 -0
  70. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js +23 -21
  71. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationAdapter.js +2 -5
  72. package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +2 -40
  73. package/src/engine/ecs/terrain/serialization/TerrainSerializationAdapter.js +7 -10
  74. package/src/engine/ecs/tooltip/TooltipComponent.spec.js +47 -0
  75. package/src/engine/ecs/tooltip/TooltipComponentSerializationAdapter.js +2 -5
  76. package/src/engine/ecs/transform/Transform.spec.js +52 -0
  77. package/src/engine/ecs/transform/TransformSerializationAdapter.js +2 -5
  78. package/src/engine/ecs/transform-attachment/TransformAttachment.js +18 -19
  79. package/src/engine/graphics/ecs/animation/AnimationController.js +20 -129
  80. package/src/engine/graphics/ecs/animation/AnimationControllerSerializationAdapter.js +27 -0
  81. package/src/engine/graphics/ecs/animation/AnimationRule.js +79 -0
  82. package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraphSerializationAdapter.js +9 -11
  83. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/AnimationGraphDefinitionSerializationAdapter.js +3 -5
  84. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.js +2 -5
  85. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationAdapter.js +2 -6
  86. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLander.js +3 -15
  87. package/src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.js +2 -4
  88. package/src/engine/graphics/ecs/highlight/HighlightSerializationAdapter.js +2 -5
  89. package/src/engine/graphics/ecs/highlight/renderer/OutlineRenderer.js +1 -1
  90. package/src/engine/graphics/ecs/light/LightSerializationAdapter.js +2 -5
  91. package/src/engine/graphics/ecs/mesh/serialization/MeshSerializationAdapter.js +2 -5
  92. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +3 -0
  93. package/src/engine/graphics/ecs/mesh-v2/render/adapters/InstancedRendererAdapter.js +1 -1
  94. package/src/engine/graphics/ecs/water/WaterSerializationAdapter.js +2 -5
  95. package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
  96. package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +1 -1
  97. package/src/engine/graphics/material/manager/MaterialManager.js +1 -1
  98. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -1
  99. package/src/engine/graphics/particles/node-based/codegen/CodeContext.js +1 -1
  100. package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +2 -5
  101. package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationAdapter.js +2 -5
  102. package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.js +1 -1
  103. package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.js +1 -1
  104. package/src/engine/graphics/texture/sampler/serialization/Sampler2DSerializationAdapter.js +2 -5
  105. package/src/engine/grid/grid2transform/GridPosition2Transform.js +11 -13
  106. package/src/engine/grid/grid2transform/GridPosition2TransformSerializationAdapter.js +3 -5
  107. package/src/engine/grid/obstacle/GridObstacleSerializationAdapter.js +2 -5
  108. package/src/engine/grid/position/GridPositionSerializationAdapter.js +2 -5
  109. package/src/engine/grid/transform2grid/Transform2GridPosition.js +10 -13
  110. package/src/engine/input/devices/KeyboardDevice.js +5 -2
  111. package/src/engine/input/devices/KeyboardDevice.spec.js +12 -0
  112. package/src/engine/input/devices/PointerDevice.js +5 -1
  113. package/src/engine/input/ecs/components/Input.js +37 -11
  114. package/src/engine/input/ecs/ism/InputBinding.js +30 -12
  115. package/src/engine/intelligence/behavior/ecs/BehaviorComponentSerializationAdapter.js +7 -10
  116. package/src/engine/intelligence/behavior/ecs/WaitForEventBehaviorSerializationAdapter.js +2 -5
  117. package/src/engine/intelligence/behavior/primitive/FailingBehaviorSerializationAdapter.js +2 -6
  118. package/src/engine/intelligence/behavior/primitive/SucceedingBehaviorSerializationAdapter.js +2 -5
  119. package/src/engine/intelligence/blackboard/BlackboardSerializationAdapter.js +2 -5
  120. package/src/engine/knowledge/database/StaticKnowledgeDatabase.js +12 -13
  121. package/src/engine/knowledge/database/StaticKnowledgeDatabase.spec.js +23 -0
  122. package/src/engine/navigation/ecs/components/PathSerializationAdapter.js +2 -5
  123. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationAdapter.js +2 -5
  124. package/src/engine/navigation/grid/find_path_on_grid_astar.spec.js +25 -0
  125. package/src/engine/options/OptionAbstract.js +6 -5
  126. package/src/engine/options/OptionGroup.js +13 -25
  127. package/src/engine/options/OptionGroup.spec.js +61 -0
  128. package/src/engine/save/storage/InMemoryStorage.js +3 -2
  129. package/src/engine/sound/ecs/SoundController.js +2 -6
  130. package/src/engine/sound/ecs/SoundListener.js +3 -21
  131. package/src/engine/sound/ecs/emitter/SoundEmitterSerializationAdapter.js +2 -6
  132. package/src/generation/theme/ThemeEngine.js +1 -1
  133. package/src/core/collection/LazyStream.js +0 -23
  134. package/src/core/collection/LazyStream.spec.js +0 -13
  135. package/src/core/collection/heap/BinaryHeap.js +0 -153
  136. package/src/engine/ecs/components/GeometryBVH.js +0 -44
  137. package/src/engine/ecs/systems/GeometryBVHSystem.js +0 -36
  138. /package/src/core/collection/{HashMap.d.ts → map/HashMap.d.ts} +0 -0
  139. /package/src/core/collection/{HashSet.d.ts → set/HashSet.d.ts} +0 -0
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../../ecs/storage/binary/
2
2
  import { Camera } from "../Camera.js";
3
3
 
4
4
  export class CameraSerializationAdapter extends BinaryClassSerializationAdapter {
5
- constructor() {
6
- super();
7
5
 
8
- this.klass = Camera;
9
- this.version = 0;
10
- }
6
+ klass = Camera;
7
+ version = 0;
11
8
 
12
9
  /**
13
10
  *
@@ -3,12 +3,8 @@ import TopDownCameraController from "./TopDownCameraController.js";
3
3
 
4
4
  export class TopDownCameraControllerSerializationAdapter extends BinaryClassSerializationAdapter {
5
5
 
6
- constructor() {
7
- super();
8
-
9
- this.klass = TopDownCameraController;
10
- this.version = 1;
11
- }
6
+ klass = TopDownCameraController;
7
+ version = 1;
12
8
 
13
9
  /**
14
10
  *
@@ -1,26 +1,14 @@
1
1
  import { BinaryClassSerializationAdapter } from "../../../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
2
2
 
3
3
  export class TopDownCameraLander {
4
- constructor() {
5
-
6
- }
7
4
  }
8
5
 
9
6
  TopDownCameraLander.typeName = 'TopDownCameraLander';
10
7
 
11
8
  export class TopDownCameraLanderSerializationAdapter extends BinaryClassSerializationAdapter {
12
- constructor() {
13
- super();
14
-
15
- this.klass = TopDownCameraLander;
16
- this.version = 0;
17
- }
18
-
19
- serialize(buffer, value) {
20
-
21
- }
22
9
 
23
- deserialize(buffer, value) {
10
+ klass = TopDownCameraLander;
11
+ version = 0;
24
12
 
25
- }
13
+ // NO-OP
26
14
  }
@@ -2,11 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../../ecs/storage/binary/
2
2
  import { Decal } from "./Decal.js";
3
3
 
4
4
  export class DecalSerializationAdapter extends BinaryClassSerializationAdapter {
5
- constructor() {
6
- super();
7
5
 
8
- this.klass = Decal;
9
- }
6
+ klass = Decal;
7
+ version = 0;
10
8
 
11
9
  /**
12
10
  *
@@ -6,12 +6,9 @@ import {
6
6
  } from "../../../ecs/storage/COMPONENT_SERIALIZATION_TRANSIENT_FIELD.js";
7
7
 
8
8
  export class HighlightSerializationAdapter extends BinaryClassSerializationAdapter {
9
- constructor() {
10
- super();
11
9
 
12
- this.klass = Highlight;
13
- this.version = 1;
14
- }
10
+ klass = Highlight;
11
+ version = 1;
15
12
 
16
13
  /**
17
14
  *
@@ -22,7 +22,7 @@ import { makeHighlightDecodeShader } from "./HighlightDecodeShader.js";
22
22
  import { makeDilationShader } from "./makeDilationShader.js";
23
23
  import { ScreenSpaceQuadShader } from "../../../shaders/ScreenSpaceQuadShader.js";
24
24
  import { makeGaussianBlurShader } from "./makeGaussianBlurShader.js";
25
- import { HashMap } from "../../../../../core/collection/HashMap.js";
25
+ import { HashMap } from "../../../../../core/collection/map/HashMap.js";
26
26
  import { invokeObjectEquals } from "../../../../../core/model/object/invokeObjectEquals.js";
27
27
  import { invokeObjectHash } from "../../../../../core/model/object/invokeObjectHash.js";
28
28
  import { assert } from "../../../../../core/assert.js";
@@ -3,12 +3,9 @@ import { LightType } from "./LightType.js";
3
3
  import { Light } from "./Light.js";
4
4
 
5
5
  export class LightSerializationAdapter extends BinaryClassSerializationAdapter {
6
- constructor() {
7
- super();
8
6
 
9
- this.klass = Light;
10
- this.version = 0;
11
- }
7
+ klass = Light;
8
+ version = 0;
12
9
 
13
10
  /**
14
11
  *
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../../ecs/storage/binary/
2
2
  import Mesh from "../Mesh.js";
3
3
 
4
4
  export class MeshSerializationAdapter extends BinaryClassSerializationAdapter {
5
- constructor() {
6
- super();
7
5
 
8
- this.klass = Mesh;
9
- this.version = 0;
10
- }
6
+ klass = Mesh;
7
+ version = 0;
11
8
 
12
9
 
13
10
  /**
@@ -37,6 +37,9 @@ const scratch_m4 = new Float32Array(16);
37
37
  */
38
38
  const scratch_ray_0 = new Float32Array(6);
39
39
 
40
+ /**
41
+ * Represents a primitive 3d object, a combination of a material and geometry
42
+ */
40
43
  export class ShadedGeometry {
41
44
  constructor() {
42
45
  /**
@@ -1,5 +1,5 @@
1
1
  import { AbstractRenderAdapter } from "./AbstractRenderAdapter.js";
2
- import { HashMap } from "../../../../../../core/collection/HashMap.js";
2
+ import { HashMap } from "../../../../../../core/collection/map/HashMap.js";
3
3
  import { InstancedMeshGroup } from "../../../../geometry/instancing/InstancedMeshGroup.js";
4
4
  import { ShadedGeometryFlags } from "../../ShadedGeometryFlags.js";
5
5
  import { StreamDrawUsage } from "three";
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/Bin
2
2
  import Water from "./Water.js";
3
3
 
4
4
  export class WaterSerializationAdapter extends BinaryClassSerializationAdapter {
5
- constructor() {
6
- super();
7
5
 
8
- this.klass = Water;
9
- this.version = 1;
10
- }
6
+ klass = Water;
7
+ version = 1;
11
8
 
12
9
  /**
13
10
  *
@@ -1,5 +1,5 @@
1
1
  import { StaticMaterialCache } from "../../../../asset/loaders/material/StaticMaterialCache.js";
2
- import { HashMap } from "../../../../../core/collection/HashMap.js";
2
+ import { HashMap } from "../../../../../core/collection/map/HashMap.js";
3
3
  import { computeGeometryEquality } from "../../buffered/computeGeometryEquality.js";
4
4
  import { computeGeometryHash } from "../../buffered/computeGeometryHash.js";
5
5
  import { array_copy } from "../../../../../core/collection/array/array_copy.js";
@@ -7,7 +7,7 @@ import { mat4, vec3 } from "gl-matrix";
7
7
  import { BakeShaderStandard } from "./shader/BakeShaderStandard.js";
8
8
  import { Sampler2D } from "../../texture/sampler/Sampler2D.js";
9
9
  import Signal from "../../../../core/events/signal/Signal.js";
10
- import { HashMap } from "../../../../core/collection/HashMap.js";
10
+ import { HashMap } from "../../../../core/collection/map/HashMap.js";
11
11
  import { computeMaterialHash } from "../../../asset/loaders/material/computeMaterialHash.js";
12
12
  import { computeMaterialEquality } from "../../../asset/loaders/material/computeMaterialEquality.js";
13
13
  import { UvEncoder } from "./grid/UvEncoder.js";
@@ -1,4 +1,4 @@
1
- import { HashMap } from "../../../../core/collection/HashMap.js";
1
+ import { HashMap } from "../../../../core/collection/map/HashMap.js";
2
2
  import { ManagedMaterial } from "./ManagedMaterial.js";
3
3
  import { Cache } from "../../../../core/cache/Cache.js";
4
4
  import { computeMaterialHash } from "../../../asset/loaders/material/computeMaterialHash.js";
@@ -1,6 +1,6 @@
1
1
  import { traverseThreeObject } from "../../ecs/highlight/renderer/traverseThreeObject.js";
2
2
  import { TextureAttachmentsByMaterialType } from "../../../asset/loaders/material/TextureAttachmensByMaterialType.js";
3
- import { HashMap } from "../../../../core/collection/HashMap.js";
3
+ import { HashMap } from "../../../../core/collection/map/HashMap.js";
4
4
  import AABB2 from "../../../../core/geom/AABB2.js";
5
5
  import { MaxRectanglesPacker } from "../../../../core/geom/packing/max-rect/MaxRectangles.js";
6
6
  import { Sampler2D } from "../../texture/sampler/Sampler2D.js";
@@ -1,4 +1,4 @@
1
- import { HashMap } from "../../../../../core/collection/HashMap.js";
1
+ import { HashMap } from "../../../../../core/collection/map/HashMap.js";
2
2
  import { NodeInstancePortReference } from "../../../../../core/model/node-graph/node/NodeInstancePortReference.js";
3
3
 
4
4
  export class CodeContext {
@@ -4,12 +4,9 @@ import {
4
4
  import { ParameterLookupTable } from "../../parameter/ParameterLookupTable.js";
5
5
 
6
6
  export class ParameterLookupTableSerializationAdapter extends BinaryClassSerializationAdapter {
7
- constructor() {
8
- super();
9
7
 
10
- this.klass = ParameterLookupTable;
11
- this.version = 0;
12
- }
8
+ klass = ParameterLookupTable;
9
+ version = 0;
13
10
 
14
11
  /**
15
12
  *
@@ -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
- this.klass = ParticleEmitter;
14
- this.version = 1;
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
- this.version = 0;
9
- this.klass = Sampler2D;
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
- constructor() {
13
- /**
14
- *
15
- * @type {Vector2}
16
- */
17
- this.offset = new Vector2(0, 0);
18
-
19
- /**
20
- *
21
- * @type {GridPosition2TransformFlags|number}
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
- this.klass = GridPosition2Transform;
9
- this.version = 1;
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
- this.klass = GridObstacle;
9
- this.version = 0;
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
- this.klass = GridPosition;
9
- this.version = 1;
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
- constructor() {
5
- /**
6
- *
7
- * @type {Transform2GridPositionFlags|number}
8
- */
9
- this.flags = 0;
10
-
11
- /**
12
- *
13
- * @type {number}
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 (!isFocusable(domElement) && domElement.getAttribute('tabindex') === null) {
77
- console.error('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.');
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
  /**
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+
5
+ import KeyboardDevice from "./KeyboardDevice.js";
6
+
7
+ test("constructor does not throw", () => {
8
+ const el = document.createElement('div');
9
+ el.setAttribute('tabindex', "0");
10
+
11
+ new KeyboardDevice(el);
12
+ });
@@ -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
- constructor() {
8
- /**
9
- *
10
- * @type {List<InputBinding>}
11
- */
12
- this.bindings = new List();
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.typeOf(path, 'string', "path");
23
- assert.typeOf(event, 'string', "event");
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 this.bindings.some(b => b.path === path && b.event === event);
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.typeOf(path, 'string', path);
36
- assert.typeOf(event, 'string', path);
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
- constructor() {
5
- /**
6
- *
7
- * @type {string}
8
- */
9
- this.path = "";
10
- /**
11
- *
12
- * @type {string}
13
- */
14
- this.event = "";
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
- this.klass = BehaviorComponent;
11
- this.version = 0;
8
+ klass = BehaviorComponent;
9
+ version = 0;
12
10
 
13
- /**
14
- *
15
- * @type {BinaryObjectSerializationAdapter}
16
- */
17
- this.objectAdapter = null;
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
- this.klass = WaitForEventBehavior;
9
- this.version = 0;
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
- constructor() {
6
- super();
7
-
8
- this.klass = FailingBehavior;
9
- this.version = 0;
10
- }
5
+ klass = FailingBehavior;
6
+ version = 0;
11
7
 
12
8
  /**
13
9
  *
@@ -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
- this.klass = SucceedingBehavior;
9
- this.version = 0;
10
- }
6
+ klass = SucceedingBehavior;
7
+ version = 0;
11
8
 
12
9
  /**
13
10
  *