Miskatonic-Investigative-Society / CoC7-FoundryVTT

An unofficial implementation of the Call of Cthulhu 7th Edition game system for Foundry Virtual Tabletop
https://discord.gg/foundryvtt
GNU General Public License v3.0
116 stars 98 forks source link

Development flag is attached before the roll results are displayed #1548

Open ryotai-trpg opened 1 month ago

ryotai-trpg commented 1 month ago

Prerequisites.

Description.

When XP gain is on and "Display chat message immediately" option in the Dice So Nice module is disabled, the development flag is displayed before the role result is displayed and the success or failure of the skill is known.

Expected Behavior.

The development flag appear at the same time as chat cards.

Possible Fix.

Changing flagForDevelopement() in the link part of module/check.js as follows works pseudo. I'm a JavaScript newbie, so there must be a better way. https://github.com/Miskatonic-Investigative-Society/CoC7-FoundryVTT/blob/develop/module/check.js#L1423-L1426

before

  async flagForDevelopement () {
    this.flaggedForDevelopment = true
    if (this.skill) await this.skill.flagForDevelopement()
  }

after

  async flagForDevelopement () {
    if (game.modules.get('dice-so-nice')?.active && !game.settings.get("dice-so-nice", "immediatelyDisplayChatMessages")) {
      await new Promise(resolve => setTimeout(resolve, 2500))
    }
    this.flaggedForDevelopment = true
    if (this.skill) await this.skill.flagForDevelopement()
  }
snap01 commented 3 weeks ago

This function is called from multiple places. A refactor of the check system is needed to call this function at a later point depending on method of showing the 3d dice. This will not be completed before the next release.