1173 lines
235 KiB
Markdown
1173 lines
235 KiB
Markdown
# 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. 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: the first release, 1.0.0, is built (`CHANGELOG.md`); the rest is design. 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-03, Fabian's request (a room or table as court; many punishments, possibly in named groups, with "Group beating", "Execution corps", "Excommunicate" and "Worse forced food policy" as examples from a full list; jail or any punishment should change the colonist, preferably for the better). Fabian's decisions are in `docs/features.md`, "Decided 2026-12-03":
|
|
|
|
- Court place (Court, step 2): a "Court place" switch on any building the player owns and a picker in the Laws tab, one per map, kept as a reference in the component, its room read when used. Courtrooms moved from Court step 4 to step 2.
|
|
- Punishment catalogue (Enforcement, step 4): a picker with groups, at most three options per entry, alongside entries and one visible "Instead" entry per row; new entries Shunned, Group beating, Execution corps, Excommunicate and Shaken faith; Apology and Public execution New. `PunishmentDef` and `Law` gain fields with defaults, so 1.0.0 saves load unchanged.
|
|
- Punishments in public (Enforcement, step 5): reprimand, beating, execution corps and apology at the court place, a crowd, witness thoughts and deterrence.
|
|
- Lose own bedroom and lose role (Sentences, step 1) on the give-back's snapshot. A pardon ends every timed punishment on a case and runs the give-back, a role lost "for good" included (Decided 2026-12-03, item 7). Sentence castes (Sentences, step 2) replace the single confinement caste, with new Castes members (Decided 2026-12-03, item 4).
|
|
- Reform (Repeat offenders, step 1): a mood thought, a stat part and a break-weight postfix for a while, and rarely one vanilla trait step away from the vice tied to the act.
|
|
- Tone: a capped group beating and vanilla gunfire are planned in, behind "Offer harsh punishments", which is on by default (Decided 2026-12-03, item 1); torture, maiming and torture furniture stay cut. Named punishments are New in Lawbook step 2.
|
|
- Fixed: `HarmedMe` is given at Verse/Pawn_HealthTracker.cs:383, not 379-382.
|
|
- Fabian accepted all nine recommendations on 2026-12-03 (`docs/features.md`, "Decided 2026-12-03"); the sibling doc changes are done on the siblings' main branches.
|
|
|
|
Changes on 2026-12-01, Fabian's decisions (`docs/features.md`, "Decided 2026-12-01"):
|
|
|
|
- Jail for slaves gives back slave status at the end of the sentence. Indentured slaves wait for the member Blax Slaves ships with its indentured servitude, which keeps the term running through a Laws sentence.
|
|
- Confinement for N days is a sentence: the convict sits in a sentence caste for its time. Built after Castes' join API, with the sentence caste Castes builds as its area 5, step 5.
|
|
- The ownership list drops its open-question marks: Castes keeps the slave interaction mode a new slave starts on and the per-caste values sibling mods register (a Castes right "may serve in court" would be one), Zones' line reads "per-cell work and path rules", and Laws puts a slave it jailed back into slavery.
|
|
|
|
Changes on 2026-12-01, the five Blax plans checked against each other:
|
|
|
|
- The ownership list is the same in all five design docs; parts that wait on an open question name it. The sibling doc changes are done on the siblings' plan branches.
|
|
- Castes' planned `CapturedBy` scope keeps arrests in the new-prisoner row, so an unhinted arrest never lands in the captured row. A jailed slave made a slave again gets the `blax.laws.released` hint too.
|
|
- "Slaves' wardens first" and talk down stand down only for the breaks Slaves' wardens take (not `IsAggro`, not the rebellion); tantrums and rages stay Laws'. The indentured term hint is Slaves' open question 3, and confinement's sentence caste is Castes' area 5, step 5.
|
|
|
|
Changes on 2026-12-01, plan review (the feature plan checked against the decompiled 1.7 code):
|
|
|
|
- First release cut back to the quick MVP Fabian asked for: the lawbook, the catalogue with its breaks and special acts, warn, guilty, subdue, jail and serving the sentence with the hold for role holders and mechanitors. Violence, slaughterers, drugs against the policy, reprimand, banish and execute, the give-back and pardon follow as the next release. The areas stay as they were; `docs/features.md` "Order" says which part ships when.
|
|
- Breaks: the line is now a state hostile to the colony (`MentalState.ForceHostileTo(Faction.OfPlayer)`, only berserk-type states in vanilla), not `IsAggro`. Tantrums, murderous and sadistic rage and slaughterers can be arrested (Verse.AI/GenAI.cs:83) and get every break punishment, Subdue included. A berserk case takes Warn, Guilty or Jail, and the jail waits until the break ends or the pawn is down. "Subdue for aggressive breaks" became "Subdue a pawn that fights back": never automatic, the player picks the fighter.
|
|
- One act, one case keeps the break case, but when the act also matches a row of its own (a murder during a murderous rage), the row with the higher severity decides.
|
|
- Violence: melee hits carry no intended target, so friendly fire is only a hit whose intended target is set and isn't the victim; a death without an attacker (bleeding out, infection) turns the victim's recent assault case into manslaughter.
|
|
- Hooks: bills are caught by a postfix on `RecordsUtility.Notify_BillDone`, not the empty, inlinable `Bill.Notify_IterationCompleted`; `CompUsable.UsedBy` files only for a pawn using the item on its own job; Ate counts a drink at a gathering spot.
|
|
- Court: our own convene window, since `Dialog_BeginLordJob` needs an installed DLC; judge and speakers stand on `ArriveToCell`, since Core's GiveSpeech duty needs a throne; courtrooms read impressiveness instead of adding a room role; custody sets guilt for the arrest and clears it at the capture; new punishment "Jail, then trial"; an acting judge from court sessions on; the repeat term reads the criminal record.
|
|
- Plan: colony votes start with the voting core and law votes, which need no court; the criminal record comes before court sessions; prison breaks cover only Laws' own convicts; jail for slaves skips indentured slaves; crimes against the faith read the colony's ideoligion and every precept comp with a bad thought, and apostasy is the `ChangedIdeo` event. New: "Applies to", talk down, decide myself, Slaves' wardens first, confinement through Castes. Indenture as a sentence moved to the ideas.
|
|
|
|
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"):
|
|
|
|
- A law's Action is now an entry of the act catalogue: seven categories built from the loaded defs when the game starts (mental breaks, ate, used, social interactions, recorded acts, records, bills) plus a short list of special acts that need their own hook (set a fire, displayed a corpse, started a social fight). Each category also offers group entries (any drug, hard drugs, human meat, any surgery and so on). DLC and modded defs show up with no patch, labelled with the mod they come from.
|
|
- The six crimes are gone as a type. Their detection stays and now serves the categories; the old crimes are starter lawbook rows and links between a break and its act.
|
|
- "Did it" for a break comes from a link table by mental state class: a dose during a drug binge, a meal during a food binge, a fire during a fire-starting spree, a displayed corpse during a corpse obsession, an insult during an insulting spree, a jailbreak talk during a jailbreaker break. A modded break that reuses a vanilla class gets its link too. Every other break offers Planning only until a later release links it.
|
|
- Aggressive breaks (berserk, murderous rage and the rest with `IsAggro`) are in the catalogue from 1.0 but offer Warn and Guilty only: subdue would walk an unarmed warden into a pawn that fights back, and vanilla refuses to arrest them. (Corrected by the plan review above: vanilla refuses the arrest only for states hostile to the arrester, berserk in vanilla.)
|
|
- One act, one case: an act that is the did-it of an open break case belongs to that case; otherwise each category's most specific enabled row decides. Rows of different categories that can catch the same act get an overlap hint in the editor.
|
|
- New hooks: `Pawn_RecordsTracker.Increment` and `AddTo`, `HistoryEventsManager.RecordEvent`, `Notify_IterationCompleted` on the bill classes, `CompUsable.UsedBy`. Hook D (`CompDrug.PostIngested`) is dropped, since hook C sees every dose.
|
|
- Plan: 1.0 takes 12 days instead of 10 (the picker and the category workers). 1.8 shrinks from 3 days to 2: food binges, jailbreakers, desertion and slaughterers are breaks in the 1.0 catalogue. The plan is 50 days.
|
|
- Defaults to confirm: one entry per row rather than a set of ticked entries (the most-specific rule needs one entry per row), and no subdue for aggressive breaks before 1.2.
|
|
|
|
Changes on 2026-11-30, after three reviews:
|
|
|
|
- Plan re-cut: 1.0 takes 10 days instead of 7, because the enforcement core, the case lifecycle, the capture hook and the scaffold now have a budget. 1.0 still ships whole: cutting it to the wake-up example would save one day. The violent crimes stay in 1.2, right before the court; the other new crimes move behind the votes as 1.8, so Fabian's court, judge, attorneys and votes come first. 1.3 gains "Convene court on its own" at a court hour. The plan is 49 days instead of 44.
|
|
- Fixed what would have broken the save promise: the subdue job is no longer suspendable, so a vomit or a forced wait can't push it into the saved job queue, and the save prefix pulls it from the queue as a backstop.
|
|
- Enforcement made safe for permadeath: the enforcer is never pulled off a rescue, a tending, a fire, a turret, a surgery or a flight, and nothing is enforced while hostiles threaten the map. Arrests check their reservations first. Subdue hands over to the vanilla capture through the job queue the moment the target goes down.
|
|
- Jail fixed against the game: the arrest job itself takes the colonist's bed, so Laws snapshots it before the job and gives it back when the arrest fails; guilt is renewed right before every arrest and the sentence counts from the capture; a hook on `CapturedBy` (and in 1.1 on `GenGuest.PrisonerRelease`) replaces "one tick after the capture", which nothing could detect; "Maintain only" lands two ticks after the capture, after any next-tick default from Castes or a prison mod.
|
|
- Subdue made reliable: hits are timed by game ticks (the toil runs on a tick interval), bionic parts are skipped, damage is scaled for Tough pawns, and the job stops once three hits in a row add no pain instead of after a fixed 20.
|
|
- Rules the lawbook lacked: one enforcement per case, a later stage's punishment replaces an unfinished earlier one; Action, Option and Stage are a row's key and the most specific row wins; the cooldown covers every act outside a break, meat included; a row spec says which punishments and days each crime and stage offers.
|
|
- Vanilla behaviour corrected: executing a guilty colonist still costs the -2 "justified execution" thought and its family's grief; corpse obsession nearly always digs the corpse up, read from the corpse, not from the job.
|
|
- Court and votes: the verdict weighs only what the case records (no witnesses, no "found later"); law votes watch acts in a tally-only mode so proposals after an unlawed act can fire.
|
|
- Matched with Blax Castes: Laws always writes Maintain only and Release for its convicts, Castes 1.4 skips hinted pawns, a jailed colonist goes to the new-prisoner row, never the captured row, and the shared ownership lines gain the same exceptions in all five docs.
|
|
|
|
Changes on 2026-11-30, first design:
|
|
|
|
- Built from Fabian's request of 2026-11-30 and six research passes: crimes, punishments, court, votes, the Workshop landscape and the Blax conventions. Every game behaviour the design relies on was checked again in the decompiled 1.7 code and cites file:line. Code paths are relative to the decompiled Assembly-CSharp, XML paths to the game's Data folder. Anomaly and Odyssey aren't installed here, so their parts are read from code only.
|
|
- 1.0 is the quick MVP: lawbook, six crimes, subdue and jail, in 7 days. No court in 1.0. Each later release ships on its own.
|
|
- Stages are what the code can tell. "Planning" means the mental break has started and nothing is done yet, so it exists only for crimes that start as a break. The game rolls the break type at the moment the break starts (Verse.AI/MentalBreaker.cs:311-328); before that it only knows that some break is close, never which one.
|
|
- Nothing of Laws enters a vanilla save list, the subdue job included: it is hidden from the save while it runs (see "Data model").
|
|
- The court doesn't reuse the vanilla Ideology trial as its engine: there the leader is always judge and prosecutor, nobody defends, crowd size decides and core-only games have none. Laws runs its own court on core classes and listens to the vanilla trial when Ideology is active.
|
|
|
|
## At a glance
|
|
|
|
What the mod covers, by area. Which area and step comes first, and why: `docs/features.md`.
|
|
|
|
| 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, laws for one group of pawns, punishments saved under your own name | None (castes: Blax Castes) | 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 by Laws' own convicts 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: talk down, decide myself, Slaves' wardens first for slaves, subdue a pawn that fights back, a full punishment catalogue in a picker with options, alongside entries and an "Instead" per row: shunned, group beating, execution corps, excommunicate, shaken faith, apology, public execution, each in private or at the court place before a crowd | None (children never beaten: Biotech; excommunicate, shaken faith, public execution: Ideology) | Beat Your Prisoners (18.2k) for colonists, Execution Mod's (2.6k, no 1.7) public executions and its years of firing-squad requests |
|
|
| 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. Lose own bedroom, lose role. Later, with the sibling mods: Blax Castes keeps the caste, jail for slaves, sentence castes through Blax Castes (bread and water, hard labour, no recreation, dry, rags, confinement) | None (role: Ideology; throne: Royalty; casket, mechs: Biotech; slaves: Ideology; sentence castes: Blax Castes) | Custom Guilt Duration for colonists (3.4k, no 1.7), Guilty! (302, 1.6) |
|
|
| Repeat offenders | A criminal record per pawn, reform (a better mood, a steadier mind and now and then one vice less after a served punishment), escalating punishments for repeat offences, probation | None (traits from genes are skipped: Biotech) | None; parole like Prison Expanded's (3.3k) for colonists; the rehabilitation Law and Order's players ask for |
|
|
| Court | "Trial" as a punishment through Ideology's trial. A court place set on any table, spot or throne, its room outlined. Court sessions on the core game: an appointed judge, a prosecutor and spectators at the court place, a verdict that weighs evidence against Social skill, the sentence from the lawbook, "Jail, then trial", an acting judge, a court hour, courtrooms, a removal button. Attorneys, witnesses and a guilty plea. Trials over 1 to 3 days, appeals | None (Ideology's trial: Ideology) | The vanilla trial as the only court (Ideology), Law and Order's trials |
|
|
| Colony votes | A voting core, law votes with back and veto, pardon petitions, an elected judge with terms, by-elections and recalls (or the leader or moral guide with Ideology), a jury | None (leader as judge, precept stances: Ideology) | None; overlaps Rimocracy (6.3k), which elects leaders and votes on its decisions |
|
|
|
|
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, M, L) compare sizes only; they decide nothing about grouping.
|
|
|
|
## Defaults I picked
|
|
|
|
Change if you disagree.
|
|
|
|
- Name: Blax Laws, subtitle "Lawbook, crimes and punishments". It keeps the one-word plural of Slaves, Castes, Zones and Defaults, and says what the player edits: a book of laws. "Court" names one later feature, "Justice" and "Legislation" are abstract nouns that break the plural pattern, and "Law" alone sits next to "Law and Order" on the Workshop. Mods folder `BlaxLaws`, Forgejo repo `rimworld-blax-laws` when you create it.
|
|
- The lawbook starts empty, in new games and in saves the mod is added to. Until a row exists Laws detects nothing and punishes nothing (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.
|
|
- One catalogue entry per row. An entry is a single def (Insult, Wake-up, the fire-starting spree) or a group (any drug binge, hard drugs, human meat, any surgery). A row that ticks several entries, like a bill's ingredient filter, would make "the most specific row wins" ambiguous, so a player who wants three drugs adds three rows or picks a group.
|
|
- Action, Option and Stage together are a row's key: the editor refuses a second row with the same three and jumps to the existing one. Option exists only for drug binges (which drug counts as "did it": any, hard, social or one chemical). When several enabled rows of one category match an act, the most specific wins: a single def over a group over the category's "any"; for binges one chemical over hard or social drugs over any drug. The starter rows plus "drug binge, wake-up, did it, jail 10 days" give a wake-up binger one case and 10 days.
|
|
- Stages: "Planning" (the break has started, nothing done yet) and "Did it". Only break entries have Planning, since the game decides the break type at the moment the break starts and never earlier. A break has "Did it" only when the link table names its act (see "Act catalogue and detection"); every other entry is "Did it" only. No guessing from mood or traits.
|
|
- Severity is Minor, Moderate, Serious or Grave. It sets the default days (1, 3, 5, 10), orders the case log and 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: the first release has Warn, Guilty for N days, Subdue, Jail for N days and Subdue then jail; Reprimand, Banish and Execute come in the next release, Trial and "Jail, then trial" with the court. Which entry and stage offers which: the table in "Lawbook tab". 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.
|
|
- From Enforcement step 4 the Punishment cell opens a picker over the whole catalogue. A row's "Instead" entry is Warn, "Offer harsh punishments" (group beating, execution corps) is on (Decided 2026-12-03, item 1), and every public entry starts "in private".
|
|
- Group beating's "How many" is "everyone able", at most 4 beaters at once, because Fabian wrote "each colonist may beat" (Decided 2026-12-03, item 9). The beating goes on until the convict is down, not truly unconscious (Decided 2026-12-03, item 8).
|
|
- Pardon ends every timed punishment on the case and runs the give-back, a role taken "for good" included (Decided 2026-12-03, item 7).
|
|
- No court place until you set one. The convene dialog and "Court on its own" fall back to the last place used.
|
|
- "Reform" is set to "Temporary effects and traits" (Decided 2026-12-03, item 5); "Temporary effects only" and "Off" are the other choices.
|
|
- Execution corps: a convict struck but alive walks free and is tended, because the volley was the sentence and Fabian said "if they miss, he may be freed". "A warden finishes it" is a row option. A convict every shot missed always walks free. The squad defaults to 1 shooter at 8 cells, so walking free is a real chance, not a rare one.
|
|
- Kind pawns are never picked as beaters or shooters, rather than picked with a mood cost; kin, spouses and lovers of the convict are never picked either.
|
|
- Spectators of a public punishment are deterred: for 10 days the break the convict was punished for is half as likely for them, through the same postfix as reform, read only when a break is rolled. It is the deterrence players asked Law and Order for and gives the court place a reason to be used.
|
|
- Breaks hostile to the colony (the live state's `ForceHostileTo(Faction.OfPlayer)` is true: berserk and berserk warcall in vanilla, Verse.AI/MentalState_Berserk.cs:12-15) offer Warn, Guilty and Jail, never Subdue: the pawn fights back, and vanilla refuses to arrest it (Verse.AI/GenAI.cs:83). Its Jail waits until the break ends or you down it, then arrests or captures it; guilt makes both certain (Verse.AI/GenAI.cs:59-66). Every other break, the aggressive ones included (tantrums, murderous and sadistic rage, slaughterer: `IsAggro` but arrestable and never aimed at the enforcer), offers the full break list. "Subdue a pawn that fights back" (Enforcement, step 3) adds a subdue for hostile breaks that the player starts.
|
|
- 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. When the act also matches a row of its own (a murder during a murderous rage, a dose under "Ate: wake-up"), the case carries out the row with the higher severity, the break's row on a tie, so a "Murder: jail 10 days, Grave" row still applies to the most common colony murder. 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.
|
|
- 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 (Laws' own convicts only for a prison break, Crimes step 2) 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.
|
|
- 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.
|
|
- Laws starts the enforcer's job at once, interrupting what it does. Law enforcement is urgent; a binge's first dose comes as soon as the pawn reaches a drug, and the binge goes for the closest drug on the map (RimWorld/JobGiver_Binge.cs:17; RimWorld/JobGiver_BingeDrug.cs:83). The one exception is danger: while hostiles threaten the map, nobody is sent, a job already running is called off, the case waits and the sweep retries after the fight. A colonist in a berserk break counts as such a threat, so cases on its map wait until it ends or is downed.
|
|
- 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.
|
|
- 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 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. The first release ships with this hold; with the give-back on (the next 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.
|
|
- "Enforce laws" switched off keeps the case log running and carries out nothing.
|
|
- Laws adds no crime events and no mental breaks. It only watches what the game does anyway; Law and Order was called useless after its crime events flooded a commitment save.
|
|
- The catalogue shows every entry the loaded game has, Royalty's psytrainers and a modded drug included, each labelled with its mod. Entries that make little sense as crimes (eating a simple meal, chitchat) stay in: the list is the game's, the lawbook is yours.
|
|
- The court convenes when you press "Convene court", 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.
|
|
|
|
Everything below is for the modder building it.
|
|
|
|
## Data model
|
|
|
|
Three parts carry everything: the component, the defs and the hooks. Enforcement and the subdue job sit on top of them.
|
|
|
|
### Lawbook and cases in one GameComponent
|
|
|
|
All state lives in one `GameComponent_BlaxLaws`. Laws are colony policy across every map, caravan and world pawn, so a MapComponent would be the wrong place.
|
|
|
|
- Saved:
|
|
- `List<Law> laws` (deep) and `nextLawId`. A `Law` holds only names and numbers: id, act key (category plus defName or group id, such as `Ate/WakeUp`, `Ate/@humanMeat`, `Break/FireStartingSpree`, `Special/SetFire`), the entry's label and source mod as they read when the row was written, option (a chemical defName or a drug group, binges only), stage and severity as enum names, punishment defName, days, enabled.
|
|
- `List<Case> cases` (deep) and `nextCaseId`. A `Case` holds the offender (pawn reference plus name and ThingID), the victim (same), the law's act key and the defName that matched it (which drug, which recipe), mental state defName for planning cases, stage reached, count, note flags, open tick, status (Open, Enforcing, Jailed, Closed), outcome key, enforcer reference (one enforcement at a time), which stages' punishments ran, the last act tick (shown in the log; the cooldown counts from the open tick), and for jail the capture tick, whether the Maintain only write is done, the release tick, the bed the pawn owned before the arrest job and whether "Arrest now" lifted the hold.
|
|
- A random int token for ids handed to other mods later, as Castes does.
|
|
- From the 2026-12-03 parts, each a new Scribe field with a default, so a save written before them loads unchanged:
|
|
- On `Law`: `punishmentOptions` (one string, `key=value;...`, empty means the entry's defaults), `alongside` (a list of PunishmentDef defNames), `instead` (a PunishmentDef defName, default `Warn`) and `where` (`Private` or `CourtPlace`, default `Private`). From Lawbook step 2 `punishment` may also hold `Named/<id>`.
|
|
- In the component: the court place per map as `Scribe_References` on the building (see "Court place"), the punishment runs that wait for the court hour, and the reform state: per pawn the expiry ticks of "Paid my debt", the stat part and the break-weight effect, the break def it halves, and the tick of the last trait step.
|
|
- On `Case`: the participants of a group punishment (references plus names), the squad result (struck, spared), the reform roll and its outcome, the snapshot fields of "Lose own bedroom and lose role" (shared with the give-back) and the end tick of a timed status punishment.
|
|
- Pawn references: Castes' pattern. `Scribe_References` with `logNullErrors` off; on save and after load, references to Discarded or destroyed pawns become null and the case keeps the name. Closed cases older than the retention setting (60 days) are pruned on save.
|
|
- Not saved: the watched-act flags and sets, the act catalogue and the enforcement queue (all rebuilt), the instance cache (a weak reference, as in Castes).
|
|
- `Game.FillComponents` adds the component to a new game and after loading (Verse/Game.cs:345, 443-446, 472-489), so a save made without Laws loads with an empty book.
|
|
- Plain unsubscribe: the component node loads as null with exactly 2 errors, "Could not find class BlaxLaws.GameComponent_BlaxLaws" and "SaveableFromNode exception: Can't load abstract class Verse.GameComponent", and `FillComponents` removes the null (Verse/Game.cs:474). Laws, cases and sentences go with it. Guilt is vanilla (RimWorld/Pawn_GuiltTracker.cs:40-44) and runs out on its own. A jailed colonist stays a vanilla prisoner of the colony; release it by hand in the prisoner tab.
|
|
|
|
### 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 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 and StartedSocialFight in the first release, the violent acts and the slaughterer's kill with "Violence" and "Slaughterers", 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`; from Enforcement step 4 it also names its picker `group`, what it `needs` (a DLC or a sibling), whether it is `harsh`, whether it always asks to `confirm`, whether it `canBePublic`, its `harshness` (1 to 4, set against Minor to Grave), its `reformBase` odds and its options (at most three, each a number range or a short list). 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.
|
|
- The save names entries only as strings: the act key, resolved through the catalogue. A row whose entry is missing (a DLC drug without its DLC, a removed mod's interaction) stays in the book with its saved label and mod, shows "Needs <DLC>" or "Missing: <mod>" and isn't enforced. It works again when the mod comes back.
|
|
- The lawbook UI reads the stage list from the entry, so an entry without a planning stage never offers one.
|
|
- Our defs never enter a vanilla save list. Laws adds no HediffDef, no memory ThoughtDef, no PrisonerInteractionModeDef, no HistoryEventDef, WorkTypeDef or RecordDef (vanilla keeps those in a `DefMap` saved by index, Verse/DefMap.cs:52-66), no IncidentDef, no Letter subclass and no LetterDef. The one JobDef (subdue) is hidden from the save. The Laws tab's MainButtonDef is never saved.
|
|
|
|
### Detection: one postfix per act, quiet while the book is empty
|
|
|
|
- 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.
|
|
- 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.
|
|
- 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 state another pawn's ability forced on the pawn (otherPawn set and not the pawn: a psycast, Neuroquake; only abilities and the social fight pass one, RimWorld/CompAbilityEffect_GiveMentalState.cs:59, RimWorld/Pawn_InteractionsTracker.cs:379-380) files nothing. For a self-cast state (Berserk trance) a prefix reads the player order before vanilla undrafts the pawn and stops its job (:141-144, :165-172).
|
|
- C. `Thing.Ingested` (Verse/Thing.cs:2005), prefix and postfix. Called once per meal from `Toils_Ingest` (RimWorld/Toils_Ingest.cs:428), and from doctors and caravans. Ate category, and every binge dose (it reaches `CompDrug.PostIngested` through `ThingWithComps.PostIngested`, Verse/ThingWithComps.cs:767-774, so the old hook D is gone).
|
|
- E. `Pawn_InteractionsTracker.TryInteractWith` (RimWorld/Pawn_InteractionsTracker.cs:176), about 90 lines, returns true at :268. Interaction category.
|
|
- F. `Pawn_InteractionsTracker.StartSocialFight` (RimWorld/Pawn_InteractionsTracker.cs:373): a message, two 9-argument `TryStartMentalState` calls and a tale. Special act StartedSocialFight.
|
|
- I. `Verb_Ignite.TryCastShot` (RimWorld/Verb_Ignite.cs:12), a protected override reached only through the virtual verb call. Special act SetFire.
|
|
- J. `MentalState_CorpseObsession.MentalStateTick` (Verse.AI/MentalState_CorpseObsession.cs:18), a virtual override that runs only for obsessed pawns. Special act DisplayedCorpse.
|
|
- U. `CompUsable.UsedBy(Pawn p)`, public virtual, prefix and postfix (RimWorld/CompUsable.cs:161). Used category. It runs from `JobDriver_UseItem` (RimWorld/JobDriver_UseItem.cs:95-96), from `IngestionOutcomeDoer_UseThing` (RimWorld/IngestionOutcomeDoer_UseThing.cs:10) and on the patient of a doctor's `Recipe_AdministerUsableItem` (RimWorld/Recipe_AdministerUsableItem.cs:15, Core's AdministerMechSerumHealer, Defs/ThingDefs_Items/Items_Exotic.xml:102). It returns without any effect when `CanBeUsedBy` fails (RimWorld/CompUsable.cs:163-166), so the prefix stores `CanBeUsedBy(p, false, true).Accepted` in `__state` and the postfix files only when it was true and one of `p`'s own current job targets is the used thing; a patient lying in bed is never the user. Patched on `CompUsable` and on every subclass that overrides it, found by reflection at startup (in the game code only `CompUseableDatacore`, which calls base, RimWorld/CompUseableDatacore.cs:30), with a per-call depth guard so an override that calls base files once.
|
|
- H. `HistoryEventsManager.RecordEvent(HistoryEvent, bool)`. Recorded-act category; the offender is the event's `HistoryEventArgsNames.Doer` (`args.TryGetArg<Pawn>`), an event without a doer opens nothing. Most of these events are recorded only with Ideology active (see "To verify").
|
|
- R. `Pawn_RecordsTracker.Increment(RecordDef)` and `AddTo(RecordDef, float)`. Record category; the offender is the tracker's `pawn`. `Time` records are not in the catalogue: they count up on their own every 80 ticks (`RecordsTickInterval`), and if that runs through `AddTo`, the set lookup drops them. Both methods are short; if the decompiled code shows a body small enough for the JIT to inline (see "To verify"), the record category polls instead: every 250 ticks it compares the watched records of free colonists with the last values, unsaved, and loses only the player-order exemption.
|
|
- B. `RecordsUtility.Notify_BillDone(Pawn billDoer, List<Thing> products)` (RimWorld/RecordsUtility.cs:52), static, two nested loops, not inlinable. Bill category; the offender is `billDoer`, the recipe `billDoer.CurJob?.RecipeDef` (a null files nothing). `Toils_Recipe.FinishRecipeAndStartStoringProduct` calls it right after `bill.Notify_IterationCompleted` for every bill type, surgery and Biotech's mech gestators included, always with the pawn that finished the bill (Verse.AI/Toils_Recipe.cs:197-200), and nothing else calls `Notify_IterationCompleted`. That method itself isn't patched: `Bill`'s version is empty (RimWorld/Bill.cs:278-280) and `Bill_Medical` calls it as a non-virtual base call the JIT may inline (RimWorld/Bill_Medical.cs:129).
|
|
- Two more hooks serve the jail, not detection (see "Enforcement runs a tick later"): K on `Pawn_GuestTracker.CapturedBy` and L on `GenGuest.PrisonerRelease`.
|
|
- Hooks of the 2026-12-03 parts, each behind its own static flag, so they cost one field read while no court place, punishment run or reform effect exists:
|
|
- P. `Building.GetGizmos` (Verse/Building.cs:401), postfix wrapping the iterator: the "Court place" switch ("Court place").
|
|
- T. `PawnDiedOrDownedThoughtsUtility.GetThoughts` (RimWorld/PawnDiedOrDownedThoughtsUtility.cs:73), postfix: strips the death thoughts for a convict the execution corps killed ("Execution corps").
|
|
- W. `MentalBreakWorker.CommonalityFor` (Verse.AI/MentalBreakWorker.cs:11), postfix: halves the weight of a punished or witnessed break ("Reform", "Punishments in public").
|
|
- V. `RestUtility.IsValidBedFor` (RimWorld/RestUtility.cs:160), postfix: refuses a bedroom bed to a convict who lost its bedroom ("Lose own bedroom and lose role").
|
|
- A `StatPart` added to `StatDefOf.MentalBreakThreshold.parts` at startup (RimWorld/StatDef.cs:140; RimWorld/StatPart.cs:7-16; RimWorld/StatDefOf.cs:52), never saved ("Reform").
|
|
- 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` holds a queue of (case, stage) entries. The component's `GameComponentTick` drains it on the tick after a hook filled it, so nothing acts inside a status change, an ingestion or an interaction, as Castes defers its work. The "Maintain only" write waits one tick more (see "Jail for N days").
|
|
- Every 250 ticks a sweep walks the open cases only (a handful at a time): closes planning cases whose break ended, re-issues lost subdue jobs, retries arrests that waited for a bed, an enforcer or the end of a fight, and gives the old bed back when an arrest or capture job ended without a prisoner. Every 2500 ticks it checks sentences. Nothing scans all pawns.
|
|
- 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. A subdue, arrest or queued capture that is already running when danger comes is called off by the next 250-tick sweep (`SubdueFlow.CallOffInDanger`, `JailFlow.CallOffInDanger`), and the case waits the same way. Laws' jobs are player-forced, so vanilla would never pull the enforcer off them when it is hit (Verse.AI/Pawn_JobTracker.cs:982) or let its hostility response take over (RimWorld/PawnUtility.cs:377-385). An arrest whose enforcer already carries the offender finishes: the carry has made it a prisoner (RimWorld/JobDriver_TakeToBed.cs:121-129). A berserk colonist is hostile to the player faction (`MentalState_Berserk.ForceHostileTo(Faction)` returns true, Verse.AI/MentalState_Berserk.cs:12-15; RimWorld/GenHostility.cs:128-133), enters the attack target cache when the break starts (Verse.AI/MentalStateHandler.cs:175) and passes `IsPotentialThreat` (RimWorld/GenHostility.cs:266-308), so it counts as danger for as long as it rages. That is wanted: a Jail row on a berserk offender waits until the break ends or the pawn is downed, and other cases on that map wait as for a raid. Only "Subdue a pawn that fights back" (Enforcement, step 3) leaves its own offender out of the check and out of the call-off.
|
|
- 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. 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, 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
|
|
|
|
- Subdue needs its own JobDef and driver (`BlaxLaws_Subdue`, `JobDriver_Subdue`). A saved job with a missing JobDef would break the enforcer after removal: `Job.ExposeData` saves the def (Verse.AI/Job.cs:505), the driver class goes missing, `Pawn_JobTracker.ExposeData` then calls `EndCurrentJob` (Verse.AI/Pawn_JobTracker.cs:105-109), which reads `curJob.def.collideWithPawns` (:433) on a job whose def is null. The pawn would keep a job with no driver and never start another (:131-133, 197-203).
|
|
- So the job never reaches the file. A prefix on the virtual `Pawn_JobTracker.ExposeData` (Verse.AI/Pawn_JobTracker.cs:90), only while `Scribe.mode == Saving` and only when `curJob.def` is ours, hides `curJob` and `curDriver` from the scribe, and a finalizer puts them back even if saving throws. Zones uses the same prefix-and-finalizer pattern for its zone list.
|
|
- The job never waits in the job queue, which is deep-saved (Verse.AI/Pawn_JobTracker.cs:94; Verse.AI/QueuedJob.cs:37). Vanilla interrupts that resume the current job afterwards would put it there through `SuspendCurrentJob` (:293-296, 408-411): vomiting (Verse/Hediff.cs:480), `PawnUtility.ForceWait` (RimWorld/PawnUtility.cs:314), disorientation (Verse/HediffComp_Disorientation.cs:25) and `HediffComp_ReactOnDamage` (:31). So `BlaxLaws_Subdue` sets `<suspendable>false</suspendable>` (default true, Verse/JobDef.cs:24) and keeps `allowOpportunisticPrefix` false (:28; Verse.AI/Pawn_JobTracker.cs:655). An interrupt then ends the job instead of queueing it (:297-299, 415), disorientation skips it outright (it checks `CurJobDef.suspendable`, Verse/HediffComp_Disorientation.cs:15), and the sweep re-issues the subdue. As a backstop the save prefix also pulls `jobQueue` entries whose def is ours, and the finalizer puts them back.
|
|
- The job reserves nothing: `TryMakePreToilReservations` returns true without a reservation, so no reservation list refers to it (vanilla saves job references in `ReservationManager.cs:57`, `AttackTargetReservationManager.cs:20`, `PawnDestinationReservationManager.cs:25` and `PhysicalInteractionReservationManager.cs:20`).
|
|
- After loading, the enforcer just picks a new job. The case still says "subdue in progress", and the sweep starts a new subdue within 250 ticks if the offender is still in its break.
|
|
- Result: Laws' only save footprint is the component node. Phase 3 asserts exactly 2 errors.
|
|
|
|
### Rules every feature follows
|
|
|
|
- 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.
|
|
- 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 (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.
|
|
- Never prefix a method of a few lines that the JIT may inline.
|
|
- A punishment that holds a convict or gathers pawns calls itself off on danger (the rule in "Enforcement runs a tick later"), a break, a drafted or downed participant, a held convict whose vanilla wait job ended, or a court place that fails its `Spawned`, `Faction` or `Destroyed` check while a public run uses it (checked in the lord toil's update): the case stays open, the sweep retries, and nothing of Laws stays on any pawn. Every vanilla wait job Laws starts to hold a convict or a squad (`Wait_MaintainPosture`, `Wait`) has `expiryInterval` 600 with `checkOverrideOnExpire` (Verse.AI/Job.cs:33, 35) and is issued again while the run is live, because `JobDriver_Wait`'s toil never completes on its own (Verse.AI/JobDriver_Wait.cs:54) and a forced job is not re-thought on damage (Verse.AI/Pawn_JobTracker.cs:982). A wait job saved mid-run then ends by itself within 600 ticks after a plain unsubscribe, and with Laws loaded the component's `LoadedGame` (Verse/GameComponent.cs:31) ends the wait jobs of the pawns named in a run the load called off. Children, and with Biotech convicts carrying `HediffDefOf.PregnantHuman` (RimWorld/HediffDefOf.cs:123), are never beaten or shot; quest lodgers and quest helpers (RimWorld/QuestUtility.cs:524, 533) are never convicts of a body, status or death punishment, and slaves, children, pacifists and pawns in a break never take part; the row's "Instead" entry runs for a convict the main one can't take.
|
|
- Every punishment's cost is shown before it runs: the picker lists the mood the convict loses and the reform odds, and every dialog of a lethal punishment shows its odds and the colony's thought.
|
|
- 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).
|
|
|
|
### DLC support
|
|
|
|
Every Blax mod works with any DLC combination, core only included (rule of 2026-11-29). For Laws:
|
|
|
|
- About.xml names no DLC, neither as a dependency nor in loadAfter.
|
|
- Every category is core: the catalogue lists whatever the loaded game holds, so a DLC's breaks, drugs, interactions, usables and recipes appear when the DLC is active and are absent without it. The starter lawbook uses only Core entries (Defs/MentalStateDefs/MentalStates_Mood.xml: FireStartingSpree :58, Binging_DrugExtreme :91, CorpseObsession :399, Binging_DrugMajor :276; Insult in Defs/InteractionDefs/Interactions_Social.xml:80), and so does the wake-up example (Defs/Drugs/WakeUp.xml:5, chemical :115). The meat groups of the Ate category read the food itself, because vanilla's `AteMeat` event is Ideology-only and skips processed food (Verse/Thing.cs:2055-2064).
|
|
- Recorded acts are the exception in practice: the category is core, but most history events are recorded only with Ideology active, so without Ideology the category may be nearly empty or never fire. The picker lists the event defs that exist and the category's tooltip says "Most recorded acts need Ideology".
|
|
- A missing entry from a DLC shows "Needs <DLC>", read from the source mod saved with the row; from any other mod "Missing: <mod>".
|
|
- DLC content meets checks that are false without the DLC: slaves exist only with Ideology (`IsSlave`), children with Biotech (`DevelopmentalStage`), roles with Ideology (`ModsConfig.IdeologyActive` before any role read), mechanitors with Biotech (`ModsConfig.BiotechActive`, as vanilla checks at RimWorld/Pawn_GuestTracker.cs:536), subhumans with Anomaly (`IsSubhuman`, which `CanBeArrestedBy` also checks, Verse.AI/GenAI.cs:79-82).
|
|
- DLC defs only through `MayRequire` in XML and `[MayRequire<DLC>]` DefOf fields. DLC code only behind `ModsConfig.<DLC>Active`; `ModLister.Check<DLC>` is an install check, not an active check.
|
|
- A choice that needs a DLC shows disabled with "Needs <DLC>" instead of hiding: 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.
|
|
- 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.
|
|
|
|
| Feature | Area, step | Needs | Without it |
|
|
|---|---|---|---|
|
|
| Lawbook tab, starter lawbook, case log | Lawbook 1 | None | Works |
|
|
| Act catalogue: breaks, ate, used, interactions, records, bills, special acts | Crimes 1 | None | Works; DLC entries are simply absent |
|
|
| Act catalogue: recorded acts | Crimes 1 | None (most events: Ideology) | Lists the event defs; most never fire |
|
|
| Violent crimes, slaughterer link, drug policy crimes | Crimes 1 | None | Works |
|
|
| Warn, guilty, subdue, jail, subdue then jail | Enforcement 1 | None | Works. Slaves don't exist |
|
|
| Laws for slaves (warn, guilty, subdue) | Enforcement 1 | Ideology | No slaves to cover |
|
|
| Children never beaten | Enforcement 1 | Biotech | No children |
|
|
| Reprimand, banish, execute | Enforcement 1 | None | Works |
|
|
| Slaves' wardens first | Enforcement 2 | Ideology, Blax Slaves | No slaves; without Slaves' feature Laws subdues slaves itself |
|
|
| Subdue a pawn that fights back | Enforcement 3 | None | Works |
|
|
| Punishment picker, options, alongside entries, "Instead" | Enforcement 4 | None | Works; entries that need a DLC or a sibling show disabled with "Needs <DLC>" or "Needs Blax Castes" |
|
|
| Shunned, group beating, execution corps, apology | Enforcement 4 | None | Works. Children and pregnant convicts are never beaten or shot (Biotech) |
|
|
| Masochist and pain-idealizing convicts take "Instead" | Enforcement 4 | None (the precept: Ideology) | The Masochist check works; the precept check is skipped |
|
|
| Excommunicate, shaken faith | Enforcement 4 | Ideology | "Needs Ideology"; Excommunicate's "Instead" is Shunned. In a classic ideoligion certainty doesn't move, so Excommunicate shuns and strips the role only and Shaken faith shows "Needs a non-classic ideoligion" |
|
|
| Public execution | Enforcement 4 | Ideology, the Execution ritual in the colony's ideoligion | "Needs Ideology" |
|
|
| Punishments in public, witness thoughts and deterrence | Enforcement 5 | None | Works. A Kind or Bloodlust spectator's variant is core |
|
|
| Lose own bedroom | Sentences 1 | None | Works. A titled pawn also gets Royalty's bedroom thought (RimWorld/ThoughtWorker_NoPersonalBedroom.cs:13) |
|
|
| Lose role | Sentences 1 | Ideology | "Needs Ideology" |
|
|
| Sentence castes | Sentences 2 | Blax Castes with its sentence members | "Needs Blax Castes"; Laws writes no policy |
|
|
| Reform: thoughts, stat part, break weight | Repeat offenders 1 | None | Works |
|
|
| Reform: trait steps | Repeat offenders 1 | None | Works. Gene and suppressed traits are skipped (Biotech) |
|
|
| Release gives back bed, grave; pardon | Sentences 1 | None | Works |
|
|
| Release gives back throne | Sentences 1 | Royalty | Skipped |
|
|
| Release gives back deathrest casket, mech modes | Sentences 1 | Biotech | Skipped |
|
|
| Release gives back the ideoligion role | Sentences 1 | Ideology | Skipped |
|
|
| Hold for role holders, while the give-back is off | Sentences 1 | Ideology | No roles |
|
|
| Hold for mechanitors, while the give-back is off | Sentences 1 | Biotech | No mechanitors |
|
|
| Jail for slaves | Sentences 2 | Ideology | No slaves |
|
|
| Trial through the vanilla trial | Court 1 | Ideology | "Trial" shows disabled with "Needs Ideology" until court sessions make it core |
|
|
| Court place on a table, party spot or campfire | Court 2 | None | Works. A throne needs Royalty, a lectern or ritual spot Ideology, since those buildings exist only then |
|
|
| Court sessions, "Jail, then trial", court hour, removal button | Court 2 | None | Works. A throne as court place needs Royalty, a lectern or ritual spot Ideology |
|
|
| Courtrooms | Court 2 | None | Works |
|
|
| Attorneys, multi-day trials | Court 3, Court 4 | None | Works |
|
|
| Elected judge | Colony votes 2 | None | Works |
|
|
| Leader or moral guide as judge | Colony votes 2 | Ideology | Option disabled with "Needs Ideology"; a saved choice falls back to elected |
|
|
| Law votes | Colony votes 1 | None | Works without the precept term |
|
|
| Prison break crime | Crimes 2 | None | Works |
|
|
| Slave rebellion crime | Crimes 2 | Ideology | Row shows "Needs Ideology" |
|
|
|
|
## Areas and steps
|
|
|
|
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
|
|
|
|
#### Lawbook tab
|
|
|
|
- **Players get:** A "Laws" button in the bottom bar, after Ideoligions (order 105; Ideos is 100 and Menu 500, Ideology/Defs/MainButtonDefs/MainButtons.xml:9, Core/Defs/Misc/MainButtonDefs/MainButtons.xml:131). Two tabs. "Lawbook" lists your laws as rows (spec below). "Add law" opens the act picker first (spec below), then adds the row; each other column is a dropdown that offers only what fits the chosen action and stage. Clicking a row's Action opens the picker again. "Starter lawbook" adds the suggested rows. "Cases" lists cases newest first: who, what, stage, when, punishment, status, with a button to jump to the pawn and, for cases that wait, "Arrest now". An empty book shows one line: "No laws yet. Add one or press Starter lawbook."
|
|
- **Row spec:**
|
|
- Columns: Action (icon, category and label, with the source mod in the tooltip); Option, only for drug binges (Any, Hard, Social, then every drug's `ChemicalDef` by label, built from the ThingDefs whose `CompProperties_Drug` names a chemical); Stage; Severity; Punishment; Days, a 1 to 50 field for Guilty, Jail, Subdue then jail, Trial and Jail then trial and "-" otherwise; On; delete. An overlap icon marks a row that can catch the same act as a row of another category; its tooltip names that row.
|
|
- A new row gets the entry's first stage, Moderate, Warn and On.
|
|
- Punishments per entry and stage:
|
|
|
|
| Entry | Stage | Punishments |
|
|
|---|---|---|
|
|
| A break that isn't hostile to the colony, aggressive ones (tantrums, murderous and sadistic rage, slaughterer) included | Planning | Warn, Subdue, Jail |
|
|
| The same, with a linked act | Did it | Warn, Reprimand, Guilty, Subdue, Jail, Subdue then jail, Banish, Execute, Trial, Jail then trial. Subdue acts only while the offender is still in its break; after it a Subdue row warns and Subdue then jail jails |
|
|
| A break hostile to the colony (berserk) | Planning | Warn, Guilty, Jail. Jail waits until the break ends or the pawn is down |
|
|
| The same, with its Violence link | Did it | Warn, Reprimand, Guilty, Jail, Banish, Execute, Trial, Jail then trial. Jail waits as above |
|
|
| Every entry outside the breaks: ate, used, interactions, recorded acts, records, bills, special acts | Did it | Warn, Reprimand, Guilty, Jail, Banish, Execute, Trial, Jail then trial |
|
|
|
|
Each punishment shows up once its feature is built: Reprimand, Banish and Execute in the release after the first, Trial with Court step 1, "Jail, then trial" with Court step 2. From Enforcement step 4 the Punishment cell opens the punishment picker instead of a dropdown, and the table above is read from each `PunishmentDef`'s `fits` (see "Punishment catalogue and picker"). A berserk state is told apart by its class in the catalogue (`MentalState_Berserk`, `MentalState_BerserkWarcall` and their subclasses, plus an XML list for modded classes), and enforcement re-checks `ForceHostileTo(Faction.OfPlayer)` on the live state, which wins over the catalogue.
|
|
|
|
- Changing Severity resets Days to the new default only while Days still equals the old default. Changing Action or Stage resets a punishment that no longer fits to Warn.
|
|
- Action, Option and Stage are the row's key. A duplicate is refused and the list jumps to the existing row.
|
|
- **Act picker:** a window like the ingredient filter of a tailoring bill. A search field on top (vanilla `QuickSearchWidget`, the one the trade and policy dialogs use), below it the categories as a collapsible tree: Mental breaks, Ate, Used, Social interactions, Recorded acts, Records, Bills, Special acts. Each category opens with its groups first ("Any drug binge", "Hard drugs", "Human meat", "Any surgery"), then every entry A to Z with its icon (the thing's icon for ate, used and bills, the interaction symbol, the def's label otherwise) and its source mod in grey. Typing filters every category at once and opens those with hits. An entry already in the book shows a tick; clicking it jumps to that row. One click picks an entry and closes the window. With a large mod list a category holds hundreds of bills; the tree draws only the visible rows.
|
|
- **How:**
|
|
- `MainButtonDef BlaxLaws_Laws` with `tabWindowClass BlaxLaws.MainTabWindow_Laws`. The window is a `MainTabWindow` with two `TabRecord`s, a scroll view and `Widgets.Dropdown` per column.
|
|
- `Dialog_PickAct : Window` draws the picker: a `QuickSearchWidget` in `DoWindowContents`, its `filter.Matches(label)` against each entry's label and defName, the tree in a scroll view that skips rows outside the view rect. It reads `ActCatalogue` and returns an act key.
|
|
- Every write goes through one `Lawbook` class (as every Castes write goes through `CasteManager`): add, edit, delete, starter. It rebuilds the watched flags after each write.
|
|
- Deleting a law that has open cases asks first and names the count; those cases close as "law repealed".
|
|
- The case list reads the component; the jump button uses `CameraJumper.TryJumpAndSelect`.
|
|
- Settings page: "Enforce laws" (on), "Show Laws tab" (on, writes `buttonVisible` live), "Messages for cases" (on), "Letters for jailings" (on), "Enforcers" (wardens first / wardens only), "Subdued pawns lose their catharsis" (on), "Player orders are exempt" (on), "Days between cases for acts outside a break" (1, 0 to 7), "Keep closed cases" (60 days, 7 to 360), "Reset to defaults". Keys `BlaxLaws_Setting<Name>` plus `...Tip`.
|
|
- **Settings:** As listed; the book itself is per save.
|
|
- **Save and removal:** The book and cases save in the component. Removal drops them with it.
|
|
- **Overlaps:** Federation: Laws and Warrants (3823463956, 10 subs, 1.6) has the only other laws tab on the Workshop, inside its own scenario.
|
|
- **Replaces:** Nothing alone; with the 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.
|
|
- **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. A Planning row never offers Reprimand, Banish or Execute; a Berserk row never offers Subdue; a Tantrum row does. 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`.
|
|
|
|
### Lawbook, step 2: the book across saves and groups
|
|
|
|
Not specced yet: lawbook templates, "Applies to" and named punishments (see `docs/features.md`). "Applies to" needs no field reserved now: a Law saved without it loads as "everyone", and keys that are unique on Action, Option and Stage stay unique with a fourth part. Named punishments need none either: a preset is a name, a `PunishmentDef` defName, an options string and an alongside list in the component (`List<NamedPunishment>`, `nextNamedId`), and a row saves `Named/<id>` in its existing `punishment` field. A named punishment never becomes a Def: a Def type for presets would be one more def a template or a save could name after an unsubscribe.
|
|
|
|
### Crimes, step 1: every act the game records
|
|
|
|
#### 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:
|
|
|
|
| Category | Entries | Groups | A case opens when |
|
|
|---|---|---|---|
|
|
| Mental breaks | Every `MentalStateDef` a `MentalBreakDef` starts, plus the states colonists reach another way (berserk); animal and baby states are left out | Any drug binge, any tantrum, any insulting spree, any aggressive break, any break | Planning: the break starts. Did it: its linked act happens during the break (link table below) |
|
|
| Ate | Every ThingDef with `ingestible`: food, meals, raw food, corpses, drugs, modded and DLC ones | Any drug, hard drugs, social drugs, medical drugs; any meat (meals with meat included), raw meat or corpses, human meat, insect meat; raw food; any meal | The pawn eats it on its own job; a doctor's dose or a warden feeding a patient doesn't count |
|
|
| Used | Every ThingDef with a `CompUsable`: psytrainers, neurotrainers, mech serums, modded usables | None | `UsedBy` runs for the pawn |
|
|
| Social interactions | Every `InteractionDef`: insult, slight, chitchat, romance attempts, breakups, jailbreak talk, modded ones | Insult or slight | The pawn starts it and it happens (`TryInteractWith` returns true); the offender is the initiator |
|
|
| Recorded acts | Every `HistoryEventDef` except the faction-level ones (goodwill, trade, quests, raids; an exclusion list in XML): cut a tree, butchered a human, harvested an organ, executed a prisoner, ate human meat, got lovin' outside marriage | None | The game records the event with the pawn as its doer. Most need Ideology |
|
|
| Records | Every `RecordDef` that counts (Int or Float; time records left out): kills, humanlike kills, animals slaughtered, bodies stripped, things deconstructed, things hauled | None | The pawn's record goes up |
|
|
| Bills | Every `RecipeDef`: made a human leather duster, cooked a fine meal, installed a bionic arm, butchered a corpse | Any surgery | The pawn finishes one iteration of the bill |
|
|
| Special acts | Set a fire, displayed a corpse, started a social fight; 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:
|
|
|
|
| Mental state class | Breaks in Core | Did it |
|
|
|---|---|---|
|
|
| `MentalState_BingingDrug` | Binging_DrugExtreme, Binging_DrugMajor | Ate a drug that matches the row's option (default: any drug) |
|
|
| `MentalState_Binging`, not the drug binge | Binging_Food | Ate anything |
|
|
| `MentalState_FireStartingSpree` | FireStartingSpree | Set a fire |
|
|
| `MentalState_CorpseObsession` | CorpseObsession | Displayed a corpse |
|
|
| `MentalState_InsultingSpree` | InsultingSpree, TargetedInsultingSpree | Insult or slight |
|
|
| `MentalState_Jailbreaker` | Jailbreaker | The jailbreak talk (`SparkJailbreak` interaction) |
|
|
|
|
Tantrums, berserk, murderous and sadistic rage get their links with "Violence", slaughterers with "Slaughterers", both in the release after the first. Every other break, desertion (GiveUpExit) included, is Planning only.
|
|
|
|
- **How:**
|
|
- Catalogue build. Each `ActCategoryWorker` walks its `DefDatabase` once after def loading: breaks from `DefDatabase<MentalBreakDef>` (`mentalState`), plus an include list in XML (Berserk) and an exclude list (animal and baby states: Manhunter, ManhunterPermanent, Roaming, BabyCry, BabyGiggle and their kin, to be read from the defs); ate from ThingDefs with `IsIngestible`; used from ThingDefs whose comps include a `CompProperties_Usable`; interactions from `DefDatabase<InteractionDef>`; recorded acts from `DefDatabase<HistoryEventDef>` minus the exclusion list; records from `DefDatabase<RecordDef>` with `type` Int or Float; bills from `DefDatabase<RecipeDef>`. Groups are predicates over defs, written once in code: drug groups by `ingestible.drugCategory` (None, Medical, Social, Hard), meat groups as below, "raw food" by `ingestible.preferability`, "any meal" by `IsProcessedFood`, "any surgery" by `RecipeDef.IsSurgery`, "any aggressive break" by `MentalStateDef.IsAggro`.
|
|
- Most specific row: per category, a row on the exact def beats a group row beats the category's "any". Two groups that both match ("hard drugs" and "any drug") rank by size: the smaller group wins.
|
|
- Drug binge.
|
|
- Planning: hook A when the new state is `MentalState_BingingDrug`. Its `PostStart` picks the chemical (Verse.AI/MentalState_BingingDrug.cs:24-27, `ChooseRandomChemical` at :49), preferring a chemical the pawn is addicted to (:51-62). Wake-up is a hard drug (Core Defs/Drugs/WakeUp.xml:27), so a wake-up binge comes from an extreme break (Binging_DrugExtreme, `drugCategory` Hard, MentalStates_Mood.xml:91-106) or from any binge of a wake-up addict.
|
|
- Did it: hook C when `ingester.MentalState is MentalState_BingingDrug` and the drug's `CompProperties_Drug` chemical matches the row's option. Doctor-given doses (RimWorld/Recipe_AdministerIngestible.cs:11) don't count. A dose outside a binge is normal drug use, not this break's crime; an "Ate" row may still catch it.
|
|
- The binge ignores forbidden items and the drug policy and lasts 40000 to 60000 ticks (MentalStates_Mood.xml:98-99), so stopping it after dose 1 still prevents the rest.
|
|
- Fire starting. Planning: hook A on `FireStartingSpree` (MentalStates_Mood.xml:58-71; the break needs the Pyromaniac trait, Core Defs/TraitDefs/Traits_Singular.xml:340-343). Did it: hook I, offender `CasterPawn`, which `FireUtility.TryStartFireIn` gets as instigator (RimWorld/Verb_Ignite.cs:12-21). Raiders also ignite (RimWorld/TrashUtility.cs:97, 117); the offender filter drops them.
|
|
- Corpse obsession. Planning: hook A on `CorpseObsession` (MentalStates_Mood.xml:399-413); `PostStart` picks the corpse (Verse.AI/MentalState_CorpseObsession.cs:41-45). Did it: hook J sees `alreadyHauledCorpse` turn true, which the job's last toil sets (RimWorld/JobDriver_HaulCorpseToPublicPlace.cs:82-95, the call at :90). 80% of drops go on a table (:64, `TryFindTableCell` :97-123); the case checks the corpse's cell for a `def.IsTable` building. "Dug up" is read from the corpse, never from the job: hook J sees the flag only after that last, instant toil, when the haul job and its grave target are gone. Hook A notes it from `corpse.ParentHolder is Building_Grave`, and hook J re-reads it for the current `__instance.corpse` on each call while `alreadyHauledCorpse` is false, since vanilla may pick another corpse (Verse.AI/MentalState_CorpseObsession.cs:26-28). Vanilla only obsesses over buried corpses (`GetClosestCorpseToDigUp` searches `ThingRequestGroup.Grave`, Verse.AI/CorpseObsessionMentalStateUtility.cs:17-21), Anomaly's unnatural corpse aside (:13), so the note is nearly always set. The flag is saved by vanilla (MentalState_CorpseObsession.cs:15), so after a load it is already true: hook J only moves a case that is open at planning, and the case's stage is saved, so the corpse is never filed twice.
|
|
- Started a fight. Hook F, offender `___pawn`, the pawn whose tracker starts the fight; `otherPawn` is the provoker. It is called from `CheckSocialFightStart` (RimWorld/Pawn_InteractionsTracker.cs:355-371) on the recipient of an interaction (:217). Slaves only fight slaves and prisoners only prisoners (:402-409). The row's tooltip says who counts as the offender.
|
|
- Interactions. Hook E: `__result` true and `intDef` in the watched set (Insult, Slight, any other). Offender `___pawn` (the initiator), victim the recipient. Insults in a spree also come through here (RimWorld/JobDriver_Insult.cs:34) and are the insulting spree's did-it. Planning for sprees: hook A on `InsultingSpree` or `TargetedInsultingSpree`. The jailbreaker's talk is the `SparkJailbreak` interaction (`InteractionDefOf.SparkJailbreak`), the did-it of `MentalState_Jailbreaker`.
|
|
- Ate. Hook C. The prefix reads the eaten def, `FoodUtility.GetFoodKind(__instance)` (RimWorld/FoodUtility.cs:1454), `def.IsProcessedFood` and `FoodUtility.IsHumanlikeCorpseOrHumanlikeMeatOrIngredient(__instance)` (used at Verse/Thing.cs:2033) into `__state`, before the stack can be destroyed; the postfix files the case. Meat groups: "any meat" from the food kind (meals with meat included), "raw meat or corpses" from `IsMeat` or `IsCorpse` on unprocessed food, "human meat" from that last call, "insect meat" from the meat's source race. It counts only when the ingester eats on its own: one of the targets (A, B or C) of its own current job is the eaten thing. That covers the Ingest job (RimWorld/JobDriver_Ingest.cs:115) and a drink at a gathering spot, which `JobDriver_SocialRelax` ingests at target C under its own job def (RimWorld/JobDriver_SocialRelax.cs:75), the most common way colonists take beer and smokeleaf. A doctor's dose (RimWorld/Recipe_AdministerIngestible.cs:11, inside the doctor's bill), a warden or parent feeding someone (RimWorld/JobDriver_FoodFeedPatient.cs:78, RimWorld/JobDriver_Feed.cs:47) and a baby fed by others (RimWorld/JobDriver_BottleFeedBaby.cs:86, 103) run on the feeder's job, so the eater's own job never targets the food and they are skipped. Caravans feed off the map (RimWorld.Planet/Caravan_NeedsTracker.cs:182, 209, 245), which the offender filter drops.
|
|
- Used. Hook U, the used thing's def against the watched set. A psytrainer, neurotrainer or serum (Royalty, Biotech or Core) files on the pawn that used it on its own job; a patient a doctor gives a healer mech serum files nothing.
|
|
- Recorded acts. Hook H: the event def against the watched set, then `args.TryGetArg<Pawn>(HistoryEventArgsNames.Doer, ...)`; an event without a doer pawn files nothing. `RecordEvent` also runs for events the player orders (an execution), so the player-order exemption reads the doer's job like every other hook.
|
|
- Records. Hook R: the record def against the watched set; the offender is the tracker's `pawn`. A record goes up for many reasons ("things hauled" every haul), and the cooldown keeps one case a day per pawn and row.
|
|
- Bills. Hook B: the recipe of the doer's current job against the watched set, the doer as offender. Bills are standing player orders but not forced jobs, so the exemption doesn't cover them: a row on "make yayo" files on the cook who made it, which is the row's point.
|
|
- Each category worker opens a case or moves an open break case to did it, increments the count, and queues the punishment of the most specific enabled matching row (see "Defaults I picked") once per stage. An act that is the linked did-it of an open break case goes to that case and opens no other case; when it also matches a row of its own, the row with the higher severity decides, the break's row on a tie (see "Defaults I picked").
|
|
- The cooldown setting applies to every act outside a break. Inside the window a further act by the same offender under the same law raises the count on that case, open or closed, and files nothing new. While that case is still open (a jail case waiting for "Arrest now" or a bed) every further act goes to it, whatever its age. An insult that sparks a fight files two cases: the insult for the insulter, the fight for the one who swings.
|
|
- **Settings:** The cooldown and "Player orders are exempt" from the settings page; per row the option.
|
|
- **Save and removal:** Cases save in the component. Hooks 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; Laws' "Talk down" (Enforcement, step 1, New) covers that for colonists on 1.7.
|
|
- **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.
|
|
- **Tests:**
|
|
- Binge: with a "wake-up" row, `TryStartMentalState(Binging_DrugExtreme)` on a colonist whose binge chemical a test hook sets to WakeUp opens one planning case; with yayo chosen, no case. `wakeUp.Ingested(pawn, 0)` during the binge moves it to did it with count 1, a second dose makes count 2, still one case. A wake-up dose outside a binge opens nothing. An "any drug" row catches a beer binge (Binging_DrugMajor). The starter rows plus "wake-up, did it, jail 10 days": a wake-up dose during a binge gives one case and a 10-day sentence.
|
|
- Fire: a forced spree opens planning; a forced Ignite job on a wooden wall moves it to did it with count 1. A raider's ignite opens nothing.
|
|
- Corpse: a forced obsession on a corpse in a grave opens planning with "dug up from a grave"; driving the haul job to the end with a table in reach moves it to did it with "on a table" and keeps the note. Phase 2 after a save with the flag already true: still one did-it entry.
|
|
- Fight: `recipient.interactions.StartSocialFight(initiator)` files the case on the recipient, not the initiator.
|
|
- Insult: `TryInteractWith(target, Insult)` files on the initiator. A Slight only with the option. A second insult within a day files nothing; with the cooldown at 0 it files a second case.
|
|
- Ate: raw meat, a simple meal with meat and human meat against the meat groups; a row on the Simple meal def catches the simple meal and not the raw meat; a drafted pawn eating opens nothing; a doctor administering a drug to a patient opens nothing for either pawn; a beer drunk on social relax files under "Ate: beer"; a player-forced eat job opens nothing while the setting is on and a case when it is off. 60 colonists eating meat for a day under an "any meat, warn" law produce at most 60 cases and 60 messages.
|
|
- Breaks caused by others: a tantrum that another pawn's psycast starts on a colonist opens nothing; a drafted colonist's self-cast break opens nothing while player orders are exempt and a case when the setting is off, and a drafted colonist's own mood break opens a case.
|
|
- Offender filter: a colonist made a quest lodger (an ongoing quest's QuestPart_ExtraFaction names another home faction, RimWorld/QuestUtility.cs:524) opens nothing for a meat meal or an insult, and the same pawn files both once the quest is removed. A visitor (guest of the colony) eating a meat meal opens nothing.
|
|
- Catalogue: every `MentalBreakDef`'s state, every ingestible ThingDef, every `InteractionDef`, every Int or Float `RecordDef` and every `RecipeDef` of the loaded game has an entry; no Time record and no excluded state has one. The test mod's own defs (a test drug ThingDef, a test InteractionDef, a test RecipeDef, a test mental state reusing `MentalState_FireStartingSpree`) appear with the test mod as source, and the test break offers Did it through the link. In a `-NoDlc` run no DLC entry appears and the starter lawbook still adds 7 rows.
|
|
- Used: a colonist using a healer mech serum on its own job files on it; a doctor-administered healer serum files nothing for either pawn; a `UsedBy` call that `CanBeUsedBy` refuses files nothing. Interactions: a forced `Chitchat` with a Chitchat row files on the initiator. Records: `pawn.records.Increment(RecordDefOf.BodiesStripped)` with a row files one case, a second increment the same day raises the count. Recorded acts: an `ExecutedPrisoner` event with a doer files on the doer, the same event without a doer files nothing (skipped without Ideology if vanilla records it only there). Bills: a finished "make simple meal" iteration files on the cook; a surgery files on the doctor; a mech gestator bill files on the mechanitor who finishes it (skipped: needs Biotech).
|
|
- Jailbreaker: a forced Jailbreaker break opens planning, the `SparkJailbreak` interaction moves it to did it. A Berserk row offers Warn, Guilty and Jail; a Tantrum or MurderousRage row also offers Subdue.
|
|
- 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.
|
|
|
|
#### Violence
|
|
|
|
- **Players get:** Four special acts: assault (hurt a free colonist, a guest or another pawn that isn't hostile, outside a social fight), harming a prisoner or slave of the colony, manslaughter and murder. A hit that kills is murder. When the victim of an assault or harm case dies of its wounds within 2 days, by bleeding out, an infection or any other death without an attacker, that case becomes manslaughter. 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). A berserk case takes Warn, Guilty or Jail; tantrums and the rages take every break punishment, Subdue included (see "Defaults I picked").
|
|
- **How:**
|
|
- Links: 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).
|
|
- Hits: 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. The offender is `dinfo.Instigator`. During an open break case any damage the offender deals, to a pawn or a wall, is that break's did-it. Outside a break the victim's status picks the act: a prisoner of the colony or a colony slave is "harmed a prisoner or slave", any other humanlike pawn that isn't hostile is assault.
|
|
- Excluded: drafted instigators; damage with `instigatorGuilty` false (executions; Laws' own subdue, which also sets a scope flag); victims in a state hostile to the colony (a colonist hitting back at a berserker); hits while both pawns are in a social fight (that is "started a social fight"); surgery (no instigator); friendly fire. A hit counts as friendly fire only when `dinfo.IntendedTarget` is set and isn't the victim (Verse/DamageInfo.cs:94): vanilla melee builds its DamageInfo with no intended target (RimWorld/Verb_MeleeAttackDamage.cs:50-51), only bullets (RimWorld/Bullet.cs:23) and explosions (Verse/DamageWorker.cs:316) set one, so "intended target not the victim" alone would drop every punch, every blade, every berserk and every tantrum hit. Vanilla already marks undrafted attackers of player pawns guilty for a day (Verse/Pawn_HealthTracker.cs:321-329).
|
|
- Deaths: a prefix and postfix on `Pawn.Kill` (Verse/Pawn.cs:2096). With an instigator in `dinfo` that passes the filter above, the death is murder, and the killing hit files no assault besides. Most deaths after an attack carry no instigator: bleeding out or an infection reaches `Kill` through `Notify_HediffChanged`, which runs `CheckForStateChange(null, hediff)` (Verse/Pawn_HealthTracker.cs:290-294, the `Kill` at :515), and a disease's death roll calls `Kill(null, this)` (Verse/Hediff.cs:512). For such a death Laws looks for an assault or harm case of the last 2 days, open or closed, with this pawn as victim, and moves it to manslaughter like a later stage (see "One enforcement per case"). The link lives in the saved case, so it survives a load.
|
|
- **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:** An undrafted colonist's punch on another colonist files assault, on a prisoner of the colony harming a prisoner. A forced berserk's melee hit on a colonist moves the berserk case to did it; a forced tantrum hitting a wall moves the tantrum case to did it. A shot that kills files murder and no assault. A stabbed colonist that bleeds out turns its assault case into manslaughter, also after a save and load in between. A murder during a murderous rage with "Murderous rage, did it: warn, Moderate" and "Murder: jail 10 days, Grave" gives one case and 10 days. An undrafted colonist's shot at a raider that hits a colonist opens nothing. A drafted shot, subdue damage and a social fight open 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 "Jail for slaves" for rebel slaves.
|
|
|
|
#### Prison breaks and slave rebellions
|
|
|
|
- **Players get:** Two acts: prison break by Laws' own convicts and slave rebellion (Ideology). A convict who breaks out gets Warn, "Add days" on its sentence or a confirmed execution (see "Banish and execute"). Other escapees, captured raiders and enemy prisoners included, stay with the prison mods: punishing them is sentencing enemy prisoners, which Prisoner Sentencing and Prison Expanded cover.
|
|
- **How:** Postfixes on `PrisonBreakUtility.StartPrisonBreak` (RimWorld/PrisonBreakUtility.cs:214, whose out list names the escapees) and `SlaveRebellionUtility.StartSlaveRebellion` (RimWorld/SlaveRebellionUtility.cs:403). For the prison break act only, the offender filter gains prisoners of the colony that serve a Laws sentence or sit in Laws' custody ("Jail, then trial"); colony slaves are offenders already.
|
|
- **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; a captured raider in the same break opens nothing; a convict's prison break row offers Warn, Add days and Execute only; the slave rebellion test skips without Ideology.
|
|
|
|
### Crimes, step 3: crimes against the faith
|
|
|
|
Not specced yet: "anything the colony's ideoligion forbids" and "left the colony's ideoligion" (see `docs/features.md`). Both run on hook H, so no new hook is needed. The group reads every precept comp whose `eventDef` is the recorded event and that gives the doer or those who learn of it a bad thought (`PreceptComp_SelfTookMemoryThought`, RimWorld/PreceptComp_SelfTookMemoryThought.cs:8, 16; `PreceptComp_KnowsMemoryThought`) or is a `PreceptComp_UnwillingToDo`. UnwillingToDo alone would miss meat, cannibalism and organ use, which have none (Ideology/Defs/PreceptDefs/Precepts_MeatEating.xml:25-45), and where it exists vanilla already stops the pawn's own job (RimWorld/IdeoUtility.cs:109-116). Leaving the ideoligion is the `ChangedIdeo` event, recorded while the old ideoligion is still set (RimWorld/Pawn_IdeoTracker.cs:189-192). Needs Ideology.
|
|
|
|
### Enforcement and punishments, step 1
|
|
|
|
#### Enforcement and cases
|
|
|
|
- **Players get:** Cases move on by themselves. A planning case closes when the break ends with nothing done, a lost subdue starts again, and an arrest that waited for a bed, an enforcer or the end of a fight happens as soon as it can. One enforcer per case, never one pulled off a rescue, a tending or a fire, and nobody sent through a raid.
|
|
- **How:** The `Enforcement` queue, the 250- and 2500-tick sweeps, the enforcer pick with its job and danger filters, the reservation checks and hook K (all in "Enforcement runs a tick later"); the case lifecycle (Open, Enforcing, Jailed, Closed, each closed case with an outcome key); one enforcement per case and the hand-over between stages; the cooldown; the `ActCategoryWorker`, `ActWorker` and `PunishmentWorker` base classes.
|
|
- **Settings:** "Enforce laws", "Enforcers", "Messages for cases", "Letters for jailings".
|
|
- **Save and removal:** Cases in the component. The queue isn't saved; cases in Enforcing refill it after a load.
|
|
- **Overlaps:** None.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** M.
|
|
- **Tests:**
|
|
- 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.
|
|
- A downed offender a doctor has already reserved for a rescue: no arrest starts, no reservation error or warning is logged, and the sweep arrests it once the reservation is gone.
|
|
- Hand-over: the drug lies next to the binger, starter rows active, the warden sent from far enough off that the binger doses first, and a second warden free beside the binger once the first is on its way. One enforcer acts, the one sent to subdue, the pawn ends as a prisoner, never in a medical bed, and the case log shows one did-it outcome. (A warden that arrives first wins every time: each hit re-thinks the binger's job, and with the drug in its hands the binge finds none on the map and wanders off, Verse.AI/Pawn_JobTracker.cs:974-990, RimWorld/JobGiver_BingeDrug.cs:83. That path is the subdue tests'.)
|
|
- "Enforce laws" off: cases open and close, nothing is enforced.
|
|
- A forced berserk with a Jail row: nobody is sent while it rages; once the break ends, or the test downs the pawn, it is arrested or captured. A raid still blocks every case as before.
|
|
|
|
#### Warn and guilty
|
|
|
|
- **Players get:** "Warn" files the case and posts a message, nothing more: a record you can act on yourself. "Guilty for N days" marks the pawn guilty the vanilla way until the days run out: the guilty icon shows, the arrest of a free colonist is always accepted, executing it costs the colony only the -2 "justified execution of colonist" thought plus its family's grief, and banishing it costs no colony-wide thought (banishing it to its death still grieves its family).
|
|
- **How:**
|
|
- `pawn.guilt.Notify_Guilty(days * 60000)` (RimWorld/Pawn_GuiltTracker.cs:46-49), which vanilla saves (:40-44) and counts down (:51-61).
|
|
- Guilt gives arrest acceptance 1.0 for an `IsColonist` pawn that isn't a quest lodger (Verse/Pawn.cs:4087). A slave in a break isn't `IsColonist` (Verse/Pawn.cs:518-527; `SlaveIsSecure` is false in a mental state, RimWorld/Pawn_GuestTracker.cs:164-175), so the arrester's `ArrestSuccessChance` decides for it (Verse/Pawn.cs:4099).
|
|
- Guilt also gives capture when downed (Verse.AI/GenAI.cs:39-67) and the character card's execute toggle for a free colonist (RimWorld/CharacterCardUtility.cs:278-285).
|
|
- Execution: for a guilty victim `GiveThoughtsForPawnExecuted` picks stage 0 (RimWorld/ThoughtUtility.cs:27-31) and records `ExecutedColonist` with it (:72). In a core-only game `Execution_Classic` turns that into `KnowColonistExecuted` stage 0, "justified execution of colonist", -2 mood for 6 days for every colonist (Core Defs/PreceptDefs/Precepts_PrisonerExecution.xml:50-53; Core Defs/ThoughtDefs/Thoughts_Memory_Death.xml:56-67); an ideoligion's execution precept may change that. Family and friends still grieve: `AppendThoughts_Relations` ignores guilt for deaths and for banishment to die (RimWorld/PawnDiedOrDownedThoughtsUtility.cs:81-84, 253).
|
|
- Banishment: guilt only removes the colony-wide `ColonistBanished` and `ColonistBanishedToDie` thoughts (RimWorld/PawnDiedOrDownedThoughtsUtility.cs:214-232; RimWorld/PawnBanishUtility.cs:150).
|
|
- A longer guilt already on the pawn is never shortened.
|
|
- **Settings:** None beyond the row.
|
|
- **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.
|
|
- **Replaces:** Nothing; ending guilt by hand is "Pardon, early release and longer sentences".
|
|
- **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.
|
|
- **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
|
|
|
|
- **Players get:** For a pawn caught planning (or still in its break after the act), a warden walks over and beats it down with fists: bruises on torso and limbs, never the head, never a bionic part, never a lost part, never a scar. The break ends when the pawn goes down. Doctors carry it to bed, and the bruises heal in a few days. The pawn remembers who hit it (-15 opinion for 10 days, vanilla's "harmed me"). The enforcer is not marked guilty, and the beaten pawn doesn't fight back.
|
|
- **How:**
|
|
- `JobDriver_Subdue`: fail on the target despawned, dead, or no longer in the break its case recorded. One toil, `Toils_Combat.FollowAndMeleeAttack(TargetIndex.A, hit)` (Verse.AI/Toils_Combat.cs:115-178), which follows the target, calls `hit` while adjacent and ends when the target is downed (:165-167) or unreachable (:132-134). The toil runs as a `tickIntervalAction` (:123), which `Thing.DoTick` calls every 1 to 15 ticks depending on how often the camera updates the pawn (Verse/Thing.cs:726-735, bounds :604-606), so counting calls would make the beating up to 15 times slower off screen. The driver keeps a `lastHitTick` field instead (the job is never saved, so the field needs no save) and hits when `Find.TickManager.TicksGame - lastHitTick >= 90`.
|
|
- The hit: a random body part of the target that isn't missing, has depth Outside, isn't solid, isn't in the head group (torso, shoulders, arms, legs) and doesn't carry or sit below an added part (`hediffSet.PartOrAnyAncestorHasDirectlyAddedParts`, Verse/HediffSet.cs:1225): an injury there gives no pain (Verse/Hediff_Injury.cs:132-135) and only damages the implant. Damage 4 to 8, divided by every factor vanilla multiplies in on the way to the injury: the race's damage multiplier (Verse/Thing.cs:1487-1497, which rounds the amount), the genes' and hediffs' damage factors (Verse/Pawn.cs:1919-1927) and `IncomingDamageFactor`, which applies even with armour ignored (Verse/DamageWorker_AddInjury.cs:164-167; Tough is 0.5, Core Defs/TraitDefs/Traits_Singular.xml:532), so the injury itself is 4 to 8. A factor of 0 ends the job as below. The injury is capped so the part keeps at least half its HP, counted unrounded (`GetPartHealth` rounds to a whole point, Verse/HediffSet.cs:581-605), and so the pawn's injuries, old scars included, stay at nine tenths of the sum vanilla kills at (150 times the health scale, Verse/Pawn_HealthTracker.cs:73, 705-719): the part caps alone add up to about 235 on a human. Nine tenths leaves room for a pawn whose pain is halved (Biotech's reduced pain gene) to go down, at about 128 points. A rounding or another mod's factor that still overshoots a cap is healed back on the hit's bruise (`Hediff_Injury.Heal`, Verse/Hediff_Injury.cs:201-212). `new DamageInfo(DamageDefOf.Blunt, amount, 0, -1, enforcer, part, null, SourceCategory.ThingOrUnknown, target, instigatorGuilty: false)` (Verse/DamageInfo.cs:144), with `SetAllowDamagePropagation(false)` (:260) and `SetIgnoreArmor(true)` (:214) so power armour doesn't make it endless, then `TakeDamage`. Then `enforcer.Drawer.Notify_MeleeAttackOn(target)` (Verse/Pawn_DrawTracker.cs:128), a punch sound and Melee XP.
|
|
- Blunt on a non-solid part makes a Bruise: no bleeding, pain 0.0125 per point (Core Defs/HediffDefs/Hediffs_Local_Injuries.xml:383-400). A pawn goes down when pain reaches its pain shock threshold (Verse/Pawn_HealthTracker.cs:101), 0.8 for a normal adult, so about 64 points or 11 hits.
|
|
- `instigatorGuilty: false` skips vanilla's guilt for harming a player pawn (Verse/Pawn_HealthTracker.cs:321-329). Calling `TakeDamage` directly sets no `meleeThreat`, which a vanilla melee verb would (RimWorld/Verb_MeleeAttack.cs:33-37), so the target doesn't turn on the enforcer. The target does get `HarmedMe` toward the enforcer (Verse/Pawn_HealthTracker.cs:383).
|
|
- Going down runs `RecoverFromState` (Verse/Pawn_HealthTracker.cs:850-853), which gives the break's `moodRecoveryThought`, Catharsis for the six watched breaks (MentalStates_Mood.xml:76, 103, 413, 539), when the break was mood-caused (Verse.AI/MentalState.cs:92-95). The driver reads that thought def before the hit and, if the hit downed the pawn, removes the memory gained this tick.
|
|
- The job ends with a message once three hits in a row haven't raised `hediffSet.PainTotal` (Verse/HediffSet.cs:57, which multiplies in pain factors at :1351-1353): go-juice, painkillers, every reachable part at its cap, or the pawn at the total cap (a normal adult goes down at about 64 points, one with halved pain at about 128). A hard ceiling of 40 hits backs that up. A "subdue then jail" row arrests instead, which works on a pawn in any break that isn't hostile to the arrester (Verse.AI/GenAI.cs:73-103, the check at :83).
|
|
- Aggressive breaks that aren't hostile (tantrums, murderous and sadistic rage, slaughterer) can be subdued: their state targets things, a named victim, prisoners or animals, never the enforcer, and the direct `TakeDamage` gives them no melee threat to answer. The enforcer pick skips the victim a murderous rage names (`MentalState_MurderousRage.target`).
|
|
- "Subdue then jail": in the tick the hit downs the target, the driver puts vanilla `JobDefOf.Capture` to a prisoner bed at the front of the enforcer's job queue (`jobQueue.EnqueueFirst`, Verse.AI/JobQueue.cs:40) and ends its toil, so the capture is the enforcer's next job, ahead of a doctor's rescue (RimWorld/WorkGiver_RescueDowned.cs:38-60). A queued job fails its reservations silently (`fromQueue`, Verse.AI/Pawn_JobTracker.cs:336, 373-375), and a queued vanilla Capture is safe in a save. Guilt is renewed before the job is queued, as for any capture (see "Jail for N days"), since a downed colonist can be captured only while guilty (Verse.AI/GenAI.cs:39-67).
|
|
- Downing drops the pawn's weapon and inventory forbidden (Verse/Pawn_HealthTracker.cs:856-859), as any downing does.
|
|
- Children (Biotech) never get this job; their row falls back as "Defaults I picked" says.
|
|
- Save: see "The subdue job never enters a save".
|
|
- **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.
|
|
- **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.
|
|
- **Effort:** S plus S.
|
|
- **Tests:**
|
|
- A binge planning case with a subdue row: within 2500 ticks the offender is downed (a colonist with normal pain; one with halved pain needs twice the hits), 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.
|
|
- Hits until nothing is left to hit, on a plain colonist, a Tough one, one with bionic arms and legs and through a race's rounded blunt multiplier: the pawn lives, its injuries add up to nine tenths of the lethal sum or less, and every hit part keeps half its HP or more, counted unrounded.
|
|
- A go-juice offender: the job ends after three hits without new pain, with one message.
|
|
- 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.
|
|
- A "subdue then jail" row ends with the pawn a prisoner, never in a medical bed, with a doctor free to rescue.
|
|
- A forced tantrum and a forced murderous rage with subdue rows: both go down, the enforcer is never attacked and never the rage's named victim.
|
|
- **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. A berserk pawn does strike back, with its weapon; that is why only the player can start a subdue on it ("Subdue a pawn that fights back"). The group beating (Enforcement, step 4) reuses these hits after the break, as a punishment, behind "Offer harsh punishments"; see its Risks.
|
|
|
|
#### 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.
|
|
|
|
Not specced yet: talk down and decide myself (see `docs/features.md`). Talk down ends a break through `MentalState.RecoverFromState`, which gives the break's catharsis (Verse.AI/MentalState.cs:92-95), so the spec decides whether "Subdued pawns lose their catharsis" covers it. Decide myself reuses the waiting case and "Arrest now".
|
|
|
|
### Enforcement and punishments, step 2: with the sibling mods
|
|
|
|
#### Slaves' wardens first
|
|
|
|
- **Players get:** With Blax Slaves' "Wardens calm breakdowns" on, a slave in a break those wardens take is left to them: Laws files the case but sends no subdue and no talk down. Its did-it rows still apply.
|
|
- **How:** `SlavesApi.CalmsBreaks`, bound by reflection at startup like the Castes calls (see "Works with the other Blax mods"), read before a subdue or a talk down of a slave. Laws stands down only for the breaks Slaves' wardens take: a state that isn't `IsAggro` (`MentalStateDef.IsAggro`, Verse/MentalStateDef.cs:108) and isn't the slave rebellion. A tantrum, a murderous or sadistic rage or a slaughterer is `IsAggro` (Core MentalStateDefs/MentalStates_Mood.xml:157, 195, 322), so the wardens skip it and Laws' subdue still applies. Without Slaves or with the flag false, Laws subdues slaves as before.
|
|
- **Save and removal:** Nothing saved.
|
|
- **Overlaps:** Blax Slaves owns calming slaves.
|
|
- **Effort:** S.
|
|
- **Tests:** With Slaves in `-Compat` and the flag on, a slave's binge planning case with a subdue row sends nobody; with the flag off, a subdue. Skipped without Ideology or Slaves.
|
|
|
|
### Enforcement and punishments, step 3: subdue a pawn that fights back
|
|
|
|
#### Subdue a pawn that fights back
|
|
|
|
New: the outline below; the full spec comes before the step is built.
|
|
|
|
- **Players get:** For a break hostile to the colony (berserk), a "Subdue with <name>" button on the case and an alert while it waits. The case names the best candidate by Melee, the weapon it holds against the offender's, and health; pressing the button sends that pawn on the subdue job. Laws never sends anyone at a berserk pawn on its own: it hits back with its weapon at full damage while the subdue job deals capped bruises, so a Melee comparison alone would get enforcers killed in a permadeath colony.
|
|
- **How:** The button starts the subdue job like a player order. For this one case the danger rule leaves the offender out: Laws walks `map.attackTargetsCache.TargetsHostileToFaction(Faction.OfPlayer)` through `GenHostility.IsActiveThreatTo` (RimWorld/GenHostility.cs:238-258 does the same loop) and skips the offender, and skips `EnemiesAreNearby(offender)`. Any other threat still blocks. No letter: Laws adds no Letter class.
|
|
- **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:** A forced berserk with a subdue choice: nobody is sent until the button is pressed; after it, the named pawn subdues it; a raid on the map still blocks the button's job.
|
|
|
|
### Enforcement and punishments, step 4: the punishment catalogue
|
|
|
|
Needs step 1's subdue, banish and execute; Excommunicate also needs Sentences step 1's give-back for the role. Fabian's examples of 2026-12-03 map to entries: "Group beating" is Group beating, "Execution corps" is Execution corps, "Excommunicate" is Excommunicate (Shunned on the core game), "Worse forced food policy" is the Bread and water sentence caste (Sentences, step 2). Not specced yet: Apology and Public execution (see `docs/features.md`). Apology needs a situational social thought "Apologized to me" read from the case, offsetting the -15 of `HarmedMe`; Public execution starts the ideoligion's Execution ritual, whose prisoner role takes any `IsPrisonerOfColony` pawn (RimWorld/RitualRolePrisoner.cs:7-21; Ideology Defs/Rituals/Ritual_Behaviors.xml:1781), and its spec checks how a ritual is started from code (see "To verify").
|
|
|
|
#### Punishment catalogue and picker
|
|
|
|
- **Players get:** The Punishment cell opens a picker instead of a dropdown: a search field and collapsible groups, Words and mood (Warn, Reprimand, Shunned, Apology), Body (Subdue, Subdue then jail, Group beating, Talk down), Freedom and daily life (Guilty, Jail, Jail then trial, the sentence castes), Status and faith (Lose own bedroom, Lose role, Shaken faith, Excommunicate), Removal (Banish), Death (Execute, Execution corps, Public execution), Court (Trial, Decide myself). Every entry shows what happens, the mood the convict loses, the reform odds for a first offender with a matching vice, and its "Needs" line; the Execution corps row also shows the walk-free chance for its squad and distance. The reason line of "Instead" names why it runs (a child, pregnant, a Masochist, a quest lodger, a missing DLC, sibling or court place). Entries that don't fit the stage, need a missing DLC or sibling, or need "Offer harsh punishments", stay in the list, disabled with the reason. Beside Days a gear button opens the entry's options, at most three, each a number or a short list (who beats, squad size, survivor rule, which sentence caste, where). Below the options: ticks for the alongside entries (Reprimand, Guilty, Shunned, Shaken faith, Lose own bedroom), so "Jail 5 days, also reprimand and guilty" is one row, and the "Instead" entry, Warn by default, which runs for a convict the main entry can't take. The case log names which ran and why.
|
|
- **How:**
|
|
- `Dialog_PickPunishment : Window`, built like `Dialog_PickAct`: a `QuickSearchWidget` and the groups in a scroll view. It lists every `PunishmentDef` from `Lawbook.PunishmentsFor(entry, stage)` plus the ones that don't fit, each as a `RowChoice` whose `reason` disables it (LawbookUi.PunishmentChoices already draws that), and returns a defName.
|
|
- The options window reads the def's option list and writes `Law.punishmentOptions`; an unknown or missing key reads as the default, so a renamed option never breaks a row. `Law.alongside` takes only defs with `runsAlongside`; `Law.instead` only defs that need no DLC, no sibling and no court place, so it never needs a fallback of its own. When "Instead" can't run either, the case is warned.
|
|
- When "Instead" runs: a child under a body or death entry; with Biotech, a convict carrying `HediffDefOf.PregnantHuman` (RimWorld/HediffDefOf.cs:123) under a body or death entry, since a beating to nine tenths of the lethal sum passes `Hediff_Pregnant.IsSeverelyWounded` (injury severity above 38 x `baseHealthScale`, Verse/Hediff_Pregnant.cs:34-55) and that brings a miscarriage with a 2-day MTB (:109); a Masochist (`DefDatabase<TraitDef>.GetNamedSilentFail("Masochist")`, Core Defs/TraitDefs/Traits_Singular.xml:185; `TraitDefOf` has no field for it) or, with Ideology, a pawn whose ideoligion holds `Pain_Idealized` (Ideology Defs/PreceptDefs/Precepts_Pain.xml:15-37, read through `Ideo.HasPrecept`, RimWorld/Ideo.cs:1307) under a beating, since pain gives it mood (Core Defs/ThoughtDefs/Thoughts_Situation_Traits.xml:5-30); a quest lodger or helper (RimWorld/QuestUtility.cs:524, 533) under any body, status or death entry; a missing DLC or sibling; a public entry with no court place. The hard-coded fallbacks of step 1 (a child's subdue becomes jail or warn) stay as they are for Subdue, the one entry the first release ships with them.
|
|
- "Offer harsh punishments" (setting, on): off, it disables Group beating and Execution corps in the picker; rows that already use them keep them, show a warning icon, and run "Instead".
|
|
- Severity still sets the default days, the reprimand stage and the court weight. `harshness` on each def (Warn 1, Talk down 1, Apology 1, Reprimand 1, Guilty 2, Jail and sentence castes 2, Shunned 2, Shaken faith 2, Lose own bedroom 2, Subdue 2, Subdue then jail 2, Group beating 3, Lose role 3, Excommunicate 3, Banish 4, Execute 4, Execution corps 4, Public execution 4; Trial, Jail then trial and Decide myself take the harshness of the punishment they end in) is set against the row's severity (Minor 1 to Grave 4) for reform; the picker shows "harsher than the act" when it is above.
|
|
- Rows saved before this step have no options, no alongside, `instead` Warn and `where` Private, which is exactly what they did.
|
|
- **Settings:** "Offer harsh punishments" (on).
|
|
- **Save and removal:** Names and numbers on `Law`. After removal the rows go with the component.
|
|
- **Overlaps:** Prisoner Sentencing (1.3k) offers a pickable list for prisoners; Laws offers one for colonists. Beat Your Prisoners (18.2k) and More Executions (1.2k) add their own; More Executions' methods apply to Laws' executions like any other.
|
|
- **Replaces:** The 150 px dropdown of step 1.
|
|
- **Effort:** M for the picker and options, S for alongside and "Instead".
|
|
- **Tests:** A 1.0.0 row loads with Warn as "Instead", no alongside entries and Private. Ticking Reprimand and Guilty beside Jail runs all three on one case. A Group beating row on a child runs "Instead"; on a Masochist the same; on a quest lodger the same; with Biotech, on a pregnant convict the same, and so does an Execution corps row. With "Offer harsh punishments" off the picker shows Group beating disabled with the reason, and an existing row warns and runs "Instead". In a `-NoDlc` run Excommunicate shows "Needs Ideology" and its row runs Shunned. An unknown option key reads as the default and logs nothing.
|
|
- **Risks:** About 25 entries; the picker draws only visible rows, as the act picker does. A row's alongside list can make one case run four punishments; the case log lists each.
|
|
|
|
#### Shunned
|
|
|
|
- **Players get:** For the row's days every colonist thinks less of the convict ("Shunned", -20 opinion) and the convict feels it ("Shunned by the colony", -6 mood). It is the core-game form of excommunication and runs alongside any main entry. A pardon ends it at once (see "Pardon, early release and longer sentences").
|
|
- **How:** Two situational ThoughtDefs of our own. The social one's worker overrides `CurrentSocialStateInternal(p, other)` (RimWorld/ThoughtWorker.cs:53) and is active when `other` is in the component's `HashSet<Pawn>` of shunned pawns and `p` is a free colonist other than the convict; vanilla checks every situational social def per pawn pair (RimWorld/ThoughtUtility.cs:11-18), so the worker reads one static bool first and costs one field read per pair while nobody is shunned. The mood one reads the same set. The end tick lives in the case; the 2500-tick sweep removes the pawn from the set.
|
|
- **Settings:** None beyond the row.
|
|
- **Save and removal:** Situational thoughts aren't saved (RimWorld/ThoughtHandler.cs:30-33). After removal both thoughts are simply gone.
|
|
- **Overlaps:** None.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S.
|
|
- **Tests:** A 3-day Shunned row: every colonist's opinion of the convict drops by 20 and the convict has the mood thought; both end after 3 days, survive phase 2 with the same time left, and the .rws holds no "BlaxLaws" thought. Performance run with 60 colonists and nobody shunned: no measurable cost.
|
|
|
|
#### Group beating
|
|
|
|
- **Players get:** Fabian's "Group beating". A held convict is beaten in turns by its beaters until it goes down in pain: bruises on torso and limbs, never the head, never a bionic part, never a scar, never death. A message names the beaters; they walk up and punch, with the melee animation and the punch sound. The convict lies "beaten down" (Decided 2026-12-03, item 8; not "unconscious": pain takes at most 0.4 off Consciousness, RimWorld/PawnCapacityWorker_Consciousness.cs:12, and a pawn is unconscious below 0.3, Verse/PawnCapacitiesHandler.cs:25-33), doctors tend it, and its Social tab shows "harmed me" -15 toward each beater for 10 days. Options: who beats (wardens, the default; anyone able; the victim first, then volunteers), how many (2, 3 or 4, or "everyone able", Fabian's "each colonist may beat": every colonist on the map who may beat takes one turn in order, at most 4 at once, until the convict goes down, with the same caps; the default is "everyone able", Decided 2026-12-03, item 9) and, from step 5, where. Harsh.
|
|
- **How:**
|
|
- Held convict: a jailed convict is beaten in its cell; a convict still in its break is beaten under Subdue's break rule; a free convict out of its break gets the vanilla `JobDefOf.Wait_MaintainPosture` job (RimWorld/JobDefOf.cs:18), started like Laws' other jobs with a 600-tick expiry and issued again while the beating runs (see "Rules every feature follows"), and ended when the beating ends. Without that the convict walks off: damage re-thinks only jobs that aren't player-forced (Verse.AI/Pawn_JobTracker.cs:982-988).
|
|
- Beaters: the enforcer pick of "Enforcement runs a tick later" plus violence (`WorkTagIsDisabled(WorkTags.Violent)`, Verse/Pawn.cs:4553), never Kind (`TraitDefOf.Kind`, RimWorld/TraitDefOf.cs:20), never the convict's family by blood (`relations.FamilyByBlood`, RimWorld/Pawn_RelationsTracker.cs:102), spouse or lover. Bloodlust and Psychopath pawns (RimWorld/TraitDefOf.cs:38, 16) come first among volunteers. "The victim first" reads the case's victim. At most 4 at once, since each needs an adjacent cell (`FollowAndMeleeAttack` hits only when `CanReachImmediate`, Verse.AI/Toils_Combat.cs:115-170).
|
|
- The job: the existing `BlaxLaws_Subdue` JobDef and `JobDriver_Subdue`, with the case's participant list in place of its single enforcer and a "held" variant whose fail condition is the convict leaving its hold, not its break. It stays non-suspendable and hidden from the save ("The subdue job never enters a save"). Hits are `SubdueHits` unchanged, so the caps (half the HP per part, nine tenths of the lethal sum, Verse/Pawn_HealthTracker.cs:73) read the convict's live injuries and hold for any number of beaters. Bruise has no scar, bleed or infection comp (Core Defs/HediffDefs/Hediffs_Local_Injuries.xml:383-400). The first hit that downs the convict (`ShouldBeDowned`, Verse/Pawn_HealthTracker.cs:642-648) ends every beater's job; the "no pain" ending (three painless hits in a row, 40 hits) counts hits per case, not per beater.
|
|
- Each hit gives the convict vanilla `HarmedMe` toward that beater (Verse/Pawn_HealthTracker.cs:383; -15 opinion, 10 days, one per other pawn, Core Defs/ThoughtDefs/Thoughts_Memory_Social.xml:195-207). That is the punishment's social price, named in the picker. A social fight (RimWorld/Pawn_InteractionsTracker.cs:373-381) or a vanilla melee verb isn't used: the convict would hit back (RimWorld/Verb_MeleeAttack.cs:34-38) and fists can hit the head.
|
|
- No Ideology precept judges a beating and no HistoryEventDef is added (it would be saved in a `DefMap`).
|
|
- **Settings:** "Offer harsh punishments".
|
|
- **Save and removal:** Nothing saved on any pawn; the participant list in the case. The wait job is vanilla.
|
|
- **Overlaps:** Beat Your Prisoners (Continued) (2902220334, 18.2k) beats prisoners with its own work type; Laws beats colonists with no work type. War Crimes Expanded 2's torture stays theirs.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S for the participant list and the held variant, S for the pick and options.
|
|
- **Tests:** A did-it case with a 3-beater group beating on a free colonist: three beaters, the convict on `Wait_MaintainPosture` until down, only Bruise injuries, every part at half HP or more, injuries at nine tenths of the lethal sum or less, `HarmedMe` toward each beater, no beater guilty, the convict's `meleeThreat` null. A Kind colonist and the convict's spouse are never picked. The same in a cell for a jailed convict. "Everyone able" with 7 eligible colonists: each takes a turn, never more than 4 adjacent at once. Save mid-beating: the .rws holds no "BlaxLaws_Subdue"; after the load, with Laws loaded and without it, the convict takes a normal job within 600 ticks. A go-juice convict ends with one message after three painless hits. A raid calls it off; the case waits.
|
|
- **Risks:** Tone: this lifts "no flogging" for one capped entry (Decided 2026-12-03, item 1); it reuses Subdue's caps and sits behind "Offer harsh punishments". Several beaters can sour the convict on several wardens at once, which can feed a social fight; the picker says so. Heavily bionic or painless convicts may never go down and get the "no pain" ending.
|
|
|
|
#### Execution corps
|
|
|
|
- **Players get:** Fabian's "Execution corps". Always confirmed in a dialog that names the squad, the distance and the chance that every shot misses. The convict walks to a wall, the squad of 1 to 6 colonists with their own guns takes its marks, aims (the warm-up lines show) and starts one volley; once the convict goes down, a shooter still aiming holds fire. Dead: the colony gets the same -2 "justified execution" as a cut execution (Decided 2026-12-03, item 2). Every shot missed: the convict walks free, pardoned, with "Spared by the squad" and the best reform odds. Struck but alive: by default free and tended too ("Defaults I picked"); the row option "A warden finishes it" sets vanilla's execution instead. The dialog says that a struck survivor may still die of its wounds, and that such a death counts as the execution. Options: squad size (1 to 6, default 1, Fabian's "shoot 1 time"), distance (5 to 10 cells, default 8), struck survivor (walks free / a warden finishes it). The defaults keep walking free a real chance; the picker row and the dialog show the figure for the row's squad and distance. Harsh.
|
|
- **How:**
|
|
- Placing: a standable cell next to a building whose `def.Fillage` is Full (Verse/ThingDef.cs:607), with standable cells for the squad at the set distance from which `Verb.CanHitTargetFrom` (Verse/Verb.cs:717) holds, since `Stance_Warmup` drops a shooter's aim without it (Verse/Stance_Warmup.cs:199-203): the wall nearest the court place when the row's "where" is the court place (step 5), else the wall nearest the convict. A prison cell is usually too small for a squad at 5 cells or more, so a jailed convict is brought out of its cell by a warden to the wall nearest its cell that passes the check (vanilla `DeliverToCell`, the job `JobGiver_DeliverPawnToCell` gives, RimWorld/JobGiver_DeliverPawnToCell.cs:35; see "To verify"). When no wall within reach passes, the confirm dialog refuses with "No room to stand the squad". A free convict walks there itself (forced vanilla `Goto`, then `Wait_MaintainPosture`, RimWorld/JobDefOf.cs:10, 18); shooters stand in a row at the distance on vanilla `Wait` (:14). Every wait job has the 600-tick expiry of "Rules every feature follows". A private run needs no lord; Laws drives it from the component's tick while it runs and never saves it, so a load mid-run calls it off, the component's `LoadedGame` ends the saved wait jobs of the convict and the squad, and the case waits for a new confirm.
|
|
- The wall gives the convict no cover, since cover only counts within 65 degrees of the shooter's direction (Verse/CoverUtility.cs:48-100), and it stops the misses that fly through it (Verse/Projectile.cs:355-361). A wild miss gets a new destination in a random direction around the convict, only forward of the shooter (Verse/ShootLine.cs:25-40, from Verse/Verb_LaunchProjectile.cs:155), so it can land beside or short of the convict and damage a building or item there, never a pawn (`preventFriendlyFire` and no `NonTargetPawns`, below). The placing rule prefers a wall with open ground on both sides.
|
|
- Shooters: free adult colonists able to do violence, never Kind, never kin, spouse or lover of the convict, holding a ranged weapon whose verb (`equipment.Primary`, Verse/Pawn_EquipmentTracker.cs:16; `CompEquippable.PrimaryVerb`, Verse/CompEquippable.cs:15) has `ForcedMissRadius` of 0.5 or less and doesn't `CausesExplosion` (Verse/VerbProperties.cs:284, 300). A burst weapon counts as `BurstShotCount` shots (Verse/Verb.cs:243) in the odds.
|
|
- The volley: Laws starts every shooter's cast in the same tick, each with `verb.TryStartCastOn(convict, surpriseAttack: false, canHitNonTargetPawns: false, preventFriendlyFire: true)` (Verse/Verb.cs:319). The shots still don't land together: each shooter warms up for `WarmupTime` x `AimingDelayFactor` (Verse/Verb.cs:349-357), which differs by weapon and pawn, and once the convict is downed, `Stance_Warmup` cancels every warm-up that started while it stood (Verse/Stance_Warmup.cs:194-197), so those shooters hold fire. The run ends when every shooter has fired or been cancelled. With that flag every branch of `Verb_LaunchProjectile.TryCastShot` drops `NonTargetPawns` (Verse/Verb_LaunchProjectile.cs:140-142, 159, 171, 179), so no spectator can be hit (Verse/Projectile.cs:449-495). `AttackStatic` and `Pawn.TryStartAttack` aren't used: they force `canHitNonTargetPawns` true (Verse/Pawn.cs:2970-2983). The direct cast skips two vanilla checks, so Laws runs both itself: the Violent work tag, and with Ideology `new HistoryEvent(HistoryEventDefOf.ExecutedColonist, shooter.Named(HistoryEventArgsNames.Doer)).Notify_PawnAboutToDo_Job()` (RimWorld/IdeoUtility.cs:109), as `WorkGiver_ExecuteGuiltyColonist` does (:43); a refusing shooter is left out.
|
|
- Guilt of the shooters: a bullet from an undrafted shooter carries `instigatorGuilty` (RimWorld/Bullet.cs:22-23), and a hit on a pawn whose home faction is the player's makes the shooter guilty (Verse/Pawn_HealthTracker.cs:321-329). The shooters stand undrafted on `Wait`, so before the volley Laws stores each shooter's `IsGuilty` and `TicksUntilInnocent` (RimWorld/Pawn_GuiltTracker.cs:15, 31), and after the run ends it writes them back with `Notify_Guilty(ticks)` (:46), `Notify_Guilty(0)` for one who wasn't guilty. No shooter carries guilt from the volley.
|
|
- Guilt of the convict: Laws calls `convict.guilt.Notify_Guilty()` (RimWorld/Pawn_GuiltTracker.cs:46) when the volley starts, so a convict whose guilty days ran out in jail or while the volley waited for the court hour is still guilty at death; "Walks free" clears it again.
|
|
- Odds: p per shot is `ShotReport.HitReportFor(shooter, verb, convict).TotalEstimatedHitChance` (Verse/ShotReport.cs:78, 82); the chance of walking free is the product of (1 - p) over every shot. That holds although shooters hold fire after a downing hit, because a full miss means nobody downed the convict, so every shot was taken. The picker row and the confirm dialog show an estimate, and the "Fire" step, once everyone stands at its mark, shows the exact figure from their real cells. The distance stays 5 cells or more.
|
|
- A convict wearing a shield belt (`CompShield`, RimWorld/CompShield.cs:9): the dialog won't start and says to take it off. Laws never takes apparel itself.
|
|
- Hit or miss: after every shooter has fired or been cancelled and the last projectile has landed, Laws compares `mindState.lastRangedHarmTick` (Verse.AI/Pawn_MindState.cs:133) with the volley's start tick. A downed convict counts as struck.
|
|
- Dead: a bullet is no execution, since only ExecutionCut has `execution` true (Core Defs/DamageDefs/Damages_Medical.xml:19-23), so vanilla would give `WitnessedDeathAlly` -5, `KnowColonistDied` -3 and killed-my-relation thoughts aimed at one shooter (RimWorld/PawnDiedOrDownedThoughtsUtility.cs:161-216, 274-300). Hook T, a postfix on `GetThoughts` (:73), strips `WitnessedDeathAlly`, `WitnessedDeathNonAlly` and `KnowColonistDied` from both output lists and turns the relation thoughts aimed at the shooter into the plain death ones, only for a victim in the component's `HashSet<Pawn>` of squad victims; it returns after one bool read while the set is empty. Then Laws calls `ThoughtUtility.GiveThoughtsForPawnExecuted(victim, squadLeader, PawnExecutionKind.GenericBrutal)` (RimWorld/ThoughtUtility.cs:21), which gives stage 0 only while the victim `IsGuilty` (:28-41), hence the guilt set at the volley's start.
|
|
- A struck survivor stays in the squad-victim set until its `hediffSet.BleedRateTotal` (Verse/HediffSet.cs:69) is 0 or for 2 days, whichever comes first. A death in that window is the volley's death: hook T strips the death thoughts as during the run, and on the next tick Laws sets guilt on the dead convict again and calls `GiveThoughtsForPawnExecuted` as above.
|
|
- Walks free: Pardon, `Notify_Guilty(0)` and `awaitingExecution = false` (RimWorld/Pawn_GuiltTracker.cs:9, 46-49); a jailed convict gets Release. The case closes as "Spared". "Spared by the squad" is a situational thought (+10 for 10 days) read from the case. A struck survivor keeps vanilla `HarmedMe` toward each shooter who hit.
|
|
- "A warden finishes it": `awaitingExecution` for a free convict, which `WorkGiver_ExecuteGuiltyColonist` carries out with the cut (RimWorld/WorkGiver_ExecuteGuiltyColonist.cs:31-48; RimWorld/JobDriver_ExecuteGuiltyColonist.cs:16-30), or the vanilla Execution mode for a jailed one.
|
|
- Abort: danger, a break, a dropped wait job or a shooter drafted before the volley ends the run; the case stays open and nothing stays on any pawn.
|
|
- **Settings:** "Offer harsh punishments".
|
|
- **Save and removal:** The run isn't saved; the case records the result. Projectiles, wounds and thoughts are vanilla.
|
|
- **Overlaps:** Execution Mod (2186151886, 2.6k, 1.1 and 1.2 only) had public executions and years of unanswered firing-squad requests. More Executions (3819037971) has the electric chair, guillotine and gallows with art; the execution corps uses the colonists' own guns and no building.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** M.
|
|
- **Tests:** With a test seed: a 4-shooter volley at 6 cells, the shown odds match the product of the hit reports. No shooter is guilty after a volley that hits, and a shooter guilty before keeps its old time left. With shooters of different warm-ups, the first downing hit cancels the others and the run still ends with one result. A convict jailed past its guilt, shot dead, gives `KnowColonistExecuted` stage 0. A struck survivor that bleeds out within 2 days gives the execution thoughts, not `WitnessedDeathAlly`. A jailed convict in a 3 by 3 cell is brought out to a wall with room for the squad; with no such wall the dialog refuses. Save mid-volley: after the load, with Laws loaded and without it, the convict and the shooters take normal jobs within 600 ticks. Spectators standing beside the line of fire are never hit over 50 seeded volleys. A dead guilty convict gives every colonist `KnowColonistExecuted` stage 0 and no `WitnessedDeathAlly` or `KnowColonistDied`; its spouse keeps its grief. A forced full miss leaves the convict free, not guilty, with "Spared by the squad". A forced hit that leaves it alive frees it by default and sets `awaitingExecution` with the option. A pacifist with a rifle is never in the squad. A shield belt blocks the dialog. A raid mid-run calls it off.
|
|
- **Risks:** A jailed convict is a prisoner, so `TryGiveThoughts` also records the prisoner-death events before `GetThoughts` (RimWorld/PawnDiedOrDownedThoughtsUtility.cs:17-63), and Ideology precepts react to an executed prisoner, not a colonist (see "To verify"). A miss that frees is a gamble, not justice: it is always confirmed, never automatic, and the odds are shown. Misses damage the wall, and wild misses beside or short of the convict can damage furniture and items standing there.
|
|
|
|
#### Excommunicate and shaken faith
|
|
|
|
- **Players get:** Fabian's "Excommunicate", with Ideology: the convict is shunned (see "Shunned"), stripped of its ideoligion role for the row's days or for good (option), and its certainty drops by 20, 40 or 60 points (option, default 60), shown as the floating "Certainty 80% -> 20%" text. It keeps its ideoligion, its spouse and its bed. Certainty grows back with mood on its own, and a converter has an easy time with the convict meanwhile. "Shaken faith" is the certainty cut alone (20, 40 or 60), as a main or alongside entry. A pardon ends the shunning and gives the role back if nobody holds it, "for good" included; the certainty cut isn't given back and grows back with mood. Without Ideology both show "Needs Ideology", and Excommunicate's "Instead" is Shunned.
|
|
- **How:**
|
|
- Certainty: `pawn.ideo.OffsetCertainty(-x)` (RimWorld/Pawn_IdeoTracker.cs:360), behind `ModsConfig.IdeologyActive`, since the method's `ModLister.CheckIdeology` (:362) is an install check. It does nothing in a classic ideoligion (:362), so there the entry only shuns and strips the role, and Shaken faith shows disabled. A certainty of 0 or less is re-rolled at random on load (:413-416), so if the result is below 1%, Laws calls `Reassure` (:355) by the difference. Certainty rises with mood by itself (`ConversionTuning.CertaintyPerDayByMoodCurve`, RimWorld/ConversionTuning.cs:37-42).
|
|
- Role: the role give-back of "Lose own bedroom and lose role".
|
|
- `SetIdeo` is never called: it records `ChangedIdeo`, can unclaim the bed and removes spouses and bonds, and switching back undoes none of it (RimWorld/Pawn_IdeoTracker.cs:183-241).
|
|
- **Settings:** None beyond the row.
|
|
- **Save and removal:** Certainty is vanilla; the role snapshot is in the case. After removal a role held back for the row's days stays lost; the player assigns it again by hand.
|
|
- **Overlaps:** None.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S.
|
|
- **Tests:** With Ideology: a 60-point cut on a pawn at 80% leaves 20%; on a pawn at 30% leaves 1% or more, and after phase 2 the same value, not a re-roll. A classic-mode run leaves certainty untouched and the role stripped. A `-NoDlc` run shows "Needs Ideology" and runs Shunned.
|
|
|
|
### Enforcement and punishments, step 5: punishments in public
|
|
|
|
Needs step 4 and Court step 2's court place and session lord.
|
|
|
|
#### Punishments in public
|
|
|
|
- **Players get:** Reprimand, Group beating and Execution corps gain "Where: in private / at the court place"; Apology gains it once Apology is built. At the court place the case waits for the court hour (the "Court hour" setting now times these too) or for "Carry out now" in the Cases tab. The convict is brought to the place, the punishers walk up, and free colonists gather and watch, seated in chairs facing the table or standing behind them. A reprimand becomes a public reprimand: the judge, or else the leader, speaks in bubbles for about an hour and the convict's thought is one stage harsher. A "Call off" button sits on the court place and on the case in the Cases tab while it runs. Spectators get "Saw justice done" for a day (+2; a Kind spectator at a beating or a shooting -4; a Bloodlust spectator +4), and for 10 days the break the convict was punished for is half as likely for them.
|
|
- **How:**
|
|
- `LordJob_BlaxPunishment`, a sibling of `LordJob_BlaxCourtSession` on `LordJob_Joinable_Gathering` (RimWorld/LordJob_Joinable_Gathering.cs:7; its abstract `CreateGatheringToil`, :38, is filled with Laws' own toil). Core duties only: for a jailed convict a warden gets DeliverPawnToCell (Core Defs/DutyDefs/Duties_Rituals.xml:55) with `focus` the convict's cell and `focusSecond` the convict, and carries or leads it there (`JobGiver_DeliverPawnToCell` reads the pawn from the holder's `focusSecond` and gives the holder a `DeliverToCell` job, RimWorld/JobGiver_DeliverPawnToCell.cs:20-36); a free convict gets ArriveToCell itself (:5), as the punishers and the speaker do; Spectate around the place for the crowd (Core Defs/DutyDefs/Duties_Gatherings.xml:55), with `PawnDuty.spectateRect` set to the place's `OccupiedRect()` (Verse.AI/PawnDuty.cs:21-25), as `LordToil_Speech` does (RimWorld/LordToil_Speech.cs:20-24), so `SpectatorCellFinder` uses the chairs facing it (RimWorld/SpectatorCellFinder.cs:18, 147), and SpectateCircle (Duties_Gatherings.xml:67) for a beating. `DutyDefOf` has `Spectate` (RimWorld/DutyDefOf.cs:126) but no ArriveToCell, DeliverPawnToCell or SpectateCircle, so Laws reaches those core defs through its own `[DefOf]` class. Laws adds no DutyDef, as for court sessions.
|
|
- The violence inside runs from the lord toil: the group beating's jobs and the execution corps' volley, as in private, with the wall nearest the place. That state is never saved, so on load (the LordJob's `ExposeData` in `PostLoadInit`, or its first `LordJobTick`) a `LordJob_BlaxPunishment` whose toil is past the gathering stage ends its lord: the case stays open, and an execution corps needs a new confirm, so a load never fires a second volley. A lord still gathering keeps running.
|
|
- The lord takes the court place with `Lord.AddBuilding` (Verse.AI.Group/Lord.cs:455), so `Building.GetGizmos` finds it through `GetLord` (Verse.AI.Group/LordUtility.cs:18; Verse/Building.cs:441-449). The toil's update re-checks the place's `Spawned`, `Faction` and `Destroyed` and ends the lord when one fails (the call-off rule in "Rules every feature follows"); the case waits.
|
|
- One gathering at a time: a waiting public punishment checks `GatheringsUtility.AnyLordJobPreventsNewGatherings` (RimWorld/GatheringsUtility.cs:123) and waits for the next court hour while a party, ritual or session runs. Speech bubbles through `MoteMaker.MakeInteractionBubble` (RimWorld/MoteMaker.cs:181), as for court sessions.
|
|
- "Call off" comes from the toil's `GetBuildingGizmos` (Verse.AI.Group/LordToil.cs:84), which vanilla calls from `Building.GetGizmos` for a building its lord owns, so no patch, and from a button on the case in the Cases tab, which needs no building.
|
|
- Witness effects: spectators the lord held at the end go into a component list with an end tick. "Saw justice done" is a situational thought reading it. Deterrence is hook W: the postfix on `CommonalityFor` multiplies by 0.5 when the pawn is in the witness list for that break def; it runs only when a break is rolled (Verse.AI/MentalBreaker.cs:311-328) and reads one bool while the list is empty.
|
|
- **Settings:** "Court hour" (shared with "Court on its own").
|
|
- **Save and removal:** A running public punishment is a vanilla lord with our LordJob class, like a session, so the removal button ends it ("Remove Blax Laws from a game"). Witness lists and thoughts vanish after removal.
|
|
- **Overlaps:** Party and ritual mods block a public punishment while their gathering runs. Ideology's execution, duel and mutilation rituals stage punishments the same way.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** M for the lord, S for the witness effects.
|
|
- **Tests:** A public reprimand in a `-NoDlc` run at a table: the convict reaches the place, at least three spectators sit or stand around it, the convict's thought is one stage harsher, and every spectator has "Saw justice done". A Kind spectator at a beating has -4. A witness's weight for the punished break is half for 10 days, then whole. A party running at the court hour makes it wait for the next day. A drafted punisher calls it off. Deconstructing the table mid-reprimand ends the lord and the case waits. A save in a public beating's violence toil: after the load the lord has ended and the case waits. Phase 3 with a public punishment running and the removal button pressed: no Laws error and no lord left with our job.
|
|
|
|
### Sentences, step 1: serve and come back
|
|
|
|
#### Jail for N days
|
|
|
|
- **Players get:** The offender is arrested, sits out the sentence in a prisoner bed and goes back to work. A letter names the sentence and the release day. The case log counts down. While jailed, the pawn keeps its work priorities and, with Blax Castes, returns to its old caste.
|
|
- **How:**
|
|
- Conviction: guilt for the sentence length when the case is filed (see "Warn and guilty"). The arrest can come days later (no prisoner bed, a hold until "Arrest now", no enforcer, a raid), and guilt counts down meanwhile (RimWorld/Pawn_GuiltTracker.cs:51-61). Once it has run out, the arrest falls back to the arrester's `ArrestSuccessChance` (Verse/Pawn.cs:4087, 4099), a refusal is berserk (:4132-4135), and a downed colonist can't be captured (Verse.AI/GenAI.cs:39-67). So right before every Arrest or Capture job Laws calls `Notify_Guilty(Math.Max(TicksUntilInnocent, sentence ticks + 60000))`, the extra day covering the release fallback, and the release tick counts from the capture, not from filing.
|
|
- Bed: `RestUtility.FindBedFor(offender, enforcer, checkSocialProperness: false, ignoreOtherReservations: false, GuestStatus.Prisoner)`, then with `ignoreOtherReservations: true`, as the arrest float menu does (RimWorld/FloatMenuOptionProvider_Arrest.cs:41-49). A bed from the second search must still pass `CanReserve` (see "Enforcement runs a tick later"). No bed: a letter, the case waits, and the 2500-tick sweep retries.
|
|
- The old bed: the arrest job's first toil, `Toils_Bed.ClaimBedIfNonMedical(TargetIndex.B, TargetIndex.A)` (RimWorld/JobDriver_TakeToBed.cs:73; RimWorld/Toils_Bed.cs:40-51), makes the offender claim the prisoner bed, which unclaims its own (RimWorld/Pawn_Ownership.cs:125-138). That happens before the arrest check and the capture. If the job then fails, its finish action only gives up the prisoner bed (JobDriver_TakeToBed.cs:74-80). So Laws stores `ownership.OwnedBed` in the case right before it starts the Arrest or Capture job, and when the job ends without the pawn becoming `IsPrisonerOfColony`, the sweep reclaims that bed with `ClaimBedIfNonMedical` if it is still free.
|
|
- 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.
|
|
- 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' 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).
|
|
- 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.
|
|
- 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. In the first release, and later 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: 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.
|
|
- **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. Prison Labor (1899474310): while its "Force to work" option is on (its default for every new prisoner), its JobGiver_Labor runs `WorkSettings.InitWorkSettings`, which disables each work type its settings bar prisoners from (`WorkSettings.WorkDisabled`, `Pawn_WorkSettings.Disable`); those priorities stay at 0 after the release. Laws leaves that toggle and the priorities alone: turn the option off on a jailed colonist to keep them.
|
|
- **Replaces:** The manual arrest-and-release cycle.
|
|
- **Effort:** S plus S plus S, hook K included.
|
|
- **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.
|
|
- 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: with it off the same work priorities as before the arrest after the release; with it on only the work types Prison Labor bars prisoners from (`WorkSettings.WorkDisabled`) may read 0 afterwards (Overlaps and the README say so). The 3-day jail test allows the same when the option was on at the capture.
|
|
- 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. Other colonists get beds of their own first: a bedless one that goes to sleep before the sweep takes the freed bed (RimWorld/RestUtility.cs:294-324), which is the second case.
|
|
- 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.
|
|
- 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 pawn that gets a role or a mech while its case waits for a bed is held, not arrested; "Arrest now" survives phase 2, and a failed arrest after the reload retries without a second hold; 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.
|
|
- **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.
|
|
|
|
#### 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 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 "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 "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.
|
|
- **Replaces:** Nothing.
|
|
- **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.
|
|
|
|
#### Pardon, early release and longer sentences
|
|
|
|
- **Players get:** On a jailed case: "Release now", "Add days" and "Pardon". On any other open case: "Pardon". On a closed case whose role was taken "for good": "Pardon", until "Keep closed cases" prunes the case. "Release now" ends only the confinement, jail or a sentence caste; the case's other timed punishments run on. "Pardon" is the way out of everything: it ends guilt and every timed punishment on the case at once (jail, Guilty, Shunned, Lose own bedroom, Lose role, a role taken "for good" included, Excommunicate's shunning and role, and a sentence caste), runs the give-back, so the bed and role come back if nobody else holds them, and closes the case as pardoned. Certainty lost to Excommunicate or Shaken faith isn't given back; it grows back with mood. A pardon gives no reform roll, since nothing was served. A pardon never needs a warden's walk when the pawn isn't jailed. Decided 2026-12-03, item 7.
|
|
- **How:** Release uses the same Release mode as a served sentence. Pardon is `Notify_Guilty(0)` and `awaitingExecution = false` (RimWorld/Pawn_GuiltTracker.cs:9, 46-49), then, in the same tick, it sets every end tick on the case to now, removes the pawn from the component's shunned and bedroom-loser sets, calls Castes' `EndSentence` for a sentence caste (once Castes' sentence members are bound), and runs the give-back of "Release gives back what jail took" on the case's snapshot, the role included even with "For good". A pardoned jailed convict is released as for "Release now". "Add days" stops at 50 days in total while Castes' API version 2 isn't bound, so the pawn stays inside Castes' 60-day memory of its old caste; with version 2 the `blax.laws.jailed` hint keeps that memory however long the sentence runs.
|
|
- **Save and removal:** Only the case's fields change. A case closed with a role taken "for good" keeps its snapshot until it is pruned; after that, or after removal, only a manual reassign gives the role back.
|
|
- **Overlaps:** None.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S.
|
|
- **Tests:** "Release now" releases within a warden's trip and leaves a Shunned alongside entry running; "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. "Pardon" on a case with jail, Shunned and Lose own bedroom ends all three in one tick and gives the bed back if free. "Pardon" on a closed case with "Lose role, for good" gives the role back if free, and does nothing to it if someone holds it.
|
|
|
|
#### Lose own bedroom and lose role
|
|
|
|
- **Players get:** Two status punishments for N days, as a main entry or alongside another one. "Lose own bedroom": the convict gives up its bed and may own no bed in a room of its own until the days are served; it sleeps in a barracks bed or wherever vanilla puts it, and gets vanilla's "slept in barracks" (-4 to -7, Core Defs/ThoughtDefs/Thoughts_Memory_RoomStats.xml:158-175) each morning. "Lose role" (Ideology): the convict loses its ideoligion role with vanilla's "role lost" thought, and the role comes back at the end if nobody holds it; with "For good" it comes back only through a pardon. A pardon ends both early. Both give back through the release give-back, so a bed or role someone took meanwhile stays theirs and the message names it. A partner who shared the bed keeps it.
|
|
- **How:**
|
|
- Bedroom: Laws stores `ownership.OwnedBed` (RimWorld/Pawn_Ownership.cs:12) in the case's give-back snapshot and calls `UnclaimBed` (:157). Laws never claims a barracks bed for the convict: `ClaimBedIfNonMedical` (:125) would evict the last owner of a full bed (:139-142), and beds by zone are Zones'. To keep the convict from claiming a bedroom bed, its own included, hook V, a postfix on `RestUtility.IsValidBedFor` (RimWorld/RestUtility.cs:160), sets the result false when the sleeper is in the component's `HashSet<Pawn>` of bedroom losers and the bed's room has the role `RoomRoleDefOf.Bedroom` (RimWorld/RoomRoleDefOf.cs:10); it reads one bool while the set is empty. It leaves the result alone for a sleeper that is `Downed` or for which `HealthAIUtility.ShouldSeekMedicalRest` (RimWorld/HealthAIUtility.cs:23) is true, so a convict downed by a group beating or struck by the squad can be rescued to the only free bed even in a bedroom. At the end Laws reclaims the stored bed with `ClaimBedIfNonMedical` only when nobody owns it.
|
|
- Role: `Precept_RoleSingle.Unassign(p, true)` (RimWorld/Precept_RoleSingle.cs:140) or `Precept_RoleMulti.Unassign(p, true)` (RimWorld/Precept_RoleMulti.cs:87), which add vanilla `IdeoRoleLost`. The role goes into the same snapshot jail uses, and at the end `Assign(p, false)` (RimWorld/Precept_RoleSingle.cs:73) if it is still free. Behind `ModsConfig.IdeologyActive`.
|
|
- Jail plus either: the snapshot is taken once; the release gives back only what the status punishment doesn't still hold back.
|
|
- **Settings:** None beyond the row.
|
|
- **Save and removal:** The snapshot and end tick live in the case. After removal the bed and role stay with whoever has them; the convict picks a free bed again by vanilla's rule.
|
|
- **Overlaps:** Blax Zones' sleeping zones by caste may give a sentence caste a barracks zone; the two compose.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S plus S.
|
|
- **Tests:** A 3-day "Lose own bedroom": the convict owns no bed in a bedroom for 3 days, also after phase 2, sleeps in a barracks bed, and owns its old bed again at the end; if another colonist claimed it meanwhile, it stays theirs. "Lose role" with Ideology: the role is empty or someone else's, and comes back at the end if free; "For good" doesn't give it back at the end, and a pardon does if it is free. In a `-NoDlc` run "Lose role" shows "Needs Ideology". A downed bedroom loser is carried to a bedroom bed when no other bed is free.
|
|
- **Risks:** The player can reassign beds by hand during the sentence; the postfix only stops the convict from choosing a bedroom bed, and a forced player assignment stays the player's call.
|
|
|
|
### Sentences, step 2: with the sibling mods
|
|
|
|
Each part waits for its sibling. Sentence castes are New in `docs/features.md`, not specced: each daily-life punishment (bread and water, hard labour, no recreation, dry, rags, confinement, and any caste the player marks for sentences) is a Castes caste the convict holds for the row's days, through the sentence members Castes adds as its area 5, step 5, after its join API (Decided 2026-12-03, item 4). What the spec builds on: vanilla seeds Simple and Paste food policies (RimWorld/FoodRestrictionDatabase.cs:101-123), and a warden respects a prisoner's food policy, so bread and water works in jail (RimWorld/Pawn_FoodRestrictionTracker.cs:34-74); Work hours block joy (Core Defs/Misc/TimeAssignmentDefs/TimeAssignments.xml:10-16), but a prisoner's timetable reads Anything (RimWorld/Pawn_TimetableTracker.cs:12-22), so the schedule entries do nothing in jail and the picker says so; vanilla's no-drugs policy keeps every addiction drug allowed (Core Defs/DrugPolicyDefs/DrugPolicyDefs.xml:19-22; RimWorld/DrugPolicy.cs:66-75); a rags outfit caps hit points and quality (Verse/ThingFilter.cs:182, 220), and a convict with no stored rags goes naked (RimWorld/JobGiver_OptimizeApparel.cs:133). One caste per pawn, so stacked daily-life punishments need a combined caste. Indenture as a sentence is an idea there.
|
|
|
|
#### Castes keeps the caste
|
|
|
|
- **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, or right before a jailed slave is made a slave again ("Jail for slaves") (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.
|
|
- **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' prisoner caste set to Enslave, a hinted pawn's mode is MaintainOnly two ticks after the capture.
|
|
|
|
#### Jail for slaves
|
|
|
|
- **Players get:** Jail rows apply to slaves. A jailed slave is a slave again when the sentence ends, and stays on the map.
|
|
- **How:** Arresting a slave sets its old faction (RimWorld/Pawn_GuestTracker.cs:479-482); a release would send it off the map (RimWorld/GenGuest.cs:14-19). At the end Laws calls `guest.SetGuestStatus(Faction.OfPlayer, GuestStatus.Slave)` (RimWorld/Pawn_GuestTracker.cs:485-507) instead of releasing, with Castes' `blax.laws.released` hint right before it, since hook L's release prefix doesn't run on this path ("Castes keeps the caste"). That skips `GenGuest.TryEnslavePrisoner` (RimWorld/GenGuest.cs:127-155), so no `EnslavedPrisoner` precept event fires. A slave in a break isn't `IsColonist` (Verse/Pawn.cs:518-527), so guilt doesn't make its arrest certain; the arrester's Social decides, and a refusal is vanilla's berserk.
|
|
- Indentured slaves: before the arrest Laws reads `SlavesApi.TermDaysLeft`. In Blax Slaves' plan an arrest ends an indentured term like any imprisonment, so without help the re-enslave at the end would leave an indentured servant a slave for life. Slaves ships a member that keeps the term through a Laws sentence with its indentured servitude. While a term runs and that member isn't bound, Laws doesn't jail: the row falls back to subdue while the slave is in its break, else to warn, as for slaves without this feature. With the member bound, Laws calls it from hook K's prefix, right before the capture, and jails as for any slave.
|
|
- **Needs:** Ideology; without it the option doesn't exist, since there are no slaves.
|
|
- **Save and removal:** The case remembers that the prisoner was a slave. After removal a jailed slave stays a prisoner of its old faction in your prison, as vanilla's Imprison mode leaves it.
|
|
- **Overlaps:** Vanilla's Imprison slave mode does the arrest by hand; Laws adds the way back.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S.
|
|
- **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. With Slaves in `-Compat` once it ships indentured servitude, an indentured slave with a jail row is jailed through the term member and afterwards is a slave with the same term end; with the member left unbound by a test switch, it is subdued or warned, never jailed. Skipped without Ideology.
|
|
- **Risks:** This writes slave status, which Blax Slaves owns. It only puts back the status the sentence took; Fabian allowed it on 2026-12-01, together with the term member.
|
|
|
|
### Repeat offenders, step 1: the record and reform
|
|
|
|
Not specced yet: the criminal record and probation (step 1), escalation (step 2) (see `docs/features.md`). Step 1 needs the first release's cases, probation also "Pardon, early release and longer sentences". The record keeps convictions after "Keep closed cases" prunes them (7 to 360 days), so the court's repeat term reads the record, never closed cases. Reform reads the record's count and keeps the tick of the last trait step in it; escalation (step 2) reads a reformed mark there and softens by one step, and a relapse within 60 days cancels that.
|
|
|
|
#### Reform
|
|
|
|
- **Players get:** Fabian's third ask. Every punishment that leaves the convict in the colony can change it, lightest first:
|
|
1. "Paid my debt", +4 mood for 6 days after a served punishment, which offsets vanilla's "was imprisoned" (-6 for 12 days, RimWorld/GenGuest.cs:8-12). After a survived execution corps it is "Spared by the squad", +10 for 10 days. When the punishment's harshness is above the act's severity it becomes "Resents my sentence", -4 for 6 days, plus a social "Sentenced me" (-10) toward the judge or enforcer, and no trait roll.
|
|
2. "Fresh start": the mental break threshold is 3 points lower for 15 days, shown as "Served a sentence" in the stat's explanation; and for 30 days the break it was punished for is half as likely, shown on the case and the record.
|
|
3. Rarely, one vanilla trait step away from the vice tied to the act, with a positive letter ("Ana is no longer a pyromaniac") and a line in the record:
|
|
|
|
| Punished act | Trait step |
|
|
|---|---|
|
|
| A drug binge, a drug against the policy, an Ate drug entry | Drug desire: chemical fascination to chemical interest, interest to none (Core Defs/TraitDefs/Traits_Spectrum.xml:37-64); never to teetotaler. At none the chemical need switches off (RimWorld/Need_Chemical_Any.cs:159-169) |
|
|
| Fire-starting spree, set a fire | Pyromaniac removed (Core Defs/TraitDefs/Traits_Singular.xml:333-358) |
|
|
| Insult, slight, insulting spree | Abrasive removed (Traits_Singular.xml:108-124; x2.3 negative interactions, RimWorld/NegativeInteractionUtility.cs:39-42) |
|
|
| Social fight, assault, tantrum, murderous or sadistic rage | Bloodlust removed (Traits_Singular.xml:16-33) |
|
|
| Food binge | Gourmand removed (Traits_Singular.xml:565-579; its only allowed break is the food binge) |
|
|
| Any other break, second conviction or later | Nerves: volatile to nervous, nervous to none (Traits_Spectrum.xml:94-140); never above none |
|
|
|
|
The picker and the case show the odds. Setting "Reform": "Temporary effects and traits" (default), "Temporary effects only" (layers 1 and 2), "Off".
|
|
- **How:**
|
|
- When: one roll as a punishment ends with the convict in the colony: hook L's postfix for jail, the 2500-tick sweep at a timed punishment's end tick (guilty, shunned, lose bedroom or role, excommunicate, sentence castes; an excommunication with the role taken "for good" rolls when its shunning ends), the cut itself for Shaken faith, the end of a beating or a volley, the verdict for a court case. Warn, Talk down, Banish, Execute, Public execution and a pardon give no trait roll; a struck convict a warden finishes gives none either.
|
|
- Odds: P = base x fit x judge x record x mood, capped at 35%. Base from `reformBase`: Reprimand 3%, Guilty and Shunned 4%, public reprimand 5%, Subdue and Group beating 6%, Apology 8%, Lose role 3%, Shaken faith 3%, Excommunicate 5%, Jail 2% per day served up to 20%, a sentence caste 1% per day up to 15%, Lose own bedroom 1% per day up to 10%, spared by the squad (every shot missed) 30%, a struck survivor who walks free 15%. Trial, Jail then trial and Decide myself take the base of the punishment they end in; an acquittal gives no roll. When a row runs several entries at once (a main entry and its alongside entries), the highest base counts, and the case still rolls once. Fit: 1 if the act maps to a trait the pawn has, otherwise 0. Judge, at a court verdict only: 0.75 + 0.5 x the judge's negotiation ability, clamped to 0.75 to 1.5. Record: 1.0 for the first conviction, 0.7 for the second, 0.4 from the third. Mood: x0.5 when the pawn ends below its minor break threshold. At most one trait step per pawn per 30 days and one per punishment.
|
|
- Thoughts: situational ThoughtDefs of our own reading expiry ticks from the component, as Reprimand. Not saved (RimWorld/ThoughtHandler.cs:30-33), refreshed every 100 ticks (RimWorld/SituationalThoughtHandler.cs:23, 34). "Sentenced me" is a social worker with the early-out set of pawns that have case history, as for attorneys.
|
|
- Stat part: a `StatPart` subclass added to `StatDefOf.MentalBreakThreshold.parts` at startup (RimWorld/StatDef.cs:140; RimWorld/StatPart.cs:7-16; RimWorld/StatDefOf.cs:52); the stat has no parts in XML (Core Defs/Stats/Stats_Pawns_General.xml:62-77). `TransformValue` reads one static bool, then a `Dictionary<Pawn, int>` of expiry ticks, and catches its own exceptions, since a throw would break every break-threshold read. The three thresholds read the stat through a 5-tick cache (Verse.AI/MentalBreaker.cs:40-44).
|
|
- Break weight: hook W multiplies `CommonalityFor` by 0.5 for the pawn's punished break def until the expiry. `MentalBreakWorker_BingingDrug` calls base (Verse.AI/MentalBreakWorker_BingingDrug.cs:8-10), so binges are covered; `MentalBreakWorker_WildDecree` doesn't (Verse.AI/MentalBreakWorker_WildDecree.cs:19-25), and no law needs it.
|
|
- Trait step: `TraitSet.RemoveTrait` (RimWorld/TraitSet.cs:325), then for a degree step `GainTrait(new Trait(def, degree))` (:258), since `Trait.degree` has no setter. Defs through `TraitDefOf` (DrugDesire, Pyromaniac, Abrasive, Bloodlust: RimWorld/TraitDefOf.cs:12, 40, 10, 38) and `DefDatabase<TraitDef>.GetNamedSilentFail` for Nerves and Gourmand, which `TraitDefOf` lacks. Guards: skip a trait with `sourceGene` set (RimWorld/Trait.cs:13; removing it deletes the gene, RimWorld/TraitSet.cs:341-344), a `Suppressed` one (Trait.cs:40) and a `ScenForced` one (:38); check `BackstoryDef.DisallowsTrait` (RimWorld/BackstoryDef.cs:249) for the new degree; touch only the vanilla defs above. Psychopath, Kind, NaturalMood and Industriousness are never touched, and no good trait is ever added.
|
|
- The letter is a vanilla standard letter with `LetterDefOf.PositiveEvent` (RimWorld/LetterDefOf.cs:16), no Letter class of ours, plus `MoteMaker.ThrowText` over the pawn (RimWorld/MoteMaker.cs:43).
|
|
- Removing Pyromaniac re-enables Firefighting at priority 0 (RimWorld/Pawn_WorkSettings.cs:195-205); setting that priority stays Castes' or the player's, and the letter says so.
|
|
- **Settings:** "Reform" (Temporary effects and traits / Temporary effects only / Off).
|
|
- **Save and removal:** Expiry ticks and the last trait-step tick in the component. After removal the thoughts, stat line and break weight are gone; a trait step stays, as vanilla traits are the pawn's history and load without Laws.
|
|
- **Overlaps:** Rimworld Law and Order's players asked for served sentences to make reoffending less likely; Uncle Boris' Brainwash Chair changes prisoner traits on a chair. Trait mods' own traits are never touched.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S for the thoughts, S for the stat part and break weight, S for the trait step.
|
|
- **Tests:** A served 5-day jail for a drug binge on a pawn with drug desire 2: "Paid my debt" for 6 days, the threshold 0.03 lower for 15 days, the binge weight halved for 30 days, and with a forced roll drug desire 1 and one letter. A second forced roll within 30 days changes nothing. A gene-sourced Kind or a suppressed pyromaniac is never touched (skipped: needs Biotech). "Temporary effects only" never changes a trait. A punishment harsher than the act gives "Resents my sentence" and no roll. Phase 2 keeps the remaining times; phase 3 after removal leaves the changed trait and no Laws thought. Performance run with 60 colonists and no effect active: no measurable cost.
|
|
- **Risks:** Vanilla never changes an adult's traits in play outside genes, creepjoiners and children's growth moments (RimWorld/ChoiceLetter_GrowthMoment.cs:189; RimWorld/CreepJoinerUtility.cs:110-122), so trait steps stay rare, capped and announced. Long or harsh punishments cost mood, and breaks are the main source of crimes; the picker shows the cost and the starter days stay short.
|
|
|
|
### Court, step 1: Ideology's trial as a punishment
|
|
|
|
#### 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 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).
|
|
- **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.
|
|
- **Replaces:** Nothing.
|
|
- **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.
|
|
|
|
### Court, step 2: court sessions on the core game
|
|
|
|
#### Court place
|
|
|
|
- **Players get:** Fabian's first ask of 2026-12-03. Select a building you own (any table, party spot, campfire, a throne with Royalty, a lectern or ritual spot with Ideology, or other furniture) and switch on "Court place". One place per map; switching it on elsewhere moves it. With the mouse over the switch the court room is outlined, the way the room stats button outlines a room. The Laws tab shows the place, its room's impressiveness against the courtroom setting, "Not a proper room" for an outdoor or open space, and a "Pick court place" button that lets you click a building on the map. The convene dialog starts at the place, "Court on its own" uses it, and public punishments (Enforcement, step 5) gather their crowd around it. Uninstalling the table into a crate and placing it again moves the court with it; deconstructing it or losing it clears the place, and the tab says "No court place".
|
|
- **How:**
|
|
- Hook P, a postfix on `Building.GetGizmos` (Verse/Building.cs:401) that wraps the iterator (`ref IEnumerable<Gizmo> __result`) and catches its own exceptions, since a throw inside an enumerator wrapper breaks the whole gizmo bar. It covers every building: the overrides of `ThingWithComps` and `Building_Throne` yield base first (Verse/ThingWithComps.cs:536; RimWorld/Building_Throne.cs:79-89). Gizmos are rebuilt every frame for every selected object (Verse/GizmoGridDrawer.cs:54-100), so it returns at once unless a law exists, the building's `Faction` is the player's, the def isn't impassable (thrones excepted) and `Find.Selector.SingleSelectedObject == this` (RimWorld/Selector.cs:74), the gate vanilla's room stats button uses (Verse/Building.cs:407). A box-select of 200 walls costs nothing.
|
|
- The Laws tab button: `Find.Targeter.BeginTargeting(TargetingParameters, Action<LocalTargetInfo>, ...)` (RimWorld/Targeter.cs:93) with `canTargetBuildings` and a validator for the player's buildings (RimWorld/TargetingParameters.cs:17, 35). The convene dialog's place picker writes the same stored value.
|
|
- The room is read when used, never stored: `Room.ID` comes from a static counter and changes on every region rebuild (Verse/Room.cs:43, 594-600). For a passable building `Thing.GetRoom()` (Verse/RegionAndRoomQuery.cs:53); for impassable furniture vanilla's rule `Gizmo_RoomStats.GetRoomToShowStatsFor(Building)` (Verse/Gizmo_RoomStats.cs:89). Hovering the switch calls `Room.DrawFieldEdges()` (Verse/Room.cs:836). "Not a proper room" when `Room.ProperRoom` (:536) is false. A room of at most 100 cells, not outdoors, is a whole gathering area as vanilla counts it (RimWorld/GatheringsUtility.cs:347).
|
|
- Save: one `Scribe_References` per map in the component. It saves as "Thing_" + ThingID (Verse/Thing.cs:798), so the place is still kept by ThingID as before, and a destroyed thing saves as null (Verse/Scribe_References.cs:60-68). A minified place keeps its instance and ID inside the crate (RimWorld/MinifyUtility.cs:15, 23). Between saves every use re-checks `Spawned`, `Map`, `Faction == Faction.OfPlayer` and `Destroyed` (Verse/Thing.cs:180-200); a failed check reads as no place. No Destroy or DeSpawn hook is needed.
|
|
- No ThingDef, designator or DesignationDef: any of them would stay on the map after a plain unsubscribe. A court place is a building reference, never a zone (Blax Zones) or an allowed area (Blax Castes).
|
|
- **Settings:** None; the switch is the setting.
|
|
- **Save and removal:** One reference per map in the component. After removal the building is just a table.
|
|
- **Overlaps:** RimCourt's seat spot is its own building; both can stand in one room.
|
|
- **Replaces:** Picking the place in the convene dialog every time.
|
|
- **Effort:** S plus S for the tab picker and the outline.
|
|
- **Tests:** Switching on "Court place" on a table stores it; on a second table moves it. Uninstall the table and place it elsewhere: the place follows it. Deconstruct it: the tab reads "No court place" at once and the save holds no reference. A claimed or destroyed place makes "Court on its own" wait with the reason. 200 selected walls: the postfix adds no gizmo and costs under a tenth of a millisecond per frame. A `-NoDlc` run offers tables and party spots; thrones and lecterns appear only with their DLC.
|
|
|
|
#### Courtrooms
|
|
|
|
- **Players get:** A verdict given in an impressive room costs the convict less mood: when the room around the court place reaches the courtroom impressiveness (setting), the convict gets the milder thought. The room keeps its own role, dining room, rec room or throne room. The Laws tab shows the court room's impressiveness against the setting. Moved here from Court step 4: it only reads the court place's room at the verdict.
|
|
- **How:** At the verdict, `room.GetStat(RoomStatDefOf.Impressiveness)` (Verse/Room.cs:823) of the court place's room, read as "Court place" says. No `RoomRoleDef`: a room has exactly one role, the highest score of all role workers (Verse/Room.cs:872). A courtroom role that scores higher would take over the dining room, the rec room or the throne room, which scores 10000 (RimWorld/RoomRoleWorker_ThroneRoom.cs:17-30) and which a noble's throne room requirement needs (Royalty); one that scores lower would never show.
|
|
- **Settings:** "Courtroom impressiveness".
|
|
- **Save and removal:** Nothing saved and no def to remove.
|
|
- **Overlaps:** RimCourt's seat spot is a different building.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S, plus S tests.
|
|
- **Tests:** A verdict at a place in a room above the setting gives the milder thought, below it the normal one; a throne room used as court place keeps its throne room role.
|
|
|
|
#### 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 (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.
|
|
- **Acting judge:** when the judge is the accused, the victim, or family of either (`pawn.relations.FamilyByBlood` plus spouse and lover), or is dead, jailed, away from the map or gone, the session uses the best uninvolved candidate: a free adult colonist who isn't involved, by Social. The convene dialog names the acting judge and why. "Court on its own" skips a case that has no uninvolved candidate, and the Cases tab says why. The same rule serves elected judges (Colony votes, step 2) and appeals (Court, step 4).
|
|
- **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".
|
|
- **Replaces:** The vanilla trial as the only court; Law and Order's trials.
|
|
- **Effort:** M.
|
|
- **Tests:** A trial row files a waiting case with no guilt; "Convene court" opens the dialog. A case whose appointed judge is the accused's spouse convenes with an acting judge, and the dialog names the reason.
|
|
|
|
#### Jail, then trial
|
|
|
|
- **Players get:** A punishment for did-it rows: the offender is arrested at once, as for Jail, waits in custody on Maintain only and goes to court. A conviction gives the row's days minus the days already served in custody; an acquittal releases it and closes the case. A plain Trial row arrests nobody, so a binger who already took some would keep bingeing until the court sits; this is the row for Fabian's "jail and maybe court". With Ideology, the leader's Accuse ability can also try a case in custody.
|
|
- **How:** The arrest is Jail's (see "Jail for N days"): guilt right before the Arrest or Capture job makes it certain (Verse/Pawn.cs:4085-4089; a downed free colonist can only be captured while guilty, Verse.AI/GenAI.cs:59-66), and without it the arrester's `ArrestSuccessChance` decides and a refusal is berserk (Verse/Pawn.cs:4099, 4132-4135). Hook K's postfix clears that guilt at the capture with `Notify_Guilty(0)` (RimWorld/Pawn_GuiltTracker.cs:46-49): custody is no conviction, and a guilty pawn can't be accused in the vanilla trial (RimWorld/CompAbilityEffect_StartTrial.cs:44-47). Maintain only two ticks after the capture, as for Jail. A conviction turns the custody into a sentence: release tick = capture tick plus the row's days, with the verdict's guilt. An acquittal sets Release at once. An escape closes the case as escaped, by Jail's early-end rule. Court days (Court, step 4) keep the accused in this custody between the days.
|
|
- **Save and removal:** The custody lives in the case like a sentence. After removal the pawn stays a vanilla prisoner of the colony.
|
|
- **Overlaps:** None.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S.
|
|
- **Tests:** A did-it binge case with "Jail, then trial, 5 days": the binger is a prisoner within 2500 ticks against a Social 0 arrester, is not guilty after the capture, and its case waits for court. Convicted after 2 days in custody, it is released 3 days later; acquitted, it is released at once. With Ideology the leader can accuse it (skipped without Ideology).
|
|
|
|
#### Convene dialog
|
|
|
|
- **Players get:** The familiar ritual-style window: role slots for judge, prosecutor, accused and spectators, a place picker (party spot, any table; from Royalty a throne; from Ideology a ritual spot or lectern), and every verdict factor with the expected conviction chance.
|
|
- **How:** `Dialog_ConveneCourt : Window` of our own, with its header, the place picker, the factor list with the chance and the button row, laid out like vanilla's ritual window. It reuses only `PawnRoleSelectionWidgetBase<CourtRole>` (RimWorld/PawnRoleSelectionWidgetBase.cs:13) for the role slots; its constructor has no DLC check (:101). `Dialog_BeginLordJob` isn't used: its constructor sets the participants drawer, `closeOnClickedOutside`, `absorbInputAroundWindow` and `forcePause` only inside `if (ModLister.CheckAnyExpansion("Ritual"))` (RimWorld/Dialog_BeginLordJob.cs:134-143). That check asks which DLCs are installed, not which are active (Verse/ModLister.cs:283-286, 426-428), and logs an error when none is (:347-353), so a player who owns no DLC would get a logged error and a court dialog without its role column. A half-day spike confirms the dialog in a core-only game before the rest is built.
|
|
- **Save and removal:** The place picker starts at the court place ("Court place") and writes it; before one is set, the last place is stored by ThingID.
|
|
- **Overlaps:** None.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** M.
|
|
- **Tests:** The dialog builds in a `-NoDlc` run and no `ModLister.Check*` error is logged when it opens; the factor list sums to the chance shown. A `-NoDlc` run only deactivates DLCs that stay installed, so it can't trigger the install check itself; the test also asserts that `Dialog_ConveneCourt` doesn't derive from `Dialog_BeginLordJob`.
|
|
|
|
#### 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 court place (or, before one is set, the last place you used), with the judge (or the acting judge, see "Cases go to trial") 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. A case with no uninvolved judge waits, and the Cases tab says why. 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. Court days reuse this scheduler.
|
|
- **Settings:** "Convene court on its own" (off), "Court hour" (10, 0 to 23). From Enforcement step 5 the court hour also times public punishments, whether or not "Convene court on its own" is on.
|
|
- **Save and removal:** Settings only; the last place is already in the component.
|
|
- **Overlaps:** None.
|
|
- **Replaces:** One "Convene court" click per case in a large colony.
|
|
- **Effort:** S.
|
|
- **Tests:** With the setting on, a waiting case convenes at the court hour without a click; during a raid it waits for the next day; with no place used yet it waits and the Cases tab says why; with the setting off nothing convenes.
|
|
|
|
#### Court session
|
|
|
|
- **Players get:** The roles walk to the place, spectators gather, the judge and the speakers trade arguments in speech bubbles for about two in-game hours, and a letter gives the verdict and the sentence. A warden brings a jailed accused and takes it back afterwards. Danger, a drafted or downed role pawn, or a missing judge calls the session off; the case stays open.
|
|
- **How:** `LordJob_BlaxCourtSession : LordJob_Joinable_Gathering` (RimWorld/LordJob_Joinable_Gathering.cs:7, call-off at :40), toils after the marriage ceremony pattern (RimWorld/LordJob_Joinable_MarriageCeremony.cs:7). Core duties only: ArriveToCell for the judge and the speakers, which walks to the cell and stands there with `JobGiver_Idle` (Core Defs/DutyDefs/Duties_Rituals.xml:5-22), DeliverPawnToCell for the warden who brings a jailed accused, with `focusSecond` the accused (:55; RimWorld/JobGiver_DeliverPawnToCell.cs:20-36) and Spectate for the crowd (Core Defs/DutyDefs/Duties_Gatherings.xml:55). Core's GiveSpeech duty (:139) isn't used: its only job giver, `JobGiver_GiveSpeech`, returns no job unless the duty's focus is a `Building_Throne` assigned to the speaker (RimWorld/JobGiver_GiveSpeech.cs:19-22), so at a party spot or a table the judge and the attorneys would reach their cell, get no job and walk off to work. The lord toil's tick plays the speech bubbles through `MoteMaker.MakeInteractionBubble` (RimWorld/MoteMaker.cs:181), not `TryInteractWith`, which writes a play log entry holding the InteractionDef (RimWorld/Pawn_InteractionsTracker.cs:249), and the speech sound. Laws adds no DutyDef: a duty is saved in `mindState.duty` while a session runs, so an own one would be one more def for the removal button to clear. One gathering at a time, as vanilla allows.
|
|
- **Save and removal:** A running session is a vanilla lord with our LordJob class and vanilla duties; see the removal button.
|
|
- **Overlaps:** Party and ritual mods block a session while their gathering runs, and the other way round.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** M.
|
|
- **Tests:** A session from convene to verdict in a `-NoDlc` run at a party spot, with the judge and both speakers at their cells for the whole session; a drafted judge calls it off and the case stays open; a jailed accused is back in its bed afterwards.
|
|
|
|
#### 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, read from the criminal record (Repeat offenders, step 1), never from closed cases, which "Keep closed cases" may prune after 7 days. 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 (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.
|
|
- **Overlaps:** None.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S plus S.
|
|
- **Tests:** With a test seed, P matches the formula for three set-ups: a planning-only case, a did-it case with count 4 (evidence +0.40) and a repeat offender. A conviction starts the sentence; an acquittal closes the case.
|
|
|
|
#### Remove Blax Laws from a game
|
|
|
|
- **Players get:** "Remove Blax Laws from this game" in the mod settings. It names the counts, ends running court sessions, public punishments, execution corps runs and subdue jobs, ends held convicts' wait jobs, asks whether to release the colonists Laws jailed, removes the component and ends with "Save now, then disable the mod".
|
|
- **How:** A running session leaves a lord whose LordJob class is missing after a plain unsubscribe: it loads with a null job, `PostLoadInit` throws on it (Verse.AI.Group/Lord.cs:246), and `LordTick` throws on every tick after (:610), each one logged (Verse.AI.Group/LordManager.cs:48-60). The button ends sessions and public punishments (`LordJob_BlaxPunishment`) first. It runs from the UI, never inside `GameComponentTick`, which loops by index (Verse/GameComponentUtility.cs:24-37). `Game.FillComponents` only runs on new games and loads (Verse/Game.cs:345, 446), so a removed component stays gone until the next load.
|
|
- **Save and removal:** This is the removal.
|
|
- **Overlaps:** None.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S.
|
|
- **Tests:** Phase 3 with a session running and the button pressed: no Laws error, no lord left with our job.
|
|
|
|
### Court, step 3: the people of a trial
|
|
|
|
Not specced yet: witnesses and the guilty plea (see `docs/features.md`).
|
|
|
|
#### 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`). Courtrooms moved to Court step 2.
|
|
|
|
#### 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. An accused in custody ("Jail, then trial") stays there until the verdict; a free accused comes to each court day.
|
|
- **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 is the one from "Jail, then trial": guilt only for the arrest, cleared at the capture. Custody without guilt would turn accused colonists berserk at the arrest (Verse/Pawn.cs:4085-4089, 4132-4135).
|
|
- **Save and removal:** Day results in the case.
|
|
- **Overlaps:** None.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** M for days and the tally, S for absences.
|
|
- **Tests:** A grave case runs 3 days; the verdict uses the mean; an escape during custody closes the case as escaped.
|
|
|
|
### Colony votes, step 1: the voting core and law votes
|
|
|
|
Needs the first release only: law votes count acts through the first release's hooks in tally-only mode and use nothing from the court.
|
|
|
|
#### Voting core
|
|
|
|
- **Players get:** The machinery every later vote shares. Who votes: free adult colonists on the home map (`IsFreeNonSlaveColonist`, Verse/Pawn.cs:542-552), never quest lodgers, slaves, children or prisoners; pawns in a break or away abstain. A "Votes" tab in the Laws window shows the ballot and each voter's choice. A vanilla letter gives the tally. An alert stays up while a vote is open and opens the tab when clicked. "Aye" and "Nay" float over the voters when it closes.
|
|
- **How:** `Alert.OnClick` (RimWorld/Alert.cs:170); alerts are found by reflection and never saved. `MoteMaker.ThrowText` (RimWorld/MoteMaker.cs:43). No custom letter class (the archive deep-saves letters) and no IncidentDef (the storyteller saves fired incident defs): the component schedules votes with `Rand.MTBEventOccurs` (Verse/Rand.cs:523) every 2500 ticks. Rolls that must read the same twice run inside `Rand.PushState` with a seed from the vote id and the pawn. "My side won", "my side lost" and "overruled" are situational thoughts.
|
|
- **Save and removal:** Open votes and their rows live in the component.
|
|
- **Overlaps:** None.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** M.
|
|
- **Tests:** The same tally twice gives the same result; an alert click opens the tab; the .rws holds no Laws letter class.
|
|
|
|
#### Colony votes on the lawbook
|
|
|
|
- **Players get:** A per-save switch, off by default. Colonists propose a law after an act that has none (25% chance, at most once per action per 10 days), petition to repeal an unpopular one (every 10 days on average) or you press "Call a vote" on any row. One vote at a time, open for 24 hours. Each voter's score adds trait stances (a pyromaniac votes against a fire law, a teetotaler for a drug law), self-interest (a trait whose only break is the targeted one), what a bystander would feel unless the voter doesn't care, Ideology precepts on the act, opinion of the offender and the proposer, and low mood. A proposal passes with more yes than no votes and at least half the voters taking a side; a tie keeps the current law. The result letter gives each voter's main reason ("Bob: no (pyromaniac)"). You can back or veto the result; the overruled side gets a small mood penalty. You can always edit the lawbook directly.
|
|
- **How:** The 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.
|
|
- **Overlaps:** Rimocracy (2159080853, 6.3k) votes on leadership decisions; Laws votes only on lawbook rows and the judge.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S plus S proposals, M scores and reasons, S plus S vote flow, S tests.
|
|
- **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.
|
|
|
|
Not specced yet: pardon petitions (see `docs/features.md`). They need the voting core and "Pardon, early release and longer sentences", nothing from the court.
|
|
|
|
### Colony votes, step 2: the judge's office
|
|
|
|
Needs court sessions (Court, step 2), whose acting-judge rule the elected judge uses.
|
|
|
|
#### Judge election
|
|
|
|
- **Players get:** The judge holds office for 60 days. An election runs when the term ends, when the judge dies, leaves, is jailed or convicted, or when you press "Hold election". Each voter picks the candidate with the highest opinion plus 3 x Social level, +15 for itself; ties go to higher Social. You can confirm the winner or appoint someone else, which gives the overruled voters a small mood penalty. A recall vote comes up when the colony's mean opinion of the judge drops below -10. A judge involved in a case hands it to an acting judge by the rule in "Cases go to trial"; a by-election fills a vacancy, and the acting judge sits until it is decided.
|
|
- **How:** Opinion from `OpinionOf` (RimWorld/Pawn_RelationsTracker.cs:592), once per voter and candidate per election: 3600 lookups at 60 pawns, once per term.
|
|
- **Settings:** "Judge: appointed (default), elected, ideoligion leader, moral guide".
|
|
- **Save and removal:** Office and term in the component.
|
|
- **Overlaps:** Leader Election (3822858677, 253), Colony Leadership (Continued) (2859856468, 3.5k), Ideology Leadership Expanded (3743069183, 3.2k, 1.6) and Rimocracy elect leaders; Laws elects only the judge and never writes `Faction.leader` or a role.
|
|
- **Replaces:** Nothing.
|
|
- **Effort:** S plus S.
|
|
- **Tests:** A friend-heavy colony elects the popular Social 10 pawn; a vacancy on the judge's death triggers a by-election; a recall passes below -10.
|
|
|
|
#### Ideoligion leader as judge
|
|
|
|
- **How:** Reads the role holder with `ChosenPawnSingle` (RimWorld/Precept_RoleSingle.cs:130) behind `ModsConfig.IdeologyActive`. Without Ideology the two options show disabled with "Needs Ideology", and a saved choice falls back to elected.
|
|
- **Save and removal:** The choice is a setting name.
|
|
- **Effort:** S.
|
|
- **Tests:** With Ideology the leader presides; in a `-NoDlc` run the saved choice reads as elected.
|
|
|
|
### Colony votes, step 3: the jury
|
|
|
|
Not specced yet: the jury (see `docs/features.md`). Needs court sessions and the voting core.
|
|
|
|
### Headless tests
|
|
|
|
#### First release
|
|
|
|
- **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.
|
|
- **Phase 2:** 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).
|
|
|
|
#### The release after the first
|
|
|
|
- **Combat:** with Violence, a combat run with 20 colonists against raiders: `TakeDamage` adds under 1% with the violence laws off. Effort S.
|
|
- **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.
|
|
|
|
#### Court, step 1
|
|
|
|
- Phase 2 covers waiting trials; phase 3 still expects exactly 2 errors. All 8 DLC combinations. 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.
|
|
|
|
#### Fabian's punishments of 2026-12-03 (Enforcement steps 4 and 5, Sentences step 1, Repeat offenders step 1, the court place)
|
|
|
|
- Phase 2 saves while a group beating, an execution corps run, a public punishment, a shunning, a lost bedroom and a reform effect are active: after the load the beating and the run are called off with the case open, a public lord caught in its violence toil has ended with the case waiting (a public lord still gathering keeps running), the convict and the shooters take normal jobs within 600 ticks, with Laws loaded and without it, and the others keep their remaining time. Phase 3 still expects exactly 2 errors, and no pawn holds a Laws job, duty, thought or hediff.
|
|
- All 8 DLC combinations: Excommunicate, Shaken faith, Lose role, Public execution and the pain precept check skip without Ideology; gene and suppressed trait guards without Biotech; thrones as court place without Royalty.
|
|
- Performance: the 60-colonist run with a court place set, nobody shunned, no reform effect and no punishment running adds nothing measurable over the first release's figure; a second run with 10 shunned pawns and 10 reform effects stays under 2%.
|
|
- `-Compat`: Blax Castes, once its sentence members exist, for the sentence castes; Beat Your Prisoners (Continued) beside a group beating; More Executions beside an execution corps. Effort S plus S.
|
|
|
|
## 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` 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.
|
|
- Ownership, the same list in all five Blax design docs:
|
|
- Castes: every per-pawn policy default of colonists, slaves and prisoners (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), and the planned ones: the cold-weather apparel policy, the Combat Extended loadout, the Royalty and Biotech switches (room and apparel requirements, psyfocus target, entropy limit, hemogen pack use, deathrest auto-wake), the slave interaction mode a new slave starts on and per-caste values other Blax mods register, which those mods apply.
|
|
- Zones: sleeping spots, beds by zone, every friendly drop location and per-cell work and path 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), the slave interaction modes (vanilla's plus Recruit and Convert), trade, prices, suppression, rebellion, slave medicine and the slave economy. Slaves routes its silver payouts through `ZonesApi.TryFindDropSpot`, with `DropCellFinder.TradeDropSpot` as fallback. Pawns are never routed into zones.
|
|
- Defaults: starting settings of vanilla stockpiles and growing zones, storage buildings, production bills, workbenches, buildings, animals and mechs, the named areas a new map starts with, 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, trials, judges, attorneys and law votes. It acts through vanilla arrest, capture, release and guilt plus its own non-lethal subdue job, and talks colonists and slaves out of a break, except slaves while Slaves' wardens calm breaks. 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. It puts a slave it jailed back into slavery. A sentence to lose the own bedroom or role unclaims that bed or role for its time and gives it back the same way; Laws never assigns a pawn another bed. Punishments of daily life go through a Castes sentence caste. It never sets policies, work priorities, allowed areas, zones or suppression. It keeps its state in one GameComponent.
|
|
|
|
### 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 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. Castes' planned `CapturedBy` scope never moves an arrest to the captured row: a pawn of the player's faction gets its "arrested" reason, which keeps the new-prisoner row (Castes `docs/features.md`, area 2, step 1). Laws' hint ("Castes keeps the caste") adds only the former-caste record that outlives `formerCasteDays`.
|
|
- 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; with Prison Labor's "Force to work" on, that mod disables the work types it bars prisoners from (see "Jail for N days", Overlaps), and the `-Compat` run checks that nothing else changes.
|
|
- "Confinement for N days" (Sentences, step 2, New) is a sentence: Laws asks Castes to put a convict into a caste the player picks for sentences and back through `blax.laws.released`. That needs a timed caste assignment in Castes' join API. Castes builds it as "Sentence caste for Blax Laws" (its area 5, step 5) after its join API, and its spec decides whether a third Laws reason sent through `NotifyJoined` is enough.
|
|
- From 2026-12-03 confinement is one of the sentence castes (Sentences, step 2, New): bread and water, hard labour, no recreation, dry, rags, confinement and any caste the player marks "for sentences", each picked per row (Decided 2026-12-03, item 4, which widens Decided 2026-12-01, item 2). Castes' area 5, step 5 allows several castes marked "for sentences" and adds `bool BeginSentence(Pawn, string casteId, int durationTicks)`, `bool EndSentence(Pawn)` and `int SentenceTicksLeft(Pawn)` in its next API version. `BeginSentence` writes the former-caste record Castes' restore already handles, and the end tick lives in Castes' save and is checked in its 2500-tick sweep, so a sentence ends even after Laws is unsubscribed; pardon and early release call `EndSentence`. A `NotifyJoined` reason row maps to one caste and carries no end tick, so it can't do this. Castes seeds starter sentence castes from vanilla's Paste and Simple food policies, the "no drugs" drug policy and a Work-only schedule, and add a "Create rags outfit" button. Confinement also waits on Castes' allowed area slot (its area 1). Without these members the entries show "Needs Blax Castes"; Laws has no fallback that stores and writes policies itself.
|
|
- Removing Pyromaniac through reform re-enables Firefighting at priority 0; Laws sets no priority, and Castes' caste priorities or the player decide.
|
|
- Castes' read-only API (version 1) lists Laws' caste checks as waiting on it: that is "Applies to" (Lawbook, step 2), which reads `CastesApi.CasteIdOf`.
|
|
|
|
### Blax Slaves
|
|
|
|
- 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' "Wardens calm breakdowns" calms slaves out of breaks that aren't `IsAggro` and aren't the rebellion. While `SlavesApi.CalmsBreaks` says that feature is on, Laws neither subdues nor talks down a slave in such a break and lets Slaves' wardens talk it down ("Slaves' wardens first").
|
|
- "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, which Fabian allowed on 2026-12-01. It never jails a slave while `SlavesApi.TermDaysLeft` says an indentured term runs, since Slaves ends the term at an arrest, until the member that keeps the term through a Laws sentence is bound; Slaves ships it with its indentured servitude.
|
|
- Suppression is never touched. A re-enslaved slave starts with the suppression vanilla gives a new slave.
|
|
- Slaves are never beaters or shooters. A slave can be the convict of every 2026-12-03 entry; the group beating is the same capped bruising as Subdue, never flogging with a tool, and fear stays Slaves' suppression.
|
|
|
|
### Blax Zones
|
|
|
|
- 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 is a building reference in Laws' component, saved by ThingID through `Scribe_References`, never a zone; its room is read when used.
|
|
- "Lose own bedroom" unclaims the bed and keeps the convict out of bedroom beds; it never assigns a bed. Where the convict sleeps is vanilla's choice or Zones' "Sleeping zones by caste" for a sentence caste.
|
|
|
|
### Blax Defaults
|
|
|
|
- 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
|
|
|
|
- Patches applied one class at a time from a `[StaticConstructorOnStartup]` class, logging "[Blax Laws] N patches applied". Every feature has a toggle. Every hook body in try/catch with a one-time log. Headless test mod copied from Zones (`Tests/BlaxLawsTests`, `run-tests.ps1`) with phase 3; a release runs all 8 DLC combinations.
|
|
|
|
### Sibling doc changes, when this design is accepted
|
|
|
|
Status on 2026-12-01, when the five plans were checked against each other: every entry below is done on the siblings' `plan/features` branches, except the READMEs and the Workshop "More Blax Gaming mods" lines, which wait until Laws is on the Workshop.
|
|
|
|
- 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).
|
|
- 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. Done in Castes' "Blax Laws" section instead of the table, and Castes' prisoner mode now skips every arrested colonist and imprisoned slave, hinted or not.
|
|
- 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.
|
|
- 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 the Laws release that brings the give-back the weapon an arrest drops is allowed again at the release.
|
|
- Slaves `docs/roadmap.md` and `docs/features.md`: an indentured term keeps running through a Laws sentence when Laws hints the arrest (a `SlavesApi` call naming the pawn from hook K's prefix, right before the capture, shipping with Slaves' indentured servitude); until that exists, Laws doesn't jail indentured slaves. Decided 2026-12-01.
|
|
- Castes `docs/features.md`: area 5, step 5, "Sentence caste for Blax Laws", ended by `blax.laws.released`, built after the join API. Decided 2026-12-01.
|
|
|
|
Status on 2026-12-03, after Fabian accepted all nine recommendations ("Decided 2026-12-03" in `docs/features.md`): every entry below is done on the siblings' main branches.
|
|
|
|
- All five docs: the Laws ownership line gains "A sentence to lose the own bedroom or role unclaims that bed or role for its time and gives it back the same way; Laws never assigns a pawn another bed. Punishments of daily life go through a Castes sentence caste." Done in Castes `docs/design.md`, Slaves `docs/roadmap.md`, Zones `docs/design.md` and Defaults `docs/design.md`, each in its ownership list.
|
|
- Castes `docs/features.md`: area 5, step 5 is now "Sentence castes for Blax Laws": castes marked "for sentences", `BeginSentence`, `EndSentence` and `SentenceTicksLeft` in the next API version, starter sentence castes (bread and water, hard labour, no recreation, dry, rags, confinement) and a "Create rags outfit" button. Its "Decided 2026-12-01" item 3 notes that Laws' "Decided 2026-12-03" item 4 widens it, and its "Order" names the sentence castes. Castes `docs/design.md`: a "Changes on 2026-12-03" note, and its "Blax Laws" section describes the sentence castes and the new members.
|
|
- Slaves `docs/roadmap.md`: the Cut line on flogging also notes that Laws' group beating is a capped beating of convicts with fists behind "Offer harsh punishments", and that slaves never beat; a "Changes on 2026-12-03" note.
|
|
- Zones `docs/design.md`: "Works with the other Blax mods" notes that the court place is a building reference in Laws' component, and that "Lose own bedroom" unclaims beds and never assigns one; a "Changes on 2026-12-03" note.
|
|
- Defaults `docs/design.md`: the ownership line only.
|
|
|
|
## 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 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`.
|
|
- `HistoryEventsManager.RecordEvent`: which events Core records without Ideology, which carry `HistoryEventArgsNames.Doer`, and the list of faction-level events to exclude.
|
|
- The self-eating check in hook C: that the eaten thing is still one of the ingester's own job targets when `Toils_Ingest` finalizes, also after a carried stack was split off. Checked by the plan review: the bill hook, `CompUsable.UsedBy` and the feeding and social relax paths (see hooks B, U and C).
|
|
- 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` (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 picker with a large mod list: catalogue size and draw cost.
|
|
|
|
For the 2026-12-03 parts every member named was found in the decompiled 1.7 code at the cited line; these behaviours need a spike or a test before their step is built:
|
|
|
|
- `LordJob_Joinable_Gathering.CreateGatheringToil` (RimWorld/LordJob_Joinable_Gathering.cs:38) takes a `GatheringDef`: whether the base class runs with no GatheringDef, or the court session and public punishment lords should derive from `LordJob_VoluntarilyJoinable` (RimWorld/LordJob_VoluntarilyJoinable.cs:6) instead. Court sessions share the answer.
|
|
- Execution corps: that `ShotReport.HitReportFor` from the shooters' real cells matches the observed hit rate over seeded volleys; how far an estimate before the squad reaches its marks is off; that `lastRangedHarmTick` is set when armour turns a hit into 0 damage; how the end of the volley is detected when some warm-ups are cancelled by the downing (`Stance_Warmup` back to `Stance_Mobile`, Verse/Stance_Warmup.cs:194-197); that a warden's `DeliverToCell` job brings a jailed convict out of its cell to the wall without the prisoner counting as escaping.
|
|
- `LordJob_BlaxPunishment` owning the court place through `Lord.AddBuilding` (Verse.AI.Group/Lord.cs:455): what owning it changes, for example `Lord.Notify_BuildingLost` (:746) when the place is destroyed mid-run, and that the lord cleanup releases it.
|
|
- The `GetThoughts` postfix: that a bullet death of a marked victim reaches `GetThoughts` through `TryGiveThoughts` (RimWorld/PawnDiedOrDownedThoughtsUtility.cs:17-63) with every death thought in its two output lists, and which prisoner-death history events a jailed convict's shooting records before it, and how Ideology's execution precepts answer them.
|
|
- A full-fill wall cell for the convict: `def.Fillage == FillCategory.Full` (Verse/ThingDef.cs:607) on the cell behind it, and a standable cell in front with a clear line of fire at the set distance.
|
|
- Starting the ideoligion's Execution ritual from a case (Public execution): which `Precept_Ritual` and obligation the colony needs and how vanilla starts it outside the ritual gizmo.
|
|
- `RestUtility.IsValidBedFor` (RimWorld/RestUtility.cs:160): how often it runs per bed search in a large colony, and that refusing bedroom beds there also covers a pawn's own previously owned bed.
|
|
- `Pawn_IdeoTracker.OffsetCertainty` (:360): that `Reassure` (:355) after it lifts a certainty clamped to 0 back above 0 before any save.
|
|
- `JobDriver_Subdue` with several participants: that two beaters adjacent at once don't block each other's `CanReachImmediate` and that the downing hit ends every participant's job in the same tick.
|
|
|
|
## 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.
|
|
- Used buildings and any job as a catalogue category (played horseshoes, used the comms console), through the same `StartJob` hook as the next item.
|
|
- "Attempted" stage between planning and did it (M): needs a postfix on the huge, hot `Pawn_JobTracker.StartJob` (Verse.AI/Pawn_JobTracker.cs:252) with a set of watched JobDefs, for example an ingest job toward wake-up during a binge.
|
|
- Crimes on caravans (S): today only pawns on a map are watched; caravan cases would wait until the pawn is home.
|
|
- Player-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`.
|
|
- 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.
|
|
- 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.
|
|
- A Castes right "may serve in court", as a per-caste value Castes stores for sibling mods (CastesApi version 4, built when the first sibling feature needs one).
|
|
- 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).
|
|
- From 2026-12-03: an Ideology certainty gain when a sentence matches what the convict's ideoligion approves of (`Pawn_IdeoTracker.Reassure`, RimWorld/Pawn_IdeoTracker.cs:355); Social XP for a convict who defended itself in court; the beater's and shooter's own mood (Bloodlust pleased, Kind upset) as situational thoughts, if players ask; choosing where each spectator stands.
|
|
- Indenture as a sentence through Blax Slaves' indentured servitude (an idea in `docs/features.md` since the plan review): a slave loses Warden, Hunting, Art and Research for good and any ideoligion role, so it needs a give-back plan and a SlavesApi call first.
|
|
|
|
## Cut
|
|
|
|
- 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).
|
|
- 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 (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.
|
|
- `Dialog_BeginLordJob` as the convene dialog: it builds its role column only when a DLC is installed (RimWorld/Dialog_BeginLordJob.cs:134-143) and logs an error otherwise.
|
|
- Core's GiveSpeech duty for court speakers: it gives a job only to a speaker on its own throne (RimWorld/JobGiver_GiveSpeech.cs:19-22).
|
|
- A courtroom `RoomRoleDef`: a room has one role (Verse/Room.cs:872), so it would replace the dining room, rec room or throne room.
|
|
- Patching `Bill.Notify_IterationCompleted`: empty and called as a base call the JIT may inline (RimWorld/Bill.cs:278-280, RimWorld/Bill_Medical.cs:129); hook B uses `RecordsUtility.Notify_BillDone`.
|
|
- 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.
|
|
- Subdue with vanilla melee (`AttackMelee` or the social fight job): the weapon or fists hit the head, the undrafted enforcer turns guilty and the target fights back.
|
|
- Fines: colonists own no silver, so a fine only burns colony silver.
|
|
- Work bans: disabling work types zeroes priorities for good (RimWorld/Pawn_WorkSettings.cs:195-205), and Castes owns priorities.
|
|
- Torture, maiming, flogging with whips or weapons, sacrifice and ripscanning as punishments, and torture furniture (pillory, stocks, gallows): beyond vanilla's tone, and the furniture needs art; War Crimes Expanded 2 has torture and More Executions has gallows for those who want them. A RimCourt bridge for its pillory and lash, for the same reason. The group beating (Enforcement, step 4) is planned in (Decided 2026-12-03, item 1), because it reuses Subdue's caps (bruises that heal, never the head, never death) and sits behind "Offer harsh punishments".
|
|
- Group beating through vanilla melee or a forced social fight: the convict fights back (RimWorld/Verb_MeleeAttack.cs:34-38; RimWorld/Pawn_InteractionsTracker.cs:373-400), fists hit the head, and cuts can scar. "Until unconscious" through anaesthetic: a fake, and odd in tone; the label is "beaten down" (Decided 2026-12-03, item 8).
|
|
- The execution corps through `AttackStatic` or `Pawn.TryStartAttack`: both force `canHitNonTargetPawns` true (Verse/Pawn.cs:2970-2983), so a stray bullet could hit a spectator. A "fire again" option after a full miss: it breaks the one-volley rule.
|
|
- Excommunication through `SetIdeo`: it records `ChangedIdeo`, can unclaim the bed, removes spouses and bonds, and switching back undoes none of it (RimWorld/Pawn_IdeoTracker.cs:183-241).
|
|
- Taking royal titles (`ReduceTitle`, RimWorld/Pawn_RoyaltyTracker.cs:554-591, which drops permits and honor for good) or honor as a fine: the Empire grants them, and a colony court has no say.
|
|
- A court ThingDef, a designator or a DesignationDef for the court place: each would stay on the map after a plain unsubscribe. Storing a Room or `Room.ID`: IDs change on every region rebuild (Verse/Room.cs:43, 594-600).
|
|
- DutyDefs of our own for public punishments: a duty is saved in `mindState.duty` while the lord runs.
|
|
- A HistoryEventDef for beatings: saved in a `DefMap`.
|
|
- Laws writing food, drug or apparel policies, schedules, work priorities or allowed areas when Castes is missing, as a fallback for the sentence castes: it breaks the shared ownership list, fights Castes' own rules when both are loaded, and leaves references to deleted policies.
|
|
- Claiming a barracks bed for a convict who lost its bedroom: `ClaimBedIfNonMedical` evicts the last owner of a full bed (RimWorld/Pawn_Ownership.cs:139-142), and beds by zone are Zones'.
|
|
- Reform that adds good traits, or touches Psychopath, Kind, NaturalMood or Industriousness: it reads as brainwashing, and Kind conflicts with Abrasive and Psychopath (Core Defs/TraitDefs/Traits_Singular.xml:36-52). Reform only removes or softens a vice tied to the act. A Laws hediff or memory thought for "reformed": our defs in vanilla save lists.
|
|
- A punishment preset Def type: named punishments live in the component as names and numbers (Lawbook, step 2).
|
|
- 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.
|
|
- 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`.
|