radar4mob
Version:
Detects and emits an event when the position of an mob with coordinates changes.
25 lines (24 loc) • 682 B
TypeScript
import TypedEmitter from 'typed-emitter';
import { Area } from './Area';
import { Position } from './Position';
type MobEvent = {
'in': (mob: Mob) => void;
'out': (mob: Mob) => void;
};
export declare class Mob {
readonly id: string;
readonly position: Position;
readonly emitter: TypedEmitter<MobEvent>;
readonly neighbors: Set<Mob>;
private __thresholdRadius;
protected readonly area: Area;
constructor(id: string, thresholdRadius: number, area: Area);
get thresholdRadius(): number;
set thresholdRadius(v: number);
private __setDirty;
/**
* It is same as `area.removeMob(mob.id)`
*/
destroy(): void;
}
export {};