Skip to content

Commit

Permalink
[#4223] Fix toolIds Proxy when assigning custom tools
Browse files Browse the repository at this point in the history
  • Loading branch information
arbron committed Sep 16, 2024
1 parent 58f99f9 commit ff3e838
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions module/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -662,24 +662,23 @@ DND5E.tools = {
}
};

const _toolIds = Object.entries(DND5E.tools).reduce((obj, [k, { id }]) => {
obj[k] = id;
return obj;
}, {});

/**
* The basic tool types in 5e. This enables specific tool proficiencies or
* starting equipment provided by classes and backgrounds.
* @enum {string}
*/
DND5E.toolIds = new Proxy(_toolIds, {
DND5E.toolIds = new Proxy(DND5E.tools, {
get(target, prop) {
return target[prop]?.id;
},
set(target, prop, value) {
foundry.utils.logCompatibilityWarning(
"Appending to CONFIG.DND5E.toolIds is deprecated, use CONFIG.DND5E.tools instead.",
{ since: "DnD5e 4.0", until: "DnD5e 4.2", once: true }
);
target[prop] ??= { ability: "int" };
target[prop].id = value;
return true;
}
});

Expand Down

0 comments on commit ff3e838

Please sign in to comment.