mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-25 18:50:56 +02:00
30 lines
651 B
TypeScript
30 lines
651 B
TypeScript
import { ActiveFragment } from "./ActiveFragment";
|
|
|
|
export class BaseGift {
|
|
fragments: ActiveFragment[];
|
|
_width?: number;
|
|
_height?: number;
|
|
|
|
constructor(width?: number, height?: number, fragments: ActiveFragment[] = []) {
|
|
this.fragments = fragments;
|
|
this._width = width;
|
|
this._height = height;
|
|
}
|
|
|
|
width(): number {
|
|
return this._width || 4;
|
|
}
|
|
height(): number {
|
|
return this._height || 4;
|
|
}
|
|
fragmentAt(worldX: number, worldY: number): ActiveFragment | undefined {
|
|
for (const aFrag of this.fragments) {
|
|
if (aFrag.fullAt(worldX, worldY)) {
|
|
return aFrag;
|
|
}
|
|
}
|
|
|
|
return undefined;
|
|
}
|
|
}
|