foundryvtt-lancer
foundryvtt-lancer copied to clipboard
[BUG] No Automation Setting for NPC Recharges
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.
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?
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?
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.
@Eranziel Would using that function negatively affect people who aren’t the active GM but control an NPC?
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.