docs: rework the design around an act catalogue

A law's Action is now picked from a catalogue built from the game's defs
(mental breaks, ate, used, social interactions, recorded acts, records,
bills, special acts), as Fabian asked on 2026-11-30. The six crimes become
starter rows and break-to-act links. New hooks for records, history
events, bills and usables, checked against the 1.7.5021 reference
assemblies; behaviour claims listed under "To verify". 1.0 is 12 days,
1.8 2 days, the plan 50.
This commit is contained in:
Timothy 2026-12-01 08:46:52 +01:00
parent 8d0f5692e8
commit dd82dd75df
2 changed files with 170 additions and 100 deletions

View File

@ -5,7 +5,7 @@
[![Any DLC combination](https://img.shields.io/badge/DLCs-any_combination-5a6b5d)](#dlc-support)
[![Status: design](https://img.shields.io/badge/status-design-CDCDCD)](docs/design.md)
RimWorld mod (1.7) by Blax Gaming. Lawbook, crimes and punishments. Write your colony's laws, and colonists who break them get stopped, jailed and, later, tried in court. Add "Drug binge, planning, subdue" and when a colonist starts a wake-up binge, a warden goes for it at once and beats it down; if it reaches a drug first, that dose counts as "did it" and the did-it law applies. Add "Drug binge, did it, jail 5 days" and the one who already took some sits out five days in your prison and walks back to work. Needs Harmony. Works with any DLC combination, core only included.
RimWorld mod (1.7) by Blax Gaming. Lawbook, crimes and punishments. Write your colony's laws, and colonists who break them get stopped, jailed and, later, tried in court. Add "Drug binge, wake-up, planning, subdue" and when a colonist starts a wake-up binge, a warden goes for it at once and beats it down; if it reaches a drug first, that dose counts as "did it" and the did-it law applies. Add "Drug binge, did it, jail 5 days" and the one who already took some sits out five days in your prison and walks back to work. Needs Harmony. Works with any DLC combination, core only included.
Status: design. Nothing is built yet; below is what 1.0 will do. The full design is in `docs/design.md`.
@ -13,21 +13,26 @@ Status: design. Nothing is built yet; below is what 1.0 will do. The full design
### The lawbook
- 📖 **An empty lawbook.** A "Laws" tab in the bottom bar. Add a law as Action (with an option such as "wake-up"), Stage, Severity, Punishment and Days, each a dropdown that only offers what fits. Nothing is watched or punished until the first row exists. `Source/BlaxLaws/MainTabWindow_Laws.cs`
- 📖 **An empty lawbook.** A "Laws" tab in the bottom bar. Add a law as Action, Stage, Severity, Punishment and Days, each a dropdown that only offers what fits. Nothing is watched or punished until the first row exists. `Source/BlaxLaws/MainTabWindow_Laws.cs`
- 🔎 **Pick any act.** The Action comes from a searchable list, like choosing what to tailor: every mental break, everything that can be eaten or used, every social interaction, every act the game records, every record and every bill. It's built from the game's own data when the game starts, so DLC and modded breaks, drugs and recipes show up with no patch, each labelled with its mod. `Source/BlaxLaws/Dialog_PickAct.cs`
- 📝 **Starter lawbook.** One click adds seven suggested laws: subdue drug binges, fire-starting sprees and corpse obsession before they start, jail for binges and fires already done, a warning for fights and insults. `Source/BlaxLaws/Lawbook.cs`
- 🎯 **One law per act.** Each action, option and stage appears once in the book, and when two laws fit an act the more specific one wins: "wake-up" over "any drug", "human meat" over "any meat".
- 🎚️ **Stages that mean something.** "Planning" is the moment a mental break starts and nothing is done yet; "Did it" is the act. A crime only offers the stages the game can really tell apart.
- 🎯 **One law per act.** Each action, option and stage appears once in the book, and when two laws fit an act the more specific one wins: "wake-up" over "hard drugs" over "any drug", "human meat" over "any meat".
- 🎚️ **Stages that mean something.** "Planning" is the moment a mental break starts and nothing is done yet; "Did it" is the act the break is about, such as the first dose of a binge. An entry only offers the stages the game can really tell apart.
- 📋 **Case log.** Who, what, when, which punishment and how it ended, newest first, with a jump to the pawn and "Arrest now" for cases that wait.
### Crimes
- 💊 **Drug binge.** Any drug, hard or social drugs, or one chemical such as wake-up. Planning when the binge starts, did it with every dose. `Source/BlaxLaws/Detection/BingeHooks.cs`
- 🔥 **Fire starting.** Planning when a pyromaniac's spree starts, did it with every fire set.
The catalogue holds hundreds of acts; these are the ones the starter lawbook and the examples use.
- 💊 **Drug binge.** Any drug, hard or social drugs, or one chemical such as wake-up. Planning when the binge starts, did it with every dose. `Source/BlaxLaws/Detection/BreakHooks.cs`
- 🔥 **Fire-starting spree.** Planning when a pyromaniac's spree starts, did it with every fire set.
- ⚰️ **Corpse obsession.** Planning when the obsession starts, did it when the corpse is on display; the case notes "on a table" and whether the corpse was dug up from a grave, which it usually is.
- 👊 **Started a fight.** The pawn who reacts and swings first, usually the insulted one.
- 🗯️ **Insults.** Every insult by the one who insults, slights too if you want. Planning for insulting sprees.
- 🍖 **Ate meat.** Any meat (meals included), raw meat and corpses, or human meat.
- 🧮 **No flood.** Meat, fights and insults outside a break open at most one case per colonist and law a day; more acts only raise its count.
- 👊 **Started a social fight.** The pawn who reacts and swings first, usually the insulted one.
- 🗯️ **Insult.** Every insult by the one who insults; slights are their own entry. Planning for insulting sprees.
- 🍖 **Ate.** Any food or drug by name, or a group: any meat (meals included), raw meat and corpses, human meat, insect meat, hard drugs.
- 🧾 **Recorded acts, records and bills.** Cut a tree, butchered a human, harvested an organ (most need Ideology); kills, bodies stripped; made a human leather duster, any surgery.
- 😡 **Aggressive breaks.** Berserk and murderous rage can be laws from 1.0 with a warning or guilt; subduing them comes in 1.2.
- 🧮 **No flood.** Acts outside a break open at most one case per colonist and law a day; more acts only raise its count.
### Punishments
@ -47,21 +52,22 @@ Status: design. Nothing is built yet; below is what 1.0 will do. The full design
Later releases, in order (details in `docs/design.md`):
- 🛏️ **1.1 Sentences done right.** Release gives back the bed, grave, throne, deathrest casket, ideoligion role and mech work modes. Pardon and early release, reprimands, jail for slaves, banishment and execution after your confirmation, and "Trial" through Ideology's vanilla trial.
- 🔪 **1.2 Violent crimes.** Tantrums and vandalism, assault, harming prisoners or slaves, murderous rage, manslaughter and murder.
- 🔪 **1.2 Violent crimes.** Assault, harming prisoners or slaves, manslaughter and murder, "did it" for tantrums, berserk and rages, and subdue for aggressive breaks by a warden who can win the fight.
- 🏛️ **1.3 Court sessions.** Trials without any DLC: a judge, a prosecutor and spectators at a place you pick, a verdict that weighs evidence against Social skill, the sentence from your lawbook. If you want, the court sits on its own at a set hour. A button removes the mod from a save.
- 🗳️ **1.4 Elected judge.** The colony votes for a judge for 60 days at a time, with by-elections and recalls.
- 🗣️ **1.5 Attorneys.** The accused asks a colonist to defend it or speaks for itself; both sides argue with Social.
- 📅 **1.6 Multi-day trials and courtrooms.** Up to three court days for grave crimes, custody between them, and courtrooms that make a verdict easier to accept.
- 🙋 **1.7 Law votes.** Colonists propose and repeal laws and vote by traits, beliefs, opinion and mood, and you can back or veto the result.
- 🚪 **1.8 More crimes.** Jailbreaks, desertion, slaughtering colony animals, food binges, drugs against the drug policy, prison breaks, slave rebellions.
- 🚪 **1.8 More crimes.** Slaughterers, drugs against the drug policy, prison breaks, slave rebellions.
## DLC support
Blax Laws works with any combination of DLCs, core only included, and lists none as a dependency. Every 1.0 crime and punishment runs on the core game.
Blax Laws works with any combination of DLCs, core only included, and lists none as a dependency. Every 1.0 category and punishment runs on the core game. The act list shows what your game has: a DLC's breaks, drugs and recipes appear when it's active.
- **Ideology** adds slaves, who can be warned, marked guilty and subdued. Role holders aren't jailed automatically in 1.0, because an arrest takes their role.
- **Biotech** adds children, who are never beaten, and mechanitors, who aren't jailed automatically in 1.0, because an arrest shuts their mechs down.
- **Royalty**, **Anomaly** and **Odyssey**: 1.0 uses none of their content.
- **Ideology** also records most of the game's acts (cut a tree, butchered a human); without it the recorded acts category rarely fires.
- **Royalty**, **Anomaly** and **Odyssey**: their acts appear in the list when active; Laws needs none of them.
- **A save made with a DLC** loads without it.
## Compatibility

View File

@ -1,10 +1,19 @@
# Blax Laws
Write a lawbook and the colony enforces it. Add "Drug binge, planning, subdue" and when a colonist starts a wake-up binge, a warden goes for it at once and beats it down; if it reaches a drug first, that dose counts as "did it" and the did-it law applies. Add "Drug binge, did it, jail 5 days" and the one who already took some is arrested, sits out five days in your prison and walks back to work. The book starts empty and only watches what the game already does: drug binges, fire-starting sprees, corpse obsession (the corpse on the dining table), social fights, insults and eating meat. Later releases add violent crimes, a court with a judge the colony elects, attorneys who argue with their Social skill, trials over several days, colony votes on the laws themselves and more crimes.
Write a lawbook and the colony enforces it. Add "Drug binge, wake-up, planning, subdue" and when a colonist starts a wake-up binge, a warden goes for it at once and beats it down; if it reaches a drug first, that dose counts as "did it" and the did-it law applies. Add "Drug binge, did it, jail 5 days" and the one who already took some is arrested, sits out five days in your prison and walks back to work. The book starts empty. A law's Action is picked from a searchable list the mod builds from the game's own defs, the way you pick what to tailor: every mental break, everything that can be eaten or used, every social interaction, every act the game records and every bill, with DLC and modded content included. Laws only watches what the game already does. Later releases add violent crimes, a court with a judge the colony elects, attorneys who argue with their Social skill, trials over several days, colony votes on the laws themselves and more crimes.
Status: design, no code yet. Checked against the RimWorld 1.7.5021 game code on 2026-11-30. RimWorld 1.7, package id `blax.laws`. From the first release a plain unsubscribe leaves a save that loads: jailed colonists stay vanilla prisoners and the log shows 2 errors.
Status: design, no code yet. Checked against the RimWorld 1.7.5021 game code on 2026-11-30; the act catalogue (2026-12-01) was checked against the 1.7.5021 reference assemblies, which have every signature and no method bodies, so its behaviour claims are listed under "To verify" until the decompiled code confirms them. RimWorld 1.7, package id `blax.laws`. From the first release a plain unsubscribe leaves a save that loads: jailed colonists stay vanilla prisoners and the log shows 2 errors.
Next (Fabian, 2026-11-30): the crimes are not a fixed set of six. His examples were entries of a full list: a law's Action is picked from a searchable catalogue built from the game's defs at runtime (every mental break, anything eaten or used, every social interaction, recorded acts, finished bills), like choosing what to tailor, so modded and DLC content shows up. The six crimes below become starter lawbook rows; the 1.0 section, data model, detection, tests and the later crime releases still need that rewrite before the build starts.
Changes on 2026-12-01, the act catalogue (Fabian, 2026-11-30: the crimes he named were examples from a full list, "like when deciding what to tailor"):
- A law's Action is now an entry of the act catalogue: seven categories built from the loaded defs when the game starts (mental breaks, ate, used, social interactions, recorded acts, records, bills) plus a short list of special acts that need their own hook (set a fire, displayed a corpse, started a social fight). Each category also offers group entries (any drug, hard drugs, human meat, any surgery and so on). DLC and modded defs show up with no patch, labelled with the mod they come from.
- The six crimes are gone as a type. Their detection stays and now serves the categories; the old crimes are starter lawbook rows and links between a break and its act.
- "Did it" for a break comes from a link table by mental state class: a dose during a drug binge, a meal during a food binge, a fire during a fire-starting spree, a displayed corpse during a corpse obsession, an insult during an insulting spree, a jailbreak talk during a jailbreaker break. A modded break that reuses a vanilla class gets its link too. Every other break offers Planning only until a later release links it.
- Aggressive breaks (berserk, murderous rage and the rest with `IsAggro`) are in the catalogue from 1.0 but offer Warn and Guilty only: subdue would walk an unarmed warden into a pawn that fights back, and vanilla refuses to arrest them.
- One act, one case: an act that is the did-it of an open break case belongs to that case; otherwise each category's most specific enabled row decides. Rows of different categories that can catch the same act get an overlap hint in the editor.
- New hooks: `Pawn_RecordsTracker.Increment` and `AddTo`, `HistoryEventsManager.RecordEvent`, `Notify_IterationCompleted` on the bill classes, `CompUsable.UsedBy`. Hook D (`CompDrug.PostIngested`) is dropped, since hook C sees every dose.
- Plan: 1.0 takes 12 days instead of 10 (the picker and the category workers). 1.8 shrinks from 3 days to 2: food binges, jailbreakers, desertion and slaughterers are breaks in the 1.0 catalogue. The plan is 50 days.
- Defaults to confirm: one entry per row rather than a set of ticked entries (the most-specific rule needs one entry per row), and no subdue for aggressive breaks before 1.2.
Changes on 2026-11-30, after three reviews:
@ -30,20 +39,20 @@ Changes on 2026-11-30, first design:
| Version | What players get | Needs | Replaces | Days |
|---|---|---|---|---|
| 1.0 | An empty Laws tab. Add a law as Action, Stage, Severity, Punishment and Days, or press "Starter lawbook". Six crimes from vanilla behaviour: drug binge (any drug or one, wake-up included), fire starting, corpse obsession, starting a social fight, insults, eating meat. Punishments: warn, guilty for N days, subdue (a capped beating that stops a break and never kills), jail for N days then back to work, subdue then jail. A case log, messages and letters | None (slaves: Ideology) | Rimworld Law and Order (419, 1.6 only, needs Ideology). Covers "arrest my own pawn for assault" and "reprimand my own pawn" asked on Prisoner Sentencing (1.3k) and "colonists commit small crimes and get caught" asked on RimCourt (8.8k) | 10 |
| 1.0 | An empty Laws tab. Add a law as Action, Stage, Severity, Punishment and Days, or press "Starter lawbook". The Action comes from a searchable catalogue of every mental break, everything eaten or used, every social interaction, every recorded act and record, every bill, plus fire setting, corpse display and social fights, DLC and modded content included. Punishments: warn, guilty for N days, subdue (a capped beating that stops a break and never kills), jail for N days then back to work, subdue then jail. A case log, messages and letters | None (slaves, most recorded acts: Ideology) | Rimworld Law and Order (419, 1.6 only, needs Ideology). Covers "arrest my own pawn for assault" and "reprimand my own pawn" asked on Prisoner Sentencing (1.3k) and "colonists commit small crimes and get caught" asked on RimCourt (8.8k) | 12 |
| 1.1 | Sentences done right: release gives back the bed, grave, throne, deathrest casket, ideoligion role and mech work modes. Pardon and early release. Reprimand (mood). Jail for slaves. Banish and execute as confirmed punishments. "Trial" as a punishment, through Ideology's vanilla trial. Blax Castes keeps the caste through any sentence | None (slaves, trial: Ideology; throne: Royalty; casket, mechs: Biotech) | Custom Guilt Duration for colonists (3.4k, no 1.7), Guilty! (302, 1.6) | 6 |
| 1.2 | Violent crimes: tantrum and vandalism, assault, harming prisoners or slaves, murderous rage, manslaughter, murder | None | Law and Order's assault and murder crimes | 3 |
| 1.2 | Violent crimes: assault, harming prisoners or slaves, manslaughter, murder, and "did it" for tantrums, berserk, murderous and sadistic rage | None | Law and Order's assault and murder crimes | 3 |
| 1.3 | Court sessions on the core game: a case goes to trial before an appointed judge, a prosecutor and spectators at a place you pick, when you convene it or, if you switch that on, at the next court hour. The verdict weighs the evidence against the speakers' Social skill, and the sentence comes from the lawbook. A button removes Laws from a save | None | The vanilla trial as the only court (Ideology), Law and Order's trials | 9 |
| 1.4 | Elected judge: the colony votes by opinion and Social skill, for a 60-day term, with by-elections and recalls. With Ideology the leader or the moral guide can be judge instead | None (leader as judge: Ideology) | None; overlaps Rimocracy (6.3k), which elects leaders | 4 |
| 1.5 | Attorneys: the accused asks a colonist to defend him or speaks for himself; prosecutor and defender argue with Social, gain Social XP and are remembered for it | None | None; answers the prosecution and defence request on RimCourt | 3 |
| 1.6 | Trials over 1 to 3 court days by severity, custody between the days, and courtrooms that make a verdict easier to accept | None | None | 6 |
| 1.7 | Law votes: colonists propose and repeal laws, each pawn votes by traits, ideoligion, opinion and mood, the result says why, and you can back or veto it | None (precept stances: Ideology) | None; overlaps Rimocracy's decisions (6.3k) | 5 |
| 1.8 | More crimes: jailbreak, desertion, slaughtering colony animals, food binge, drugs against the drug policy, prison break, slave rebellion | None (slave rebellion: Ideology) | Law and Order's sabotage crime, partly | 3 |
| Total | | | | 49 |
| 1.8 | More crimes: "did it" for slaughterers, drugs against the drug policy, prison break, slave rebellion | None (slave rebellion: Ideology) | Law and Order's sabotage crime, partly | 2 |
| Total | | | | 50 |
Effort: S = 0.5 days, M = 2, L = 5, summed per release and rounded up. Subscriber counts are current subscribers from the Steam Web API (GetPublishedFileDetails), read on 2026-11-30; "no 1.7" means the item has no 1.7 tag. Needs: "None" means the release runs on the core game, and a DLC in brackets marks the parts that switch off without it (see "DLC support").
Total: 49 working days. 1.0 takes 10 and is useful alone. It ships whole: a 1.0 cut to the wake-up example (lawbook, binge, fire and corpse; warn, subdue, jail) would still need the enforcement core, the subdue job, jail and the scaffold, and would save one day. 1.1 comes next because 1.0's jail leaves gaps a long colony feels (unclaimed beds, lost roles). 1.2 adds only the violent crimes, the cases a court is most often wanted for (assault, murder), so the court line (1.3 to 1.6) starts on day 20 and builds step by step. Law votes (1.7) reuse the voting core of the judge election (1.4). The other new crimes (1.8) wait until the court, the judge, attorneys and votes are out, since those are the additions asked for.
Total: 50 working days. 1.0 takes 12 and is useful alone. It ships whole: a 1.0 cut to the wake-up example (lawbook, breaks and ate only; warn, subdue, jail) would still need the picker, the enforcement core, the subdue job, jail and the scaffold, and would save about two days. 1.1 comes next because 1.0's jail leaves gaps a long colony feels (unclaimed beds, lost roles). 1.2 adds only the violent crimes, the cases a court is most often wanted for (assault, murder), so the court line (1.3 to 1.6) starts on day 22 and builds step by step. Law votes (1.7) reuse the voting core of the judge election (1.4). The rest of the new crimes (1.8) wait until the court, the judge, attorneys and votes are out, since those are the additions asked for.
## Defaults I picked
@ -51,14 +60,17 @@ Change if you disagree.
- Name: Blax Laws, subtitle "Lawbook, crimes and punishments". It keeps the one-word plural of Slaves, Castes, Zones and Defaults, and says what the player edits: a book of laws. "Court" names one later feature, "Justice" and "Legislation" are abstract nouns that break the plural pattern, and "Law" alone sits next to "Law and Order" on the Workshop. Mods folder `BlaxLaws`, Forgejo repo `rimworld-blax-laws` when you create it.
- The lawbook starts empty, in new games and in saves the mod is added to. Until a row exists Laws detects nothing and punishes nothing (from 1.7, while law votes are on, it counts acts without opening cases).
- "Starter lawbook" adds seven suggested rows in one click, only when pressed: drug binge (any drug) planning: subdue, Moderate; drug binge did it: jail 5 days, Serious; fire starting planning: subdue, Serious; fire starting did it: jail 10 days, Grave; corpse obsession planning: subdue, Moderate; started a fight did it: warn, Minor; insult did it: warn, Minor. "Ate meat" is left out, since most colonies eat meat. Pressing it again adds only rows that are missing.
- Action, Option and Stage together are a row's key: the editor refuses a second row with the same three and jumps to the existing one. When several enabled rows match one act, the most specific wins: one chemical over hard or social drugs over any drug, human meat over raw meat over any meat. The starter rows plus "wake-up, did it, jail 10 days" give a wake-up binger one case and 10 days.
- Stages: "Planning" (the break has started, nothing done yet) and "Did it". The stage dropdown offers only the stages a crime really has: planning exists for drug binges, fire-starting sprees, corpse obsession and insulting sprees, never for meat, fights or a random insult. No guessing from mood or traits.
- "Starter lawbook" adds seven suggested rows in one click, only when pressed: any drug binge planning: subdue, Moderate; any drug binge did it: jail 5 days, Serious; fire-starting spree planning: subdue, Serious; fire-starting spree did it: jail 10 days, Grave; corpse obsession planning: subdue, Moderate; started a social fight did it: warn, Minor; Insult did it: warn, Minor. "Ate: any meat" is left out, since most colonies eat meat. Pressing it again adds only rows that are missing.
- One catalogue entry per row. An entry is a single def (Insult, Wake-up, the fire-starting spree) or a group (any drug binge, hard drugs, human meat, any surgery). A row that ticks several entries, like a bill's ingredient filter, would make "the most specific row wins" ambiguous, so a player who wants three drugs adds three rows or picks a group.
- Action, Option and Stage together are a row's key: the editor refuses a second row with the same three and jumps to the existing one. Option exists only for drug binges (which drug counts as "did it": any, hard, social or one chemical). When several enabled rows of one category match an act, the most specific wins: a single def over a group over the category's "any"; for binges one chemical over hard or social drugs over any drug. The starter rows plus "drug binge, wake-up, did it, jail 10 days" give a wake-up binger one case and 10 days.
- Stages: "Planning" (the break has started, nothing done yet) and "Did it". Only break entries have Planning, since the game decides the break type at the moment the break starts and never earlier. A break has "Did it" only when the link table names its act (see "Act catalogue and detection"); every other entry is "Did it" only. No guessing from mood or traits.
- Severity is Minor, Moderate, Serious or Grave. It sets the default days (1, 3, 5, 10), orders the case log and, from 1.3, weighs in court. Days go from 1 to 50, so a sentence plus the release walk stays inside Blax Castes' default memory of the old caste (60 days).
- Punishments in 1.0: Warn, Guilty for N days, Subdue, Jail for N days, Subdue then jail. Planning (binge, fire, corpse, insulting spree) offers Warn, Subdue and Jail. Did it offers all five for those crimes, and Warn, Guilty and Jail for meat, fights and insults. Subdue acts only while the offender is still in its break; after the break a Subdue row warns and a Subdue then jail row jails.
- Punishments in 1.0: Warn, Guilty for N days, Subdue, Jail for N days, Subdue then jail. Planning offers Warn, Subdue and Jail. A break's Did it offers all five. Every entry outside the breaks offers Warn, Guilty and Jail. Subdue acts only while the offender is still in its break; after the break a Subdue row warns and a Subdue then jail row jails.
- Aggressive breaks (`MentalStateDef.IsAggro`: berserk, murderous rage, sadistic rage and modded ones) offer only Warn and Guilty in 1.0. A berserk pawn fights back, so a subdue would walk an unarmed warden into a fight, and vanilla refuses to arrest a berserk pawn. Guilty still makes the vanilla capture after you down it certain and an execution justified. 1.2 adds subdue for them with the enforcer's Melee weighed.
- One case per incident. A binge is one case from its start to its end; it moves from planning to did it, and each row fires once per case. A dose count and notes ("on a table", "dug up from a grave") go into the case.
- One act, one case. An act that is the did-it of an open break case (a dose during the binge) belongs to that case, and no other row opens a second case for it. Outside a break each category files its own case, so "Ate: wake-up" and "Recorded acts: ingested a drug" (Ideology) both catch a dose; the editor shows an overlap hint on rows of different categories that can catch the same act.
- One enforcement per case. A later stage's punishment replaces an unfinished earlier one: a did-it Jail that arrives while the planning subdue still runs ends the subdue, and the same enforcer starts the arrest, or the capture if the offender is already down (Verse.AI/GenAI.cs:39-67). Warn and Guilty run alongside.
- Acts outside a break (meat, fights, insults outside a spree) open at most one case per offender and law per day (setting, 0 to 7 days). A further act inside that window raises the count on that case and posts no message, so a feud or a meat-eating colony of 60 doesn't flood the log or the save.
- Every act outside a break opens at most one case per offender and law per day (setting, 0 to 7 days). A further act inside that window raises the count on that case and posts no message, so a feud, a meat-eating colony of 60 or a "Records: things hauled" row doesn't flood the log or the save.
- Who the laws cover: free colonists, children included, and colony slaves. Never guests, Hospitality visitors, quest lodgers, prisoners or babies. Slaves get Warn, Guilty and Subdue in 1.0; jail for slaves comes in 1.1.
- Children (Biotech) are never beaten: Subdue on a child becomes Jail when the row has days, otherwise Warn.
- Player orders are exempt: an act done while drafted or on a player-forced job opens no case (setting).
@ -71,6 +83,7 @@ Change if you disagree.
- Messages for every case. Letters only when a colonist is jailed or you have to act: no prisoner bed, no enforcer, a role holder on hold. The vanilla break letter already arrives, so Laws never sends a second letter for a break.
- "Enforce laws" switched off keeps the case log running and carries out nothing.
- Laws adds no crime events and no mental breaks. It only watches what the game does anyway; Law and Order was called useless after its crime events flooded a commitment save.
- The catalogue shows every entry the loaded game has, Royalty's psytrainers and a modded drug included, each labelled with its mod. Entries that make little sense as crimes (eating a simple meal, chitchat) stay in: the list is the game's, the lawbook is yours.
- The court convenes when you press "Convene court" (1.3), or on its own at the court hour once you switch on "Convene court on its own" (off). "Trial" is a punishment you pick per row. The judge is appointed until you switch to elections (1.4). Votes are off per save until you switch them on (1.7).
- Multiplayer: not supported.
@ -85,35 +98,39 @@ Three parts carry everything: the component, the defs and the hooks. Enforcement
All state lives in one `GameComponent_BlaxLaws`. Laws are colony policy across every map, caravan and world pawn, so a MapComponent would be the wrong place.
- Saved:
- `List<Law> laws` (deep) and `nextLawId`. A `Law` holds only names and numbers: id, crime defName, option (a chemical defName, a meat kind or "slights too"), stage and severity as enum names, punishment defName, days, enabled.
- `List<Case> cases` (deep) and `nextCaseId`. A `Case` holds the offender (pawn reference plus name and ThingID), the victim (same), crime defName, mental state defName for planning cases, stage reached, count, note flags, open tick, status (Open, Enforcing, Jailed, Closed), outcome key, enforcer reference (one enforcement at a time), which stages' punishments ran, the last act tick for the cooldown, and for jail the capture tick, whether the Maintain only write is done, the release tick and the bed the pawn owned before the arrest job.
- `List<Law> laws` (deep) and `nextLawId`. A `Law` holds only names and numbers: id, act key (category plus defName or group id, such as `Ate/WakeUp`, `Ate/@humanMeat`, `Break/FireStartingSpree`, `Special/SetFire`), the entry's label and source mod as they read when the row was written, option (a chemical defName or a drug group, binges only), stage and severity as enum names, punishment defName, days, enabled.
- `List<Case> cases` (deep) and `nextCaseId`. A `Case` holds the offender (pawn reference plus name and ThingID), the victim (same), the law's act key and the defName that matched it (which drug, which recipe), mental state defName for planning cases, stage reached, count, note flags, open tick, status (Open, Enforcing, Jailed, Closed), outcome key, enforcer reference (one enforcement at a time), which stages' punishments ran, the last act tick for the cooldown, and for jail the capture tick, whether the Maintain only write is done, the release tick and the bed the pawn owned before the arrest job.
- A random int token for ids handed to other mods later, as Castes does.
- Pawn references: Castes' pattern. `Scribe_References` with `logNullErrors` off; on save and after load, references to Discarded or destroyed pawns become null and the case keeps the name. Closed cases older than the retention setting (60 days) are pruned on save.
- Not saved: the watched-crime flags and the enforcement queue (both rebuilt), the instance cache (a weak reference, as in Castes).
- Not saved: the watched-act flags and sets, the act catalogue and the enforcement queue (all rebuilt), the instance cache (a weak reference, as in Castes).
- `Game.FillComponents` adds the component to a new game and after loading (Verse/Game.cs:345, 443-446, 472-489), so a save made without Laws loads with an empty book.
- Plain unsubscribe: the component node loads as null with exactly 2 errors, "Could not find class BlaxLaws.GameComponent_BlaxLaws" and "SaveableFromNode exception: Can't load abstract class Verse.GameComponent", and `FillComponents` removes the null (Verse/Game.cs:474). Laws, cases and sentences go with it. Guilt is vanilla (RimWorld/Pawn_GuiltTracker.cs:40-44) and runs out on its own. A jailed colonist stays a vanilla prisoner of the colony; release it by hand in the prisoner tab.
### Crimes and punishments are defs, saved as names
### The act catalogue is built from the game's defs, saved as names
- `CrimeDef` (our own Def type) with label, the stages it offers, its option kind and a `CrimeWorker` class. `PunishmentDef` with label, the stages and crime kinds it fits, and a `PunishmentWorker`. 1.0 ships six crimes and five punishments in `Defs/BlaxLaws_Crimes.xml` and `Defs/BlaxLaws_Punishments.xml`.
- The save names them only as strings, resolved with `GetNamedSilentFail`. A row whose def is missing (a later DLC crime without its DLC, a removed compat crime) stays in the book, shows "Needs <DLC>" or "Unknown" and isn't enforced.
- The lawbook UI reads the stage list from the def, so a crime without a planning stage never offers one.
- Laws defines no crime list of its own. `ActCategoryDef` (our own Def type, seven in 1.0: Break, Ate, Used, Interaction, RecordedAct, Record, Bill) names an `ActCategoryWorker` that reads the loaded defs once, after def loading, and returns the category's entries: one per def plus its group entries. `ActDef` (our own Def type) is a special act with its own hook and `ActWorker`: SetFire, DisplayedCorpse and StartedSocialFight in 1.0, the violent acts from 1.2. `BreakLinkDef` (our own Def type) names a mental state class and the act that counts as its "did it" (see "Act catalogue and detection"). `PunishmentDef` with label, the stages and entry kinds it fits, and a `PunishmentWorker`. 1.0 ships them in `Defs/BlaxLaws_Categories.xml`, `BlaxLaws_Acts.xml`, `BlaxLaws_BreakLinks.xml` and `BlaxLaws_Punishments.xml`. Another mod can add a `BreakLinkDef` for its own break class with no code.
- `ActCatalogue` holds the entries: key, label, icon, source mod (`def.modContentPack`, shown as "Core", the DLC's name or the mod's name), category, the stages and punishments the entry offers. It is built once per game start (a few thousand entries with a large mod list; the picker searches it, nothing else walks it) and never saved.
- The save names entries only as strings: the act key, resolved through the catalogue. A row whose entry is missing (a DLC drug without its DLC, a removed mod's interaction) stays in the book with its saved label and mod, shows "Needs <DLC>" or "Missing: <mod>" and isn't enforced. It works again when the mod comes back.
- The lawbook UI reads the stage list from the entry, so an entry without a planning stage never offers one.
- Our defs never enter a vanilla save list. Laws adds no HediffDef, no memory ThoughtDef, no PrisonerInteractionModeDef, no HistoryEventDef, WorkTypeDef or RecordDef (vanilla keeps those in a `DefMap` saved by index, Verse/DefMap.cs:52-66), no IncidentDef, no Letter subclass and no LetterDef. The one JobDef (subdue) is hidden from the save. The Laws tab's MainButtonDef is never saved.
### Detection: one postfix per act, quiet while the book is empty
- Static flags per crime (binge, fire, corpse, fight, insult, meat) plus a `HashSet<MentalStateDef>` of watched break states are a cache of the current game's lawbook. They are rebuilt on every lawbook write and in the component's `FinalizeInit`, and cleared when a game starts or loads. Every hook reads its flag first, so while the book is empty and law votes are off (1.7) a hook costs one static field read per call.
- One static flag per category and per special act, plus per category a `HashSet` of the watched defs (groups expanded when the set is built: "hard drugs" becomes every ThingDef whose drug category is Hard), are a cache of the current game's lawbook. Groups that depend on the thing rather than its def (a meal with human meat in it) keep a predicate that runs only when the category's flag is on. Flags and sets are rebuilt on every lawbook write and in the component's `FinalizeInit`, and cleared when a game starts or loads. Every hook reads its flag first, so while the book is empty and law votes are off (1.7) a hook costs one static field read per call; with the flag on, one set lookup.
- Every hook body sits in try/catch with a one-time log, reset in `FinalizeInit` (Zones' `Once` pattern). A hook only records; it never punishes. Punishments run from the enforcement queue on the next tick.
- Offender filter, shared by every hook: spawned on a map, humanlike, `Faction.IsPlayer`, free colonist or colony slave, not a quest lodger (RimWorld/QuestUtility.cs:524), not a baby, not subhuman. Caravan acts are skipped in 1.0 (Backlog).
- Player orders: the offender `Drafted` or its current job `playerForced` (Verse.AI/Job.cs:37) exempts the act while the setting is on.
- 1.0 hooks, all postfixes unless noted, none on a method the JIT may inline:
- A. `MentalStateHandler.TryStartMentalState` (Verse.AI/MentalStateHandler.cs:91), about 110 lines. `PostStart` runs at :162 before `return true` at :202, so the binge chemical and the obsession corpse are already chosen. Opens planning cases.
- C. `Thing.Ingested` (Verse/Thing.cs:2005), prefix and postfix. Called once per meal from `Toils_Ingest` (RimWorld/Toils_Ingest.cs:428), and from doctors and caravans. Meat.
- D. `CompDrug.PostIngested` (RimWorld/CompDrug.cs:47), a virtual override reached from `ThingWithComps.PostIngested` (Verse/ThingWithComps.cs:767-774). Binge doses.
- E. `Pawn_InteractionsTracker.TryInteractWith` (RimWorld/Pawn_InteractionsTracker.cs:176), about 90 lines, returns true at :268. Insults.
- F. `Pawn_InteractionsTracker.StartSocialFight` (RimWorld/Pawn_InteractionsTracker.cs:373): a message, two 9-argument `TryStartMentalState` calls and a tale. Fights.
- I. `Verb_Ignite.TryCastShot` (RimWorld/Verb_Ignite.cs:12), a protected override reached only through the virtual verb call. Fires.
- J. `MentalState_CorpseObsession.MentalStateTick` (Verse.AI/MentalState_CorpseObsession.cs:18), a virtual override that runs only for obsessed pawns. Corpse displayed.
- A. `MentalStateHandler.TryStartMentalState` (Verse.AI/MentalStateHandler.cs:91), about 110 lines. `PostStart` runs at :162 before `return true` at :202, so the binge chemical and the obsession corpse are already chosen. Break category: opens planning cases.
- C. `Thing.Ingested` (Verse/Thing.cs:2005), prefix and postfix. Called once per meal from `Toils_Ingest` (RimWorld/Toils_Ingest.cs:428), and from doctors and caravans. Ate category, and every binge dose (it reaches `CompDrug.PostIngested` through `ThingWithComps.PostIngested`, Verse/ThingWithComps.cs:767-774, so the old hook D is gone).
- E. `Pawn_InteractionsTracker.TryInteractWith` (RimWorld/Pawn_InteractionsTracker.cs:176), about 90 lines, returns true at :268. Interaction category.
- F. `Pawn_InteractionsTracker.StartSocialFight` (RimWorld/Pawn_InteractionsTracker.cs:373): a message, two 9-argument `TryStartMentalState` calls and a tale. Special act StartedSocialFight.
- I. `Verb_Ignite.TryCastShot` (RimWorld/Verb_Ignite.cs:12), a protected override reached only through the virtual verb call. Special act SetFire.
- J. `MentalState_CorpseObsession.MentalStateTick` (Verse.AI/MentalState_CorpseObsession.cs:18), a virtual override that runs only for obsessed pawns. Special act DisplayedCorpse.
- U. `CompUsable.UsedBy(Pawn p)`, public virtual (signature in the 1.7.5021 reference assembly). Used category. Patched on `CompUsable` and on every subclass that overrides it, found by reflection at startup, with a per-call depth guard so an override that calls base files once.
- H. `HistoryEventsManager.RecordEvent(HistoryEvent, bool)`. Recorded-act category; the offender is the event's `HistoryEventArgsNames.Doer` (`args.TryGetArg<Pawn>`), an event without a doer opens nothing. Most of these events are recorded only with Ideology active (see "To verify").
- R. `Pawn_RecordsTracker.Increment(RecordDef)` and `AddTo(RecordDef, float)`. Record category; the offender is the tracker's `pawn`. `Time` records are not in the catalogue: they count up on their own every 80 ticks (`RecordsTickInterval`), and if that runs through `AddTo`, the set lookup drops them. Both methods are short; if the decompiled code shows a body small enough for the JIT to inline (see "To verify"), the record category polls instead: every 250 ticks it compares the watched records of free colonists with the last values, unsaved, and loses only the player-order exemption.
- B. `Notify_IterationCompleted(Pawn billDoer, List<Thing> ingredients)` on `Bill`, `Bill_Production`, `Bill_Medical` and `Bill_Autonomous` (each declares it in the reference assembly) and on any modded subclass that overrides it, with the same depth guard as U. Bill category; the offender is `billDoer`, a bill finished without a doer (Biotech's mech gestators) opens nothing.
- Two more hooks serve the jail, not detection (see "Enforcement runs a tick later"): K on `Pawn_GuestTracker.CapturedBy` and, from 1.1, L on `GenGuest.PrisonerRelease`.
- Not patched: `MentalState_CorpseObsession.Notify_CorpseHauled` (one store, :47-50), `Pawn_GuiltTracker.Notify_Guilty` (one store, RimWorld/Pawn_GuiltTracker.cs:46-49), `MentalStateHandler.ClearMentalStateDirect` and `MentalState.RecoverFromState`. A break that ends with nothing done is found by the 250-tick sweep over open planning cases instead, which needs no hook.
@ -151,18 +168,21 @@ All state lives in one `GameComponent_BlaxLaws`. Laws are colony policy across e
Every Blax mod works with any DLC combination, core only included (rule of 2026-11-29). For Laws:
- About.xml names no DLC, neither as a dependency nor in loadAfter.
- Every 1.0 crime is core: the break defs are in Core (Defs/MentalStateDefs/MentalStates_Mood.xml: FireStartingSpree :58, Binging_DrugExtreme :91, CorpseObsession :399, Binging_DrugMajor :276, InsultingSpree :519, TargetedInsultingSpree :556), Insult and Slight in Core (Defs/InteractionDefs/Interactions_Social.xml:80, 116), wake-up in Core (Defs/Drugs/WakeUp.xml:5, chemical :115). No 1.0 crime uses a HistoryEvent: `AteMeat` is Ideology-only and skips processed food (Verse/Thing.cs:2055-2064), so the meat law reads the food itself.
- Every 1.0 category is core: the catalogue lists whatever the loaded game holds, so a DLC's breaks, drugs, interactions, usables and recipes appear when the DLC is active and are absent without it. The starter lawbook uses only Core entries (Defs/MentalStateDefs/MentalStates_Mood.xml: FireStartingSpree :58, Binging_DrugExtreme :91, CorpseObsession :399, Binging_DrugMajor :276; Insult in Defs/InteractionDefs/Interactions_Social.xml:80), and so does the wake-up example (Defs/Drugs/WakeUp.xml:5, chemical :115). The meat groups of the Ate category read the food itself, because vanilla's `AteMeat` event is Ideology-only and skips processed food (Verse/Thing.cs:2055-2064).
- Recorded acts are the exception in practice: the category is core, but most history events are recorded only with Ideology active, so without Ideology the category may be nearly empty or never fire. The picker lists the event defs that exist and the category's tooltip says "Most recorded acts need Ideology".
- A missing entry from a DLC shows "Needs <DLC>", read from the source mod saved with the row; from any other mod "Missing: <mod>".
- DLC content meets checks that are false without the DLC: slaves exist only with Ideology (`IsSlave`), children with Biotech (`DevelopmentalStage`), roles with Ideology (`ModsConfig.IdeologyActive` before any role read), mechanitors with Biotech (`ModsConfig.BiotechActive`, as vanilla checks at RimWorld/Pawn_GuestTracker.cs:536), subhumans with Anomaly (`IsSubhuman`, which `CanBeArrestedBy` also checks, Verse.AI/GenAI.cs:79-82).
- DLC defs only through `MayRequire` in XML and `[MayRequire<DLC>]` DefOf fields. DLC code only behind `ModsConfig.<DLC>Active`; `ModLister.Check<DLC>` is an install check, not an active check.
- A choice that needs a DLC shows disabled with "Needs <DLC>" instead of hiding: 1.1's Trial until 1.3 ("Needs Ideology"), 1.4's leader and moral guide as judge.
- A save made with a DLC loads without it: the component holds pawn references, names and numbers. A row naming a DLC crime stays and shows "Needs <DLC>". A case whose offender was a slave keeps its name.
- A save made with a DLC loads without it: the component holds pawn references, names and numbers. A row naming a DLC entry stays and shows "Needs <DLC>". A case whose offender was a slave keeps its name.
- Anomaly and Odyssey: guarded in code only. Laws calls no Anomaly or Odyssey code in 1.0; an Odyssey colony with pawns on two maps enforces per map.
- Tests: `run-tests.ps1 -NoDlc` and `-Dlc`, from Zones' script. A release runs the whole suite, phases 2 and 3 included, in all 8 combinations of Royalty, Ideology and Biotech. A test that needs a DLC logs "skipped: needs Ideology" (or its DLC) without failing.
| Feature | Release | Needs | Without it |
|---|---|---|---|
| Lawbook tab, starter lawbook, case log | 1.0 | None | Works |
| Six crimes | 1.0 | None | Works |
| Act catalogue: breaks, ate, used, interactions, records, bills, special acts | 1.0 | None | Works; DLC entries are simply absent |
| Act catalogue: recorded acts | 1.0 | None (most events: Ideology) | Lists the event defs; most never fire |
| Warn, guilty, subdue, jail, subdue then jail | 1.0 | None | Works. Slaves don't exist |
| Laws for slaves (warn, guilty, subdue) | 1.0 | Ideology | No slaves to cover |
| Hold for role holders | 1.0 | Ideology | No roles |
@ -181,31 +201,34 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
| Leader or moral guide as judge | 1.4 | Ideology | Option disabled with "Needs Ideology"; a saved choice falls back to elected |
| Attorneys, multi-day trials, courtrooms | 1.5, 1.6 | None | Works |
| Law votes | 1.7 | None | Works without the precept term |
| Breaks, escapes, drug policy crimes | 1.8 | None | Works |
| Slaughterer link, prison break, drug policy crimes | 1.8 | None | Works |
| Slave rebellion crime | 1.8 | Ideology | Row shows "Needs Ideology" |
## Releases
### 1.0 Lawbook, six crimes, subdue and jail (10 days)
### 1.0 Lawbook, act catalogue, subdue and jail (12 days)
#### Lawbook tab
- **Players get:** A "Laws" button in the bottom bar, after Ideoligions (order 105; Ideos is 100 and Menu 500, Ideology/Defs/MainButtonDefs/MainButtons.xml:9, Core/Defs/Misc/MainButtonDefs/MainButtons.xml:131). Two tabs. "Lawbook" lists your laws as rows (spec below). "Add law" opens the Action menu first, then adds the row; each column is a dropdown that offers only what fits the chosen action and stage. "Starter lawbook" adds the suggested rows. "Cases" lists cases newest first: who, what, stage, when, punishment, status, with a button to jump to the pawn and, for cases that wait, "Arrest now". An empty book shows one line: "No laws yet. Add one or press Starter lawbook."
- **Players get:** A "Laws" button in the bottom bar, after Ideoligions (order 105; Ideos is 100 and Menu 500, Ideology/Defs/MainButtonDefs/MainButtons.xml:9, Core/Defs/Misc/MainButtonDefs/MainButtons.xml:131). Two tabs. "Lawbook" lists your laws as rows (spec below). "Add law" opens the act picker first (spec below), then adds the row; each other column is a dropdown that offers only what fits the chosen action and stage. Clicking a row's Action opens the picker again. "Starter lawbook" adds the suggested rows. "Cases" lists cases newest first: who, what, stage, when, punishment, status, with a button to jump to the pawn and, for cases that wait, "Arrest now". An empty book shows one line: "No laws yet. Add one or press Starter lawbook."
- **Row spec:**
- Columns: Action; Option, only for crimes that have options (drugs: Any, Hard, Social, then every drug's `ChemicalDef` by label, built from the ThingDefs whose `CompProperties_Drug` names a chemical; meat: Any, Raw meat or corpses, Human meat; insults: Slights count too); Stage; Severity; Punishment; Days, a 1 to 50 field for Guilty, Jail and Subdue then jail and "-" otherwise; On; delete.
- A new row gets the crime's first stage, Moderate, Warn and On.
- Punishments per crime and stage:
- Columns: Action (icon, category and label, with the source mod in the tooltip); Option, only for drug binges (Any, Hard, Social, then every drug's `ChemicalDef` by label, built from the ThingDefs whose `CompProperties_Drug` names a chemical); Stage; Severity; Punishment; Days, a 1 to 50 field for Guilty, Jail and Subdue then jail and "-" otherwise; On; delete. An overlap icon marks a row that can catch the same act as a row of another category; its tooltip names that row.
- A new row gets the entry's first stage, Moderate, Warn and On.
- Punishments per entry and stage:
| Crime | Stage | Punishments |
| Entry | Stage | Punishments |
|---|---|---|
| Drug binge, fire starting, corpse obsession, insulting spree | Planning | Warn, Subdue, Jail |
| The same | Did it | Warn, Guilty, Subdue, Jail, Subdue then jail. Subdue acts only while the offender is still in its break; after it a Subdue row warns and Subdue then jail jails |
| Ate meat, started a fight, insult outside a spree | Did it | Warn, Guilty, Jail |
| A break that isn't aggressive | Planning | Warn, Subdue, Jail |
| The same, with a linked act | Did it | Warn, Guilty, Subdue, Jail, Subdue then jail. Subdue acts only while the offender is still in its break; after it a Subdue row warns and Subdue then jail jails |
| An aggressive break (`IsAggro`) | Planning, and Did it once 1.2 links one | Warn, Guilty |
| Every entry outside the breaks: ate, used, interactions, recorded acts, records, bills, special acts | Did it | Warn, Guilty, Jail |
- Changing Severity resets Days to the new default only while Days still equals the old default. Changing Action or Stage resets a punishment that no longer fits to Warn.
- Action, Option and Stage are the row's key. A duplicate is refused and the list jumps to the existing row.
- **Act picker:** a window like the ingredient filter of a tailoring bill. A search field on top (vanilla `QuickSearchWidget`, the one the trade and policy dialogs use), below it the categories as a collapsible tree: Mental breaks, Ate, Used, Social interactions, Recorded acts, Records, Bills, Special acts. Each category opens with its groups first ("Any drug binge", "Hard drugs", "Human meat", "Any surgery"), then every entry A to Z with its icon (the thing's icon for ate, used and bills, the interaction symbol, the def's label otherwise) and its source mod in grey. Typing filters every category at once and opens those with hits. An entry already in the book shows a tick; clicking it jumps to that row. One click picks an entry and closes the window. With a large mod list a category holds hundreds of bills; the tree draws only the visible rows.
- **How:**
- `MainButtonDef BlaxLaws_Laws` with `tabWindowClass BlaxLaws.MainTabWindow_Laws`. The window is a `MainTabWindow` with two `TabRecord`s, a scroll view and `Widgets.Dropdown` per column.
- `Dialog_PickAct : Window` draws the picker: a `QuickSearchWidget` in `DoWindowContents`, its `filter.Matches(label)` against each entry's label and defName, the tree in a scroll view that skips rows outside the view rect. It reads `ActCatalogue` and returns an act key.
- Every write goes through one `Lawbook` class (as every Castes write goes through `CasteManager`): add, edit, delete, starter. It rebuilds the watched flags after each write.
- Deleting a law that has open cases asks first and names the count; those cases close as "law repealed".
- The case list reads the component; the jump button uses `CameraJumper.TryJumpAndSelect`.
@ -213,55 +236,79 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- **Settings:** As listed; the book itself is per save.
- **Save and removal:** The book and cases save in the component. Removal drops them with it.
- **Overlaps:** Federation: Laws and Warrants (3823463956, 10 subs, 1.6) has the only other laws tab on the Workshop, inside its own scenario.
- **Replaces:** Nothing alone; with the crimes and punishments below it replaces Rimworld Law and Order (3661387691, 419 subs, last update 2026-02-15, 1.6 only, needs Ideology, five hardcoded crimes).
- **Effort:** M, 2 days.
- **Tests:** A new game has an empty book, no cases and every watch flag false. Adding a binge row sets the binge flag and the watched state set holds both binge defs; deleting it clears them. Starter lawbook adds 7 rows; pressing it again adds none. Rows keep id, option, stage, severity, punishment, days and the On flag through phase 2. A row whose crime defName doesn't resolve (written into the component by the test) stays, reports "Unknown" and opens no case. A save made without Laws loads with an empty component. With "Show Laws tab" off, `buttonVisible` is false at once. A second row with the same Action, Option and Stage is refused. A new row reads first stage, Moderate, Warn, On. Moderate to Serious moves untouched Days from 3 to 5 and leaves typed Days alone. Switching a Subdue row's action to Ate meat resets it to Warn. The drug option list holds WakeUp and no non-drug chemical.
- **Replaces:** Nothing alone; with the catalogue and punishments below it replaces Rimworld Law and Order (3661387691, 419 subs, last update 2026-02-15, 1.6 only, needs Ideology, five hardcoded crimes).
- **Effort:** M plus S for the picker, 2.5 days.
- **Tests:** A new game has an empty book, no cases and every watch flag false. Adding an "any drug binge" row sets the Break flag and the watched set holds both binge defs; deleting it clears them. Starter lawbook adds 7 rows; pressing it again adds none. Rows keep id, act key, saved label and mod, option, stage, severity, punishment, days and the On flag through phase 2. A row whose act key doesn't resolve (written into the component by the test, once with "Core" and once with "Ideology" as its saved mod) stays, reports "Missing: Core" or "Needs Ideology" and opens no case. A save made without Laws loads with an empty component. With "Show Laws tab" off, `buttonVisible` is false at once. A second row with the same Action, Option and Stage is refused. A new row reads first stage, Moderate, Warn, On. Moderate to Serious moves untouched Days from 3 to 5 and leaves typed Days alone. Switching a Subdue row's action to "Ate: any meat" resets it to Warn. The drug option list holds WakeUp and no non-drug chemical. The picker's search for "wake" lists Wake-up under Ate and "make wake-up" under Bills; for "insult" it lists Insult under interactions and the insulting sprees under breaks. "Ate: wake-up" next to "Recorded acts: ingested a drug" shows the overlap icon on both.
- **Risks:** Humanoid Alien Races pawns never got Law and Order's tab; Laws has no per-pawn tab, and its offender filter is `RaceProps.Humanlike`, so alien colonists are covered. Test with HAR in `-Compat`.
#### Six crimes
#### Act catalogue and detection
- **Players get:** Laws notice these acts and open a case:
- **Players get:** Any act in the catalogue can be a law. The categories, what fills them and what opens a case:
| Action | Option | Planning | Did it |
| Category | Entries | Groups | A case opens when |
|---|---|---|---|
| Drug binge | Any drug (default), hard drugs, social drugs, or one chemical such as wake-up | The binge break starts, drug chosen, nothing taken yet | Each dose taken during the binge, counted |
| Fire starting | None | A fire-starting spree starts | Each fire set, counted |
| Corpse obsession | None | The obsession starts, corpse chosen | The corpse is displayed; the case notes "on a table" and "dug up from a grave", which is nearly always true |
| Started a fight | None | None | A social fight starts. The offender is the pawn who reacts and swings, usually the insulted one |
| Insult | Slights count too (off) | An insulting spree starts | Each insult, by the one who insults |
| Ate meat | Any meat, meals with meat included (default); raw meat or corpses; human meat | None | The pawn eats it |
| Mental breaks | Every `MentalStateDef` a `MentalBreakDef` starts, plus the states colonists reach another way (berserk); animal and baby states are left out | Any drug binge, any tantrum, any insulting spree, any aggressive break, any break | Planning: the break starts. Did it: its linked act happens during the break (link table below) |
| Ate | Every ThingDef with `ingestible`: food, meals, raw food, corpses, drugs, modded and DLC ones | Any drug, hard drugs, social drugs, medical drugs; any meat (meals with meat included), raw meat or corpses, human meat, insect meat; raw food; any meal | The pawn eats it on its own job; a doctor's dose or a warden feeding a patient doesn't count |
| Used | Every ThingDef with a `CompUsable`: psytrainers, neurotrainers, mech serums, modded usables | None | `UsedBy` runs for the pawn |
| Social interactions | Every `InteractionDef`: insult, slight, chitchat, romance attempts, breakups, jailbreak talk, modded ones | Insult or slight | The pawn starts it and it happens (`TryInteractWith` returns true); the offender is the initiator |
| Recorded acts | Every `HistoryEventDef` except the faction-level ones (goodwill, trade, quests, raids; an exclusion list in XML): cut a tree, butchered a human, harvested an organ, executed a prisoner, ate human meat, got lovin' outside marriage | None | The game records the event with the pawn as its doer. Most need Ideology |
| Records | Every `RecordDef` that counts (Int or Float; time records left out): kills, humanlike kills, animals slaughtered, bodies stripped, things deconstructed, things hauled | None | The pawn's record goes up |
| Bills | Every `RecipeDef`: made a human leather duster, cooked a fine meal, installed a bionic arm, butchered a corpse | Any surgery | The pawn finishes one iteration of the bill |
| Special acts | Set a fire, displayed a corpse, started a social fight (1.0); assault, harmed a prisoner or slave, manslaughter, murder (1.2) | None | Their own hooks, below |
- **Link table:** a break's "Did it" stage exists only when a `BreakLinkDef` names its act. Links go by mental state class, subclasses included, so a modded break that reuses a vanilla class has its "Did it" too:
| Mental state class | Breaks in Core | Did it |
|---|---|---|
| `MentalState_BingingDrug` | Binging_DrugExtreme, Binging_DrugMajor | Ate a drug that matches the row's option (default: any drug) |
| `MentalState_Binging`, not the drug binge | Binging_Food | Ate anything |
| `MentalState_FireStartingSpree` | FireStartingSpree | Set a fire |
| `MentalState_CorpseObsession` | CorpseObsession | Displayed a corpse |
| `MentalState_InsultingSpree` | InsultingSpree, TargetedInsultingSpree | Insult or slight |
| `MentalState_Jailbreaker` | Jailbreaker | The jailbreak talk (`SparkJailbreak` interaction) |
Tantrums, berserk, murderous and sadistic rage get their links in 1.2, slaughterers in 1.8. Every other break, desertion (GiveUpExit) included, is Planning only.
- **How:**
- Catalogue build. Each `ActCategoryWorker` walks its `DefDatabase` once after def loading: breaks from `DefDatabase<MentalBreakDef>` (`mentalState`), plus an include list in XML (Berserk) and an exclude list (animal and baby states: Manhunter, ManhunterPermanent, Roaming, BabyCry, BabyGiggle and their kin, to be read from the defs); ate from ThingDefs with `IsIngestible`; used from ThingDefs whose comps include a `CompProperties_Usable`; interactions from `DefDatabase<InteractionDef>`; recorded acts from `DefDatabase<HistoryEventDef>` minus the exclusion list; records from `DefDatabase<RecordDef>` with `type` Int or Float; bills from `DefDatabase<RecipeDef>`. Groups are predicates over defs, written once in code: drug groups by `ingestible.drugCategory` (None, Medical, Social, Hard), meat groups as below, "raw food" by `ingestible.preferability`, "any meal" by `IsProcessedFood`, "any surgery" by `RecipeDef.IsSurgery`, "any aggressive break" by `MentalStateDef.IsAggro`.
- Most specific row: per category, a row on the exact def beats a group row beats the category's "any". Two groups that both match ("hard drugs" and "any drug") rank by size: the smaller group wins.
- Drug binge.
- Planning: hook A when the new state is `MentalState_BingingDrug`. Its `PostStart` picks the chemical (Verse.AI/MentalState_BingingDrug.cs:24-27, `ChooseRandomChemical` at :49), preferring a chemical the pawn is addicted to (:51-62). Wake-up is a hard drug (Core Defs/Drugs/WakeUp.xml:27), so a wake-up binge comes from an extreme break (Binging_DrugExtreme, `drugCategory` Hard, MentalStates_Mood.xml:91-106) or from any binge of a wake-up addict.
- Did it: hook D when `ingester.MentalState is MentalState_BingingDrug` and `parent`'s chemical matches the row's option. Doctor-given doses (RimWorld/Recipe_AdministerIngestible.cs:11) don't count. A dose outside a binge is normal drug use, not this crime.
- Did it: hook C when `ingester.MentalState is MentalState_BingingDrug` and the drug's `CompProperties_Drug` chemical matches the row's option. Doctor-given doses (RimWorld/Recipe_AdministerIngestible.cs:11) don't count. A dose outside a binge is normal drug use, not this break's crime; an "Ate" row may still catch it.
- The binge ignores forbidden items and the drug policy and lasts 40000 to 60000 ticks (MentalStates_Mood.xml:98-99), so stopping it after dose 1 still prevents the rest.
- Fire starting. Planning: hook A on `FireStartingSpree` (MentalStates_Mood.xml:58-71; the break needs the Pyromaniac trait, Core Defs/TraitDefs/Traits_Singular.xml:340-343). Did it: hook I, offender `CasterPawn`, which `FireUtility.TryStartFireIn` gets as instigator (RimWorld/Verb_Ignite.cs:12-21). Raiders also ignite (RimWorld/TrashUtility.cs:97, 117); the offender filter drops them.
- Corpse obsession. Planning: hook A on `CorpseObsession` (MentalStates_Mood.xml:399-413); `PostStart` picks the corpse (Verse.AI/MentalState_CorpseObsession.cs:41-45). Did it: hook J sees `alreadyHauledCorpse` turn true, which the job's last toil sets (RimWorld/JobDriver_HaulCorpseToPublicPlace.cs:82-95, the call at :90). 80% of drops go on a table (:64, `TryFindTableCell` :97-123); the case checks the corpse's cell for a `def.IsTable` building. "Dug up" is read from the corpse, never from the job: hook J sees the flag only after that last, instant toil, when the haul job and its grave target are gone. Hook A notes it from `corpse.ParentHolder is Building_Grave`, and hook J re-reads it for the current `__instance.corpse` on each call while `alreadyHauledCorpse` is false, since vanilla may pick another corpse (Verse.AI/MentalState_CorpseObsession.cs:26-28). Vanilla only obsesses over buried corpses (`GetClosestCorpseToDigUp` searches `ThingRequestGroup.Grave`, Verse.AI/CorpseObsessionMentalStateUtility.cs:17-21), Anomaly's unnatural corpse aside (:13), so the note is nearly always set. The flag is saved by vanilla (MentalState_CorpseObsession.cs:15), so after a load it is already true: hook J only moves a case that is open at planning, and the case's stage is saved, so the corpse is never filed twice.
- Started a fight. Hook F, offender `___pawn`, the pawn whose tracker starts the fight; `otherPawn` is the provoker. It is called from `CheckSocialFightStart` (RimWorld/Pawn_InteractionsTracker.cs:355-371) on the recipient of an interaction (:217). Slaves only fight slaves and prisoners only prisoners (:402-409). The row's tooltip says who counts as the offender.
- Insult. Hook E: `__result` true and `intDef` Insult, or Slight with the option. Offender `___pawn` (the initiator), victim the recipient. Insults in a spree also come through here (RimWorld/JobDriver_Insult.cs:34). Planning: hook A on `InsultingSpree` or `TargetedInsultingSpree`.
- Ate meat. Hook C. The prefix reads `FoodUtility.GetFoodKind(__instance)` (RimWorld/FoodUtility.cs:1454), `def.IsProcessedFood` and `FoodUtility.IsHumanlikeCorpseOrHumanlikeMeatOrIngredient(__instance)` (used at Verse/Thing.cs:2033) into `__state`, before the stack can be destroyed; the postfix files the case. Babies fed by others are filtered out.
- Each crime's worker opens a case or moves an open one to did it, increments the count, and queues the punishment of the most specific enabled matching row (see "Defaults I picked") once per stage.
- The cooldown setting applies to every act outside a break: meat, fights and insults outside a spree. Inside the window a further act by the same offender under the same law raises the count on that case, open or closed, and files nothing new. An insult that sparks a fight files two cases: the insult for the insulter, the fight for the one who swings.
- Interactions. Hook E: `__result` true and `intDef` in the watched set (Insult, Slight, any other). Offender `___pawn` (the initiator), victim the recipient. Insults in a spree also come through here (RimWorld/JobDriver_Insult.cs:34) and are the insulting spree's did-it. Planning for sprees: hook A on `InsultingSpree` or `TargetedInsultingSpree`. The jailbreaker's talk is the `SparkJailbreak` interaction (`InteractionDefOf.SparkJailbreak`), the did-it of `MentalState_Jailbreaker`.
- Ate. Hook C. The prefix reads the eaten def, `FoodUtility.GetFoodKind(__instance)` (RimWorld/FoodUtility.cs:1454), `def.IsProcessedFood` and `FoodUtility.IsHumanlikeCorpseOrHumanlikeMeatOrIngredient(__instance)` (used at Verse/Thing.cs:2033) into `__state`, before the stack can be destroyed; the postfix files the case. Meat groups: "any meat" from the food kind (meals with meat included), "raw meat or corpses" from `IsMeat` or `IsCorpse` on unprocessed food, "human meat" from that last call, "insect meat" from the meat's source race. It counts only when the ingester eats on its own: its current job is Ingest with the eaten thing as target. A doctor's dose, a warden or parent feeding someone and a baby fed by others run on the feeder's job and are skipped.
- Used. Hook U, the used thing's def against the watched set. A psytrainer, neurotrainer or serum (Royalty, Biotech or Core) files on the pawn that used it.
- Recorded acts. Hook H: the event def against the watched set, then `args.TryGetArg<Pawn>(HistoryEventArgsNames.Doer, ...)`; an event without a doer pawn files nothing. `RecordEvent` also runs for events the player orders (an execution), so the player-order exemption reads the doer's job like every other hook.
- Records. Hook R: the record def against the watched set; the offender is the tracker's `pawn`. A record goes up for many reasons ("things hauled" every haul), and the cooldown keeps one case a day per pawn and row.
- Bills. Hook B: the bill's `recipe` against the watched set, the doer as offender. Bills are standing player orders but not forced jobs, so the exemption doesn't cover them: a row on "make yayo" files on the cook who made it, which is the row's point.
- Each category worker opens a case or moves an open break case to did it, increments the count, and queues the punishment of the most specific enabled matching row (see "Defaults I picked") once per stage. An act that is the linked did-it of an open break case goes to that case and to no other row.
- The cooldown setting applies to every act outside a break. Inside the window a further act by the same offender under the same law raises the count on that case, open or closed, and files nothing new. An insult that sparks a fight files two cases: the insult for the insulter, the fight for the one who swings.
- **Settings:** The cooldown and "Player orders are exempt" from the settings page; per row the option.
- **Save and removal:** Cases save in the component. Hooks save nothing.
- **Save and removal:** Cases save in the component. Hooks and the catalogue save nothing.
- **Overlaps:** Insult System (3783191560, 86 subs) and Grudges! (3491693870, 27.5k, 1.6, unmaintained) add social conflict; Laws only reads vanilla interactions. Pawn Rules (Continued) (3024243615, 6.7k) prevents meat eating per pawn; Laws punishes it afterwards. Snap Out! (1319782555, 636k, no 1.7) talks a pawn out of a break; it is the gentle partner of subdue.
- **Replaces:** Law and Order's crimes are new events and breaks; Laws replaces the idea with vanilla's own acts.
- **Effort:** M, 2 days.
- **Effort:** M for the categories, groups and links, S for hooks U, H, R and B, S for the catalogue tests: 3 days.
- **Tests:**
- Binge: with a "wake-up" row, `TryStartMentalState(Binging_DrugExtreme)` on a colonist whose binge chemical a test hook sets to WakeUp opens one planning case; with yayo chosen, no case. `wakeUp.Ingested(pawn, 0)` during the binge moves it to did it with count 1, a second dose makes count 2, still one case. A wake-up dose outside a binge opens nothing. An "any drug" row catches a beer binge (Binging_DrugMajor). The starter rows plus "wake-up, did it, jail 10 days": a wake-up dose during a binge gives one case and a 10-day sentence.
- Fire: a forced spree opens planning; a forced Ignite job on a wooden wall moves it to did it with count 1. A raider's ignite opens nothing.
- Corpse: a forced obsession on a corpse in a grave opens planning with "dug up from a grave"; driving the haul job to the end with a table in reach moves it to did it with "on a table" and keeps the note. Phase 2 after a save with the flag already true: still one did-it entry.
- Fight: `recipient.interactions.StartSocialFight(initiator)` files the case on the recipient, not the initiator.
- Insult: `TryInteractWith(target, Insult)` files on the initiator. A Slight only with the option. A second insult within a day files nothing; with the cooldown at 0 it files a second case.
- Meat: raw meat, a simple meal with meat and human meat against the three options; a drafted pawn eating opens nothing; a player-forced eat job opens nothing while the setting is on and a case when it is off. 60 colonists eating meat for a day under an "any meat, warn" law produce at most 60 cases and 60 messages.
- Cost: 100000 `TryInteractWith` calls with an empty book run within 2% of the same calls with the patches unapplied (test switch).
- **Risks:** Double counting across laws (a meat bite during a food binge, 1.8) needs the precedence rule "one case per incident per crime". Slights are frequent between rivals (weight 0.02, RimWorld/InteractionWorker_Slight.cs:15); the cooldown keeps the log readable. Modded mental states with their own classes are invisible unless they reuse these defs.
- Ate: raw meat, a simple meal with meat and human meat against the meat groups; a row on the Simple meal def catches the simple meal and not the raw meat; a drafted pawn eating opens nothing; a doctor administering a drug to a patient opens nothing for either pawn; a player-forced eat job opens nothing while the setting is on and a case when it is off. 60 colonists eating meat for a day under an "any meat, warn" law produce at most 60 cases and 60 messages.
- Catalogue: every `MentalBreakDef`'s state, every ingestible ThingDef, every `InteractionDef`, every Int or Float `RecordDef` and every `RecipeDef` of the loaded game has an entry; no Time record and no excluded state has one. The test mod's own defs (a test drug ThingDef, a test InteractionDef, a test RecipeDef, a test mental state reusing `MentalState_FireStartingSpree`) appear with the test mod as source, and the test break offers Did it through the link. In a `-NoDlc` run no DLC entry appears and the starter lawbook still adds 7 rows.
- Used: `UsedBy` of a mech serum (healer) files on the user. Interactions: a forced `Chitchat` with a Chitchat row files on the initiator. Records: `pawn.records.Increment(RecordDefOf.BodiesStripped)` with a row files one case, a second increment the same day raises the count. Recorded acts: an `ExecutedPrisoner` event with a doer files on the doer, the same event without a doer files nothing (skipped without Ideology if vanilla records it only there). Bills: a finished "make simple meal" iteration files on the cook; a mech gestator bill finishing without a doer files nothing (skipped: needs Biotech).
- Jailbreaker: a forced Jailbreaker break opens planning, the `SparkJailbreak` interaction moves it to did it. An aggressive break row offers Warn and Guilty only.
- Cost: 100000 calls each of `TryInteractWith`, `Increment` and `RecordEvent` with an empty book run within 2% of the same calls with the patches unapplied (test switch).
- **Risks:** Double counting across categories (a dose is an Ate act, a recorded act and maybe a record) is accepted and shown by the overlap icon; inside a break the break case owns the act. Slights are frequent between rivals (weight 0.02, RimWorld/InteractionWorker_Slight.cs:15); the cooldown keeps the log readable. A modded break with its own state class is in the catalogue with Planning only until someone adds a `BreakLinkDef`. A mod that records acts without `Increment`, `RecordEvent` or `TryInteractWith` is invisible to Laws. The catalogue labels come from the defs; a modded def without a label shows its defName.
#### Enforcement and cases
- **Players get:** Cases move on by themselves. A planning case closes when the break ends with nothing done, a lost subdue starts again, and an arrest that waited for a bed, an enforcer or the end of a fight happens as soon as it can. One enforcer per case, never one pulled off a rescue, a tending or a fire, and nobody sent through a raid.
- **How:** The `Enforcement` queue, the 250- and 2500-tick sweeps, the enforcer pick with its job and danger filters, the reservation checks and hook K (all in "Enforcement runs a tick later"); the case lifecycle (Open, Enforcing, Jailed, Closed, each closed case with an outcome key); one enforcement per case and the hand-over between stages; the cooldown; the `CrimeWorker` and `PunishmentWorker` base classes.
- **How:** The `Enforcement` queue, the 250- and 2500-tick sweeps, the enforcer pick with its job and danger filters, the reservation checks and hook K (all in "Enforcement runs a tick later"); the case lifecycle (Open, Enforcing, Jailed, Closed, each closed case with an outcome key); one enforcement per case and the hand-over between stages; the cooldown; the `ActCategoryWorker`, `ActWorker` and `PunishmentWorker` base classes.
- **Settings:** "Enforce laws", "Enforcers", "Messages for cases", "Letters for jailings".
- **Save and removal:** Cases in the component. The queue isn't saved; cases in Enforcing refill it after a load.
- **Overlaps:** None.
@ -357,9 +404,9 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- **Harness:** copy Zones' `Tests/` (the most complete: three phases, `-Worktree`, `-WaitSeconds`) as `Tests/BlaxLawsTests`. Switch `-blaxlawstests`, data folder `%TEMP%\BlaxLawsTest`, results `BlaxLawsTestResults.txt`, settings files `Mod_BlaxLaws_*` deleted every run.
- **Phase 3:** after phase 2 the runner saves as `BlaxLawsTest3`, replaces `Class="BlaxLaws.GameComponent_BlaxLaws"` with a type that doesn't exist, loads, and runs the phase 3 tests: exactly the 2 expected errors, a jailed colonist still a prisoner of the colony, no "BlaxLaws" in any pawn's job or queue. Phase 2 saves while an enforcer vomits mid-subdue (`Vomit` started with `resumeCurJobAfterwards`), so phase 3 also proves a queued subdue never reaches the file.
- **Fixtures:** Colonist, ColonySlave (Ideology), Child (Biotech), Prisoner, `Tick`, `QuietStoryteller`, `SnapshotSettings` from Castes; new: `PrisonerBed(cell)`, `Drug(def, cell)`, `Table(cell)`, `Corpse(cell)`, `ForceBreak(pawn, def, chemical)`, `LawRow(crime, option, stage, severity, punishment, days)`.
- **Compat runs:** `-Compat` adds Prison Labor, Prisoner Realism, Custom Prisoner Interactions, Hospitality, Vanilla Social Interactions Expanded, Humanoid Alien Races if installed (Law and Order's tab never showed for its pawns), Blax Castes, Blax Slaves, Blax Zones and Blax Defaults. Package ids are read from each installed About.xml and recorded in Compat.cs with their source, as Castes does. Prisoner Sentencing and Prison Expanded aren't installed; their early release is simulated with a direct `GenGuest.PrisonerRelease`.
- **Performance:** 60 colonists and the starter lawbook, 2500 ticks with and without Laws, median of three runs: Laws adds under 2%.
- **Fixtures:** Colonist, ColonySlave (Ideology), Child (Biotech), Prisoner, `Tick`, `QuietStoryteller`, `SnapshotSettings` from Castes; new: `PrisonerBed(cell)`, `Drug(def, cell)`, `Table(cell)`, `Corpse(cell)`, `ForceBreak(pawn, def, chemical)`, `LawRow(actKey, option, stage, severity, punishment, days)`. The test mod ships its own defs for the catalogue tests: a drug ThingDef, an InteractionDef, a RecipeDef and a MentalStateDef plus MentalBreakDef that reuse `MentalState_FireStartingSpree`.
- **Compat runs:** `-Compat` adds Prison Labor, Prisoner Realism, Custom Prisoner Interactions, Hospitality, Vanilla Social Interactions Expanded, Humanoid Alien Races if installed (Law and Order's tab never showed for its pawns), Blax Castes, Blax Slaves, Blax Zones and Blax Defaults. Package ids are read from each installed About.xml and recorded in Compat.cs with their source, as Castes does. Prisoner Sentencing and Prison Expanded aren't installed; their early release is simulated with a direct `GenGuest.PrisonerRelease`. The catalogue tests run there too: the compat mods' defs must appear under their mod names.
- **Performance:** 60 colonists and the starter lawbook, 2500 ticks with and without Laws, median of three runs: Laws adds under 2%. The same with a "Records: things hauled" row and an "Ate: any meal" row, the two busiest hooks.
- **Effort:** S plus S for the harness copy, the compat and performance runs, plus S for the scaffold (csproj, startup, LawsLog, Compat, DlcSupport, the Tools copy, the art with a "scale" badge): 1.5 days.
### 1.1 Sentences done right and more punishments (6 days)
@ -444,17 +491,17 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
### 1.2 Violent crimes (3 days)
Only the violent crimes come before the court: they are the cases a trial is most often wanted for. The other new crimes wait for 1.8.
Only the violent crimes come before the court: they are the cases a trial is most often wanted for. The rest wait for 1.8.
#### Violence
- **Players get:** Tantrum and vandalism (planning: the tantrum starts; did it: damaged or destroyed something), assault (hurt a colonist, slave or guest outside a fight), harming prisoners or slaves (sadistic rage included), murderous rage (planning, with the target named), manslaughter and murder.
- **How:** Hook A for the breaks (Tantrum, TargetedTantrum, BedroomTantrum, SadisticRage, MurderousRage; MentalStates_Mood.xml:318, 352, 368, 381, 191). A postfix on `Thing.TakeDamage` (Verse/Thing.cs:1477), the funnel for all damage and hot in combat, so it reads its static flag before anything else. A prefix and postfix on `Pawn.Kill` (Verse/Pawn.cs:2096) catch deaths. Excluded: drafted instigators, damage with `instigatorGuilty` false (executions; Laws' own subdue, which also sets a scope flag), victims in an aggro state, surgery (no instigator), friendly fire (`dinfo.IntendedTarget` not the victim, Verse/DamageInfo.cs:94). Vanilla already marks such attackers guilty for a day (Verse/Pawn_HealthTracker.cs:321-329).
- **Players get:** Four special acts: assault (hurt a colonist, slave or guest outside a fight), harming prisoners or slaves, manslaughter and murder. The violent breaks are in the catalogue since 1.0 with Planning; 1.2 gives them Did it: a tantrum damaged or destroyed something, a berserk pawn or a murderous or sadistic rage hurt someone (murderous rage names its target from the start). Subdue opens for aggressive breaks: only an enforcer with Melee at least the offender's goes, and when nobody qualifies a letter asks you to draft someone.
- **How:** The breaks are catalogue entries already (Tantrum, TargetedTantrum, BedroomTantrum, SadisticRage, MurderousRage; MentalStates_Mood.xml:318, 352, 368, 381, 191); 1.2 adds `BreakLinkDef`s for `MentalState_Tantrum`, `MentalState_Berserk` and `MentalState_MurderousRage` (`MentalState_SadisticRageTantrum` is a tantrum subclass and links to harming a prisoner or slave). A postfix on `Thing.TakeDamage` (Verse/Thing.cs:1477), the funnel for all damage and hot in combat, so it reads its static flag before anything else. A prefix and postfix on `Pawn.Kill` (Verse/Pawn.cs:2096) catch deaths. Excluded: drafted instigators, damage with `instigatorGuilty` false (executions; Laws' own subdue, which also sets a scope flag), victims in an aggro state, surgery (no instigator), friendly fire (`dinfo.IntendedTarget` not the victim, Verse/DamageInfo.cs:94). Vanilla already marks such attackers guilty for a day (Verse/Pawn_HealthTracker.cs:321-329).
- **Save and removal:** Cases only.
- **Overlaps:** Prison mods that beat prisoners with the beater as instigator (Prisoner Realism's demoralize, Beat Your Prisoners) are caught by "harming prisoners". That is the law's point; its tooltip says so.
- **Replaces:** Law and Order's assault and murder crimes.
- **Effort:** M.
- **Tests:** One case per crime and stage; a drafted shot opens nothing; subdue damage opens nothing.
- **Effort:** M, plus S for the links and the aggressive-break subdue.
- **Tests:** One case per special act and per linked break stage; a drafted shot opens nothing; subdue damage opens nothing; an aggressive break with a subdue row sends only an enforcer whose Melee is at least the offender's.
#### Headless tests in 1.2
@ -596,29 +643,31 @@ Only the violent crimes come before the court: they are the cases a trial is mos
#### Colony votes on the lawbook
- **Players get:** A per-save switch, off by default. Colonists propose a law after an act that has none (25% chance, at most once per action per 10 days), petition to repeal an unpopular one (every 10 days on average) or you press "Call a vote" on any row. One vote at a time, open for 24 hours. Each voter's score adds trait stances (a pyromaniac votes against a fire law, a teetotaler for a drug law), self-interest (a trait whose only break is the targeted one), what a bystander would feel unless the voter doesn't care, Ideology precepts on the act, opinion of the offender and the proposer, and low mood. A proposal passes with more yes than no votes and at least half the voters taking a side; a tie keeps the current law. The result letter gives each voter's main reason ("Bob: no (pyromaniac)"). You can back or veto the result; the overruled side gets a small mood penalty. You can always edit the lawbook directly.
- **How:** The 1.4 voting core plus the score terms. An act without a law is invisible in 1.0 (its flag is false and the hook returns at once), so while votes are on every crime's flag is set in tally-only mode: the hooks count acts per crime in an unsaved tally and open no case, and a proposal rolls from that tally. The violent crimes (1.2) are the exception, since their `Thing.TakeDamage` hook is hot in combat; they come up only through petitions and "Call a vote". Self-interest reads `TraitDegreeData.randomMentalState` and `theOnlyAllowedMentalBreaks` (RimWorld/TraitDegreeData.cs:35, 63), so modded traits count with no patch. Bystander immunity through `ThoughtUtility.ThoughtNullified` (RimWorld/ThoughtUtility.cs:305). The stance data lives in the `CrimeDef` XML from 1.0 (traits, bystander thought, history events with `MayRequire="Ludeon.RimWorld.Ideology"`), unused until now, so the save format doesn't change. Precept comps are read directly, not through `Ideo.MemberWillingToDo`, which rolls a random chance inside (RimWorld/Ideo.cs:881).
- **How:** The 1.4 voting core plus the score terms. An act without a law is invisible in 1.0 (its flag is false and the hook returns at once), so while votes are on every category's flag is set in tally-only mode: the hooks count acts per catalogue entry in an unsaved tally and open no case, and a proposal rolls from that tally. Records stay out of the tally ("things hauled" would only produce noise); they come up through petitions and "Call a vote". The violent crimes (1.2) are the exception, since their `Thing.TakeDamage` hook is hot in combat; they come up only through petitions and "Call a vote". Self-interest reads `TraitDegreeData.randomMentalState` and `theOnlyAllowedMentalBreaks` (RimWorld/TraitDegreeData.cs:35, 63), so modded traits count with no patch. Bystander immunity through `ThoughtUtility.ThoughtNullified` (RimWorld/ThoughtUtility.cs:305). The stance data lives in `ActStanceDef` XML keyed by act key (traits, bystander thought, history events with `MayRequire="Ludeon.RimWorld.Ideology"`), written for the common entries; an entry without one gets stances only from opinion and mood. The save format doesn't change. Precept comps are read directly, not through `Ideo.MemberWillingToDo`, which rolls a random chance inside (RimWorld/Ideo.cs:881).
- **Save and removal:** Proposals and open votes in the component.
- **Overlaps:** Rimocracy (2159080853, 6.3k) votes on leadership decisions; Laws votes only on lawbook rows and the judge.
- **Replaces:** Nothing.
- **Effort:** S plus S proposals, M scores and reasons, S plus S vote flow, S tests: 5 days.
- **Tests:** A pyromaniac votes no on a fire law; a teetotaler yes on a drug law; a cannibal no on a cannibalism law; a friend of the offender no, a rival yes; 2 of 6 voters taking a side fails on quorum; overrule thoughts reach only the overruled side; with 60 voters opening and closing a vote stays under a millisecond budget. With votes on and an empty book, a forced fire-starting spree counts in the tally, opens no case and can raise a fire-law proposal; with votes off the fire flag stays false.
### 1.8 More crimes (3 days)
### 1.8 More crimes (2 days)
#### Breaks, escapes and desertion
Food binges, jailbreakers, desertion (GiveUpExit) and slaughterers are mental breaks, so they are in the 1.0 catalogue with Planning, and the food binge and the jailbreaker have their Did it from 1.0's link table. What is left needs new hooks or new offenders.
- **Players get:** Jailbreak (a colonist frees prisoners), desertion (planning only: the give-up-and-leave break, since a deserter who left is out of reach), slaughtering colony animals, food binge, prison break (prisoners as offenders), slave rebellion (Ideology).
- **How:** Hook A for Jailbreaker, GiveUpExit, Slaughterer and Binging_Food (MentalStates_Mood.xml:125, 249, 153, 432). Postfixes on `InteractionWorker_SparkJailbreak.Interacted` (RimWorld/InteractionWorker_SparkJailbreak.cs:9), `PrisonBreakUtility.StartPrisonBreak` (RimWorld/PrisonBreakUtility.cs:214, whose out list names the escapees), `SlaveRebellionUtility.StartSlaveRebellion` (RimWorld/SlaveRebellionUtility.cs:403) and the private `ExecutionUtility.ExecutionInt` (RimWorld/ExecutionUtility.cs:20) for the slaughterer. Food binge reuses hook C.
#### Slaughterers, prison breaks and slave rebellions
- **Players get:** Did it for the slaughterer break (it slaughtered an animal), and two acts by pawns the laws didn't cover before: prison break (prisoners as offenders) and slave rebellion (Ideology).
- **How:** A `BreakLinkDef` for `MentalState_Slaughterer` on a new special act, fed by a postfix on the private `ExecutionUtility.ExecutionInt` (RimWorld/ExecutionUtility.cs:20). Postfixes on `PrisonBreakUtility.StartPrisonBreak` (RimWorld/PrisonBreakUtility.cs:214, whose out list names the escapees) and `SlaveRebellionUtility.StartSlaveRebellion` (RimWorld/SlaveRebellionUtility.cs:403). The offender filter gains prisoners of the colony for the prison break act only.
- **Save and removal:** Cases only.
- **Overlaps:** Blax Slaves owns rebellion; the rebellion crime only records who rebelled.
- **Overlaps:** Blax Slaves owns rebellion; the rebellion act only records who rebelled.
- **Replaces:** Law and Order's sabotage crime, partly.
- **Effort:** M.
- **Tests:** One case per crime; the slave rebellion test skips without Ideology.
- **Effort:** S plus S.
- **Tests:** One case per act; the slave rebellion test skips without Ideology.
#### Drugs against the policy
- **Players get:** "Took a drug the drug policy doesn't allow", outside binges and player orders.
- **How:** Hook D compares `ingester.drugs.CurrentPolicy[def]` (`allowedForJoy`, `allowedForAddiction`, `allowScheduled`; RimWorld/DrugPolicyEntry.cs:9-13). Medical drugs and doctor-given doses don't count.
- **Players get:** a group entry "Drug the policy doesn't allow" in the Ate category, outside binges and player orders.
- **How:** Hook C compares `ingester.drugs.CurrentPolicy[def]` (`allowedForJoy`, `allowedForAddiction`, `allowScheduled`; RimWorld/DrugPolicyEntry.cs:9-13). Medical drugs and doctor-given doses don't count.
- **Save and removal:** Cases only.
- **Overlaps:** Castes sets drug policies; Laws only reads them.
- **Replaces:** Nothing.
@ -627,7 +676,7 @@ Only the violent crimes come before the court: they are the cases a trial is mos
#### Headless tests in 1.8
- All 8 DLC combinations; the slave rebellion test skips without Ideology. The new crimes join 1.7's tally-only mode, checked with one forced break each. Effort S.
- All 8 DLC combinations; the slave rebellion test skips without Ideology. The new acts join 1.7's tally-only mode, checked with one forced act each. Effort S.
## Works with the other Blax mods
@ -675,12 +724,28 @@ Only the violent crimes come before the court: they are the cases a trial is mos
- Zones `docs/design.md`: "Works with the other Blax mods" notes that Laws' arrests use prisoner zone beds like any prisoner bed.
- Defaults `docs/design.md`: the Blax mods section notes that Laws' subdue downs a pawn through `MakeDowned`, so the colony forbid rule decides about that weapon, and that from Laws 1.1 the weapon an arrest drops is allowed again at the release.
## To verify against the decompiled code
The act catalogue was checked on 2026-12-01 against the 1.7.5021 reference assemblies (RimRef, `Krafs.Rimworld.Ref` 1.7.5021-unstable): every type, field and signature it names exists there (a probe that calls each of them compiles against RimRef with no error), method bodies don't. Before the 1.0 build, check these in the decompiled 1.7 code and fix the design where it differs:
- `Pawn_RecordsTracker.Increment` and `AddTo`: body size (inlining risk, else the record category polls), whether time records go through `AddTo`.
- `HistoryEventsManager.RecordEvent`: which events Core records without Ideology, which carry `HistoryEventArgsNames.Doer`, and the list of faction-level events to exclude.
- `Notify_IterationCompleted` on `Bill`, `Bill_Production`, `Bill_Medical` and `Bill_Autonomous`: which call base (the depth guard), that a surgery's completion passes through `Bill_Medical`, and that an autonomous bill has no doer.
- `CompUsable.UsedBy`: the overrides in Core and the DLCs, and that every use path calls it.
- The self-eating check in hook C: when `Toils_Ingest` finalizes, the ingester's own job is Ingest with the food as target, and a doctor, warden, parent or caravan feeding runs on another pawn's job or none.
- The break include and exclude lists: which states `MentalBreakDef`s name, and which animal and baby states to leave out.
- The jailbreaker's talk goes through `TryInteractWith` (the old 1.8 text patched `InteractionWorker_SparkJailbreak.Interacted` directly).
- The insect meat group: how insect meat is told apart (the meat's source race flesh type is the likely field).
- The picker with a large mod list: catalogue size and draw cost.
## Backlog
- Rows that tick several entries, like a bill's ingredient filter, if one entry per row proves too narrow; needs a precedence rule for overlapping sets.
- Used buildings and any job as a catalogue category (played horseshoes, used the comms console), through the same `StartJob` hook as the next item.
- "Attempted" stage between planning and did it (M): needs a postfix on the huge, hot `Pawn_JobTracker.StartJob` (Verse.AI/Pawn_JobTracker.cs:252) with a set of watched JobDefs, for example an ingest job toward wake-up during a binge.
- Crimes on caravans (S): today only pawns on a map are watched; caravan cases would wait until the pawn is home.
- Player-ordered acts as crimes, each an explicit option: execution, organ harvesting, butchering a human, hemogen extraction (Biotech). Vanilla already has "about to" checks in work givers through `HistoryEvent.Notify_PawnAboutToDo_Job`.
- Ideoligion precept violations and apostasy through `HistoryEventsManager.RecordEvent` (RimWorld/HistoryEventsManager.cs:55), adultery through `GotLovin_NonSpouse` (Core), freeing a held entity (Anomaly).
- Player-forced jobs as crimes: since 1.0 executions, organ harvesting and butchering a human are in the catalogue (recorded acts, bills) and count unless the job was forced or the pawn drafted. A per-row "player orders count too" switch would drop the exemption. Vanilla already has "about to" checks in work givers through `HistoryEvent.Notify_PawnAboutToDo_Job`.
- A recorded-acts group "anything the offender's ideoligion forbids" read from its precepts, and apostasy. Single events (adultery as `GotLovin_NonSpouse`, a butchered human) are catalogue entries since 1.0. Freeing a held entity (Anomaly).
- Theft: vanilla colonists never steal; a "took forbidden goods during a break" flag in the `Thing.Ingested` prefix.
- Guilty plea for a shorter sentence; appeals and retrial under a new judge; witnesses as a role and as evidence (free colonists with line of sight to the act, recorded in a new Case field at filing); a jury from the spectators.
- A judge's bench with art (needs a removal story for a missing ThingDef). A titled noble presides (Royalty). Trial by duel (Ideology's duel lord job).
@ -690,7 +755,6 @@ Only the violent crimes come before the court: they are the cases a trial is mos
- A Castes right "may serve in court".
- Pardon petitions from a convict's friends; votes on punishments ("beating is cruel"); campaigning through vanilla deep talks; Royalty vote weight.
- Confessions and interrogation, next to Prisoner Interrogation Ritual (3696342867, 1.3k).
- Subdue weighs the enforcer's Melee against the offender's.
## Cut