Merge main into strict

This commit is contained in:
Scott Anderson
2025-05-14 22:18:12 -04:00
22 changed files with 1715 additions and 178 deletions
+4
View File
@@ -2,6 +2,7 @@ import { LitElement, html } from "lit";
import { customElement, state } from "lit/decorators.js";
import "./LanguageModal";
import ar from "../../resources/lang/ar.json";
import bg from "../../resources/lang/bg.json";
import bn from "../../resources/lang/bn.json";
import de from "../../resources/lang/de.json";
@@ -17,6 +18,7 @@ import pl from "../../resources/lang/pl.json";
import pt_br from "../../resources/lang/pt_br.json";
import ru from "../../resources/lang/ru.json";
import sh from "../../resources/lang/sh.json";
import tp from "../../resources/lang/tp.json";
import tr from "../../resources/lang/tr.json";
import uk from "../../resources/lang/uk.json";
@@ -32,6 +34,7 @@ export class LangSelector extends LitElement {
private dKeyPressed: boolean = false;
private languageMap: Record<string, any> = {
ar,
bg,
bn,
de,
@@ -48,6 +51,7 @@ export class LangSelector extends LitElement {
ru,
sh,
tr,
tp,
uk,
};
+31 -1
View File
@@ -21,6 +21,7 @@ import {
EmojiUpdate,
GameUpdateType,
TargetPlayerUpdate,
UnitIncomingUpdate,
} from "../../../core/game/GameUpdates";
import { ClientID } from "../../../core/Schemas";
import {
@@ -53,6 +54,7 @@ interface Event {
priority?: number;
duration?: Tick;
focusID?: number;
unitView?: UnitView;
}
@customElement("events-display")
@@ -89,6 +91,7 @@ export class EventsDisplay extends LitElement implements Layer {
[GameUpdateType.BrokeAlliance, (u) => this.onBrokeAllianceEvent(u)],
[GameUpdateType.TargetPlayer, (u) => this.onTargetPlayerEvent(u)],
[GameUpdateType.Emoji, (u) => this.onEmojiMessageEvent(u)],
[GameUpdateType.UnitIncoming, (u) => this.onUnitIncomingEvent(u)],
]);
constructor() {
@@ -424,6 +427,25 @@ export class EventsDisplay extends LitElement implements Layer {
}
}
onUnitIncomingEvent(event: UnitIncomingUpdate) {
const myPlayer = this.game.playerByClientID(this.clientID);
if (!myPlayer || myPlayer.smallID() !== event.playerID) {
return;
}
const unitView = this.game.unit(event.unitID);
this.addEvent({
description: event.message,
type: event.messageType,
unsafeDescription: false,
highlight: true,
createdAt: this.game.ticks(),
unitView: unitView,
});
}
private getMessageTypeClasses(type: MessageType): string {
switch (type) {
case MessageType.SUCCESS:
@@ -651,7 +673,15 @@ export class EventsDisplay extends LitElement implements Layer {
>
${this.getEventDescription(event)}
</button>`
: this.getEventDescription(event)}
: event.unitView
? html`<button
@click=${() => {
this.emitGoToUnitEvent(event.unitView);
}}
>
${this.getEventDescription(event)}
</button>`
: this.getEventDescription(event)}
${event.buttons
? html`
<div class="flex flex-wrap gap-1.5 mt-1">