fix(physics): TS-23 - plumb real PK/PKLite/Impenetrable mover flags
Campaign P Slice P3 item 3. The wire parse (CreateObject's PublicWeenieDesc._bitfield), the decode (EntityCollisionFlagsExt. FromPwdBitfield), the per-GUID storage (ClientObjectTable. PublicWeenieBitfield), and the exemption logic (CollisionExemption. ShouldSkip) all already existed and were already correct -- every mover-flags call site just fed a GUID-prefix IsPlayer heuristic instead of the real per-entity PK/PKLite/Impenetrable state (retail OBJECTINFO::init 0x0050cf30 state |= 0x80/0x800/0x1000). Port: - EntityCollisionFlagsExt.ToMoverState translates the decoded PWD bit-space into the ObjectInfoState bit-space FindObjCollisions actually reads -- two different numberings that must not be confused. Deliberately does not translate IsPlayer (every call site already derives that correctly from its own GUID heuristic per #184 Slice 2b). - EntityCollisionFlagsExt.ResolveMoverPvpState is the one shared ClientObjectTable-backed lookup (guid -> ObjectInfoState), replacing what would otherwise have been three separate inline copies across GameWindow/LivePresentationComposition/RemoteTeleportController. - Threaded as a new optional moverPvpState parameter through RuntimeRemotePhysicsUpdater.Tick/TickHidden and RuntimeOrdinaryPhysicsUpdater.TryBegin (default None preserves every pre-P3 caller unchanged), and as PlayerMovementController.OwnPvpFlags for the local player's own two resolve call sites. - TS-23 section 12b: PlayerWeenie.JumpStaminaCost's pk parameter now reads the real PlayerKillerStatus(0x86)/LastPkAttackTimestamp(0x91) pair against retail's 20-second recency window (pkStatus in {4, 0x40} && (timestamp + 20.0) >= now), replacing the P1 hardcoded false. RuntimeMovementSkillState/Snapshot and LiveSessionEventRouter.RecomputePvpStatus push both the PWD bitfield and the PlayerKillerStatus pair reactively, riding the SAME ClientObject event triggers RecomputeBurden already uses. - A conformance test caught a genuine precision bug in the first PK-timer clock choice: DateTimeOffset.UtcNow's Unix-epoch seconds (~1.7 billion) loses ~128 seconds of precision in a 32-bit float, silently swallowing the entire 20-second window. Switched to Environment.TickCount64 (small, monotonic magnitude) -- also the more retail-plausible basis, since LastPkAttackTimestamp is itself a wire PropertyFloat and retail's Timer::cur_time is almost certainly a process/session-relative counter for the same precision reason, not an absolute epoch. Non-PK invariant (the acceptance criterion): an entity with no ClientObjectTable row, or a row whose PublicWeenieBitfield is null or 0, resolves to ObjectInfoState.None -- a no-op OR into moverFlags, bit-identical to every pre-P3 caller's hardcoded value. A dedicated test drives two real ClientObjectTable rows through CollisionExemption.ShouldSkip and confirms PK-vs-PK collides while PK-vs-non-PK and non-PK-vs-non-PK both stay exempt (walk through). Register: TS-23 retired (both the collision-flags and PK-timer halves); the stale "M2 combat must land TS-23" phase-gate note removed. dotnet build + dotnet test (Core.Tests 4008/2 skip, Runtime.Tests 425/0, App.Tests 3968/3 skip, complete solution build) all green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
8b5425498c
commit
bb7b899bfe
17 changed files with 702 additions and 53 deletions
|
|
@ -163,6 +163,21 @@ public sealed class PlayerMovementController
|
|||
/// </summary>
|
||||
public float StepDownHeight { get; set; } = 0.4f;
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 (Campaign P Slice P3, 2026-07-30): the local player's own
|
||||
/// PK/PKLite/Impenetrable <see cref="ObjectInfoState"/> bits, decoded
|
||||
/// from <c>PublicWeenieDesc._bitfield</c> (retail <c>OBJECTINFO::init</c>
|
||||
/// 0x0050cf30 `state |= w->vtable->IsPK()/IsPKLite()/IsImpenetrable()
|
||||
/// ? 0x800/0x1000/0x80`). Set at world-entry and refreshed reactively
|
||||
/// whenever the player's own <c>ClientObject.PublicWeenieBitfield</c>
|
||||
/// changes (same trigger set as <see cref="StepUpHeight"/>'s
|
||||
/// server-skill pushes). Default <see cref="ObjectInfoState.None"/>
|
||||
/// (no PK/PKLite/Impenetrable) is bit-identical to every pre-P3 caller's
|
||||
/// hardcoded <c>IsPlayer | EdgeSlide</c> — the non-PK invariant this
|
||||
/// port must not break.
|
||||
/// </summary>
|
||||
public ObjectInfoState OwnPvpFlags { get; set; } = ObjectInfoState.None;
|
||||
|
||||
/// <summary>
|
||||
/// TS-46 (2026-07-30): the player's own Setup ≤2-sphere list (dat
|
||||
/// <c>CSphere</c> Origin+Radius), verbatim per retail
|
||||
|
|
@ -930,6 +945,22 @@ public sealed class PlayerMovementController
|
|||
_weenie.SetStamina(currentStamina < 0 ? null : (uint)currentStamina);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TS-23 §12b (Campaign P Slice P3, 2026-07-30): pushes the raw
|
||||
/// <c>PlayerKillerStatus</c>/<c>LastPkAttackTimestamp</c> pair into
|
||||
/// <see cref="PlayerWeenie.JumpStaminaCost"/>'s PK-timer bump. A
|
||||
/// negative <paramref name="playerKillerStatus"/> restores "never
|
||||
/// pushed" (matches <see cref="SetCharacterStamina"/>'s own sentinel
|
||||
/// convention); <paramref name="lastPkAttackTimestamp"/> is <c>null</c>
|
||||
/// when the property is absent.
|
||||
/// </summary>
|
||||
public void SetCharacterPkStatus(int playerKillerStatus, float? lastPkAttackTimestamp)
|
||||
{
|
||||
_weenie.SetPlayerKillerStatus(
|
||||
playerKillerStatus < 0 ? null : playerKillerStatus,
|
||||
lastPkAttackTimestamp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// R3-W2 (r3-port-plan.md §4): the player's <see cref="MotionInterpreter"/>
|
||||
/// — GameWindow binds the player sequencer's MotionDone seam to it so the
|
||||
|
|
@ -1418,7 +1449,10 @@ public sealed class PlayerMovementController
|
|||
stepDownHeight: StepDownHeight,
|
||||
isOnGround: previousOnWalkable,
|
||||
body: _body,
|
||||
moverFlags: ObjectInfoState.IsPlayer | ObjectInfoState.EdgeSlide,
|
||||
// TS-23: OwnPvpFlags is None for every non-PK character
|
||||
// (the default), so this OR is a no-op for the common
|
||||
// case and bit-identical to the pre-P3 hardcoded value.
|
||||
moverFlags: ObjectInfoState.IsPlayer | ObjectInfoState.EdgeSlide | OwnPvpFlags,
|
||||
movingEntityId: LocalEntityId,
|
||||
// TS-46: the player's own Setup sphere list, scaled by
|
||||
// ObjectScale. Empty falls back to the 0.48/1.835
|
||||
|
|
@ -1859,12 +1893,15 @@ public sealed class PlayerMovementController
|
|||
// under the same flag profile as retail player movement.
|
||||
//
|
||||
// Commit C 2026-04-29 — local player is always IsPlayer.
|
||||
// The PK/PKLite/Impenetrable bits come from PlayerDescription's
|
||||
// PlayerKillerStatus property; not yet parsed (non-PK pair → walks
|
||||
// through other non-PK players, which is retail's default for
|
||||
// ACE's character creation defaults too).
|
||||
// TS-23 (2026-07-30): OwnPvpFlags carries the real
|
||||
// PK/PKLite/Impenetrable bits, decoded from the player's own
|
||||
// PublicWeenieDesc._bitfield (default None — a no-op OR for
|
||||
// every non-PK character, bit-identical to the pre-P3 value;
|
||||
// non-PK pair still walks through other non-PK players,
|
||||
// retail's default for ACE's character creation defaults).
|
||||
moverFlags: AcDream.Core.Physics.ObjectInfoState.IsPlayer
|
||||
| AcDream.Core.Physics.ObjectInfoState.EdgeSlide,
|
||||
| AcDream.Core.Physics.ObjectInfoState.EdgeSlide
|
||||
| OwnPvpFlags,
|
||||
// Fix #42: skip self in FindObjCollisions. Wired by GameWindow
|
||||
// when the local player entity spawns (or stays 0 in tests, in
|
||||
// which case there's no registered ShadowEntry to collide with
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue