Blax Laws 1.0.0: lawbook, act catalogue, enforcement and jail
- Laws tab with the lawbook and the case log; the book starts empty and
the mod watches nothing until a law exists.
- Act catalogue built from the game's defs (breaks, food, drugs, usables,
interactions, recorded acts, records, bills) plus special acts, with
groups, break links and a starter lawbook.
- Enforcement: warn, guilty, subdue, jail for N days and subdue then jail,
one case per incident, danger waits, role holders and mechanitors held
for Arrest now.
- Headless test suite green in every DLC combination, core only and with
the compat mods.
2026-12-02 20:07:17 +00:00
|
|
|
using System.Linq;
|
|
|
|
|
using BlaxLaws;
|
|
|
|
|
using RimWorld;
|
|
|
|
|
using Verse;
|
|
|
|
|
|
|
|
|
|
namespace BlaxLawsTests
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The lawbook and case store: rows keyed on Action, Option and Stage, rows whose entry is missing, the
|
|
|
|
|
/// starter lawbook, and rows and cases through the save as names and numbers.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class StoreTests
|
|
|
|
|
{
|
|
|
|
|
private const string MissingCoreKey = "Ate/BlaxLawsTest_NoSuchFood";
|
|
|
|
|
private const string MissingIdeologyKey = "RecordedAct/BlaxLawsTest_NoSuchEvent";
|
|
|
|
|
|
|
|
|
|
[BlaxTest("lawbook: a row whose entry is missing stays, reads Missing: Core or Needs Ideology, watches nothing and files nothing")]
|
|
|
|
|
public static void MissingEntryRows()
|
|
|
|
|
{
|
|
|
|
|
Law core = Fixtures.LawRow(MissingCoreKey, null, LawStage.DidIt, LawSeverity.Moderate, "Warn", 3, "Core", "ludeon.rimworld");
|
|
|
|
|
Law ideo = Fixtures.LawRow(MissingIdeologyKey, null, LawStage.DidIt, LawSeverity.Moderate, "Warn", 3, "Ideology", "ludeon.rimworld.ideology");
|
|
|
|
|
T.Check(Lawbook.Laws.Contains(core) && Lawbook.Laws.Contains(ideo), "a row with a missing entry left the book");
|
|
|
|
|
T.Check(!core.Resolves && !ideo.Resolves, "a made-up act key resolves");
|
|
|
|
|
T.Equal("Missing: Core", core.MissingText, "missing text of a Core row");
|
|
|
|
|
T.Equal("Needs Ideology", ideo.MissingText, "missing text of an Ideology row");
|
|
|
|
|
T.Equal("Needs Ideology", DlcSupport.MissingText("Ideology", null), "missing text from the DLC name alone");
|
|
|
|
|
T.Equal("Missing: Some Mod", DlcSupport.MissingText("Some Mod", "someone.somemod"), "missing text of a mod row");
|
|
|
|
|
T.Check(!Watch.Any, "a row whose entry is missing turned a watch flag on");
|
|
|
|
|
Pawn p = Fixtures.Colonist();
|
|
|
|
|
T.Check(CaseFiler.Report(new ActEvent(ActCategories.Ate, ThingDefOf.MealSimple, p)) == null, "a row whose entry is missing filed a case");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BlaxTest("lawbook: a second row with the same action, option and stage is refused and names the first")]
|
|
|
|
|
public static void DuplicateRefused()
|
|
|
|
|
{
|
|
|
|
|
Law a = Fixtures.LawRow(MissingCoreKey, null, LawStage.DidIt, LawSeverity.Minor, "Warn", 1);
|
|
|
|
|
var dup = new Law { actKey = MissingCoreKey, stage = LawStage.DidIt, punishment = "Jail", days = 5 };
|
|
|
|
|
T.Check(!Lawbook.TryAdd(dup, out Law existing), "the duplicate row was added");
|
|
|
|
|
T.Check(existing == a, "the refusal names " + existing + ", not the first row");
|
|
|
|
|
var otherStage = new Law { actKey = MissingCoreKey, stage = LawStage.Planning, punishment = "Warn", days = 1 };
|
|
|
|
|
T.Check(Lawbook.TryAdd(otherStage, out _), "a row with another stage was refused");
|
|
|
|
|
var binge = new Law { actKey = "Break/@anyDrugBinge", option = DrugOptions.Any, stage = LawStage.DidIt, punishment = "Warn", days = 3 };
|
|
|
|
|
T.Check(Lawbook.TryAdd(binge, out _), "a binge row was refused");
|
|
|
|
|
var bingeNull = new Law { actKey = "Break/@anyDrugBinge", option = null, stage = LawStage.DidIt, punishment = "Warn", days = 3 };
|
|
|
|
|
T.Check(!Lawbook.TryAdd(bingeNull, out Law e2) && e2 == binge, "a binge row with no option counts as Any and must be refused");
|
|
|
|
|
var bingeWake = new Law { actKey = "Break/@anyDrugBinge", option = "WakeUpChemical", stage = LawStage.DidIt, punishment = "Warn", days = 3 };
|
|
|
|
|
T.Check(Lawbook.TryAdd(bingeWake, out _), "a binge row with another option was refused");
|
|
|
|
|
T.Check(a.id > 0 && otherStage.id > a.id, "row ids are not handed out in order: " + a.id + ", " + otherStage.id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BlaxTest("lawbook: Moderate to Serious moves untouched days from 3 to 5 and leaves typed days alone; days clamp to 1..50")]
|
|
|
|
|
public static void SeverityMovesDefaultDays()
|
|
|
|
|
{
|
|
|
|
|
Law a = Fixtures.LawRow(MissingCoreKey, null, LawStage.DidIt, LawSeverity.Moderate, "Jail", 3);
|
|
|
|
|
Lawbook.SetSeverity(a, LawSeverity.Serious);
|
|
|
|
|
T.Equal(5, a.days, "untouched days after Moderate to Serious");
|
|
|
|
|
Lawbook.SetDays(a, 7);
|
|
|
|
|
Lawbook.SetSeverity(a, LawSeverity.Grave);
|
|
|
|
|
T.Equal(7, a.days, "typed days after Serious to Grave");
|
|
|
|
|
Lawbook.SetDays(a, 0);
|
|
|
|
|
T.Equal(1, a.days, "days 0 clamped");
|
|
|
|
|
Lawbook.SetDays(a, 80);
|
|
|
|
|
T.Equal(50, a.days, "days 80 clamped");
|
|
|
|
|
T.Equal(1, Lawbook.DefaultDays(LawSeverity.Minor), "Minor days");
|
|
|
|
|
T.Equal(10, Lawbook.DefaultDays(LawSeverity.Grave), "Grave days");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BlaxTest("lawbook: Starter lawbook adds 7 rows, pressing it again adds none")]
|
|
|
|
|
public static void StarterLawbook()
|
|
|
|
|
{
|
|
|
|
|
int before = Lawbook.Laws.Count;
|
|
|
|
|
T.Equal(7, Lawbook.AddStarter(), "rows the starter lawbook added");
|
|
|
|
|
T.Equal(before + 7, Lawbook.Laws.Count, "rows in the book after the starter lawbook");
|
|
|
|
|
T.Equal(0, Lawbook.AddStarter(), "rows a second press added");
|
|
|
|
|
Law jail = Lawbook.Find("Break/@anyDrugBinge", DrugOptions.Any, LawStage.DidIt);
|
|
|
|
|
T.NotNull(jail, "starter row 'any drug binge, did it'");
|
|
|
|
|
T.Equal("Jail", jail.punishment, "punishment of 'any drug binge, did it'");
|
|
|
|
|
T.Equal(5, jail.days, "days of 'any drug binge, did it'");
|
|
|
|
|
T.Equal(LawSeverity.Serious, jail.severity, "severity of 'any drug binge, did it'");
|
|
|
|
|
Law fire = Lawbook.Find("Break/FireStartingSpree", null, LawStage.DidIt);
|
|
|
|
|
T.Check(fire != null && fire.punishment == "Jail" && fire.days == 10 && fire.severity == LawSeverity.Grave, "starter fire-starting spree did-it row: " + fire);
|
|
|
|
|
T.NotNull(Lawbook.Find("Interaction/Insult", null, LawStage.DidIt), "starter row 'Insult, did it'");
|
|
|
|
|
T.NotNull(Lawbook.Find("Special/StartedSocialFight", null, LawStage.DidIt), "starter row 'started a social fight'");
|
|
|
|
|
T.Check(Lawbook.Laws.All(l => l.savedMod == "Core" || l.Resolves), "a starter row saved another mod than Core");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BlaxTest("cases: a filed case closes with its outcome, and deleting its row closes the open ones as repealed")]
|
|
|
|
|
public static void CaseLifecycle()
|
|
|
|
|
{
|
|
|
|
|
GameComponent_BlaxLaws comp = Fixtures.Comp;
|
|
|
|
|
Pawn p = Fixtures.Colonist();
|
|
|
|
|
Law a = Fixtures.LawRow(MissingCoreKey, null, LawStage.DidIt, LawSeverity.Serious, "Warn", 5);
|
|
|
|
|
LawCase c = CaseFiler.Open(a, new ActEvent(ActCategories.Ate, ThingDefOf.MealSimple, p), LawStage.DidIt);
|
|
|
|
|
T.NotNull(c, "CaseFiler.Open");
|
|
|
|
|
T.Check(comp.Cases.Contains(c) && comp.CasesOf(p).Contains(c), "the case is not in the store or its offender index");
|
|
|
|
|
T.Equal(a.id, c.didItLawId, "the case's did-it row");
|
|
|
|
|
T.Equal(LawSeverity.Serious, c.severity, "the case's severity");
|
|
|
|
|
T.Equal(1, c.count, "the count of a new did-it case");
|
|
|
|
|
T.Equal(p.LabelShort, c.offenderName, "the offender's saved name");
|
|
|
|
|
T.Equal(1, Lawbook.OpenCaseCount(a), "open cases of the row");
|
|
|
|
|
T.Equal(1, Lawbook.Delete(a), "cases the delete closed");
|
|
|
|
|
T.Check(c.IsClosed && c.outcome == CaseOutcomes.Repealed, "the case after the delete: " + c);
|
|
|
|
|
T.Equal("Law repealed", CaseOutcomes.Label(c.outcome), "the repealed label");
|
|
|
|
|
}
|
|
|
|
|
|
Blax Laws 1.0.0: tests for every shipped claim, escape and custody fixes
- Tests for the end-to-end subdue and jail, halved pain, the role hold,
every way a sentence ends, pruning, the nobody-to-enforce letter and
performance; each fails when its feature is broken.
- A jailed colonist that escapes closes as Escaped, also when the world
deletes it before the sentence check or a save falls in between. One
sold, given away, kidnapped or lost with a map closes with its own
message instead of "escaped".
- The release fallback also frees a prisoner on a caravan.
- An arrest waits while the offender carries someone, and ends an
offender job that holds reservations, so no reservation errors.
- Release text says a colonist, not a warden: Basic work also releases
prisoners.
- Test harness: test order, fixture hardening, roof cleanup and logging.
2026-12-03 14:46:28 +00:00
|
|
|
private const string SaveKey = "save.rowAndCase";
|
|
|
|
|
|
Blax Laws 1.0.0: lawbook, act catalogue, enforcement and jail
- Laws tab with the lawbook and the case log; the book starts empty and
the mod watches nothing until a law exists.
- Act catalogue built from the game's defs (breaks, food, drugs, usables,
interactions, recorded acts, records, bills) plus special acts, with
groups, break links and a starter lawbook.
- Enforcement: warn, guilty, subdue, jail for N days and subdue then jail,
one case per incident, danger waits, role holders and mechanitors held
for Arrest now.
- Headless test suite green in every DLC combination, core only and with
the compat mods.
2026-12-02 20:07:17 +00:00
|
|
|
[BlaxTest("save: a row and a case go into the save as names and numbers (setup)")]
|
|
|
|
|
public static void SaveSetup()
|
Blax Laws 1.0.0: tests for every shipped claim, escape and custody fixes
- Tests for the end-to-end subdue and jail, halved pain, the role hold,
every way a sentence ends, pruning, the nobody-to-enforce letter and
performance; each fails when its feature is broken.
- A jailed colonist that escapes closes as Escaped, also when the world
deletes it before the sentence check or a save falls in between. One
sold, given away, kidnapped or lost with a map closes with its own
message instead of "escaped".
- The release fallback also frees a prisoner on a caravan.
- An arrest waits while the offender carries someone, and ends an
offender job that holds reservations, so no reservation errors.
- Release text says a colonist, not a warden: Basic work also releases
prisoners.
- Test harness: test order, fixture hardening, roof cleanup and logging.
2026-12-03 14:46:28 +00:00
|
|
|
{
|
|
|
|
|
// Built right before the save: the case reads Jailed although its colonist is no prisoner, so a later
|
|
|
|
|
// phase-1 test's sentence sweep would close it as released early.
|
|
|
|
|
T.CarryAtSave(SaveKey, RowAndCaseForSave);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static string RowAndCaseForSave()
|
Blax Laws 1.0.0: lawbook, act catalogue, enforcement and jail
- Laws tab with the lawbook and the case log; the book starts empty and
the mod watches nothing until a law exists.
- Act catalogue built from the game's defs (breaks, food, drugs, usables,
interactions, recorded acts, records, bills) plus special acts, with
groups, break links and a starter lawbook.
- Enforcement: warn, guilty, subdue, jail for N days and subdue then jail,
one case per incident, danger waits, role holders and mechanitors held
for Arrest now.
- Headless test suite green in every DLC combination, core only and with
the compat mods.
2026-12-02 20:07:17 +00:00
|
|
|
{
|
|
|
|
|
Pawn p = Fixtures.Keep(Fixtures.Colonist());
|
|
|
|
|
Law a = Fixtures.KeepLaw(Fixtures.LawRow(MissingIdeologyKey, null, LawStage.DidIt, LawSeverity.Grave, "Jail", 12, "Ideology", "ludeon.rimworld.ideology"));
|
|
|
|
|
Lawbook.SetEnabled(a, false);
|
|
|
|
|
LawCase c = CaseFiler.Open(a, new ActEvent(ActCategories.RecordedAct, null, p) { notes = CaseNotes.OnTable | CaseNotes.DugUp }, LawStage.DidIt);
|
|
|
|
|
c.count = 4;
|
|
|
|
|
c.breakState = "Binging_DrugExtreme";
|
|
|
|
|
c.breakStartTick = 1234;
|
|
|
|
|
c.MarkPunished(LawStage.DidIt);
|
|
|
|
|
c.status = CaseStatus.Jailed;
|
|
|
|
|
c.captureTick = 2000;
|
|
|
|
|
c.releaseTick = 2000 + 12 * GenDate.TicksPerDay;
|
Blax Laws 1.0.0: tests for every shipped claim, escape and custody fixes
- Tests for the end-to-end subdue and jail, halved pain, the role hold,
every way a sentence ends, pruning, the nobody-to-enforce letter and
performance; each fails when its feature is broken.
- A jailed colonist that escapes closes as Escaped, also when the world
deletes it before the sentence check or a save falls in between. One
sold, given away, kidnapped or lost with a map closes with its own
message instead of "escaped".
- The release fallback also frees a prisoner on a caravan.
- An arrest waits while the offender carries someone, and ends an
offender job that holds reservations, so no reservation errors.
- Release text says a colonist, not a warden: Basic work also releases
prisoners.
- Test harness: test order, fixture hardening, roof cleanup and logging.
2026-12-03 14:46:28 +00:00
|
|
|
return a.id + "|" + c.id + "|" + p.ThingID;
|
Blax Laws 1.0.0: lawbook, act catalogue, enforcement and jail
- Laws tab with the lawbook and the case log; the book starts empty and
the mod watches nothing until a law exists.
- Act catalogue built from the game's defs (breaks, food, drugs, usables,
interactions, recorded acts, records, bills) plus special acts, with
groups, break links and a starter lawbook.
- Enforcement: warn, guilty, subdue, jail for N days and subdue then jail,
one case per incident, danger waits, role holders and mechanitors held
for Arrest now.
- Headless test suite green in every DLC combination, core only and with
the compat mods.
2026-12-02 20:07:17 +00:00
|
|
|
}
|
|
|
|
|
|
Blax Laws 1.0.0: tests for every shipped claim, escape and custody fixes
- Tests for the end-to-end subdue and jail, halved pain, the role hold,
every way a sentence ends, pruning, the nobody-to-enforce letter and
performance; each fails when its feature is broken.
- A jailed colonist that escapes closes as Escaped, also when the world
deletes it before the sentence check or a save falls in between. One
sold, given away, kidnapped or lost with a map closes with its own
message instead of "escaped".
- The release fallback also frees a prisoner on a caravan.
- An arrest waits while the offender carries someone, and ends an
offender job that holds reservations, so no reservation errors.
- Release text says a colonist, not a warden: Basic work also releases
prisoners.
- Test harness: test order, fixture hardening, roof cleanup and logging.
2026-12-03 14:46:28 +00:00
|
|
|
[BlaxTest("save: the row and the case keep every field through the reload", phase: 2, Order = -1)]
|
Blax Laws 1.0.0: lawbook, act catalogue, enforcement and jail
- Laws tab with the lawbook and the case log; the book starts empty and
the mod watches nothing until a law exists.
- Act catalogue built from the game's defs (breaks, food, drugs, usables,
interactions, recorded acts, records, bills) plus special acts, with
groups, break links and a starter lawbook.
- Enforcement: warn, guilty, subdue, jail for N days and subdue then jail,
one case per incident, danger waits, role holders and mechanitors held
for Arrest now.
- Headless test suite green in every DLC combination, core only and with
the compat mods.
2026-12-02 20:07:17 +00:00
|
|
|
public static void SaveRoundTrip()
|
|
|
|
|
{
|
Blax Laws 1.0.0: tests for every shipped claim, escape and custody fixes
- Tests for the end-to-end subdue and jail, halved pain, the role hold,
every way a sentence ends, pruning, the nobody-to-enforce letter and
performance; each fails when its feature is broken.
- A jailed colonist that escapes closes as Escaped, also when the world
deletes it before the sentence check or a save falls in between. One
sold, given away, kidnapped or lost with a map closes with its own
message instead of "escaped".
- The release fallback also frees a prisoner on a caravan.
- An arrest waits while the offender carries someone, and ends an
offender job that holds reservations, so no reservation errors.
- Release text says a colonist, not a warden: Basic work also releases
prisoners.
- Test harness: test order, fixture hardening, roof cleanup and logging.
2026-12-03 14:46:28 +00:00
|
|
|
T.Check(T.Carry.TryGetValue(SaveKey, out string carry) && !carry.NullOrEmpty(), "phase-1 setup did not run");
|
|
|
|
|
string[] parts = carry.Split('|');
|
|
|
|
|
T.Check(parts.Length == 3, "carry: " + carry);
|
Blax Laws 1.0.0: lawbook, act catalogue, enforcement and jail
- Laws tab with the lawbook and the case log; the book starts empty and
the mod watches nothing until a law exists.
- Act catalogue built from the game's defs (breaks, food, drugs, usables,
interactions, recorded acts, records, bills) plus special acts, with
groups, break links and a starter lawbook.
- Enforcement: warn, guilty, subdue, jail for N days and subdue then jail,
one case per incident, danger waits, role holders and mechanitors held
for Arrest now.
- Headless test suite green in every DLC combination, core only and with
the compat mods.
2026-12-02 20:07:17 +00:00
|
|
|
GameComponent_BlaxLaws comp = Fixtures.Comp;
|
Blax Laws 1.0.0: tests for every shipped claim, escape and custody fixes
- Tests for the end-to-end subdue and jail, halved pain, the role hold,
every way a sentence ends, pruning, the nobody-to-enforce letter and
performance; each fails when its feature is broken.
- A jailed colonist that escapes closes as Escaped, also when the world
deletes it before the sentence check or a save falls in between. One
sold, given away, kidnapped or lost with a map closes with its own
message instead of "escaped".
- The release fallback also frees a prisoner on a caravan.
- An arrest waits while the offender carries someone, and ends an
offender job that holds reservations, so no reservation errors.
- Release text says a colonist, not a warden: Basic work also releases
prisoners.
- Test harness: test order, fixture hardening, roof cleanup and logging.
2026-12-03 14:46:28 +00:00
|
|
|
Law a = comp.LawById(int.Parse(parts[0]));
|
Blax Laws 1.0.0: lawbook, act catalogue, enforcement and jail
- Laws tab with the lawbook and the case log; the book starts empty and
the mod watches nothing until a law exists.
- Act catalogue built from the game's defs (breaks, food, drugs, usables,
interactions, recorded acts, records, bills) plus special acts, with
groups, break links and a starter lawbook.
- Enforcement: warn, guilty, subdue, jail for N days and subdue then jail,
one case per incident, danger waits, role holders and mechanitors held
for Arrest now.
- Headless test suite green in every DLC combination, core only and with
the compat mods.
2026-12-02 20:07:17 +00:00
|
|
|
T.NotNull(a, "the kept row after the reload");
|
|
|
|
|
T.Equal(MissingIdeologyKey, a.actKey, "act key");
|
|
|
|
|
T.Equal(LawStage.DidIt, a.stage, "stage");
|
|
|
|
|
T.Equal(LawSeverity.Grave, a.severity, "severity");
|
|
|
|
|
T.Equal("Jail", a.punishment, "punishment");
|
|
|
|
|
T.Equal(12, a.days, "days");
|
|
|
|
|
T.Check(!a.enabled, "the row's On flag came back on");
|
|
|
|
|
T.Equal("Ideology", a.savedMod, "saved mod");
|
|
|
|
|
T.Equal("Needs Ideology", a.MissingText, "missing text after the reload");
|
|
|
|
|
T.Check(comp.NextLawId > a.id, "next row id " + comp.NextLawId + " would repeat " + a.id);
|
|
|
|
|
|
Blax Laws 1.0.0: tests for every shipped claim, escape and custody fixes
- Tests for the end-to-end subdue and jail, halved pain, the role hold,
every way a sentence ends, pruning, the nobody-to-enforce letter and
performance; each fails when its feature is broken.
- A jailed colonist that escapes closes as Escaped, also when the world
deletes it before the sentence check or a save falls in between. One
sold, given away, kidnapped or lost with a map closes with its own
message instead of "escaped".
- The release fallback also frees a prisoner on a caravan.
- An arrest waits while the offender carries someone, and ends an
offender job that holds reservations, so no reservation errors.
- Release text says a colonist, not a warden: Basic work also releases
prisoners.
- Test harness: test order, fixture hardening, roof cleanup and logging.
2026-12-03 14:46:28 +00:00
|
|
|
LawCase c = comp.CaseById(int.Parse(parts[1]));
|
Blax Laws 1.0.0: lawbook, act catalogue, enforcement and jail
- Laws tab with the lawbook and the case log; the book starts empty and
the mod watches nothing until a law exists.
- Act catalogue built from the game's defs (breaks, food, drugs, usables,
interactions, recorded acts, records, bills) plus special acts, with
groups, break links and a starter lawbook.
- Enforcement: warn, guilty, subdue, jail for N days and subdue then jail,
one case per incident, danger waits, role holders and mechanitors held
for Arrest now.
- Headless test suite green in every DLC combination, core only and with
the compat mods.
2026-12-02 20:07:17 +00:00
|
|
|
T.NotNull(c, "the kept case after the reload");
|
Blax Laws 1.0.0: tests for every shipped claim, escape and custody fixes
- Tests for the end-to-end subdue and jail, halved pain, the role hold,
every way a sentence ends, pruning, the nobody-to-enforce letter and
performance; each fails when its feature is broken.
- A jailed colonist that escapes closes as Escaped, also when the world
deletes it before the sentence check or a save falls in between. One
sold, given away, kidnapped or lost with a map closes with its own
message instead of "escaped".
- The release fallback also frees a prisoner on a caravan.
- An arrest waits while the offender carries someone, and ends an
offender job that holds reservations, so no reservation errors.
- Release text says a colonist, not a warden: Basic work also releases
prisoners.
- Test harness: test order, fixture hardening, roof cleanup and logging.
2026-12-03 14:46:28 +00:00
|
|
|
Pawn p = Fixtures.FindPawnById(parts[2]);
|
Blax Laws 1.0.0: lawbook, act catalogue, enforcement and jail
- Laws tab with the lawbook and the case log; the book starts empty and
the mod watches nothing until a law exists.
- Act catalogue built from the game's defs (breaks, food, drugs, usables,
interactions, recorded acts, records, bills) plus special acts, with
groups, break links and a starter lawbook.
- Enforcement: warn, guilty, subdue, jail for N days and subdue then jail,
one case per incident, danger waits, role holders and mechanitors held
for Arrest now.
- Headless test suite green in every DLC combination, core only and with
the compat mods.
2026-12-02 20:07:17 +00:00
|
|
|
T.NotNull(p, "the kept colonist after the reload");
|
|
|
|
|
T.Check(c.offender == p, "the case's offender reference didn't resolve to the colonist");
|
|
|
|
|
T.Check(comp.CasesOf(p).Contains(c), "the offender index lacks the case after the reload");
|
|
|
|
|
T.Equal(a.id, c.didItLawId, "did-it row");
|
|
|
|
|
T.Equal(4, c.count, "count");
|
|
|
|
|
T.Equal(CaseNotes.OnTable | CaseNotes.DugUp, c.notes, "notes");
|
|
|
|
|
T.Equal("Binging_DrugExtreme", c.breakState, "break state");
|
|
|
|
|
T.Equal(1234, c.breakStartTick, "break start tick");
|
|
|
|
|
T.Check(c.HasPunished(LawStage.DidIt) && !c.HasPunished(LawStage.Planning), "punished stages: " + c.punishedStages);
|
|
|
|
|
T.Equal(CaseStatus.Jailed, c.status, "status");
|
|
|
|
|
T.Equal(2000, c.captureTick, "capture tick");
|
|
|
|
|
T.Equal(2000 + 12 * GenDate.TicksPerDay, c.releaseTick, "release tick");
|
|
|
|
|
T.Equal(LawSeverity.Grave, c.severity, "severity");
|
|
|
|
|
T.Check(comp.NextCaseId > c.id, "next case id " + comp.NextCaseId + " would repeat " + c.id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|