refactor(runtime): own projectile simulation
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.
This commit is contained in:
parent
fce8e7b18e
commit
2aee33569f
19 changed files with 1255 additions and 335 deletions
40
src/AcDream.Runtime/Physics/RuntimeProjectile.cs
Normal file
40
src/AcDream.Runtime/Physics/RuntimeProjectile.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
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++;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue