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
This commit is contained in:
VariableVince
2026-02-21 05:58:14 +01:00
committed by GitHub
parent b865e0af8f
commit 444aa16ac8
+7 -7
View File
@@ -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) {