@dcl/ecs 7.3.1-5467804476.commit-aa99243 → 7.3.1

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.
@@ -7,6 +7,7 @@ import { createComponentDefinitionFromSchema } from './lww-element-set-component
7
7
  import { EntityContainer } from './entity';
8
8
  import { SystemContainer, SYSTEMS_REGULAR_PRIORITY } from './systems';
9
9
  import { createValueSetComponentDefinitionFromSchema } from './grow-only-value-set-component-definition';
10
+ import { removeEntityWithChildren as removeEntityWithChildrenEngine } from '../runtime/helpers/tree';
10
11
  export * from './input';
11
12
  export * from './readonly';
12
13
  export * from './types';
@@ -31,6 +32,9 @@ function preEngine() {
31
32
  }
32
33
  return entityContainer.removeEntity(entity);
33
34
  }
35
+ function removeEntityWithChildren(entity) {
36
+ return removeEntityWithChildrenEngine({ removeEntity, defineComponentFromSchema, getEntitiesWith }, entity);
37
+ }
34
38
  function registerComponentDefinition(componentName, component) {
35
39
  /* istanbul ignore next */
36
40
  if (sealed)
@@ -165,6 +169,7 @@ function preEngine() {
165
169
  return {
166
170
  addEntity,
167
171
  removeEntity,
172
+ removeEntityWithChildren,
168
173
  addSystem,
169
174
  getSystems,
170
175
  removeSystem,
@@ -203,6 +208,7 @@ export function Engine(options) {
203
208
  return {
204
209
  addEntity: partialEngine.addEntity,
205
210
  removeEntity: partialEngine.removeEntity,
211
+ removeEntityWithChildren: partialEngine.removeEntityWithChildren,
206
212
  addSystem: partialEngine.addSystem,
207
213
  removeSystem: partialEngine.removeSystem,
208
214
  defineComponent: partialEngine.defineComponent,
@@ -56,6 +56,11 @@ export interface IEngine {
56
56
  * @param entity - entity
57
57
  */
58
58
  removeEntity(entity: Entity): void;
59
+ /**
60
+ * Remove all components of each entity in the tree made with Transform parenting
61
+ * @param entity - the root entity of the tree
62
+ */
63
+ removeEntityWithChildren(entity: Entity): void;
59
64
  /**
60
65
  *
61
66
  * @public
@@ -20,7 +20,7 @@ import { ComponentDefinition, IEngine } from '../../engine';
20
20
  * }
21
21
  * ```
22
22
  */
23
- export declare function getComponentEntityTree<T>(engine: IEngine, entity: Entity, component: ComponentDefinition<T & {
23
+ export declare function getComponentEntityTree<T>(engine: Pick<IEngine, 'getEntitiesWith'>, entity: Entity, component: ComponentDefinition<T & {
24
24
  parent?: Entity;
25
25
  }>): Generator<Entity>;
26
26
  /**
@@ -29,4 +29,4 @@ export declare function getComponentEntityTree<T>(engine: IEngine, entity: Entit
29
29
  * @param firstEntity - the root entity of the tree
30
30
  * @public
31
31
  */
32
- export declare function removeEntityWithChildren(engine: IEngine, entity: Entity): void;
32
+ export declare function removeEntityWithChildren(engine: Pick<IEngine, 'getEntitiesWith' | 'defineComponentFromSchema' | 'removeEntity'>, entity: Entity): void;
@@ -36,6 +36,7 @@ const lww_element_set_component_definition_1 = require("./lww-element-set-compon
36
36
  const entity_1 = require("./entity");
37
37
  const systems_1 = require("./systems");
38
38
  const grow_only_value_set_component_definition_1 = require("./grow-only-value-set-component-definition");
39
+ const tree_1 = require("../runtime/helpers/tree");
39
40
  __exportStar(require("./input"), exports);
40
41
  __exportStar(require("./readonly"), exports);
41
42
  __exportStar(require("./types"), exports);
@@ -60,6 +61,9 @@ function preEngine() {
60
61
  }
61
62
  return entityContainer.removeEntity(entity);
62
63
  }
64
+ function removeEntityWithChildren(entity) {
65
+ return (0, tree_1.removeEntityWithChildren)({ removeEntity, defineComponentFromSchema, getEntitiesWith }, entity);
66
+ }
63
67
  function registerComponentDefinition(componentName, component) {
64
68
  /* istanbul ignore next */
65
69
  if (sealed)
@@ -194,6 +198,7 @@ function preEngine() {
194
198
  return {
195
199
  addEntity,
196
200
  removeEntity,
201
+ removeEntityWithChildren,
197
202
  addSystem,
198
203
  getSystems,
199
204
  removeSystem,
@@ -232,6 +237,7 @@ function Engine(options) {
232
237
  return {
233
238
  addEntity: partialEngine.addEntity,
234
239
  removeEntity: partialEngine.removeEntity,
240
+ removeEntityWithChildren: partialEngine.removeEntityWithChildren,
235
241
  addSystem: partialEngine.addSystem,
236
242
  removeSystem: partialEngine.removeSystem,
237
243
  defineComponent: partialEngine.defineComponent,
@@ -56,6 +56,11 @@ export interface IEngine {
56
56
  * @param entity - entity
57
57
  */
58
58
  removeEntity(entity: Entity): void;
59
+ /**
60
+ * Remove all components of each entity in the tree made with Transform parenting
61
+ * @param entity - the root entity of the tree
62
+ */
63
+ removeEntityWithChildren(entity: Entity): void;
59
64
  /**
60
65
  *
61
66
  * @public
@@ -20,7 +20,7 @@ import { ComponentDefinition, IEngine } from '../../engine';
20
20
  * }
21
21
  * ```
22
22
  */
23
- export declare function getComponentEntityTree<T>(engine: IEngine, entity: Entity, component: ComponentDefinition<T & {
23
+ export declare function getComponentEntityTree<T>(engine: Pick<IEngine, 'getEntitiesWith'>, entity: Entity, component: ComponentDefinition<T & {
24
24
  parent?: Entity;
25
25
  }>): Generator<Entity>;
26
26
  /**
@@ -29,4 +29,4 @@ export declare function getComponentEntityTree<T>(engine: IEngine, entity: Entit
29
29
  * @param firstEntity - the root entity of the tree
30
30
  * @public
31
31
  */
32
- export declare function removeEntityWithChildren(engine: IEngine, entity: Entity): void;
32
+ export declare function removeEntityWithChildren(engine: Pick<IEngine, 'getEntitiesWith' | 'defineComponentFromSchema' | 'removeEntity'>, entity: Entity): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcl/ecs",
3
3
  "description": "Decentraland ECS",
4
- "version": "7.3.1-5467804476.commit-aa99243",
4
+ "version": "7.3.1",
5
5
  "author": "DCL",
6
6
  "bugs": "https://github.com/decentraland/ecs/issues",
7
7
  "files": [
@@ -33,5 +33,5 @@
33
33
  },
34
34
  "types": "./dist/index.d.ts",
35
35
  "typings": "./dist/index.d.ts",
36
- "commit": "aa992431d867572547b24b5373f6c107cb9eeeef"
36
+ "commit": "5385d4df188c5ed28c5b03bc31e7c497b5e04342"
37
37
  }