feature-Prettier Guest Names#2746
Conversation
| if (operation && operation.func === 'FOREACH') { | ||
| v20ReplaceGuestWithZeroWidthSpace(operation.loopRoutine); | ||
| } | ||
| if (operation && operation.func === 'IF') { | ||
| v20ReplaceGuestWithZeroWidthSpace(operation.thenRoutine); | ||
| v20ReplaceGuestWithZeroWidthSpace(operation.elseRoutine); | ||
| } |
There was a problem hiding this comment.
This isn't necessary. This function will already be called for the sub-routines.
| 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'; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
This seems to handle only a very specific case.
| const availableColors = MaterialPalette.filter(c => !usedColors.has(c)); | ||
| const pool = availableColors.length > 0 ? availableColors : MaterialPalette; | ||
|
|
||
| return pool[Math.floor(randomFunction() * pool.length)]; |
There was a problem hiding this comment.
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.
| hand: 'hand', | ||
|
|
||
| color: '#999999', | ||
| contrastColor: null, |
There was a problem hiding this comment.
Shouldn't this be a computed readonly property instead?
| playerName = args; | ||
| if(args) | ||
| playerName = args; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
This does not show up for me in Firefox 144 / Linux.
| 'client/js/editor/sidebar/assets.js', | ||
| 'client/js/editor/sidebar/toolbox.js', | ||
| 'client/js/editor/sidebar/gameSettings.js', | ||
| 'client/js/generatednames.js', |
There was a problem hiding this comment.
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.
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)