mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-02 05:48:06 +00:00
alliance renewal: fix request to renew when ally is dead, fix translation keys (#1359)
## Description: The EventsDisplay now checks if your ally is alive before sending a "request to renew" event. Also fixed so incorrect translation keys. ## 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 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: evan
This commit is contained in:
@@ -241,7 +241,7 @@ export class EventsDisplay extends LitElement implements Layer {
|
||||
|
||||
private checkForAllianceExpirations() {
|
||||
const myPlayer = this.game.myPlayer();
|
||||
if (!myPlayer) return;
|
||||
if (!myPlayer?.isAlive()) return;
|
||||
|
||||
for (const alliance of myPlayer.alliances()) {
|
||||
if (
|
||||
@@ -262,6 +262,7 @@ export class EventsDisplay extends LitElement implements Layer {
|
||||
this.alliancesCheckedAt.set(alliance.id, this.game.ticks());
|
||||
|
||||
const other = this.game.player(alliance.other) as PlayerView;
|
||||
if (!other.isAlive()) continue;
|
||||
|
||||
this.addEvent({
|
||||
description: translateText("events_display.about_to_expire", {
|
||||
|
||||
@@ -20,6 +20,14 @@ export class AllianceExtensionExecution implements Execution {
|
||||
return;
|
||||
}
|
||||
const to = mg.player(this.toID);
|
||||
|
||||
if (!this.from.isAlive() || !to.isAlive()) {
|
||||
console.info(
|
||||
`[AllianceExtensionExecution] Player ${this.from.id()} or ${this.toID} is not alive`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const alliance = this.from.allianceWith(to);
|
||||
if (!alliance) {
|
||||
console.warn(
|
||||
@@ -35,12 +43,12 @@ export class AllianceExtensionExecution implements Execution {
|
||||
alliance.extend();
|
||||
|
||||
mg.displayMessage(
|
||||
"alliance.renewed",
|
||||
"events_display.alliance_renewed",
|
||||
MessageType.ALLIANCE_ACCEPTED,
|
||||
this.from.id(),
|
||||
);
|
||||
mg.displayMessage(
|
||||
"alliance.renewed",
|
||||
"events_display.alliance_renewed",
|
||||
MessageType.ALLIANCE_ACCEPTED,
|
||||
this.toID,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user