Carries the parsed dat objects ApplyLoadedTerrainLocked needs so the worker can pre-read them and the apply can run lock-free. Optional field (default null) keeps existing LoadedLandblock construction back-compatible. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
30 lines
1.3 KiB
C#
30 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using DatReaderWriter.DBObjs;
|
|
// Environment collides with System.Environment under implicit usings — alias it.
|
|
using DatEnvironment = DatReaderWriter.DBObjs.Environment;
|
|
|
|
namespace AcDream.Core.World;
|
|
|
|
/// <summary>
|
|
/// The parsed dat objects <c>ApplyLoadedTerrainLocked</c> needs, pre-read by the
|
|
/// streaming worker under <c>_datLock</c> so the apply makes ZERO DatCollection
|
|
/// calls and the update thread never blocks on the worker's lock (the FPS
|
|
/// 30↔200 swing was that lock-wait). Keyed by the same dat id the apply would
|
|
/// have passed to <c>_dats.Get<T></c>.
|
|
/// </summary>
|
|
public sealed record PhysicsDatBundle(
|
|
LandBlockInfo? Info,
|
|
IReadOnlyDictionary<uint, EnvCell> EnvCells,
|
|
IReadOnlyDictionary<uint, DatEnvironment> Environments,
|
|
IReadOnlyDictionary<uint, Setup> Setups,
|
|
IReadOnlyDictionary<uint, GfxObj> GfxObjs)
|
|
{
|
|
/// <summary>Empty bundle for far-tier landblocks (no cells / buildings /
|
|
/// entities) and for non-streaming <see cref="LoadedLandblock"/> construction.</summary>
|
|
public static readonly PhysicsDatBundle Empty = new(
|
|
null,
|
|
new Dictionary<uint, EnvCell>(),
|
|
new Dictionary<uint, DatEnvironment>(),
|
|
new Dictionary<uint, Setup>(),
|
|
new Dictionary<uint, GfxObj>());
|
|
}
|