Refactor alot of stuff
This commit is contained in:
@@ -22,6 +22,16 @@ namespace KernelPanic.Combat
|
||||
/// <summary>Bounded persistent work, advanced only by the authoritative Interpret phase.</summary>
|
||||
public sealed class GoroutineScheduler
|
||||
{
|
||||
// Explicit checkpoint values: no gameplay hooks or random draws during restoration.
|
||||
internal GoroutineSchedulerValues CaptureValues() => new()
|
||||
{
|
||||
_nextId = _nextId,
|
||||
};
|
||||
internal void RestoreValues(GoroutineSchedulerValues value)
|
||||
{
|
||||
_nextId = value._nextId;
|
||||
}
|
||||
|
||||
public const int Capacity = 3, MaximumTicks = 5;
|
||||
private readonly List<Goroutine> _active = new();
|
||||
private long _nextId;
|
||||
@@ -65,5 +75,7 @@ namespace KernelPanic.Combat
|
||||
return true;
|
||||
}
|
||||
public void Clear() { foreach (var work in _active.ToArray()) Terminate(work); }
|
||||
internal void RestoreActive(IEnumerable<Goroutine> active)
|
||||
{ _active.Clear(); _active.AddRange(active); }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user