Move projectile component identity, prediction invalidation, spatial worksets, authoritative corrections, and the retail physics step into AcDream.Runtime. Keep App as the DAT-shape and presentation adapter so ACE outcomes and visible behavior remain unchanged.
40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using AcDream.Core.Physics;
|
|
|
|
namespace AcDream.Runtime.Physics;
|
|
|
|
/// <summary>
|
|
/// Presentation-free projectile component attached to one canonical Runtime
|
|
/// entity incarnation. The body is retail's one <c>CPhysicsObj</c>; the
|
|
/// prepared Setup sphere and prediction version die with the same incarnation.
|
|
/// </summary>
|
|
public interface IRuntimeProjectile
|
|
{
|
|
PhysicsBody Body { get; }
|
|
ProjectileCollisionSphere CollisionSphere { get; }
|
|
ulong PredictionAuthorityVersion { get; }
|
|
}
|
|
|
|
internal sealed class RuntimeProjectile : IRuntimeProjectile
|
|
{
|
|
internal RuntimeProjectile(
|
|
PhysicsBody body,
|
|
ProjectileCollisionSphere collisionSphere)
|
|
{
|
|
Body = body ?? throw new ArgumentNullException(nameof(body));
|
|
if (!collisionSphere.IsValid)
|
|
{
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(collisionSphere),
|
|
"A Runtime projectile requires one valid prepared Setup sphere.");
|
|
}
|
|
|
|
CollisionSphere = collisionSphere;
|
|
}
|
|
|
|
public PhysicsBody Body { get; }
|
|
public ProjectileCollisionSphere CollisionSphere { get; }
|
|
public ulong PredictionAuthorityVersion { get; private set; }
|
|
|
|
internal void InvalidatePrediction() =>
|
|
PredictionAuthorityVersion++;
|
|
}
|