Re-package with the corrections layer bundled; sync the wiki (Rehabilitation page, loop update)

This commit is contained in:
flan
2026-07-15 21:01:28 +00:00
parent 3530100ed5
commit 18a983b7cc
16 changed files with 298 additions and 6 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+36
View File
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<!--
The visible reform track, on Core's shared treatment engine (the same one Ward's recovery rides).
A rehab session advances it; it decays without sustained sessions, so rehabilitation has to be
kept up. It is a readout and a pressure, not the parole gate itself: parole keys off the reform
SCORE and the security grade, and the "Ready for parole" alert fires from that.
-->
<HediffDef>
<defName>Institution_Reforming</defName>
<label>reforming</label>
<description>This prisoner is being rehabilitated — worked with toward turning a corner. Progress decays without sustained sessions. When they have reformed enough and their security grade is low enough, they can be paroled back into the colony.</description>
<hediffClass>HediffWithComps</hediffClass>
<defaultLabelColor>(0.55, 0.85, 0.65)</defaultLabelColor>
<scenarioCanAdd>false</scenarioCanAdd>
<maxSeverity>1.0</maxSeverity>
<isBad>false</isBad>
<comps>
<li Class="HediffCompProperties_SeverityPerDay">
<severityPerDay>-0.08</severityPerDay>
</li>
</comps>
<stages>
<li>
<minSeverity>0</minSeverity>
<label>reforming</label>
</li>
<li>
<minSeverity>0.999</minSeverity>
<label>reformed</label>
</li>
</stages>
</HediffDef>
</Defs>
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<!-- Distinct defNames from the interaction modes: [DefOf] binds by name, so a job and a mode that
shared one name could not both be reached. -->
<JobDef>
<defName>Institution_RehabilitateJob</defName>
<driverClass>Contraband.JobDriver_Rehabilitate</driverClass>
<reportString>rehabilitating TargetA.</reportString>
<casualInterruptible>false</casualInterruptible>
</JobDef>
<JobDef>
<defName>Institution_ParoleJob</defName>
<driverClass>Contraband.JobDriver_Parole</driverClass>
<reportString>paroling TargetA.</reportString>
<casualInterruptible>false</casualInterruptible>
</JobDef>
</Defs>
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<!--
Two non-exclusive prisoner modes, exactly the shape Ward's psychiatric-care mode uses (and Prison
Labor's seven). Non-exclusive so they STACK: set Rehabilitate to run the reform programme, and
Parole so a warden releases them the moment they are eligible; or set Rehabilitate alone and
parole by hand when the alert fires.
-->
<PrisonerInteractionModeDef>
<defName>Institution_Rehabilitate</defName>
<label>rehabilitate</label>
<listOrder>120</listOrder>
<isNonExclusiveInteraction>true</isNonExclusiveInteraction>
<mustBeAwake>false</mustBeAwake>
<allowOnWildMan>false</allowOnWildMan>
<allowInClassicIdeoMode>true</allowInClassicIdeoMode>
</PrisonerInteractionModeDef>
<PrisonerInteractionModeDef>
<defName>Institution_Parole</defName>
<label>parole when reformed</label>
<listOrder>210</listOrder>
<isNonExclusiveInteraction>true</isNonExclusiveInteraction>
<mustBeAwake>false</mustBeAwake>
<allowOnWildMan>false</allowOnWildMan>
<allowInClassicIdeoMode>true</allowInClassicIdeoMode>
</PrisonerInteractionModeDef>
</Defs>
+46
View File
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<ThoughtDef>
<defName>Institution_Rehabilitated</defName>
<thoughtClass>Thought_Memory</thoughtClass>
<durationDays>2</durationDays>
<stackLimit>3</stackLimit>
<stages>
<li>
<label>counselled</label>
<description>Someone sat with me and talked it through. Maybe I can turn this around.</description>
<baseMoodEffect>5</baseMoodEffect>
</li>
</stages>
</ThoughtDef>
<ThoughtDef>
<defName>Institution_Paroled</defName>
<thoughtClass>Thought_Memory</thoughtClass>
<durationDays>8</durationDays>
<stackLimit>1</stackLimit>
<stages>
<li>
<label>paroled</label>
<description>They gave me a second chance and let me back in. I mean to earn it.</description>
<baseMoodEffect>12</baseMoodEffect>
</li>
</stages>
</ThoughtDef>
<ThoughtDef>
<defName>Institution_ReformNeglected</defName>
<thoughtClass>Thought_Memory</thoughtClass>
<durationDays>3</durationDays>
<stackLimit>4</stackLimit>
<stages>
<li>
<label>left to rot</label>
<description>They said they would help me change, then forgot I exist. Why should I bother?</description>
<baseMoodEffect>-6</baseMoodEffect>
</li>
</stages>
</ThoughtDef>
</Defs>
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Defs>
<!--
New WorkGiver subclasses, not patches: they inherit WorkGiver_Warden.ShouldSkip (so they respect
Prison Commons areas for free) and are invisible to Custom Prisoner Interactions, which only
patches the named vanilla warden givers.
-->
<WorkGiverDef>
<defName>Institution_WardenRehabilitate</defName>
<label>rehabilitate prisoner</label>
<giverClass>Contraband.WorkGiver_Warden_Rehabilitate</giverClass>
<workType>Warden</workType>
<verb>rehabilitate</verb>
<gerund>rehabilitating</gerund>
<priorityInType>65</priorityInType>
<requiredCapacities>
<li>Talking</li>
<li>Hearing</li>
</requiredCapacities>
</WorkGiverDef>
<WorkGiverDef>
<defName>Institution_WardenParole</defName>
<label>parole prisoner</label>
<giverClass>Contraband.WorkGiver_Warden_Parole</giverClass>
<workType>Warden</workType>
<verb>parole</verb>
<gerund>paroling</gerund>
<priorityInType>85</priorityInType>
<requiredCapacities>
<li>Talking</li>
</requiredCapacities>
</WorkGiverDef>
</Defs>
+5 -4
View File
@@ -33,9 +33,10 @@ The suite is a closed loop, and each turn of it lives in a different layer:
under the perimeter, all countered by warden search — and a bent warden who smuggles for them.
6. **Gangs** *(Gangs)* — held pawns organise into contraband economies: joining by disposition,
smuggling networks, rivalry, fights that book as crimes.
7. **Corrections** *(Justice)* — classification grades the danger; discipline moves a **reform**
score (harden vs. rehabilitate); a **deterrence** climate rises and falls with visible justice and
feeds back into everyone's disposition; parole releases the genuinely reformed.
7. **Corrections** *(Justice · Rehabilitation)* — a warden **rehabilitates** a prisoner: counselling
sessions move a **reform** score and raise the colony's climate of **order** (classification
re-grades as reform rises), that order feeds back into everyone's disposition, and a **parole**
alert releases the genuinely reformed back into the colony. Neglect a flagged prisoner and they harden.
8. **Treatment** *(Ward)* — the other door: a prisoner committed for **psychiatric care** rather than
punished. Counselling reduces the disorder that broke them and builds a recovery track toward
discharge; neglect a committed patient and they deteriorate.
@@ -55,7 +56,7 @@ one off disables its systems in place without uninstalling anything.
|---|---|---|---|
| **Core** | *(always on — the engine)* | propensity, the criminal record, secured context, the shared **treatment engine**, the deterrence seam | [Core](core/Home.md) |
| **Contraband** | Contraband | concealment & intake, improvised shivs, Prison-Architect tunnels, warden search, warden corruption | [Contraband](contraband/Home.md) |
| **Justice** | Justice | classification, deterrence feedback, discipline & reform, parole, regime (prisoner recreation) | [Justice](justice/Home.md) |
| **Justice** | Justice | classification, deterrence feedback, discipline & reform, **rehabilitation** (warden reform work + parole), regime | [Justice](justice/Home.md) |
| **Justice · Policing** | Policing | colony crime on the spectrum, witnesses, a constable, the weighed arrest, prison riots, recidivism alerts | [Policing](justice/Policing.md) |
| **Gangs** | Gangs | gangs as contraband economies — joining, smuggling networks, rivalry, fights-as-crime | [Gangs](gangs/Home.md) |
| **Ward** | Ward | psychiatric care — treatment, recovery, discharge, ward neglect, sedation | [Ward](ward/Home.md) |
+3
View File
@@ -2,6 +2,9 @@
*Punishment as an action, with a self-complete payoff — and the seat of institutionalization.*
> This page is the **maths** — what a disciplinary act does to reform and order. What *drives* it in
> play (a warden's rehabilitation sessions, and neglect that hardens) is [Rehabilitation](Rehabilitation.md).
Punishment in Justice does two things at once, on two different axes:
1. **It deters the colony.** Order seen to be done raises the climate of order for everyone —
+3 -2
View File
@@ -45,7 +45,7 @@ happened* are fed by its siblings. It grades and gates over all of them.
---
## The five modules
## The six modules
| Module | What it does | Page |
|---|---|---|
@@ -53,9 +53,10 @@ happened* are fed by its siblings. It grades and gates over all of them.
| **Deterrence** | The colony's climate of order, moved by crime and punishment, drifting to baseline, read back into propensity. | [Deterrence](Deterrence.md) |
| **Discipline & Reform** | Punishment moves the reform score — harden vs. rehabilitate. The seat of institutionalization and recidivism. | [Discipline & Reform](Discipline-and-Reform.md) |
| **Parole** | Release when reform, grade, and pardon status line up. | [Parole](Parole.md) |
| **Rehabilitation** | The warden work that DRIVES the corrections arc: a rehabilitate mode + counselling sessions move reform and colony order, a parole alert + release job, and neglect that hardens. | [Rehabilitation](Rehabilitation.md) |
| **Regime** | Enables the prisoner recreation (Joy) need via a Harmony postfix, idempotent with Prisoner Recreation. | [Regime](Regime.md) |
Threaded through all five is one small piece of glue, **`JusticeBootstrap`**, which at load fills the
Threaded through all six is one small piece of glue, **`JusticeBootstrap`**, which at load fills the
neutral deterrence seam Core leaves open — reconnecting the feedback loop across the mod boundary
without Core ever depending on Justice. See [Deterrence](Deterrence.md).
+4
View File
@@ -2,6 +2,10 @@
*Release, driven by what the pawn has become.*
> This page is the release **decision** (`CanRelease`). The warden work that acts on it — the
> "Ready for parole" alert and the release job that frees a parolee back into the colony — is
> [Rehabilitation](Rehabilitation.md).
Parole is the end of the arc, and it is deliberately a *decision*, not a mechanic that rebuilds the
game's release flow. It asks one question — **is this pawn ready?** — and answers it from two things
already on the record: the reform the sentence earned (or failed to earn), and the grade the record
+115
View File
@@ -0,0 +1,115 @@
# Rehabilitation — the post-arrest loop, wired
*The warden work that finally drives discipline, reform, and parole. Source in
`Source/Justice/Corrections/`.*
Classification, discipline, deterrence, and parole always had their **maths** — a grade over the
record, a reform score punishment moves, an order climate, a release decision. What they lacked was a
**trigger**: nothing in play called them. Reform never moved, so classification never re-graded and
parole never fired; the only thing that raised the colony's order was a punishment nothing invoked.
The post-arrest half of the loop was real code with no way to run it.
Rehabilitation is that trigger. It gives corrections the same treatment Ward gave psychiatric care —
a **prisoner interaction mode**, **warden jobs**, an **alert**, and an inspect readout — so a warden
actually reforms a prisoner over time and paroles them when they have turned a corner.
---
## The two modes
Both are non-exclusive prisoner interaction modes (the shape Prison Labor and Ward use), so they
stack with each other and with recruit / reduce-resistance.
| Mode | What a warden does | Result |
|---|---|---|
| **Rehabilitate** | Runs counselling sessions on the prisoner | Reform rises, the reform track fills, colony order rises |
| **Parole when reformed** | Releases the prisoner **once they are eligible** | A paroled colonist, back in the colony |
Set **Rehabilitate** alone to run the programme and parole by hand when the alert fires; set **both**
for a hands-off "reform, then release" pipeline. A prisoner flagged for parole who is *not yet*
eligible is simply not acted on — the warden waits.
---
## A rehabilitation session
A warden walks to the prisoner and counsels them for ~1250 ticks (about 20 in-game minutes), Social
being the active skill. On completion (never on interruption — the credit is a follow-on toil), one
session does three things, in `CorrectionsUtility.RunReformSession`:
1. **Corrective discipline** — `Discipline.Punish(prisoner, harsh: false)`: reform **+0.10**, and the
punishment is recorded, which raises the colony's **order** by `+0.12`. This is the deterrence-up
half that punishment alone never triggered — visible corrective justice deters everyone else.
2. **The reform track** — `TreatmentProgram.AdvanceRecovery` advances `Institution_Reforming` on
Core's shared treatment engine, by `0.34 × cell quality × skill`. It is the visible progress bar,
and it **decays** (`−0.08/day`), so rehabilitation has to be *sustained*.
3. **A memory** — the prisoner feels counselled (a small mood lift).
| Input | Range | Source |
|---|---|---|
| skill factor | `0.5 … 1.0` | warden's Social level |
| cell quality | `0.5 … 1.5` | `TreatmentProgram.FacilityQuality` (room impressiveness) |
| reform / session | `+0.10` | `Discipline.Punish` (fixed) |
| order / session | `+0.12` | `Justice.RecordPunishment` |
Reform reaches the parole bar (`≥ 0.30`) in roughly **three completed sessions**, faster than a bad
cell or a poor counsellor fills the visible track — so the "Ready for parole" alert keys off the real
gate (`Parole.CanRelease`), not the bar.
---
## Neglect — the teeth
A prisoner you flag for rehabilitation and then never attend **hardens**, exactly as a ward you don't
staff does. `MapComponent_ReformNeglect` measures the days since the last real session; past **two
days** of neglect, reform falls `−0.15/day` and they resent it (a mood hit). The hardening lowers
reform *directly*, not through `Discipline.Punish` — neglect is passive prisonization, not an act of
visible justice, so unlike a session it must **not** raise the colony's order.
Attend the prisoner and the clock resets; flag them and walk away and they slide back toward the
record that put them in. "A reform programme you don't staff is worse than none."
---
## Parole — the release that stays
When a rehabilitated prisoner clears `Parole.CanRelease` — reform `≥ 0.30`, security grade
`≤ Medium`, not already pardoned — the **Ready for parole** alert names them. A warden set to Parole
then processes the release (`CorrectionsUtility.ReleaseOnParole`):
- marks the **pardon** on the record;
- clears the prisoner hold so a former colonist is a **free colonist again** — a parolee who *stays*
in the colony carrying their record, not vanilla's release that ejects them from the map;
- a grateful memory, and a small **+0.03** to order (a lawful release is visible justice too).
The parolee keeps their `CriminalRecord`, so if they reoffend the [policing](Policing.md) loop catches
them again — recidivism, closing back onto the start.
---
## Seeing it
A rehabilitated prisoner's inspect pane shows the state directly (a Harmony postfix on
`Pawn.GetInspectString`, via Justice's existing Regime patch — not a contested method):
> *Rehabilitation: reforming (40%)* · *reformed — ready for parole* · *— neglected (3d)*
And because the colony's **order climate** otherwise has no readout at all, the same line surfaces it
when it is far enough from ordinary to matter — *Colony order: low (28%) — crime pays here* / *high
(71%) — order holds*.
---
## What this closes
With rehabilitation wired, the whole post-arrest arc runs in play: **discipline** moves reform,
**classification** re-grades as reform rises, **deterrence** climbs on visible justice (not just
falls on crime), **parole** releases the reformed, and Core's **treatment engine** carries the reform
track the same way it carries Ward's recovery. The loop closes back onto disposition — catching,
reforming, and releasing one pawn moves the climate every other pawn is judged against.
Gated by `InstitutionSettings.justice`, like the rest of the corrections layer.
---
*Part of the **Institution** suite. AI disclosure: developed with substantial assistance from Claude (Anthropic).*