From 576bd3166fa0d900cb318ceabf3b90c1c2d85bc2 Mon Sep 17 00:00:00 2001 From: tobspr <> Date: Sat, 30 May 2020 19:11:18 +0200 Subject: [PATCH] Minor improvements --- src/js/changelog.js | 11 ++++++++ src/js/game/camera.js | 28 ++++++++++++--------- src/js/game/hud/hud.js | 4 ++- src/js/game/hud/parts/keybinding_overlay.js | 19 +++++++------- src/js/game/hud/parts/mass_selector.js | 2 +- src/js/game/hud/parts/waypoints.js | 6 +++-- src/js/game/key_action_mapper.js | 15 ++++++----- translations/base-en.yaml | 4 ++- 8 files changed, 57 insertions(+), 32 deletions(-) diff --git a/src/js/changelog.js b/src/js/changelog.js index 65f84f2e..af65730a 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -1,4 +1,15 @@ export const CHANGELOG = [ + { + version: "1.1.2", + date: "unreleased", + entries: [ + "Move default key for deleting from 'X' to 'DEL'", + "Show confirmation when deleting > 100 buildings", + "Reintroduce 'SPACE' keybinding to center on map", + "Improved keybinding hints", + "Fixed some keybindings showing as 'undefined'", + ], + }, { version: "1.1.1", date: "28.05.2020", diff --git a/src/js/game/camera.js b/src/js/game/camera.js index 930d6932..96bf5cd0 100644 --- a/src/js/game/camera.js +++ b/src/js/game/camera.js @@ -345,15 +345,19 @@ export class Camera extends BasicSerializableObject { */ bindKeys() { const mapper = this.root.keyMapper; - mapper - .getBinding(KEYMAPPINGS.ingame.mapMoveUp) - .add(() => console.log("move up") || (this.keyboardForce.y = -1)); - mapper.getBinding(KEYMAPPINGS.ingame.mapMoveDown).add(() => (this.keyboardForce.y = 1)); - mapper.getBinding(KEYMAPPINGS.ingame.mapMoveRight).add(() => (this.keyboardForce.x = 1)); - mapper.getBinding(KEYMAPPINGS.ingame.mapMoveLeft).add(() => (this.keyboardForce.x = -1)); + mapper.getBinding(KEYMAPPINGS.navigation.mapMoveUp).add(() => (this.keyboardForce.y = -1)); + mapper.getBinding(KEYMAPPINGS.navigation.mapMoveDown).add(() => (this.keyboardForce.y = 1)); + mapper.getBinding(KEYMAPPINGS.navigation.mapMoveRight).add(() => (this.keyboardForce.x = 1)); + mapper.getBinding(KEYMAPPINGS.navigation.mapMoveLeft).add(() => (this.keyboardForce.x = -1)); - mapper.getBinding(KEYMAPPINGS.ingame.mapZoomIn).add(() => (this.desiredZoom = this.zoomLevel * 1.2)); - mapper.getBinding(KEYMAPPINGS.ingame.mapZoomOut).add(() => (this.desiredZoom = this.zoomLevel * 0.8)); + mapper + .getBinding(KEYMAPPINGS.navigation.mapZoomIn) + .add(() => (this.desiredZoom = this.zoomLevel * 1.2)); + mapper + .getBinding(KEYMAPPINGS.navigation.mapZoomOut) + .add(() => (this.desiredZoom = this.zoomLevel * 0.8)); + + mapper.getBinding(KEYMAPPINGS.navigation.centerMap).add(() => this.centerOnMap()); } centerOnMap() { @@ -881,19 +885,19 @@ export class Camera extends BasicSerializableObject { let forceY = 0; const actionMapper = this.root.keyMapper; - if (actionMapper.getBinding(KEYMAPPINGS.ingame.mapMoveUp).isCurrentlyPressed()) { + if (actionMapper.getBinding(KEYMAPPINGS.navigation.mapMoveUp).isCurrentlyPressed()) { forceY -= 1; } - if (actionMapper.getBinding(KEYMAPPINGS.ingame.mapMoveDown).isCurrentlyPressed()) { + if (actionMapper.getBinding(KEYMAPPINGS.navigation.mapMoveDown).isCurrentlyPressed()) { forceY += 1; } - if (actionMapper.getBinding(KEYMAPPINGS.ingame.mapMoveLeft).isCurrentlyPressed()) { + if (actionMapper.getBinding(KEYMAPPINGS.navigation.mapMoveLeft).isCurrentlyPressed()) { forceX -= 1; } - if (actionMapper.getBinding(KEYMAPPINGS.ingame.mapMoveRight).isCurrentlyPressed()) { + if (actionMapper.getBinding(KEYMAPPINGS.navigation.mapMoveRight).isCurrentlyPressed()) { forceX += 1; } diff --git a/src/js/game/hud/hud.js b/src/js/game/hud/hud.js index 4b13b9f3..b2472a68 100644 --- a/src/js/game/hud/hud.js +++ b/src/js/game/hud/hud.js @@ -186,7 +186,9 @@ export class GameHUD { } /* dev:start */ - this.trailerMaker.update(); + if (this.trailerMaker) { + this.trailerMaker.update(); + } /* dev:end*/ } diff --git a/src/js/game/hud/parts/keybinding_overlay.js b/src/js/game/hud/parts/keybinding_overlay.js index fe93da4c..013eb5f7 100644 --- a/src/js/game/hud/parts/keybinding_overlay.js +++ b/src/js/game/hud/parts/keybinding_overlay.js @@ -24,24 +24,25 @@ export class HUDKeybindingOverlay extends BaseHUDPart { [], `
${getKeycode(KEYMAPPINGS.ingame.createMarker)}
+ ${getKeycode(KEYMAPPINGS.navigation.createMarker)}
- ${getKeycode(KEYMAPPINGS.ingame.mapMoveUp)}
- ${getKeycode(KEYMAPPINGS.ingame.mapMoveLeft)}
- ${getKeycode(KEYMAPPINGS.ingame.mapMoveDown)}
- ${getKeycode(KEYMAPPINGS.ingame.mapMoveRight)}
+ ${getKeycode(KEYMAPPINGS.navigation.mapMoveUp)}
+ ${getKeycode(KEYMAPPINGS.navigation.mapMoveLeft)}
+ ${getKeycode(KEYMAPPINGS.navigation.mapMoveDown)}
+ ${getKeycode(KEYMAPPINGS.navigation.mapMoveRight)}
- ${T.global.keys.control}
+
+ ${getKeycode(
+ KEYMAPPINGS.massSelect.massSelectStart
+ )}
+
-
+
⇧ ${getKeycode(
+ ${getKeycode(
KEYMAPPINGS.placementModifiers.placeMultiple
)}
diff --git a/src/js/game/hud/parts/mass_selector.js b/src/js/game/hud/parts/mass_selector.js
index 2d59fb84..f89d4055 100644
--- a/src/js/game/hud/parts/mass_selector.js
+++ b/src/js/game/hud/parts/mass_selector.js
@@ -79,7 +79,7 @@ export class HUDMassSelector extends BaseHUDPart {
}
confirmDelete() {
- if (this.selectedUids.size > 500) {
+ if (this.selectedUids.size > 100) {
const { ok } = this.root.hud.parts.dialogs.showWarning(
T.dialogs.massDeleteConfirm.title,
T.dialogs.massDeleteConfirm.desc.replace(
diff --git a/src/js/game/hud/parts/waypoints.js b/src/js/game/hud/parts/waypoints.js
index 746145b3..d981d33e 100644
--- a/src/js/game/hud/parts/waypoints.js
+++ b/src/js/game/hud/parts/waypoints.js
@@ -35,7 +35,7 @@ export class HUDWaypoints extends BaseHUDPart {
${T.ingame.waypoints.description.replace(
"",
`${this.root.keyMapper
- .getBinding(KEYMAPPINGS.ingame.createMarker)
+ .getBinding(KEYMAPPINGS.navigation.createMarker)
.getKeyCodeString()}
`
)}
`
@@ -121,7 +121,9 @@ export class HUDWaypoints extends BaseHUDPart {
this.domAttach = new DynamicDomAttach(this.root, this.hintElement);
}
- this.root.keyMapper.getBinding(KEYMAPPINGS.ingame.createMarker).add(this.requestCreateMarker, this);
+ this.root.keyMapper
+ .getBinding(KEYMAPPINGS.navigation.createMarker)
+ .add(this.requestCreateMarker, this);
this.currentMarkerOpacity = 1;
this.rerenderWaypointList();
diff --git a/src/js/game/key_action_mapper.js b/src/js/game/key_action_mapper.js
index 60690934..2ffbb03c 100644
--- a/src/js/game/key_action_mapper.js
+++ b/src/js/game/key_action_mapper.js
@@ -20,17 +20,20 @@ export const KEYMAPPINGS = {
},
ingame: {
- mapMoveUp: { keyCode: key("W") },
- mapMoveRight: { keyCode: key("D") },
- mapMoveDown: { keyCode: key("S") },
- mapMoveLeft: { keyCode: key("A") },
-
menuOpenShop: { keyCode: key("F") },
menuOpenStats: { keyCode: key("G") },
toggleHud: { keyCode: 113 }, // F2
toggleFPSInfo: { keyCode: 115 }, // F1
+ },
+ navigation: {
+ mapMoveUp: { keyCode: key("W") },
+ mapMoveRight: { keyCode: key("D") },
+ mapMoveDown: { keyCode: key("S") },
+ mapMoveLeft: { keyCode: key("A") },
+
+ centerMap: { keyCode: 32 }, // SPACE
mapZoomIn: { keyCode: 187, repeated: true }, // "+"
mapZoomOut: { keyCode: 189, repeated: true }, // "-"
@@ -62,7 +65,7 @@ export const KEYMAPPINGS = {
massSelectStart: { keyCode: 17 }, // CTRL
massSelectSelectMultiple: { keyCode: 16 }, // SHIFT
massSelectCopy: { keyCode: key("C") },
- confirmMassDelete: { keyCode: key("X") },
+ confirmMassDelete: { keyCode: 46 }, // DEL
},
placementModifiers: {
diff --git a/translations/base-en.yaml b/translations/base-en.yaml
index f424d9b1..9940b0b5 100644
--- a/translations/base-en.yaml
+++ b/translations/base-en.yaml
@@ -204,7 +204,7 @@ ingame:
# every situation
keybindingsOverlay:
moveMap: Move
- removeBuildings: Delete
+ selectBuildings: Select area
stopPlacement: Stop placement
rotateBuilding: Rotate building
placeMultiple: Place multiple
@@ -557,6 +557,7 @@ keybindings:
categoryLabels:
general: Application
ingame: Game
+ navigation: Navigating
placement: Placement
massSelect: Mass Select
buildings: Building Shortcuts
@@ -569,6 +570,7 @@ keybindings:
mapMoveRight: Move Right
mapMoveDown: Move Down
mapMoveLeft: Move Left
+ centerMap: Center Map
mapZoomIn: Zoom in
mapZoomOut: Zoom out