Skip to content

Commit

Permalink
Move "pf2e.restForTheNight" hook back to rest function (#12889)
Browse files Browse the repository at this point in the history
  • Loading branch information
stwlam authored Jan 9, 2024
1 parent 4822163 commit 7b03664
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/module/chat-message/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,8 @@ class ChatMessagePF2e extends ChatMessage {
CriticalHitAndFumbleCards.handleDraw(this);
}

// If this is a rest notification, re-render sheet for anyone currently viewing it and call system hook
if (options.restForTheNight) {
const actor = this.actor;
actor?.render();
Hooks.callAll("pf2e.restForTheNight", actor);
}
// If this is a rest notification, re-render sheet for anyone currently viewing it
if (options.restForTheNight) this.actor?.render();
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/scripts/macros/rest-for-the-night.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ export async function restForTheNight(options: RestForTheNightOptions): Promise<
);
const content = [actorAwakens, recoveryList.outerHTML].join("\n");

// Call a hook for modules to do anything extra
Hooks.callAll("pf2e.restForTheNight", actor);
messages.push({ user: game.user.id, content, speaker: ChatMessagePF2e.getSpeaker({ actor }) });
}

Expand Down

0 comments on commit 7b03664

Please sign in to comment.