diff --git a/module/documents/Actor/Handler.mjs b/module/documents/Actor/Handler.mjs index 557f569..25e71cd 100644 --- a/module/documents/Actor/Handler.mjs +++ b/module/documents/Actor/Handler.mjs @@ -96,5 +96,10 @@ export class ActorHandler extends Actor { return this.proxyFunction("_preUpdate", ...args); }; - useRestDie() { return this.proxyFunction("useRestDie"); }; + getRollData() { + if (!this.fn?.getRollData) return {}; + return this.fn?.getRollData.bind(this)(); + }; + + useRestDie() {return this.proxyFunction("useRestDie")}; }; diff --git a/module/documents/Actor/Mob.mjs b/module/documents/Actor/Mob.mjs index ff8b4c5..16f397f 100644 --- a/module/documents/Actor/Mob.mjs +++ b/module/documents/Actor/Mob.mjs @@ -1 +1,11 @@ -export default {}; +/** @this {Actor} */ +function getRollData() { + const data = { + initiative: this.system.initiative ?? 0, + }; + return data; +}; + +export default { + getRollData, +}; diff --git a/module/documents/Actor/Player.mjs b/module/documents/Actor/Player.mjs index 7cae17d..7f91eb6 100644 --- a/module/documents/Actor/Player.mjs +++ b/module/documents/Actor/Player.mjs @@ -132,6 +132,14 @@ async function preUntypedEmbed(item) { }; }; +/** @this {Actor} */ +function getRollData() { + const data = { + initiative: this.system.stats.hands ?? 0, + }; + return data; +}; + export default { atAspectLimit, createCustomItem, @@ -142,4 +150,5 @@ export default { genericEmbeddedDelete, preAspectEmbed, preUntypedEmbed, + getRollData, }; \ No newline at end of file diff --git a/system.json b/system.json index 4456f78..018b357 100644 --- a/system.json +++ b/system.json @@ -35,5 +35,6 @@ "extensions": ["css", "hbs", "json", "js", "mjs", "svg"], "paths": ["templates", "langs", ".styles", "module", "assets"] } - } + }, + "initiative": "@initiative" } \ No newline at end of file