acdream/src/AcDream.Runtime/RuntimeSimulationOwnership.cs
Erik cdee7a4b49 refactor(runtime): close simulation ownership
Move remote-motion construction, CreateObject vector initialization, final simulation-component retirement, and the combined J5 ownership ledger into Runtime. Delete App compatibility views and moved-state reconstruction while preserving the existing graphical projection and retail update order.
2026-07-26 15:53:31 +02:00

44 lines
1.5 KiB
C#

using AcDream.Runtime.Entities;
using AcDream.Runtime.Gameplay;
using AcDream.Runtime.Physics;
namespace AcDream.Runtime;
/// <summary>
/// One allocation-free terminal ownership ledger for the complete J5
/// presentation-independent simulation graph. It owns no mutable state.
/// Graphical and no-window hosts inspect the same canonical owners.
/// </summary>
public readonly record struct RuntimeSimulationOwnershipSnapshot(
RuntimeEntityObjectOwnershipSnapshot EntityObjects,
RuntimePhysicsOwnershipSnapshot Physics,
RuntimeGameplayOwnershipSnapshot Gameplay)
{
public bool IsConverged =>
EntityObjects.IsConverged
&& Physics.IsConverged
&& Gameplay.IsConverged;
}
public static class RuntimeSimulationOwnership
{
public static RuntimeSimulationOwnershipSnapshot Capture(
RuntimeEntityObjectLifetime entityObjects,
RuntimeInventoryState inventory,
RuntimeCharacterState character,
RuntimeCommunicationState communication,
RuntimeActionState actions,
RuntimeLocalPlayerMovementState movement)
{
ArgumentNullException.ThrowIfNull(entityObjects);
return new RuntimeSimulationOwnershipSnapshot(
entityObjects.CaptureOwnership(),
entityObjects.Physics.CaptureOwnership(),
RuntimeGameplayOwnership.Capture(
inventory,
character,
communication,
actions,
movement));
}
}