Move Position, Vector, State, Movement, and equal-generation CreateObject routing out of GameWindow while preserving per-channel authority, ForcePosition acknowledgement, and motion-runtime ownership. Add adversarial authority and exact-wire coverage so reentrant updates and GUID reuse cannot publish stale state.
88 lines
3.7 KiB
C#
88 lines
3.7 KiB
C#
using System.Collections;
|
|
using System.Reflection;
|
|
using AcDream.App.Physics;
|
|
using AcDream.App.Rendering;
|
|
using AcDream.App.World;
|
|
|
|
namespace AcDream.App.Tests.World;
|
|
|
|
public sealed class GameWindowLiveEntityCompositionTests
|
|
{
|
|
private const BindingFlags PrivateImplementation =
|
|
BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic;
|
|
|
|
[Theory]
|
|
[InlineData("RegisterLiveEntityCollision")]
|
|
[InlineData("MotionTableDefaultPose")]
|
|
[InlineData("LeaveWorldLiveEntityRuntimeComponents")]
|
|
[InlineData("WithdrawLiveEntityWorldProjection")]
|
|
[InlineData("RebindAnimatedEntityForAppearance")]
|
|
[InlineData("OnLiveEntitySpawned")]
|
|
[InlineData("OnLiveEntitySpawnedLocked")]
|
|
[InlineData("RehydrateServerEntitiesForLandblock")]
|
|
[InlineData("TryInitializeLiveCenter")]
|
|
[InlineData("CompleteLiveEntityReady")]
|
|
[InlineData("OnLiveAppearanceUpdated")]
|
|
[InlineData("OnLiveEntityPickedUp")]
|
|
[InlineData("OnLiveParentUpdated")]
|
|
[InlineData("TryAcceptParentForRender")]
|
|
[InlineData("OnLiveEntityDeleted")]
|
|
[InlineData("OnLiveEntityPruned")]
|
|
[InlineData("TearDownLiveEntityRuntimeComponents")]
|
|
[InlineData("CreateLiveEntityRuntimeTeardownPlan")]
|
|
[InlineData("RouteSameGenerationCreateObject")]
|
|
[InlineData("OnLiveMotionUpdated")]
|
|
[InlineData("OnLivePositionUpdated")]
|
|
[InlineData("OnLiveVectorUpdated")]
|
|
[InlineData("OnLiveStateUpdated")]
|
|
[InlineData("EnsureRemoteMotionBindings")]
|
|
[InlineData("ResolvePhysicsHost")]
|
|
[InlineData("GetSetupCylinder")]
|
|
[InlineData("RouteServerMoveTo")]
|
|
[InlineData("StickToObjectFromWire")]
|
|
[InlineData("ClearTargetForHiddenEntity")]
|
|
[InlineData("ApplyServerControlledVelocityCycle")]
|
|
[InlineData("RunRemoteTeleportHook")]
|
|
[InlineData("SendImmediateLocalPositionEvent")]
|
|
[InlineData("DispatchRemoteInboundMotion")]
|
|
[InlineData("CreateRemoteMotion")]
|
|
[InlineData("WillAdvanceRemoteMotion")]
|
|
public void GameWindow_DoesNotReacquireExtractedLiveEntityBodies(string methodName)
|
|
{
|
|
Assert.Null(typeof(GameWindow).GetMethod(methodName, PrivateImplementation));
|
|
}
|
|
|
|
[Fact]
|
|
public void GameWindow_DoesNotOwnAnAppearanceUpdateStateType()
|
|
{
|
|
Assert.Null(typeof(GameWindow).GetNestedType(
|
|
"AppearanceUpdateState",
|
|
BindingFlags.NonPublic));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(typeof(LiveEntityCollisionBuilder))]
|
|
[InlineData(typeof(LiveEntityDefaultPoseResolver))]
|
|
[InlineData(typeof(LiveEntityProjectionWithdrawalController))]
|
|
[InlineData(typeof(LocalPlayerShadowState))]
|
|
[InlineData(typeof(LiveEntityAppearanceBinding))]
|
|
[InlineData(typeof(LiveEntityHydrationController))]
|
|
[InlineData(typeof(DatLiveEntityProjectionMaterializer))]
|
|
[InlineData(typeof(LiveEntityRuntimeTeardownController))]
|
|
[InlineData(typeof(LiveEntityNetworkUpdateController))]
|
|
[InlineData(typeof(LiveEntityMotionRuntimeController))]
|
|
[InlineData(typeof(LiveEntityInboundAuthorityGate))]
|
|
[InlineData(typeof(DeferredLiveEntityMotionRuntimeBindings))]
|
|
public void ExtractedHelpers_DoNotOwnGuidIndexesOrBackendState(Type helperType)
|
|
{
|
|
foreach (FieldInfo field in helperType.GetFields(
|
|
BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic))
|
|
{
|
|
Assert.False(typeof(IDictionary).IsAssignableFrom(field.FieldType),
|
|
$"{helperType.Name}.{field.Name} must resolve identity through LiveEntityRuntime.");
|
|
string typeName = field.FieldType.FullName ?? field.FieldType.Name;
|
|
Assert.DoesNotContain("Silk.NET", typeName, StringComparison.Ordinal);
|
|
Assert.DoesNotContain("OpenGL", typeName, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
}
|
|
}
|