# 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: item 1 of "Order" is built as release 1.0.0 (`CHANGELOG.md`); the rest is design. Planned 2026-12-01 and reviewed against the decompiled game the same day. 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. - Which parts ship first is decided in "Order", not by the areas: a release can take part of a step. - 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 "), 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 when they are Laws' own convicts and break out. 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. A confinement sentence asks Castes for a timed caste (Castes' area 5, step 5). - Blax Slaves: slave status, suppression, rebellion and the slave economy. Laws records a rebellion as an act, leaves slaves in a non-violent break to Slaves' wardens while "Wardens calm breakdowns" is on (`SlavesApi.CalmsBreaks`), and 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, and punishing them when they break out, 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: - **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 " or "Missing: " and works again when it returns. Designed. Step 2, the book across saves and groups (needs step 1; castes need Castes' read-only API): - **Lawbook templates.** Save the book to a file and load it in another colony, with Blax Defaults' write, read-back and backup rules. The file carries a version number, so a column added later (escalation, "Applies to") loads into an older template with its default. 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. - **Applies to.** A row names whom it covers: everyone (default), free colonists, slaves, children, or a caste through `CastesApi.CasteIdOf`; a per-pawn exemption list ("above the law") sits in the component. On the same act a narrower group wins over a wider one. Rows saved before this step load as "everyone" and keep their keys unique, so no saved book changes. New. Demand: Castes' read-only API (version 1) already lists Laws' caste checks as waiting on it. 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: - **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. A hit that kills is murder; an assault victim who dies of its wounds later turns that case into manslaughter. Designed: [Violence](design.md#violence). - **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 "Add days" from Sentences step 1, and for rebel slaves jail for slaves): - **Prison break.** Laws' own convicts who break out are offenders for this one act; they get a warning, "Add days" or a confirmed execution. Other escapees stay with the prison mods. Designed: [Prison breaks and slave rebellions](design.md#prison-breaks-and-slave-rebellions). - **Slave rebellion.** Records who rebelled; the rebellion itself stays Slaves'. Designed: same section. Needs Ideology. Step 3, crimes against the faith (New; needs only step 1's recorded acts, and its spec first): - **Anything the colony's ideoligion forbids.** One group entry under recorded acts: an act whose history event a precept of the colony's primary ideoligion answers with a bad thought for the doer or for those who learn of it (`PreceptComp_SelfTookMemoryThought`, `PreceptComp_KnowsMemoryThought`) or with `PreceptComp_UnwillingToDo`. An option switches to the offender's own ideoligion. Laws caches the events per ideoligion and rebuilds the set when an ideoligion changes. Vanilla records meat eating as an event only for raw meat (Verse/Thing.cs:2055-2064); meals with meat reach the precepts through `FoodUtility.AddThoughtsFromIdeo` (RimWorld/FoodUtility.cs:968) and no event, so a vegetarian colony uses "Ate: any meat", which reads the food itself. 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. - **Left the colony's ideoligion.** A group entry on the `ChangedIdeo` event, which `Pawn_IdeoTracker.SetIdeo` records with the pawn as doer while the old ideoligion is still set (RimWorld/Pawn_IdeoTracker.cs:189-192), so hook H sees it and no new hook is needed. New, from the Backlog. Needs Ideology. 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: - **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, a berserk colonist included; one already sent is called back. 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 that isn't hostile to the colony, tantrums and murderous or sadistic rage included: 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; on a berserk pawn the jail waits until the break ends or you down it. 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). - **Talk down.** A planning punishment for breaks that aren't hostile: the enforcer walks over, and a Social roll against the offender's mood ends the break through `RecoverFromState`, with the catharsis setting applied. The spec decides what a failed try leads to. Laws owns calming colonists. Slaves follow the subdue rule: while Slaves' wardens calm breaks (step 2), Laws leaves the breaks they take to them, and otherwise talks slaves down like colonists. New. Demand: Snap Out! (1319782555, 636k, no 1.7) talks pawns out of breaks and has no 1.7 build. - **Decide myself.** A punishment that leaves the case waiting in the Cases tab with Warn, Guilty N days, Jail N days and Pardon buttons and an alert while it waits; any open or warned case also gets a "Sentence" button. New. Demand: Prisoner Sentencing (1.3k) and RimCourt (8.8k) are built on the player choosing per case. Step 2, with the sibling mods (needs Slaves' "Wardens calm breakdowns"): - **Slaves' wardens first.** While `SlavesApi.CalmsBreaks` is true, Laws doesn't subdue or talk down a slave in a break Slaves' wardens take (not `IsAggro`, not the rebellion) and leaves it to them. Tantrums, rages and slaughterers stay Laws', since the wardens skip them. Designed: [Subdue](design.md#subdue), "Works with the other Blax mods". Step 3, subdue a pawn that fights back (needs step 1's subdue proven in play): - **Subdue with a fighter you pick.** For a break hostile to the colony (berserk), never automatic: the case shows the best candidate by Melee, weapon and health, and "Subdue with " sends that pawn. The danger rule leaves this one offender out. New: [Subdue a pawn that fights back](design.md#subdue-a-pawn-that-fights-back) holds the outline. ## 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: - **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. Until the give-back ships, role holders and mechanitors wait with "Arrest now", because the arrest takes the role and shuts the mechs down. 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). - **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): - **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. While an indentured term runs (`SlavesApi.TermDaysLeft`), Laws doesn't jail and falls back to subdue or warn, until Slaves ships the member that keeps the term through a Laws sentence with its indentured servitude; with that member bound, Laws calls it right before the capture and jails as for any slave. Designed: [Jail for slaves](design.md#jail-for-slaves). Needs Ideology. - **Confinement for N days.** A sentence: Laws asks Castes to put the convict into a caste the player picks for sentences, with that caste's allowed area and work priorities, for the sentence's time, and the `blax.laws.released` reason returns it to its old caste. No bed, role or mech is lost. New. Built after Castes' join API, with the sentence caste Castes builds for it (its area 5, step 5). Ideas: a life sentence until pardoned, as Prisoner Sentencing offers for prisoners. Indenture as a sentence through Blax Slaves' indentured servitude, once that exists and a player asks: a slave has Warden, Hunting, Art and Research disabled and their priorities zeroed for good (Core Defs/WorkTypeDefs/WorkTypes.xml:85, 140, 280, 355; RimWorld/Pawn_WorkSettings.cs:195-205) and loses any ideoligion role (RimWorld/Precept_Role.cs:582-585), so it needs a plan for who gives those back, and a SlavesApi call to start a term. ## 5. Repeat offenders Closed cases are pruned after the "Keep closed cases" setting (60 days by default) 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. Step 1, the record (needs the first release's cases; probation also Sentences' early release): - **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 only the record, so the record comes before court sessions. - **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. Step 2, escalation (needs the record): - **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. ## 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 convene dialog of our own 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; when the judge is the accused, the victim or family of either, or is dead, jailed or away, the best uninvolved colonist acts as judge and the dialog says why. Designed: [Cases go to trial](design.md#cases-go-to-trial) through [Verdict and sentence](design.md#verdict-and-sentence). - **Jail, then trial.** The offender is arrested at once as for Jail, held on Maintain only and sent to court; a conviction gives the row's days minus the days served, an acquittal releases it. This is "jail and maybe court" for a binger who already took some. Designed: [Jail, then trial](design.md#jail-then-trial). - **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; an accused in custody from "Jail, then trial" stays there between the days. Designed: [Court days](design.md#court-days). - **Courtrooms.** An impressive room around the court place softens the verdict; no room role is added. Designed: [Courtrooms](design.md#courtrooms). - **Appeals.** A convict appeals once and is retried before another judge, picked by step 2's acting-judge rule. 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 what the law is and who judges. All votes share one voting core. Step 1, the voting core and law votes (needs the first release; pardon petitions also Pardon): - **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). - **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). - **Pardon petitions.** A convict's friends petition and the colony votes on a pardon. New, from the Backlog. Step 2, the judge's office (needs court sessions): - **Elected judge.** A 60-day term, by-elections and recalls; a judge involved in a case hands it over by Court step 2's acting-judge rule. 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 3, the jury (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). Ideas: votes on punishments ("beating is cruel"), campaigning through vanilla deep talks, Royalty vote weight, a Castes right "may serve in court" (a per-caste value Castes stores for sibling mods, CastesApi version 4, which Castes builds when the first sibling feature needs one). ## Order 1. First release, the smallest loop that stops a break and jails the one who did it: Lawbook step 1; from Crimes step 1 the seven categories with their groups, the special acts, the break links and no flood; from Enforcement step 1 enforcement, warn and guilty, subdue, jail and subdue then jail; from Sentences step 1 serving the sentence, with role holders and mechanitors held for "Arrest now". Fabian asked for a quick MVP, and none of these works without the others: a book without enforcement does nothing. 2. The other designed parts of the step 1s: Violence first, with its combat performance run, then slaughterers and drugs against the policy, reprimand, banish and execute, the give-back (which drops the hold) and pardon, early release and add days. 3. The criminal record (Repeat offenders step 1), then Court steps 1 and 2. The court is what Fabian asked for after the lawbook; step 1 gives Ideology players a trial at once, step 2 brings "Jail, then trial" for his binge example, and the court's repeat term reads the record. 4. Attorneys (Court step 3), law votes with the voting core (Colony votes step 1) and the elected judge (Colony votes step 2). Fabian asked for each; law votes need no court, the judge needs sessions. 5. Court days and courtrooms (Court step 4). 6. As soon as the sibling is there: "Castes keeps the caste" with Castes' join API (it lifts the 50-day cap), "Slaves' wardens first" with Slaves' "Wardens calm breakdowns", and jail for slaves, whose indentured slaves wait for the term member Slaves ships with its indentured servitude. 7. After that, the parts nobody asked for yet, each once its spec is written: decide myself, talk down, probation and escalation, lawbook templates and "Applies to", witnesses, the guilty plea, appeals, the jury, pardon petitions, uprisings, crimes against the faith, confinement (after Castes' join API), and subdue a pawn that fights back. ## 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 as Laws' own systems: allowed areas and work priorities are Castes', so "Confinement" (Sentences step 2) asks Castes instead. - 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". ## Decided 2026-12-01 1. **Jail for slaves writes slave status back** at the end of the sentence, and skips a slave serving an indentured term until Blax Slaves ships the member that keeps the term through a Laws sentence (with its indentured servitude), because it only restores what the sentence took, and without the member a short sentence would leave an indentured servant a slave for life. 2. **Confinement is a sentence** that puts the convict into a sentence caste for its time, built after Castes' join API, with the timed caste assignment Castes builds for it as its area 5, step 5, because allowed areas and work priorities are Castes'.