FoundryDevelopmentConsortium / Knowledge-Recalled-PF2e-FVTT

Creative Commons Zero v1.0 Universal
0 stars 3 forks source link

NPC Model and NPC model flags updated. #15

Closed AlecHolloway closed 1 year ago

AlecHolloway commented 1 year ago
On the start of the application the encounters are now being pulled and created with the NPCModel instead of the Actor Model so the Actor Model can now be deleted I assume.

The update actor hook is calling the updateNPCModelFlags so that function needs to be placed in index.js

Corrected usage of updateData: Previously, the updateData object was not being properly passed to the updateNPCModelFlags function. By fixing the code to pass updateData as a parameter to the function, it ensures that the function is called with the relevant update data when the updateActor hook is triggered. This allows the function to correctly update the NPC flags based on the provided data.

Conditional check for flag updates: The code now includes a conditional check before updating the NPC flags using setFlag. The check compares the existing flags with the updated flags to determine if there are any changes. If the flags are equal, the update is skipped to avoid an infinite loop caused by triggering the updateActor hook again. This ensures that the NPC flags are only updated when necessary.

Finally, the code should be cleaned up and adhere to eslint curly brace styles also we should remove all lines of console.log before production.