bard-legends-framework 0.9.7 → 0.10.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.
@@ -1,7 +1,10 @@
1
1
  import { Attachable } from '../base/attachable';
2
2
  export type EntityClassType = new (...args: any[]) => Entity;
3
+ /**
4
+ * @param destroyOnSceneClose - Default: true. If true, the entity will be destroyed when the scene is closed.
5
+ */
3
6
  export interface EntityDecoratorMeta {
4
- global: boolean;
7
+ destroyOnSceneClose: boolean;
5
8
  }
6
9
  export declare function EntityDecorator(meta?: EntityDecoratorMeta): (EntityClass: EntityClassType) => any;
7
10
  export declare abstract class Entity extends Attachable {
@@ -9,7 +9,7 @@ function EntityDecorator(meta) {
9
9
  return function (EntityClass) {
10
10
  EntityClass.$meta = {
11
11
  type: 'entity',
12
- global: meta?.global ?? false
12
+ destroyOnSceneClose: meta?.destroyOnSceneClose ?? true
13
13
  };
14
14
  entity_store_helper_1.EntityStoreHelper.registerEntityClass(EntityClass);
15
15
  };
@@ -34,8 +34,8 @@ class Entity extends attachable_1.Attachable {
34
34
  constructor() {
35
35
  super();
36
36
  this.viewCreationHelper = new entity_views_helper_1.EntityViewsHelper(this);
37
- let globalEntity = this.constructor.$meta.global;
38
- if (!globalEntity) {
37
+ let destroyOnSceneClose = this.constructor.$meta.destroyOnSceneClose;
38
+ if (destroyOnSceneClose) {
39
39
  scene_1.Scene['registerEntity'](this);
40
40
  }
41
41
  entity_store_helper_1.EntityStoreHelper.registerEntity(this);
@@ -43,8 +43,8 @@ class Entity extends attachable_1.Attachable {
43
43
  destroySelf() {
44
44
  super.destroySelf();
45
45
  this.viewCreationHelper.destroyViews();
46
- let globalEntity = this.constructor.$meta.global;
47
- if (!globalEntity) {
46
+ let destroyOnSceneClose = this.constructor.$meta.destroyOnSceneClose;
47
+ if (destroyOnSceneClose) {
48
48
  scene_1.Scene['unregisterEntity'](this);
49
49
  }
50
50
  entity_store_helper_1.EntityStoreHelper.unregisterEntity(this.constructor.name, this.id);
@@ -21,6 +21,6 @@ let CameraEntity = class CameraEntity extends game_entities_1.SingletonEntity {
21
21
  };
22
22
  exports.CameraEntity = CameraEntity;
23
23
  exports.CameraEntity = CameraEntity = __decorate([
24
- (0, game_entities_1.EntityDecorator)({ global: true })
24
+ (0, game_entities_1.EntityDecorator)({ destroyOnSceneClose: false })
25
25
  ], CameraEntity);
26
26
  //# sourceMappingURL=camera.entity.js.map
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "bard-legends-framework",
3
- "version": "0.9.7",
3
+ "version": "0.10.0",
4
4
  "description": "Bard Legends Framework",
5
5
  "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
6
  "files": [
8
7
  "dist/**/*.js",
9
8
  "dist/**/*.d.ts"
10
9
  ],
11
10
  "publishConfig": {
12
- "main": "dist/index.js"
11
+ "main": "dist/index.js",
12
+ "types": "dist/index.d.ts"
13
13
  },
14
14
  "repository": {
15
15
  "type": "git",
@@ -55,5 +55,6 @@
55
55
  "tslib": "2.6.2",
56
56
  "typescript": "5.3.3",
57
57
  "vitest": "1.6.0"
58
- }
58
+ },
59
+ "types": "dist/index.d.ts"
59
60
  }