Fix "Art (Painting)" skill not respecting deletion (#250)

* Fix "Art (Painting)" skill not respecting deletion
This commit is contained in:
Jalen
2025-09-03 08:25:36 +03:00
committed by GitHub
parent 3741835682
commit 738ff02064
3 changed files with 12 additions and 18 deletions
+1
View File
@@ -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:**
+10 -10
View File
@@ -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...
+1 -8
View File
@@ -241,14 +241,7 @@
"proficiency": 0
}
},
"typedSkills": {
"tskill_01": {
"label": "Painting",
"group": "Art",
"proficiency": 0,
"failure": false
}
},
"typedSkills": {},
"specialTraining": []
},
"unnatural_skills": {