acdream/tests/AcDream.Core.Tests/Physics
Erik 7d6fe90607 feat(physics): retail PvP exemption + viewer/creature/missile gates (Commit C)
The retail-faithful exemption block at the top of
CPhysicsObj::FindObjCollisions
(acclient_2013_pseudo_c.txt:276782-276839,276971), ported line-for-
line as a small static helper.

Behaviour now matches retail:
  - Two non-PK players walk through each other.
  - Two PK players collide.
  - Two PKLite players collide.
  - Mismatched PK status (PK vs non-PK, PK vs PKLite) — exempt.
  - Impenetrable target ("Free" PK status) — always collides.
  - Player vs creature/NPC — always collides (this is what closes the
    user-facing complaint that walking into a Holtburg vendor was
    walking through them).
  - Mover with IGNORE_CREATURES — walks through creature targets.
  - Viewer (camera ray) — walks through creatures.
  - Target with ETHEREAL+IGNORE_COLLISIONS — universally exempt.

CollisionExemption.ShouldSkip(targetState, targetFlags, moverState)
  - new file src/AcDream.Core/Physics/CollisionExemption.cs.
  - 13-test matrix covering every documented case
    (CollisionExemptionTests.cs).
  - Static + pure → cheap to call from the hot path.

Wiring:
  - TransitionTypes.FindObjCollisions: after broadphase distance
    reject, call ShouldSkip on the obj and ObjectInfo.State; on true,
    `continue`. Static landblock entries (State=0, Flags=None) fall
    through cheaply — no behavior change for static collision.
  - PhysicsEngine.ResolveWithTransition: new optional moverFlags
    parameter (default None for back-compat). PlayerMovementController
    passes ObjectInfoState.IsPlayer; remote dead-reckoning leaves it
    None (matches non-player movers, no PvP exemption applies).
  - PK/PKLite/Impenetrable bits for the LOCAL player are not yet
    sourced from PlayerDescription's PlayerKillerStatus property —
    that's a follow-up. Default "non-PK player" matches ACE's
    character-creation default and the user's +Acdream test
    character.

Cross-checked against ACE PhysicsObj.cs:381-405 (line-for-line C# port
of the same retail block). Only intentional divergence: ACE adds
state.HasFlag(IsImpenetrable) (mover-impenetrable) to the collide list;
retail's pseudo-C only checks the target — acdream follows retail.

dotnet build green, dotnet test 1467 passing (+13 new). Live test:
+Acdream walking into Holtburg vendors now stops at their cylinder;
walking through small plants still passes (Commit B's phantom skip).

Closes the live-entity collision arc: A (plumbing) + B (registration)
+ C (exemption).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 13:21:36 +02:00
..
AnimationCommandRouterTests.cs fix(anim): Phase L.1b route motion commands 2026-04-28 10:46:22 +02:00
AnimationHookRouterTests.cs feat(anim): Phase E.1 hook router + GameWindow wiring 2026-04-18 16:30:23 +02:00
AnimationSequencerTests.cs fix(anim): Phase L.1c sequencer cycle fallback for missing MoveTo motion 2026-04-29 10:33:48 +02:00
BSPQueryTests.cs feat(physics): PhysicsDataCache + BSP sphere query 2026-04-13 23:28:39 +02:00
CellSurfaceTests.cs feat(core): Phase B.3 — CellSurface (indoor floor polygon projection) 2026-04-12 09:51:22 +02:00
CollisionExemptionTests.cs feat(physics): retail PvP exemption + viewer/creature/missile gates (Commit C) 2026-04-29 13:21:36 +02:00
CollisionPrimitivesTests.cs feat(physics): port 9 collision primitives from acclient.exe (chunk_00530000.c) 2026-04-12 23:53:47 +02:00
EntityCollisionFlagsTests.cs feat(physics): live-entity collision plumbing (Commit A) 2026-04-29 13:12:56 +02:00
MotionCommandResolverTests.cs fix(anim): Phase L.1b route motion commands 2026-04-28 10:46:22 +02:00
MotionInterpreterTests.cs fix(anim): Phase L.1b route motion commands 2026-04-28 10:46:22 +02:00
PhysicsBodyTests.cs feat(core): port decompiled AC client physics — CollisionPrimitives + PhysicsBody 2026-04-12 23:54:51 +02:00
PhysicsEngineTests.cs feat(core): Phase B.3 — CellPortal-based indoor/outdoor transitions in PhysicsEngine 2026-04-12 18:22:55 +02:00
PlayerWeenieTests.cs feat(physics): PlayerWeenie with retail Run/Jump formulas 2026-04-13 23:15:25 +02:00
PortalPlaneTests.cs feat(core): Phase B.3 — PortalPlane (plane math + crossing detection) 2026-04-12 18:17:48 +02:00
RemoteMoveToDriverTests.cs fix(anim): Phase L.1c clamp approach velocity to prevent overshoot 2026-04-29 10:14:35 +02:00
ServerControlledLocomotionTests.cs fix(anim): Phase L.1c match MoveTo run speed 2026-04-28 20:58:22 +02:00
ShadowObjectRegistryTests.cs feat(physics): live-entity collision plumbing (Commit A) 2026-04-29 13:12:56 +02:00
TerrainSurfaceTests.cs feat(core): Phase B.3 — TerrainSurface (outdoor heightmap Z + cell ID) 2026-04-12 09:51:54 +02:00
TransitionTests.cs feat(physics): Transition.FindTransitionalPosition core algorithm 2026-04-13 23:52:45 +02:00