b451f83174
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
43 lines
1.7 KiB
C#
43 lines
1.7 KiB
C#
namespace Theriapolis.Core.Data;
|
|
|
|
/// <summary>
|
|
/// Phase 6 M0 — bundle of all settlement-stamp content needed to drive
|
|
/// <see cref="World.Settlements.SettlementStamper"/>. Held by
|
|
/// <see cref="ContentResolver"/>; passed into <see cref="Tactical.TacticalChunkGen"/>
|
|
/// as an optional argument so headless tools that don't need full content
|
|
/// (e.g. worldgen-dump) can run without it.
|
|
/// </summary>
|
|
public sealed class SettlementContent
|
|
{
|
|
public IReadOnlyDictionary<string, BuildingTemplateDef> Buildings { get; }
|
|
public IReadOnlyDictionary<string, SettlementLayoutDef> PresetByAnchor { get; }
|
|
|
|
/// <summary>Tier 1..5 → procedural layout (or null if no procedural layout for that tier).</summary>
|
|
public IReadOnlyDictionary<int, SettlementLayoutDef> ProceduralByTier { get; }
|
|
|
|
public SettlementContent(
|
|
IReadOnlyDictionary<string, BuildingTemplateDef> buildings,
|
|
IReadOnlyDictionary<string, SettlementLayoutDef> presetByAnchor,
|
|
IReadOnlyDictionary<int, SettlementLayoutDef> proceduralByTier)
|
|
{
|
|
Buildings = buildings;
|
|
PresetByAnchor = presetByAnchor;
|
|
ProceduralByTier = proceduralByTier;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Look up the layout to use for a given settlement, preferring the
|
|
/// hand-authored preset for its anchor (if any) and falling back to the
|
|
/// procedural layout for its tier.
|
|
/// </summary>
|
|
public SettlementLayoutDef? ResolveFor(World.Settlement settlement)
|
|
{
|
|
if (settlement.Anchor is { } anchor &&
|
|
PresetByAnchor.TryGetValue(anchor.ToString(), out var preset))
|
|
return preset;
|
|
if (ProceduralByTier.TryGetValue(settlement.Tier, out var proc))
|
|
return proc;
|
|
return null;
|
|
}
|
|
}
|