diff --git a/client/src/units/unitsmanager.ts b/client/src/units/unitsmanager.ts index e06dd39f..cfbee371 100644 --- a/client/src/units/unitsmanager.ts +++ b/client/src/units/unitsmanager.ts @@ -8,6 +8,7 @@ export class UnitsManager { #units: { [ID: number]: Unit }; #copiedUnits: Unit[]; #selectionEventDisabled: boolean = false; + #pasteDisabled: boolean = false; constructor() { this.#units = {}; @@ -330,10 +331,15 @@ export class UnitsManager { pasteUnits() { - for (let idx in this.#copiedUnits) + if (!this.#pasteDisabled) { - var unit = this.#copiedUnits[idx]; - cloneUnit(unit.ID, getMap().getMouseCoordinates()); + for (let idx in this.#copiedUnits) + { + var unit = this.#copiedUnits[idx]; + cloneUnit(unit.ID, getMap().getMouseCoordinates()); + } + this.#pasteDisabled = true; + setTimeout(() => this.#pasteDisabled = false, 250); } }