@woosh/meep-engine 2.75.8 → 2.76.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 (107) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +784 -982
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +784 -982
  5. package/editor/actions/concrete/ModifyPatchSampler2DAction.js +6 -3
  6. package/editor/actions/concrete/PatchTerrainTextureAction.js +6 -3
  7. package/editor/process/EditorProcess.js +12 -16
  8. package/editor/process/ProcessEngine.js +9 -10
  9. package/package.json +1 -1
  10. package/src/core/binary/dec2hex.js +1 -1
  11. package/src/{engine/ecs/ik/IKMath.js → core/geom/vec3/v3_computeOffsetVector.js} +1 -1
  12. package/src/core/math/newton_solver_1d.js +13 -4
  13. package/src/{engine/graphics → core/math/random}/generate_halton_jitter.js +2 -2
  14. package/src/core/math/solveQuadratic.js +5 -3
  15. package/src/core/math/spline/catmull_rom_compute_T.js +19 -0
  16. package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSpline.js +3 -3
  17. package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSplineUniformDistance.js +3 -3
  18. package/src/core/math/spline/computeNonuniformCatmullRomSplineSample.js +109 -0
  19. package/src/core/math/spline/interpolate_bicubic.js +12 -0
  20. package/src/core/math/spline/spline_catmullrom_1d.js +120 -0
  21. package/src/engine/control/ControlContext.js +25 -27
  22. package/src/engine/ecs/EntityManager.js +12 -9
  23. package/src/engine/ecs/EntityObserver.js +26 -22
  24. package/src/engine/ecs/binding/ComponentPropertyPath.js +12 -12
  25. package/src/engine/ecs/components/Motion.js +5 -7
  26. package/src/engine/ecs/components/SerializationMetadata.js +5 -3
  27. package/src/engine/ecs/dynamic_actions/actions/definition/AbstractActionDescription.js +0 -2
  28. package/src/engine/ecs/dynamic_actions/actions/definition/ActionSequenceDescription.js +7 -9
  29. package/src/engine/ecs/dynamic_actions/actions/definition/DelayActionDescription.js +3 -5
  30. package/src/engine/ecs/dynamic_actions/actions/definition/SendRequestActionDescription.js +6 -8
  31. package/src/engine/ecs/dynamic_actions/actions/definition/SpeakLineActionDescription.js +14 -17
  32. package/src/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +8 -11
  33. package/src/engine/ecs/dynamic_actions/actions/definition/WriteToBlackboardActionDescription.js +15 -18
  34. package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +7 -7
  35. package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +6 -6
  36. package/src/engine/ecs/parent/EntityNode.js +39 -37
  37. package/src/engine/ecs/speaker/VoiceSystem.js +36 -39
  38. package/src/engine/ecs/system/SystemEntityContext.js +25 -23
  39. package/src/engine/ecs/tag/find_entities_with_tag.js +18 -0
  40. package/src/engine/ecs/terrain/TerrainClouds.js +23 -24
  41. package/src/engine/ecs/terrain/ecs/splat/SplatMapMaterialPatch.js +5 -2
  42. package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +15 -14
  43. package/src/engine/ecs/tooltip/TooltipComponent.js +6 -7
  44. package/src/engine/graphics/camera/testClippingPlaneComputation.js +0 -4
  45. package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +1 -5
  46. package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +2 -6
  47. package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +12 -14
  48. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +22 -20
  49. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +3 -4
  50. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -4
  51. package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +1 -1
  52. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +0 -4
  53. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +0 -4
  54. package/src/engine/graphics/shadows/testShadowMapRendering.js +0 -2
  55. package/src/engine/graphics/texture/atlas/TextureAtlas.js +13 -11
  56. package/src/engine/graphics/texture/sampler/Sampler2D.js +15 -366
  57. package/src/engine/graphics/texture/sampler/Sampler2D.spec.js +0 -31
  58. package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.js +166 -0
  59. package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.spec.js +31 -0
  60. package/src/engine/graphics/texture/sampler/sampler2d_paint.js +81 -0
  61. package/src/engine/graphics/texture/sampler/sampler2d_sub_copy_same_item_size.js +50 -0
  62. package/src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.js +1 -1
  63. package/src/engine/navigation/ecs/components/Path.js +10 -9
  64. package/src/engine/physics/computeInterceptPoint.js +44 -0
  65. package/src/engine/plugin/EnginePlugin.js +1 -2
  66. package/src/engine/ecs/components/AlignToVelocity.js +0 -9
  67. package/src/engine/ecs/components/CharacterController.js +0 -31
  68. package/src/engine/ecs/components/PhysicalBody.js +0 -51
  69. package/src/engine/ecs/components/Steering.js +0 -111
  70. package/src/engine/ecs/components/SteeringSerializationAdapter.js +0 -34
  71. package/src/engine/ecs/systems/AlignToVelocitySystem.js +0 -51
  72. package/src/engine/ecs/systems/CharacterControlSystem.js +0 -134
  73. package/src/engine/ecs/systems/PhysicsSystem.js +0 -89
  74. package/src/engine/ecs/systems/PropertySetSystem.js +0 -18
  75. package/src/engine/ecs/systems/SteeringSystem.js +0 -171
  76. package/src/engine/ecs/systems/TagSystem.d.ts +0 -5
  77. package/src/engine/ecs/systems/TagSystem.js +0 -31
  78. package/src/engine/graphics/CanvasBlur.js +0 -599
  79. package/src/engine/graphics/material/LoadMaterial.js +0 -199
  80. package/src/engine/graphics/material/getTextureImmediate.js +0 -21
  81. package/src/engine/graphics/render/buffer/RenderGraph.js +0 -177
  82. package/src/engine/graphics/render/buffer/RenderGraphUtils.js +0 -32
  83. package/src/engine/graphics/render/buffer/buffers/DepthFrameBuffer.js +0 -101
  84. package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnection.js +0 -43
  85. package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnectionEndpoint.js +0 -39
  86. package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnectionValidator.js +0 -30
  87. package/src/engine/graphics/render/buffer/executor/FrameBufferPool.js +0 -127
  88. package/src/engine/graphics/render/buffer/executor/RenderGraphExecutor.js +0 -261
  89. package/src/engine/graphics/render/buffer/executor/RenderProgramCommandType.js +0 -5
  90. package/src/engine/graphics/render/buffer/node/DeferredRenderProgramDefinition.js +0 -142
  91. package/src/engine/graphics/render/buffer/node/RenderProgramDefinition.js +0 -21
  92. package/src/engine/graphics/render/buffer/node/RenderProgramInstance.js +0 -30
  93. package/src/engine/graphics/render/buffer/node/ScreenSpaceRenderProgramDefinition.js +0 -118
  94. package/src/engine/graphics/render/staged/PostProcessingEffect.js +0 -32
  95. package/src/engine/graphics/render/staged/PostProcessingEffectInputCoupling.js +0 -41
  96. package/src/engine/graphics/render/staged/PostProcessingStack.js +0 -29
  97. package/src/engine/graphics/render/staged/StagedRenderer.js +0 -161
  98. package/src/engine/graphics/render/staged/StandardRenderOutputs.js +0 -20
  99. package/src/engine/graphics/texture/CanvasClone.js +0 -28
  100. package/src/engine/graphics/texture/sampler/bicubic.js +0 -59
  101. package/src/engine/graphics/texture/sampler/bicubic.spec.js +0 -13
  102. package/src/engine/graphics/texture/sampler/differenceSampler.js +0 -36
  103. package/src/engine/graphics/texture/sampler/loadSampler2D.js +0 -41
  104. package/src/engine/graphics/texture/sampler/mergeSampler2D.js +0 -96
  105. package/src/engine/graphics/texture/sampler/rgbaData2valueSampler2D.js +0 -38
  106. package/src/engine/navigation/ecs/components/computeNonuniformCatmullRomSplineSample.js +0 -242
  107. /package/src/{engine/graphics/texture → core/math/noise}/noise_octaves.js +0 -0
@@ -6,10 +6,29 @@
6
6
  * @constructor
7
7
  * @class
8
8
  */
9
- import { BitSet } from "../../core/binary/BitSet.js";
10
9
  import { assert } from "../../core/assert.js";
10
+ import { BitSet } from "../../core/binary/BitSet.js";
11
11
 
12
12
  export class EntityObserver {
13
+ /**
14
+ *
15
+ * @type {BitSet}
16
+ */
17
+ componentMask = new BitSet();
18
+
19
+ /**
20
+ * Mapping from component index to position in array of observed component types,
21
+ * this is used to build arguments for callbacks
22
+ * @type {number[]}
23
+ */
24
+ componentIndexMapping = [];
25
+
26
+ /**
27
+ *
28
+ * @type {EntityComponentDataset|null}
29
+ */
30
+ dataset = null;
31
+
13
32
  /**
14
33
  *
15
34
  * @param {Array} componentTypes
@@ -18,7 +37,12 @@ export class EntityObserver {
18
37
  * @param {*} [thisArg=undefined] will assume {@link this} value inside callbacks
19
38
  * @constructor
20
39
  */
21
- constructor(componentTypes, completedCallback, brokenCallback, thisArg) {
40
+ constructor(
41
+ componentTypes,
42
+ completedCallback,
43
+ brokenCallback,
44
+ thisArg
45
+ ) {
22
46
  assert.isArray(componentTypes, 'componentTypes must be an array, instead was something else');
23
47
  assert.isFunction(completedCallback, 'completedCallback');
24
48
  assert.isFunction(brokenCallback, 'brokenCallback');
@@ -57,26 +81,6 @@ export class EntityObserver {
57
81
  * @type {*}
58
82
  */
59
83
  this.thisArg = thisArg;
60
-
61
-
62
- /**
63
- *
64
- * @type {BitSet}
65
- */
66
- this.componentMask = new BitSet();
67
-
68
- /**
69
- * Mapping from component index to position in array of observed component types,
70
- * this is used to build arguments for callbacks
71
- * @type {number[]}
72
- */
73
- this.componentIndexMapping = [];
74
-
75
- /**
76
- *
77
- * @type {EntityComponentDataset|null}
78
- */
79
- this.dataset = null;
80
84
  }
81
85
 
82
86
  /**
@@ -1,15 +1,15 @@
1
1
  export class ComponentPropertyPath {
2
- constructor() {
3
- /**
4
- * Component type name
5
- * @type {string}
6
- */
7
- this.component = "";
8
2
 
9
- /**
10
- * Path to the property
11
- * @type {string}
12
- */
13
- this.path = "";
14
- }
3
+ /**
4
+ * Component type name
5
+ * @type {string}
6
+ */
7
+ component = "";
8
+
9
+ /**
10
+ * Path to the property
11
+ * @type {string}
12
+ */
13
+ path = "";
14
+
15
15
  }
@@ -7,13 +7,11 @@ import Vector3 from '../../../core/geom/Vector3.js';
7
7
 
8
8
 
9
9
  class Motion {
10
- constructor() {
11
- /**
12
- * @readonly
13
- * @type {Vector3}
14
- */
15
- this.velocity = new Vector3();
16
- }
10
+ /**
11
+ * @readonly
12
+ * @type {Vector3}
13
+ */
14
+ velocity = new Vector3();
17
15
 
18
16
  toJSON() {
19
17
  return {
@@ -3,10 +3,12 @@ export const SerializationFlags = {
3
3
  };
4
4
 
5
5
  export class SerializationMetadata {
6
- constructor() {
7
- this.flags = 0;
8
- }
9
6
 
7
+ /**
8
+ *
9
+ * @type {number}
10
+ */
11
+ flags = 0;
10
12
 
11
13
  /**
12
14
  *
@@ -1,6 +1,4 @@
1
1
  export class AbstractActionDescription {
2
- constructor() {
3
- }
4
2
 
5
3
  /**
6
4
  * Main entry point
@@ -1,16 +1,14 @@
1
- import { AbstractActionDescription } from "./AbstractActionDescription.js";
2
1
  import { SequenceBehavior } from "../../../../intelligence/behavior/composite/SequenceBehavior.js";
2
+ import { AbstractActionDescription } from "./AbstractActionDescription.js";
3
3
 
4
4
  export class ActionSequenceDescription extends AbstractActionDescription {
5
- constructor() {
6
- super();
7
5
 
8
- /**
9
- *
10
- * @type {AbstractActionDescription[]}
11
- */
12
- this.elements = [];
13
- }
6
+
7
+ /**
8
+ *
9
+ * @type {AbstractActionDescription[]}
10
+ */
11
+ elements = [];
14
12
 
15
13
  execute(actor, dataset, context, system) {
16
14
  const sequence = this.elements.map(e => {
@@ -1,12 +1,10 @@
1
- import { AbstractActionDescription } from "./AbstractActionDescription.js";
2
1
  import { DelayBehavior } from "../../../../intelligence/behavior/util/DelayBehavior.js";
2
+ import { AbstractActionDescription } from "./AbstractActionDescription.js";
3
3
 
4
4
  export class DelayActionDescription extends AbstractActionDescription {
5
- constructor() {
6
- super();
7
5
 
8
- this.time = 0;
9
- }
6
+
7
+ time = 0;
10
8
 
11
9
  execute(actor, dataset, context, system) {
12
10
  return DelayBehavior.from(this.time);
@@ -1,17 +1,15 @@
1
- import { AbstractActionDescription } from "./AbstractActionDescription.js";
2
1
  import { assert } from "../../../../../core/assert.js";
2
+ import { compileReactiveExpression } from "../../../../../core/lang/reactive/compileReactiveExpression.js";
3
3
  import { ActionBehavior } from "../../../../intelligence/behavior/primitive/ActionBehavior.js";
4
4
  import { Transform } from "../../../transform/Transform.js";
5
- import { compileReactiveExpression } from "../../../../../core/lang/reactive/compileReactiveExpression.js";
5
+ import { AbstractActionDescription } from "./AbstractActionDescription.js";
6
6
 
7
7
  export class SendRequestActionDescription extends AbstractActionDescription {
8
- constructor() {
9
- super();
10
8
 
11
- this.distance = Number.POSITIVE_INFINITY;
12
- this.responders = 1;
13
- this.context = {};
14
- }
9
+
10
+ distance = Number.POSITIVE_INFINITY;
11
+ responders = 1;
12
+ context = {};
15
13
 
16
14
  fromJSON({
17
15
  distance = Number.POSITIVE_INFINITY,
@@ -1,31 +1,28 @@
1
- import { AbstractActionDescription } from "./AbstractActionDescription.js";
1
+ import { SendEventBehavior } from "../../../../../../../model/game/util/behavior/SendEventBehavior.js";
2
+ import { assert } from "../../../../../core/assert.js";
2
3
  import {
3
4
  ParallelBehavior,
4
5
  ParallelBehaviorPolicy
5
6
  } from "../../../../intelligence/behavior/composite/ParallelBehavior.js";
6
7
  import { WaitForEventBehavior } from "../../../../intelligence/behavior/ecs/WaitForEventBehavior.js";
7
8
  import { VoiceEvents } from "../../../speaker/VoiceEvents.js";
8
- import { SendEventBehavior } from "../../../../../../../model/game/util/behavior/SendEventBehavior.js";
9
- import { assert } from "../../../../../core/assert.js";
9
+ import { AbstractActionDescription } from "./AbstractActionDescription.js";
10
10
 
11
11
  export class SpeakLineActionDescription extends AbstractActionDescription {
12
- constructor() {
13
- super();
14
12
 
15
- /**
16
- *
17
- * @type {string}
18
- */
19
- this.id = "";
13
+ /**
14
+ *
15
+ * @type {string}
16
+ */
17
+ id = "";
20
18
 
21
- this.isGroup = false;
19
+ isGroup = false;
22
20
 
23
- /**
24
- * If override is on, will request speaking a line even if another line is currently being spoken
25
- * @type {boolean}
26
- */
27
- this.override = false;
28
- }
21
+ /**
22
+ * If override is on, will request speaking a line even if another line is currently being spoken
23
+ * @type {boolean}
24
+ */
25
+ override = false;
29
26
 
30
27
  execute(actor, dataset, context, system) {
31
28
  const id = this.id;
@@ -1,18 +1,15 @@
1
- import { AbstractActionDescription } from "./AbstractActionDescription.js";
2
- import { WeightedRandomBehavior } from "../../../../intelligence/behavior/selector/WeightedRandomBehavior.js";
3
- import { WeightedElement } from "../../../../intelligence/behavior/selector/WeightedElement.js";
4
1
  import { computeHashFloat } from "../../../../../core/primitives/numbers/computeHashFloat.js";
2
+ import { WeightedElement } from "../../../../intelligence/behavior/selector/WeightedElement.js";
3
+ import { WeightedRandomBehavior } from "../../../../intelligence/behavior/selector/WeightedRandomBehavior.js";
4
+ import { AbstractActionDescription } from "./AbstractActionDescription.js";
5
5
 
6
6
  export class WeightedRandomActionDescription extends AbstractActionDescription {
7
- constructor() {
8
- super();
9
7
 
10
- /**
11
- *
12
- * @type {WeightedElement<AbstractActionDescription>[]}
13
- */
14
- this.elements = [];
15
- }
8
+ /**
9
+ *
10
+ * @type {WeightedElement<AbstractActionDescription>[]}
11
+ */
12
+ elements = [];
16
13
 
17
14
  execute(actor, dataset, context, system) {
18
15
 
@@ -1,25 +1,22 @@
1
- import { AbstractActionDescription } from "./AbstractActionDescription.js";
1
+ import { assert } from "../../../../../core/assert.js";
2
+ import { compileReactiveExpression } from "../../../../../core/lang/reactive/compileReactiveExpression.js";
2
3
  import { ActionBehavior } from "../../../../intelligence/behavior/primitive/ActionBehavior.js";
3
4
  import { Blackboard } from "../../../../intelligence/blackboard/Blackboard.js";
4
- import { compileReactiveExpression } from "../../../../../core/lang/reactive/compileReactiveExpression.js";
5
- import { assert } from "../../../../../core/assert.js";
5
+ import { AbstractActionDescription } from "./AbstractActionDescription.js";
6
6
 
7
7
  export class WriteToBlackboardActionDescription extends AbstractActionDescription {
8
- constructor() {
9
- super();
10
-
11
- /**
12
- *
13
- * @type {ReactiveExpression}
14
- */
15
- this.expression = null;
16
-
17
- /**
18
- *
19
- * @type {string}
20
- */
21
- this.name = "";
22
- }
8
+
9
+ /**
10
+ *
11
+ * @type {ReactiveExpression}
12
+ */
13
+ expression = null;
14
+
15
+ /**
16
+ *
17
+ * @type {string}
18
+ */
19
+ name = "";
23
20
 
24
21
  execute(actor, dataset, context, system) {
25
22
 
@@ -1,14 +1,14 @@
1
- import { clamp } from "../../../core/math/clamp.js";
2
- import { inverseLerp } from "../../../core/math/inverseLerp.js";
3
- import { IKSolver } from "./IKSolver.js";
4
- import { findSkeletonBoneByType } from "../../graphics/ecs/mesh/SkeletonUtils.js";
5
- import Quaternion from "../../../core/geom/Quaternion.js";
6
- import Vector3 from "../../../core/geom/Vector3.js";
7
1
  import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
8
- import { v3_computeOffsetVector } from "./IKMath.js";
2
+ import Quaternion from "../../../core/geom/Quaternion.js";
3
+ import { v3_computeOffsetVector } from "../../../core/geom/vec3/v3_computeOffsetVector.js";
9
4
  import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
10
5
  import { v3_length } from "../../../core/geom/vec3/v3_length.js";
6
+ import Vector3 from "../../../core/geom/Vector3.js";
7
+ import { clamp } from "../../../core/math/clamp.js";
11
8
  import { clamp01 } from "../../../core/math/clamp01.js";
9
+ import { inverseLerp } from "../../../core/math/inverseLerp.js";
10
+ import { findSkeletonBoneByType } from "../../graphics/ecs/mesh/SkeletonUtils.js";
11
+ import { IKSolver } from "./IKSolver.js";
12
12
 
13
13
  const boneWorldPosition = new Vector3();
14
14
  const boneWorldRotation = new Quaternion();
@@ -1,15 +1,15 @@
1
1
  import { assert } from "../../../core/assert.js";
2
+ import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
3
+ import Quaternion from "../../../core/geom/Quaternion.js";
4
+ import { v3_computeOffsetVector } from "../../../core/geom/vec3/v3_computeOffsetVector.js";
5
+ import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
6
+ import { v3_length } from "../../../core/geom/vec3/v3_length.js";
2
7
  import Vector3 from "../../../core/geom/Vector3.js";
3
8
  import { clamp } from "../../../core/math/clamp.js";
9
+ import { clamp01 } from "../../../core/math/clamp01.js";
4
10
  import { inverseLerp } from "../../../core/math/inverseLerp.js";
5
- import Quaternion from "../../../core/geom/Quaternion.js";
6
11
  import { findSkeletonBoneByType } from "../../graphics/ecs/mesh/SkeletonUtils.js";
7
- import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
8
12
  import { IKSolver } from "./IKSolver.js";
9
- import { v3_computeOffsetVector } from "./IKMath.js";
10
- import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
11
- import { v3_length } from "../../../core/geom/vec3/v3_length.js";
12
- import { clamp01 } from "../../../core/math/clamp01.js";
13
13
 
14
14
  const boneWorldPositionC = new Vector3();
15
15
  const boneWorldPositionB = new Vector3();
@@ -1,27 +1,53 @@
1
- import {assert} from "../../../core/assert.js";
2
- import {array_push_if_unique} from "../../../core/collection/array/array_push_if_unique.js";
3
- import {array_remove_first} from "../../../core/collection/array/array_remove_first.js";
1
+ import { assert } from "../../../core/assert.js";
2
+ import { array_push_if_unique } from "../../../core/collection/array/array_push_if_unique.js";
3
+ import { array_remove_first } from "../../../core/collection/array/array_remove_first.js";
4
4
  import Signal from "../../../core/events/signal/Signal.js";
5
5
  import Entity from "../Entity.js";
6
- import {TransformAttachment, TransformAttachmentFlags} from "../transform-attachment/TransformAttachment.js";
7
- import {Transform} from "../transform/Transform.js";
8
- import {EntityNodeFlags} from "./EntityNodeFlags.js";
9
- import {ParentEntity} from "./ParentEntity.js";
6
+ import { TransformAttachment, TransformAttachmentFlags } from "../transform-attachment/TransformAttachment.js";
7
+ import { Transform } from "../transform/Transform.js";
8
+ import { EntityNodeFlags } from "./EntityNodeFlags.js";
9
+ import { ParentEntity } from "./ParentEntity.js";
10
10
 
11
11
  const DEFAULT_FLAGS = EntityNodeFlags.LiveManagement;
12
12
 
13
13
  export class EntityNode {
14
+ /**
15
+ *
16
+ * @type {EntityNode|null}
17
+ * @private
18
+ */
19
+ __parent = null;
20
+
21
+ /**
22
+ *
23
+ * @type {EntityNode[]}
24
+ * @private
25
+ */
26
+ __children = [];
27
+
28
+ /**
29
+ * Local transform
30
+ * @type {Transform}
31
+ * @private
32
+ */
33
+ __transform = new Transform();
34
+
35
+ on = {
36
+ built: new Signal(),
37
+ destroyed: new Signal()
38
+ };
39
+
40
+ /**
41
+ *
42
+ * @type {number}
43
+ */
44
+ flags = DEFAULT_FLAGS;
45
+
14
46
  /**
15
47
  *
16
48
  * @param {Entity} [entity] optional entity to be wrapped
17
49
  */
18
50
  constructor(entity = new Entity()) {
19
- /**
20
- *
21
- * @type {EntityNode|null}
22
- * @private
23
- */
24
- this.__parent = null;
25
51
 
26
52
  /**
27
53
  *
@@ -30,30 +56,6 @@ export class EntityNode {
30
56
  */
31
57
  this.__entity = entity;
32
58
 
33
- /**
34
- *
35
- * @type {EntityNode[]}
36
- * @private
37
- */
38
- this.__children = [];
39
-
40
- /**
41
- * Local transform
42
- * @type {Transform}
43
- * @private
44
- */
45
- this.__transform = new Transform();
46
-
47
- this.on = {
48
- built: new Signal(),
49
- destroyed: new Signal()
50
- };
51
-
52
- /**
53
- *
54
- * @type {number}
55
- */
56
- this.flags = DEFAULT_FLAGS;
57
59
  }
58
60
 
59
61
  /**
@@ -1,37 +1,37 @@
1
- import { max2 } from "../../../core/math/max2.js";
2
- import { Voice } from "./Voice.js";
3
- import Entity from "../Entity.js";
4
- import GUIElement from "../gui/GUIElement.js";
5
- import { SerializationMetadata } from "../components/SerializationMetadata.js";
6
- import HeadsUpDisplay from "../gui/hud/HeadsUpDisplay.js";
7
- import ViewportPosition from "../gui/position/ViewportPosition.js";
8
- import { Transform } from "../transform/Transform.js";
9
- import { Attachment } from "../attachment/Attachment.js";
10
- import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
11
- import { SequenceBehavior } from "../../intelligence/behavior/composite/SequenceBehavior.js";
12
- import { DelayBehavior } from "../../intelligence/behavior/util/DelayBehavior.js";
13
- import { DieBehavior } from "../../intelligence/behavior/ecs/DieBehavior.js";
14
- import Vector2 from "../../../core/geom/Vector2.js";
15
- import { VoiceEvents } from "./VoiceEvents.js";
16
- import { AbstractContextSystem } from "../system/AbstractContextSystem.js";
17
- import { SystemEntityContext } from "../system/SystemEntityContext.js";
18
- import { ActionBehavior } from "../../intelligence/behavior/primitive/ActionBehavior.js";
19
- import { Blackboard } from "../../intelligence/blackboard/Blackboard.js";
20
- import { VoiceFlags } from "./VoiceFlags.js";
21
1
  import { assert } from "../../../core/assert.js";
22
2
  import { weightedRandomFromArray } from "../../../core/collection/array/weightedRandomFromArray.js";
23
- import { GameAssetType } from "../../asset/GameAssetType.js";
3
+ import Vector2 from "../../../core/geom/Vector2.js";
4
+ import { max2 } from "../../../core/math/max2.js";
5
+ import { ResourceAccessKind } from "../../../core/model/ResourceAccessKind.js";
6
+ import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
24
7
  import { DomSizeObserver } from "../../../view/util/DomSizeObserver.js";
25
- import { SpeechBubbleView } from "./SpeechBubbleView.js";
26
- import { AnimationBehavior } from "../../animation/keyed2/behavior/AnimationBehavior.js";
27
8
  import AnimationTrack from "../../animation/keyed2/AnimationTrack.js";
28
- import TransitionFunctions from "../../animation/TransitionFunctions.js";
29
9
  import AnimationTrackPlayback from "../../animation/keyed2/AnimationTrackPlayback.js";
10
+ import { AnimationBehavior } from "../../animation/keyed2/behavior/AnimationBehavior.js";
11
+ import TransitionFunctions from "../../animation/TransitionFunctions.js";
12
+ import { GameAssetType } from "../../asset/GameAssetType.js";
13
+ import { SequenceBehavior } from "../../intelligence/behavior/composite/SequenceBehavior.js";
14
+ import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
15
+ import { DieBehavior } from "../../intelligence/behavior/ecs/DieBehavior.js";
16
+ import { ActionBehavior } from "../../intelligence/behavior/primitive/ActionBehavior.js";
17
+ import { DelayBehavior } from "../../intelligence/behavior/util/DelayBehavior.js";
18
+ import { Blackboard } from "../../intelligence/blackboard/Blackboard.js";
30
19
  import { globalMetrics } from "../../metrics/GlobalMetrics.js";
31
20
  import { MetricsCategory } from "../../metrics/MetricsCategory.js";
32
- import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
33
- import { ResourceAccessKind } from "../../../core/model/ResourceAccessKind.js";
21
+ import { Attachment } from "../attachment/Attachment.js";
22
+ import { SerializationMetadata } from "../components/SerializationMetadata.js";
23
+ import Entity from "../Entity.js";
34
24
  import { EntityFlags } from "../EntityFlags.js";
25
+ import GUIElement from "../gui/GUIElement.js";
26
+ import HeadsUpDisplay from "../gui/hud/HeadsUpDisplay.js";
27
+ import ViewportPosition from "../gui/position/ViewportPosition.js";
28
+ import { AbstractContextSystem } from "../system/AbstractContextSystem.js";
29
+ import { SystemEntityContext } from "../system/SystemEntityContext.js";
30
+ import { Transform } from "../transform/Transform.js";
31
+ import { SpeechBubbleView } from "./SpeechBubbleView.js";
32
+ import { Voice } from "./Voice.js";
33
+ import { VoiceEvents } from "./VoiceEvents.js";
34
+ import { VoiceFlags } from "./VoiceFlags.js";
35
35
 
36
36
  /**
37
37
  * Delay before the user notices the text and begins to read
@@ -94,21 +94,18 @@ class LineWeigher {
94
94
  }
95
95
 
96
96
  class Context extends SystemEntityContext {
97
- constructor() {
98
- super();
99
97
 
100
- /**
101
- *
102
- * @type {LineDescription}
103
- */
104
- this.active_line = null;
98
+ /**
99
+ *
100
+ * @type {LineDescription}
101
+ */
102
+ active_line = null;
105
103
 
106
- /**
107
- *
108
- * @type {Entity}
109
- */
110
- this.active_executor = null;
111
- }
104
+ /**
105
+ *
106
+ * @type {Entity}
107
+ */
108
+ active_executor = null;
112
109
 
113
110
  handleSpeakLineEvent({ id }) {
114
111
  this.system.sayLine(this.entity, id, this.components[0]);
@@ -1,27 +1,29 @@
1
1
  export class SystemEntityContext {
2
- constructor() {
3
-
4
- this.entity = -1;
5
-
6
- /**
7
- * Pointer back to the system
8
- * @type {System}
9
- */
10
- this.system = null;
11
-
12
- /**
13
- *
14
- * @type {*[]}
15
- */
16
- this.components = [];
17
-
18
- /**
19
- *
20
- * @type {boolean}
21
- * @protected
22
- */
23
- this.__is_linked = false;
24
- }
2
+
3
+ /**
4
+ *
5
+ * @type {number}
6
+ */
7
+ entity = -1;
8
+
9
+ /**
10
+ * Pointer back to the system
11
+ * @type {System}
12
+ */
13
+ system = null;
14
+
15
+ /**
16
+ *
17
+ * @type {*[]}
18
+ */
19
+ components = [];
20
+
21
+ /**
22
+ *
23
+ * @type {boolean}
24
+ * @protected
25
+ */
26
+ __is_linked = false;
25
27
 
26
28
  /**
27
29
  *
@@ -0,0 +1,18 @@
1
+ import Tag from "../components/Tag.js";
2
+
3
+ /**
4
+ *
5
+ * @param {string} tag
6
+ * @param {EntityComponentDataset} ecd
7
+ * @returns {number[]}
8
+ */
9
+ export function find_entities_with_tag(tag, ecd) {
10
+ const r = [];
11
+ ecd.traverseComponents(Tag, (t, e) => {
12
+ if (t.contains(tag)) {
13
+ r.push(e);
14
+ }
15
+ });
16
+
17
+ return r;
18
+ }