rimworld-blax-laws/Source/BlaxLaws/Model/Enums.cs

140 lines
5.0 KiB
C#

using System;
using Verse;
namespace BlaxLaws
{
/// <summary>
/// A law's stage. Planning: a break has started and nothing is done yet (break entries only). Did it:
/// the act happened. Saved by name, so the names never change.
/// </summary>
public enum LawStage
{
Planning,
DidIt,
}
/// <summary>A law's severity. Sets the default days (1, 3, 5, 10) and orders the case log. Saved by name.</summary>
public enum LawSeverity
{
Minor,
Moderate,
Serious,
Grave,
}
/// <summary>Where a case stands. Saved by name.</summary>
public enum CaseStatus
{
/// <summary>Filed; nothing runs yet, or it waits (no bed, no enforcer, danger, a hold).</summary>
Open,
/// <summary>An enforcer is on it (a subdue, an arrest or a capture job).</summary>
Enforcing,
/// <summary>The offender serves a sentence in Laws' custody.</summary>
Jailed,
/// <summary>Done; LawCase.outcome says how.</summary>
Closed,
}
/// <summary>Notes a case keeps about the act ("on a table", "dug up from a grave"). Saved by name.</summary>
[Flags]
public enum CaseNotes
{
None = 0,
OnTable = 1,
DugUp = 2,
}
/// <summary>
/// What a hook read from the thing itself, before it could be destroyed (hook C's prefix), for groups
/// that depend on the thing rather than its def: a meal with meat in it, human meat. Not saved.
/// </summary>
[Flags]
public enum ActFacts
{
None = 0,
/// <summary>Any meat, meals with meat included (FoodUtility.GetFoodKind).</summary>
Meat = 1,
/// <summary>Raw meat or a corpse, unprocessed.</summary>
RawMeatOrCorpse = 2,
/// <summary>Human meat, a humanlike corpse or an ingredient of either.</summary>
HumanMeat = 4,
/// <summary>Insect meat.</summary>
InsectMeat = 8,
/// <summary>Raw food (ingestible preferability).</summary>
RawFood = 16,
/// <summary>A meal (processed food).</summary>
Meal = 32,
}
/// <summary>Which stages of a case have had their punishment dispatched. Saved by name.</summary>
[Flags]
public enum StageMask
{
None = 0,
Planning = 1,
DidIt = 2,
}
/// <summary>
/// The entry kind and stage a punishment fits (design: "Lawbook tab", punishments per entry and stage).
/// Read from PunishmentDef.fits in XML.
/// </summary>
public enum PunishmentFit
{
/// <summary>A break that isn't hostile to the colony, at planning.</summary>
BreakPlanning,
/// <summary>A break that isn't hostile to the colony, at did it.</summary>
BreakDidIt,
/// <summary>A break hostile to the colony (berserk), at planning.</summary>
HostileBreakPlanning,
/// <summary>A break hostile to the colony (berserk), at did it.</summary>
HostileBreakDidIt,
/// <summary>Every entry outside the breaks: ate, used, interactions, recorded acts, records, bills, special acts.</summary>
Act,
}
/// <summary>What an Enforcement queue entry does when it comes due.</summary>
public enum CaseTask
{
/// <summary>Start the punishment of the case's law for the entry's stage (PunishmentWorker.Start).</summary>
Punish,
/// <summary>Write "Maintain only" on a pawn Laws just jailed (Sentences.WriteMaintainOnly).</summary>
MaintainOnly,
}
/// <summary>Outcome keys of closed cases. The label is "BlaxLaws_Outcome_" + key. Saved as strings.</summary>
public static class CaseOutcomes
{
public const string Repealed = "Repealed";
public const string BreakEnded = "BreakEnded";
public const string NotEnforced = "NotEnforced";
public const string OffenderGone = "OffenderGone";
public const string Warned = "Warned";
public const string Guilty = "Guilty";
public const string Subdued = "Subdued";
public const string Served = "Served";
public const string ReleasedEarly = "ReleasedEarly";
/// <summary>The outcome's label, or the key itself when no string exists (an outcome a later release added).</summary>
public static string Label(string key)
{
if (key.NullOrEmpty())
return "";
string k = "BlaxLaws_Outcome_" + key;
return k.CanTranslate() ? k.Translate().ToString() : key;
}
}
/// <summary>Labels for the enums, from Keyed.</summary>
public static class LawLabels
{
public static string Stage(LawStage stage) => ("BlaxLaws_Stage_" + stage).Translate();
public static string Severity(LawSeverity severity) => ("BlaxLaws_Severity_" + severity).Translate();
public static string Status(CaseStatus status) => ("BlaxLaws_Status_" + status).Translate();
public static StageMask Mask(LawStage stage) => stage == LawStage.Planning ? StageMask.Planning : StageMask.DidIt;
}
}