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

local defined Keys will not be loaded when connecting to a dedicated server #801

Open
Grantapher opened this issue Mar 25, 2023 · 10 comments

Comments

@Grantapher
Copy link

Grantapher commented Mar 25, 2023

I have a bug, that local defined Keys will not be loaded when connecting to a dedicated server. Insted only the default values will be used. I have a fix for it, but can't commit it to your fork (branch: origin\grantapher-development). The button is disabled in VS2022.

I've changed the code in BaseConfig.cs from

                if (prop.PropertyType == typeof(KeyCode) && !RPC.VPlusConfigSync.isConnecting)
                {
                    prop.SetValue(this, data.GetKeyCode(keyName, (KeyCode)existingValue), null);
                    continue;
                }

to

                if (prop.PropertyType == typeof(KeyCode))
                {
                    prop.SetValue(this, data.GetKeyCode(keyName, (KeyCode)existingValue), null);
                    continue;
                }

This is necessary to use FreePlacementRotation without colliding with other keys (e.g. F is used for activateForsaken Powers. This is very frustrating.


Originally posted by @JackTheFragger in #793 (comment)

@Grantapher
Copy link
Author

Based on commit 149e08e it seems that the code you deleted exists to prevent the server from overriding keys defined in each player's local config. Are you certain you have Server.serverSyncHotkeys set to false? Are you certain you overwrote the key configuration in your local config?

@JackTheFragger
Copy link

My server config has the same key definitions. But they will never be read. I've tried key sync enabled and disabled. The properly name 'isConnecting' doedn't say, that it's the KeySync option. I will test it.

@JackTheFragger
Copy link

The Code is bullshit, because:

The Sync will read the full config and replaces the local config with the server one. If HotKeySync is disabled, the new config will take only the default values, because they will not been overwritten with the local defined... That's why your local config will never run

@JackTheFragger
Copy link

I've added my tested changes. Now it will peform correctyl. And: now server sync settings will be used for decisions, not local settings.

@Grantapher
Copy link
Author

Grantapher commented Mar 26, 2023

What exactly are you trying to get the functionality to be? The server shouldn't overwrite the player's own choices for the hotkeys unless the player opts in, which I believe is what the code originally aimed for.

And although it does defy the "server syncs config" stuff, this seems like it should be an exception.

@JackTheFragger
Copy link

ServerSync has to be locked by the server for avoiding "cheating". The HotkeySync-Option is something, I've never understood. Who is using it? And why? The option will be overwritten with first sync and will stay there until quitting the game. So it should defined by the server for deterministic.

@JackTheFragger
Copy link

JackTheFragger commented Mar 26, 2023

If local defining of server hotkey sync is required, code has to be changed, too, to avoid server overwriting this option.

Please answer, what you think about it.

@Grantapher
Copy link
Author

; Changes whether the server will force it's config on clients that connect. Only affects servers.
; WE HEAVILY RECOMMEND TO NEVER DISABLE THIS!
serverSyncsConfig=true

serverSyncsConfig does say it only affects servers, so agree that the client value shouldn't have an effect there.

; If false allows you to keep your own defined hotkeys instead of synchronising the ones declared for the server. 
; Sections need to be enabled in your local configuration to load hotkeys. 
; This is a client side setting and not affected by server settings.
serverSyncHotkeys=false

serverSyncHotkeys says the opposite, only client side configuration affects it, so we should stay with that. It makes sense that players should be able to customize hotkeys.

@JackTheFragger
Copy link

Thanks for clarification. I will change the code.

@JackTheFragger
Copy link

I've edited my code with refactorings for better readibility and fix for overwriting local value for syncHotkeyConfig (only local will be used and remote ignored).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants