diff --git a/README.md b/README.md index e4bd2aa27..f2081d255 100644 --- a/README.md +++ b/README.md @@ -97,10 +97,16 @@ npm run start:server-dev ``` - **Lint and fix code**: + ```bash npm run lint:fix ``` +- **Testing** + ```bash + npm test + ``` + ## 🏗️ Project Structure - `/src/client` - Frontend game client diff --git a/resources/lang/en.json b/resources/lang/en.json index d65dd52c0..58cf977c3 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -252,6 +252,11 @@ "view_options": "View Options", "toggle_view": "Toggle View", "toggle_view_desc": "Alternate view (terrain/countries)", + "attack_ratio_controls": "Attack Ratio Controls", + "attack_ratio_up": "Increase Attack Ratio", + "attack_ratio_up_desc": "Increase attack ratio by 10%", + "attack_ratio_down": "Decrease Attack Ratio", + "attack_ratio_down_desc": "Decrease attack ratio by 10%", "zoom_controls": "Zoom Controls", "zoom_out": "Zoom Out", "zoom_out_desc": "Zoom out the map", diff --git a/src/client/InputHandler.ts b/src/client/InputHandler.ts index aa6a225b6..47f57ae7a 100644 --- a/src/client/InputHandler.ts +++ b/src/client/InputHandler.ts @@ -122,6 +122,8 @@ export class InputHandler { moveRight: "KeyD", zoomOut: "KeyQ", zoomIn: "KeyE", + attackRatioDown: "Digit1", + attackRatioUp: "Digit2", ...JSON.parse(localStorage.getItem("settings.keybinds") ?? "{}"), }; this.canvas.addEventListener("pointerdown", (e) => this.onPointerDown(e)); @@ -218,8 +220,8 @@ export class InputHandler { "ArrowRight", "Minus", "Equal", - "Digit1", - "Digit2", + keybinds.attackRatioDown, + keybinds.attackRatioUp, keybinds.centerCamera, "ControlLeft", "ControlRight", @@ -240,12 +242,12 @@ export class InputHandler { this.eventBus.emit(new RefreshGraphicsEvent()); } - if (e.code === "Digit1") { + if (e.code === keybinds.attackRatioDown) { e.preventDefault(); this.eventBus.emit(new AttackRatioEvent(-10)); } - if (e.code === "Digit2") { + if (e.code === keybinds.attackRatioUp) { e.preventDefault(); this.eventBus.emit(new AttackRatioEvent(10)); } diff --git a/src/client/UserSettingModal.ts b/src/client/UserSettingModal.ts index cfd9d21c1..405e24145 100644 --- a/src/client/UserSettingModal.ts +++ b/src/client/UserSettingModal.ts @@ -345,6 +345,28 @@ export class UserSettingModal extends LitElement { @change=${this.handleKeybindChange} > +