Files
mrgameeng/src/MrGameEng.Content/Mods/Def.cs
T

31 lines
1.1 KiB
C#

namespace MrGameEng.Mods;
/// <summary>
/// Base class of all data definitions loaded by <see cref="DefDatabase"/> from mod JSON.
/// Games subclass this per content kind (terrain, things, pawns, …) with plain
/// serializable properties.
/// </summary>
public abstract class Def
{
/// <summary>
/// Unique name within the def type. A later mod redefining the same name fully
/// replaces the earlier def.
/// </summary>
public string DefName { get; init; } = "";
/// <summary>
/// Name of the def (same type) whose fields this def starts from; own fields override
/// the inherited ones. Abstractness is not inherited.
/// </summary>
public string? Parent { get; init; }
/// <summary>Abstract defs only serve as parents and are not emitted into the database.</summary>
public bool Abstract { get; init; }
/// <summary>Display label — plain text or a localization key, as the game decides.</summary>
public string Label { get; init; } = "";
/// <inheritdoc />
public override string ToString() => $"{GetType().Name} {DefName}";
}