Skip to content

feature-Prettier Guest Names#2746

Open
mousewax wants to merge 9 commits into
mainfrom
feature-PrettierGuestNames
Open

feature-Prettier Guest Names#2746
mousewax wants to merge 9 commits into
mainfrom
feature-PrettierGuestNames

Conversation

@mousewax
Copy link
Copy Markdown
Collaborator

@mousewax mousewax commented Nov 20, 2025

Creates new guest names that are board game and tabletop-related adjective and noun. There is also a zero-width space at the beginning to key off of similar to "Guest".

Additionally, to make sure the zero-width space is removed, when an input gets focus that has that at the beginning the value is completely blanked and restored if the value is empty.


PR-SERVER-BOT: You can play around with it here: https://test.virtualtabletop.io/PR-2746/pr-test (or any other room on that server)

@mousewax mousewax self-assigned this Nov 20, 2025
@mousewax mousewax added enhancement New feature or request Ready for review A PR that is just waiting for tests and approval labels Nov 20, 2025
Comment thread server/fileupdater.mjs
Comment on lines +552 to +558
if (operation && operation.func === 'FOREACH') {
v20ReplaceGuestWithZeroWidthSpace(operation.loopRoutine);
}
if (operation && operation.func === 'IF') {
v20ReplaceGuestWithZeroWidthSpace(operation.thenRoutine);
v20ReplaceGuestWithZeroWidthSpace(operation.elseRoutine);
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary. This function will already be called for the sub-routines.

Comment thread server/fileupdater.mjs
Comment on lines +536 to +550
if (operation && operation.func === 'IF' && operation.operand2 === 'Guest') {
if (i > 0) {
const prevOp = routine[i - 1];
if (typeof prevOp === 'string') {
const match = prevOp.match(/var\s+([a-zA-Z0-9_]+)\s*=\s*substr\s+\${playerName}\s+0\s+5/);
if (match) {
const varName = match;
if (operation.operand1 === `\${${varName}}`) {
routine[i - 1] = prevOp.replace('0 5', '0 1');
operation.operand2 = '\u200B';
}
}
}
}
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to handle only a very specific case.

Comment thread client/js/color.js
const availableColors = MaterialPalette.filter(c => !usedColors.has(c));
const pool = availableColors.length > 0 ? availableColors : MaterialPalette;

return pool[Math.floor(randomFunction() * pool.length)];
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous algorithm made sure to pick colors that were as distinct as possible from all used colors in the room. The new one seems to be just random and could lead to very similar colors.

If you prefer the material colors palette, we should probably combine it with the hue separation algorithm. So something like beginning with a random one, then getting the subsequent ones using the old system but "snapping" to the next material color.

Comment thread client/js/widgets/seat.js
hand: 'hand',

color: '#999999',
contrastColor: null,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a computed readonly property instead?

Comment on lines -123 to +167
playerName = args;
if(args)
playerName = args;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the name on the server is set to "", the client should not simply ignore that and keep the previous name. I don't mind enforcing a non-empty name but that shouldn't be here.

width: 100%;
height: 100%;
-webkit-mask-image: url(i/icons-white/user-solid-svg.svg);
mask-image: url(i/icons-white/user-solid-svg.svg);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not show up for me in Firefox 144 / Linux.

Comment thread server/minify.mjs
'client/js/editor/sidebar/assets.js',
'client/js/editor/sidebar/toolbox.js',
'client/js/editor/sidebar/gameSettings.js',
'client/js/generatednames.js',
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't include files in Play Mode and Edit Mode, please. If you need the function in editor code as well (which doesn't seem to be the case), it just needs to be added to the list of exported functions somewhere in main.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Ready for review A PR that is just waiting for tests and approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants