From ac44c208a8b202a0ab3448430567194d0da1ad36 Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Wed, 29 Mar 2023 08:59:32 +0200 Subject: [PATCH 1/2] Maximum paste rate set to once every 250ms --- client/src/units/unitsmanager.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/src/units/unitsmanager.ts b/client/src/units/unitsmanager.ts index e06dd39f..9b4449df 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,16 @@ export class UnitsManager { pasteUnits() { - for (let idx in this.#copiedUnits) + if (!this.#pasteDisabled) { - var unit = this.#copiedUnits[idx]; - cloneUnit(unit.ID, getMap().getMouseCoordinates()); + console.log("paste") + for (let idx in this.#copiedUnits) + { + var unit = this.#copiedUnits[idx]; + cloneUnit(unit.ID, getMap().getMouseCoordinates()); + } + this.#pasteDisabled = true; + setTimeout(() => this.#pasteDisabled = false, 250); } } From 73a539bf9439a6bed76d62ec70b7452dd1248787 Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Wed, 29 Mar 2023 09:00:04 +0200 Subject: [PATCH 2/2] Removed log --- client/src/units/unitsmanager.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/units/unitsmanager.ts b/client/src/units/unitsmanager.ts index 9b4449df..cfbee371 100644 --- a/client/src/units/unitsmanager.ts +++ b/client/src/units/unitsmanager.ts @@ -333,7 +333,6 @@ export class UnitsManager { { if (!this.#pasteDisabled) { - console.log("paste") for (let idx in this.#copiedUnits) { var unit = this.#copiedUnits[idx];