Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] No Automation Setting for NPC Recharges #546

Closed
Eranziel opened this issue Apr 28, 2023 · 5 comments
Closed

[BUG] No Automation Setting for NPC Recharges #546

Eranziel opened this issue Apr 28, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@Eranziel
Copy link
Owner

Describe the bug
There is no way to disable the automated NPC recharge roll when they start their turn.

Expected behavior
There should be a setting in system automation for disabling the automatic recharge rolls.

@Eranziel Eranziel added the bug Something isn't working label Apr 28, 2023
@msprijatelj
Copy link
Contributor

I think a stretch goal for this one would be to find a way to only roll once for recharge when multiple GMs are logged in; perhaps a debounce function?

@Eranziel
Copy link
Owner Author

Yes, that's a good idea. Would be applicable to things like lock on consumption and (later) damage application.

Brainstorming, maybe a function which returns false if there are any other GMs logged in which are either 1) higher-ranked (GM > assistant GM), or 2) user ID is lower?

@Eranziel
Copy link
Owner Author

Eranziel commented Jan 8, 2024

There is actually a function for this in Foundry v11 core. game.users.activeGM() returns only one or zero users, so we can use that to see if the active GM is the client's user before running this kind of code.

@msprijatelj
Copy link
Contributor

@Eranziel Would using that function negatively affect people who aren’t the active GM but control an NPC?

@Eranziel
Copy link
Owner Author

Eranziel commented Jan 8, 2024

No, everything should remain the same in that use case. The recharge automation only runs on GM clients currently, but it requires the turn to change. Players can't change the turn due to core Foundry permissions stuff, so there should always be a GM client to handle the automation. The NPC-controlling player would also still be able to click the Recharge button on the NPC sheet if/when needed.

Using game.users.activeGM() instead of user.isGM() just means the code runs only once if multiple GMs are logged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants