Skip to content
2 changes: 2 additions & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"disable_nations": "Disable Nations",
"instant_build": "Instant Build",
"instant_research": "Instant Research",
"research_all_techs": "Research All Techs",
"infinite_gold": "Infinite Gold",
"infinite_troops": "Infinite Troops",
"disable_nukes": "Disable Nukes",
Expand Down Expand Up @@ -209,6 +210,7 @@
"disable_nations": "Disable Nations",
"instant_build": "Instant Build",
"instant_research": "Instant Research",
"research_all_techs": "Research All Techs",
"infinite_gold": "Infinite Gold",
"infinite_troops": "Infinite Troops",
"peace_timer": "Protected Start",
Expand Down
26 changes: 26 additions & 0 deletions src/client/HostLobbyModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class HostLobbyModal extends LitElement {
@state() private infiniteTroops: boolean = false;
@state() private instantBuild: boolean = false;
@state() private instantResearchHumanOnly: boolean = false;
@state() private researchAllTechs: boolean = false;
@state() private lobbyId = "";
@state() private copySuccess = false;
@state() private clients: ClientInfo[] = [];
Expand Down Expand Up @@ -377,6 +378,27 @@ export class HostLobbyModal extends LitElement {
</div>
</label>

<label
for="research-all-techs"
class="option-card ${this.researchAllTechs ? "selected" : ""}"
>
<div class="checkbox-icon"></div>
<input
type="checkbox"
id="research-all-techs"
@change=${(e: Event) => {
this.researchAllTechs = Boolean(
(e.target as HTMLInputElement).checked,
);
this.putGameConfig();
}}
.checked=${this.researchAllTechs}
/>
<div class="option-card-title">
${translateText("host_modal.research_all_techs")}
</div>
</label>

<label
for="infinite-gold"
class="option-card ${this.infiniteGold ? "selected" : ""}"
Expand Down Expand Up @@ -942,6 +964,7 @@ export class HostLobbyModal extends LitElement {
infiniteTroops: this.infiniteTroops,
instantBuild: this.instantBuild,
instantResearchHumanOnly: this.instantResearchHumanOnly,
researchAllTechs: this.researchAllTechs,
gameMode: this.gameMode,
disabledUnits: this.disabledUnits,
playerTeams: this.teamCount,
Expand Down Expand Up @@ -1074,6 +1097,9 @@ export class HostLobbyModal extends LitElement {
if (data.gameConfig?.startingGold !== undefined) {
this.startingGold = data.gameConfig.startingGold;
}
if (data.gameConfig?.researchAllTechs !== undefined) {
this.researchAllTechs = Boolean(data.gameConfig.researchAllTechs);
}
});
}

Expand Down
21 changes: 21 additions & 0 deletions src/client/SinglePlayerModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class SinglePlayerModal extends LitElement {
@state() private infiniteTroops: boolean = false;
@state() private instantBuild: boolean = false;
@state() private instantResearchHumanOnly: boolean = false;
@state() private researchAllTechs: boolean = false;
@state() private useRandomMap: boolean = false;
@state() private gameMode: GameMode = GameMode.FFA;
@state() private teamCount: TeamCountConfig = 2;
Expand Down Expand Up @@ -280,6 +281,25 @@ export class SinglePlayerModal extends LitElement {
</div>
</label>

<label
for="singleplayer-modal-research-all-techs"
class="option-card ${this.researchAllTechs ? "selected" : ""}"
>
<div class="checkbox-icon"></div>
<input
type="checkbox"
id="singleplayer-modal-research-all-techs"
@change=${(e: Event) =>
(this.researchAllTechs = Boolean(
(e.target as HTMLInputElement).checked,
))}
.checked=${this.researchAllTechs}
/>
<div class="option-card-title">
${translateText("single_modal.research_all_techs")}
</div>
</label>

<label
for="singleplayer-modal-infinite-gold"
class="option-card ${this.infiniteGold ? "selected" : ""}"
Expand Down Expand Up @@ -531,6 +551,7 @@ export class SinglePlayerModal extends LitElement {
infiniteTroops: this.infiniteTroops,
instantBuild: this.instantBuild,
instantResearchHumanOnly: this.instantResearchHumanOnly,
researchAllTechs: this.researchAllTechs,
disabledUnits: this.disabledUnits
.map((u) => Object.values(UnitType).find((ut) => ut === u))
.filter((ut): ut is UnitType => ut !== undefined),
Expand Down
7 changes: 7 additions & 0 deletions src/client/graphics/GameRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ export function createRenderer(
game: GameView,
eventBus: EventBus,
): GameRenderer {
// Remove persisted settings modals from previous games so they reset to default levels
document.querySelector("build-settings-modal")?.remove();
document.querySelector("unit-upgrade-settings-modal")?.remove();
// Clear persisted levels so they reset to 1 for the new game
localStorage.removeItem("buildSettings.levels");
localStorage.removeItem("unitUpgradeSettings.levels");

const transformHandler = new TransformHandler(game, eventBus, canvas);

// Prevent main menu/page scrolling during gameplay
Expand Down
10 changes: 10 additions & 0 deletions src/client/graphics/layers/UILayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,16 @@ export class UILayer implements Layer {
if (typeof maxHealth === "number") {
maxHealth = maxHealth + (lvl - 1) * 1000;
}
} else if (unit.type() === UnitType.FighterJet) {
// Fighter Jet: per-level max health from config
const lvl = unit.level ? unit.level() : 1;
maxHealth = this.game.config().fighterJetLevelMaxHealth(lvl);
} else if (unit.type() === UnitType.Warship) {
const lvl = unit.level ? unit.level() : 1;
maxHealth = this.game.config().warshipLevelMaxHealth(lvl);
} else if (unit.type() === UnitType.Submarine) {
const lvl = unit.level ? unit.level() : 1;
maxHealth = this.game.config().submarineLevelMaxHealth(lvl);
}
if (maxHealth === undefined || this.context === null) {
return;
Expand Down
Loading
Loading