Multi src astar (#594)

## Description:
Samples border shore tiles and uses multi-a* for determining the
transport ship spawn cell.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

<DISCORD USERNAME>
evan

---------

Co-authored-by: evan <openfrontio@gmail.com>
This commit is contained in:
evanpelle
2025-04-23 10:16:43 -07:00
committed by GitHub
parent b2c3a8add6
commit 84287b8dfa
14 changed files with 167 additions and 126 deletions
+20 -8
View File
@@ -11,7 +11,7 @@ import {
import { createGameRecord } from "../core/Util";
import { ServerConfig } from "../core/configuration/Config";
import { getConfig } from "../core/configuration/ConfigLoader";
import { Team, UnitType } from "../core/game/Game";
import { Cell, Team, UnitType } from "../core/game/Game";
import { TileRef } from "../core/game/GameMap";
import {
ErrorUpdate,
@@ -372,13 +372,25 @@ export class ClientGameRunner {
this.shouldBoat(tile, bu.canBuild) &&
this.gameView.isLand(tile)
) {
this.eventBus.emit(
new SendBoatAttackIntentEvent(
this.gameView.owner(tile).id(),
cell,
this.myPlayer.troops() * this.renderer.uiState.attackRatio,
),
);
this.myPlayer
.bestTransportShipSpawn(this.gameView.ref(cell.x, cell.y))
.then((spawn: number | false) => {
let spawnCell = null;
if (spawn !== false) {
spawnCell = new Cell(
this.gameView.x(spawn),
this.gameView.y(spawn),
);
}
this.eventBus.emit(
new SendBoatAttackIntentEvent(
this.gameView.owner(tile).id(),
cell,
this.myPlayer.troops() * this.renderer.uiState.attackRatio,
spawnCell,
),
);
});
}
const owner = this.gameView.owner(tile);
+4 -3
View File
@@ -387,8 +387,9 @@ export class RadialMenu implements Layer {
// BestTransportShipSpawn is an expensive operation, so
// we calculate it here and send the spawn tile to other clients.
myPlayer.bestTransportShipSpawn(tile).then((spawn) => {
if (spawn == false) {
return;
let spawnTile: Cell | null = null;
if (spawn !== false) {
spawnTile = new Cell(this.g.x(spawn), this.g.y(spawn));
}
this.eventBus.emit(
@@ -396,7 +397,7 @@ export class RadialMenu implements Layer {
this.g.owner(tile).id(),
this.clickedCell,
this.uiState.attackRatio * myPlayer.troops(),
new Cell(this.g.x(spawn), this.g.y(spawn)),
spawnTile,
),
);
});