@dcl/ecs 7.8.4 → 7.8.5

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.
@@ -139,6 +139,10 @@ function preEngine(options) {
139
139
  }
140
140
  return null;
141
141
  }
142
+ function getEntityByName(value) {
143
+ const entity = getEntityOrNullByName(value);
144
+ return entity;
145
+ }
142
146
  function* getComponentDefGroup(...args) {
143
147
  const [firstComponentDef, ...componentDefinitions] = args;
144
148
  for (const [entity] of firstComponentDef.iterator()) {
@@ -186,6 +190,7 @@ function preEngine(options) {
186
190
  getComponent,
187
191
  getComponentOrNull: getComponentOrNull,
188
192
  getEntityOrNullByName,
193
+ getEntityByName,
189
194
  removeComponentDefinition,
190
195
  registerComponentDefinition,
191
196
  entityContainer,
@@ -240,6 +245,7 @@ export function Engine(options) {
240
245
  componentsIter: partialEngine.componentsIter,
241
246
  seal: partialEngine.seal,
242
247
  getEntityOrNullByName: partialEngine.getEntityOrNullByName,
248
+ getEntityByName: partialEngine.getEntityByName,
243
249
  update,
244
250
  RootEntity: 0,
245
251
  PlayerEntity: 1,
@@ -188,7 +188,14 @@ export interface IEngine {
188
188
  * Search for the entity that matches de label string defined in the editor.
189
189
  * @param value - Name value string
190
190
  */
191
- getEntityOrNullByName(label: string): Entity | null;
191
+ getEntityOrNullByName<T = string>(label: T): Entity | null;
192
+ /**
193
+ * @public
194
+ * Search for the entity that matches de label string defined in the editor.
195
+ * @param value - Name value string
196
+ * @typeParam T - The type of the entity name value
197
+ */
198
+ getEntityByName<T = never, K = T>(value: K & (T extends never ? never : string)): Entity;
192
199
  /**
193
200
  * @public
194
201
  * @param deltaTime - deltaTime in seconds
@@ -168,6 +168,10 @@ function preEngine(options) {
168
168
  }
169
169
  return null;
170
170
  }
171
+ function getEntityByName(value) {
172
+ const entity = getEntityOrNullByName(value);
173
+ return entity;
174
+ }
171
175
  function* getComponentDefGroup(...args) {
172
176
  const [firstComponentDef, ...componentDefinitions] = args;
173
177
  for (const [entity] of firstComponentDef.iterator()) {
@@ -215,6 +219,7 @@ function preEngine(options) {
215
219
  getComponent,
216
220
  getComponentOrNull: getComponentOrNull,
217
221
  getEntityOrNullByName,
222
+ getEntityByName,
218
223
  removeComponentDefinition,
219
224
  registerComponentDefinition,
220
225
  entityContainer,
@@ -269,6 +274,7 @@ function Engine(options) {
269
274
  componentsIter: partialEngine.componentsIter,
270
275
  seal: partialEngine.seal,
271
276
  getEntityOrNullByName: partialEngine.getEntityOrNullByName,
277
+ getEntityByName: partialEngine.getEntityByName,
272
278
  update,
273
279
  RootEntity: 0,
274
280
  PlayerEntity: 1,
@@ -188,7 +188,14 @@ export interface IEngine {
188
188
  * Search for the entity that matches de label string defined in the editor.
189
189
  * @param value - Name value string
190
190
  */
191
- getEntityOrNullByName(label: string): Entity | null;
191
+ getEntityOrNullByName<T = string>(label: T): Entity | null;
192
+ /**
193
+ * @public
194
+ * Search for the entity that matches de label string defined in the editor.
195
+ * @param value - Name value string
196
+ * @typeParam T - The type of the entity name value
197
+ */
198
+ getEntityByName<T = never, K = T>(value: K & (T extends never ? never : string)): Entity;
192
199
  /**
193
200
  * @public
194
201
  * @param deltaTime - deltaTime in seconds
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcl/ecs",
3
3
  "description": "Decentraland ECS",
4
- "version": "7.8.4",
4
+ "version": "7.8.5",
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": "27ceddb40a3f854050f2d70e9f469131b449e7d2"
36
+ "commit": "a5e11cbf36bbfb2a0f3f4e450e0f8ea843bb319e"
37
37
  }