PDA

View Full Version : CombatManager.requestActivation does not trigger hooks



anathemort
January 21st, 2022, 16:37
Hello,
I am trying to listen in for turn end/start events through the CombatManager. So far I have had success with setCustomTurnStart and setCustomTurnEnd, but I recently discovered that the activation flag (in the lower left of the CT, which you can drag/drop to set a turn) does not trigger any hooks. This function, requestActivation, seems to only be used by this drag/drop flag.

I can understand why it might not go through all the work of finding the actors for turn end/start, like how nextActor does, but wouldn't it make sense to at least call onInitChangeEvent? If not that, would it be possible to add another hook, such as onActivationEvent?

Moon Wizard
January 21st, 2022, 17:23
If you manually adjust the actor round, we have no way of determining what the user is trying to do with regards to round start and round end activity (i.e. rewinding for missed actions, skipping forward in time, just setting up different targeting, ....). In fact, we don't even know that the user wants to "change" the initiative, per se. So, we assume and do nothing other than change the active state.

What are you trying to accomplish?

Regards,
JPG

anathemort
January 21st, 2022, 17:36
What are you trying to accomplish?

I'm setting up a targeting extension with the aim of making every turn consistent, which helps (anecdotally, from the five games I run) with novice players or just those that don't use the CT. Really it's just selecting the token at turn start and clearing targets at turn end.

I'm already hooked into the round start event so this isn't a really big problem, since my ext will eventually get to run anyway and get things cleaned up for the next round, but a hook like onActivationEvent or running onTurnStartEvent from requestActivation would be nice for the token selection piece. It makes sense to me to still call onTurnStartEvent since the now-activated node is effectively starting their turn.

Dire Weasel
January 21st, 2022, 19:15
Take a look at Celestian's Has Initiative Indicator (https://github.com/CelestianGC/Has-Initiative-Indicator).

anathemort
January 21st, 2022, 19:19
Take a look at Celestian's Has Initiative Indicator (https://github.com/CelestianGC/Has-Initiative-Indicator).

Great rec, thanks. I use that extension and am disappointed I didn't think of looking at it :confused:

It's very amusing: all celestian is doing is adding a handler to the CT node active state, effectively creating their own onActivationEvent hook:

DB.addHandler("combattracker.list.*.active", "onUpdate", updateInititiativeIndicator);

If this isn't something FG sees as valuable, I could definitely do the same.