mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 20:07:21 +01:00
ignore hat/weapon state changes
This commit is contained in:
parent
242b6650ef
commit
b42e7e236c
3 changed files with 6 additions and 30 deletions
|
|
@ -5,6 +5,7 @@ using MareSynchronos.Mediator;
|
||||||
using MareSynchronos.Models;
|
using MareSynchronos.Models;
|
||||||
using MareSynchronos.Utils;
|
using MareSynchronos.Utils;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
namespace MareSynchronos.Managers;
|
namespace MareSynchronos.Managers;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors></Authors>
|
<Authors></Authors>
|
||||||
<Company></Company>
|
<Company></Company>
|
||||||
<Version>0.7.38</Version>
|
<Version>0.7.39</Version>
|
||||||
<Description></Description>
|
<Description></Description>
|
||||||
<Copyright></Copyright>
|
<Copyright></Copyright>
|
||||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||||
|
|
|
||||||
|
|
@ -165,11 +165,11 @@ public class GameObjectHandler : MediatorSubscriberBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var customizeDiff = CompareAndUpdateCustomizeData(chara->CustomizeData, out bool doNotSendUpdate);
|
var customizeDiff = CompareAndUpdateCustomizeData(chara->CustomizeData);
|
||||||
|
|
||||||
if (addrDiff || equipDiff || customizeDiff || drawObjDiff || nameChange)
|
if (addrDiff || equipDiff || customizeDiff || drawObjDiff || nameChange)
|
||||||
{
|
{
|
||||||
if (_isOwnedObject && !doNotSendUpdate)
|
if (_isOwnedObject)
|
||||||
{
|
{
|
||||||
_logger.LogTrace("[{this}] Changed", this);
|
_logger.LogTrace("[{this}] Changed", this);
|
||||||
|
|
||||||
|
|
@ -203,10 +203,9 @@ public class GameObjectHandler : MediatorSubscriberBase
|
||||||
_clearCts = null;
|
_clearCts = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe bool CompareAndUpdateCustomizeData(byte* customizeData, out bool doNotSendUpdate)
|
private unsafe bool CompareAndUpdateCustomizeData(byte* customizeData)
|
||||||
{
|
{
|
||||||
bool hasChanges = false;
|
bool hasChanges = false;
|
||||||
doNotSendUpdate = false;
|
|
||||||
|
|
||||||
for (int i = 0; i < CustomizeData.Length; i++)
|
for (int i = 0; i < CustomizeData.Length; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -218,30 +217,6 @@ public class GameObjectHandler : MediatorSubscriberBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var newHatState = Marshal.ReadByte((IntPtr)customizeData + 30, 0);
|
|
||||||
var newWeaponOrVisorState = Marshal.ReadByte((IntPtr)customizeData + 31, 0);
|
|
||||||
if (newHatState != HatState)
|
|
||||||
{
|
|
||||||
if (HatState != null && !hasChanges)
|
|
||||||
{
|
|
||||||
_logger.LogDebug("[{this}] Not Sending Update, only Hat changed", this);
|
|
||||||
doNotSendUpdate = true;
|
|
||||||
}
|
|
||||||
HatState = newHatState;
|
|
||||||
}
|
|
||||||
|
|
||||||
newWeaponOrVisorState &= 0b1101; // ignore drawing weapon
|
|
||||||
|
|
||||||
if (newWeaponOrVisorState != VisorWeaponState)
|
|
||||||
{
|
|
||||||
if (VisorWeaponState != null && !hasChanges)
|
|
||||||
{
|
|
||||||
_logger.LogDebug("[{this}] Not Sending Update, only Visor/Weapon changed", this);
|
|
||||||
doNotSendUpdate = true;
|
|
||||||
}
|
|
||||||
VisorWeaponState = newWeaponOrVisorState;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hasChanges;
|
return hasChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue