Issue stable Runtime identities at canonical registration, publish entity and inventory commits through one generation-stamped synchronous stream, and make graphical adapters borrow the same direct views and events as a no-window host. Preserve exact projection teardown and retail mutation order while removing App-side event reconstruction. Make the hard-recenter ordering fixture independent of the production two-millisecond frame budget so its injected-failure gate is deterministic. Co-authored-by: Codex <codex@openai.com>
137 lines
3 KiB
C#
137 lines
3 KiB
C#
using AcDream.Core.Physics;
|
|
|
|
namespace AcDream.Runtime;
|
|
|
|
public readonly record struct RuntimeEntityIdentity(
|
|
uint ServerGuid,
|
|
uint LocalEntityId,
|
|
ushort Incarnation);
|
|
|
|
public readonly record struct RuntimeEntitySnapshot(
|
|
RuntimeEntityIdentity Identity,
|
|
uint CellId,
|
|
uint PhysicsState,
|
|
Position? Position);
|
|
|
|
public interface IRuntimeEntityVisitor
|
|
{
|
|
void Visit(in RuntimeEntitySnapshot entity);
|
|
}
|
|
|
|
public interface IRuntimeEntityView
|
|
{
|
|
int Count { get; }
|
|
|
|
bool TryGet(uint serverGuid, out RuntimeEntitySnapshot entity);
|
|
|
|
/// <summary>
|
|
/// Visits the canonical owner synchronously without copying its mutable
|
|
/// collection. The visitor must not retain references or mutate runtime
|
|
/// ownership during the call.
|
|
/// </summary>
|
|
void Visit(IRuntimeEntityVisitor visitor);
|
|
}
|
|
|
|
public readonly record struct RuntimeInventoryItemSnapshot(
|
|
uint ObjectId,
|
|
ushort Incarnation,
|
|
string Name,
|
|
uint ContainerId,
|
|
int ContainerSlot,
|
|
uint WielderId,
|
|
uint EquipLocation,
|
|
int StackSize,
|
|
int Value);
|
|
|
|
public interface IRuntimeInventoryVisitor
|
|
{
|
|
void Visit(in RuntimeInventoryItemSnapshot item);
|
|
}
|
|
|
|
public interface IRuntimeInventoryView
|
|
{
|
|
int ObjectCount { get; }
|
|
|
|
int ContainerCount { get; }
|
|
|
|
bool TryGet(uint objectId, out RuntimeInventoryItemSnapshot item);
|
|
|
|
/// <inheritdoc cref="IRuntimeEntityView.Visit"/>
|
|
void Visit(IRuntimeInventoryVisitor visitor);
|
|
}
|
|
|
|
public interface IRuntimeChatView
|
|
{
|
|
long Revision { get; }
|
|
|
|
int Count { get; }
|
|
}
|
|
|
|
public readonly record struct RuntimeMovementSnapshot(
|
|
bool HasController,
|
|
uint LocalEntityId,
|
|
Position Position,
|
|
System.Numerics.Vector3 Velocity,
|
|
bool IsAirborne,
|
|
double SimulationTimeSeconds);
|
|
|
|
public interface IRuntimeMovementView
|
|
{
|
|
RuntimeMovementSnapshot Snapshot { get; }
|
|
}
|
|
|
|
public enum RuntimePortalKind
|
|
{
|
|
None,
|
|
Login,
|
|
Portal,
|
|
}
|
|
|
|
public readonly record struct RuntimePortalSnapshot(
|
|
long Generation,
|
|
RuntimePortalKind Kind,
|
|
uint DestinationCell,
|
|
bool IsReady,
|
|
bool IsMaterialized,
|
|
bool IsCompleted,
|
|
bool IsCancelled,
|
|
bool IsWorldVisible);
|
|
|
|
public interface IRuntimePortalView
|
|
{
|
|
RuntimePortalSnapshot Snapshot { get; }
|
|
}
|
|
|
|
public readonly record struct RuntimeStateCheckpoint(
|
|
RuntimeGenerationToken Generation,
|
|
RuntimeLifecycleState Lifecycle,
|
|
ulong FrameNumber,
|
|
int EntityCount,
|
|
int MaterializedEntityCount,
|
|
int InventoryObjectCount,
|
|
int InventoryContainerCount,
|
|
long ChatRevision,
|
|
int ChatCount,
|
|
RuntimeMovementSnapshot Movement,
|
|
RuntimePortalSnapshot Portal);
|
|
|
|
public interface IGameRuntimeView
|
|
{
|
|
RuntimeGenerationToken Generation { get; }
|
|
|
|
RuntimeLifecycleSnapshot Lifecycle { get; }
|
|
|
|
IGameRuntimeClock Clock { get; }
|
|
|
|
IRuntimeEntityView Entities { get; }
|
|
|
|
IRuntimeInventoryView Inventory { get; }
|
|
|
|
IRuntimeChatView Chat { get; }
|
|
|
|
IRuntimeMovementView Movement { get; }
|
|
|
|
IRuntimePortalView Portal { get; }
|
|
|
|
RuntimeStateCheckpoint CaptureCheckpoint();
|
|
}
|