mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 14:50:44 +00:00
bugfix: flags not showing in game
This commit is contained in:
@@ -11,11 +11,7 @@ import {
|
||||
ServerStartGameMessageSchema,
|
||||
Turn,
|
||||
} from "../core/Schemas";
|
||||
import {
|
||||
createGameRecord,
|
||||
decompressGameRecord,
|
||||
generateID,
|
||||
} from "../core/Util";
|
||||
import { createGameRecord, decompressGameRecord } from "../core/Util";
|
||||
import { LobbyConfig } from "./ClientGameRunner";
|
||||
import { getPersistentIDFromCookie } from "./Main";
|
||||
|
||||
@@ -56,14 +52,6 @@ export class LocalServer {
|
||||
gameID: this.lobbyConfig.gameStartInfo.gameID,
|
||||
gameStartInfo: this.lobbyConfig.gameStartInfo,
|
||||
turns: this.turns,
|
||||
players: [
|
||||
{
|
||||
flag: this.lobbyConfig.flag,
|
||||
playerID: generateID(),
|
||||
clientID: this.lobbyConfig.clientID,
|
||||
username: this.lobbyConfig.playerName,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import "./components/baseComponents/Modal";
|
||||
import "./components/Difficulties";
|
||||
import { DifficultyDescription } from "./components/Difficulties";
|
||||
import "./components/Maps";
|
||||
import { FlagInput } from "./FlagInput";
|
||||
import { JoinLobbyEvent } from "./Main";
|
||||
import { UsernameInput } from "./UsernameInput";
|
||||
|
||||
@@ -334,6 +335,10 @@ export class SinglePlayerModal extends LitElement {
|
||||
consolex.warn("Username input element not found");
|
||||
}
|
||||
|
||||
const flagInput = document.querySelector("flag-input") as FlagInput;
|
||||
if (!flagInput) {
|
||||
consolex.warn("Flag input element not found");
|
||||
}
|
||||
this.dispatchEvent(
|
||||
new CustomEvent("join-lobby", {
|
||||
detail: {
|
||||
@@ -346,6 +351,10 @@ export class SinglePlayerModal extends LitElement {
|
||||
playerID: generateID(),
|
||||
clientID,
|
||||
username: usernameInput.getCurrentUsername(),
|
||||
flag:
|
||||
flagInput.getCurrentFlag() == "xx"
|
||||
? ""
|
||||
: flagInput.getCurrentFlag(),
|
||||
},
|
||||
],
|
||||
config: {
|
||||
|
||||
@@ -337,6 +337,7 @@ export class Transport {
|
||||
lastTurn: numTurns,
|
||||
persistentID: this.lobbyConfig.persistentID,
|
||||
username: this.lobbyConfig.playerName,
|
||||
flag: this.lobbyConfig.flag,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -58,7 +58,6 @@ export class TerrainLayer implements Layer {
|
||||
}
|
||||
|
||||
renderLayer(context: CanvasRenderingContext2D) {
|
||||
console.log(this.transformHandler.scale);
|
||||
if (this.transformHandler.scale < 1) {
|
||||
context.imageSmoothingEnabled = true;
|
||||
context.imageSmoothingQuality = "low";
|
||||
|
||||
@@ -396,6 +396,7 @@ export const ClientJoinMessageSchema = ClientBaseMessageSchema.extend({
|
||||
type: z.literal("join"),
|
||||
lastTurn: z.number(), // The last turn the client saw.
|
||||
username: SafeString,
|
||||
flag: SafeString.nullable().optional(),
|
||||
});
|
||||
|
||||
export const ClientMessageSchema = z.union([
|
||||
|
||||
@@ -16,5 +16,6 @@ export class Client {
|
||||
public readonly ip: string,
|
||||
public readonly username: string,
|
||||
public readonly ws: WebSocket,
|
||||
public readonly flag: string | null,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -267,6 +267,7 @@ export class GameServer {
|
||||
playerID: c.playerID,
|
||||
username: c.username,
|
||||
clientID: c.clientID,
|
||||
flag: c.flag,
|
||||
})),
|
||||
});
|
||||
|
||||
|
||||
@@ -303,6 +303,7 @@ export function startWorker() {
|
||||
ip,
|
||||
clientMsg.username,
|
||||
ws,
|
||||
clientMsg.flag,
|
||||
);
|
||||
|
||||
const wasFound = gm.addClient(
|
||||
|
||||
Reference in New Issue
Block a user