public readonly struct RewindScopeA world that is in the past, and the promise that it will not stay there.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The restore is the important half, and it is the half that is easy to lose. A rewound query is a handful of lines — move the bodies, cast, read the answer — and every one of those lines can throw, return early, or grow a branch six months later that forgets to put the world back. A world left in the past does not fail: it simulates, replicates and looks entirely normal, with every player standing where they were a fifth of a second ago, for ever. Making the restore a using is what turns that from a thing you must remember into a thing the compiler does.
using var rewind = compensator.RewindFor(claim.Tick, player.RoundTrip.RoundTrip);
Disposing twice is harmless, and disposing a scope whose compensator has already been restored some other way is harmless too. Both are what a finally does on a path that has already unwound.
Fields and properties (2)
public Tick AtThe tick the world was moved to.
public int BodyCountHow many bodies were actually moved.
Methods (6)
public void Dispose()Puts every body back where the simulation left it.
public bool Equals(RewindScope other)Indicates whether the current object is equal to another object of the same type.
public override bool Equals(object? obj)Indicates whether this instance and a specified object are equal.
public override int GetHashCode()Returns the hash code for this instance.
public static bool operator ==(RewindScope left, RewindScope right)Whether two scopes are the same one.
public static bool operator !=(RewindScope left, RewindScope right)Whether two scopes are different.
Used by (2)
- LagCompensationTestsVixen.Net.Physics.Tests
- LagCompensatorVixen.Net.Physics