fix: race field type — string default in template, remove Array.isArray guards

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 22:46:20 +01:00
co-authored by Claude Sonnet 4.6
parent 25250dc98a
commit 61b18ca3fc
2 changed files with 4 additions and 7 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
"ladAccount": false,
"showingOff": 0
},
"race": [],
"race": "",
"training": [],
"archetype": "",
"attributes": {
+3 -6
View File
@@ -419,8 +419,7 @@ class ZeroEngineActorSheet extends foundry.appv1.sheets.ActorSheet {
context.drugAlerts = this._buildDrugAlerts(this.actor);
// EBB user detection — Ebon and Brain Waster are ebb users
const raceRaw = this.actor.system.race;
const race = String(Array.isArray(raceRaw) ? (raceRaw[0] || "") : (raceRaw || "")).toLowerCase();
const race = String(this.actor.system.race || "").toLowerCase();
// Flat string versions for dropdown selected-state matching in templates
context.raceStr = race;
const trainingRaw = this.actor.system.training;
@@ -7128,8 +7127,7 @@ const SLA_RACIAL_ABILITY_DATA = {
async function _ensureRacialAbilities(actor) {
if (!actor || actor.type !== "character") return;
const raceRaw = actor.system?.race;
const race = String(Array.isArray(raceRaw) ? (raceRaw[0] || "") : (raceRaw || ""))
const race = String(actor.system?.race || "")
.toLowerCase()
.replace(/[\s-]/g, "")
.replace("313-s", "")
@@ -7189,8 +7187,7 @@ Hooks.once("ready", function() {
let count = 0;
for (const actor of game.actors ?? []) {
if (actor.type !== "character") continue;
const raceRaw = actor.system?.race;
const race = String(Array.isArray(raceRaw) ? (raceRaw[0] || "") : (raceRaw || "")).toLowerCase();
const race = String(actor.system?.race || "").toLowerCase();
if (!race || race === "undefined") continue;
const before = actor.items.filter(i => i.system?.category === "racial").length;
await _ensureRacialAbilities(actor);