fix(physics): AP-129 review fix - port CanMoveInto/IsAllowedIn, stop failing closed
Campaign P Slice P4 Opus review verdict: FIX-FIRST. RestrictionObjPrevalenceInspectionTests
(commit 3b5e0992) found 103,766 of 729,888 installed EnvCells (1,293 landblocks -
the whole housing estate) carry a baked RestrictionObj. The AP-71 gate's
unconditional fail-closed default (CanMoveInto unmodeled) would have locked
every apartment/cottage/villa interior for every player, including its own
owner - a live regression, not the "inert in dev content" the original
register row assumed.
Ports ACCWeenieObject::CanMoveInto (0x0058da40, pc:407982-408056) and
RestrictionDB::IsAllowedIn (0x005ae8f0, pc:444493-444516) verbatim into
ObjectInfo.CheckEntryRestrictions:
- owner_iid == 0 or == mover's own guid -> admit (open/owner)
- no RestrictionDB (retail _db == 0, i.e. never authored or not yet
received) -> admit
- present RestrictionDB -> IsAllowedIn: open-to-public flag, OR mover
shares the house's allegiance monarch, OR mover's own guid is a
guest-table member
- unresolved restriction object -> fails CLOSED, exactly retail's own
fallback when GetObjectA can't resolve it (pc:704-716)
Wire feed (Core.Net):
- CreateObject.cs: HouseOwner (WeenieHeaderFlag 0x02000000), HouseRestrictions
(0x04000000), and Monarch (0x40) PWD-tail fields were parsed-and-skipped;
now captured. Also fixes the HouseRestrictions PHashTable header
misconception: the wire is ONE packed u32 (low 24 bits = entry count),
not a separate count(u16)+numBuckets(u16) pair - verified against
Chorizite's RestrictionDB.generated.cs. The old skip's byte-count
happened to match for realistic guest-list sizes, but a future
numBuckets value >255 would have corrupted the parse; now correct
regardless.
- GameEvents.cs/GameEventWiring.cs: new House_UpdateRestrictions (0x0248)
parser + wiring - retail's live guest-list refresh, whole-unit replace.
No-ops if the house object hasn't arrived via CreateObject yet.
- ClientObject/WeenieData/ClientObjectTable: HouseOwnerId, MonarchId,
Restrictions (new HouseRestrictionRecord) fields + merge-preserving
Ingest + targeted UpdateHouseRestrictions.
Physics wiring:
- PhysicsEngine gains an Objects (ClientObjectTable?) property, mirroring
the existing DataCache pattern - acdream's GetObjectA equivalent, used
ONLY by the entry-restriction gate.
- RuntimeEntityObjectLifetime wires Physics.Engine.Objects = Objects in
all three constructors, right alongside the table's own construction -
the same canonical table every other subsystem borrows from, never a
second one. This is the production fix: without it the gate still fails
closed on every restricted cell (unresolvable object), so the wiring is
load-bearing, not cosmetic.
Register: AP-129 narrowed (not retired) to the genuine remaining residual -
House_UpdateRestrictions' Sequence byte isn't used for staleness/reordering
rejection (low-probability, self-correcting), and outdoor CLandCell
restriction (a separate DAT structure) remains unported and unaffected by
this fix.
Tests: 15 new/updated in Ap71EntryRestrictionGateTests.cs (resolved-unowned
admits, owner admits, present-list-excluded blocks, present-list-included
admits, open-to-public admits, shared-allegiance-monarch admits, unresolved
blocks via null and via an empty table, plus two new end-to-end
PhysicsEngine.Objects-wired scenarios); 2 new CreateObject parser tests +
2 new GameEventWiring tests for the wire feed.
AcDream.Core.Tests: 4049 passed, 2 skipped, 0 failed.
AcDream.Core.Net.Tests: 761 passed, 0 skipped, 0 failed.
Complete solution suite: 9,961 total, 9,956 passed, 5 skipped, 0 failed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
dc0468cc2b
commit
7a0f836af5
15 changed files with 704 additions and 81 deletions
|
|
@ -27,6 +27,13 @@ public sealed class GameEventWiringTests
|
|||
return result;
|
||||
}
|
||||
|
||||
private static void AppendU32(List<byte> payload, uint value)
|
||||
{
|
||||
byte[] u32 = new byte[4];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(u32, value);
|
||||
payload.AddRange(u32);
|
||||
}
|
||||
|
||||
private static byte[] WrapEnvelope(GameEventType type, byte[] payload)
|
||||
{
|
||||
byte[] body = new byte[GameEventEnvelope.HeaderSize + payload.Length];
|
||||
|
|
@ -222,6 +229,65 @@ public sealed class GameEventWiringTests
|
|||
Assert.Equal(new[] { 0x1500u }, wieldConfirmed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AP-129 (Campaign P Slice P4 review fix, 2026-07-30): 0x0248
|
||||
/// House_UpdateRestrictions refreshes an already-known house object's
|
||||
/// guest/ban list. Wire shape verified against Chorizite
|
||||
/// House_UpdateRestrictions.generated.cs: byte Sequence, uint SenderId,
|
||||
/// then RestrictionDB (Version u32, Flags u32, MonarchId u32, PHashTable
|
||||
/// packed-u32-count + count × (guid u32 + value u32)).
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void WireAll_HouseUpdateRestrictions_UpdatesClientObjectTable()
|
||||
{
|
||||
var (d, items, _, _, _) = MakeAll();
|
||||
const uint houseGuid = 0x70200099u;
|
||||
items.AddOrUpdate(new ClientObject { ObjectId = houseGuid, WeenieClassId = 1 });
|
||||
|
||||
var payload = new List<byte>();
|
||||
payload.Add(5); // Sequence
|
||||
AppendU32(payload, houseGuid); // SenderId
|
||||
AppendU32(payload, 0x10000002u); // Version
|
||||
AppendU32(payload, 0u); // Flags (private)
|
||||
AppendU32(payload, 0x50000500u); // MonarchId
|
||||
AppendU32(payload, 1u); // PHashTable packed size (count=1)
|
||||
AppendU32(payload, 0x50000001u); // guest guid
|
||||
AppendU32(payload, 1u); // guest permission (storage)
|
||||
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.HouseUpdateRestrictions, payload.ToArray()));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
var house = items.Get(houseGuid);
|
||||
Assert.NotNull(house);
|
||||
Assert.NotNull(house!.Restrictions);
|
||||
Assert.False(house.Restrictions!.OpenToPublic);
|
||||
Assert.Equal(0x50000500u, house.Restrictions.AllegianceMonarchId);
|
||||
Assert.Single(house.Restrictions.Guests);
|
||||
Assert.Equal(1u, house.Restrictions.Guests[0x50000001u]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_HouseUpdateRestrictions_UnknownHouseObject_NoOps()
|
||||
{
|
||||
// Retail's own client would only receive this for an object it already
|
||||
// knows about; a stub half-formed ClientObject must not be invented.
|
||||
var (d, items, _, _, _) = MakeAll();
|
||||
const uint unknownHouseGuid = 0x70200100u;
|
||||
|
||||
var payload = new List<byte>();
|
||||
payload.Add(1);
|
||||
AppendU32(payload, unknownHouseGuid);
|
||||
AppendU32(payload, 0x10000002u);
|
||||
AppendU32(payload, 1u); // open
|
||||
AppendU32(payload, 0u);
|
||||
AppendU32(payload, 0u); // zero guests
|
||||
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.HouseUpdateRestrictions, payload.ToArray()));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
Assert.Null(items.Get(unknownHouseGuid));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_ConfirmationRequest_UsesRetailTwoIntegerHeader()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue