Initial commit: Theriapolis baseline at port/godot branch point
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>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
namespace Theriapolis.Core.World.Settlements;
|
||||
|
||||
/// <summary>
|
||||
/// Phase 6 M0 — runtime record of a single stamped building inside a
|
||||
/// settlement. Created by <see cref="SettlementStamper"/> at chunk-gen time
|
||||
/// and attached to the parent <see cref="World.Settlement"/>.
|
||||
///
|
||||
/// Buildings can straddle chunk boundaries; the footprint is in
|
||||
/// world-pixel (= tactical-tile) coordinates so cross-chunk lookups
|
||||
/// (e.g. "is the player inside the Millhaven inn?") work without per-chunk
|
||||
/// reconstruction.
|
||||
/// </summary>
|
||||
public sealed class BuildingFootprint
|
||||
{
|
||||
/// <summary>Unique id within the parent settlement (sequential, 0-based).</summary>
|
||||
public int Id { get; init; }
|
||||
|
||||
/// <summary>Building template id (e.g. "inn_small").</summary>
|
||||
public string TemplateId { get; init; } = "";
|
||||
|
||||
/// <summary>Inclusive minimum X in world-pixel space.</summary>
|
||||
public int MinX { get; init; }
|
||||
|
||||
/// <summary>Inclusive minimum Y in world-pixel space.</summary>
|
||||
public int MinY { get; init; }
|
||||
|
||||
/// <summary>Inclusive maximum X in world-pixel space.</summary>
|
||||
public int MaxX { get; init; }
|
||||
|
||||
/// <summary>Inclusive maximum Y in world-pixel space.</summary>
|
||||
public int MaxY { get; init; }
|
||||
|
||||
/// <summary>Door positions in world-pixel space (one entry per door).</summary>
|
||||
public (int X, int Y)[] Doors { get; init; } = Array.Empty<(int, int)>();
|
||||
|
||||
/// <summary>Resident slots: role tag (possibly anchor-prefixed) → spawn position in world-pixel space.</summary>
|
||||
public BuildingResidentSlot[] Residents { get; init; } = Array.Empty<BuildingResidentSlot>();
|
||||
|
||||
public bool ContainsTile(int worldPxX, int worldPxY)
|
||||
=> worldPxX >= MinX && worldPxX <= MaxX
|
||||
&& worldPxY >= MinY && worldPxY <= MaxY;
|
||||
}
|
||||
|
||||
/// <summary>One resident slot inside a building.</summary>
|
||||
public readonly struct BuildingResidentSlot
|
||||
{
|
||||
/// <summary>Role tag — either generic ("innkeeper") or anchor-qualified ("millhaven.innkeeper").</summary>
|
||||
public readonly string RoleTag;
|
||||
|
||||
/// <summary>Spawn point in world-pixel (tactical-tile) coordinates.</summary>
|
||||
public readonly int SpawnX;
|
||||
public readonly int SpawnY;
|
||||
|
||||
/// <summary>Optional category match for procedural residents — passed through from BuildingTemplateDef.Category.</summary>
|
||||
public readonly string Category;
|
||||
|
||||
public BuildingResidentSlot(string roleTag, int spawnX, int spawnY, string category)
|
||||
{
|
||||
RoleTag = roleTag;
|
||||
SpawnX = spawnX;
|
||||
SpawnY = spawnY;
|
||||
Category = category;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user