Eranziel / foundryvtt-lancer

A Foundry VTT game system for LANCER RPG.
GNU General Public License v3.0
105 stars 63 forks source link

fix: restore (broken) Action Tracker functionality #757

Open lazulit3 opened 1 month ago

lazulit3 commented 1 month ago

This PR fixes functionality related to the Action tracking:

I tried to understand the prior behavior and fix what bugs I could find, but am unsure if I got everything.

Fixes & Improvements

Questions / Discussion

For the Print Messages setting in Action Tracker Settings, what is the desired behavior for the end-of-turn action output?

Or neither? I see that the code intended to style them differently based on which actions were spent, but that style is gone/broken, so am guessing here.

Testing

Behavior that I've verified (related to fixes):

lazulit3 commented 1 month ago

Oh I forgot to fix the active vs inactive styling for the Mech Sheet Action buttons-- should make that behavior consistent.

Will follow up later this week.

BoltsJ commented 1 month ago

There's previous work on the fix-action-bar branch. Probably worth building off that rather than starting from scratch

lazulit3 commented 1 month ago

There's previous work on the fix-action-bar branch. Probably worth building off that rather than starting from scratch

Thanks, I hadn't seen this. I've updated this branch with:

The only changes I have here that disagree w/ prior work is https://github.com/Eranziel/foundryvtt-lancer/pull/757/commits/dd3532d293787ddcf2ddc55af38e58139bb28729, my rationale for removing this.updateActions(token.actor, _defaultActionData(token.actor)) is at https://github.com/Eranziel/foundryvtt-lancer/commit/21ebd6080f9cda943a0fc0c2992e7500401950d4#r145967069

The !== condition causes updateActions(token.actor, _defaultActionData(token.actor)) to reset the action tracker data-- I think we want to remove the updateActions part altogether. (Otherwise changes to action data just get overridden).

I assume this was from a past circumstance where action_tracker could be undefined and need initialization, but I haven't been able to find a case where this is needed currently. :)

lazulit3 commented 1 month ago

Oh I forgot to fix the active vs inactive styling for the Mech Sheet Action buttons-- should make that behavior consistent.

Okay, got this done.

I think this is ready for review.

Style Examples

Fresh actions at turn start:

bar-fresh-actions

sheet-actions-fresh

Some actions spent:

bar-with-spent

sheet-actions-with-spent

Chat messages:

chat-turn-start-and-end