@woosh/meep-engine 2.57.0 → 2.59.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-image-decoder.js +1 -1
  2. package/build/bundle-worker-terrain.js +1 -1
  3. package/build/meep.cjs +14789 -19638
  4. package/build/meep.min.js +1 -1
  5. package/build/meep.module.js +14790 -19638
  6. package/editor/Editor.js +4 -4
  7. package/editor/process/symbolic/buildThreeJSHelperEntity.js +3 -3
  8. package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +3 -3
  9. package/editor/process/symbolic/makePositionedIconDisplaySymbol.js +3 -3
  10. package/editor/tools/v2/prototypeTransformControls.js +3 -3
  11. package/editor/view/ecs/ComponentControlView.js +2 -1
  12. package/package.json +2 -2
  13. package/samples/generation/main.js +2 -2
  14. package/samples/terrain/from_image.js +2 -2
  15. package/samples/terrain/from_image_2.js +4 -4
  16. package/src/core/binary/byteArrayToString.js +28 -0
  17. package/src/core/binary/downloadAsFile.js +28 -0
  18. package/src/core/binary/downloadUrlAsFile.js +14 -0
  19. package/src/core/binary/jsonToStringToByteArray.js +27 -0
  20. package/src/core/binary/stringToByteArray.js +24 -0
  21. package/src/core/bvh2/BinaryNode.spec.js +2 -1
  22. package/src/core/color/Color.spec.js +27 -1
  23. package/src/core/color/parse_color.js +1 -1
  24. package/src/core/fsm/simple/SimpleStateMachine.spec.js +34 -2
  25. package/src/core/geom/3d/matrix/m4_multiply.js +2 -2
  26. package/src/core/geom/3d/matrix/m4_multiply.spec.js +11 -0
  27. package/src/core/geom/3d/matrix/m4_multiply_alphatensor.spec.js +11 -0
  28. package/src/core/geom/3d/morton/split_by_2.js +1 -1
  29. package/src/core/geom/3d/shape/util/shape_to_visual_entity.js +10 -10
  30. package/src/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +2 -2
  31. package/src/core/geom/3d/topology/samples/sampleFloodFill.js +3 -3
  32. package/src/core/process/action/AsynchronousDelayAction.js +2 -2
  33. package/src/core/process/executor/profile/ConcurrentExecutorProfiler.js +1 -1
  34. package/src/engine/EngineHarness.js +7 -7
  35. package/src/engine/EntityCreator.js +5 -5
  36. package/src/engine/__module.js +1 -1
  37. package/src/engine/achievements/AchievementManager.js +2 -2
  38. package/src/engine/animation/AnimationUtils.js +4 -4
  39. package/src/engine/animation/behavior/animateProperty.js +2 -2
  40. package/src/engine/animation/curve/draw/build_plot_entity_from_array.js +3 -3
  41. package/src/engine/animation/playAnimationTrack.js +3 -3
  42. package/src/engine/animation/playTrackRealTime.js +3 -3
  43. package/src/engine/animation/removeEntityWithMeshParticlesEffect.js +2 -2
  44. package/src/engine/control/ControlContext.js +7 -7
  45. package/src/engine/ecs/{EntityBuilder.d.ts → Entity.d.ts} +5 -5
  46. package/src/engine/ecs/{EntityBuilder.js → Entity.js} +29 -29
  47. package/src/engine/ecs/{EntityBuilder.spec.js → Entity.spec.js} +17 -17
  48. package/src/engine/ecs/EntityBlueprint.d.ts +2 -2
  49. package/src/engine/ecs/EntityBlueprint.js +3 -3
  50. package/src/engine/ecs/EntityBlueprint.spec.js +2 -2
  51. package/src/engine/ecs/{EntityBuilderFlags.js → EntityFlags.js} +1 -1
  52. package/src/engine/ecs/EntityObserver.spec.js +8 -8
  53. package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +5 -5
  54. package/src/engine/ecs/foliage/ecs/InstancedMeshUtils.js +3 -3
  55. package/src/engine/ecs/gui/menu/radial/RadialContextMenu.d.ts +2 -2
  56. package/src/engine/ecs/gui/menu/radial/RadialContextMenu.js +5 -5
  57. package/src/engine/ecs/parent/EntityNode.d.ts +3 -3
  58. package/src/engine/ecs/parent/EntityNode.js +5 -5
  59. package/src/engine/ecs/parent/testHuDPerf.js +2 -2
  60. package/src/engine/ecs/speaker/VoiceSystem.js +5 -5
  61. package/src/engine/ecs/tooltip/testTooltipComponentSystem.js +3 -3
  62. package/src/engine/graphics/camera/makeOrbitalCameraController.js +3 -3
  63. package/src/engine/graphics/camera/testClippingPlaneComputation.js +3 -3
  64. package/src/engine/graphics/debug/createDebugLabel.js +3 -3
  65. package/src/engine/graphics/ecs/camera/filter/setup_filtered_camera_controller.js +3 -3
  66. package/src/engine/graphics/ecs/decal/v2/prototypeDecalEditor.js +3 -3
  67. package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +14 -14
  68. package/src/engine/graphics/ecs/mesh-v2/aggregate/prototypeSGMesh.js +3 -3
  69. package/src/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +5 -5
  70. package/src/engine/graphics/ecs/mesh-v2/sample/prototype_sg_raycast.js +6 -6
  71. package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.js +3 -3
  72. package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +3 -3
  73. package/src/engine/graphics/ecs/path/tube/build/TubePathBuilder.js +3 -3
  74. package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +3 -3
  75. package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +2 -2
  76. package/src/engine/graphics/ecs/sprite/prototypeSpriteSystem.js +2 -2
  77. package/src/engine/graphics/geometry/optimization/merge/prototypeGeometryMerge.js +4 -4
  78. package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +7 -7
  79. package/src/engine/graphics/particles/node-based/editor/ParticleSpecificationEditorView.js +1 -1
  80. package/src/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +2 -2
  81. package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.d.ts +2 -2
  82. package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +3 -3
  83. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +10 -10
  84. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -2
  85. package/src/engine/graphics/render/buffer/simple-fx/taa/prototypeTAA.js +2 -2
  86. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +11 -11
  87. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +5 -5
  88. package/src/engine/graphics/sh3/LightProbeVolume.js +2 -2
  89. package/src/engine/graphics/sh3/prototypeSH3Probe.js +3 -3
  90. package/src/engine/graphics/sh3/visualise_probe.js +3 -3
  91. package/src/engine/graphics/shadows/testShadowMapRendering.js +3 -3
  92. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js +1 -1
  93. package/src/engine/graphics/texture/sprite/prototypeSpriteCutoutGeometry.js +2 -2
  94. package/src/engine/input/ecs/controllers/KeyboardCameraController.js +2 -2
  95. package/src/engine/input/ecs/util/TopDownCameraControllerHelper.js +2 -2
  96. package/src/engine/intelligence/behavior/composite/ParallelBehavior.spec.js +13 -12
  97. package/src/engine/physics/fluid/prototype.js +3 -3
  98. package/src/engine/save/storage/JsonStringCodec.js +1 -1
  99. package/src/engine/save/storage/LocalStorage.js +2 -1
  100. package/src/engine/ui/GUIEngine.js +4 -4
  101. package/src/engine/ui/notification/NotificationManager.js +3 -3
  102. package/src/generation/markers/debug/visualizeMarkers.js +2 -2
  103. package/src/generation/markers/prototypeGridCellActionPlaceMarker.js +2 -2
  104. package/src/core/binary/ByteArrayTools.js +0 -137
  105. package/src/core/binary/NaiveBitSet.js +0 -69
  106. package/src/core/binary/objects/StandardTypeBuilder.js +0 -126
  107. package/src/core/binary/serde/JsonSerializer.js +0 -113
@@ -1,6 +1,6 @@
1
- import EntityBuilder from "./EntityBuilder.js";
1
+ import Entity from "./Entity.js";
2
2
  import { EntityComponentDataset } from "./EntityComponentDataset.js";
3
- import { EntityBuilderFlags } from "./EntityBuilderFlags.js";
3
+ import { EntityFlags } from "./EntityFlags.js";
4
4
 
5
5
 
6
6
  class DummyComponent {
@@ -19,13 +19,13 @@ function sampleDataset() {
19
19
  }
20
20
 
21
21
  test("constructor doesn't throw", () => {
22
- new EntityBuilder();
22
+ new Entity();
23
23
  });
24
24
 
25
25
  test("entity exists in dataset after build", () => {
26
26
  const dataset = new EntityComponentDataset();
27
27
 
28
- const builder = new EntityBuilder();
28
+ const builder = new Entity();
29
29
 
30
30
  const entity = builder.build(dataset);
31
31
 
@@ -37,7 +37,7 @@ test("component exist in dataset after build", () => {
37
37
 
38
38
  dataset.setComponentTypeMap([DummyComponent]);
39
39
 
40
- const builder = new EntityBuilder();
40
+ const builder = new Entity();
41
41
 
42
42
  const component = new DummyComponent();
43
43
 
@@ -53,30 +53,30 @@ test("component exist in dataset after build", () => {
53
53
  test("'Built' flag is reset when entity is removed without invoking 'destroy' method", () => {
54
54
  const dataset = sampleDataset();
55
55
 
56
- const b = new EntityBuilder();
56
+ const b = new Entity();
57
57
 
58
- expect(b.getFlag(EntityBuilderFlags.Built)).toBe(false);
58
+ expect(b.getFlag(EntityFlags.Built)).toBe(false);
59
59
  expect(b.isBuilt).toBe(false);
60
60
 
61
61
  b.build(dataset);
62
62
 
63
- expect(b.getFlag(EntityBuilderFlags.Built)).toBe(true);
63
+ expect(b.getFlag(EntityFlags.Built)).toBe(true);
64
64
  expect(b.isBuilt).toBe(true);
65
65
 
66
66
  dataset.removeEntity(b.entity);
67
67
 
68
- expect(b.getFlag(EntityBuilderFlags.Built)).toBe(false);
68
+ expect(b.getFlag(EntityFlags.Built)).toBe(false);
69
69
  expect(b.isBuilt).toBe(false);
70
70
  });
71
71
 
72
72
  test("removeAllComponents from empty", () => {
73
- const entity = new EntityBuilder();
73
+ const entity = new Entity();
74
74
 
75
75
  expect(() => entity.removeAllComponents()).not.toThrow()
76
76
  });
77
77
 
78
78
  test("removeAllComponents with 1 entity", () => {
79
- const entity = new EntityBuilder();
79
+ const entity = new Entity();
80
80
 
81
81
  entity.add(new DummyComponent());
82
82
 
@@ -88,13 +88,13 @@ test("removeAllComponents with 1 entity", () => {
88
88
  });
89
89
 
90
90
  test("removeComponent when component is not preset", () => {
91
- const entity = new EntityBuilder();
91
+ const entity = new Entity();
92
92
 
93
93
  expect(entity.removeComponent(DummyComponent)).toBe(null);
94
94
  });
95
95
 
96
96
  test("removeComponent when component is preset", () => {
97
- const entity = new EntityBuilder();
97
+ const entity = new Entity();
98
98
 
99
99
  const component = new DummyComponent();
100
100
 
@@ -107,14 +107,14 @@ test("removeComponent when component is preset", () => {
107
107
 
108
108
  test("getComponentSafe throws when component is missing", () => {
109
109
 
110
- const entity = new EntityBuilder();
110
+ const entity = new Entity();
111
111
 
112
112
  expect(() => entity.getComponentSafe(DummyComponent)).toThrow();
113
113
 
114
114
  });
115
115
  test("getComponentSafe throws when component is present", () => {
116
116
 
117
- const entity = new EntityBuilder();
117
+ const entity = new Entity();
118
118
 
119
119
  const component = new DummyComponent();
120
120
  entity.add(component);
@@ -126,7 +126,7 @@ test("getComponentSafe throws when component is present", () => {
126
126
 
127
127
  test("adding component to live entity results in component being added to the dataset", () => {
128
128
 
129
- const entity = new EntityBuilder();
129
+ const entity = new Entity();
130
130
 
131
131
  const ecd = sampleDataset();
132
132
 
@@ -141,7 +141,7 @@ test("adding component to live entity results in component being added to the da
141
141
 
142
142
  test("promiseEvent", async () => {
143
143
 
144
- const entity = new EntityBuilder();
144
+ const entity = new Entity();
145
145
 
146
146
  const ecd = sampleDataset();
147
147
 
@@ -1,4 +1,4 @@
1
- import EntityBuilder from "./EntityBuilder";
1
+ import Entity from "./Entity";
2
2
 
3
3
  interface Type<T> extends Function {
4
4
  new(...args: any[]): T;
@@ -13,5 +13,5 @@ export class EntityBlueprint {
13
13
 
14
14
  clear(): void
15
15
 
16
- build(seed?: object): EntityBuilder
16
+ build(seed?: object): Entity
17
17
  }
@@ -1,4 +1,4 @@
1
- import EntityBuilder from "./EntityBuilder.js";
1
+ import Entity from "./Entity.js";
2
2
 
3
3
  /**
4
4
  *
@@ -141,10 +141,10 @@ export class EntityBlueprint {
141
141
 
142
142
  /**
143
143
  * @param {object} [templateSeed]
144
- * @return {EntityBuilder}
144
+ * @return {Entity}
145
145
  */
146
146
  build(templateSeed) {
147
- const eb = new EntityBuilder();
147
+ const eb = new Entity();
148
148
 
149
149
  this.#components.forEach((template, ComponentClass) => {
150
150
  const component = new ComponentClass();
@@ -1,5 +1,5 @@
1
1
  import { EntityBlueprint } from "./EntityBlueprint.js";
2
- import EntityBuilder from "./EntityBuilder.js";
2
+ import Entity from "./Entity.js";
3
3
 
4
4
  test("constructor does not throw", () => {
5
5
 
@@ -13,7 +13,7 @@ test("build empty", () => {
13
13
  const entity = blueprint.build();
14
14
 
15
15
  expect(entity).toBeDefined();
16
- expect(entity).toBeInstanceOf(EntityBuilder);
16
+ expect(entity).toBeInstanceOf(Entity);
17
17
  expect(entity.count).toEqual(0);
18
18
  });
19
19
 
@@ -2,7 +2,7 @@
2
2
  *
3
3
  * @enum
4
4
  */
5
- export const EntityBuilderFlags = {
5
+ export const EntityFlags = {
6
6
  /**
7
7
  * Whether the entity is built, set internally
8
8
  */
@@ -1,7 +1,7 @@
1
1
  import { EntityObserver } from "./EntityObserver.js";
2
2
  import { Transform } from "./transform/Transform.js";
3
3
  import GridPosition from "../grid/position/GridPosition.js";
4
- import EntityBuilder from "./EntityBuilder.js";
4
+ import Entity from "./Entity.js";
5
5
  import { EntityComponentDataset } from "./EntityComponentDataset.js";
6
6
  import { noop } from "../../core/function/Functions.js";
7
7
  import { jest } from '@jest/globals';
@@ -42,13 +42,13 @@ test("existing entities that match are supplied via callback when attaching", ()
42
42
 
43
43
  const t0 = new Transform();
44
44
  const g0 = new GridPosition();
45
- const entity0 = new EntityBuilder().add(t0).add(g0).build(dataset);
45
+ const entity0 = new Entity().add(t0).add(g0).build(dataset);
46
46
 
47
47
  const t1 = new Transform();
48
48
  const g1 = new GridPosition();
49
- const entity1 = new EntityBuilder().add(t1).add(g1).build(dataset);
49
+ const entity1 = new Entity().add(t1).add(g1).build(dataset);
50
50
 
51
- new EntityBuilder().add(new Transform()).build(dataset);
51
+ new Entity().add(new Transform()).build(dataset);
52
52
 
53
53
  const observer = new EntityObserver([Transform, GridPosition], completed, broken);
54
54
 
@@ -69,7 +69,7 @@ test("completed matches are observed when they happen after attachment", () => {
69
69
 
70
70
  const t0 = new Transform();
71
71
  const g0 = new GridPosition();
72
- const entity0 = new EntityBuilder().add(t0).build(dataset);
72
+ const entity0 = new Entity().add(t0).build(dataset);
73
73
 
74
74
  const observer = new EntityObserver([Transform, GridPosition], completed, broken);
75
75
 
@@ -93,7 +93,7 @@ test("broken matches are observed", () => {
93
93
  const dataset = makeDataset();
94
94
  const t0 = new Transform();
95
95
  const g0 = new GridPosition();
96
- const entityBuilder = new EntityBuilder().add(t0).add(g0);
96
+ const entityBuilder = new Entity().add(t0).add(g0);
97
97
  const entity0 = entityBuilder.build(dataset);
98
98
 
99
99
  const observer = new EntityObserver([Transform, GridPosition], completed, broken);
@@ -115,7 +115,7 @@ test("matching entities added after connect are observed", () => {
115
115
  const dataset = makeDataset();
116
116
  const t0 = new Transform();
117
117
  const g0 = new GridPosition();
118
- const entityBuilder = new EntityBuilder().add(t0).add(g0);
118
+ const entityBuilder = new Entity().add(t0).add(g0);
119
119
 
120
120
  const observer = new EntityObserver([Transform, GridPosition], completed, broken);
121
121
 
@@ -135,7 +135,7 @@ test("match after connect and break", () => {
135
135
  const dataset = makeDataset();
136
136
  const t0 = new Transform();
137
137
  const g0 = new GridPosition();
138
- const entityBuilder = new EntityBuilder().add(t0).add(g0);
138
+ const entityBuilder = new Entity().add(t0).add(g0);
139
139
 
140
140
  const observer = new EntityObserver([Transform, GridPosition], completed, broken);
141
141
 
@@ -5,7 +5,7 @@ import { DataScope } from "../../../../../model/game/unit/actions/data/DataScope
5
5
  import { Blackboard } from "../../intelligence/blackboard/Blackboard.js";
6
6
  import { returnTrue } from "../../../core/function/Functions.js";
7
7
  import { EntityProxyScope } from "../binding/EntityProxyScope.js";
8
- import EntityBuilder from "../EntityBuilder.js";
8
+ import Entity from "../Entity.js";
9
9
  import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
10
10
  import { SequenceBehavior } from "../../intelligence/behavior/composite/SequenceBehavior.js";
11
11
  import { DieBehavior } from "../../intelligence/behavior/ecs/DieBehavior.js";
@@ -22,7 +22,7 @@ import { randomFloatBetween } from "../../../core/math/random/randomFloatBetween
22
22
  import { randomMultipleFromArray } from "../../../core/collection/array/randomMultipleFromArray.js";
23
23
  import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
24
24
  import { ResourceAccessKind } from "../../../core/model/ResourceAccessKind.js";
25
- import { EntityBuilderFlags } from "../EntityBuilderFlags.js";
25
+ import { EntityFlags } from "../EntityFlags.js";
26
26
  import { number_compare_descending } from "../../../core/primitives/numbers/number_compare_descending.js";
27
27
 
28
28
  /**
@@ -196,7 +196,7 @@ export class DynamicActorSystem extends AbstractContextSystem {
196
196
 
197
197
  const execution = ctx.execution;
198
198
 
199
- if (execution.executor !== null && execution.executor.getFlag(EntityBuilderFlags.Built)) {
199
+ if (execution.executor !== null && execution.executor.getFlag(EntityFlags.Built)) {
200
200
  // there is an active rule being executed, see if this one has the right to interrupt
201
201
 
202
202
  if (rule.priority <= execution.rule.priority) {
@@ -223,7 +223,7 @@ export class DynamicActorSystem extends AbstractContextSystem {
223
223
 
224
224
  const execution = ctx.execution;
225
225
 
226
- if (execution.executor !== null && execution.executor.getFlag(EntityBuilderFlags.Built)) {
226
+ if (execution.executor !== null && execution.executor.getFlag(EntityFlags.Built)) {
227
227
  execution.executor.destroy();
228
228
  }
229
229
  }
@@ -269,7 +269,7 @@ export class DynamicActorSystem extends AbstractContextSystem {
269
269
  const ecd = this.entityManager.dataset;
270
270
  const behavior = rule.action.execute(entity, ecd, context, this);
271
271
 
272
- const entity_builder = new EntityBuilder()
272
+ const entity_builder = new Entity()
273
273
  .add(BehaviorComponent.fromOne(SequenceBehavior.from([
274
274
  OverrideContextBehavior.from(
275
275
  {
@@ -1,4 +1,4 @@
1
- import EntityBuilder from "../../EntityBuilder.js";
1
+ import Entity from "../../Entity.js";
2
2
  import { loadFoliageLayer } from "./Foliage2System.js";
3
3
  import Mesh, { MeshFlags } from "../../../graphics/ecs/mesh/Mesh.js";
4
4
  import { Transform } from "../../transform/Transform.js";
@@ -51,7 +51,7 @@ export function convertInstancedMeshComponents2Entities(dataset, assetManager) {
51
51
 
52
52
  //TODO Consider moving BVH info here also, to make this process faster
53
53
 
54
- const entityBuilder = new EntityBuilder();
54
+ const entityBuilder = new Entity();
55
55
 
56
56
  entityBuilder.add(transform).add(mesh).build(dataset);
57
57
  }
@@ -145,7 +145,7 @@ export function optimizeIndividualMeshesEntitiesToInstances(dataset, threshold =
145
145
  const tBuild = new Task({
146
146
  name: "Build Meshes",
147
147
  cycleFunction: function () {
148
- const entityBuilder = new EntityBuilder();
148
+ const entityBuilder = new Entity();
149
149
 
150
150
  entityBuilder.add(foliage2);
151
151
 
@@ -1,4 +1,4 @@
1
- import EntityBuilder from "../../../EntityBuilder";
1
+ import Entity from "../../../Entity";
2
2
  import {EntityComponentDataset} from "../../../EntityComponentDataset";
3
3
  import Vector2 from "../../../../../core/geom/Vector2";
4
4
  import {RadialMenuElementDefinition} from "../../../../../view/elements/radial/RadialMenuElementDefinition";
@@ -19,4 +19,4 @@ interface RadialMenuOptions {
19
19
  selectionDistance?: number
20
20
  }
21
21
 
22
- export function makeMenu(options: RadialMenuOptions): EntityBuilder;
22
+ export function makeMenu(options: RadialMenuOptions): Entity;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { SerializationMetadata } from "../../../components/SerializationMetadata.js";
5
5
 
6
- import EntityBuilder from "../../../EntityBuilder.js";
6
+ import Entity from "../../../Entity.js";
7
7
  import GUIElement from "../../GUIElement.js";
8
8
  import { MouseEvents } from "../../../../input/devices/events/MouseEvents.js";
9
9
  import { TouchEvents } from "../../../../input/devices/events/TouchEvents.js";
@@ -12,7 +12,7 @@ import RadialMenuView from "../../../../../view/elements/radial/RadialMenu.js";
12
12
  import { animateAppearance } from "./AnimateAppearance.js";
13
13
  import { animateDisappearance } from "./AnimateDisappearance.js";
14
14
  import { RadialMenuSettings } from "./RadialMenuSettings.js";
15
- import { EntityBuilderFlags } from "../../../EntityBuilderFlags.js";
15
+ import { EntityFlags } from "../../../EntityFlags.js";
16
16
 
17
17
  /**
18
18
  *
@@ -32,7 +32,7 @@ import { EntityBuilderFlags } from "../../../EntityBuilderFlags.js";
32
32
  * @param {string[]} [classList]
33
33
  * @param {Vector2} [pointerPosition] Used to set initial selection, same as position is not set
34
34
  * @param {number} [selectionDistance] minimum distance in pixels at which selection registers
35
- * @returns {EntityBuilder}
35
+ * @returns {Entity}
36
36
  */
37
37
  export function makeMenu({
38
38
  ecd,
@@ -99,7 +99,7 @@ export function makeMenu({
99
99
  //play appearance animation
100
100
  const appearanceAnimationFinished = animateAppearance(mainView, ecd);
101
101
 
102
- const builder = new EntityBuilder();
102
+ const builder = new Entity();
103
103
 
104
104
  //prevent menu serialization
105
105
  builder.add(SerializationMetadata.Transient);
@@ -234,7 +234,7 @@ export function makeMenu({
234
234
  window.addEventListener(TouchEvents.End, performSelection);
235
235
 
236
236
  // to simplify usage of this class, we turn on component registration on the builder
237
- builder.setFlag(EntityBuilderFlags.RegisterComponents);
237
+ builder.setFlag(EntityFlags.RegisterComponents);
238
238
 
239
239
  // actually build the menu
240
240
  builder.build(ecd);
@@ -1,12 +1,12 @@
1
- import EntityBuilder from "../EntityBuilder";
1
+ import Entity from "../Entity";
2
2
  import {EntityComponentDataset} from "../EntityComponentDataset";
3
3
  import {Transform} from "../transform/Transform";
4
4
 
5
5
  export class EntityNode {
6
- constructor(entity?: EntityBuilder)
6
+ constructor(entity?: Entity)
7
7
 
8
8
  readonly parent: EntityNode | null
9
- readonly entity: EntityBuilder
9
+ readonly entity: Entity
10
10
 
11
11
  readonly transform: Transform
12
12
 
@@ -1,5 +1,5 @@
1
1
  import { ParentEntity } from "./ParentEntity.js";
2
- import EntityBuilder from "../EntityBuilder.js";
2
+ import Entity from "../Entity.js";
3
3
  import { array_remove_first } from "../../../core/collection/array/array_remove_first.js";
4
4
  import { assert } from "../../../core/assert.js";
5
5
  import { array_push_if_unique } from "../../../core/collection/array/array_push_if_unique.js";
@@ -13,9 +13,9 @@ const DEFAULT_FLAGS = EntityNodeFlags.LiveManagement;
13
13
  export class EntityNode {
14
14
  /**
15
15
  *
16
- * @param {EntityBuilder} [entity] optional entity to be wrapped
16
+ * @param {Entity} [entity] optional entity to be wrapped
17
17
  */
18
- constructor(entity = new EntityBuilder()) {
18
+ constructor(entity = new Entity()) {
19
19
  /**
20
20
  *
21
21
  * @type {EntityNode|null}
@@ -25,7 +25,7 @@ export class EntityNode {
25
25
 
26
26
  /**
27
27
  *
28
- * @type {EntityBuilder}
28
+ * @type {Entity}
29
29
  * @private
30
30
  */
31
31
  this.__entity = entity;
@@ -254,7 +254,7 @@ export class EntityNode {
254
254
 
255
255
  /**
256
256
  *
257
- * @return {EntityBuilder}
257
+ * @return {Entity}
258
258
  */
259
259
  get entity() {
260
260
  return this.__entity;
@@ -5,7 +5,7 @@ import { EngineConfiguration } from "../../EngineConfiguration.js";
5
5
  import { AttachmentSystem } from "../attachment/AttachmentSystem.js";
6
6
  import { GameAssetType } from "../../asset/GameAssetType.js";
7
7
  import { Sampler2D } from "../../graphics/texture/sampler/Sampler2D.js";
8
- import EntityBuilder from "../EntityBuilder.js";
8
+ import Entity from "../Entity.js";
9
9
  import HeadsUpDisplay from "../gui/hud/HeadsUpDisplay.js";
10
10
  import ViewportPosition from "../gui/position/ViewportPosition.js";
11
11
  import GUIElement from "../gui/GUIElement.js";
@@ -95,7 +95,7 @@ async function main(engine) {
95
95
  v * grid_size + 1
96
96
  );
97
97
 
98
- new EntityBuilder()
98
+ new Entity()
99
99
  .add(transform)
100
100
  .add(new HeadsUpDisplay())
101
101
  .add(new ViewportPosition())
@@ -1,6 +1,6 @@
1
1
  import { max2 } from "../../../core/math/max2.js";
2
2
  import { Voice } from "./Voice.js";
3
- import EntityBuilder from "../EntityBuilder.js";
3
+ import Entity from "../Entity.js";
4
4
  import GUIElement from "../gui/GUIElement.js";
5
5
  import { SerializationMetadata } from "../components/SerializationMetadata.js";
6
6
  import HeadsUpDisplay from "../gui/hud/HeadsUpDisplay.js";
@@ -31,7 +31,7 @@ import { globalMetrics } from "../../metrics/GlobalMetrics.js";
31
31
  import { MetricsCategory } from "../../metrics/MetricsCategory.js";
32
32
  import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
33
33
  import { ResourceAccessKind } from "../../../core/model/ResourceAccessKind.js";
34
- import { EntityBuilderFlags } from "../EntityBuilderFlags.js";
34
+ import { EntityFlags } from "../EntityFlags.js";
35
35
 
36
36
  /**
37
37
  * Delay before the user notices the text and begins to read
@@ -105,7 +105,7 @@ class Context extends SystemEntityContext {
105
105
 
106
106
  /**
107
107
  *
108
- * @type {EntityBuilder}
108
+ * @type {Entity}
109
109
  */
110
110
  this.active_executor = null;
111
111
  }
@@ -354,7 +354,7 @@ export class VoiceSystem extends AbstractContextSystem {
354
354
 
355
355
  const ctx = this.__getEntityContext(entity);
356
356
 
357
- if (ctx.active_executor !== null && ctx.active_executor.getFlag(EntityBuilderFlags.Built)) {
357
+ if (ctx.active_executor !== null && ctx.active_executor.getFlag(EntityFlags.Built)) {
358
358
  // terminate currently speech bubble
359
359
  ctx.active_executor.destroy();
360
360
  }
@@ -415,7 +415,7 @@ export class VoiceSystem extends AbstractContextSystem {
415
415
 
416
416
  this.__setBubbleSize(line_pure_text, view);
417
417
 
418
- const entityBuilder = new EntityBuilder()
418
+ const entityBuilder = new Entity()
419
419
  .add(GUIElement.fromView(view))
420
420
  .add(ViewportPosition.fromJSON({ anchor: new Vector2(0.5, 1) }))
421
421
  .add(HeadsUpDisplay.fromJSON({}))
@@ -4,7 +4,7 @@ import { QuestDescriptionDatabase } from "../../../../../model/game/ecs/componen
4
4
  import { MeshSystem } from "../../graphics/ecs/mesh/MeshSystem.js";
5
5
  import { makeEngineOptionsModel } from "../../../../../model/game/options/makeEngineOptionsModel.js";
6
6
  import Vector3 from "../../../core/geom/Vector3.js";
7
- import EntityBuilder from "../EntityBuilder.js";
7
+ import Entity from "../Entity.js";
8
8
  import { Transform } from "../transform/Transform.js";
9
9
  import Mesh from "../../graphics/ecs/mesh/Mesh.js";
10
10
  import { TooltipComponent } from "./TooltipComponent.js";
@@ -87,7 +87,7 @@ function main(engine) {
87
87
 
88
88
  const ecd = engine.entityManager.dataset;
89
89
 
90
- new EntityBuilder()
90
+ new Entity()
91
91
  .add(Transform.fromJSON({
92
92
  position: new Vector3(12.17416, 0.09969, 11.06082)
93
93
  }))
@@ -101,7 +101,7 @@ function main(engine) {
101
101
  }))
102
102
  .build(ecd);
103
103
 
104
- new EntityBuilder()
104
+ new Entity()
105
105
  .add(Transform.fromJSON({
106
106
  position: new Vector3(10.5, 0.09969, 9.06082)
107
107
  }))
@@ -1,7 +1,7 @@
1
1
  import TopDownCameraController, { rotate_from_view } from "../ecs/camera/topdown/TopDownCameraController.js";
2
2
  import InputController from "../../input/ecs/components/InputController.js";
3
3
  import { decodeMouseEventButtons } from "../../input/devices/PointerDevice.js";
4
- import EntityBuilder from "../../ecs/EntityBuilder.js";
4
+ import Entity from "../../ecs/Entity.js";
5
5
  import { Camera } from "../ecs/camera/Camera.js";
6
6
  import { clamp } from "../../../core/math/clamp.js";
7
7
 
@@ -11,7 +11,7 @@ import { clamp } from "../../../core/math/clamp.js";
11
11
  * @param {EntityComponentDataset} ecd
12
12
  * @param {HTMLElement} dom_element
13
13
  * @param {number} [sensitivity]
14
- * @return {EntityBuilder}
14
+ * @return {Entity}
15
15
  */
16
16
  export function makeOrbitalCameraController({
17
17
  camera_entity,
@@ -101,7 +101,7 @@ export function makeOrbitalCameraController({
101
101
  }
102
102
  ]);
103
103
 
104
- const eb = new EntityBuilder();
104
+ const eb = new Entity();
105
105
  eb.add(inputController);
106
106
 
107
107
  return eb;
@@ -43,7 +43,7 @@ import { makeEngineOptionsModel } from "../../../../../model/game/options/makeEn
43
43
  import { enableEditor } from "../../../../editor/enableEditor.js";
44
44
  import Vector3 from "../../../core/geom/Vector3.js";
45
45
  import { CanvasView } from "../../../view/elements/CanvasView.js";
46
- import EntityBuilder from "../../ecs/EntityBuilder.js";
46
+ import Entity from "../../ecs/Entity.js";
47
47
  import GUIElement from "../../ecs/gui/GUIElement.js";
48
48
  import ViewportPosition from "../../ecs/gui/position/ViewportPosition.js";
49
49
  import Vector2 from "../../../core/geom/Vector2.js";
@@ -389,7 +389,7 @@ function main(engine) {
389
389
  engine.graphics.renderer.setClearColor('rgba(99,99,99,1)');
390
390
 
391
391
 
392
- new EntityBuilder()
392
+ new Entity()
393
393
  .add(Transform.fromJSON({
394
394
  position: {
395
395
  x: 100,
@@ -411,7 +411,7 @@ function main(engine) {
411
411
 
412
412
  const canvasView = makeCameraClippingDebug(engine);
413
413
 
414
- new EntityBuilder()
414
+ new Entity()
415
415
  .add(ViewportPosition.fromJSON({
416
416
  offset: new Vector2(10, 10)
417
417
  }))
@@ -1,6 +1,6 @@
1
1
  import Vector3 from "../../../core/geom/Vector3.js";
2
2
  import { Transform } from "../../ecs/transform/Transform.js";
3
- import EntityBuilder from "../../ecs/EntityBuilder.js";
3
+ import Entity from "../../ecs/Entity.js";
4
4
  import HeadsUpDisplay from "../../ecs/gui/hud/HeadsUpDisplay.js";
5
5
  import ViewportPosition from "../../ecs/gui/position/ViewportPosition.js";
6
6
  import GUIElement from "../../ecs/gui/GUIElement.js";
@@ -10,7 +10,7 @@ import LabelView from "../../../view/common/LabelView.js";
10
10
  *
11
11
  * @param {string} text
12
12
  * @param {Vector3} [position]
13
- * @returns {EntityBuilder}
13
+ * @returns {Entity}
14
14
  */
15
15
  export function createDebugLabel(text, position = Vector3.zero) {
16
16
 
@@ -26,7 +26,7 @@ export function createDebugLabel(text, position = Vector3.zero) {
26
26
 
27
27
  t.position.copy(position);
28
28
 
29
- const eb = new EntityBuilder()
29
+ const eb = new Entity()
30
30
  .add(new HeadsUpDisplay())
31
31
  .add(new ViewportPosition())
32
32
  .add(GUIElement.fromView(v))
@@ -1,6 +1,6 @@
1
1
  import { assert } from "../../../../../core/assert.js";
2
2
  import TopDownCameraController from "../topdown/TopDownCameraController.js";
3
- import EntityBuilder from "../../../../ecs/EntityBuilder.js";
3
+ import Entity from "../../../../ecs/Entity.js";
4
4
  import { BehaviorComponent } from "../../../../intelligence/behavior/ecs/BehaviorComponent.js";
5
5
  import { RepeatBehavior } from "../../../../intelligence/behavior/decorator/RepeatBehavior.js";
6
6
  import { ActionBehavior } from "../../../../intelligence/behavior/primitive/ActionBehavior.js";
@@ -14,7 +14,7 @@ import { lerp } from "../../../../../core/math/lerp.js";
14
14
  * @param {EntityComponentDataset} ecd
15
15
  * @param {number} [responsiveness] higher value results in sharper movement when following
16
16
  * @param {number} [inertia]
17
- * @returns {{controller:TopDownCameraController, entity:EntityBuilder}}
17
+ * @returns {{controller:TopDownCameraController, entity:Entity}}
18
18
  */
19
19
  export function setup_filtered_camera_controller({
20
20
  target,
@@ -33,7 +33,7 @@ export function setup_filtered_camera_controller({
33
33
  const remembered_value = new TopDownCameraController();
34
34
  remembered_value.copy(result);
35
35
 
36
- const entityBuilder = new EntityBuilder();
36
+ const entityBuilder = new Entity();
37
37
 
38
38
  entityBuilder
39
39
  .add(BehaviorComponent.fromOne(
@@ -1,5 +1,5 @@
1
1
  import { EngineHarness } from "../../../../EngineHarness.js";
2
- import EntityBuilder from "../../../../ecs/EntityBuilder.js";
2
+ import Entity from "../../../../ecs/Entity.js";
3
3
  import { SGMesh } from "../../mesh-v2/aggregate/SGMesh.js";
4
4
  import { Transform } from "../../../../ecs/transform/Transform.js";
5
5
  import { GLTFAssetLoader } from "../../../../asset/loaders/GLTFAssetLoader.js";
@@ -102,7 +102,7 @@ async function main(engine) {
102
102
 
103
103
  const ecd = engine.entityManager.dataset;
104
104
 
105
- new EntityBuilder()
105
+ new Entity()
106
106
  .add(SGMesh.fromURL("moicon/gnutti_not_optimized/model.gltf"))
107
107
  .add(Transform.fromJSON({
108
108
  position: { x: 10, y: 3, z: 10 },
@@ -113,7 +113,7 @@ async function main(engine) {
113
113
 
114
114
  const selected_decal_uri = new ObservedString('');
115
115
 
116
- new EntityBuilder()
116
+ new Entity()
117
117
  .add(GUIElement.fromView(makeDecalSelector({ engine, selected: selected_decal_uri })))
118
118
  .build(ecd);
119
119