From 738ff020647402e6ebb8ca0a78ac37f798c63b19 Mon Sep 17 00:00:00 2001 From: Jalen <72114365+jalensailin@users.noreply.github.com> Date: Wed, 3 Sep 2025 01:25:36 -0400 Subject: [PATCH] Fix "Art (Painting)" skill not respecting deletion (#250) * Fix "Art (Painting)" skill not respecting deletion --- CHANGELOG.md | 1 + module/deltagreen.js | 20 ++++++++++---------- template.json | 9 +-------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 220dbd8..31d765a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ ### **Bug Fixes:** +- [#203](https://github.com/deltagreen-foundryvtt/delta-green-foundry-vtt-system/issues/203) - Fixed default "Art (Painting)" custom skill from persisting despite deletion. - [#229](https://github.com/deltagreen-foundryvtt/delta-green-foundry-vtt-system/issues/229) - Fixed deprecation warning related to gridDistance and gridUnits. ### **Localization:** diff --git a/module/deltagreen.js b/module/deltagreen.js index 8affd6f..bf7d084 100644 --- a/module/deltagreen.js +++ b/module/deltagreen.js @@ -164,18 +164,18 @@ Hooks.on("preCreateActor", async (actor, creationData, options, userId) => { // If creationData has `system` then the new actor is either duplicated or imported, // We only want to translate the sample Typed Skill on brand new actors, // thus we return early if creationData has the `system` property so we do not override anything. - if (creationData?.system) return; - - // Only translate for actor types with a default Typed Skill (agents and NPCs) - if (!["agent", "npc"].includes(actor.type)) return; + // Also, only translate actor types with a default Typed Skill (agents and NPCs) + if (creationData?.system || !["agent", "npc"].includes(actor.type)) return; // Translate the default typed skill for brand new actors. - const artLabel = game.i18n.translations.DG?.TypeSkills?.Art ?? "Art"; - const paintingLabel = - game.i18n.translations.DG?.TypeSkills?.Subskills?.Painting ?? "Painting"; - - actor.updateSource({ "system.typedSkills.tskill_01.group": artLabel }); - actor.updateSource({ "system.typedSkills.tskill_01.label": paintingLabel }); + actor.updateSource({ + "system.typedSkills.tskill_01": { + label: game.i18n.localize("DG.TypeSkills.Subskills.Painting"), + group: game.i18n.localize("DG.TypeSkills.Art"), + proficiency: 0, + failure: false, + }, + }); }); // Note - this event is fired on ALL connected clients... diff --git a/template.json b/template.json index 0075ebe..63efaaf 100644 --- a/template.json +++ b/template.json @@ -241,14 +241,7 @@ "proficiency": 0 } }, - "typedSkills": { - "tskill_01": { - "label": "Painting", - "group": "Art", - "proficiency": 0, - "failure": false - } - }, + "typedSkills": {}, "specialTraining": [] }, "unnatural_skills": {