mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-03 10:40:48 +00:00
show alliance icon
This commit is contained in:
@@ -119,12 +119,15 @@ export class GameRunner {
|
||||
throw new Error(`player with id ${playerID} not found`);
|
||||
}
|
||||
|
||||
return {
|
||||
const rel = {
|
||||
relations: Object.fromEntries(
|
||||
player.allRelationsSorted()
|
||||
.map(({ player, relation }) => [player.smallID(), relation])
|
||||
)
|
||||
),
|
||||
alliances: player.alliances().map(a => a.other(player).smallID())
|
||||
};
|
||||
console.log(`got relations: ${JSON.stringify(rel)}`)
|
||||
return rel
|
||||
}
|
||||
|
||||
private canBoat(myPlayer: Player, tile: TileRef): boolean {
|
||||
|
||||
@@ -127,7 +127,7 @@ export class PlayerView implements Player {
|
||||
}
|
||||
|
||||
isAlliedWith(other: Player): boolean {
|
||||
return false
|
||||
return this.data.alliances.some(n => other.smallID() == n)
|
||||
}
|
||||
allianceWith(other: Player): Alliance | null {
|
||||
return null
|
||||
|
||||
@@ -30,8 +30,7 @@ export class DevConfig extends DefaultConfig {
|
||||
return info
|
||||
}
|
||||
|
||||
// tradeShipSpawnRate(): number {
|
||||
// return 10
|
||||
// tradeShipSpawnRate(): number { // return 10
|
||||
// }
|
||||
// boatMaxDistance(): number {
|
||||
// return 5000
|
||||
|
||||
@@ -370,7 +370,7 @@ export interface PlayerActions {
|
||||
|
||||
export interface PlayerProfile {
|
||||
relations: Record<number, Relation>
|
||||
// TODO: add alliances etc
|
||||
alliances: number[]
|
||||
}
|
||||
|
||||
export interface PlayerInteraction {
|
||||
@@ -428,6 +428,7 @@ export interface PlayerUpdate {
|
||||
workers: number,
|
||||
troops: number,
|
||||
targetTroopRatio: number
|
||||
alliances: number[]
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -75,7 +75,8 @@ export class PlayerImpl implements MutablePlayer {
|
||||
population: this.population(),
|
||||
workers: this.workers(),
|
||||
troops: this.troops(),
|
||||
targetTroopRatio: this.targetTroopRatio()
|
||||
targetTroopRatio: this.targetTroopRatio(),
|
||||
alliances: this.alliances().map(a => a.other(this).smallID())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user