From 444aa16ac8ecd590a3242a6a3f36a4fe342cc731 Mon Sep 17 00:00:00 2001 From: VariableVince <24507472+VariableVince@users.noreply.github.com> Date: Sat, 21 Feb 2026 05:58:14 +0100 Subject: [PATCH] Fix: less console warn spam on each attack-click (#3262) ## Description: Rabbit suggestion to move console warn for not being able to send boat to doBoatAttackUnderCursor and remove it from canBoatAttack. On each attack-click on land, if that land is own land or ally and canAttack is false, it will check canAutoBoat. Even if user had no intention to attack, there would be a warning that no boat could be send. Now only do that warning when user actually intended to send a boat using hotkey G which calls doBoatAttackUnderCursor. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: tryout33 --- src/client/ClientGameRunner.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/client/ClientGameRunner.ts b/src/client/ClientGameRunner.ts index fb01edb34..829053201 100644 --- a/src/client/ClientGameRunner.ts +++ b/src/client/ClientGameRunner.ts @@ -654,9 +654,13 @@ export class ClientGameRunner { } this.myPlayer.actions(tile).then((actions) => { - if (this.canBoatAttack(actions) !== false) { - this.sendBoatAttackIntent(tile); + if (this.canBoatAttack(actions) === false) { + console.warn( + "Boat attack triggered but can't send Transport Ship to tile", + ); + return; } + this.sendBoatAttackIntent(tile); }); } @@ -705,11 +709,7 @@ export class ClientGameRunner { const bu = actions.buildableUnits.find( (bu) => bu.type === UnitType.TransportShip, ); - if (bu === undefined) { - console.warn(`no transport ship buildable units`); - return false; - } - return bu.canBuild; + return bu?.canBuild ?? false; } private sendBoatAttackIntent(tile: TileRef) {