From 5a28974027566530c89cff607823df5ca3753cf6 Mon Sep 17 00:00:00 2001 From: PeekabooSteam Date: Sun, 1 Oct 2023 20:12:36 +0100 Subject: [PATCH] Added additive hotgroup select --- client/src/olympusapp.ts | 3 +++ client/src/unit/unitsmanager.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/src/olympusapp.ts b/client/src/olympusapp.ts index fb1bee90..25d6548a 100644 --- a/client/src/olympusapp.ts +++ b/client/src/olympusapp.ts @@ -278,11 +278,14 @@ export class OlympusApp { digits.forEach(code => { shortcutManager.addKeyboardShortcut(`hotgroup${code}`, { + "altKey": false, "callback": (ev: KeyboardEvent) => { if (ev.ctrlKey && ev.shiftKey) this.getUnitsManager().selectedUnitsAddToHotgroup(parseInt(ev.code.substring(5))); else if (ev.ctrlKey && !ev.shiftKey) this.getUnitsManager().selectedUnitsSetHotgroup(parseInt(ev.code.substring(5))); + else if (!ev.ctrlKey && ev.shiftKey) + this.getUnitsManager().selectUnitsByHotgroup(parseInt(ev.code.substring(5)), false); else this.getUnitsManager().selectUnitsByHotgroup(parseInt(ev.code.substring(5))); }, diff --git a/client/src/unit/unitsmanager.ts b/client/src/unit/unitsmanager.ts index 969f33b1..4a8383a2 100644 --- a/client/src/unit/unitsmanager.ts +++ b/client/src/unit/unitsmanager.ts @@ -201,8 +201,12 @@ export class UnitsManager { * * @param hotgroup The hotgroup number */ - selectUnitsByHotgroup(hotgroup: number) { - this.deselectAllUnits(); + selectUnitsByHotgroup(hotgroup: number, deselectAllUnits: boolean = true ) { + + if ( deselectAllUnits ) { + this.deselectAllUnits(); + } + this.getUnitsByHotgroup(hotgroup).forEach((unit: Unit) => unit.setSelected(true)) }