Handle retail ObjectDelete (0xF747) using CM_Physics::DispatchSB_DeleteObject 0x006AC6A0 / SmartBox::HandleDeleteObject 0x00451EA0 and ACE GameMessageDeleteObject so dead creatures are removed when corpses spawn. Route action-class ForwardCommand values through AnimationCommandRouter/PlayAction instead of SetCycle so creature attack commands 0x51/0x52/0x53 survive the immediate Ready echo, matching CMotionTable::GetObjectSequence 0x00522860 / ACE MotionTable.GetObjectSequence. Use server-authoritative UpdatePosition velocity, or observed server position delta for non-player entities when HasVelocity is absent, to reduce monster/NPC chase lag without applying player RUM prediction to server-controlled creatures.
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using System.Buffers.Binary;
|
|
|
|
namespace AcDream.Core.Net.Messages;
|
|
|
|
/// <summary>
|
|
/// Inbound <c>ObjectDelete</c> GameMessage (opcode <c>0xF747</c>).
|
|
///
|
|
/// <para>
|
|
/// Retail dispatch path:
|
|
/// <c>CM_Physics::DispatchSB_DeleteObject</c> 0x006AC6A0 reads guid from
|
|
/// <c>buf+4</c> and instance sequence from <c>buf+8</c>, then calls
|
|
/// <c>SmartBox::HandleDeleteObject</c> 0x00451EA0. ACE emits the same
|
|
/// layout from <c>GameMessageDeleteObject</c>.
|
|
/// </para>
|
|
/// </summary>
|
|
public static class DeleteObject
|
|
{
|
|
public const uint Opcode = 0xF747u;
|
|
|
|
public readonly record struct Parsed(uint Guid, ushort InstanceSequence);
|
|
|
|
/// <summary>
|
|
/// Parse a 0xF747 body. <paramref name="body"/> must start with the
|
|
/// 4-byte opcode, matching every other parser in this namespace.
|
|
/// </summary>
|
|
public static Parsed? TryParse(ReadOnlySpan<byte> body)
|
|
{
|
|
if (body.Length < 10)
|
|
return null;
|
|
|
|
uint opcode = BinaryPrimitives.ReadUInt32LittleEndian(body.Slice(0, 4));
|
|
if (opcode != Opcode)
|
|
return null;
|
|
|
|
uint guid = BinaryPrimitives.ReadUInt32LittleEndian(body.Slice(4, 4));
|
|
ushort instanceSequence = BinaryPrimitives.ReadUInt16LittleEndian(body.Slice(8, 2));
|
|
return new Parsed(guid, instanceSequence);
|
|
}
|
|
}
|