@woosh/meep-engine 2.121.11 → 2.121.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/editor/process/symbolic/make3DSymbolicDisplay.js +2 -2
- package/editor/tools/TransformTool.js +3 -3
- package/editor/view/v2/prototypeEditor.js +1 -1
- package/package.json +1 -1
- package/src/core/collection/array/array_pick_best_elements.js +1 -1
- package/src/core/collection/list/List.d.ts.map +1 -1
- package/src/core/collection/list/List.js +3 -5
- package/src/core/collection/map/HashMap.d.ts.map +1 -1
- package/src/core/collection/map/HashMap.js +3 -1
- package/src/core/color/oklab/compute_max_saturation.d.ts +3 -1
- package/src/core/color/oklab/compute_max_saturation.d.ts.map +1 -1
- package/src/core/color/oklab/compute_max_saturation.js +3 -1
- package/src/core/color/oklab/find_cusp.d.ts +3 -1
- package/src/core/color/oklab/find_cusp.d.ts.map +1 -1
- package/src/core/color/oklab/find_cusp.js +3 -1
- package/src/core/color/oklab/find_gamut_intersection.d.ts +3 -1
- package/src/core/color/oklab/find_gamut_intersection.d.ts.map +1 -1
- package/src/core/color/oklab/find_gamut_intersection.js +3 -1
- package/src/core/color/oklab/okhsv_to_linear_srgb.d.ts +3 -1
- package/src/core/color/oklab/okhsv_to_linear_srgb.d.ts.map +1 -1
- package/src/core/color/oklab/okhsv_to_linear_srgb.js +3 -1
- package/src/core/color/oklab/oklab_to_linear_srgb.d.ts +3 -1
- package/src/core/color/oklab/oklab_to_linear_srgb.d.ts.map +1 -1
- package/src/core/color/oklab/oklab_to_linear_srgb.js +3 -1
- package/src/core/color/oklab/oklab_to_xyz.d.ts +4 -1
- package/src/core/color/oklab/oklab_to_xyz.d.ts.map +1 -1
- package/src/core/color/oklab/oklab_to_xyz.js +4 -1
- package/src/core/color/oklab/xyz_to_oklab.d.ts +3 -1
- package/src/core/color/oklab/xyz_to_oklab.d.ts.map +1 -1
- package/src/core/color/oklab/xyz_to_oklab.js +3 -1
- package/src/core/fsm/simple/SimpleStateMachineDescription.js +3 -3
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.d.ts +2 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +2 -1
- package/src/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.d.ts +3 -1
- package/src/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.js +5 -3
- package/src/core/geom/ConicRay.d.ts +3 -1
- package/src/core/geom/ConicRay.d.ts.map +1 -1
- package/src/core/geom/ConicRay.js +3 -1
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +3 -2
- package/src/core/geom/Vector1.js +1 -1
- package/src/core/geom/Vector2.d.ts.map +1 -1
- package/src/core/geom/Vector2.js +2 -1
- package/src/core/geom/Vector3.d.ts.map +1 -1
- package/src/core/geom/Vector3.js +2 -1
- package/src/core/graph/layout/CircleLayout.d.ts.map +1 -1
- package/src/core/graph/layout/CircleLayout.js +5 -2
- package/src/core/model/ObservedString.d.ts +5 -0
- package/src/core/model/ObservedString.d.ts.map +1 -1
- package/src/core/model/ObservedString.js +5 -5
- package/src/core/model/node-graph/node/NodeDescription.js +3 -3
- package/src/core/model/node-graph/visual/NodeDescriptionVisualRegistry.js +1 -1
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +4 -4
- package/src/core/model/reactive/model/terminal/ReactiveReference.js +4 -4
- package/src/core/process/action/PromiseAsynchronousAction.js +3 -3
- package/src/core/process/action/SynchronousAction.js +1 -1
- package/src/core/process/buildPromiseChain.js +4 -4
- package/src/core/process/executor/ConcurrentExecutor.d.ts +104 -16
- package/src/core/process/task/Task.d.ts +153 -15
- package/src/core/process/task/Task.d.ts.map +1 -1
- package/src/core/process/task/Task.js +26 -4
- package/src/core/process/task/TaskGroup.d.ts +83 -5
- package/src/core/process/task/TaskGroup.d.ts.map +1 -1
- package/src/core/process/task/TaskGroup.js +6 -6
- package/src/core/process/undo/Action.d.ts.map +1 -1
- package/src/core/process/undo/Action.js +3 -4
- package/src/core/process/undo/ActionProcessor.d.ts.map +1 -1
- package/src/core/process/undo/ActionProcessor.js +3 -6
- package/src/engine/asset/AssetManager.js +1 -1
- package/src/engine/development/performance/MetricCollection.js +1 -1
- package/src/engine/ecs/Entity.d.ts.map +1 -1
- package/src/engine/ecs/Entity.js +2 -0
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +35 -15
- package/src/engine/ecs/EntityManager.d.ts +12 -6
- package/src/engine/ecs/EntityManager.d.ts.map +1 -1
- package/src/engine/ecs/EntityManager.js +16 -8
- package/src/engine/ecs/System.d.ts.map +1 -1
- package/src/engine/ecs/System.js +41 -1
- package/src/engine/ecs/dynamic_actions/DataScope.d.ts +2 -2
- package/src/engine/ecs/dynamic_actions/DataScope.d.ts.map +1 -1
- package/src/engine/ecs/dynamic_actions/DataScope.js +7 -7
- package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +1 -1
- package/src/engine/ecs/dynamic_actions/actions/definition/SendRequestActionDescription.js +1 -1
- package/src/engine/ecs/dynamic_actions/actions/definition/SpeakLineActionDescription.js +2 -2
- package/src/engine/ecs/dynamic_actions/actions/definition/WriteToBlackboardActionDescription.js +1 -1
- package/src/engine/ecs/dynamic_actions/actions/definition/deserializeActionFromJSON.js +3 -3
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +1 -1
- package/src/engine/ecs/fow/FogOfWar.js +8 -8
- package/src/engine/ecs/fow/shader/FogOfWarRenderer.d.ts.map +1 -1
- package/src/engine/ecs/fow/shader/FogOfWarRenderer.js +13 -13
- package/src/engine/ecs/speaker/lines/LineDescription.js +1 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js +1 -1
- package/src/engine/ecs/terrain/ecs/Terrain.js +4 -4
- package/src/engine/graphics/particles/node-based/codegen/glsl/GLSLCodeGenerator.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/codegen/glsl/GLSLCodeGenerator.js +5 -5
- package/src/engine/graphics/particles/node-based/codegen/modules/FunctionModule.d.ts +2 -1
- package/src/engine/graphics/particles/node-based/codegen/modules/FunctionModule.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/codegen/modules/FunctionModule.js +13 -5
- package/src/engine/graphics/particles/node-based/codegen/modules/FunctionModuleReference.js +1 -1
- package/src/engine/graphics/particles/node-based/codegen/modules/FunctionModuleRegistry.js +2 -2
- package/src/engine/graphics/particles/node-based/particle/ParticleAttributeSpecification.js +2 -2
- package/src/engine/graphics/texture/sampler/HarmonicDiffusionGrid.js +5 -5
- package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_NaiveFlood.d.ts +3 -1
- package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_NaiveFlood.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_NaiveFlood.js +4 -2
- package/src/engine/graphics/texture/sampler/sampler2d_combine.js +1 -1
- package/src/engine/graphics/three/TransfromControls.js +4 -5
- package/src/engine/input/devices/InputDeviceSwitch.d.ts.map +1 -1
- package/src/engine/input/devices/InputDeviceSwitch.js +1 -0
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.js +1 -1
- package/src/engine/intelligence/blackboard/AbstractBlackboard.js +3 -3
- package/src/engine/intelligence/blackboard/Blackboard.d.ts.map +1 -1
- package/src/engine/intelligence/blackboard/Blackboard.js +4 -4
- package/src/engine/intelligence/mcts/MonteCarlo.d.ts.map +1 -1
- package/src/engine/intelligence/mcts/MonteCarlo.js +36 -55
- package/src/engine/intelligence/resource/Resource.js +3 -3
- package/src/engine/save/StorageBackedList.js +2 -2
- package/src/engine/scene/SerializedScene.d.ts +1 -1
- package/src/engine/scene/SerializedScene.d.ts.map +1 -1
- package/src/engine/scene/SerializedScene.js +2 -2
- package/src/engine/sound/SoundEngine.d.ts.map +1 -1
- package/src/engine/sound/SoundEngine.js +2 -3
- package/src/engine/sound/ecs/emitter/SoundTrack.js +2 -2
- package/src/engine/sound/ecs/emitter/loadSoundTrackAsset.js +2 -2
- package/src/engine/ui/DraggableAspect.d.ts +5 -0
- package/src/engine/ui/DraggableAspect.d.ts.map +1 -1
- package/src/engine/ui/DraggableAspect.js +5 -5
- package/src/engine/ui/notification/NotificationManager.js +3 -3
- package/src/generation/filtering/boolean/CellFilterLiteralBoolean.d.ts.map +1 -1
- package/src/generation/filtering/boolean/CellFilterLiteralBoolean.js +3 -3
- package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.d.ts.map +1 -1
- package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.js +2 -2
- package/src/generation/grid/GridData.d.ts.map +1 -1
- package/src/generation/grid/GridData.js +3 -3
- package/src/generation/grid/generation/NoopGridTaskGenerator.d.ts +1 -1
- package/src/generation/grid/generation/NoopGridTaskGenerator.d.ts.map +1 -1
- package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.js +1 -1
- package/src/generation/grid/generation/grid/GridTaskAddNodesFixed.d.ts +1 -1
- package/src/generation/grid/generation/grid/GridTaskAddNodesFixed.d.ts.map +1 -1
- package/src/generation/grid/layers/GridDataLayer.d.ts.map +1 -1
- package/src/generation/grid/layers/GridDataLayer.js +2 -2
- package/src/generation/markers/GridActionRuleSet.js +1 -1
- package/src/generation/markers/GridCellActionPlaceMarker.js +1 -1
- package/src/generation/markers/actions/MarkerProcessingRule.js +1 -1
- package/src/generation/markers/matcher/MarkerNodeMatcherByType.d.ts.map +1 -1
- package/src/generation/markers/matcher/MarkerNodeMatcherByType.js +2 -2
- package/src/generation/markers/matcher/MarkerNodeMatcherContainsTag.d.ts.map +1 -1
- package/src/generation/markers/matcher/MarkerNodeMatcherContainsTag.js +2 -2
- package/src/generation/markers/transform/MarkerNodeTransformerRecordProperty.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformerRecordProperty.js +2 -2
- package/src/generation/markers/transform/MarkerNodeTransformerRecordPropertyClosure.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformerRecordPropertyClosure.js +3 -3
- package/src/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js +3 -3
- package/src/generation/markers/transform/MarkerNodeTransformerRemoveTag.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformerRemoveTag.js +2 -2
- package/src/generation/placement/action/GridCellActionPlaceTags.d.ts.map +1 -1
- package/src/generation/placement/action/GridCellActionPlaceTags.js +1 -3
- package/src/generation/placement/action/GridCellActionWriteFilterToLayer.d.ts.map +1 -1
- package/src/generation/placement/action/GridCellActionWriteFilterToLayer.js +2 -2
- package/src/generation/rules/CellMatcherLayerBitMaskTest.d.ts.map +1 -1
- package/src/generation/rules/CellMatcherLayerBitMaskTest.js +2 -2
- package/src/generation/theme/TerrainTheme.js +1 -1
- package/src/view/View.d.ts.map +1 -1
- package/src/view/View.js +3 -5
- package/src/view/common/ListView.js +1 -1
- package/src/view/common/LocalizedLabelView.js +3 -3
- package/src/view/elements/radial/RadialText.d.ts.map +1 -1
- package/src/view/elements/radial/RadialText.js +14 -6
- package/src/view/interaction/InteractionCommand.d.ts.map +1 -1
- package/src/view/interaction/InteractionCommand.js +5 -5
- package/src/view/interaction/InteractionCommandSet.js +1 -1
- package/src/view/tooltip/gml/compiler/GMLReferenceCompiler.js +2 -2
- package/src/core/process/task/ITask.d.ts +0 -18
|
@@ -16,7 +16,7 @@ class TaskGroup {
|
|
|
16
16
|
*/
|
|
17
17
|
constructor(subtasks, name = 'Unnamed') {
|
|
18
18
|
assert.isArray(subtasks, 'subtasks');
|
|
19
|
-
assert.
|
|
19
|
+
assert.isString(name, 'name');
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
*
|
|
@@ -41,11 +41,6 @@ class TaskGroup {
|
|
|
41
41
|
* @type {ObservedInteger}
|
|
42
42
|
*/
|
|
43
43
|
this.state = new ObservedInteger(TaskState.INITIAL);
|
|
44
|
-
/**
|
|
45
|
-
* @readonly
|
|
46
|
-
* @type {boolean}
|
|
47
|
-
*/
|
|
48
|
-
this.isTaskGroup = true;
|
|
49
44
|
}
|
|
50
45
|
|
|
51
46
|
/**
|
|
@@ -231,6 +226,11 @@ class TaskGroup {
|
|
|
231
226
|
}
|
|
232
227
|
}
|
|
233
228
|
|
|
229
|
+
/**
|
|
230
|
+
* @readonly
|
|
231
|
+
* @type {boolean}
|
|
232
|
+
*/
|
|
233
|
+
TaskGroup.prototype.isTaskGroup = true;
|
|
234
234
|
|
|
235
235
|
/**
|
|
236
236
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/undo/Action.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/undo/Action.js"],"names":[],"mappings":"AACA;;;;;;;GAOG;AACH,oBALa,GAAG;IAMZ;;;OAGG;IACH,mBAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,eAFW,GAAG,iBAIb;IAED;;;OAGG;IACH,gBAFW,GAAG,iBAIb;IAGL;;;OAGG;IACH,UAFU,OAAO,CAEQ;CANxB"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Alex Goldring
|
|
3
|
-
* @copyright Alex Goldring 2017
|
|
4
|
-
*/
|
|
5
1
|
|
|
6
2
|
/**
|
|
7
3
|
* Base class for implementing reversible actions.
|
|
8
4
|
* Actions are intended to be used in conjunction with {@link ActionProcessor}
|
|
9
5
|
* @template CTX
|
|
6
|
+
*
|
|
7
|
+
* @author Alex Goldring
|
|
8
|
+
* @copyright Company Named Limited (c) 2025
|
|
10
9
|
*/
|
|
11
10
|
export class Action {
|
|
12
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/undo/ActionProcessor.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionProcessor.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/undo/ActionProcessor.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,6BANa,CAAC,EAAE,CAAC;IAOb;;;;OAIG;IACH,qBAHW,GAAC,EA+DX;IA3DG;;;OAGG;IACH,SAFU,IAAI,CAAC,MAAM,CAAC,CAEG;IAEzB;;;OAGG;IACH,SAFU,GAAC,CAEW;IAEtB;;;OAGG;IACH,OAFU,KAAK,CAAC,IAAI,CAAC,GAAC,CAAC,CAAC,CAET;IAEf;;OAEG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,oBAFU,MAAM,CAEW;IAE3B;;;OAGG;IACH,kBAFU,MAAM,CAEa;IAE7B;;;OAGG;IACH,oBAFU,MAAM,CAEmB;IAEnC;;;OAGG;IACH,aAFU,MAAM,CAAC,GAAC,CAAC,GAAG,MAAM,CAEG;IAE/B;;;OAGG;IACH,eAFU,MAAM,CAAC,GAAC,CAAC,GAAG,MAAM,CAEK;IAEjC;;;;OAIG;IACH,uBAAuC;IAG3C;;;OAGG;IACH,gBAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,0BAJW,MAAM,GACJ,CAAC,CAWb;IAED;;OAEG;IACH,cAGC;IAED;;;;;;;;OAQG;IACH,wBAFW,MAAM,QAqChB;IAED;;;OAGG;IACH,kBAFW,CAAC,iBAiCX;IAED,uBA2BC;IAED;;;;;OAKG;IACH,2CAcC;IAED;;;;;OAKG;IACH,4BAJW,CAAC,GACC,OAAO,CAWnB;IAED;;;;;;OAMG;IACH,4BAyDC;IAED,sBAQC;IAED;;;;OAIG;IACH,sBAmCC;IAED;;OAEG;IACH,sBAQC;IAED;;;;OAIG;IACH,sBA0BC;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,iBAuBlB;IAED;;;OAGG;IACH,WAFW,MAAM,iBAUhB;IAED;;;;;OAKG;IACH,oBAgBC;IAED;;;;OAIG;IACH,kBAMC;CACJ;iBAvfgB,+BAA+B;qBAG3B,WAAW;mBAFb,+BAA+B"}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Alex Goldring on 27/06/2017.
|
|
3
|
-
* @copyright Alex Goldring 2017
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
1
|
import { assert } from "../../assert.js";
|
|
8
2
|
import List from "../../collection/list/List.js";
|
|
9
3
|
import Signal from "../../events/signal/Signal.js";
|
|
@@ -13,6 +7,9 @@ import { Mark } from "./Mark.js";
|
|
|
13
7
|
/**
|
|
14
8
|
* @template C, M
|
|
15
9
|
* @constructor
|
|
10
|
+
*
|
|
11
|
+
* @author Alex Goldring
|
|
12
|
+
* @copyright Company Named Limited (c) 2025
|
|
16
13
|
*/
|
|
17
14
|
export class ActionProcessor {
|
|
18
15
|
/**
|
|
@@ -842,7 +842,7 @@ export class AssetManager {
|
|
|
842
842
|
* @return {Promise<Asset<T>>}
|
|
843
843
|
*/
|
|
844
844
|
promiseByAlias(alias) {
|
|
845
|
-
assert.
|
|
845
|
+
assert.isString(alias, 'alias');
|
|
846
846
|
|
|
847
847
|
// resolve alias
|
|
848
848
|
const assetDescription = this.#aliases.get(alias);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/Entity.js"],"names":[],"mappings":"AAgBA
|
|
1
|
+
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/Entity.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH;IA2aI;;;;;OAKG;IACH,+BAJW,MAAM,WACN,sBAAsB,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IAED;;;OAGG;IACH,WAFa,OAAO,CAwBnB;IAED;;;;OAIG;IACH,eAFW,sBAAsB,GADpB,MAAM,CAyDlB;IAyBL;;;;OAIG;IACH,mBAFU,OAAO,CAEQ;;CAPxB;;gCA1f+B,sBAAsB;4BAD1B,kBAAkB;mBAF3B,oCAAoC"}
|
package/src/engine/ecs/Entity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityComponentDataset.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityComponentDataset.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityComponentDataset.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityComponentDataset.js"],"names":[],"mappings":"AAyHA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IAEI;;;;OAIG;IACH,wBAA+B;IAE/B;;;;;OAKG;IACH,yBAAsC;IAEtC;;;OAGG;IACH,2BAAkC;IAElC;;;OAGG;IACH,yBAAsB;IAEtB;;;;OAIG;IACH,4BAAgC;IAEhC;;;;OAIG;IACH,2BAAuB;IAEvB;;;OAGG;IACH,mBAAgB;IAEhB;;;;OAIG;IACH,oBAAgB;IAEhB;;;;;;;OAOG;IACH,mBAAe;IAEf;;;OAGG;IACH,0BAFU,MAAM,CAAC,MAAM,CAAC,CAEO;IAE/B;;;OAGG;IACH,0BAFU,MAAM,CAEe;IAG/B;;;;OAIG;IACH,+BAA4B;IAE5B;;;;OAIG;IACH,kCAA+B;IAE/B;;;OAGG;IACH,kBAAe;IAGf;;;;;;OAMG;IACH,iBALa,CAAC,EAAE,CAAC,UACN,GAAG,iBACH,CAAC,GACC,OAAO,CAAC,CAAC,CAAC,CAoCtB;IAED;;;;;OAKG;IACH,sBAJW,cAAc,cACd,OAAO,GACL,OAAO,CAqDnB;IAED;;;;;OAKG;IACH,yBAJW,cAAc,cACd,OAAO,GACL,OAAO,CAuDnB;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;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AAM,YACN,SAAU,YACV,GAAC,QA8BX;IAED;;;;;;;;OAQG;IACH,kCAPW,MAAM,aACN,MAAM,gCAEN,GAAC,GAEC,OAAO,CAoCnB;IAED;;;;;OAKG;IACH,2DAeC;IAED;;;;OAIG;IACH,iCAHW,MAAM,GACJ,OAAO,CAenB;IAED;;OAEG;IACH,cAMC;IAED;;;OAGG;IACH,iBAYC;IAED;;;;OAIG;IACH,wBAJa,CAAC,aACH,MAAM,GACJ,IAAI,cAAU,KAAK,CAAC,CAAC,CAAC,CAYlC;IAED;;;;OAIG;IACH,mBAFW,sBAAsB,iCA6DhC;IAED;;;;OAIG;IACH,+EAiDC;IAED;;;OAGG;IACH,WAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,8CAFW,GAAC,QAgBX;IAGL;;;OAGG;IACH,mCAFU,OAAO,CAEwC;CANxD;mBA53DkB,oCAAoC"}
|
|
@@ -85,14 +85,18 @@ function matchComponentMask(
|
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
*
|
|
88
|
-
* @param entityIndex
|
|
88
|
+
* @param {number} entityIndex
|
|
89
89
|
* @param {BitSet} mask
|
|
90
|
-
* @param componentIndexMap
|
|
91
|
-
* @param components
|
|
92
|
-
* @param result
|
|
90
|
+
* @param {number[]} componentIndexMap
|
|
91
|
+
* @param {[]} components
|
|
92
|
+
* @param {[]} result
|
|
93
93
|
*/
|
|
94
94
|
function buildObserverCallbackArgs(entityIndex, mask, componentIndexMap, components, result) {
|
|
95
|
-
for (
|
|
95
|
+
for (
|
|
96
|
+
let i = mask.nextSetBit(0);
|
|
97
|
+
i !== -1;
|
|
98
|
+
i = mask.nextSetBit(i + 1)
|
|
99
|
+
) {
|
|
96
100
|
const componentDataset = components[i];
|
|
97
101
|
|
|
98
102
|
const componentInstance = componentDataset[entityIndex];
|
|
@@ -103,15 +107,26 @@ function buildObserverCallbackArgs(entityIndex, mask, componentIndexMap, compone
|
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* @type {number[]}
|
|
113
|
+
*/
|
|
114
|
+
const scratch_indices = [];
|
|
108
115
|
|
|
109
116
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
117
|
+
* Used for constructing arguments prior to traversal visitor call
|
|
118
|
+
* @type {*[]}
|
|
119
|
+
*/
|
|
120
|
+
const scratch_args = [];
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Represents a storage for entities and their associated components.
|
|
124
|
+
* Entities are just integer IDs and components are stored in a virtual table, where each component type has a separate column and each entity is a row in that table.
|
|
125
|
+
* It is valid for entities to have no components or to have every possible component.
|
|
126
|
+
* The entity IDs are compacted, meaning that when an entity is removed - its ID can later be reused.
|
|
127
|
+
* Typically, you would use {@link Entity} helper class instead of working directly with the dataset as it offers a higher-level API.
|
|
128
|
+
*
|
|
129
|
+
* Designed to handle millions of objects at the same time.
|
|
115
130
|
*
|
|
116
131
|
* @example
|
|
117
132
|
* const ecd = new EntityComponentDataset();
|
|
@@ -123,10 +138,15 @@ const scratch_array_1 = [];
|
|
|
123
138
|
*
|
|
124
139
|
* // destroy the entity
|
|
125
140
|
* ecd.removeEntity(entityId);
|
|
141
|
+
*
|
|
142
|
+
* @see https://en.wikipedia.org/wiki/Entity_component_system
|
|
143
|
+
* @author Alex Goldring
|
|
144
|
+
* @copyright Company Named Limited (c) 2025
|
|
126
145
|
*/
|
|
127
146
|
export class EntityComponentDataset {
|
|
128
147
|
|
|
129
148
|
/**
|
|
149
|
+
* Set a bit at index of an entity if index is used, unset otherwise
|
|
130
150
|
* @private
|
|
131
151
|
* @type {BitSet}
|
|
132
152
|
*/
|
|
@@ -1208,7 +1228,7 @@ export class EntityComponentDataset {
|
|
|
1208
1228
|
let entityIndex, i;
|
|
1209
1229
|
|
|
1210
1230
|
//map classes to indices
|
|
1211
|
-
const indices =
|
|
1231
|
+
const indices = scratch_indices;
|
|
1212
1232
|
|
|
1213
1233
|
// prepare sorted array of component indices
|
|
1214
1234
|
const numClasses = classes.length;
|
|
@@ -1228,12 +1248,12 @@ export class EntityComponentDataset {
|
|
|
1228
1248
|
indices[i] = componentIndex;
|
|
1229
1249
|
}
|
|
1230
1250
|
|
|
1231
|
-
const args =
|
|
1251
|
+
const args = scratch_args;
|
|
1232
1252
|
|
|
1233
1253
|
// crop args array to the right length (since we're re-using a scratch array)
|
|
1234
1254
|
const args_length_intended = numClasses + 1;
|
|
1235
1255
|
|
|
1236
|
-
array_shrink_to_size(
|
|
1256
|
+
array_shrink_to_size(scratch_args, args_length_intended);
|
|
1237
1257
|
|
|
1238
1258
|
const entityOccupancy = this.entityOccupancy;
|
|
1239
1259
|
|
|
@@ -55,20 +55,26 @@ export class EntityManager {
|
|
|
55
55
|
*/
|
|
56
56
|
private readonly systemAccumulatedFixedStepTime;
|
|
57
57
|
/**
|
|
58
|
-
* Value used to execute {@link System
|
|
59
|
-
* In seconds
|
|
58
|
+
* Value used to execute {@link System.fixedUpdate}
|
|
59
|
+
* In seconds.
|
|
60
|
+
* The default is ~60 Hz, which should be sufficient for most use-cases.
|
|
61
|
+
* Setting this value higher will reduce total number of steps per second, and typically lead to better performance.
|
|
62
|
+
* Setting this value lower will increase number of steps per second, increasing simulation accuracy at the cost of performance.
|
|
63
|
+
* Make sure you understand the implications when modifying this.
|
|
64
|
+
* A good safe range is [0.001 - 0.2]
|
|
60
65
|
* @type {number}
|
|
61
66
|
*/
|
|
62
67
|
fixedUpdateStepSize: number;
|
|
63
68
|
/**
|
|
64
|
-
* How long can any given system run it's fixedUpdate, per simulation update
|
|
65
|
-
* This is value allows us to avoid cases where fixedUpdate takes longer that its time step and causes a runaway freeze
|
|
66
|
-
* In milliseconds
|
|
69
|
+
* How long can any given system run it's {@link System.fixedUpdate}, per simulation update
|
|
70
|
+
* This is value allows us to avoid cases where {@link System.fixedUpdate} takes longer that its time step and causes a runaway freeze
|
|
71
|
+
* In milliseconds.
|
|
67
72
|
* @type {number}
|
|
68
73
|
*/
|
|
69
74
|
fixedUpdatePerSystemExecutionTimeLimit: number;
|
|
70
75
|
/**
|
|
71
|
-
*
|
|
76
|
+
* Currently attached dataset.
|
|
77
|
+
* Do not modify directly, instead use {@link attachDataSet} and {@link detachDataSet} respectively.
|
|
72
78
|
* @type {EntityComponentDataset}
|
|
73
79
|
*/
|
|
74
80
|
dataset: EntityComponentDataset;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityManager.js"],"names":[],"mappings":"iCAeU,MAAM;;;;;;;;;AAWhB;;;GAGG;AACH;IAEI;;;OAGG;IACH,kBAFU,iCAAQ,CAEL;IAEb;;;;OAIG;IACH,uCAA2B;IAE3B;;;;OAIG;IACH,iCAAqB;IAErB;;OAEG;IACH;;;QAGI;;WAEG;qBADO,MAAM,iCAAQ;;MAI1B;IAEF;;;OAGG;IACH,OAFU,kBAAkB,CAEO;IAEnC;;;;;;OAMG;IACH,gDAA2C;IAE3C
|
|
1
|
+
{"version":3,"file":"EntityManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityManager.js"],"names":[],"mappings":"iCAeU,MAAM;;;;;;;;;AAWhB;;;GAGG;AACH;IAEI;;;OAGG;IACH,kBAFU,iCAAQ,CAEL;IAEb;;;;OAIG;IACH,uCAA2B;IAE3B;;;;OAIG;IACH,iCAAqB;IAErB;;OAEG;IACH;;;QAGI;;WAEG;qBADO,MAAM,iCAAQ;;MAI1B;IAEF;;;OAGG;IACH,OAFU,kBAAkB,CAEO;IAEnC;;;;;;OAMG;IACH,gDAA2C;IAE3C;;;;;;;;;OASG;IACH,qBAFU,MAAM,CAEqB;IAErC;;;;;OAKG;IACH,wCAFU,MAAM,CAE4B;IAE5C;;;;OAIG;IACH,SAFU,sBAAsB,CAEjB;IAEf;;;;;OAKG;IACH,uCAAsC;IAEtC;;;OAGG;IACH,6BA8EC;IAED,sBAcC;IAED;;;OAGG;IACH,uBAFa,KAAK,EAAE,CAuBnB;IAED;;;;;OAKG;IACH,uBAJW,sBAAsB,QA0BhC;IAED;;;;OAIG;IACH,UAJa,CAAC,eACH,KAAK,CAAC,CAAC,CAAC,GACN,OAAO,CAInB;IAED;;;;OAIG;IACH,UAJa,CAAC,eACH,KAAK,CAAC,CAAC,CAAC,GACN,CAAC,GAAC,IAAI,CAgBlB;IAED;;;;;OAKG;IACH,wBAJa,CAAC,aACH,MAAM,GACJ,IAAI,GAAC,KAAK,CAAC,CAAC,CAAC,CAezB;IAGD;;;OAGG;IACH,oBAFW,MAAM,QAoEhB;IAED;;;;;OAKG;IACH,iEA0EC;IAED;;;;OAIG;IACH,uDAFa,OAAO,CAAC,OAAO,CAAC,CAyC5B;IAED;;;;;OAKG;IACH,mBA6BC;IAED;;;;;OAKG;IACH,oBAwCC;IAED;;;;;OAKG;IACH,kEAwEC;IAED;;;;OAIG;IACH,2BAHW,KAAK,GACH,OAAO,iCAAS,CA0B5B;IAED;;;;;OAKG;IACH,kCAJW,KAAK,SACL,WAAW,GACT,OAAO,iCAAS,CAsB5B;IAED;;;;;OAKG;IACH,mEAsEC;CACJ;uBAhzBmC,aAAa;mBAP9B,oCAAoC"}
|
|
@@ -79,22 +79,28 @@ export class EntityManager {
|
|
|
79
79
|
systemAccumulatedFixedStepTime = new Map();
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
|
-
* Value used to execute {@link System
|
|
83
|
-
* In seconds
|
|
82
|
+
* Value used to execute {@link System.fixedUpdate}
|
|
83
|
+
* In seconds.
|
|
84
|
+
* The default is ~60 Hz, which should be sufficient for most use-cases.
|
|
85
|
+
* Setting this value higher will reduce total number of steps per second, and typically lead to better performance.
|
|
86
|
+
* Setting this value lower will increase number of steps per second, increasing simulation accuracy at the cost of performance.
|
|
87
|
+
* Make sure you understand the implications when modifying this.
|
|
88
|
+
* A good safe range is [0.001 - 0.2]
|
|
84
89
|
* @type {number}
|
|
85
90
|
*/
|
|
86
|
-
fixedUpdateStepSize = 0.
|
|
91
|
+
fixedUpdateStepSize = 0.016666666666;
|
|
87
92
|
|
|
88
93
|
/**
|
|
89
|
-
* How long can any given system run it's fixedUpdate, per simulation update
|
|
90
|
-
* This is value allows us to avoid cases where fixedUpdate takes longer that its time step and causes a runaway freeze
|
|
91
|
-
* In milliseconds
|
|
94
|
+
* How long can any given system run it's {@link System.fixedUpdate}, per simulation update
|
|
95
|
+
* This is value allows us to avoid cases where {@link System.fixedUpdate} takes longer that its time step and causes a runaway freeze
|
|
96
|
+
* In milliseconds.
|
|
92
97
|
* @type {number}
|
|
93
98
|
*/
|
|
94
99
|
fixedUpdatePerSystemExecutionTimeLimit = 15;
|
|
95
100
|
|
|
96
101
|
/**
|
|
97
|
-
*
|
|
102
|
+
* Currently attached dataset.
|
|
103
|
+
* Do not modify directly, instead use {@link attachDataSet} and {@link detachDataSet} respectively.
|
|
98
104
|
* @type {EntityComponentDataset}
|
|
99
105
|
*/
|
|
100
106
|
dataset = null;
|
|
@@ -324,6 +330,7 @@ export class EntityManager {
|
|
|
324
330
|
assert.isNumber(timeDelta, 'timeDelta');
|
|
325
331
|
assert.notNaN(timeDelta, 'timeDelta');
|
|
326
332
|
assert.greaterThanOrEqual(timeDelta, 0, 'timeDelta must be >= 0');
|
|
333
|
+
assert.isFiniteNumber(timeDelta, 'timeDelta');
|
|
327
334
|
|
|
328
335
|
if (this.__execution_order_needs_update) {
|
|
329
336
|
this.updateExecutionOrder();
|
|
@@ -348,6 +355,7 @@ export class EntityManager {
|
|
|
348
355
|
|
|
349
356
|
const system = systems[i];
|
|
350
357
|
|
|
358
|
+
// Perform fixed-step update
|
|
351
359
|
if (system.fixedUpdate !== noop) {
|
|
352
360
|
let accumulated_time = accumulatedTime.get(system) + timeDelta;
|
|
353
361
|
|
|
@@ -744,7 +752,7 @@ export class EntityManager {
|
|
|
744
752
|
* @param {function} [readyCallback] Called when shutdown finishes successfully. defaults to no-operation
|
|
745
753
|
* @param {function} [errorCallback] Called when an error occurs during shutdown process. defaults to console error output
|
|
746
754
|
*/
|
|
747
|
-
shutdown(readyCallback = noop, errorCallback= console.error) {
|
|
755
|
+
shutdown(readyCallback = noop, errorCallback = console.error) {
|
|
748
756
|
if (this.state !== EntityManagerState.Running) {
|
|
749
757
|
throw new IllegalStateException(`System is wrong state, expected '${EntityManagerState.Running}'`);
|
|
750
758
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,oBArBa,CAAC;IAuBV;;;;;OAKG;IACH,yBAFU,aAAa,CAEF;IAErB;;;;OAIG;IACH,gBAFU,aAAa,CAAE,WAAW,CAAC,CAEU;IAE/C;;;;OAIG;IACH,oBAAkB;IAElB;;;;;;;;;OASG;IACH,iBAFU,2BAA2B,EAAE,CAElB;IAGrB;;OAEG;IACH,mCAcC;IAED;;;;OAIG;IACH,sBAJa,CAAC,SACH,CAAC,GACA,MAAM,CA8BjB;IAED;;;;;OAKG;IACH,uBAJW,aAAa,0DAOvB;IAED;;;;;OAKG;IACH,wBAJW,aAAa,0DAMvB;IAED,wCAEC;IAED,0CAEC;IAIL;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,yBAA4B;IAG5B;;;OAGG;IACH,oBAAuB;CApBtB;;;;0BA2CS,MAAM;;;;;;;;0BAjMU,mCAAmC;qBADxC,6BAA6B"}
|
package/src/engine/ecs/System.js
CHANGED
|
@@ -5,25 +5,52 @@ import ObservedValue from "../../core/model/ObservedValue.js";
|
|
|
5
5
|
import { ResourceAccessKind } from "../../core/model/ResourceAccessKind.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
+
* Base class to extend ECS systems from.
|
|
9
|
+
* A System defines some behavior over a tuple of components.
|
|
10
|
+
* Override base methods as needed to achieve desired behavior. The system already offers {@link update} and {@link fixedUpdate} methods for time-based simulation.
|
|
11
|
+
* If you have event-driven requirements - make use of {@link link} and {@link unlink} methods, as well as messaging facilities of {@link EntityComponentDataset}.
|
|
8
12
|
*
|
|
9
13
|
* @template C
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* class FallDamageSystem{
|
|
17
|
+
* dependencies = [Health, Physics]
|
|
18
|
+
*
|
|
19
|
+
* listeners = []; // internal storage
|
|
20
|
+
*
|
|
21
|
+
* link(health, physics, entity){
|
|
22
|
+
* const listener = () => health.value -= 10; // receive damage on fall
|
|
23
|
+
* physics.onContact.add(listener);
|
|
24
|
+
* this.listeners[entity] = listener; // remember for later
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* unlink(health, physics, entity){
|
|
28
|
+
* const listener = this.listeners[entity];
|
|
29
|
+
* physics.onContact.remove(listener);
|
|
30
|
+
* delete this.listeners[entity]; // cleanup
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
10
33
|
*/
|
|
11
34
|
export class System {
|
|
12
35
|
|
|
13
36
|
/**
|
|
37
|
+
* Reference to the attached {@link EntityManager}, usually set during {@link startup}
|
|
38
|
+
* Useful for gaining access to other Systems, via {@link EntityManager.getSystem} as well as the associated dataset via {@link EntityManager.dataset}
|
|
14
39
|
* @protected
|
|
15
40
|
* @type {EntityManager}
|
|
16
41
|
*/
|
|
17
42
|
entityManager = null;
|
|
18
43
|
|
|
19
44
|
/**
|
|
45
|
+
* Managed internally by {@link EntityManager}, do not modify manually
|
|
20
46
|
* @readonly
|
|
21
47
|
* @type {ObservedValue.<SystemState>}
|
|
22
48
|
*/
|
|
23
49
|
state = new ObservedValue(SystemState.INITIAL);
|
|
24
50
|
|
|
25
51
|
/**
|
|
26
|
-
*
|
|
52
|
+
* Components which have to be present before the system links an entity
|
|
53
|
+
* NOTE: do not modify this while the system is running
|
|
27
54
|
* @type {Array}
|
|
28
55
|
*/
|
|
29
56
|
dependencies = [];
|
|
@@ -35,6 +62,7 @@ export class System {
|
|
|
35
62
|
* - Declaring this helps EntityManager to ensure that all relevant component types are properly registered for the system
|
|
36
63
|
*
|
|
37
64
|
* NOTE: specifying this is optional. The engine will still work.
|
|
65
|
+
* NOTE: do not modify this while the system is running
|
|
38
66
|
* @type {ResourceAccessSpecification[]}
|
|
39
67
|
*/
|
|
40
68
|
components_used = [];
|
|
@@ -94,11 +122,23 @@ export class System {
|
|
|
94
122
|
return result;
|
|
95
123
|
}
|
|
96
124
|
|
|
125
|
+
/**
|
|
126
|
+
*
|
|
127
|
+
* @param {EntityManager} entityManager
|
|
128
|
+
* @param {function} readyCallback
|
|
129
|
+
* @param {function} errorCallback
|
|
130
|
+
*/
|
|
97
131
|
startup(entityManager, readyCallback, errorCallback) {
|
|
98
132
|
this.entityManager = entityManager;
|
|
99
133
|
readyCallback();
|
|
100
134
|
}
|
|
101
135
|
|
|
136
|
+
/**
|
|
137
|
+
*
|
|
138
|
+
* @param {EntityManager} entityManager
|
|
139
|
+
* @param {function} readyCallback
|
|
140
|
+
* @param {function} errorCallback
|
|
141
|
+
*/
|
|
102
142
|
shutdown(entityManager, readyCallback, errorCallback) {
|
|
103
143
|
readyCallback();
|
|
104
144
|
}
|
|
@@ -12,10 +12,10 @@ export class DataScope {
|
|
|
12
12
|
size(): number;
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
15
|
-
* @param {string}
|
|
15
|
+
* @param {string} variable_name
|
|
16
16
|
* @returns {*|undefined}
|
|
17
17
|
*/
|
|
18
|
-
read(
|
|
18
|
+
read(variable_name: string): any | undefined;
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
21
|
* @param {Object} scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataScope.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/dynamic_actions/DataScope.js"],"names":[],"mappings":"AAEA;IAGQ;;;OAGG;IACH,cAAe;IAGf,YAqCE;IAGN;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"DataScope.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/dynamic_actions/DataScope.js"],"names":[],"mappings":"AAEA;IAGQ;;;OAGG;IACH,cAAe;IAGf,YAqCE;IAGN;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACJ,GAAC,GAAC,SAAS,CAqBvB;IAED;;;OAGG;IACH,uBAOC;IAED;;;OAGG;IACH,WAIC;IAED;;;;OAIG;IACH,aAHW,MAAM,GACJ,MAAM,CAYlB;CACJ"}
|
|
@@ -60,11 +60,11 @@ export class DataScope {
|
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
*
|
|
63
|
-
* @param {string}
|
|
63
|
+
* @param {string} variable_name
|
|
64
64
|
* @returns {*|undefined}
|
|
65
65
|
*/
|
|
66
|
-
read(
|
|
67
|
-
assert.
|
|
66
|
+
read(variable_name) {
|
|
67
|
+
assert.isString(variable_name, 'variable_name');
|
|
68
68
|
|
|
69
69
|
const stack = this.stack;
|
|
70
70
|
|
|
@@ -73,7 +73,7 @@ export class DataScope {
|
|
|
73
73
|
for (let i = last; i >= 0; i--) {
|
|
74
74
|
const scope = stack[i];
|
|
75
75
|
|
|
76
|
-
const value = scope[
|
|
76
|
+
const value = scope[variable_name];
|
|
77
77
|
|
|
78
78
|
if (value !== undefined) {
|
|
79
79
|
return value;
|
|
@@ -89,10 +89,10 @@ export class DataScope {
|
|
|
89
89
|
* @param {Object} scope
|
|
90
90
|
*/
|
|
91
91
|
push(scope) {
|
|
92
|
-
assert.
|
|
93
|
-
assert.
|
|
92
|
+
assert.defined(scope, 'scope');
|
|
93
|
+
assert.notNull(scope, 'scope');
|
|
94
94
|
|
|
95
|
-
assert.
|
|
95
|
+
assert.isObject(scope, 'scope');
|
|
96
96
|
|
|
97
97
|
this.stack.push(scope);
|
|
98
98
|
}
|
|
@@ -292,7 +292,7 @@ export class DynamicActorSystem extends AbstractContextSystem {
|
|
|
292
292
|
* @param {DataScope} scope
|
|
293
293
|
*/
|
|
294
294
|
populateEntityScope(entity, scope) {
|
|
295
|
-
assert.
|
|
295
|
+
assert.isNumber(entity, "entity");
|
|
296
296
|
|
|
297
297
|
const ecd = this.entityManager.dataset;
|
|
298
298
|
|
|
@@ -19,7 +19,7 @@ export class SendRequestActionDescription extends AbstractActionDescription {
|
|
|
19
19
|
|
|
20
20
|
assert.defined(context, 'context');
|
|
21
21
|
assert.notNull(context, 'context');
|
|
22
|
-
assert.
|
|
22
|
+
assert.isObject(context, 'context');
|
|
23
23
|
|
|
24
24
|
this.distance = distance;
|
|
25
25
|
this.responders = responders;
|
|
@@ -62,12 +62,12 @@ export class SpeakLineActionDescription extends AbstractActionDescription {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
if (line_id !== undefined) {
|
|
65
|
-
assert.
|
|
65
|
+
assert.isString(line_id, 'line_id');
|
|
66
66
|
|
|
67
67
|
this.isGroup = false;
|
|
68
68
|
this.id = line_id;
|
|
69
69
|
} else {
|
|
70
|
-
assert.
|
|
70
|
+
assert.isString(set_id, 'set_id');
|
|
71
71
|
|
|
72
72
|
this.isGroup = true;
|
|
73
73
|
this.id = set_id;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SpeakLineActionDescription } from "./SpeakLineActionDescription.js";
|
|
2
|
-
import { SendRequestActionDescription } from "./SendRequestActionDescription.js";
|
|
3
1
|
import { assert } from "../../../../../core/assert.js";
|
|
4
2
|
import { ActionSequenceDescription } from "./ActionSequenceDescription.js";
|
|
5
3
|
import { DelayActionDescription } from "./DelayActionDescription.js";
|
|
6
4
|
import { NoopActionDescription } from "./NoopActionDescription.js";
|
|
5
|
+
import { SendRequestActionDescription } from "./SendRequestActionDescription.js";
|
|
6
|
+
import { SpeakLineActionDescription } from "./SpeakLineActionDescription.js";
|
|
7
7
|
import { WeightedRandomActionDescription } from "./WeightedRandomActionDescription.js";
|
|
8
8
|
import { WriteToBlackboardActionDescription } from "./WriteToBlackboardActionDescription.js";
|
|
9
9
|
|
|
@@ -44,7 +44,7 @@ function registerType(t) {
|
|
|
44
44
|
|
|
45
45
|
const type = t.prototype.type;
|
|
46
46
|
|
|
47
|
-
assert.
|
|
47
|
+
assert.isString(type, 'type');
|
|
48
48
|
|
|
49
49
|
type_map[type] = (j) => {
|
|
50
50
|
const action = new t;
|
|
@@ -107,7 +107,7 @@ export class DynamicRuleDescription {
|
|
|
107
107
|
global_cooldowns = [],
|
|
108
108
|
priority = 0
|
|
109
109
|
}) {
|
|
110
|
-
assert.
|
|
110
|
+
assert.isString(condition, 'condition');
|
|
111
111
|
|
|
112
112
|
assert.defined(action, 'action');
|
|
113
113
|
assert.notNull(action, 'action');
|
|
@@ -208,7 +208,7 @@ export class FogOfWar {
|
|
|
208
208
|
this.textureNeedsUpdate = true;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
concealAll(){
|
|
211
|
+
concealAll() {
|
|
212
212
|
this.clear();
|
|
213
213
|
}
|
|
214
214
|
|
|
@@ -219,9 +219,9 @@ export class FogOfWar {
|
|
|
219
219
|
* @param {number} radius
|
|
220
220
|
*/
|
|
221
221
|
reveal(x, y, radius) {
|
|
222
|
-
assert.
|
|
223
|
-
assert.
|
|
224
|
-
assert.
|
|
222
|
+
assert.isNumber(x, 'x');
|
|
223
|
+
assert.isNumber(y, 'y');
|
|
224
|
+
assert.isNumber(radius, 'radius');
|
|
225
225
|
|
|
226
226
|
const sampler = this.sampler;
|
|
227
227
|
const samplerWidth = sampler.width;
|
|
@@ -272,9 +272,9 @@ export class FogOfWar {
|
|
|
272
272
|
* @param {number} radius
|
|
273
273
|
*/
|
|
274
274
|
conceal(x, y, radius) {
|
|
275
|
-
assert.
|
|
276
|
-
assert.
|
|
277
|
-
assert.
|
|
275
|
+
assert.isNumber(x, 'x');
|
|
276
|
+
assert.isNumber(y, 'y');
|
|
277
|
+
assert.isNumber(radius, 'radius');
|
|
278
278
|
|
|
279
279
|
const sampler = this.sampler;
|
|
280
280
|
const samplerWidth = sampler.width;
|
|
@@ -445,7 +445,7 @@ export class FogOfWar {
|
|
|
445
445
|
* @param {number} clearance distance to nearest non-occluding cell
|
|
446
446
|
*/
|
|
447
447
|
computeAABBVisibility(aabb, cameraFocalPoint, clearance) {
|
|
448
|
-
assert.
|
|
448
|
+
assert.isNumber(clearance, 'clearance');
|
|
449
449
|
|
|
450
450
|
let sx0 = this.size.x - 1;
|
|
451
451
|
let sy0 = this.size.y - 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FogOfWarRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/fow/shader/FogOfWarRenderer.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,oDAHW,QAAQ,YACR,CAAS,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,QAAC,QAiBlD;AAED;IAEQ;;;OAGG;IACH,UAFU,cAAc,CAEwB;IAEhD,2DAAkE;IAElE,2BAAwD;IACxD,aAAwB;IAI5B;;;OAGG;IACH,2BAFW,QAAQ,QAOlB;IAED;;;;;;OAMG;IACH,wBALW,MAAM,WACN,MAAM,UACN,MAAM,UACN,MAAM,QAqBhB;IAED;;;OAGG;IACH,wBAFW,OAAO,QAMjB;IAED;;;OAGG;IACH,qBAFW,OAAO,QAKjB;IAED;;;;OAIG;IACH,iBAHW,MAAM,KACN,MAAM,QAIhB;IAED;;;OAGG;IACH,mBAFW,OAAO,QAIjB;IAED;;;;;;OAMG;IACH,iBALW,aAAa,UACb,iBAAiB,GAAC,kBAAkB,SACpC,KAAK,UACL,iBAAiB,QAoB3B;CACJ;
|
|
1
|
+
{"version":3,"file":"FogOfWarRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/fow/shader/FogOfWarRenderer.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,oDAHW,QAAQ,YACR,CAAS,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,QAAC,QAiBlD;AAED;IAEQ;;;OAGG;IACH,UAFU,cAAc,CAEwB;IAEhD,2DAAkE;IAElE,2BAAwD;IACxD,aAAwB;IAI5B;;;OAGG;IACH,2BAFW,QAAQ,QAOlB;IAED;;;;;;OAMG;IACH,wBALW,MAAM,WACN,MAAM,UACN,MAAM,UACN,MAAM,QAqBhB;IAED;;;OAGG;IACH,wBAFW,OAAO,QAMjB;IAED;;;OAGG;IACH,qBAFW,OAAO,QAKjB;IAED;;;;OAIG;IACH,iBAHW,MAAM,KACN,MAAM,QAIhB;IAED;;;OAGG;IACH,mBAFW,OAAO,QAIjB;IAED;;;;;;OAMG;IACH,iBALW,aAAa,UACb,iBAAiB,GAAC,kBAAkB,SACpC,KAAK,UACL,iBAAiB,QAoB3B;CACJ;qBAhJ+C,OAAO;mCAAP,OAAO;sBAAP,OAAO"}
|