docs: feature plan by area instead of releases by size

docs/features.md is the new plan of record: seven areas (lawbook,
crimes, enforcement and punishments, sentences, repeat offenders,
court, colony votes), steps only where a part needs another part, a
sibling feature or a decision first, the order with its reasons, and
two open questions (jail for slaves, indenture as a sentence).

The first release now holds every crime family except uprisings and
faith, all punishments and sentences that give back what jail took.
New, not yet specced: lawbook templates, crimes against the faith,
criminal record, escalation, probation, witnesses, guilty plea,
appeals, jury and pardon petitions.

design.md: At a glance by area, release sections regrouped into areas
and steps, day counts gone, version references replaced by feature
names; Violence and the slaughterer/uprising section split along the
new areas. README: first-release features and Planned by area.
This commit is contained in:
Timothy 2026-12-01 17:20:25 +01:00
parent dd82dd75df
commit a02630972e
3 changed files with 492 additions and 242 deletions

View File

@ -7,7 +7,7 @@
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. 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`. Status: design. Nothing is built yet; below is what the first release will do. What the whole mod covers and in which order: `docs/features.md`. The specs: `docs/design.md`.
## Features ## Features
@ -31,7 +31,8 @@ The catalogue holds hundreds of acts; these are the ones the starter lawbook and
- 🗯️ **Insult.** Every insult by the one who insults; slights are their own entry. Planning for insulting sprees. - 🗯️ **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. - 🍖 **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. - 🧾 **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. - 🔪 **Violence.** Assault, harming prisoners or slaves, manslaughter and murder, plus "did it" for tantrums, berserk and rages and for the slaughterer break. Berserk and rages take a warning or guilt; subduing a pawn that fights back comes in a later step.
- 🚫 **Drugs against the policy.** Any drug the pawn's drug policy doesn't allow, outside binges and player orders.
- 🧮 **No flood.** Acts outside a break open at most one case per colonist and law a day; more acts only raise its count. - 🧮 **No flood.** Acts outside a break open at most one case per colonist and law a day; more acts only raise its count.
### Punishments ### Punishments
@ -41,6 +42,13 @@ The catalogue holds hundreds of acts; these are the ones the starter lawbook and
- 🛑 **Subdue.** A warden beats the offender down with fists to stop the break: bruises on torso and limbs, never the head or a bionic part, no lost parts, no scars, and the beating doesn't hand out the break's catharsis. No warden is pulled off a rescue, a patient or a fire, and nobody is sent while raiders are on the map. `Source/BlaxLaws/JobDriver_Subdue.cs` - 🛑 **Subdue.** A warden beats the offender down with fists to stop the break: bruises on torso and limbs, never the head or a bionic part, no lost parts, no scars, and the beating doesn't hand out the break's catharsis. No warden is pulled off a rescue, a patient or a fire, and nobody is sent while raiders are on the map. `Source/BlaxLaws/JobDriver_Subdue.cs`
- 🔒 **Jail for N days.** Arrested into a prisoner bed, kept on "Maintain only" so no prison mod recruits or enslaves your colonist, released by a warden when the time is served, back to work with its priorities intact. `Source/BlaxLaws/Enforcement.cs` - 🔒 **Jail for N days.** Arrested into a prisoner bed, kept on "Maintain only" so no prison mod recruits or enslaves your colonist, released by a warden when the time is served, back to work with its priorities intact. `Source/BlaxLaws/Enforcement.cs`
- 🔗 **Subdue, then jail.** Beaten down and carried straight to a cell before a doctor takes it to bed. - 🔗 **Subdue, then jail.** Beaten down and carried straight to a cell before a doctor takes it to bed.
- 😔 **Reprimand.** A mood penalty by severity for three days.
- 🚪 **Banish and execute.** Only after you confirm them in a dialog.
### Sentences
- 🛏️ **Back to its own bed.** When the sentence is served the colonist gets back its bed, grave, throne, deathrest casket, ideoligion role, its mechs' work modes and the weapon the arrest made it drop. A thing someone else claimed meanwhile stays theirs, and the letter says so.
- 🕊️ **Pardon, early release, more days.** On any jailed case, from the case log.
### Save and settings ### Save and settings
@ -49,23 +57,23 @@ The catalogue holds hundreds of acts; these are the ones the starter lawbook and
## Planned ## Planned
Later releases, in order (details in `docs/design.md`): The whole plan, by area, with the order and the reasons: `docs/features.md`. Coming after the first release:
- 🛏️ **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. - 🥊 **Subdue a pawn that fights back.** Berserk and rages get subdued too, by an enforcer at least as good at melee.
- 🔪 **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. - 🏛️ **Court.** "Trial" as a punishment through Ideology's trial, then court sessions 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, and if you want a court that sits on its own at a set hour. Then attorneys, witnesses and a guilty plea, trials over up to three days, courtrooms and appeals.
- 🏛️ **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. - 🗳️ **Colony votes.** The colony elects its judge, with terms, by-elections and recalls; colonists propose and repeal laws and vote by traits, beliefs, opinion and mood, and you back or veto the result; later a jury and pardon petitions.
- 🗳️ **1.4 Elected judge.** The colony votes for a judge for 60 days at a time, with by-elections and recalls. - 📈 **Repeat offenders.** A criminal record per colonist, harsher punishments for a repeat offence, and early release on probation.
- 🗣️ **1.5 Attorneys.** The accused asks a colonist to defend it or speaks for itself; both sides argue with Social. - 📚 **Lawbook templates.** Take your lawbook to the next colony.
- 📅 **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. - 🚨 **Uprisings.** Prison breaks and slave rebellions as crimes.
- 🙋 **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. - 🙏 **Crimes against the faith.** One law for anything a colonist's own ideoligion forbids, and apostasy (Ideology).
- 🚪 **1.8 More crimes.** Slaughterers, drugs against the drug policy, prison breaks, slave rebellions. - 🤝 **With the other Blax mods.** Blax Castes keeps a convict's caste through any sentence, jailed slaves become slaves again, and an indenture as a sentence through Blax Slaves (both still Fabian's call).
## DLC support ## DLC support
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. Blax Laws works with any combination of DLCs, core only included, and lists none as a dependency. Every category and punishment of the first release runs on the core game; the throne, deathrest casket, role and mech parts of the release give-back switch off without their DLC. 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. - **Ideology** adds slaves, who can be warned, marked guilty and subdued. An arrest takes a role holder's role; the release gives it back.
- **Biotech** adds children, who are never beaten, and mechanitors, who aren't jailed automatically in 1.0, because an arrest shuts their mechs down. - **Biotech** adds children, who are never beaten, and mechanitors, whose mechs shut down while they sit in jail and go back to their work modes at the release.
- **Ideology** also records most of the game's acts (cut a tree, butchered a human); without it the recorded acts category rarely fires. - **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. - **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. - **A save made with a DLC** loads without it.

View File

@ -1,9 +1,16 @@
# Blax Laws # Blax Laws
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. 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. Beyond that it covers sentences that give back what jail took, repeat offenders, a court with a judge the colony elects, attorneys who argue with their Social skill, witnesses and trials over several days, and colony votes on the laws themselves. What the mod covers and in which order: `docs/features.md`.
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. 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.
Changes on 2026-12-01, the feature plan (Fabian, 2026-12-01: plan the whole mod, chunked by what belongs together, never by time or size):
- `docs/features.md` is the new plan of record for scope and order: seven areas (lawbook, crimes, enforcement and punishments, sentences, repeat offenders, court, colony votes), each with steps only where a part needs another part, a sibling feature or a decision first. This file keeps the specs. "At a glance" is a table by area, "Releases" became "Areas and steps", and day counts and totals are gone; per-feature S, M and L marks stay as information. Version numbers in the dated notes below refer to the old cut.
- Regrouped: violence, slaughterers and drugs against the policy join the first release's crimes; reprimand, banish and execute its punishments; the give-back and pardon its sentences, so a jail never takes a bedroom or a role for good. The Ideology trial is the court's first step. Subdue for aggressive breaks is its own enforcement step. Elected judge and law votes form one area around the shared voting core. Prison breaks and slave rebellions are the crimes' "uprisings" step.
- Two sections were split along the new areas: "Violence" (its aggressive-break subdue is now "Subdue for aggressive breaks") and "Slaughterers, prison breaks and slave rebellions". Spec content is otherwise unchanged; version references became feature names.
- New in the plan, not specced yet: lawbook templates, crimes against the faith, repeat offenders (criminal record, escalation, probation), witnesses, guilty plea, appeals, jury and pardon petitions, most of them promoted from the Backlog. Indenture as a sentence is an open question for Fabian.
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"): 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. - 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.
@ -37,41 +44,38 @@ Changes on 2026-11-30, first design:
## At a glance ## At a glance
| Version | What players get | Needs | Replaces | Days | What the mod covers, by area. Which area and step comes first, and why: `docs/features.md`.
|---|---|---|---|---|
| 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: 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: "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"). | Area | What players get | Needs | Replaces |
|---|---|---|---|
| Lawbook | 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 built from the game's defs. A case log. Later: lawbook templates across saves | None | Rimworld Law and Order (419, 1.6 only, needs Ideology) |
| Crimes | Every mental break, everything eaten or used, every social interaction, every recorded act and record, every bill, plus fire setting, corpse display, social fights, assault, harming prisoners or slaves, manslaughter, murder, slaughterers and drugs against the policy, DLC and modded content included. Later: prison breaks and slave rebellions, crimes against the faith | None (slaves, most recorded acts, slave rebellion, faith: Ideology) | Law and Order's crimes, its sabotage crime partly. 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) |
| Enforcement and punishments | Warn, guilty for N days, subdue (a capped beating that stops a break and never kills), jail, subdue then jail, reprimand, banish and execute after confirmation. Later: subdue for aggressive breaks | None (children never beaten: Biotech) | Arresting your own colonist mid-break by hand, which Arrest and Release (4.6k, no 1.7) exists for |
| Sentences | Sentences served on Maintain only and released by a warden. Release gives back the bed, grave, throne, deathrest casket, ideoligion role, mech work modes and the dropped weapon. Pardon, early release, add days. Later, with the sibling mods: Blax Castes keeps the caste, jail for slaves, indenture as a sentence | None (role: Ideology; throne: Royalty; casket, mechs: Biotech; slaves: Ideology) | Custom Guilt Duration for colonists (3.4k, no 1.7), Guilty! (302, 1.6) |
| Repeat offenders | A criminal record per pawn, escalating punishments for repeat offences, probation. New, not specced | None | None; parole like Prison Expanded's (3.3k) for colonists |
| Court | "Trial" as a punishment through Ideology's trial. Court sessions on the core game: an appointed judge, a prosecutor and spectators at a place you pick, a verdict that weighs evidence against Social skill, the sentence from the lawbook, a court hour, a removal button. Attorneys, witnesses and a guilty plea. Trials over 1 to 3 days, courtrooms, appeals | None (Ideology's trial: Ideology) | The vanilla trial as the only court (Ideology), Law and Order's trials |
| Colony votes | A voting core, an elected judge with terms, by-elections and recalls (or the leader or moral guide with Ideology), law votes with back and veto, a jury and pardon petitions | None (leader as judge, precept stances: Ideology) | None; overlaps Rimocracy (6.3k), which elects leaders and votes on its decisions |
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. 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 area runs on the core game, and a DLC in brackets marks the parts that switch off without it (see "DLC support"). Effort marks on features (S = 0.5 days, M = 2, L = 5) are information only; they decide nothing about grouping.
## Defaults I picked ## Defaults I picked
Change if you disagree. 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. - 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). - 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 (while law votes are on, it counts acts without opening cases).
- "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. - "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. - 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. - 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. - 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). - Severity is Minor, Moderate, Serious or Grave. It sets the default days (1, 3, 5, 10), orders the case log and 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 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. - Core punishments: Warn, Guilty for N days, Subdue, Jail for N days, Subdue then jail. Reprimand, Banish and Execute join them in the same step (see their sections). 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. - Aggressive breaks (`MentalStateDef.IsAggro`: berserk, murderous rage, sadistic rage and modded ones) offer only Warn and Guilty until "Subdue for aggressive breaks" is built. 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. That step 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 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 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. - 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.
- 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. - 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. - 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; jail comes with "Jail for slaves" (Sentences, step 2).
- Children (Biotech) are never beaten: Subdue on a child becomes Jail when the row has days, otherwise Warn. - 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). - Player orders are exempt: an act done while drafted or on a player-forced job opens no case (setting).
- Who enforces: the nearest awake free colonist with Warden work active who can do the job (violence for subdue, manipulation for an arrest), then anyone able. Never a slave, a child, the offender, a pawn in a break, a pawn on a player order, a pawn in a party or ritual, or a pawn on a job that must not be dropped: rescuing, carrying or tending someone, fighting a fire, manning a turret, surgery, fleeing. - Who enforces: the nearest awake free colonist with Warden work active who can do the job (violence for subdue, manipulation for an arrest), then anyone able. Never a slave, a child, the offender, a pawn in a break, a pawn on a player order, a pawn in a party or ritual, or a pawn on a job that must not be dropped: rescuing, carrying or tending someone, fighting a fire, manning a turret, surgery, fleeing.
@ -79,12 +83,12 @@ Change if you disagree.
- Subdue hits torso and limbs only, never the head or a bionic part, with capped blunt damage that leaves bruises, and stops at downed or once three hits in a row add no pain (go-juice, painkillers). The subdued pawn loses the Catharsis that ending its break would give (setting), so the beating doesn't reward the crime. - Subdue hits torso and limbs only, never the head or a bionic part, with capped blunt damage that leaves bruises, and stops at downed or once three hits in a row add no pain (go-juice, painkillers). The subdued pawn loses the Catharsis that ending its break would give (setting), so the beating doesn't reward the crime.
- Jail convicts through vanilla guilt for the sentence length, renewed right before the arrest. While it lasts the arrest of a free colonist is always accepted. Executing a guilty colonist costs the colony only the -2 "justified execution" thought (ideoligion precepts may change it) plus its family's grief; banishing it costs no colony-wide thought, though banishing it to its death still grieves its family. - Jail convicts through vanilla guilt for the sentence length, renewed right before the arrest. While it lasts the arrest of a free colonist is always accepted. Executing a guilty colonist costs the colony only the -2 "justified execution" thought (ideoligion precepts may change it) plus its family's grief; banishing it costs no colony-wide thought, though banishing it to its death still grieves its family.
- A jailed colonist is set to "Maintain only" two ticks after the capture, after any default a prison mod or Blax Castes writes, so no default recruits, enslaves or executes it. When the sentence is served Laws sets "Release" and a warden walks it out; if nobody has after a day, Laws releases it in place. - A jailed colonist is set to "Maintain only" two ticks after the capture, after any default a prison mod or Blax Castes writes, so no default recruits, enslaves or executes it. When the sentence is served Laws sets "Release" and a warden walks it out; if nobody has after a day, Laws releases it in place.
- Role holders (Ideology) and mechanitors with mechs (Biotech) aren't jailed automatically in 1.0, because arrest takes the role and shuts the mechs down. The case waits with an "Arrest now" button and a letter says why. 1.1 gives both back after release and drops the hold. - Role holders (Ideology) and mechanitors with mechs (Biotech) aren't jailed automatically while "Release gives back what jail took" is switched off, because arrest takes the role and shuts the mechs down. The case waits with an "Arrest now" button and a letter says why. With that feature on (it ships in the same first release) both come back after the release and the hold drops.
- 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. - 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. - "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. - 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 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). - The court convenes when you press "Convene court", 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. Votes are off per save until you switch them on.
- Multiplayer: not supported. - Multiplayer: not supported.
Everything below is for the modder building it. Everything below is for the modder building it.
@ -108,7 +112,7 @@ All state lives in one `GameComponent_BlaxLaws`. Laws are colony policy across e
### The act catalogue is built from the game's defs, saved as names ### The act catalogue is built from the game's defs, saved as names
- 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. - Laws defines no crime list of its own. `ActCategoryDef` (our own Def type, seven of them: 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, StartedSocialFight, the violent acts and the slaughterer's kill in the first release, prison break and slave rebellion with the uprisings. `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`. The first release 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. - `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 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. - The lawbook UI reads the stage list from the entry, so an entry without a planning stage never offers one.
@ -116,11 +120,11 @@ All state lives in one `GameComponent_BlaxLaws`. Laws are colony policy across e
### Detection: one postfix per act, quiet while the book is empty ### Detection: one postfix per act, quiet while the book is empty
- 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. - 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 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. - 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). - 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 (Backlog).
- Player orders: the offender `Drafted` or its current job `playerForced` (Verse.AI/Job.cs:37) exempts the act while the setting is on. - 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: - First-release 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. Break category: opens planning cases. - 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). - 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. - E. `Pawn_InteractionsTracker.TryInteractWith` (RimWorld/Pawn_InteractionsTracker.cs:176), about 90 lines, returns true at :268. Interaction category.
@ -131,7 +135,7 @@ All state lives in one `GameComponent_BlaxLaws`. Laws are colony policy across e
- 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"). - 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. - 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. - 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`. - Two more hooks serve the jail, not detection (see "Enforcement runs a tick later"): K on `Pawn_GuestTracker.CapturedBy` and 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. - 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.
### Enforcement runs a tick later ### Enforcement runs a tick later
@ -141,8 +145,8 @@ All state lives in one `GameComponent_BlaxLaws`. Laws are colony policy across e
- Enforcer pick: free colonists on the offender's map, awake, not downed, not in a mental state, not drafted, no player-forced job, no lord (parties, rituals, caravans forming), not the offender, not a child, not a slave. Also skipped: a pawn whose `CurJob.def.casualInterruptible` is false (in Core's JobDefs that covers Rescue, Capture, Arrest, TendPatient, BeatFire, ExtinguishSelf, ManTurret, DeliverToBed and LayDown), a pawn carrying a pawn (`IsCarryingPawn`, RimWorld/PawnUtility.cs:115), a pawn on Flee or FleeAndCower (Core Defs/JobDefs/Jobs_Misc.xml:510, 518) and a pawn on a `DoBill` whose recipe `IsSurgery` (Verse/RecipeDef.cs:362). Wardens (Warden work active) first, then anyone able, nearest by straight distance among those that can reach the offender. Subdue needs a pawn able to do violence, an arrest one with Manipulation. - Enforcer pick: free colonists on the offender's map, awake, not downed, not in a mental state, not drafted, no player-forced job, no lord (parties, rituals, caravans forming), not the offender, not a child, not a slave. Also skipped: a pawn whose `CurJob.def.casualInterruptible` is false (in Core's JobDefs that covers Rescue, Capture, Arrest, TendPatient, BeatFire, ExtinguishSelf, ManTurret, DeliverToBed and LayDown), a pawn carrying a pawn (`IsCarryingPawn`, RimWorld/PawnUtility.cs:115), a pawn on Flee or FleeAndCower (Core Defs/JobDefs/Jobs_Misc.xml:510, 518) and a pawn on a `DoBill` whose recipe `IsSurgery` (Verse/RecipeDef.cs:362). Wardens (Warden work active) first, then anyone able, nearest by straight distance among those that can reach the offender. Subdue needs a pawn able to do violence, an arrest one with Manipulation.
- Danger: no enforcement starts while `GenHostility.AnyHostileActiveThreatToPlayer(map)` (RimWorld/GenHostility.cs:227) is true on the offender's map or `PawnUtility.EnemiesAreNearby(offender)` (RimWorld/PawnUtility.cs:161). The case waits and the sweep retries. - Danger: no enforcement starts while `GenHostility.AnyHostileActiveThreatToPlayer(map)` (RimWorld/GenHostility.cs:227) is true on the offender's map or `PawnUtility.EnemiesAreNearby(offender)` (RimWorld/PawnUtility.cs:161). The case waits and the sweep retries.
- Jobs start with `Pawn_JobTracker.StartJob(job, JobCondition.InterruptForced, ..., preToilReservationsCanFail: true)` with `playerForced` set. Before an Arrest or Capture, Laws checks `enforcer.CanReserve(offender)` and `CanReserve(bed)` (Verse.AI/ReservationUtility.cs:63); without that, `StartJob` would log a reservation error and end the job as Errored (Verse.AI/Pawn_JobTracker.cs:336, 373-380), for example when a doctor already reserved the downed offender. On a failed check the case waits for the sweep. Laws never queues its own job; the one job it queues is the vanilla Capture after a subdue (see "Subdue"). - Jobs start with `Pawn_JobTracker.StartJob(job, JobCondition.InterruptForced, ..., preToilReservationsCanFail: true)` with `playerForced` set. Before an Arrest or Capture, Laws checks `enforcer.CanReserve(offender)` and `CanReserve(bed)` (Verse.AI/ReservationUtility.cs:63); without that, `StartJob` would log a reservation error and end the job as Errored (Verse.AI/Pawn_JobTracker.cs:336, 373-380), for example when a doctor already reserved the downed offender. On a failed check the case waits for the sweep. Laws never queues its own job; the one job it queues is the vanilla Capture after a subdue (see "Subdue").
- Hook K, a prefix and postfix on `Pawn_GuestTracker.CapturedBy` (RimWorld/Pawn_GuestTracker.cs:561-576, 16 lines with calls, not inlinable). It returns at once unless the pawn has a case in Enforcing with an Arrest or Capture job out. The postfix records the capture tick and queues the "Maintain only" write; the case saves whether that write is done, so a save made in between still gets it after the load. From 1.1 the prefix sends Castes the `blax.laws.jailed` hint and notes the weapon the pawn still holds, before `SetGuestStatus` drops it (:564; :461). - Hook K, a prefix and postfix on `Pawn_GuestTracker.CapturedBy` (RimWorld/Pawn_GuestTracker.cs:561-576, 16 lines with calls, not inlinable). It returns at once unless the pawn has a case in Enforcing with an Arrest or Capture job out. The postfix records the capture tick and queues the "Maintain only" write; the case saves whether that write is done, so a save made in between still gets it after the load. For "Release gives back what jail took" the prefix notes the weapon the pawn still holds, before `SetGuestStatus` drops it (:564; :461), and for "Castes keeps the caste" it sends Castes the `blax.laws.jailed` hint.
- Hook L (1.1), a prefix and postfix on `GenGuest.PrisonerRelease` (RimWorld/GenGuest.cs:8-21). It returns at once unless the pawn serves a Laws sentence. The prefix sends `blax.laws.released`; the postfix queues the give-back for the next tick. Castes reads a hint in its `SetGuestStatus` hook, inside these calls, and drops it at the end of the tick, so the sweep would be too late. - Hook L, for the give-back and for Castes, a prefix and postfix on `GenGuest.PrisonerRelease` (RimWorld/GenGuest.cs:8-21). It returns at once unless the pawn serves a Laws sentence. For "Castes keeps the caste" the prefix sends `blax.laws.released`; the postfix queues the give-back for the next tick. Castes reads a hint in its `SetGuestStatus` hook, inside these calls, and drops it at the end of the tick, so the sweep would be too late.
### The subdue job never enters a save ### The subdue job never enters a save
@ -158,7 +162,7 @@ All state lives in one `GameComponent_BlaxLaws`. Laws are colony policy across e
- Undo only what Laws did. Sentences end, interaction modes and restorations apply only to pawns Laws jailed; another mod's prisoner, or a colonist you arrested by hand, is never touched. - Undo only what Laws did. Sentences end, interaction modes and restorations apply only to pawns Laws jailed; another mod's prisoner, or a colonist you arrested by hand, is never touched.
- No game state in statics: the hot-path flags are a cache of the current game's book, rebuilt on load. Scopes set in a prefix are cleared in a finalizer. - No game state in statics: the hot-path flags are a cache of the current game's book, rebuilt on load. Scopes set in a prefix are cleared in a finalizer.
- Store what the player chose: names and numbers, never live defs. - Store what the player chose: names and numbers, never live defs.
- Bulk changes ask first and name the count: deleting a law with open cases, the removal button (1.3). - Bulk changes ask first and name the count: deleting a law with open cases, the removal button (court sessions).
- Every hook body in try/catch with a one-time log; a Laws error never breaks an ingestion, an interaction or a save. - Every hook body in try/catch with a one-time log; a Laws error never breaks an ingestion, an interaction or a save.
- Never prefix a method of a few lines that the JIT may inline. - Never prefix a method of a few lines that the JIT may inline.
- A setting written into defs at startup says "restart required"; the Laws tab toggle writes `MainButtonDef.buttonVisible` live, because the bar counts that field for its width (RimWorld/MainButtonsRoot.cs:15-27) but draws by `Worker.Visible` (:65-81). - A setting written into defs at startup says "restart required"; the Laws tab toggle writes `MainButtonDef.buttonVisible` live, because the bar counts that field for its width (RimWorld/MainButtonsRoot.cs:15-27) but draws by `Worker.Visible` (:65-81).
@ -168,45 +172,48 @@ 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: 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. - About.xml names no DLC, neither as a dependency nor in loadAfter.
- 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). - Every 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". - 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>". - 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 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. - 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 choice that needs a DLC shows disabled with "Needs <DLC>" instead of hiding: the Trial punishment until court sessions exist ("Needs Ideology"), the 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 entry 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. - Anomaly and Odyssey: guarded in code only. Laws calls no Anomaly or Odyssey code; 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. - 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 | | Feature | Area, step | Needs | Without it |
|---|---|---|---| |---|---|---|---|
| Lawbook tab, starter lawbook, case log | 1.0 | None | Works | | Lawbook tab, starter lawbook, case log | Lawbook 1 (first release) | None | Works |
| Act catalogue: breaks, ate, used, interactions, records, bills, special acts | 1.0 | None | Works; DLC entries are simply absent | | Act catalogue: breaks, ate, used, interactions, records, bills, special acts | Crimes 1 (first release) | None | Works; DLC entries are simply absent |
| Act catalogue: recorded acts | 1.0 | None (most events: Ideology) | Lists the event defs; most never fire | | Act catalogue: recorded acts | Crimes 1 | 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 | | Violent crimes, slaughterer link, drug policy crimes | Crimes 1 | None | Works |
| Laws for slaves (warn, guilty, subdue) | 1.0 | Ideology | No slaves to cover | | Warn, guilty, subdue, jail, subdue then jail | Enforcement 1 (first release) | None | Works. Slaves don't exist |
| Hold for role holders | 1.0 | Ideology | No roles | | Laws for slaves (warn, guilty, subdue) | Enforcement 1 | Ideology | No slaves to cover |
| Hold for mechanitors | 1.0 | Biotech | No mechanitors | | Children never beaten | Enforcement 1 | Biotech | No children |
| Children never beaten | 1.0 | Biotech | No children | | Reprimand, banish, execute | Enforcement 1 | None | Works |
| Release gives back bed, grave | 1.1 | None | Works | | Subdue for aggressive breaks | Enforcement 2 | None | Works |
| Release gives back throne | 1.1 | Royalty | Skipped | | Release gives back bed, grave; pardon | Sentences 1 (first release) | None | Works |
| Release gives back deathrest casket, mech modes | 1.1 | Biotech | Skipped | | Release gives back throne | Sentences 1 | Royalty | Skipped |
| Release gives back the ideoligion role | 1.1 | Ideology | Skipped | | Release gives back deathrest casket, mech modes | Sentences 1 | Biotech | Skipped |
| Reprimand, pardon, banish, execute | 1.1 | None | Works | | Release gives back the ideoligion role | Sentences 1 | Ideology | Skipped |
| Jail for slaves | 1.1 | Ideology | No slaves | | Hold for role holders, while the give-back is off | Sentences 1 | Ideology | No roles |
| Trial through the vanilla trial | 1.1 | Ideology | "Trial" shows disabled with "Needs Ideology" until 1.3 makes it core | | Hold for mechanitors, while the give-back is off | Sentences 1 | Biotech | No mechanitors |
| Violent crimes | 1.2 | None | Works | | Jail for slaves | Sentences 2 | Ideology | No slaves |
| Court sessions, court hour, removal button | 1.3 | None | Works. A throne as court place needs Royalty, a lectern or ritual spot Ideology | | Trial through the vanilla trial | Court 1 | Ideology | "Trial" shows disabled with "Needs Ideology" until court sessions make it core |
| Elected judge | 1.4 | None | Works | | Court sessions, court hour, removal button | Court 2 | None | Works. A throne as court place needs Royalty, a lectern or ritual spot Ideology |
| 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 | Court 3, Court 4 | None | Works |
| Attorneys, multi-day trials, courtrooms | 1.5, 1.6 | None | Works | | Elected judge | Colony votes 1 | None | Works |
| Law votes | 1.7 | None | Works without the precept term | | Leader or moral guide as judge | Colony votes 1 | Ideology | Option disabled with "Needs Ideology"; a saved choice falls back to elected |
| Slaughterer link, prison break, drug policy crimes | 1.8 | None | Works | | Law votes | Colony votes 2 | None | Works without the precept term |
| Slave rebellion crime | 1.8 | Ideology | Row shows "Needs Ideology" | | Prison break crime | Crimes 2 | None | Works |
| Slave rebellion crime | Crimes 2 | Ideology | Row shows "Needs Ideology" |
## Releases ## Areas and steps
### 1.0 Lawbook, act catalogue, subdue and jail (12 days) The specs, grouped by area as in `docs/features.md`, which gives the order and the reasons for it. An area is one player problem; its steps follow what each part needs built first, never a time box. Features marked New in `features.md` get their spec here before their step is built.
### Lawbook, step 1: the book (first release)
#### Lawbook tab #### Lawbook tab
@ -220,7 +227,7 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
|---|---|---| |---|---|---|
| A break that isn't aggressive | Planning | Warn, Subdue, 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 | | 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 | | An aggressive break (`IsAggro`) | Planning, and Did it through the Violence links | Warn, Guilty; Subdue once "Subdue for aggressive breaks" is built |
| Every entry outside the breaks: ate, used, interactions, recorded acts, records, bills, special acts | Did it | Warn, Guilty, Jail | | 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. - 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.
@ -237,10 +244,16 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- **Save and removal:** The book and cases save in the component. Removal drops them with it. - **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. - **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 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). - **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. - **Effort:** M plus S for the picker.
- **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. - **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`. - **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`.
### Lawbook, step 2: templates across saves
Not specced yet: lawbook templates (see `docs/features.md`).
### Crimes, step 1: every act the game records (first release)
#### Act catalogue and detection #### Act catalogue and detection
- **Players get:** Any act in the catalogue can be a law. The categories, what fills them and what opens a case: - **Players get:** Any act in the catalogue can be a law. The categories, what fills them and what opens a case:
@ -254,7 +267,7 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
| 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 | | 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 | | 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 | | 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 | | Special acts | Set a fire, displayed a corpse, started a social fight; assault, harmed a prisoner or slave, manslaughter, murder (Violence); the slaughterer's kill; prison break and slave rebellion (uprisings) | 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: - **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:
@ -267,7 +280,7 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
| `MentalState_InsultingSpree` | InsultingSpree, TargetedInsultingSpree | Insult or slight | | `MentalState_InsultingSpree` | InsultingSpree, TargetedInsultingSpree | Insult or slight |
| `MentalState_Jailbreaker` | Jailbreaker | The jailbreak talk (`SparkJailbreak` interaction) | | `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. Tantrums, berserk, murderous and sadistic rage get their links with "Violence", slaughterers with "Slaughterers", both in the first release. Every other break, desertion (GiveUpExit) included, is Planning only.
- **How:** - **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`. - 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`.
@ -291,7 +304,7 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- **Save and removal:** Cases save in the component. Hooks and the catalogue 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. - **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. - **Replaces:** Law and Order's crimes are new events and breaks; Laws replaces the idea with vanilla's own acts.
- **Effort:** M for the categories, groups and links, S for hooks U, H, R and B, S for the catalogue tests: 3 days. - **Effort:** M for the categories, groups and links, S for hooks U, H, R and B, S for the catalogue tests.
- **Tests:** - **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. - 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. - 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.
@ -305,6 +318,56 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- 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). - 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. - **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.
#### Violence
- **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 with Planning, and Violence 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). Until "Subdue for aggressive breaks" is built, those breaks offer Warn and Guilty only.
- **How:** The breaks are catalogue entries already (Tantrum, TargetedTantrum, BedroomTantrum, SadisticRage, MurderousRage; MentalStates_Mood.xml:318, 352, 368, 381, 191); Violence 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, plus S for the links.
- **Tests:** One case per special act and per linked break stage; a drafted shot opens nothing; subdue damage opens nothing.
#### Slaughterers
- **Players get:** Did it for the slaughterer break: it slaughtered an animal.
- **How:** A `BreakLinkDef` for `MentalState_Slaughterer` on a new special act, fed by a postfix on the private `ExecutionUtility.ExecutionInt` (RimWorld/ExecutionUtility.cs:20).
- **Save and removal:** Cases only.
- **Overlaps:** None.
- **Replaces:** Nothing.
- **Effort:** S.
- **Tests:** A forced slaughterer break moves to did it when the pawn slaughters an animal.
#### Drugs against the policy
- **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.
- **Effort:** S.
- **Tests:** A forced ingest of a drug the policy forbids opens a case; an allowed one doesn't.
### Crimes, step 2: uprisings
Needs "Pardon, early release and longer sentences" for "Add days" on a convict, and Fabian's answer on "Jail for slaves" for rebel slaves.
#### Prison breaks and slave rebellions
- **Players get:** Two acts by pawns the laws didn't cover before: prison break (prisoners as offenders) and slave rebellion (Ideology). Which punishments a prisoner offender gets is still to be specced; `docs/features.md` proposes warn, "Add days" on a Laws sentence and a confirmed execution.
- **How:** 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 act only records who rebelled.
- **Replaces:** Law and Order's sabotage crime, partly.
- **Effort:** S plus S.
- **Tests:** One case per act; the slave rebellion test skips without Ideology.
### Crimes, step 3: crimes against the faith
Not specced yet: "anything my ideoligion forbids" and apostasy (see `docs/features.md`). Needs Ideology and a check of the precept code in the decompiled game.
### Enforcement and punishments, step 1 (first release)
#### Enforcement and cases #### 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. - **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.
@ -313,7 +376,7 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- **Save and removal:** Cases in the component. The queue isn't saved; cases in Enforcing refill it after a load. - **Save and removal:** Cases in the component. The queue isn't saved; cases in Enforcing refill it after a load.
- **Overlaps:** None. - **Overlaps:** None.
- **Replaces:** Nothing. - **Replaces:** Nothing.
- **Effort:** M, 2 days. - **Effort:** M.
- **Tests:** - **Tests:**
- A warden tending a patient, beating a fire, carrying a downed colonist or doing surgery is never picked; the next candidate is. - A warden tending a patient, beating a fire, carrying a downed colonist or doing surgery is never picked; the next candidate is.
- During a raid a binge case waits and nobody is sent; after the raid the sweep enforces it. - During a raid a binge case waits and nobody is sent; after the raid the sweep enforces it.
@ -334,10 +397,10 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- **Settings:** None beyond the row. - **Settings:** None beyond the row.
- **Save and removal:** Guilt is vanilla. Nothing of ours is saved on the pawn. - **Save and removal:** Guilt is vanilla. Nothing of ours is saved on the pawn.
- **Overlaps:** Custom Guilt Duration (2865127870, 3.4k, no 1.7) and Guilty! (3654983512, 302, 1.6) set guilt length globally; Laws sets it per law. They compose: the last writer wins for that pawn. - **Overlaps:** Custom Guilt Duration (2865127870, 3.4k, no 1.7) and Guilty! (3654983512, 302, 1.6) set guilt length globally; Laws sets it per law. They compose: the last writer wins for that pawn.
- **Replaces:** Nothing yet; 1.1 adds pardon. - **Replaces:** Nothing; ending guilt by hand is "Pardon, early release and longer sentences".
- **Effort:** Inside the crimes and jail budgets. - **Effort:** Inside the crimes and jail budgets.
- **Tests:** A guilty row with 3 days leaves `TicksUntilInnocent` at 180000; a longer existing guilt stays. Guilty colonist with Social 0 arrester: `GetAcceptArrestChance` is 1. `PawnDiedOrDownedThoughtsUtility.GetThoughts` for a guilty colonist with a spouse: Banished lists no colony-wide thought; BanishedToDie lists the spouse's grief and no colony-wide thought. - **Tests:** A guilty row with 3 days leaves `TicksUntilInnocent` at 180000; a longer existing guilt stays. Guilty colonist with Social 0 arrester: `GetAcceptArrestChance` is 1. `PawnDiedOrDownedThoughtsUtility.GetThoughts` for a guilty colonist with a spouse: Banished lists no colony-wide thought; BanishedToDie lists the spouse's grief and no colony-wide thought.
- **Risks:** Guilt also comes from vanilla (undrafted friendly fire, Verse/Pawn_HealthTracker.cs:321-329), so Laws never treats a guilty pawn as its own convict without a case. With guilt on, the vanilla Ideology trial refuses the pawn (`ValidateNotGuilty`, RimWorld/CompAbilityEffect_StartTrial.cs:44-47); 1.1's Trial punishment therefore sets no guilt before the trial. - **Risks:** Guilt also comes from vanilla (undrafted friendly fire, Verse/Pawn_HealthTracker.cs:321-329), so Laws never treats a guilty pawn as its own convict without a case. With guilt on, the vanilla Ideology trial refuses the pawn (`ValidateNotGuilty`, RimWorld/CompAbilityEffect_StartTrial.cs:44-47); the Trial punishment therefore sets no guilt before the trial.
#### Subdue #### Subdue
@ -355,9 +418,9 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- Save: see "The subdue job never enters a save". - Save: see "The subdue job never enters a save".
- **Settings:** "Subdued pawns lose their catharsis" (on), "Enforcers". - **Settings:** "Subdued pawns lose their catharsis" (on), "Enforcers".
- **Save and removal:** Nothing saved for the job; the case records "subdue in progress" and the enforcer. - **Save and removal:** Nothing saved for the job; the case records "subdue in progress" and the enforcer.
- **Overlaps:** Beat Your Prisoners (Continued) (2902220334, 18.2k) beats prisoners to lower resistance, a different target. Its players reported fists destroying heads; that is why Laws caps damage per part and skips the head. Blax Slaves 2.0's wardens calm slaves out of non-violent breaks; Laws stands down for slaves when that is active (see "Works with the other Blax mods"). - **Overlaps:** Beat Your Prisoners (Continued) (2902220334, 18.2k) beats prisoners to lower resistance, a different target. Its players reported fists destroying heads; that is why Laws caps damage per part and skips the head. Blax Slaves' "Wardens calm breakdowns" calms slaves out of non-violent breaks; Laws stands down for slaves when that is active (see "Works with the other Blax mods").
- **Replaces:** Arresting your own colonist mid-break by hand, the workaround Arrest and Release (2593514063, 4.6k, no 1.7) exists for. - **Replaces:** Arresting your own colonist mid-break by hand, the workaround Arrest and Release (2593514063, 4.6k, no 1.7) exists for.
- **Effort:** S plus S, 1 day. - **Effort:** S plus S.
- **Tests:** - **Tests:**
- A binge planning case with a subdue row: within 2500 ticks the offender is downed, has only Bruise injuries, every part at 50% HP or more, no head injury, no Catharsis memory (and has it with the setting off), the enforcer isn't guilty and the offender's `meleeThreat` is null. The same run with the camera on another map: still downed within 2500 ticks. - A binge planning case with a subdue row: within 2500 ticks the offender is downed, has only Bruise injuries, every part at 50% HP or more, no head injury, no Catharsis memory (and has it with the setting off), the enforcer isn't guilty and the offender's `meleeThreat` is null. The same run with the camera on another map: still downed within 2500 ticks.
- A Tough colonist and a colonist with two bionic arms both go down; the bionic arms take no injury. - A Tough colonist and a colonist with two bionic arms both go down; the bionic arms take no injury.
@ -365,7 +428,41 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- A child offender with a subdue row is warned, and with a subdue then jail row is jailed without a beating (skipped: needs Biotech). - A child offender with a subdue row is warned, and with a subdue then jail row is jailed without a beating (skipped: needs Biotech).
- Save while the job runs: the .rws contains no "BlaxLaws_Subdue"; after the reload the enforcer runs another job and the sweep starts a new subdue within 250 ticks. Start `Vomit` with `resumeCurJobAfterwards` on the enforcer mid-subdue, then save: the .rws contains no "BlaxLaws_Subdue" and the enforcer's queue holds no subdue job. - Save while the job runs: the .rws contains no "BlaxLaws_Subdue"; after the reload the enforcer runs another job and the sweep starts a new subdue within 250 ticks. Start `Vomit` with `resumeCurJobAfterwards` on the enforcer mid-subdue, then save: the .rws contains no "BlaxLaws_Subdue" and the enforcer's queue holds no subdue job.
- A "subdue then jail" row ends with the pawn a prisoner, never in a medical bed, with a doctor free to rescue. - A "subdue then jail" row ends with the pawn a prisoner, never in a medical bed, with a doctor free to rescue.
- **Risks:** Tone: Blax Slaves cut torture and flogging as beyond vanilla's tone. Subdue is a short fistfight to stop a break, closer to vanilla's social fight than to flogging, and the description says so. An enforcer weaker than the offender still wins, since the target never strikes back; accepted for an MVP, and weighing Melee skill is in the Backlog. - **Risks:** Tone: Blax Slaves cut torture and flogging as beyond vanilla's tone. Subdue is a short fistfight to stop a break, closer to vanilla's social fight than to flogging, and the description says so. An enforcer weaker than the offender still wins, since the target never strikes back; accepted for plain subdue; "Subdue for aggressive breaks" weighs Melee skill.
#### Reprimand
- **Players get:** A mood punishment for minor crimes: "Reprimanded" -4, -8, -12 or -16 by severity, for 3 days.
- **How:** A situational ThoughtDef whose worker reads the expiry tick from the component. Situational thoughts aren't saved and refresh every 100 ticks (RimWorld/SituationalThoughtHandler.cs:23, 34). A memory thought would be saved per pawn (RimWorld/MemoryThoughtHandler.cs:36) and log an error per memory after removal.
- **Save and removal:** The expiry tick lives in the case. After removal the thought is simply gone.
- **Overlaps:** RimCourt's rulings carry their own mood effects; they never touch the same pawn through Laws.
- **Replaces:** Nothing.
- **Effort:** S.
- **Tests:** The thought shows with the right stage, ends after 3 days, survives phase 2 with the same remaining time, and the .rws holds no "BlaxLaws" thought.
#### Banish and execute
- **Players get:** Two more punishments, always confirmed in a dialog, never automatic: banish and execute. With guilt, an execution costs the colony only the -2 "justified execution of colonist" thought (ideoligion precepts may change it) plus the family's grief; a banishment costs no colony-wide thought, and banishing to its death still grieves the family.
- **How:** Banish opens `PawnBanishUtility.ShowBanishPawnConfirmationDialog` (RimWorld/PawnBanishUtility.cs:157). Execute sets `awaitingExecution` for a free guilty colonist, which wardens carry out (RimWorld/CharacterCardUtility.cs:278-285), or the vanilla Execution mode for a jailed one. Guilt picks the mildest execution stage (RimWorld/ThoughtUtility.cs:27-31, 72) and drops the colony-wide banishment thoughts (RimWorld/PawnDiedOrDownedThoughtsUtility.cs:214-232); relations still grieve (:81-84, 253). See "Warn and guilty".
- **Save and removal:** Vanilla fields only.
- **Overlaps:** More Executions (3819037971, 1.2k) adds execution methods; they apply to Laws' executions like any other.
- **Replaces:** Nothing.
- **Effort:** S.
- **Tests:** The dialog appears and nothing happens without a click. A confirmed execution in a core-only run gives every colonist `KnowColonistExecuted` at stage 0 (-2) and nothing harsher, and the victim's spouse its grief thought. A confirmed plain banishment gives no colony-wide thought.
### Enforcement and punishments, step 2: subdue a pawn that fights back
#### Subdue for aggressive breaks
- **Players get:** Subdue opens for aggressive breaks (berserk, murderous and sadistic rage, modded `IsAggro` states): only an enforcer with Melee at least the offender's goes, and when nobody qualifies a letter asks you to draft someone.
- **How:** The enforcer pick (see "Enforcement runs a tick later") gains one filter for aggressive breaks: the candidate's Melee level at least the offender's. Without a candidate the case waits with a letter, and the sweep retries. Split out of the earlier "Violence" text on 2026-12-01; the details are still to be specced against the decompiled code.
- **Save and removal:** Nothing new; the case records the subdue as before.
- **Overlaps:** None.
- **Replaces:** Drafting a fighter by hand against your own berserk colonist.
- **Effort:** S.
- **Tests:** An aggressive break with a subdue row sends only an enforcer whose Melee is at least the offender's; with none, one letter and no job.
### Sentences, step 1: serve and come back (first release)
#### Jail for N days #### Jail for N days
@ -377,50 +474,37 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- Job: `JobMaker.MakeJob(JobDefOf.Arrest, offender, bed)` with `count = 1` (:52-54), or `JobDefOf.Capture` when the offender is down. The float menu offers Arrest only to drafted pawns (:27-30), so Laws builds the job itself. The job fails on `CanBeArrestedBy` (RimWorld/JobDriver_TakeToBed.cs:85-89; Verse.AI/GenAI.cs:73-103): pawns in a binge, a fire-starting spree or a corpse obsession can be arrested, berserk ones can't. - Job: `JobMaker.MakeJob(JobDefOf.Arrest, offender, bed)` with `count = 1` (:52-54), or `JobDefOf.Capture` when the offender is down. The float menu offers Arrest only to drafted pawns (:27-30), so Laws builds the job itself. The job fails on `CanBeArrestedBy` (RimWorld/JobDriver_TakeToBed.cs:85-89; Verse.AI/GenAI.cs:73-103): pawns in a binge, a fire-starting spree or a corpse obsession can be arrested, berserk ones can't.
- At contact the target rolls `CheckAcceptArrest` (Verse/Pawn.cs:4102-4137; RimWorld/JobDriver_TakeToBed.cs:91-116). A refusal turns the pawn berserk (Verse/Pawn.cs:4132-4135); with guilt a colonist never refuses. - At contact the target rolls `CheckAcceptArrest` (Verse/Pawn.cs:4102-4137; RimWorld/JobDriver_TakeToBed.cs:91-116). A refusal turns the pawn berserk (Verse/Pawn.cs:4132-4135); with guilt a colonist never refuses.
- Picking it up calls `CapturedBy` (RimWorld/JobDriver_TakeToBed.cs:164-178), which runs `SetGuestStatus(player, Prisoner)` (RimWorld/Pawn_GuestTracker.cs:443-540). That ends the break without Catharsis, because `ClearMind_NewTemp` resets the mental state directly (Verse/Pawn.cs:2807-2813; Verse.AI/Pawn_MindState.cs:343-350; Verse.AI/MentalStateHandler.cs:58-61), drops weapon and inventory forbidden (Pawn_GuestTracker.cs:461), undrafts, clears surgery bills (:533), drops a deathrest casket that isn't for prisoners (:534; RimWorld/Pawn_Ownership.cs:294-304; the colonist bed is already gone, see above) and sends a mechanitor's control groups to self-shutdown (:536-539; RimWorld/Pawn_MechanitorTracker.cs:312-322). Work priorities survive: prisoners have no disabled work types, only slaves do (RimWorld/GuestUtility.cs:39-52). - Picking it up calls `CapturedBy` (RimWorld/JobDriver_TakeToBed.cs:164-178), which runs `SetGuestStatus(player, Prisoner)` (RimWorld/Pawn_GuestTracker.cs:443-540). That ends the break without Catharsis, because `ClearMind_NewTemp` resets the mental state directly (Verse/Pawn.cs:2807-2813; Verse.AI/Pawn_MindState.cs:343-350; Verse.AI/MentalStateHandler.cs:58-61), drops weapon and inventory forbidden (Pawn_GuestTracker.cs:461), undrafts, clears surgery bills (:533), drops a deathrest casket that isn't for prisoners (:534; RimWorld/Pawn_Ownership.cs:294-304; the colonist bed is already gone, see above) and sends a mechanitor's control groups to self-shutdown (:536-539; RimWorld/Pawn_MechanitorTracker.cs:312-322). Work priorities survive: prisoners have no disabled work types, only slaves do (RimWorld/GuestUtility.cs:39-52).
- Two ticks after the capture Laws sets `SetExclusiveInteraction(PrisonerInteractionModeDefOf.MaintainOnly)` (RimWorld/Pawn_GuestTracker.cs:304); hook K's postfix records the capture tick and queues the write. Prison Labor sets its default mode on every new player prisoner in a `SetGuestStatus` postfix, inside the capture. Castes 1.4 can set one from its join queue on the first tick after the capture, the tick Laws would use with a one-tick delay. Both components tick in one loop over `Game.components` (Verse/GameComponentUtility.cs:24-31), in type order in a new game and in append order when a mod is added to a running save (Verse/Game.cs:472-489), so with Castes added after Laws, Castes would write last. Two ticks wins over both in any order. Will is 0 for the player kinds (Core Defs/PawnKindDefs_Humanlikes/PawnKinds_Player.xml:11, set at RimWorld/Pawn_GuestTracker.cs:474), so an Enslave default would succeed at the first warden visit (RimWorld/InteractionWorker_EnslaveAttempt.cs:19-20, 44-51). That is why Laws' write must land last. Prison Labor's non-exclusive labor toggle stays as Prison Labor set it: hard labor in jail is that mod's call. - Two ticks after the capture Laws sets `SetExclusiveInteraction(PrisonerInteractionModeDefOf.MaintainOnly)` (RimWorld/Pawn_GuestTracker.cs:304); hook K's postfix records the capture tick and queues the write. Prison Labor sets its default mode on every new player prisoner in a `SetGuestStatus` postfix, inside the capture. Castes' default prisoner interaction can set one from its join queue on the first tick after the capture, the tick Laws would use with a one-tick delay. Both components tick in one loop over `Game.components` (Verse/GameComponentUtility.cs:24-31), in type order in a new game and in append order when a mod is added to a running save (Verse/Game.cs:472-489), so with Castes added after Laws, Castes would write last. Two ticks wins over both in any order. Will is 0 for the player kinds (Core Defs/PawnKindDefs_Humanlikes/PawnKinds_Player.xml:11, set at RimWorld/Pawn_GuestTracker.cs:474), so an Enslave default would succeed at the first warden visit (RimWorld/InteractionWorker_EnslaveAttempt.cs:19-20, 44-51). That is why Laws' write must land last. Prison Labor's non-exclusive labor toggle stays as Prison Labor set it: hard labor in jail is that mod's call.
- The sentence record stores the capture tick, the release tick (capture plus the sentence) and the bed the pawn owned before the arrest job. Every 2500 ticks, a served sentence gets `SetExclusiveInteraction(Release)`. Wardens take it through `WorkGiver_Warden_ReleasePrisoner` (RimWorld/WorkGiver_Warden_ReleasePrisoner.cs:8-36), which skips downed prisoners and prisoners in a break (:15-19). `JobDriver_ReleasePrisoner` carries the pawn out and calls `GenGuest.PrisonerRelease` (Verse.AI/JobDriver_ReleasePrisoner.cs:31-37): `WasImprisoned` (-6 mood for 12 days; RimWorld/GenGuest.cs:10-13), `UnclaimAll` (:47; Pawn_Ownership.cs:286-292), and `SetGuestStatus(null)` because the home faction is the player (:55-62). Laws never patches the release job driver; Rimocracy's patch there broke every release (NullReferenceException, reported 2025-07 and 2025-08). - The sentence record stores the capture tick, the release tick (capture plus the sentence) and the bed the pawn owned before the arrest job. Every 2500 ticks, a served sentence gets `SetExclusiveInteraction(Release)`. Wardens take it through `WorkGiver_Warden_ReleasePrisoner` (RimWorld/WorkGiver_Warden_ReleasePrisoner.cs:8-36), which skips downed prisoners and prisoners in a break (:15-19). `JobDriver_ReleasePrisoner` carries the pawn out and calls `GenGuest.PrisonerRelease` (Verse.AI/JobDriver_ReleasePrisoner.cs:31-37): `WasImprisoned` (-6 mood for 12 days; RimWorld/GenGuest.cs:10-13), `UnclaimAll` (:47; Pawn_Ownership.cs:286-292), and `SetGuestStatus(null)` because the home faction is the player (:55-62). Laws never patches the release job driver; Rimocracy's patch there broke every release (NullReferenceException, reported 2025-07 and 2025-08).
- Fallback: one day after the due tick without a release, Laws calls `GenGuest.PrisonerRelease` itself. - Fallback: one day after the due tick without a release, Laws calls `GenGuest.PrisonerRelease` itself.
- Early end: once a jailed pawn is no longer `IsPrisonerOfColony` before its release tick (recruited, released by you or another mod, escaped, dead), the sentence closes with that outcome and a message. - Early end: once a jailed pawn is no longer `IsPrisonerOfColony` before its release tick (recruited, released by you or another mod, escaped, dead), the sentence closes with that outcome and a message.
- Hold: an Ideology role holder would lose its role on arrest, because `Precept_Role.ValidatePawn` refuses a player pawn that isn't a free non-slave colonist (RimWorld/Precept_Role.cs:582-585), and a mechanitor's mechs would shut down. Laws doesn't arrest those on its own in 1.0: the case waits with "Arrest now" and a letter. Guilt is set at filing anyway and renewed when "Arrest now" starts the job. - Hold: an Ideology role holder would lose its role on arrest, because `Precept_Role.ValidatePawn` refuses a player pawn that isn't a free non-slave colonist (RimWorld/Precept_Role.cs:582-585), and a mechanitor's mechs would shut down. While "Release gives back what jail took" is switched off, Laws doesn't arrest those on its own: the case waits with "Arrest now" and a letter. Guilt is set at filing anyway and renewed when "Arrest now" starts the job.
- Slaves: 1.0 never jails a slave. Releasing an imprisoned slave sends it back to its old faction and off the map (RimWorld/GenGuest.cs:14-19; Pawn_GuestTracker.cs:479-482), so slave jail waits for 1.1's re-enslave. A slave's jail row falls back to subdue while it is in its break, else to warn. - Slaves: without "Jail for slaves" Laws never jails a slave. Releasing an imprisoned slave sends it back to its old faction and off the map (RimWorld/GenGuest.cs:14-19; Pawn_GuestTracker.cs:479-482), so slave jail waits for that feature's re-enslave. A slave's jail row falls back to subdue while it is in its break, else to warn.
- **Settings:** "Letters for jailings" (on). Days per row. - **Settings:** "Letters for jailings" (on). Days per row.
- **Save and removal:** The sentence lives in the case. After removal a jailed colonist stays a vanilla prisoner of the colony; its guilt runs out on its own. - **Save and removal:** The sentence lives in the case. After removal a jailed colonist stays a vanilla prisoner of the colony; its guilt runs out on its own.
- **Overlaps:** Prisoner Sentencing (3736998871, 1.3k, 1.7) has a Temporary sentence that lets a former colonist rejoin; Prison Expanded (3827258534, 3.3k, 1.7) has its own sentences and parole. Both may release the same pawn: Laws notices the early release and closes its sentence instead of fighting them. Prisoner Realism (3760196312, 23.9k) institutionalises prisoners after about 10 days in jail and has its own "Arrest here", which Laws' jobs don't need. Custom Prisoner Interactions (2841231775, 51.2k) skips colonists on capture. - **Overlaps:** Prisoner Sentencing (3736998871, 1.3k, 1.7) has a Temporary sentence that lets a former colonist rejoin; Prison Expanded (3827258534, 3.3k, 1.7) has its own sentences and parole. Both may release the same pawn: Laws notices the early release and closes its sentence instead of fighting them. Prisoner Realism (3760196312, 23.9k) institutionalises prisoners after about 10 days in jail and has its own "Arrest here", which Laws' jobs don't need. Custom Prisoner Interactions (2841231775, 51.2k) skips colonists on capture.
- **Replaces:** The manual arrest-and-release cycle. - **Replaces:** The manual arrest-and-release cycle.
- **Effort:** S plus S plus S, 1.5 days, hook K included. - **Effort:** S plus S plus S, hook K included.
- **Tests:** - **Tests:**
- A did-it binge case with "jail 3 days": within 2500 ticks the offender is `IsPrisonerOfColony`, its mental state is null, it has no Catharsis, `TicksUntilInnocent` is at least 240000 minus the ticks since the arrest started, and two ticks after the capture its mode is MaintainOnly (also with Prison Labor in `-Compat`). Skip to the release tick: the mode is Release; a warden releases it; the pawn is a free colonist with `WasImprisoned` and the same work priorities as before the arrest. - A did-it binge case with "jail 3 days": within 2500 ticks the offender is `IsPrisonerOfColony`, its mental state is null, it has no Catharsis, `TicksUntilInnocent` is at least 240000 minus the ticks since the arrest started, and two ticks after the capture its mode is MaintainOnly (also with Prison Labor in `-Compat`). Skip to the release tick: the mode is Release; a warden releases it; the pawn is a free colonist with `WasImprisoned` and the same work priorities as before the arrest.
- Mode order: Laws' component moved before Castes' in `Game.components`, and an Enslave mode written at capture plus 1 (by the test now, by Castes 1.4's prisoner caste once it exists): the mode is MaintainOnly at capture plus 2 (Enslave skipped: needs Ideology; the core run uses ReduceResistance). - Mode order: Laws' component moved before Castes' in `Game.components`, and an Enslave mode written at capture plus 1 (by the test now, by Castes' prisoner caste once it exists): the mode is MaintainOnly at capture plus 2 (Enslave skipped: needs Ideology; the core run uses ReduceResistance).
- Prison Labor in `-Compat`, once with its non-exclusive "Force to work" (`PrisonLabor_workOption`) off and once on: the same work priorities as before the arrest after the release. Its 1.7 PrisonLabor.dll has `Patches_WorkSettings`, `LaborWorkSettings` and `InitWorkSettings`; if priorities change, Overlaps and the README say so. - Prison Labor in `-Compat`, once with its non-exclusive "Force to work" (`PrisonLabor_workOption`) off and once on: the same work priorities as before the arrest after the release. Its 1.7 PrisonLabor.dll has `Patches_WorkSettings`, `LaborWorkSettings` and `InitWorkSettings`; if priorities change, Overlaps and the README say so.
- With Castes in `-Compat`: the caste after the release matches the old one, read through reflection on `GameComponent_BlaxCastes.CasteOf(Pawn)`, so the test mod needs no reference to Castes; from Castes 1.1 through `CastesApi.CasteIdOf` (API version 1). Skipped without Castes. - With Castes in `-Compat`: the caste after the release matches the old one, read through reflection on `GameComponent_BlaxCastes.CasteOf(Pawn)`, so the test mod needs no reference to Castes; once Castes ships its read-only API, through `CastesApi.CasteIdOf` (API version 1). Skipped without Castes.
- The old bed: an arrest interrupted after its first toil leaves the colonist owning its old bed by the next sweep. A bed someone else claimed meanwhile stays theirs. - The old bed: an arrest interrupted after its first toil leaves the colonist owning its old bed by the next sweep. A bed someone else claimed meanwhile stays theirs.
- Late arrest: a 5-day row with no prisoner bed for 6 days, then one is built: the arrest is accepted against a Social 0 arrester, and the release comes 5 days after the capture. - Late arrest: a 5-day row with no prisoner bed for 6 days, then one is built: the arrest is accepted against a Social 0 arrester, and the release comes 5 days after the capture.
- No prisoner bed: one letter, no arrest; building one leads to the arrest at the next sweep. - No prisoner bed: one letter, no arrest; building one leads to the arrest at the next sweep.
- Holds and fallbacks, each skipped with "skipped: needs <DLC>": a role holder (Ideology) and a mechanitor with a mech (Biotech) get no arrest and one letter, and "Arrest now" arrests; a slave in a binge with a jail row is subdued, and the same row outside a break warns (Ideology). In the DLC-off runs no hold or fallback logs anything. - Holds and fallbacks, each skipped with "skipped: needs <DLC>": a role holder (Ideology) and a mechanitor with a mech (Biotech) get no arrest and one letter, and "Arrest now" arrests; a slave in a binge with a jail row is subdued, and the same row outside a break warns (Ideology). In the DLC-off runs no hold or fallback logs anything.
- Recruiting the jailed pawn closes the sentence as "released early". The fallback releases a pawn no warden can reach. - Recruiting the jailed pawn closes the sentence as "released early". The fallback releases a pawn no warden can reach.
- **Risks:** Arrest needs a prisoner bed (FloatMenuOptionProvider_Arrest.cs:41-49). Release unclaims bed, grave, throne and casket (RimWorld/GenGuest.cs:47); 1.0 accepts that the pawn picks a free bed again, 1.1 gives the old one back. Jailed colonists can break out (base MTB 60 days, Verse/PawnKindDef.cs:129; RimWorld/PrisonBreakUtility.cs:42-110); the early-end rule closes the sentence. Prisoner Realism's institutionalisation starts around 10 days, so the starter rows stay at 5 and 10. - **Risks:** Arrest needs a prisoner bed (FloatMenuOptionProvider_Arrest.cs:41-49). Release unclaims bed, grave, throne and casket (RimWorld/GenGuest.cs:47); without "Release gives back what jail took" the pawn picks a free bed again; with it the old one comes back. Jailed colonists can break out (base MTB 60 days, Verse/PawnKindDef.cs:129; RimWorld/PrisonBreakUtility.cs:42-110); the early-end rule closes the sentence. Prisoner Realism's institutionalisation starts around 10 days, so the starter rows stay at 5 and 10.
#### Headless tests in 1.0
- **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(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)
1.0's jail works but costs a long colony things vanilla never gives back. This release closes those gaps first, then adds the punishments that need no new crime.
#### Release gives back what jail took #### Release gives back what jail took
- **Players get:** After a sentence the pawn walks back into its own bedroom, its grave plot, its throne and its deathrest casket, takes up its ideoligion role again, its mechs return to their work modes and the weapon the arrest made it drop is allowed again. The 1.0 hold for role holders and mechanitors goes away: they are jailed like anyone, and the letter says what comes back at release. - **Players get:** After a sentence the pawn walks back into its own bedroom, its grave plot, its throne and its deathrest casket, takes up its ideoligion role again, its mechs return to their work modes and the weapon the arrest made it drop is allowed again. The hold for role holders and mechanitors goes away: they are jailed like anyone, and the letter says what comes back at release.
- **How:** Right before Laws starts the Arrest or Capture job, before its first toil takes the bed (see 1.0's jail), it snapshots into the case: owned bed and grave, throne (Royalty), deathrest casket (Biotech), the Ideology role (the `Precept_RoleSingle` the pawn holds) and each mech control group's work mode (`MechanitorControlGroup.WorkMode`, RimWorld/MechanitorControlGroup.cs:55). Hook K's prefix adds the primary weapon the pawn still holds when `CapturedBy` runs, which `SetGuestStatus` then drops (RimWorld/Pawn_GuestTracker.cs:461). A weapon dropped earlier, at a subdue downing (Verse/Pawn_HealthTracker.cs:856-859), is never taken: Blax Defaults' colony forbid rule or vanilla decides about it. After `GenGuest.PrisonerRelease`, from hook L's postfix, Laws reclaims what is still free: `ClaimBedIfNonMedical` (RimWorld/Pawn_Ownership.cs:125), `ClaimGrave` (:168), `ClaimThrone` (:197), `ClaimDeathrestCasket` (:251), `Precept_RoleSingle.Assign(pawn, addThoughts: false)` (RimWorld/Precept_RoleSingle.cs:73) if nobody holds the role, `SetWorkMode` per group (RimWorld/MechanitorControlGroup.cs:84), and unforbids the weapon if it still lies where it dropped. A thing another pawn claimed meanwhile stays theirs, and the release letter names it. Each DLC part runs behind its `ModsConfig.<DLC>Active`. - **How:** Right before Laws starts the Arrest or Capture job, before its first toil takes the bed (see "Jail for N days"), it snapshots into the case: owned bed and grave, throne (Royalty), deathrest casket (Biotech), the Ideology role (the `Precept_RoleSingle` the pawn holds) and each mech control group's work mode (`MechanitorControlGroup.WorkMode`, RimWorld/MechanitorControlGroup.cs:55). Hook K's prefix adds the primary weapon the pawn still holds when `CapturedBy` runs, which `SetGuestStatus` then drops (RimWorld/Pawn_GuestTracker.cs:461). A weapon dropped earlier, at a subdue downing (Verse/Pawn_HealthTracker.cs:856-859), is never taken: Blax Defaults' colony forbid rule or vanilla decides about it. After `GenGuest.PrisonerRelease`, from hook L's postfix, Laws reclaims what is still free: `ClaimBedIfNonMedical` (RimWorld/Pawn_Ownership.cs:125), `ClaimGrave` (:168), `ClaimThrone` (:197), `ClaimDeathrestCasket` (:251), `Precept_RoleSingle.Assign(pawn, addThoughts: false)` (RimWorld/Precept_RoleSingle.cs:73) if nobody holds the role, `SetWorkMode` per group (RimWorld/MechanitorControlGroup.cs:84), and unforbids the weapon if it still lies where it dropped. A thing another pawn claimed meanwhile stays theirs, and the release letter names it. Each DLC part runs behind its `ModsConfig.<DLC>Active`.
- **Save and removal:** Snapshot fields in the case: references and def names. Removal drops them; the pawn stays a prisoner as in 1.0. - **Save and removal:** Snapshot fields in the case: references and def names. Removal drops them; the pawn stays a prisoner, as "Jail for N days" says.
- **Overlaps:** Arrest and Release (2593514063, 4.6k, no 1.7) warns that arrest strips Ideology roles; Laws gives them back. - **Overlaps:** Arrest and Release (2593514063, 4.6k, no 1.7) warns that arrest strips Ideology roles; Laws gives them back.
- **Replaces:** Nothing. - **Replaces:** Nothing.
- **Effort:** M, 2 days. - **Effort:** M.
- **Tests:** Per item, one arrest and release on the core game and its DLC; each comes back. A bed claimed by another pawn during the sentence stays with that pawn and the letter names it. A role given to someone else stays with them. Royalty, Biotech and Ideology parts log "skipped: needs <DLC>" without it. `-Compat` with Blax Defaults' colony rule on and a Poor rifle: after subdue then jail, the rifle follows the colony rule once the pawn is carried off, and the release leaves it forbidden; after a plain arrest, the release allows the rifle the arrest dropped. - **Tests:** Per item, one arrest and release on the core game and its DLC; each comes back. A bed claimed by another pawn during the sentence stays with that pawn and the letter names it. A role given to someone else stays with them. Royalty, Biotech and Ideology parts log "skipped: needs <DLC>" without it. `-Compat` with Blax Defaults' colony rule on and a Poor rifle: after subdue then jail, the rifle follows the colony rule once the pawn is carried off, and the release leaves it forbidden; after a plain arrest, the release allows the rifle the arrest dropped.
#### Pardon, early release and longer sentences #### Pardon, early release and longer sentences
@ -433,15 +517,19 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- **Effort:** S. - **Effort:** S.
- **Tests:** "Release now" releases within a warden's trip; "Add days" moves the release tick and, without Castes' API version 2, stops at 50 days in total; "Pardon" leaves `IsGuilty` false and the case closed. - **Tests:** "Release now" releases within a warden's trip; "Add days" moves the release tick and, without Castes' API version 2, stops at 50 days in total; "Pardon" leaves `IsGuilty` false and the case closed.
#### Reprimand ### Sentences, step 2: with the sibling mods
- **Players get:** A mood punishment for minor crimes: "Reprimanded" -4, -8, -12 or -16 by severity, for 3 days. Each part waits for its sibling or for Fabian's answer. Indenture as a sentence is an open question in `docs/features.md`, not specced.
- **How:** A situational ThoughtDef whose worker reads the expiry tick from the component. Situational thoughts aren't saved and refresh every 100 ticks (RimWorld/SituationalThoughtHandler.cs:23, 34). A memory thought would be saved per pawn (RimWorld/MemoryThoughtHandler.cs:36) and log an error per memory after removal.
- **Save and removal:** The expiry tick lives in the case. After removal the thought is simply gone. #### Castes keeps the caste
- **Overlaps:** RimCourt's rulings carry their own mood effects; they never touch the same pawn through Laws.
- **Players get:** With Blax Castes' join API (API version 2), a jailed colonist goes to the new-prisoner row, never the captured row, and comes back to its own caste whatever the sentence length.
- **How:** `CastesApi.HintJoinReason(pawn, "blax.laws.jailed")` from hook K's prefix, right before the capture, and `"blax.laws.released"` from hook L's prefix, right before the release (API version 2, Castes' join API). Castes reads a hint in its `SetGuestStatus` hook, inside those calls, and drops it at the end of the tick. With the hint, Castes' prisoner caste sets no mode on the pawn. Laws keeps writing Maintain only after the capture and Release at the end for its convicts, whatever the Castes version.
- **Save and removal:** Nothing in Laws; Castes keeps its own record.
- **Overlaps:** None.
- **Replaces:** Nothing. - **Replaces:** Nothing.
- **Effort:** S. - **Effort:** S.
- **Tests:** The thought shows with the right stage, ends after 3 days, survives phase 2 with the same remaining time, and the .rws holds no "BlaxLaws" thought. - **Tests:** With Castes in `-Compat` and API version 2, an arrest lands in the new-prisoner row, not the captured row, and a 70-day sentence (test override past the 50-day limit) still returns the pawn to its old caste. Without version 2 the call is a no-op. With Castes' prisoner caste set to Enslave, a hinted pawn's mode is MaintainOnly two ticks after the capture.
#### Jail for slaves #### Jail for slaves
@ -455,63 +543,27 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- **Tests:** A slave jailed for 1 day is a slave of the colony again afterwards, never leaves the map, and no `EnslavedPrisoner` event was recorded. Skipped without Ideology. - **Tests:** A slave jailed for 1 day is a slave of the colony again afterwards, never leaves the map, and no `EnslavedPrisoner` event was recorded. Skipped without Ideology.
- **Risks:** This writes slave status, which Blax Slaves owns. It only puts back the status the sentence took. Open decision for Fabian. - **Risks:** This writes slave status, which Blax Slaves owns. It only puts back the status the sentence took. Open decision for Fabian.
#### Banish and execute ### Repeat offenders
- **Players get:** Two more punishments, always confirmed in a dialog, never automatic: banish and execute. With guilt, an execution costs the colony only the -2 "justified execution of colonist" thought (ideoligion precepts may change it) plus the family's grief; a banishment costs no colony-wide thought, and banishing to its death still grieves the family. Not specced yet: criminal record, escalation and probation (see `docs/features.md`). Needs the first release's cases.
- **How:** Banish opens `PawnBanishUtility.ShowBanishPawnConfirmationDialog` (RimWorld/PawnBanishUtility.cs:157). Execute sets `awaitingExecution` for a free guilty colonist, which wardens carry out (RimWorld/CharacterCardUtility.cs:278-285), or the vanilla Execution mode for a jailed one. Guilt picks the mildest execution stage (RimWorld/ThoughtUtility.cs:27-31, 72) and drops the colony-wide banishment thoughts (RimWorld/PawnDiedOrDownedThoughtsUtility.cs:214-232); relations still grieve (:81-84, 253). See "Warn and guilty".
- **Save and removal:** Vanilla fields only. ### Court, step 1: Ideology's trial as a punishment
- **Overlaps:** More Executions (3819037971, 1.2k) adds execution methods; they apply to Laws' executions like any other.
- **Replaces:** Nothing.
- **Effort:** S.
- **Tests:** The dialog appears and nothing happens without a click. A confirmed execution in a core-only run gives every colonist `KnowColonistExecuted` at stage 0 (-2) and nothing harsher, and the victim's spouse its grief thought. A confirmed plain banishment gives no colony-wide thought.
#### Trial through Ideology's ritual #### Trial through Ideology's ritual
- **Players get:** A "Trial" punishment. The case waits for a trial and sets no guilt. With Ideology your leader's Accuse ability works on the accused, and the vanilla verdict closes the case: convicted means the row's sentence (jail N days), exonerated closes it. Without Ideology "Trial" shows disabled with "Needs Ideology" until 1.3's own court makes it core. - **Players get:** A "Trial" punishment. The case waits for a trial and sets no guilt. With Ideology your leader's Accuse ability works on the accused, and the vanilla verdict closes the case: convicted means the row's sentence (jail N days), exonerated closes it. Without Ideology "Trial" shows disabled with "Needs Ideology" until court sessions make it core.
- **How:** Prefix and postfix on `RitualOutcomeEffectWorker_Trial.Apply` (RimWorld/RitualOutcomeEffectWorker_Trial.cs:21-58), a 37-line override, patched only with Ideology active. The prefix stores the convict's `TicksUntilInnocent`; a conviction calls `Notify_Guilty(900000)` (:49). A guilty pawn can't be accused (RimWorld/CompAbilityEffect_StartTrial.cs:44-47), so a jump means convicted. All three trial variants (colonist, prisoner, mental state) use this worker, so Fabian's "accuse him while he binges" works through vanilla: conviction makes the arrest certain (Verse/Pawn.cs:4087). - **How:** Prefix and postfix on `RitualOutcomeEffectWorker_Trial.Apply` (RimWorld/RitualOutcomeEffectWorker_Trial.cs:21-58), a 37-line override, patched only with Ideology active. The prefix stores the convict's `TicksUntilInnocent`; a conviction calls `Notify_Guilty(900000)` (:49). A guilty pawn can't be accused (RimWorld/CompAbilityEffect_StartTrial.cs:44-47), so a jump means convicted. All three trial variants (colonist, prisoner, mental state) use this worker, so Fabian's "accuse him while he binges" works through vanilla: conviction makes the arrest certain (Verse/Pawn.cs:4087).
- **Save and removal:** The case waits in the component; the trial itself is vanilla. - **Save and removal:** The case waits in the component; the trial itself is vanilla.
- **Overlaps:** Accusations+ (2557321190, 62, 1.3 only) extended the vanilla trial. - **Overlaps:** Accusations+ (2557321190, 62, 1.3 only) extended the vanilla trial.
- **Replaces:** Nothing. - **Replaces:** Nothing.
- **Effort:** S plus S, 1 day. - **Effort:** S plus S.
- **Tests:** A trial row and an open case; drive the worker's `Apply` with a forced positive outcome: the case closes convicted and the jail starts. Negative outcome: closed exonerated. Skipped without Ideology; in a `-NoDlc` run the row shows "Needs Ideology" and the case waits. - **Tests:** A trial row and an open case; drive the worker's `Apply` with a forced positive outcome: the case closes convicted and the jail starts. Negative outcome: closed exonerated. Skipped without Ideology; in a `-NoDlc` run the row shows "Needs Ideology" and the case waits.
#### Castes keeps the caste ### Court, step 2: court sessions on the core game
- **Players get:** With Blax Castes 1.3, a jailed colonist goes to the new-prisoner row, never the captured row, and comes back to its own caste whatever the sentence length.
- **How:** `CastesApi.HintJoinReason(pawn, "blax.laws.jailed")` from hook K's prefix, right before the capture, and `"blax.laws.released"` from hook L's prefix, right before the release (API version 2, Castes 1.3). Castes reads a hint in its `SetGuestStatus` hook, inside those calls, and drops it at the end of the tick. With the hint, Castes 1.4's prisoner caste sets no mode on the pawn. Laws keeps writing Maintain only after the capture and Release at the end for its convicts, whatever the Castes version.
- **Save and removal:** Nothing in Laws; Castes keeps its own record.
- **Overlaps:** None.
- **Replaces:** Nothing.
- **Effort:** S.
- **Tests:** With Castes in `-Compat` and API version 2, an arrest lands in the new-prisoner row, not the captured row, and a 70-day sentence (test override past the 50-day limit) still returns the pawn to its old caste. Without version 2 the call is a no-op. With Castes 1.4 and an Enslave prisoner caste, a hinted pawn's mode is MaintainOnly two ticks after the capture.
#### Headless tests in 1.1
- Phase 2 covers snapshots and waiting trials; phase 3 still expects exactly 2 errors. All 8 DLC combinations. Effort S.
### 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 rest wait for 1.8.
#### Violence
- **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, 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
- A combat run with 20 colonists against raiders: `TakeDamage` adds under 1% with the violence laws off. Effort S.
### 1.3 Court sessions (9 days)
#### Cases go to trial #### Cases go to trial
- **Players get:** "Trial" works on the core game. A case with a trial row waits in the Cases tab with "Convene court" and a gizmo on the accused, or convenes itself at the court hour when you switch that on (see "Court on its own"). With Ideology, the vanilla trial still closes the case (1.1). - **Players get:** "Trial" works on the core game. A case with a trial row waits in the Cases tab with "Convene court" and a gizmo on the accused, or convenes itself at the court hour when you switch that on (see "Court on its own"). With Ideology, the vanilla trial still closes the case (see "Trial through Ideology's ritual").
- **How:** The case file gains judge, prosecutor, evidence term, session results and a short transcript of plain strings. The judge office (pawn, appointed by you) lives in the component. - **How:** The case file gains judge, prosecutor, evidence term, session results and a short transcript of plain strings. The judge office (pawn, appointed by you) lives in the component.
- **Save and removal:** All in the component. - **Save and removal:** All in the component.
- **Overlaps:** RimCourt (3790057068, 8.8k, 1.7) is "you rule civil disputes as the lord"; Laws is "the colony tries those who break its laws". Its author called a colony vote "kind of a different mod". - **Overlaps:** RimCourt (3790057068, 8.8k, 1.7) is "you rule civil disputes as the lord"; Laws is "the colony tries those who break its laws". Its author called a colony vote "kind of a different mod".
@ -532,7 +584,7 @@ Only the violent crimes come before the court: they are the cases a trial is mos
#### Court on its own #### Court on its own
- **Players get:** "Convene court on its own" (off) and "Court hour" (10). When on, a waiting case convenes at the next court hour at the last place you used, with the appointed judge and the default prosecutor, when the judge and the accused are free (not drafted, downed, in a break or in another gathering) and no hostiles threaten the map. Otherwise it tries again the next day. A message names the case; no click needed. With it off, the court sits only when you press "Convene court". - **Players get:** "Convene court on its own" (off) and "Court hour" (10). When on, a waiting case convenes at the next court hour at the last place you used, with the appointed judge and the default prosecutor, when the judge and the accused are free (not drafted, downed, in a break or in another gathering) and no hostiles threaten the map. Otherwise it tries again the next day. A message names the case; no click needed. With it off, the court sits only when you press "Convene court".
- **How:** Every 2500 ticks the component compares `GenLocalDate.HourOfDay(map)` (RimWorld/GenLocalDate.cs:16) with the court hour and starts the same lord job as the dialog, one case at a time, oldest and gravest first. 1.6's court days reuse this scheduler. - **How:** Every 2500 ticks the component compares `GenLocalDate.HourOfDay(map)` (RimWorld/GenLocalDate.cs:16) with the court hour and starts the same lord job as the dialog, one case at a time, oldest and gravest first. Court days reuse this scheduler.
- **Settings:** "Convene court on its own" (off), "Court hour" (10, 0 to 23). - **Settings:** "Convene court on its own" (off), "Court hour" (10, 0 to 23).
- **Save and removal:** Settings only; the last place is already in the component. - **Save and removal:** Settings only; the last place is already in the component.
- **Overlaps:** None. - **Overlaps:** None.
@ -553,7 +605,7 @@ Only the violent crimes come before the court: they are the cases a trial is mos
#### Verdict and sentence #### Verdict and sentence
- **Players get:** Conviction chance P = 0.5 + evidence + 0.25 x (prosecutor's negotiation ability minus the accused's) + judge bias, clamped to 0.1 to 0.9. Evidence, from what the case already records: did it +0.25, each count past the first +0.05 up to +0.15, planning only (stopped before acting) 0, a repeat conviction for the same law within 60 days +0.10. Laws sees every act as it happens, so there is no "found later" term; witnesses are in the Backlog. Judge bias: -0.2 x the judge's opinion of the accused / 100. No crowd term. Convicted: the row's sentence, with guilt for at least 15 days as vanilla's trial gives (RimWorld/RitualOutcomeEffectWorker_Trial.cs:8), and "Convicted" -15 for 20 days. Acquitted: +8 for 10 days. - **Players get:** Conviction chance P = 0.5 + evidence + 0.25 x (prosecutor's negotiation ability minus the accused's) + judge bias, clamped to 0.1 to 0.9. Evidence, from what the case already records: did it +0.25, each count past the first +0.05 up to +0.15, planning only (stopped before acting) 0, a repeat conviction for the same law within 60 days +0.10. Laws sees every act as it happens, so there is no "found later" term; witnesses are in the Backlog. Judge bias: -0.2 x the judge's opinion of the accused / 100. No crowd term. Convicted: the row's sentence, with guilt for at least 15 days as vanilla's trial gives (RimWorld/RitualOutcomeEffectWorker_Trial.cs:8), and "Convicted" -15 for 20 days. Acquitted: +8 for 10 days.
- **How:** Negotiation ability is 0.4 plus a Social bonus, times Talking and Hearing (Core Defs/Stats/Stats_Pawns_Social.xml:5-32), the scale vanilla's trial uses. Without an attorney (1.5) the accused speaks for itself. Opinion comes from `OpinionOf` (RimWorld/Pawn_RelationsTracker.cs:592). Thoughts are situational, as in 1.1. - **How:** Negotiation ability is 0.4 plus a Social bonus, times Talking and Hearing (Core Defs/Stats/Stats_Pawns_Social.xml:5-32), the scale vanilla's trial uses. Without an attorney (see "Defence and prosecution") the accused speaks for itself. Opinion comes from `OpinionOf` (RimWorld/Pawn_RelationsTracker.cs:592). Thoughts are situational, as for Reprimand.
- **Save and removal:** Session results in the case. - **Save and removal:** Session results in the case.
- **Overlaps:** None. - **Overlaps:** None.
- **Replaces:** Nothing. - **Replaces:** Nothing.
@ -570,11 +622,45 @@ Only the violent crimes come before the court: they are the cases a trial is mos
- **Effort:** S. - **Effort:** S.
- **Tests:** Phase 3 with a session running and the button pressed: no Laws error, no lord left with our job. - **Tests:** Phase 3 with a session running and the button pressed: no Laws error, no lord left with our job.
#### Headless tests in 1.3 ### Court, step 3: the people of a trial
- The suite runs in all 8 DLC combinations; the place picker's throne and ritual spot entries skip without their DLC. Effort S. Not specced yet: witnesses and the guilty plea (see `docs/features.md`).
### 1.4 Elected judge (4 days) #### Defence and prosecution
- **Players get:** When a trial is set, the accused asks the colonist with the best mix of its liking for the accused and negotiation ability, and that colonist accepts when its opinion of the accused is 10 or more. You can assign anyone in the dialog (a reluctant attorney argues a little worse) or let the accused speak for itself. The prosecutor defaults to the victim, then the best speaker. Both speakers get 200 Social XP per session. A defended convict takes the verdict better (-8 instead of -15); an acquitted one likes its attorney more (+15). A Kind judge cuts sentences by a quarter, a Psychopath or Bloodlust judge adds a quarter.
- **How:** The defender's negotiation ability replaces the accused's in P. XP through `SkillRecord.Learn`. Opinion effects are situational social thoughts read from the case file, with an early-out set of pawns that have court history, so 60 x 60 opinion recalculations stay cheap.
- **Save and removal:** Roles per case in the component.
- **Overlaps:** RimCourt players asked for prosecution and defence colonists using Social (2026-08-27); its author has no plans for it.
- **Replaces:** Nothing.
- **Effort:** S per part (asking, prosecutor, XP and opinions, judge traits) plus S tests.
- **Tests:** A Social 12 attorney lowers P by the formula; a refusing pawn below opinion 10 isn't proposed; XP lands on both speakers.
### Court, step 4: long trials
Not specced yet: appeals (see `docs/features.md`).
#### Court days
- **Players get:** Serious and grave cases take 2 or 3 court days, one session a day at the court hour (see "Court on its own"), with an alert when court sits. The case window shows how each day went. The verdict on the last day comes from the mean of the days. An absent attorney means the accused speaks for itself that day; a failed day is rescheduled. The accused can be held in custody until the verdict.
- **How:** Each session computes its own P with that day's attendees, plus a small swing shown as "the day went to the prosecution" or "to the defence". Custody reuses jail without guilt.
- **Save and removal:** Day results in the case.
- **Overlaps:** None.
- **Replaces:** Nothing.
- **Effort:** M for days and the tally, S for absences, S for custody.
- **Tests:** A grave case runs 3 days; the verdict uses the mean; an escape during custody closes the case as escaped.
#### Courtrooms
- **Players get:** A room built around the court place counts as a courtroom when it is impressive enough. A verdict given there costs the convict less mood.
- **How:** A `RoomRoleDef` whose worker scores a room holding the chosen court place, after `RoomRoleWorker_ThroneRoom` (RimWorld/RoomRoleWorker_ThroneRoom.cs:17-30). Room roles are computed, never saved.
- **Save and removal:** Nothing saved; a room loses the role with the mod.
- **Overlaps:** RimCourt's seat spot is a different building.
- **Replaces:** Nothing.
- **Effort:** M, plus S tests.
- **Tests:** A room with the place and high impressiveness gets the role; the convict's thought is milder there.
### Colony votes, step 1: the voting core and the judge's office
#### Voting core #### Voting core
@ -604,112 +690,79 @@ Only the violent crimes come before the court: they are the cases a trial is mos
- **Effort:** S. - **Effort:** S.
- **Tests:** With Ideology the leader presides; in a `-NoDlc` run the saved choice reads as elected. - **Tests:** With Ideology the leader presides; in a `-NoDlc` run the saved choice reads as elected.
### 1.5 Attorneys (3 days) ### Colony votes, step 2: law votes
#### Defence and prosecution
- **Players get:** When a trial is set, the accused asks the colonist with the best mix of its liking for the accused and negotiation ability, and that colonist accepts when its opinion of the accused is 10 or more. You can assign anyone in the dialog (a reluctant attorney argues a little worse) or let the accused speak for itself. The prosecutor defaults to the victim, then the best speaker. Both speakers get 200 Social XP per session. A defended convict takes the verdict better (-8 instead of -15); an acquitted one likes its attorney more (+15). A Kind judge cuts sentences by a quarter, a Psychopath or Bloodlust judge adds a quarter.
- **How:** The defender's negotiation ability replaces the accused's in P. XP through `SkillRecord.Learn`. Opinion effects are situational social thoughts read from the case file, with an early-out set of pawns that have court history, so 60 x 60 opinion recalculations stay cheap.
- **Save and removal:** Roles per case in the component.
- **Overlaps:** RimCourt players asked for prosecution and defence colonists using Social (2026-08-27); its author has no plans for it.
- **Replaces:** Nothing.
- **Effort:** S per part (asking, prosecutor, XP and opinions, judge traits) plus S tests, 3 days.
- **Tests:** A Social 12 attorney lowers P by the formula; a refusing pawn below opinion 10 isn't proposed; XP lands on both speakers.
### 1.6 Multi-day trials and courtrooms (6 days)
#### Court days
- **Players get:** Serious and grave cases take 2 or 3 court days, one session a day at the court hour from 1.3, with an alert when court sits. The case window shows how each day went. The verdict on the last day comes from the mean of the days. An absent attorney means the accused speaks for itself that day; a failed day is rescheduled. The accused can be held in custody until the verdict.
- **How:** Each session computes its own P with that day's attendees, plus a small swing shown as "the day went to the prosecution" or "to the defence". Custody reuses jail without guilt.
- **Save and removal:** Day results in the case.
- **Overlaps:** None.
- **Replaces:** Nothing.
- **Effort:** M for days and the tally, S for absences, S for custody.
- **Tests:** A grave case runs 3 days; the verdict uses the mean; an escape during custody closes the case as escaped.
#### Courtrooms
- **Players get:** A room built around the court place counts as a courtroom when it is impressive enough. A verdict given there costs the convict less mood.
- **How:** A `RoomRoleDef` whose worker scores a room holding the chosen court place, after `RoomRoleWorker_ThroneRoom` (RimWorld/RoomRoleWorker_ThroneRoom.cs:17-30). Room roles are computed, never saved.
- **Save and removal:** Nothing saved; a room loses the role with the mod.
- **Overlaps:** RimCourt's seat spot is a different building.
- **Replaces:** Nothing.
- **Effort:** M, plus S tests.
- **Tests:** A room with the place and high impressiveness gets the role; the convict's thought is milder there.
### 1.7 Law votes (5 days)
#### Colony votes on the lawbook #### 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. - **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 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). - **How:** The voting core plus the score terms. An act without a law is invisible to the hooks (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 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. - **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. - **Overlaps:** Rimocracy (2159080853, 6.3k) votes on leadership decisions; Laws votes only on lawbook rows and the judge.
- **Replaces:** Nothing. - **Replaces:** Nothing.
- **Effort:** S plus S proposals, M scores and reasons, S plus S vote flow, S tests: 5 days. - **Effort:** S plus S proposals, M scores and reasons, S plus S vote flow, S tests.
- **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. - **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 (2 days) ### Colony votes, step 3: jury and petitions
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. Not specced yet: the jury and pardon petitions (see `docs/features.md`).
#### Slaughterers, prison breaks and slave rebellions ### Headless tests
- **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). #### First release
- **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 act only records who rebelled.
- **Replaces:** Law and Order's sabotage crime, partly.
- **Effort:** S plus S.
- **Tests:** One case per act; the slave rebellion test skips without Ideology.
#### Drugs against the policy - **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(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.
- **Combat:** a combat run with 20 colonists against raiders: `TakeDamage` (Violence) adds under 1% with the violence laws off.
- **Phase 2:** also covers the give-back snapshots of "Release gives back what jail took"; phase 3 still expects exactly 2 errors. All 8 DLC combinations.
- **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), plus S for the combat run.
- **Players get:** a group entry "Drug the policy doesn't allow" in the Ate category, outside binges and player orders. #### Court, step 1
- **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.
- **Effort:** S.
- **Tests:** A forced ingest of a drug the policy forbids opens a case; an allowed one doesn't.
#### Headless tests in 1.8 - Phase 2 covers waiting trials; phase 3 still expects exactly 2 errors. All 8 DLC combinations. 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. #### Court, step 2
- The suite runs in all 8 DLC combinations; the place picker's throne and ritual spot entries skip without their DLC. Effort S.
#### Crimes, step 2
- All 8 DLC combinations; the slave rebellion test skips without Ideology. The new acts join the tally-only mode of law votes, checked with one forced act each. Effort S.
## Works with the other Blax mods ## Works with the other Blax mods
- Package ids: `blax.slaves`, `blax.castes`, `blax.zones`, `blax.defaults`, `blax.laws`. No hard dependencies. Laws' About.xml lists `brrainz.harmony`, `blax.castes` and `blax.slaves` in loadAfter, because it binds `CastesApi` (1.1) and `SlavesApi`. Load order becomes Castes, Zones, Slaves, Laws. No sibling lists `blax.laws`, so there is no loadAfter cycle. Defaults lists no sibling and no sibling lists Defaults. - Package ids: `blax.slaves`, `blax.castes`, `blax.zones`, `blax.defaults`, `blax.laws`. No hard dependencies. Laws' About.xml lists `brrainz.harmony`, `blax.castes` and `blax.slaves` in loadAfter, because it binds `CastesApi` and `SlavesApi`. Load order becomes Castes, Zones, Slaves, Laws. No sibling lists `blax.laws`, so there is no loadAfter cycle. Defaults lists no sibling and no sibling lists Defaults.
- Detection: one Compat helper, `ModLister.GetActiveModWithIdentifier(id, ignorePostfix: true)`. Sibling APIs bound by reflection into cached delegates at startup; a missing sibling or method is a silent no-op. Laws offers no API in 1.x; a `LawsApi` with an int `Version` comes when a sibling needs one. - Detection: one Compat helper, `ModLister.GetActiveModWithIdentifier(id, ignorePostfix: true)`. Sibling APIs bound by reflection into cached delegates at startup; a missing sibling or method is a silent no-op. Laws offers no API in 1.x; a `LawsApi` with an int `Version` comes when a sibling needs one.
- Ownership: - Ownership:
- Castes: every per-pawn policy default (apparel, food, drug, reading, medical care, schedule, work priorities, weapon loadout, allowed area, hostility, self-tend, carried medicine, fire at will, prisoner interaction except the Maintain only and Release modes Laws sets on colonists it jailed). - Castes: every per-pawn policy default (apparel, food, drug, reading, medical care, schedule, work priorities, weapon loadout, allowed area, hostility, self-tend, carried medicine, fire at will, prisoner interaction except the Maintain only and Release modes Laws sets on colonists it jailed).
- Zones: sleeping spots, beds by zone, every friendly drop location and per-cell work rules (work rule areas); it never changes a pawn's work priorities or allowed area. - Zones: sleeping spots, beds by zone, every friendly drop location and per-cell work rules (work rule areas); it never changes a pawn's work priorities or allowed area.
- Slaves: slave status (except the status Laws gives back to a slave it jailed), trade, prices, suppression, rebellion, slave medicine and the slave economy. - Slaves: slave status (except the status Laws gives back to a slave it jailed), trade, prices, suppression, rebellion, slave medicine and the slave economy.
- Defaults: starting settings of vanilla stockpiles and growing zones, storage buildings, production bills, workbenches, buildings, animals and mechs, and what the game forbids when pawns go down, die or are stripped. It writes when something is made or joins, and through its opt-in forbid rules when a pawn goes down, dies or is stripped. It keeps nothing in the save. - Defaults: starting settings of vanilla stockpiles and growing zones, storage buildings, production bills, workbenches, buildings, animals and mechs, and what the game forbids when pawns go down, die or are stripped. It writes when something is made or joins, and through its opt-in forbid rules when a pawn goes down, dies or is stripped. It keeps nothing in the save.
- Laws: the colony's lawbook (which acts are crimes, at which stage, how severe and how they are punished), cases, sentences and, from 1.3, trials, judges, attorneys and law votes. It acts through vanilla arrest, capture, release and guilt plus its own non-lethal subdue job. For the colonists it jailed, and only for them, it writes the prisoner interaction mode (Maintain only after the arrest, Release when the sentence ends) and, from 1.1, gives back what the sentence took: bed, grave, throne, deathrest casket, ideoligion role, mech work modes and the weapon the arrest dropped. From 1.1, and only if Fabian agrees, it puts a slave it jailed back into slavery. It never sets policies, work priorities, allowed areas, zones or suppression. It keeps its state in one GameComponent. - Laws: the colony's lawbook (which acts are crimes, at which stage, how severe and how they are punished), cases, sentences, trials, judges, attorneys and law votes. It acts through vanilla arrest, capture, release and guilt plus its own non-lethal subdue job. For the colonists it jailed, and only for them, it writes the prisoner interaction mode (Maintain only after the arrest, Release when the sentence ends) and gives back what the sentence took: bed, grave, throne, deathrest casket, ideoligion role, mech work modes and the weapon the arrest dropped. Only if Fabian agrees, it puts a slave it jailed back into slavery. It never sets policies, work priorities, allowed areas, zones or suppression. It keeps its state in one GameComponent.
### Blax Castes ### Blax Castes
- An arrest is vanilla `CapturedBy`, so Castes 1.0 already moves the jailed colonist to the new-prisoner row and a release within `formerCasteDays` (60) back to its old caste. Laws' 50-day limit on days keeps every 1.0 sentence, the fallback day included, inside that window; 1.1's "Add days" stops at 50 days in total until the API version 2 hint keeps the record. From Castes 1.3 an arrest without the hint lands in the captured row (Castes' new `CapturedBy` scope); Laws 1.1 hints it. - An arrest is vanilla `CapturedBy`, so Castes 1.0 already moves the jailed colonist to the new-prisoner row and a release within `formerCasteDays` (60) back to its old caste. Laws' 50-day limit on days keeps every sentence, the fallback day included, inside that window; "Add days" stops at 50 days in total until the API version 2 hint keeps the record. Once Castes' join API (API version 2) ships, an arrest without the hint lands in the captured row (Castes' new `CapturedBy` scope); Laws' "Castes keeps the caste" hints it.
- The one write into Castes' area: the Maintain only and Release modes for pawns Laws jailed, in every version of both mods. From Castes 1.3 (API version 2) Laws 1.1 sends `blax.laws.jailed` from hook K and `blax.laws.released` from hook L through `HintJoinReason`; Castes 1.4's prisoner caste then sets no mode on the hinted pawn, and Laws still writes Maintain only two ticks after the capture. - The one write into Castes' area: the Maintain only and Release modes for pawns Laws jailed, in every version of both mods. With Castes' join API (API version 2), Laws' "Castes keeps the caste" sends `blax.laws.jailed` from hook K and `blax.laws.released` from hook L through `HintJoinReason`; Castes' prisoner caste then sets no mode on the hinted pawn, and Laws still writes Maintain only two ticks after the capture.
- Laws never writes a policy, a schedule, medical care or a work priority. Jail keeps priorities because prisoners have no disabled work types; the `-Compat` run checks that Prison Labor doesn't change them. - Laws never writes a policy, a schedule, medical care or a work priority. Jail keeps priorities because prisoners have no disabled work types; the `-Compat` run checks that Prison Labor doesn't change them.
### Blax Slaves ### Blax Slaves
- Slaves are offenders like colonists, with warn, guilty and subdue in 1.0. Rebellion stays Slaves'; 1.8's rebellion crime only records it. - Slaves are offenders like colonists, with warn, guilty and subdue from the first release. Rebellion stays Slaves'; the slave rebellion act (Crimes, step 2) only records it.
- Slaves 2.0's wardens calm slaves out of non-violent breaks. When a SlavesApi member says that feature is on, Laws doesn't subdue slaves and lets Slaves' wardens talk them down. - Slaves' "Wardens calm breakdowns" calms slaves out of non-violent breaks. When a SlavesApi member says that feature is on, Laws doesn't subdue slaves and lets Slaves' wardens talk them down.
- 1.1's jail for slaves puts a jailed slave back into slavery at the end, without vanilla's enslave event. It restores the status the sentence took; it's still a write to slave status, so it ships only if Fabian agrees. - "Jail for slaves" puts a jailed slave back into slavery at the end, without vanilla's enslave event. It restores the status the sentence took; it's still a write to slave status, so it ships only if Fabian agrees.
- Suppression is never touched. A re-enslaved slave starts with the suppression vanilla gives a new slave. - Suppression is never touched. A re-enslaved slave starts with the suppression vanilla gives a new slave.
### Blax Zones ### Blax Zones
- Jail uses any vanilla prisoner bed. Zones 1.5's prisoner sleeping zones are made of real beds, so arrests find them with no Laws code. - Jail uses any vanilla prisoner bed. Zones' people sleeping zones for prisoners are made of real beds, so arrests find them with no Laws code.
- A court place (1.3) and a courtroom (1.6) are stored by ThingID in Laws' component, never as a zone. - A court place and a courtroom are stored by ThingID in Laws' component, never as a zone.
### Blax Defaults ### Blax Defaults
- Arrest drops the weapon and inventory forbidden inside `SetGuestStatus`, which Defaults' forbid rules don't see; 1.1 unforbids the weapon the arrest dropped, noted in hook K's prefix. A subdue downing goes through `MakeDowned` first, so a subdued pawn holds no weapon at the capture: Defaults' colony forbid rule decides about that weapon once the pawn is carried off, and Laws never touches it. Neither mod hooks the other. A `-Compat` test with the colony rule on covers both paths (see 1.1 "Release gives back what jail took"). - Arrest drops the weapon and inventory forbidden inside `SetGuestStatus`, which Defaults' forbid rules don't see; "Release gives back what jail took" unforbids the weapon the arrest dropped, noted in hook K's prefix. A subdue downing goes through `MakeDowned` first, so a subdued pawn holds no weapon at the capture: Defaults' colony forbid rule decides about that weapon once the pawn is carried off, and Laws never touches it. Neither mod hooks the other. A `-Compat` test with the colony rule on covers both paths (see "Release gives back what jail took").
### Shared conventions ### Shared conventions
@ -719,14 +772,15 @@ Food binges, jailbreakers, desertion (GiveUpExit) and slaughterers are mental br
- All four docs and READMEs: package ids gain `blax.laws`; the ownership lists gain the Laws sentence above; load order reads "Castes, Zones, Slaves, Laws"; the "More Blax Gaming mods" lines on the Workshop pages name Blax Laws. - All four docs and READMEs: package ids gain `blax.laws`; the ownership lists gain the Laws sentence above; load order reads "Castes, Zones, Slaves, Laws"; the "More Blax Gaming mods" lines on the Workshop pages name Blax Laws.
- The shared ownership lines, the same in all five docs: Castes' line ends "prisoner interaction except the Maintain only and Release modes Laws sets on colonists it jailed"; Slaves' line reads "slave status (except the status Laws gives back to a slave it jailed)"; the Laws line is the one above. In Castes `docs/design.md` (its "Works with the other Blax mods" list), Zones `docs/design.md` (the ownership bullet in its Blax mods section), Slaves `docs/roadmap.md` (the "Ownership" bullet) and Defaults `docs/design.md` (its ownership line and the Castes paragraph that lists prisoner interaction). - The shared ownership lines, the same in all five docs: Castes' line ends "prisoner interaction except the Maintain only and Release modes Laws sets on colonists it jailed"; Slaves' line reads "slave status (except the status Laws gives back to a slave it jailed)"; the Laws line is the one above. In Castes `docs/design.md` (its "Works with the other Blax mods" list), Zones `docs/design.md` (the ownership bullet in its Blax mods section), Slaves `docs/roadmap.md` (the "Ownership" bullet) and Defaults `docs/design.md` (its ownership line and the Castes paragraph that lists prisoner interaction).
- Castes `docs/design.md`: the join reason table gains `blax.laws.jailed` (new-prisoner row, never the captured row, no prisoner mode, former-caste record kept beyond `formerCasteDays`) and `blax.laws.released` (previous caste whatever its age). 1.4's default prisoner interaction skips pawns with the `blax.laws.jailed` hint. - Castes `docs/design.md`: the join reason table gains `blax.laws.jailed` (new-prisoner row, never the captured row, no prisoner mode, former-caste record kept beyond `formerCasteDays`) and `blax.laws.released` (previous caste whatever its age). Castes' default prisoner interaction skips pawns with the `blax.laws.jailed` hint.
- Slaves `docs/roadmap.md`: `SlavesApi` gains a bool `CalmsBreaks` with 2.0's "Wardens calm breakdowns", which Laws reads to stand its subdue down for slaves. The Cut line on flogging gets a note that Laws' subdue is a capped fistfight to end a break, not a punishment system for slaves. - Slaves `docs/roadmap.md`: `SlavesApi` gains a bool `CalmsBreaks` with "Wardens calm breakdowns", which Laws reads to stand its subdue down for slaves. The Cut line on flogging gets a note that Laws' subdue is a capped fistfight to end a break, not a punishment system for slaves.
- Zones `docs/design.md`: "Works with the other Blax mods" notes that Laws' arrests use prisoner zone beds like any prisoner bed. - 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. - 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' first release the weapon an arrest drops is allowed again at the release.
- Slaves `docs/roadmap.md`, only if Fabian says yes to indenture as a sentence (see `docs/features.md`): `SlavesApi` gains a call that starts an indenture for a convict with a term, and Slaves' indentured servitude names Laws as a source.
## To verify against the decompiled code ## 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: 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 first release is built, 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`. - `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. - `HistoryEventsManager.RecordEvent`: which events Core records without Ideology, which carry `HistoryEventArgsNames.Doer`, and the list of faction-level events to exclude.
@ -734,26 +788,26 @@ The act catalogue was checked on 2026-12-01 against the 1.7.5021 reference assem
- `CompUsable.UsedBy`: the overrides in Core and the DLCs, and that every use path calls it. - `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 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 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 jailbreaker's talk goes through `TryInteractWith` (an earlier draft 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 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. - The picker with a large mod list: catalogue size and draw cost.
## Backlog ## Backlog
Promoted to `docs/features.md` on 2026-12-01 as New features: lawbook templates; the group "anything the offender's ideoligion forbids" and apostasy (single events such as adultery as `GotLovin_NonSpouse` are catalogue entries already); witnesses as a role and as evidence (free colonists with line of sight to the act, recorded in a new Case field at filing); the guilty plea; appeals and retrial under a new judge; a jury from the spectators; pardon petitions from a convict's friends. The rest waits for demand:
- 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. - 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. - 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. - "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. - Crimes on caravans (S): today only pawns on a map are watched; caravan cases would wait until the pawn is home.
- 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`. - Player-forced jobs as crimes: 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). - Freeing a held entity (Anomaly) as an act.
- Theft: vanilla colonists never steal; a "took forbidden goods during a break" flag in the `Thing.Ingested` prefix. - 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). - 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).
- Trials for guests and enemy prisoners, next to Prisoner Sentencing and Prison Expanded. - Trials for guests and enemy prisoners, next to Prisoner Sentencing and Prison Expanded.
- RimCourt bridge: its pillory and lash as punishments while RimCourt is active. - RimCourt bridge: its pillory and lash as punishments while RimCourt is active.
- Lawbook templates shared across saves, in a Config file with Defaults' write, read-back and backup rules.
- A Castes right "may serve in court". - 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. - 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). - Confessions and interrogation, next to Prisoner Interrogation Ritual (3696342867, 1.3k).
## Cut ## Cut
@ -761,7 +815,7 @@ The act catalogue was checked on 2026-12-01 against the 1.7.5021 reference assem
- New crime events or extra mental breaks: Law and Order did that and a commitment save drowned in murderous rages. Laws only watches. - New crime events or extra mental breaks: Law and Order did that and a commitment save drowned in murderous rages. Laws only watches.
- A "planning" stage guessed from mood or traits before a break: the break type doesn't exist until the break starts (Verse.AI/MentalBreaker.cs:311-328). - A "planning" stage guessed from mood or traits before a break: the break type doesn't exist until the break starts (Verse.AI/MentalBreaker.cs:311-328).
- Vanilla's `AteMeat` event for the meat law: Ideology only and blind to meals (Verse/Thing.cs:2055-2064). - Vanilla's `AteMeat` event for the meat law: Ideology only and blind to meals (Verse/Thing.cs:2055-2064).
- The vanilla Ideology trial as the court: leader-only judge who also prosecutes, no defender, the leader's 10-day ability cooldown, a verdict driven by crowd size, Ideology only. Laws listens to it instead (1.1). - The vanilla Ideology trial as the court: leader-only judge who also prosecutes, no defender, the leader's 10-day ability cooldown, a verdict driven by crowd size, Ideology only. Laws listens to it instead (see "Trial through Ideology's ritual").
- A hidden ritual precept to get the ritual dialog for free: it would sit in every ideoligion in the save (RimWorld/Ideo.cs:617-624) and log errors per ideo after removal. - A hidden ritual precept to get the ritual dialog for free: it would sit in every ideoligion in the save (RimWorld/Ideo.cs:617-624) and log errors per ideo after removal.
- Votes or court days as IncidentDefs, GameConditions or quests, a custom Letter class or LetterDef, memory ThoughtDefs, HediffDefs for punishments, our own InteractionDefs: each leaves our defs in vanilla save lists. - Votes or court days as IncidentDefs, GameConditions or quests, a custom Letter class or LetterDef, memory ThoughtDefs, HediffDefs for punishments, our own InteractionDefs: each leaves our defs in vanilla save lists.
- A "Law enforcement" work type: WorkTypeDefs sit in a `DefMap` saved by index, so adding or removing the mod shifts other mods' values. - A "Law enforcement" work type: WorkTypeDefs sit in a `DefMap` saved by index, so adding or removing the mod shifts other mods' values.
@ -771,4 +825,4 @@ The act catalogue was checked on 2026-12-01 against the 1.7.5021 reference assem
- Torture and flogging: beyond vanilla's tone; War Crimes Expanded 2 has torture for those who want it. - Torture and flogging: beyond vanilla's tone; War Crimes Expanded 2 has torture for those who want it.
- Patching `JobDriver_ReleasePrisoner`: releases go through the vanilla interaction mode. - Patching `JobDriver_ReleasePrisoner`: releases go through the vanilla interaction mode.
- Using the guilt timer as the sentence: other mods change guilt length; the case keeps its own release tick. - Using the guilt timer as the sentence: other mods change guilt length; the case keeps its own release tick.
- Patching tiny methods: `Notify_CorpseHauled`, `Pawn_GuiltTracker.Notify_Guilty`, `ExecutionUtility.DoExecutionByCut` (a one-line wrapper; 1.8 patches the private `ExecutionInt`), the empty `MentalState.Notify_AttackedTarget`. - Patching tiny methods: `Notify_CorpseHauled`, `Pawn_GuiltTracker.Notify_Guilty`, `ExecutionUtility.DoExecutionByCut` (a one-line wrapper; "Slaughterers" patches the private `ExecutionInt`), the empty `MentalState.Notify_AttackedTarget`.

188
docs/features.md Normal file
View File

@ -0,0 +1,188 @@
# Blax Laws feature plan
Write the colony's lawbook from every act the game knows, and the colony enforces it: a warden stops a binge before the first dose, a murderer sits out its sentence and walks back to its own bed and role, and a colonist who keeps doing it gets more each time. Grave cases go to a court with a judge the colony elects, attorneys who argue with Social, witnesses and a jury, and the colony votes on the laws themselves. Laws only watches what the game already does: no new crime events, no new mental breaks.
Status: design only, nothing built. Planned 2026-12-01. This file is the plan of record for what the mod covers and in which order the parts come. `docs/design.md` holds the spec of every designed feature.
## How this plan is cut
- An area is one player problem together with the system that solves it. No area is cut to fit a time box or a release size.
- An area has steps only where a part needs another part built first, a sibling mod's feature or a decision from Fabian. Each step is usable on its own.
- Status per feature: **Designed** (spec in `design.md`, linked), **New** (added by this plan; its spec is written before its step is built), **Idea** (waits for player demand).
- Every feature works with any DLC combination (a DLC part switches off and says "Needs <DLC>"), has its own toggle, keeps the save loadable after a plain unsubscribe, stays inside vanilla's tone (no torture, no flogging) and needs no new art unless it says so.
## Scope
Laws covers which acts are crimes, how they are seen, how the colony stops and punishes them, sentences and what comes back after them, repeat offenders, trials, the judge and votes on the laws. It covers free colonists and colony slaves; prisoners only for a prison break.
It leaves to the sibling mods:
- Blax Castes: policies, schedules, work priorities, allowed areas and prisoner interaction defaults. Laws writes only Maintain only and Release, and only on colonists it jailed.
- Blax Slaves: slave status, suppression, rebellion and the slave economy. Laws records a rebellion as an act and, if Fabian agrees, gives back the slave status a sentence took.
- Blax Zones: beds by zone, drop spots and work rule areas. Arrests use any prisoner bed, zone beds included.
- Blax Defaults: what stays forbidden when pawns go down, die or are stripped. Laws only allows again the weapon its own arrest dropped.
Sentencing guests and enemy prisoners stays with Prisoner Sentencing and Prison Expanded.
## 1. Lawbook
Players want to say what is forbidden without a fixed crime list, and to see every case.
Step 1, the book (first release):
- **Laws tab.** Rows of Action, Stage, Severity, Punishment and Days; each dropdown offers only what fits the action. Designed: [Lawbook tab](design.md#lawbook-tab).
- **Act picker.** A searchable tree like a tailoring bill's filter, built from the loaded defs, each entry labelled with its mod. Designed: [Lawbook tab](design.md#lawbook-tab).
- **Starter lawbook.** Seven suggested rows in one click. Designed: "Defaults I picked".
- **Case log.** Who, what, stage, punishment and status, newest first, with "Arrest now" for cases that wait. Designed: [Lawbook tab](design.md#lawbook-tab).
- **Missing entries wait.** A row whose DLC or mod is gone shows "Needs <DLC>" or "Missing: <mod>" and works again when it returns. Designed.
Step 2, lawbook templates (after Repeat offenders, so the file format holds the escalation column):
- **Lawbook templates.** Save the book to a file and load it in another colony, with Blax Defaults' write, read-back and backup rules. New, from the Backlog. Demand: the same wish for policies and settings carried Export Agency (16.3k) and Save My Settings (3.8k), which Castes' templates answer.
Ideas: rows that tick several entries, like a bill's ingredient filter; a per-row "player orders count too" switch.
## 2. Crimes
Any act the game knows can be a crime, DLC and modded content included, and the colony sees it the moment it happens.
Step 1, every act the game records (first release):
- **Seven categories.** Mental breaks, ate, used, social interactions, recorded acts, records and bills, each with group entries (any drug, hard drugs, human meat, any surgery). Designed: [Act catalogue and detection](design.md#act-catalogue-and-detection).
- **Special acts.** Set a fire, displayed a corpse, started a social fight. Designed: same section.
- **Planning and did it for breaks.** A link table gives drug and food binges, fire-starting sprees, corpse obsession, insulting sprees and the jailbreaker their "did it". Designed: same section.
- **Violence.** Assault, harming prisoners or slaves, manslaughter and murder, plus "did it" for tantrums, berserk, murderous and sadistic rage. Designed: [Violence](design.md#violence). It joins the first release: a lawbook without assault and murder misses the crimes players name first.
- **Slaughterers.** The slaughterer break's "did it" is the animal it killed. Designed: [Slaughterers](design.md#slaughterers).
- **Drugs against the policy.** An Ate group entry for a drug the pawn's policy doesn't allow; Laws reads the policy Castes or the player set. Designed: [Drugs against the policy](design.md#drugs-against-the-policy).
- **No flood.** Acts outside a break open at most one case per offender and law a day. Designed.
Step 2, uprisings (needs Sentences step 1, and for rebel slaves Fabian's answer on jail for slaves):
- **Prison break.** Prisoners become offenders for this one act. Designed: [Prison breaks and slave rebellions](design.md#prison-breaks-and-slave-rebellions). The spec still has to say which punishments a prisoner gets; the proposal is warn, "Add days" on a Laws sentence and a confirmed execution.
- **Slave rebellion.** Records who rebelled; the rebellion itself stays Slaves'. Designed: same section. Needs Ideology.
Step 3, crimes against the faith (New; spec and a check of the precept code in the decompiled game first):
- **Anything my ideoligion forbids.** One group entry that matches any recorded act the offender's own ideoligion forbids, read from its precepts (`PreceptComp_UnwillingToDo.eventDef`), so a vegetarian colony needs one row instead of one per meat. New, from the Backlog. Needs Ideology. Demand: Rimworld Law and Order (419, 1.6 only) built its crimes on Ideology; vanilla answers a broken precept with mood alone.
- **Apostasy.** A colonist who leaves the colony's main ideoligion (`Pawn_IdeoTracker.SetIdeo`). New, from the Backlog. Needs Ideology.
The two hooks above exist in the 1.7.5021 reference assemblies (a compile probe found both); what they do at runtime is not checked.
Ideas: an "attempted" stage (needs the hot `StartJob` hook), crimes on caravans, theft during a break, used buildings and any job as a category, freeing a held entity (Anomaly).
## 3. Enforcement and punishments
When a law is broken the colony acts at once, safely, and the punishment fits the act.
Step 1 (first release):
- **Enforcement.** One enforcer per case, wardens first; nobody is pulled off a rescue, a tending, a fire, a turret or a surgery, and nobody is sent while hostiles threaten the map. Waiting cases retry by themselves. Designed: [Enforcement and cases](design.md#enforcement-and-cases).
- **Warn and guilty.** A record and a message, or vanilla guilt for N days: certain arrest, a mild execution thought, no colony-wide banishment thought. Designed: [Warn and guilty](design.md#warn-and-guilty).
- **Subdue.** A capped fistfight that ends a break: torso and limbs only, never a bionic part, no catharsis for the offender, children never. Designed: [Subdue](design.md#subdue).
- **Jail and subdue then jail.** The arrest; serving the sentence is area 4. Designed: [Jail for N days](design.md#jail-for-n-days), [Subdue](design.md#subdue).
- **Reprimand.** -4 to -16 mood by severity for 3 days. Designed: [Reprimand](design.md#reprimand).
- **Banish and execute.** Always confirmed in a dialog, never automatic. Designed: [Banish and execute](design.md#banish-and-execute).
Step 2, subdue a pawn that fights back (needs step 1's subdue proven in play):
- **Subdue for aggressive breaks.** Only an enforcer with Melee at least the offender's goes; when nobody qualifies, a letter asks you to draft someone. Designed: [Subdue for aggressive breaks](design.md#subdue-for-aggressive-breaks).
## 4. Sentences
A sentence ends and the colonist comes back whole. Jail must not cost a long colony its bedrooms, roles and mechs.
Step 1, serve and come back (first release):
- **Serving the sentence.** Maintain only, so no prison mod recruits or enslaves the convict; a warden releases it when the time is served, with a fallback; another mod's early release closes the sentence instead of fighting it. Designed: [Jail for N days](design.md#jail-for-n-days).
- **Release gives back what jail took.** Bed, grave, throne, deathrest casket, ideoligion role, mech work modes and the weapon the arrest dropped. With it, role holders and mechanitors need no hold. Designed: [Release gives back what jail took](design.md#release-gives-back-what-jail-took). It joins the first release: a jail that takes the bedroom and the role for good is half a feature.
- **Pardon, early release, add days.** Designed: [Pardon, early release and longer sentences](design.md#pardon-early-release-and-longer-sentences).
Step 2, with the sibling mods (each part waits for its sibling or Fabian's answer):
- **Castes keeps the caste.** A convict returns to its own caste whatever the sentence length. Designed: [Castes keeps the caste](design.md#castes-keeps-the-caste). Needs Castes' join API (API version 2).
- **Jail for slaves.** A jailed slave is a slave again when the sentence ends. Designed: [Jail for slaves](design.md#jail-for-slaves). Needs Ideology and Fabian's yes, since it writes slave status.
- **Indenture as a sentence.** Serve N days as an indentured servant through Blax Slaves' indentured servitude. New, open question below. Needs Ideology, Slaves' indentured servitude and a SlavesApi call. Demand: players of Indentured Servitude asked to tie it to the guilty verdict (its comment page 2878184888, seen in search results; Steam rate-limited the page itself).
Idea: a life sentence until pardoned, as Prisoner Sentencing offers for prisoners.
## 5. Repeat offenders
Closed cases are pruned after 60 days and every offence is judged as the first, so a colonist who binges every season gets five days each time. New in this plan as a whole.
One step (needs the first release's cases):
- **Criminal record.** Convictions per pawn and law, kept after old cases are pruned, shown in the Cases tab and on the pawn. New. The court's repeat-conviction term reads it once it exists.
- **Escalation.** A row names what a repeat offence within N days gets: first a warning, then 5 days, then 10. New. No player request found; it brings the court's repeat rule to colonies that never convene a court.
- **Probation.** Release early on probation; a new case during probation brings back the remaining days. New. Demand: Prison Expanded (3.3k, 1.7) offers parole for prisoners, and nothing offers it for colonists.
## 6. Court
Grave cases get a trial instead of an automatic sentence, on the core game, with real roles.
Step 1, Ideology's trial as a punishment:
- **Trial.** A "Trial" punishment; with Ideology the leader's Accuse ability tries the case and the vanilla verdict closes it. Designed: [Trial through Ideology's ritual](design.md#trial-through-ideologys-ritual). Shows "Needs Ideology" without it until step 2.
Step 2, court sessions on the core game:
- **Court sessions.** Cases wait for trial, a ritual-style convene dialog with roles, place and the conviction chance, a session with speeches and a verdict letter, a verdict from evidence, Social skill and the judge's bias, and the sentence from the lawbook. The judge is appointed. Designed: [Cases go to trial](design.md#cases-go-to-trial) through [Verdict and sentence](design.md#verdict-and-sentence).
- **Court on its own.** Waiting cases convene at the court hour without a click (off by default). Designed: [Court on its own](design.md#court-on-its-own).
- **Remove Blax Laws from a game.** A button that ends sessions and offers to release Laws' convicts, since a running session can't survive a plain unsubscribe. Designed: [Remove Blax Laws from a game](design.md#remove-blax-laws-from-a-game).
Step 3, the people of a trial (needs sessions):
- **Attorneys.** Defence and prosecution argue with Social, gain XP and are remembered; a Kind judge cuts sentences, a cruel one adds to them. Designed: [Defence and prosecution](design.md#defence-and-prosecution).
- **Witnesses.** Colonists who saw the act testify and each adds evidence; an act nobody saw is harder to prove. New, from the Backlog. Demand: Rimworld Law and Order's trial odds weigh how many witnesses saw the crime. Hook: at filing, awake free colonists with line of sight to the act (`GenSight.LineOfSight`, in the reference assemblies). The spec decides how the verdict formula changes.
- **Guilty plea.** The accused pleads guilty for a shorter sentence and skips the session. New, from the Backlog.
Step 4, long trials (needs sessions):
- **Court days.** Serious and grave cases over 2 or 3 days, with custody between them. Designed: [Court days](design.md#court-days).
- **Courtrooms.** An impressive room around the court place softens the verdict. Designed: [Courtrooms](design.md#courtrooms).
- **Appeals.** A convict appeals once and is retried before another judge. New, from the Backlog. Demand: Rimworld Law and Order has no appeal at all.
Ideas: a titled noble presides (Royalty), trial by duel (Ideology), a judge's bench (needs art and a removal story), trials for guests and enemy prisoners, a RimCourt bridge with its pillory and lash, confessions and interrogation.
## 7. Colony votes
The colony has a say in who judges and in what the law is. All votes share one voting core.
Step 1, the voting core and the judge's office (needs court sessions):
- **Voting core.** Who votes, a ballot tab, a tally letter, an alert while a vote is open, "Aye" and "Nay" over the voters. Designed: [Voting core](design.md#voting-core).
- **Elected judge.** A 60-day term, by-elections, recalls and an acting judge when the judge is involved in the case. Designed: [Judge election](design.md#judge-election).
- **Leader or moral guide as judge.** Designed: [Ideoligion leader as judge](design.md#ideoligion-leader-as-judge). Needs Ideology.
Step 2, law votes:
- **Law votes.** Colonists propose and repeal laws and vote by traits, beliefs, opinion and mood; you back or veto the result. Designed: [Colony votes on the lawbook](design.md#colony-votes-on-the-lawbook).
Step 3, jury and petitions (needs court sessions and the voting core):
- **Jury.** The spectators vote the verdict through the voting core instead of the formula alone. New, from the Backlog. Demand: the older Jury Trial mod built a court with jury seats but no vote (seen in search results).
- **Pardon petitions.** A convict's friends petition and the colony votes on a pardon. New, from the Backlog.
Ideas: votes on punishments ("beating is cruel"), campaigning through vanilla deep talks, Royalty vote weight, a Castes right "may serve in court" (needs a CastesApi addition).
## Order
1. First release, the core loop: Lawbook step 1, Crimes step 1, Enforcement step 1 and Sentences step 1. None of them is useful alone: a book without enforcement does nothing, and a jail without the give-back takes bedrooms and roles for good.
2. Enforcement step 2. Berserk and rages are the breaks players fear most, and the fight needs the plain subdue proven first.
3. Court, steps 1 to 4. The court is what Fabian asked for after the lawbook; step 1 gives Ideology players a trial at once, and each later step needs the one before.
4. Colony votes, steps 1 to 3. They need court sessions; law votes and the jury reuse the voting core.
5. Repeat offenders, then Lawbook step 2, so the template file holds the escalation column.
6. As soon as they are unblocked: Crimes step 2 (prison break once Sentences step 1 exists, rebel slaves after Fabian's answer), Sentences step 2 (Castes' join API, Fabian's answers, Slaves' indentured servitude) and Crimes step 3 (after its spec and the precept check).
## Left out
- New crime events or extra mental breaks: Laws only watches.
- Torture and flogging, fines (colonists own no silver), work bans and a law-enforcement work type.
- House arrest and community service: allowed areas and work priorities are Castes'.
- Anything that puts our defs into vanilla save lists: incidents, letters, hediffs or memory thoughts for votes, court days or punishments.
Reasons for these and the rest: `design.md`, "Cut".
## Open questions for Fabian
1. Jail for slaves writes slave status back at the end of the sentence. Recommendation: yes, it only restores what the sentence took, and Blax Slaves' line in the shared ownership list already names the exception.
2. Indenture as a sentence through Blax Slaves. Recommendation: yes, once Slaves' indentured servitude exists, with Slaves owning the status and the term and Laws only handing over the convict and the days.