refactor(world): extract live entity teardown
This commit is contained in:
parent
4427cfb2c7
commit
f38822c490
8 changed files with 565 additions and 159 deletions
27
src/AcDream.App/Physics/RemoteMovementObservationTracker.cs
Normal file
27
src/AcDream.App/Physics/RemoteMovementObservationTracker.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System.Numerics;
|
||||
|
||||
namespace AcDream.App.Physics;
|
||||
|
||||
/// <summary>
|
||||
/// Session-scoped observation timestamps used to infer when a remote
|
||||
/// locomotion cycle has stopped. Canonical live identity remains in
|
||||
/// <c>LiveEntityRuntime</c>; this owner contains only derived observer state.
|
||||
/// </summary>
|
||||
internal sealed class RemoteMovementObservationTracker
|
||||
{
|
||||
private readonly Dictionary<uint, (Vector3 Pos, DateTime Time)> _lastMove = new();
|
||||
|
||||
internal (Vector3 Pos, DateTime Time) this[uint serverGuid]
|
||||
{
|
||||
set => _lastMove[serverGuid] = value;
|
||||
}
|
||||
|
||||
internal bool TryGetValue(
|
||||
uint serverGuid,
|
||||
out (Vector3 Pos, DateTime Time) observation) =>
|
||||
_lastMove.TryGetValue(serverGuid, out observation);
|
||||
|
||||
internal bool Remove(uint serverGuid) => _lastMove.Remove(serverGuid);
|
||||
|
||||
internal void Clear() => _lastMove.Clear();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue