using System.Numerics;
using AcDream.Core.Physics;
namespace AcDream.Core.Net.Messages;
///
/// The nine retail PhysicsTimeStamp channels stored at the tail of a
/// PhysicsDesc. Field order is verbatim from acclient.h:6084.
///
public readonly record struct PhysicsTimestamps(
ushort Position,
ushort Movement,
ushort State,
ushort Vector,
ushort Teleport,
ushort ServerControlledMove,
ushort ForcePosition,
ushort ObjDesc,
ushort Instance);
/// A parent or child attachment carried by PhysicsDesc.
public readonly record struct PhysicsAttachment(uint Guid, uint LocationId);
///
/// A present Movement field. The wrapper is retained even when
/// is empty so callers can distinguish absent Movement
/// from an explicitly present zero-length movement block.
///
public readonly record struct PhysicsMovementData(
ReadOnlyMemory RawData,
CreateObject.ServerMotionState? MotionState,
bool? IsAutonomous);
///
/// Immutable, lossless projection of the retail PhysicsDesc embedded in
/// CreateObject (0xF745). Nullable members preserve absent versus present-zero.
/// Network acceleration is retained for protocol fidelity; retail recalculates
/// normal acceleration after applying the final physics state.
///
public readonly record struct PhysicsSpawnData(
uint RawState,
CreateObject.ServerPosition? Position,
PhysicsMovementData? Movement,
uint? AnimationFrame,
uint? SetupTableId,
uint? MotionTableId,
uint? SoundTableId,
uint? PhysicsScriptTableId,
PhysicsAttachment? Parent,
ReadOnlyMemory? Children,
float? Scale,
float? Friction,
float? Elasticity,
float? Translucency,
Vector3? Velocity,
Vector3? Acceleration,
Vector3? AngularVelocity,
uint? DefaultScriptType,
float? DefaultScriptIntensity,
PhysicsTimestamps Timestamps)
{
/// The corrected retail flag view of .
public PhysicsStateFlags State => (PhysicsStateFlags)RawState;
}