# The Treatment Engine — shared rehabilitation *The shared maths behind every "fix a held pawn over time" system in the suite.* Core carries one more thing every rehabilitation-style system needs and none should own alone: the maths of a **treatment programme**. Sustained attention in a secured facility reduces a marked condition, the room's quality helps or hurts, and once there's nothing left to reduce a **recovery track** builds toward a state where the pawn can be discharged. It exists for the same reason the propensity engine does. Two systems want the identical loop pointed at different things — **Ward** treats the mental illness that got a pawn committed; **Justice** rehabilitates the disposition that got one imprisoned — and without a shared engine each would grow its own copy and drift apart. Core owns **only the maths**. Which interaction enrols a pawn, which conditions and moods carry the flavour, which jobs run the sessions, and which alert fires on discharge all live in the mod using it. > The engine does something only when there's a real condition to work through, and does nothing > otherwise. A colony that never marks anything treatable never notices it exists. --- ## How treatment plays out A condition has to be **marked treatable** before a programme can touch it (Ward marks mental illness this way; a modder or player can mark anything — see the [Modder API](Modder-API.md) page). Once a condition is marked, treatment runs in sessions: 1. **Each completed session removes a slice of the condition's severity.** The base amount is **0.12 severity per session**, *before* it's scaled by the treating pawn's skill, the facility's quality, and how much of the session that patient actually gets. When a condition's severity reaches zero it's gone. 2. **A full course is several sessions by design.** The programme has to be *sustained* — you can't fix a pawn in a single visit. 3. **Once nothing is left to treat, continued care builds a recovery track** from 0 toward 1 (discharge-ready). Fix the illness first, then stabilise. 4. **The recovery track decays on its own if you stop.** Recovery you stop maintaining slips back down — which is what makes the whole thing a loop you keep up, not a one-time unlock. --- ## The numbers ### Facility quality The room the treatment happens in scales every session between **0.5×** (grim) and **1.5×** (excellent): | Room | Factor | |---|---:| | Bare (0 impressiveness) | 0.60 | | Decent (~48 impressiveness) | 1.00 | | Impressive (108+ impressiveness) | 1.50 (capped) | | Outdoors / no room | 0.75 | The limits are deliberate: a grim, filthy, cramped facility heals worse and a calm clean one better, but a palace can't trivialise the work the programme costs (1.5× ceiling), and even treating a pawn out in the open is a poor makeshift room (0.75×), not a hard zero. ### Reducing a condition Each marked condition drops by **0.12 × the session's combined strength** per session, and vanishes when it hits zero. That combined strength is the treating pawn's skill × the facility quality above × the patient's share of the session — so all three inputs matter, and a good therapist in a good room working one-on-one is worth many times a poor one splitting attention in a bad room. ### Building recovery The recovery track is a plain 0-to-1 progress bar toward discharge. Continued care adds to it (capped at 1.0) and — crucially — it carries a slow decay, so it slips back down without sustained attention. The mod using the engine decides what reaching the top actually *unlocks* (Ward: a "ready for discharge" alert). --- ## Who uses it - **[Institution: Ward](https://git.arch.fyi/flan/rimworld-ward)** — psychiatric care. Marks mental-illness conditions treatable (Rim Disorders' depression, anxiety, PTSD, and OCD, when that mod is present), runs warden counselling sessions, and builds a recovery track toward a "ready for discharge" alert. The reference example. - **Institution: Justice** — rehabilitation. Its *reform* score is the disposition axis punishment moves; the recovery track is the natural home for a *sustained rehabilitation programme* that gates parole on the same shared engine, so the two systems agree on "getting better" instead of each inventing it. "Reduce the condition, *then* build recovery" is the shape Ward uses, but it isn't forced: a rehabilitation system with no clinical condition to clear (like Justice's reform) can build a recovery track from the very first session and read its level to gate a parole. The point, exactly as with propensity: one engine, two uses, no drift. --- *Part of the **Institution** suite.*