Added command hash control

This commit is contained in:
Pax1601
2023-09-05 17:25:32 +02:00
parent cbb878cf96
commit a96a6eb57d
3 changed files with 28 additions and 15 deletions

View File

@@ -429,6 +429,7 @@ export class Map extends L.Map {
var marker = new TemporaryUnitMarker(latlng, name, coalition, commandHash);
marker.addTo(this);
this.#temporaryMarkers.push(marker);
return marker;
}
getSelectedCoalitionArea() {

View File

@@ -17,18 +17,22 @@ export class TemporaryUnitMarker extends CustomMarker {
this.#coalition = coalition;
this.#commandHash = commandHash;
if (this.#commandHash !== undefined) {
this.#timer = window.setInterval(() => {
if (this.#commandHash !== undefined) {
isCommandExecuted((res: any) => {
if (res.commandExecuted) {
this.removeFrom(getMap());
window.clearInterval(this.#timer);
}
}, this.#commandHash)
}
}, 1000);
}
if (commandHash !== undefined)
this.setCommandHash(commandHash)
}
setCommandHash(commandHash: string) {
this.#commandHash = commandHash;
this.#timer = window.setInterval(() => {
if (this.#commandHash !== undefined) {
isCommandExecuted((res: any) => {
if (res.commandExecuted) {
this.removeFrom(getMap());
window.clearInterval(this.#timer);
}
}, this.#commandHash)
}
}, 1000);
}
createIcon() {