feat(combat): port retail held weapon parenting

Select the default combat mode from ordered equipped objects so bows request missile stance. Parse CreateObject parent metadata and ParentEvent, then render held objects as separate children composed from setup holding locations and placement frames each animation tick.
This commit is contained in:
Erik 2026-07-11 13:02:26 +02:00
parent 564d39dfea
commit ab6d96d113
18 changed files with 1152 additions and 17 deletions

View file

@ -0,0 +1,42 @@
using System.Buffers.Binary;
namespace AcDream.Core.Net.Messages;
/// <summary>
/// Inbound retail <c>ParentEvent</c> (<c>0xF749</c>): attach a child physics
/// object (weapon, shield, ammunition) to a named holding location on a
/// parent creature and apply the child's placement frame.
///
/// Wire oracle: <c>CM_Physics::DispatchSB_ParentEvent @ 0x006ACAF0</c>.
/// Runtime oracle: <c>SmartBox::HandleParentEvent @ 0x004535D0</c> and
/// <c>SmartBox::DoParentEvent @ 0x00452290</c>.
/// </summary>
public static class ParentEvent
{
public const uint Opcode = 0xF749u;
public readonly record struct Parsed(
uint ParentGuid,
uint ChildGuid,
uint ParentLocation,
uint PlacementId,
ushort ParentInstanceSequence,
ushort ChildPositionSequence);
public static Parsed? TryParse(ReadOnlySpan<byte> body)
{
if (body.Length < 24)
return null;
if (BinaryPrimitives.ReadUInt32LittleEndian(body) != Opcode)
return null;
return new Parsed(
BinaryPrimitives.ReadUInt32LittleEndian(body.Slice(4, 4)),
BinaryPrimitives.ReadUInt32LittleEndian(body.Slice(8, 4)),
BinaryPrimitives.ReadUInt32LittleEndian(body.Slice(12, 4)),
BinaryPrimitives.ReadUInt32LittleEndian(body.Slice(16, 4)),
BinaryPrimitives.ReadUInt16LittleEndian(body.Slice(20, 2)),
BinaryPrimitives.ReadUInt16LittleEndian(body.Slice(22, 2)));
}
}