Merge branch 'v26'

This commit is contained in:
evanpelle
2025-10-14 20:24:15 -07:00
10 changed files with 32 additions and 9 deletions
+1 -1
View File
@@ -500,7 +500,7 @@
},
"win_modal": {
"support_openfront": "Support OpenFront!",
"territory_pattern": "Purchase a territory pattern to support OpenFront!",
"territory_pattern": "Purchase a territory skin to go ad-free!",
"died": "You died",
"your_team": "Your team won!",
"other_team": "{team} team has won!",
+1
View File
@@ -49,6 +49,7 @@ export class GutterAds extends LitElement {
}
public hide(): void {
this.isVisible = false;
console.log("hiding GutterAds");
this.destroyAds();
this.requestUpdate();
+7
View File
@@ -350,6 +350,13 @@ class Client {
"Sharing this ID will allow others to view your game history and stats.",
);
this.patternsModal.onUserMe(userMeResponse);
const flares = (userMeResponse.player.flares ?? []).filter((flare) =>
flare.startsWith("pattern:"),
);
if (flares.length > 0) {
console.log("Hiding gutter ads because you have patterns");
this.gutterAds.hide();
}
}
};
+1 -1
View File
@@ -496,7 +496,7 @@ export class Transport {
type: "donate_gold",
clientID: this.lobbyConfig.clientID,
recipient: event.recipient.id(),
gold: event.gold,
gold: event.gold ? Number(event.gold) : null,
});
}
+1 -1
View File
@@ -278,7 +278,7 @@ export const EmbargoIntentSchema = BaseIntentSchema.extend({
export const DonateGoldIntentSchema = BaseIntentSchema.extend({
type: z.literal("donate_gold"),
recipient: ID,
gold: z.bigint().nullable(),
gold: z.number().nullable(),
});
export const DonateTroopIntentSchema = BaseIntentSchema.extend({
+6 -2
View File
@@ -1,15 +1,19 @@
import { Execution, Game, Gold, Player, PlayerID } from "../game/Game";
import { toInt } from "../Util";
export class DonateGoldExecution implements Execution {
private recipient: Player;
private active = true;
private gold: Gold;
constructor(
private sender: Player,
private recipientID: PlayerID,
private gold: Gold | null,
) {}
goldNum: number | null,
) {
this.gold = toInt(goldNum ?? 0);
}
init(mg: Game, ticks: number): void {
if (!mg.hasPlayer(this.recipientID)) {
+5
View File
@@ -55,6 +55,11 @@ export class WarshipExecution implements Execution {
this.warship.delete();
return;
}
if (this.warship.owner().isDisconnected()) {
this.warship.delete();
return;
}
const hasPort = this.warship.owner().unitCount(UnitType.Port) > 0;
if (hasPort) {
this.warship.modifyHealth(1);
+2 -2
View File
@@ -79,8 +79,8 @@ export class MapPlaylist {
// Create the default public game config (from your GameManager)
return {
donateGold: false,
donateTroops: false,
donateGold: mode === GameMode.Team,
donateTroops: mode === GameMode.Team,
gameMap: map,
maxPlayers: config.lobbyMaxPlayers(map, mode, playerTeams),
gameType: GameType.Public,
+6
View File
@@ -41,6 +41,12 @@ export class PrivilegeCheckerImpl implements PrivilegeChecker {
return { type: "forbidden", reason: "invalid color: " + e.message };
}
}
if (refs.flag) {
cosmetics.flag = cosmetics.flag = refs.flag.replace(
/[^a-z0-9-_ ()]/gi,
"",
);
}
return { type: "allowed", cosmetics };
}
+2 -2
View File
@@ -120,7 +120,7 @@ describe("Donate gold to an ally", () => {
donor.addGold(6000n);
const donorGoldBefore = donor.gold();
const recipientGoldBefore = recipient.gold();
game.addExecution(new DonateGoldExecution(donor, recipientInfo.id, 5000n));
game.addExecution(new DonateGoldExecution(donor, recipientInfo.id, 5000));
for (let i = 0; i < 5; i++) {
game.executeNextTick();
@@ -242,7 +242,7 @@ describe("Donate Gold to a non ally", () => {
const donorGoldBefore = donor.gold();
const recipientGoldBefore = donor.gold();
game.addExecution(new DonateGoldExecution(donor, recipientInfo.id, 5000n));
game.addExecution(new DonateGoldExecution(donor, recipientInfo.id, 5000));
game.executeNextTick();
// Gold should not be donated since they are not allies