Fixed possessionLocation == null serialization problem

This commit is contained in:
Pascal Serrarens 2022-02-24 13:46:40 +01:00
parent 58532dda73
commit 39cc19df48

View File

@ -191,6 +191,8 @@ namespace Passer.Humanoid {
bw.Write(name); bw.Write(name);
bw.Write(avatarPrefabName); bw.Write(avatarPrefabName);
bw.Write(physics); bw.Write(physics);
if (possessionLocation == null)
possessionLocation = "";
bw.Write(possessionLocation); bw.Write(possessionLocation);
#if RemoteAvatarBundles #if RemoteAvatarBundles
bw.Write(remoteAvatarBundleSize); bw.Write(remoteAvatarBundleSize);
@ -1470,7 +1472,7 @@ namespace Passer.Humanoid {
public ulong nwId; public ulong nwId;
public byte humanoidId; public byte humanoidId;
public string avatarPrefabName; public string avatarPrefabName;
public string possessionLocation; public string possessionLocation = "";
public ChangeAvatar() { } public ChangeAvatar() { }
public ChangeAvatar(HumanoidControl humanoid, string avatarPrefabName, string possessionLocation) { public ChangeAvatar(HumanoidControl humanoid, string avatarPrefabName, string possessionLocation) {
@ -1488,6 +1490,8 @@ namespace Passer.Humanoid {
bw.Write(nwId); bw.Write(nwId);
bw.Write(humanoidId); bw.Write(humanoidId);
bw.Write(avatarPrefabName); bw.Write(avatarPrefabName);
if (possessionLocation == null)
possessionLocation = "";
bw.Write(possessionLocation); bw.Write(possessionLocation);
byte[] data = ms.ToArray(); byte[] data = ms.ToArray();
@ -1502,6 +1506,8 @@ namespace Passer.Humanoid {
humanoidId = br.ReadByte(); humanoidId = br.ReadByte();
avatarPrefabName = br.ReadString(); avatarPrefabName = br.ReadString();
possessionLocation = br.ReadString(); possessionLocation = br.ReadString();
if (possessionLocation == "")
possessionLocation = null;
} }
// This is the same code as in the base class IMessage // This is the same code as in the base class IMessage