Skip to content
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

MultiServer: allow underscore as space replacement #3283

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Berserker66
Copy link
Member

What is this fixing or adding?

requests such as https://discord.com/channels/731205301247803413/1238036062346149909

How was this tested?

with a few commands, such as

/alias Test_potato Berserker
Named Test Potato as Berserker
/send tEsT_potato Progressive Dots
Notice (all): Cheat console: sending "Progressive Dots" to Berserker (Test Potato)

@github-actions github-actions bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels May 9, 2024
@PinkSwitch
Copy link
Contributor

Will this break if a user has an actual underscore in their name? What about if there are 2 players: test_potato and test potato ?

@ScipioWright
Copy link
Collaborator

Will this break if a user has an actual underscore in their name? What about if there are 2 players: test_potato and test potato ?

I think I would be fine with not allowing two players to have the same name where the only difference is one has an underscore where the other has a space

@Berserker66
Copy link
Member Author

This is already addressed, you cannot have this.

case-sensitive-only overlapping usernames have been disallowed for a long time now.
@black-sliver
Copy link
Member

You think this is better than trying to fix clients and command parsing to properly allow both spaces and underscores everywhere? Encapsulating string with spaces in " quotes is something even less tech-savvy people understand as far is i know. And we can provide command line documentation/recommendations in Network API so individual clients behave similar.

I won't block this, but I'll let the community decide (i.e. wait for enough peer review approvals before I hit approve).

@Berserker66
Copy link
Member Author

This is a relatively simple and easy change we can do now, a proper command parser that understands " everywhere I'd say is still desirable and may eventually replace this.


p = ServerCommandProcessor(Context("", 0, "", "", 0, 0, False))
Copy link
Member

Choose a reason for hiding this comment

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

Note sure if you want to fix this, but this should probably be a separate test for readability.

MultiServer.py Outdated Show resolved Hide resolved
@@ -210,7 +210,7 @@ def main(args=None, callback=ERmain):
else:
raise RuntimeError(f'No weights specified for player {player}')

if len(set(name.lower() for name in erargs.name.values())) != len(erargs.name):
if len(set(name.lower().replace("_", " ") for name in erargs.name.values())) != len(erargs.name):
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if it would be cheaper to do " " -> "_" rather than "_" -> " " because during runtime we will see more "_" than " ", but it shouldn't matter much.

Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
@Exempt-Medic Exempt-Medic added the is: enhancement Issues requesting new features or pull requests implementing new features. label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants