Skip to content

Commit

Permalink
do not change player name if it is undefined or empty
Browse files Browse the repository at this point in the history
  • Loading branch information
n-at committed Sep 3, 2023
1 parent 04f0650 commit 27b7f76
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion assets/netplay-ui-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
//send previously saved client name
const netplayName = netplay.getName();
const savedName = window.NetplayLoadClientName(netplayName);
if (netplayName !== savedName) {
if (savedName && netplayName !== savedName) {
netplay.setName(savedName);
}

Expand Down
2 changes: 1 addition & 1 deletion assets/netplay-ui-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
function wsGreeting() {
const netplayName = netplay.getName();
const savedName = window.NetplayLoadClientName(netplayName);
if (netplayName !== savedName) {
if (savedName && netplayName !== savedName) {
netplay.setName(savedName);
}

Expand Down
20 changes: 15 additions & 5 deletions templates/includes/play_default_options.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,21 @@
const netplayControls = window.localStorage.playtimeNetplayControls;
const netplayVirtualGamepad = window.localStorage.playtimeNetplayVirtualGamepad;
window.localStorage.clear();
window.localStorage.__dark_theme = darkTheme;
window.localStorage.playtimeNetplayName = netplayName;
window.localStorage.playtimeNetplayPlayer = netplayPlayer;
window.localStorage.playtimeNetplayControls = netplayControls;
window.localStorage.playtimeNetplayVirtualGamepad = netplayVirtualGamepad;
if (darkTheme) {
window.localStorage.__dark_theme = darkTheme;
}
if (netplayName) {
window.localStorage.playtimeNetplayName = netplayName;
}
if (netplayPlayer) {
window.localStorage.playtimeNetplayPlayer = netplayPlayer;
}
if (netplayControls) {
window.localStorage.playtimeNetplayControls = netplayControls;
}
if (netplayVirtualGamepad) {
window.localStorage.playtimeNetplayVirtualGamepad = netplayVirtualGamepad;
}
const coreSettings = {
settings: {
Expand Down

0 comments on commit 27b7f76

Please sign in to comment.