Some checks are pending
Headless portability / portable-headless (ubuntu-latest) (push) Waiting to run
Headless portability / portable-headless (windows-latest) (push) Waiting to run
Headless portability / linux-graphical (push) Waiting to run
Headless portability / linux-vulkan (push) Waiting to run
LiveEntityCollisionBuilder and LiveEntityDefaultPoseResolver move from AcDream.App.Physics to AcDream.Runtime.Physics with no behaviour change — diff-verified byte-identical shape math by both review lenses. The Build signature's App-record parameter is replaced by presentation-free primitives with identical guard semantics, INCLUDING the FinalPhysicsState read the contract had missed and the implementer surfaced rather than dropped. Visibility stays internal: Runtime's existing InternalsVisibleTo grants already cover every consumer, so the implementation's public widening is reverted per the architecture review's finding 11. The registration WIRING is deliberately WITHHELD. Both Opus lenses failed it, converging: a shadow registered at spawn freezes there (RuntimeRemotePhysicsUpdater is Runtime-homed but App-driven — nothing headless ticks it), so a walking NPC becomes a phantom obstacle at its spawn point while the real NPC still passes through the bot; three of five shadow-lifetime edges leaked (pickup leaves a permanent invisible collider, supersession orphans a duplicate, generation reset never unregisters and the K-ledger convergence oracle only checks retained shadows AFTER disposal clears them); and headless cannot resolve BSP collision assets at all, so doors and chests would still be walk-through. The frozen-shadow root was the SESSION LEAD's contract error (fact 3), not the implementer's. #330 stays OPEN, rewritten as the seven-point scope map the reviews produced — the honest overnight deliverable is that map, not a half-mechanism carrying new divergences. Suite 11,235 passed / 4 skipped / 0 failed (the withheld seam's two tests account for the delta from the implementation run's 11,237). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
130 lines
4.4 KiB
C#
130 lines
4.4 KiB
C#
using System.Numerics;
|
|
using AcDream.App.World;
|
|
using AcDream.Core.Net;
|
|
using AcDream.Core.Physics;
|
|
using AcDream.Core.World;
|
|
using AcDream.Runtime.Physics;
|
|
using DatReaderWriter.DBObjs;
|
|
|
|
namespace AcDream.App.Rendering;
|
|
|
|
/// <summary>
|
|
/// Exact runtime identity retained while retail
|
|
/// <c>SmartBox::UpdateVisualDesc</c> mutates only a live object's visual
|
|
/// description.
|
|
/// </summary>
|
|
internal sealed record LiveEntityAppearanceUpdateState(
|
|
WorldEntity Entity,
|
|
LiveEntityAnimationState? Animation);
|
|
|
|
internal sealed record LiveEntityAppearanceCollisionUpdate(
|
|
LiveEntityRecord Record,
|
|
WorldEntity Entity,
|
|
LiveEntityCollisionRegistration? Registration);
|
|
|
|
/// <summary>
|
|
/// Focused appearance-lifetime operations shared by ObjDesc hydration and the
|
|
/// final animation presenter. This type owns no identity index; every capture
|
|
/// is resolved from <see cref="LiveEntityRuntime"/>.
|
|
/// </summary>
|
|
internal static class LiveEntityAppearanceBinding
|
|
{
|
|
public static LiveEntityAppearanceUpdateState? Capture(
|
|
LiveEntityRuntime runtime,
|
|
uint serverGuid)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(runtime);
|
|
if (!runtime.TryGetRecord(serverGuid, out LiveEntityRecord record)
|
|
|| record.WorldEntity is not { } entity)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return new LiveEntityAppearanceUpdateState(
|
|
entity,
|
|
record.AnimationRuntime as LiveEntityAnimationState);
|
|
}
|
|
|
|
public static void RebindAnimation(
|
|
LiveEntityAnimationState animation,
|
|
WorldEntity entity,
|
|
Setup setup,
|
|
float scale,
|
|
IReadOnlyList<LiveAnimationPartTemplate> partTemplate,
|
|
IReadOnlyList<bool> partAvailability)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(animation);
|
|
ArgumentNullException.ThrowIfNull(entity);
|
|
ArgumentNullException.ThrowIfNull(setup);
|
|
ArgumentNullException.ThrowIfNull(partTemplate);
|
|
ArgumentNullException.ThrowIfNull(partAvailability);
|
|
|
|
animation.Entity = entity;
|
|
animation.Setup = setup;
|
|
animation.Scale = scale;
|
|
animation.PartTemplate = partTemplate;
|
|
animation.PartAvailability = partAvailability;
|
|
animation.InvalidatePresentationPoses();
|
|
}
|
|
|
|
public static LiveEntityAppearanceCollisionUpdate? PrepareCollision(
|
|
LiveEntityRuntime runtime,
|
|
LiveEntityCollisionBuilder builder,
|
|
WorldEntity entity,
|
|
Setup setup,
|
|
IReadOnlyList<uint> effectivePartGfxObjIds,
|
|
WorldSession.EntitySpawn spawn,
|
|
Vector3 worldOrigin)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(runtime);
|
|
ArgumentNullException.ThrowIfNull(builder);
|
|
ArgumentNullException.ThrowIfNull(entity);
|
|
ArgumentNullException.ThrowIfNull(setup);
|
|
ArgumentNullException.ThrowIfNull(effectivePartGfxObjIds);
|
|
if (!runtime.TryGetRecord(spawn.Guid, out LiveEntityRecord record)
|
|
|| !ReferenceEquals(record.WorldEntity, entity))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return new LiveEntityAppearanceCollisionUpdate(
|
|
record,
|
|
entity,
|
|
builder.Build(
|
|
entity,
|
|
setup,
|
|
effectivePartGfxObjIds,
|
|
spawn,
|
|
record.ServerGuid,
|
|
record.Generation,
|
|
record.WorldEntity!,
|
|
record.FinalPhysicsState,
|
|
worldOrigin,
|
|
retainEmptyPayload: true));
|
|
}
|
|
|
|
public static bool CommitCollision(
|
|
LiveEntityRuntime runtime,
|
|
ShadowObjectRegistry registry,
|
|
LiveEntityAppearanceCollisionUpdate update)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(runtime);
|
|
ArgumentNullException.ThrowIfNull(registry);
|
|
ArgumentNullException.ThrowIfNull(update);
|
|
if (!runtime.TryGetRecord(update.Record.ServerGuid, out LiveEntityRecord current)
|
|
|| !ReferenceEquals(current, update.Record)
|
|
|| !ReferenceEquals(current.WorldEntity, update.Entity))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
LiveEntityCollisionBuilder.ReconcileAppearance(
|
|
registry,
|
|
update.Entity.Id,
|
|
update.Registration,
|
|
suspendIfNew: !current.IsSpatiallyVisible
|
|
|| current.ProjectionKind is not LiveEntityProjectionKind.World
|
|
|| (current.FinalPhysicsState & PhysicsStateFlags.Hidden) != 0);
|
|
return true;
|
|
}
|
|
}
|