Fix Territory Skins option (#2538)

Resolves #2517 

## Description:

Fixes territory skin option not doing anything.
Also changes some instances of directly accessing
"this.cosmetics.pattern" to use the precalculated "pattern" variable.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Lavodan
This commit is contained in:
Lavodan
2025-12-01 04:38:35 +01:00
committed by GitHub
parent 5d513dfe5d
commit 55e413c528
+6 -4
View File
@@ -212,7 +212,9 @@ export class PlayerView {
.theme()
.borderColor(defaultTerritoryColor);
const pattern = this.cosmetics.pattern;
const pattern = userSettings.territoryPatterns()
? this.cosmetics.pattern
: undefined;
if (pattern) {
pattern.colorPalette ??= {
name: "",
@@ -224,7 +226,7 @@ export class PlayerView {
if (this.team() === null) {
this._territoryColor = colord(
this.cosmetics.color?.color ??
this.cosmetics.pattern?.colorPalette?.primaryColor ??
pattern?.colorPalette?.primaryColor ??
defaultTerritoryColor.toHex(),
);
} else {
@@ -253,9 +255,9 @@ export class PlayerView {
.defendedBorderColors(this._borderColor);
this.decoder =
this.cosmetics.pattern === undefined
pattern === undefined
? undefined
: new PatternDecoder(this.cosmetics.pattern, base64url.decode);
: new PatternDecoder(pattern, base64url.decode);
}
territoryColor(tile?: TileRef): Colord {