Throw in hole: stacks notes aren't rendering cards
DarthGandalf opened this issue · 8 comments
Describe the bug
It's possible to make notes on stacks, but they no longer change appearance of the stacks - it always looks empty
To Reproduce
Steps to reproduce the behavior:
- start TIIAH game
- add a note on a stack
- See nothing changed
Expected behavior
the stack appearance should follow the note
Additional context
Can't share replay, because during replay it doesn't hide the cards.
Verified broken
Based on the timing of this report and some of the code history, I suspect one of these may be to blame:
- "refactor: SuitIndex and Rank types used for stronger typing"
- "refactor: remove special ranks from codebase"
- "fix: stack base pips"
@Zamiell do you think anything about how isStackBase
is set, compared to the old methodology, could be affecting the code here: https://github.com/Hanabi-Live/hanabi-live/blame/main/packages/client/src/game/ui/HanabiCard.ts#L450 ? (I might do a bit more code digging myself, but you will probably know immediately once you look at it :D)
EDIT: Perhaps
could be to blame? Then again, I'm not sure if this drawing code is responsible for drawing notes' empathy on the stacks...I keep on looking at the code and nothing really stands out, but I don't fully understand everything. :'(
i have no idea what the problem is, if you want to investigate you can just start adding debug statements to see what is going on
Okay, I figured out the problem...
318a99f replaced
return `card-${suitName}-${rankToShow}`;
with
const bareNameRank = this.isStackBase
? STACK_BASE_RANK
: rankToShow ?? UNKNOWN_CARD_RANK;
return `card-${bareNameSuit}-${bareNameRank}`;
Note that this makes it impossible for the card's bareName to ever change from e.g. "card-Teal-StackBase". Whereas before, it was able to be overwritten by a note (that set rankToShow
) to e.g. "card-Teal-3".
If I comment out:
getBareNameRank(rankToShow: Rank | null): string {
// if (this.isStackBase) {
// return CARD_IMAGE_STACK_BASE_RANK_NAME;
// }
...
}
we see that the note actually works:
So the trick is to return the code to a state where the "rankToShow" can override the logic for isStackBase
... :)
Well, I should be sleeping, but instead I'm improving Throw It in a Hole for everyone... 😢
Please take a look at #2928 as it should fix this issue.
This issue should be fixed now, and is fixed when I test on hanab.live. Thanks for the help James! You should be able to mark as closed. I don't think I attached the PR correctly to this issue... :'(
yeah next time you can do "fixes #2875" in the PR title and it will close the issue automatically
err i mean in the PR description