-
Notifications
You must be signed in to change notification settings - Fork 22
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
Combat turn V3 #245
Combat turn V3 #245
Conversation
Azurelol
commented
Mar 8, 2025
•
edited
Loading
edited
- Standardizes the combat turn button across the combat hud and tracker
- Fixes taking turns out of order
- Show info for other combatants when someone's taking a turn
- Add item event
a9fea4c
to
fda70e8
Compare
fda70e8
to
b3b795c
Compare
Don't be afraid! The line changes come from fixing the line endings for the package files. |
588e64e
to
b4f19a3
Compare
module/ui/combat.mjs
Outdated
* @param {FUCombat} combat | ||
* @return {Object.<"friendly"|"neutral"|"hostile", {}[]>} | ||
*/ | ||
getFactions() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original version of this method was not cleaned up combat-tracker.mjs:
async getFactions(turns, combat) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack. Thank you for pointing it out.
module/ui/combat.mjs
Outdated
data.combatant = this.combatant; | ||
// ID : Turns Left | ||
data.turnsLeft = this.countTurnsLeft(); | ||
data.factions = this.getFactions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might need to pass data.turns
into this (see below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather, it was changed so that factions only gets assigned if not already present. Since the combat hud will use it as well.
module/ui/combat.mjs
Outdated
* @return {Object.<"friendly"|"neutral"|"hostile", {}[]>} | ||
*/ | ||
getFactions() { | ||
return this.combatants.reduce( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the crux of the issue with with the missing animated token thumbnails and other elements like effects or resources. The previous version of getFactions had data.turns passed in from populateData, and it was this collection of turn data that was iterated over in the combat tracker handlebars template. This now uses the combatants collection on the combat, which is missing information compared to the turn data array previously passed in (such as a dynamic url based on either the token's image itself, or a base64 png display url generated from the token's sprite texture instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was correct, as the combat tracker needs different data.
2110832
to
43220ab
Compare
After the rebase + fixup for the damned files, the turn button broke. Investigating... Fixed. |
43220ab
to
faa449a
Compare
…at is when data is retrieved Whether combat has started depends on whether round > 0
module/ui/combat-tracker.mjs
Outdated
agg[combatant.id] = combatant.totalTurns; | ||
return agg; | ||
}, {}); | ||
// We assign it afterwards, since factions will be assigned if empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand this. What do we mean by afterwards? The logic is not deferred here right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whops, forgot to remove this comment. (Old implementation)