mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 06:12:19 +00:00
7de962eb5b
## Description: Have the diplomacy view only draw border, not interior tiles. Drawing the interior tiles is a very expensive operation and caused main thread cpu usage to spike to close to 100%. Also change the color scheme so that neutral players are gray, and embargoed players are red. I think long term embargo should be more of a war state. Added embargo update and cleaned it up to use Player instead of PlayerID. There's no reason to pass ids around. <img width="493" height="466" alt="Screenshot 2025-08-07 at 6 25 55 PM" src="https://github.com/user-attachments/assets/75552036-42f1-4103-9537-234ff1c0464f" /> ## 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 - [x] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: evan
38 lines
848 B
TypeScript
38 lines
848 B
TypeScript
import { Execution, Game, Player, PlayerID } from "../game/Game";
|
|
|
|
export class EmbargoExecution implements Execution {
|
|
private active = true;
|
|
|
|
private target: Player;
|
|
|
|
constructor(
|
|
private player: Player,
|
|
private targetID: PlayerID,
|
|
private readonly action: "start" | "stop",
|
|
) {}
|
|
|
|
init(mg: Game, _: number): void {
|
|
if (!mg.hasPlayer(this.targetID)) {
|
|
console.warn(`EmbargoExecution recipient ${this.targetID} not found`);
|
|
this.active = false;
|
|
return;
|
|
}
|
|
this.target = mg.player(this.targetID);
|
|
}
|
|
|
|
tick(_: number): void {
|
|
if (this.action === "start") this.player.addEmbargo(this.target, false);
|
|
else this.player.stopEmbargo(this.target);
|
|
|
|
this.active = false;
|
|
}
|
|
|
|
isActive(): boolean {
|
|
return this.active;
|
|
}
|
|
|
|
activeDuringSpawnPhase(): boolean {
|
|
return false;
|
|
}
|
|
}
|