feat: LazyEntityUpdater
This commit is contained in:
@@ -3,20 +3,20 @@ import type { General } from "./General.js";
|
||||
import type { IResourceController } from "./ResourceController.js";
|
||||
import type { ITroopEntity } from "./TroopEntity.js";
|
||||
import type { GeneralID } from "./defs.js";
|
||||
import { LazyEntityUpdater } from "./LazyEntityUpdater.js";
|
||||
|
||||
export class Troop {
|
||||
private _raw: ITroopEntity
|
||||
export class Troop extends LazyEntityUpdater<ITroopEntity> {
|
||||
protected readonly _indirectNames: (keyof ITroopEntity)[] = ["id"];
|
||||
protected readonly _entityType = "Troop";
|
||||
protected readonly _raw: ITroopEntity;
|
||||
private _leader: WeakRef<General>;
|
||||
private _members: Map<GeneralID, WeakRef<General>>;
|
||||
|
||||
public get raw(): Readonly<ITroopEntity> {
|
||||
return this._raw;
|
||||
}
|
||||
|
||||
constructor(
|
||||
raw: ITroopEntity,
|
||||
private resourceController: IResourceController
|
||||
protected resourceController: IResourceController
|
||||
){
|
||||
super();
|
||||
this._raw = raw;
|
||||
|
||||
const members = resourceController.findGeneralByTroop(raw.id);
|
||||
|
||||
Reference in New Issue
Block a user