From 31442cf32087eb4016f17dd7338e67aa49284dda Mon Sep 17 00:00:00 2001 From: Extremelyd1 <10898310+Extremelyd1@users.noreply.github.com> Date: Sat, 7 Sep 2024 10:40:48 +0200 Subject: [PATCH] Fix save data soft-locks --- HKMP/Game/Client/Save/SaveManager.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/HKMP/Game/Client/Save/SaveManager.cs b/HKMP/Game/Client/Save/SaveManager.cs index abb722f..b2fed24 100644 --- a/HKMP/Game/Client/Save/SaveManager.cs +++ b/HKMP/Game/Client/Save/SaveManager.cs @@ -767,6 +767,7 @@ private void UpdateSaveWithData(ushort index, byte[] encodedValue) { var value = encodedValue[0] == 1; + _lastPlayerData?.SetBoolInternal(name, value); pd.SetBoolInternal(name, value); } else if (type == typeof(float)) { if (valueLength != 4) { @@ -775,6 +776,7 @@ private void UpdateSaveWithData(ushort index, byte[] encodedValue) { var value = BitConverter.ToSingle(encodedValue, 0); + _lastPlayerData?.SetFloatInternal(name, value); pd.SetFloatInternal(name, value); } else if (type == typeof(int)) { if (valueLength != 4) { @@ -783,10 +785,12 @@ private void UpdateSaveWithData(ushort index, byte[] encodedValue) { var value = BitConverter.ToInt32(encodedValue, 0); + _lastPlayerData?.SetIntInternal(name, value); pd.SetIntInternal(name, value); } else if (type == typeof(string)) { var value = DecodeString(encodedValue, 0); + _lastPlayerData?.SetStringInternal(name, value); pd.SetStringInternal(name, value); } else if (type == typeof(Vector3)) { if (valueLength != 12) { @@ -799,6 +803,7 @@ private void UpdateSaveWithData(ushort index, byte[] encodedValue) { BitConverter.ToSingle(encodedValue, 8) ); + _lastPlayerData?.SetVector3Internal(name, value); pd.SetVector3Internal(name, value); } else if (type == typeof(List)) { var length = BitConverter.ToUInt16(encodedValue, 0); @@ -884,6 +889,7 @@ private void UpdateSaveWithData(ushort index, byte[] encodedValue) { Logger.Warn($"Received save update with incorrect value length for MapZone: {valueLength}"); } + _lastPlayerData?.SetVariableInternal(name, (MapZone) encodedValue[0]); pd.SetVariableInternal(name, (MapZone) encodedValue[0]); } else { throw new ArgumentException($"Could not decode type: {type}");