mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 04:41:22 +00:00
bugfix: start troops were set at zero, username was not set in singleplayer
This commit is contained in:
@@ -11,6 +11,7 @@ import "./components/Difficulties";
|
||||
import { DifficultyDescription } from "./components/Difficulties";
|
||||
import "./components/Maps";
|
||||
import { JoinLobbyEvent } from "./Main";
|
||||
import { UsernameInput } from "./UsernameInput";
|
||||
|
||||
@customElement("single-player-modal")
|
||||
export class SinglePlayerModal extends LitElement {
|
||||
@@ -326,6 +327,13 @@ export class SinglePlayerModal extends LitElement {
|
||||
const clientID = generateID();
|
||||
const gameID = generateID();
|
||||
|
||||
const usernameInput = document.querySelector(
|
||||
"username-input",
|
||||
) as UsernameInput;
|
||||
if (!usernameInput) {
|
||||
consolex.warn("Username input element not found");
|
||||
}
|
||||
|
||||
this.dispatchEvent(
|
||||
new CustomEvent("join-lobby", {
|
||||
detail: {
|
||||
@@ -337,7 +345,7 @@ export class SinglePlayerModal extends LitElement {
|
||||
{
|
||||
playerID: generateID(),
|
||||
clientID,
|
||||
username: "PLACEHOLDER",
|
||||
username: usernameInput.getCurrentUsername(),
|
||||
},
|
||||
],
|
||||
config: {
|
||||
|
||||
@@ -107,7 +107,9 @@ export class GameImpl implements Game {
|
||||
|
||||
private addHumans() {
|
||||
if (this.config().gameConfig().gameMode != GameMode.Team) {
|
||||
this._humans.forEach((p) => this.addPlayer(p, 0));
|
||||
this._humans.forEach((p) =>
|
||||
this.addPlayer(p, this.config().startManpower(p)),
|
||||
);
|
||||
return;
|
||||
}
|
||||
const playerToTeam = assignTeams(this._humans);
|
||||
|
||||
Reference in New Issue
Block a user