diff --git a/docs/design.md b/docs/design.md index d1e971b..2547e76 100644 --- a/docs/design.md +++ b/docs/design.md @@ -4,6 +4,12 @@ Write a lawbook and the colony enforces it. Add "Drug binge, wake-up, planning, Status: design, no code yet. Checked against the RimWorld 1.7.5021 game code on 2026-11-30; the act catalogue (2026-12-01) was checked against the 1.7.5021 reference assemblies, which have every signature and no method bodies, so its behaviour claims are listed under "To verify" until the decompiled code confirms them. RimWorld 1.7, package id `blax.laws`. From the first release a plain unsubscribe leaves a save that loads: jailed colonists stay vanilla prisoners and the log shows 2 errors. +Changes on 2026-12-01, the 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. @@ -477,8 +483,8 @@ Not specced yet: talk down and decide myself (see `docs/features.md`). Talk down #### Slaves' wardens first -- **Players get:** With Blax Slaves' "Wardens calm breakdowns" on, a slave in a non-violent break is left to Slaves' wardens: Laws files the case but sends no subdue. 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 of a slave. Without Slaves or with the flag false, Laws subdues slaves as before. +- **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. @@ -560,7 +566,7 @@ Each part waits for its sibling or for Fabian's answer. Confinement for N days i #### 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 (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. +- **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. @@ -570,8 +576,8 @@ Each part waits for its sibling or for Fabian's answer. Confinement for N days i #### 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. 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 (its open question 1), so the re-enslave at the end would leave an indentured servant a slave for life. While a term runs, 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, until Slaves offers a hint that keeps the term through a Laws sentence. +- **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 (its open question 1), so the re-enslave at the end would leave an indentured servant a slave for life. While a term runs, 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, until Slaves offers a hint that keeps the term through a Laws sentence (Slaves' open question 3, planned with its indentured servitude). With that member bound, Laws calls it right before the arrest 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. @@ -794,26 +800,26 @@ Not specced yet: the jury (see `docs/features.md`). Needs court sessions and the - 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: - - Castes: every per-pawn policy default (apparel, food, drug, reading, medical care, schedule, work priorities, weapon loadout, allowed area, hostility, self-tend, carried medicine, fire at will, prisoner interaction except the Maintain only and Release modes Laws sets on colonists it jailed). - - Zones: sleeping spots, beds by zone, every friendly drop location and per-cell work rules (work rule areas); it never changes a pawn's work priorities or allowed area. - - Slaves: slave status (except the status Laws gives back to a slave it jailed), trade, prices, suppression, rebellion, slave medicine and the slave economy. - - Defaults: starting settings of vanilla stockpiles and growing zones, storage buildings, production bills, workbenches, buildings, animals and mechs, and what the game forbids when pawns go down, die or are stripped. It writes when something is made or joins, and through its opt-in forbid rules when a pawn goes down, dies or is stripped. It keeps nothing in the save. - - 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 out of a break (Slaves' wardens calm slaves). For the colonists it jailed, and only for them, it writes the prisoner interaction mode (Maintain only after the arrest, Release when the sentence ends) and gives back what the sentence took: bed, grave, throne, deathrest casket, ideoligion role, mech work modes and the weapon the arrest dropped. Only if Fabian agrees, it puts a slave it jailed back into slavery. It never sets policies, work priorities, allowed areas, zones or suppression. It keeps its state in one GameComponent. +- Ownership, the same list in all five Blax design docs; a part that waits on Fabian's answer names the open question: + - 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 (Castes' open question 2) and per-caste values other Blax mods register, which those mods apply (Castes' open question 1). + - Zones: sleeping spots, beds by zone, every friendly drop location and per-cell work rules (work rule areas), with path rules on those areas (Zones' open question 3); 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, Laws' open question 1), 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 (Laws' open question 1). 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. Once Castes' join API (API version 2) ships, an arrest without the hint lands in the captured row (Castes' new `CapturedBy` scope); Laws' "Castes keeps the caste" hints it. +- 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; the `-Compat` run checks that Prison Labor doesn't change them. -- "Confinement for N days" (Sentences, step 2, New) would ask 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, which Castes doesn't plan yet (`docs/features.md`, open question 2). +- "Confinement for N days" (Sentences, step 2, New) would ask 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 (`docs/features.md`, open question 2). Castes plans it as "Sentence caste for Blax Laws" (its area 5, step 5), only on Fabian's yes, and its spec decides whether a third Laws reason sent through `NotifyJoined` is enough. - 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 non-violent breaks. When a SlavesApi member says that feature is on, Laws doesn't subdue slaves and lets Slaves' wardens talk them down. -- "Jail for slaves" puts a jailed slave back into slavery at the end, without vanilla's enslave event. It restores the status the sentence took; it's still a write to slave status, so it ships only if Fabian agrees. It never jails a slave while `SlavesApi.TermDaysLeft` says an indentured term runs, since Slaves ends the term at an arrest, until Slaves offers a hint that keeps the term through a Laws sentence. +- 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, so it ships only if Fabian agrees. It never jails a slave while `SlavesApi.TermDaysLeft` says an indentured term runs, since Slaves ends the term at an arrest, until Slaves offers a hint that keeps the term through a Laws sentence (Slaves' open question 3). - Suppression is never touched. A re-enslaved slave starts with the suppression vanilla gives a new slave. ### Blax Zones @@ -831,14 +837,16 @@ Not specced yet: the jury (see `docs/features.md`). Needs court sessions and the ### 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. +- 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` (open question 1): an indentured term keeps running through a Laws sentence when Laws hints the arrest (for example a `SlavesApi` call naming the pawn before the arrest); until that exists, Laws doesn't jail indentured slaves. Asked together with Laws' open question 1. -- Castes `docs/features.md`, only if Fabian says yes to confinement (Laws' open question 2): the join API gains a timed caste assignment for Laws' convicts, ended by `blax.laws.released`. +- Slaves `docs/roadmap.md` and `docs/features.md` (its open question 3): an indentured term keeps running through a Laws sentence when Laws hints the arrest (a `SlavesApi` call naming the pawn before the arrest, shipping with Slaves' indentured servitude); until that exists, Laws doesn't jail indentured slaves. Asked together with Laws' open question 1. +- Castes `docs/features.md`, only if Fabian says yes to confinement (Laws' open question 2): area 5, step 5, "Sentence caste for Blax Laws", ended by `blax.laws.released`. ## To verify against the decompiled code diff --git a/docs/features.md b/docs/features.md index fa846ac..9c57a32 100644 --- a/docs/features.md +++ b/docs/features.md @@ -82,12 +82,12 @@ Step 1: - **Jail and subdue then jail.** The arrest; on a berserk pawn the jail waits until the break ends or you down it. Serving the sentence is area 4. Designed: [Jail for N days](design.md#jail-for-n-days), [Subdue](design.md#subdue). - **Reprimand.** -4 to -16 mood by severity for 3 days. Designed: [Reprimand](design.md#reprimand). - **Banish and execute.** Always confirmed in a dialog, never automatic. Designed: [Banish and execute](design.md#banish-and-execute). -- **Talk down.** A planning punishment for breaks that aren't hostile: the enforcer walks over, and a Social roll against the offender's mood ends the break through `RecoverFromState`, with the catharsis setting applied. The spec decides what a failed try leads to. Laws owns calming colonists; Slaves' wardens calm slaves. New. Demand: Snap Out! (1319782555, 636k, no 1.7) talks pawns out of breaks and has no 1.7 build. +- **Talk down.** A planning punishment for breaks that aren't hostile: the enforcer walks over, and a Social roll against the offender's mood ends the break through `RecoverFromState`, with the catharsis setting applied. The spec decides what a failed try leads to. Laws owns calming colonists. Slaves follow the subdue rule: while Slaves' wardens calm breaks (step 2), Laws leaves the breaks they take to them, and otherwise talks slaves down like colonists. New. Demand: Snap Out! (1319782555, 636k, no 1.7) talks pawns out of breaks and has no 1.7 build. - **Decide myself.** A punishment that leaves the case waiting in the Cases tab with Warn, Guilty N days, Jail N days and Pardon buttons and an alert while it waits; any open or warned case also gets a "Sentence" button. New. Demand: Prisoner Sentencing (1.3k) and RimCourt (8.8k) are built on the player choosing per case. Step 2, with the sibling mods (needs Slaves' "Wardens calm breakdowns"): -- **Slaves' wardens first.** While `SlavesApi.CalmsBreaks` is true, Laws doesn't subdue a slave in a non-violent break and leaves it to Slaves' wardens. Designed: [Subdue](design.md#subdue), "Works with the other Blax mods". +- **Slaves' wardens first.** While `SlavesApi.CalmsBreaks` is true, Laws doesn't subdue or talk down a slave in a break Slaves' wardens take (not `IsAggro`, not the rebellion) and leaves it to them. Tantrums, rages and slaughterers stay Laws', since the wardens skip them. Designed: [Subdue](design.md#subdue), "Works with the other Blax mods". Step 3, subdue a pawn that fights back (needs step 1's subdue proven in play): @@ -195,5 +195,5 @@ Reasons for these and the rest: `design.md`, "Cut". ## Open questions for Fabian -1. Jail for slaves writes slave status back at the end of the sentence, and skips a slave serving an indentured term until Blax Slaves adds a hint that keeps the term through a Laws sentence. Recommendation: yes to both. It only restores what the sentence took; without the hint, an arrest ends the term (Slaves' own open question 1) and a short sentence would leave an indentured servant a slave for life, so the hint goes into Slaves' plan with that question. -2. Confinement as a sentence needs a new Castes call, a timed caste assignment. Recommendation: yes, built after Castes' join API; if Castes declines, house arrest stays left out. +1. Jail for slaves writes slave status back at the end of the sentence, and skips a slave serving an indentured term until Blax Slaves adds a hint that keeps the term through a Laws sentence. Recommendation: yes to both. It only restores what the sentence took; without the hint, an arrest ends the term (Slaves' own open question 1) and a short sentence would leave an indentured servant a slave for life. Slaves asks the same two things as its open questions 1 and 3, with the same recommendation, and plans the hint with its indentured servitude. +2. Confinement as a sentence needs a new Castes call, a timed caste assignment. Recommendation: yes, built after Castes' join API; if Castes declines, house arrest stays left out. Castes plans it, on a yes, as its area 5, step 5.