fix(render): default avatar renders as a real character, not a grey circle

A player who never customized arrives as avatar 'default' — not a char/skin/model,
so avatarVisuals resolved it to 'legacy' kind with no sprite and the renderer drew
the grey fallback circle (while NPCs with explicit char-* avatars rendered fine).
Coerce any unknown/'default' avatar to 'char-villager' on the 2D topdown path so
nobody is ever a grey dot in a room of people. iso/3d keep their own fallbacks.
This commit is contained in:
jwinterm
2026-07-10 22:41:58 -04:00
parent 4b92e70d4c
commit 588250e5a9
+9
View File
@@ -88,6 +88,15 @@
opts = opts || {};
var ap = normalize(appearance);
var projection = opts.projection || 'legacy-rot';
// A player who never customized arrives as avatar 'default' (or an unknown id), which is not
// a char/skin/model and would fall to the grey circle. On the 2D topdown/tavern path, coerce
// it to a real Kenney character so nobody is ever a grey dot in a room of people. (iso/3d
// keep their own fallbacks below.)
if (ap && projection !== 'iso' && projection !== '3d') {
var a = ap.avatar;
var known = (RK.isChar && RK.isChar(a)) || (RK.isSkin && RK.isSkin(a)) || (a && /^kenney-/.test(a));
if (!known) ap = Object.assign({}, ap, { avatar: 'char-villager' });
}
var kind = kindFor(ap, projection);
var pack = packFor(ap, kind, projection);
var visual = {