easyPlace initial
This commit is contained in:
@@ -8,6 +8,9 @@ class StructureCollection {
|
||||
}
|
||||
|
||||
add(name) {
|
||||
if (this.#structures[name]) {
|
||||
throw new Error(`Structure ${name} already exists.`);
|
||||
}
|
||||
const structure = new Structure(name);
|
||||
this.#structures[name] = structure;
|
||||
return structure;
|
||||
@@ -26,6 +29,10 @@ class StructureCollection {
|
||||
struct.remove();
|
||||
delete this.#structures[name];
|
||||
}
|
||||
|
||||
getStructuresAtLocation(location) {
|
||||
return Object.values(this.#structures).filter(structure => structure.isLocationActive(structure.toStructureCoords(location)));
|
||||
}
|
||||
}
|
||||
|
||||
export const structureCollection = new StructureCollection();
|
||||
Reference in New Issue
Block a user