using Verse;
namespace BlaxLaws
{
///
/// Why enforcement waits: the Keyed keys LawCase.waitReason holds and the Cases tab shows
/// (WaitReasons.Label). A case that waits is Open; the 250-tick sweep retries it, a case waiting for a
/// prisoner bed only every 2500 ticks (design: "Enforcement runs a tick later").
///
public static class WaitReasons
{
/// Hostiles threaten the offender's map (a raid, a berserk colonist): nobody is sent.
public const string Danger = "BlaxLaws_Wait_Danger";
/// Nobody on the map can ever enforce it (no warden in "Wardens only", nobody able): the player has to act.
public const string NoEnforcer = "BlaxLaws_Wait_NoEnforcer";
/// Enforcers exist but none is free now (asleep, on a rescue, in a ritual, out of reach).
public const string Busy = "BlaxLaws_Wait_Busy";
/// No prisoner bed the enforcer can take the offender to.
public const string NoBed = "BlaxLaws_Wait_NoBed";
/// Someone else holds the offender or the bed (a doctor's rescue): the arrest waits, no reservation error.
public const string Reserved = "BlaxLaws_Wait_Reserved";
/// The offender's break is hostile to the colony (berserk): the arrest waits until it ends or the pawn is down.
public const string HostileBreak = "BlaxLaws_Wait_HostileBreak";
/// A role holder or a mechanitor with mechs: Laws doesn't arrest it on its own; "Arrest now" does.
public const string Hold = "BlaxLaws_Wait_Hold";
/// The offender isn't on a map (carried, in a caravan).
public const string Away = "BlaxLaws_Wait_Away";
/// The reason's text, or "" for none.
public static string Label(string reason)
{
if (reason.NullOrEmpty())
return "";
return reason.CanTranslate() ? reason.Translate().ToString() : reason;
}
///
/// Puts the case back to Open with the reason. Returns true when the reason changed, so a letter goes
/// out once per wait and not on every sweep.
///
public static bool Set(LawCase c, string reason)
{
if (c == null)
return false;
bool changed = c.waitReason != reason;
c.status = CaseStatus.Open;
c.waitReason = reason;
return changed;
}
}
///
/// Outcome keys of this package beside CaseOutcomes. Saved as strings; the label is
/// "BlaxLaws_Outcome_" + key (CaseOutcomes.Label), from BlaxLaws_Enforcement.xml.
///
public static class EnforcementOutcomes
{
/// The subdue gave up: three hits in a row caused no pain (go-juice, painkillers, every part at its cap).
public const string NotSubdued = "NotSubdued";
/// A jailed pawn left the map before its sentence was served.
public const string Escaped = "Escaped";
/// A jailed pawn died.
public const string Died = "Died";
/// The offender became a prisoner some other way (arrested by hand, another mod): Laws never touches it.
public const string AlreadyPrisoner = "AlreadyPrisoner";
}
}