save but not send hat/visor/weapon state, fix sync of mounts, speed up cache generation a bit

This commit is contained in:
Stanley Dimant
2022-07-26 12:49:44 +02:00
parent b8275ca070
commit 307c90f40e
7 changed files with 86 additions and 30 deletions

View File

@@ -32,8 +32,11 @@ namespace MareSynchronos.Models
public byte[] EquipSlotData { get; set; } = new byte[40];
public byte[] CustomizeData { get; set; } = new byte[26];
public byte? HatState { get; set; }
public byte? VisorWeaponState { get; set; }
public bool HasUnprocessedUpdate { get; set; } = false;
public bool DoNotSendUpdate { get; set; } = false;
public bool IsProcessing { get; set; } = false;
public unsafe void CheckAndUpdateObject()
@@ -94,6 +97,25 @@ namespace MareSynchronos.Models
}
}
if (ObjectKind is not ObjectKind.Mount)
{
var newHatState = Marshal.ReadByte((IntPtr)customizeData + 30, 0);
var newWeaponOrVisorState = Marshal.ReadByte((IntPtr)customizeData + 31, 0);
if (newHatState != HatState)
{
if (HatState != null) DoNotSendUpdate = true;
HatState = newHatState;
hasChanges = true;
}
if (newWeaponOrVisorState != VisorWeaponState)
{
if (VisorWeaponState != null) DoNotSendUpdate = true;
VisorWeaponState = newWeaponOrVisorState;
hasChanges = true;
}
}
return hasChanges;
}
}