78 lines
3.5 KiB
C#
78 lines
3.5 KiB
C#
|
|
using Verse;
|
||
|
|
|
||
|
|
namespace BlaxLaws
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// 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").
|
||
|
|
/// </summary>
|
||
|
|
public static class WaitReasons
|
||
|
|
{
|
||
|
|
/// <summary>Hostiles threaten the offender's map (a raid, a berserk colonist): nobody is sent.</summary>
|
||
|
|
public const string Danger = "BlaxLaws_Wait_Danger";
|
||
|
|
|
||
|
|
/// <summary>Nobody on the map can ever enforce it (no warden in "Wardens only", nobody able): the player has to act.</summary>
|
||
|
|
public const string NoEnforcer = "BlaxLaws_Wait_NoEnforcer";
|
||
|
|
|
||
|
|
/// <summary>Enforcers exist but none is free now (asleep, on a rescue, in a ritual, out of reach).</summary>
|
||
|
|
public const string Busy = "BlaxLaws_Wait_Busy";
|
||
|
|
|
||
|
|
/// <summary>No prisoner bed the enforcer can take the offender to.</summary>
|
||
|
|
public const string NoBed = "BlaxLaws_Wait_NoBed";
|
||
|
|
|
||
|
|
/// <summary>Someone else holds the offender or the bed (a doctor's rescue): the arrest waits, no reservation error.</summary>
|
||
|
|
public const string Reserved = "BlaxLaws_Wait_Reserved";
|
||
|
|
|
||
|
|
/// <summary>The offender's break is hostile to the colony (berserk): the arrest waits until it ends or the pawn is down.</summary>
|
||
|
|
public const string HostileBreak = "BlaxLaws_Wait_HostileBreak";
|
||
|
|
|
||
|
|
/// <summary>A role holder or a mechanitor with mechs: Laws doesn't arrest it on its own; "Arrest now" does.</summary>
|
||
|
|
public const string Hold = "BlaxLaws_Wait_Hold";
|
||
|
|
|
||
|
|
/// <summary>The offender isn't on a map (carried, in a caravan).</summary>
|
||
|
|
public const string Away = "BlaxLaws_Wait_Away";
|
||
|
|
|
||
|
|
/// <summary>The reason's text, or "" for none.</summary>
|
||
|
|
public static string Label(string reason)
|
||
|
|
{
|
||
|
|
if (reason.NullOrEmpty())
|
||
|
|
return "";
|
||
|
|
return reason.CanTranslate() ? reason.Translate().ToString() : reason;
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 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.
|
||
|
|
/// </summary>
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Outcome keys of this package beside CaseOutcomes. Saved as strings; the label is
|
||
|
|
/// "BlaxLaws_Outcome_" + key (CaseOutcomes.Label), from BlaxLaws_Enforcement.xml.
|
||
|
|
/// </summary>
|
||
|
|
public static class EnforcementOutcomes
|
||
|
|
{
|
||
|
|
/// <summary>The subdue gave up: three hits in a row caused no pain (go-juice, painkillers, every part at its cap).</summary>
|
||
|
|
public const string NotSubdued = "NotSubdued";
|
||
|
|
|
||
|
|
/// <summary>A jailed pawn left the map before its sentence was served.</summary>
|
||
|
|
public const string Escaped = "Escaped";
|
||
|
|
|
||
|
|
/// <summary>A jailed pawn died.</summary>
|
||
|
|
public const string Died = "Died";
|
||
|
|
|
||
|
|
/// <summary>The offender became a prisoner some other way (arrested by hand, another mod): Laws never touches it.</summary>
|
||
|
|
public const string AlreadyPrisoner = "AlreadyPrisoner";
|
||
|
|
}
|
||
|
|
}
|