Skip to content

Commit

Permalink
Changelog
Browse files Browse the repository at this point in the history
- Added serverSyncHotkeys which prevents the synchronization of hotkeys from the server
- Updated valheim_plus.cfg and vplusconfig.json to represent the changes
  • Loading branch information
nxPublic committed Mar 22, 2021
1 parent 470dbc6 commit 149e08e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ValheimPlus/Configurations/BaseConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void LoadIniData(KeyDataCollection data)
continue;
}

if (prop.PropertyType == typeof(KeyCode))
if (prop.PropertyType == typeof(KeyCode) && !RPC.VPlusConfigSync.isConnecting)
{
prop.SetValue(this, data.GetKeyCode(keyName, (KeyCode)existingValue), null);
continue;
Expand Down
1 change: 1 addition & 0 deletions ValheimPlus/Configurations/Sections/ServerConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class ServerConfiguration : BaseConfig<ServerConfiguration>
public bool disableServerPassword { get; set; } = false;
public bool enforceMod { get; internal set; } = true;
public bool serverSyncsConfig { get; internal set; } = true;
public bool serverSyncHotkeys { get; internal set; } = true;
public int dataRate { get; internal set; } = 60; // Code that applies this multiplies by 1024, so the default is 60(KB)
}

Expand Down
16 changes: 14 additions & 2 deletions ValheimPlus/RPC/VPlusConfigSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace ValheimPlus.RPC
{
public class VPlusConfigSync
{

static public bool isConnecting = false;
public static void RPC_VPlusConfigSync(long sender, ZPackage configPkg)
{
if (ZNet.m_isServer) //Server
Expand Down Expand Up @@ -75,8 +77,18 @@ public static void RPC_VPlusConfigSync(long sender, ZPackage configPkg)

ValheimPlusPlugin.harmony.UnpatchSelf();

Configuration.Current = ConfigurationExtra.LoadFromIni(memStream);

// Sync HotKeys when connecting ?
if(Configuration.Current.Server.IsEnabled && Configuration.Current.Server.serverSyncHotkeys)
{
isConnecting = true;
Configuration.Current = ConfigurationExtra.LoadFromIni(memStream);
isConnecting = false;
}
else
{
Configuration.Current = ConfigurationExtra.LoadFromIni(memStream);
}

ValheimPlusPlugin.harmony.PatchAll();

ZLog.Log("Successfully synced VPlus configuration from server.");
Expand Down
3 changes: 3 additions & 0 deletions valheim_plus.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,9 @@ enforceMod=true
; Changes whether the server will force it's config on clients that connect. Only affects servers.
serverSyncsConfig=true

; 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

; The total amount of data that the server and client can send per second in kilobyte, do not set this value higher than 200-300 if you don't exactly know what you are doing.
dataRate=60

Expand Down
5 changes: 5 additions & 0 deletions vplusconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,11 @@
"defaultValue": "true",
"defaultType": "bool"
},
"serverSyncHotkeys": {
"description": "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.",
"defaultValue": "false",
"defaultType": "bool"
},
"dataRate": {
"description": "The total amount of data that the server and client can send per second in kilobyte",
"defaultValue": "60",
Expand Down

0 comments on commit 149e08e

Please sign in to comment.