Skip to main content

CachedSyncChannel

A internal class in Root.Township, the global namespace. Reach it through att-stubs' publicized assemblies or Harmony's AccessTools.

Remembers the NetworkEntity.SyncChannel that was active when it was made, so async code can send on that same channel later. Used by Postbox, MapManager, Controller and DiggingImpactor across awaits.

Constructors​

MemberWhat it is
CachedSyncChannel()Creates a CachedSyncChannel with default values.

Fields​

2 private and internal fields
MemberWhat it is
private ConnectionChannel cacheThe sync channel captured in the constructor.
private ConnectionChannel returnToThe sync channel that was active when Activate was called.

Methods​

MemberWhat it is
IDisposable Activate()Sets NetworkEntity.SyncChannel back to the cached channel and returns this, so a using block restores the old one after.
void Dispose()Puts back the sync channel that was active before Activate.