docs: forbid rules move to 1.1 with hit point and quality filters

One filter each for your colony and for enemies decides what dropped gear the game forbade is allowed again, once the fight is over. Stripping can forbid what doesn't match; corpse switches join the same release. Later releases shift by one.
This commit is contained in:
Fabian @ Blax Software 2026-11-29 20:49:48 +01:00
parent aba5ab08fe
commit 67e52a2ae0
1 changed files with 229 additions and 97 deletions

View File

@ -1,8 +1,8 @@
# Blax Defaults
Every new shelf starts at Preferred and pulls meals out of the freezer, every new bill searches the whole map to make one item, and every tamed husky starts with no area and no training. Blax Defaults lets you tune one stockpile, shelf, bill, crop, building or animal, click "Make default", and every new one you make starts like it. Colonists, slaves and prisoners stay with Blax Castes.
Every new shelf starts at Preferred and pulls meals out of the freezer, every new bill searches the whole map to make one item, and every tamed husky starts with no area and no training. Blax Defaults lets you tune one stockpile, shelf, bill, crop, building or animal, click "Make default", and every new one you make starts like it. Its forbid rules decide what stays forbidden when pawns go down, die or are stripped: the good weapons, the food and the medicine get allowed, the junk stays forbidden. Colonists, slaves and prisoners stay with Blax Castes.
Status: design ready to build, no code yet. Checked against the RimWorld 1.7.5021 game code on 2026-11-29. RimWorld 1.7, package id `blax.defaults`. It keeps nothing in the save, so it can be added to or removed from a running colony at any time.
Status: 1.0 is built; 1.1 to 1.5 are designed, no code yet. Checked against the RimWorld 1.7.5021 game code on 2026-11-29. RimWorld 1.7, package id `blax.defaults`. It keeps nothing in the save, so it can be added to or removed from a running colony at any time.
Changes on 2026-11-29, after two review rounds:
@ -16,20 +16,32 @@ Changes on 2026-11-29, after two review rounds:
- DLC support: every feature works with any DLC combination, core only included, and About.xml names no DLC. What needs one switches off cleanly without it: growth vats and the mech rows (Biotech), biosculpter pods (Ideology), and the "slaves only", "mechs only" and "non-mechs only" parts of recipe defaults. The mech rows now show disabled with "Needs Biotech" instead of being hidden. Each release runs the tests in all 8 combinations of Royalty, Ideology and Biotech; Anomaly and Odyssey are guarded in code only. Day counts don't change.
- Matched with the Castes and Zones docs: the ownership sentence and the Castes section now say that the forbid rules write outside creation and see humanlike pawns' corpses and gear. A saved default for a DLC building shows disabled with "Needs Biotech" (or Ideology) instead of counting as a name from an inactive mod. The Needs column uses the format the three docs share.
Changes on 2026-11-29, forbid rules reworked:
- The forbid rules get their own release, 1.1, right after 1.0, and the other releases shift by one: more storage and bills 1.2, animals 1.3, growers and buildings 1.4, mechs 1.5. The plan is 25 days instead of 22.
- The two plain switches for dropped gear become two rules, your colony and enemies, each a vanilla item filter with the hit points and quality ranges stockpiles have. Going down and dying share one rule, because gear drops once: when the pawn goes down, or when it dies without going down, as raiders downed by violence often do. What doesn't match keeps the game's flag.
- The rules reach apparel: an opt-in strip switch per rule forbids what stripping drops when the filter refuses it. Butchering stays vanilla.
- Everything the rules allow, corpses included, waits until no enemy that can still fight is on the map.
- A downed colonist's main weapon stays forbidden only while the colonist lies where it fell, for it to pick up again, as vanilla does. Once the colonist is rescued, carried off or dies, it has forgotten the weapon, and the rule decides. That also covers a kidnapped colonist's weapon, so its backlog item goes.
- After review: escaping prisoners stay in your colony, like rebelling slaves; a rule can't be turned on before it has a filter; an animal's corpse follows the animal switch even when the animal was hostile. The gear rules take 2.5 days instead of 2, and 1.1 stays at 4.
- Hooks: scopes on `Pawn.Kill` and `Pawn_HealthTracker.MakeDowned` with a recorder on the `CompForbiddable.Forbidden` setter replace the postfix on `Pawn.DropAndForbidEverything`. That catches stacks a drop merges into and leaves trades, captures and map generation alone.
- Matched with the Castes, Zones and Slaves docs: all four carry the "go down, die or are stripped" sentence and Zones' work rule areas (its 1.6) in their ownership lines, and say "allowed area" for Castes' area slot. The Zones section says how work rule areas and the forbid rules compose, and the release numbers each doc cites of the others follow this re-cut.
## At a glance
| Version | What players get | Needs | Replaces | Days |
|---|---|---|---|---|
| 1.0 | Storage defaults: new stockpiles, dumping stockpiles, shelves, bookcases, hoppers, fridges and weapon racks start with the filter and priority you saved, set from a "Defaults" button in the storage tab. One click makes new shelves start empty. Values for every new bill: radius, drop on floor, repeat mode. A defaults file that never resets itself. Overlap warnings | None | [FSF] No Default Shelf Storage (93k), Better Workbench Management's default store mode (452k, no 1.7), Default Ingredient Radius (11.6k), the storage half and the bill values of 1trickPwnyta's Defaults (75k, no 1.7) and of Set my Defaults (116) | 6 |
| 1.1 | Graves, sarcophagi, mortars, growth vats, biosculpter pods and modded storage start from your default too; defaults per recipe saved from the bill window; the bills a new workbench comes with | None (growth vats: Biotech, biosculpter pods: Ideology, "slaves only": Ideology, "mechs only" and "non-mechs only": Biotech) | The per-recipe and per-workbench bills of Defaults and Set my Defaults, Auto Bill Restore (1.1k, no 1.7) | 5 |
| 1.2 | Animal defaults per species: area, follow flags and training when an animal joins; born animals copy their mother; auto-slaughter limits for a species you own for the first time and for new maps. Corpses outside the home area stay allowed. Auto-repair for new mechs (Biotech) | None (mech auto-repair: Biotech) | Animal Controls' join defaults (57k, no 1.7), Allow Dead Animals (67k, no 1.7), Auto-repair On (61k, no 1.7), Auto Training (1.2k), the newborn copy of Assign Animal Food (25k, no 1.7) | 5 |
| 1.3 | Crops for new growing zones and hydroponics basins; settings for new doors, tables, traps, heaters, coolers and lamps, per building or for every door, lamp, heater or cooler; rules that stop the game forbidding your own dropped gear and enemy gear | None | No Default Gather Spot (8.4k, no 1.7), Default White Lights (656), Always Auto-Rearm (67), Default Plant Selector (7), partly KilledEnemyAutoAllowed (5.2k) | 4 |
| 1.4 | Mech defaults per kind (Biotech): the work mode of the control group a new mech joins, its area, and a Defaults gizmo on mechs | Biotech | The mech work modes of 1trickPwnyta's Defaults | 2 |
| Total | | | | 22 |
| 1.1 | Forbid rules for your colony and for enemies: what the game forbids when one of their pawns goes down or dies is allowed when it matches a filter with hit points and quality ranges (for example every item, but weapons only at 50 to 100% and Normal or better), once the fight is over. Stripping can forbid what doesn't match. Corpses outside the home area can stay allowed | None (slaves: Ideology, colony mechs: Biotech) | KilledEnemyAutoAllowed (Continued) (5.2k), Allow Dead Animals (67k, no 1.7), Allow Everything (3.8k, no 1.7) for drops, partly Auto Strip on Haul's tainted forbid (18k) | 4 |
| 1.2 | Graves, sarcophagi, mortars, growth vats, biosculpter pods and modded storage start from your default too; defaults per recipe saved from the bill window; the bills a new workbench comes with | None (growth vats: Biotech, biosculpter pods: Ideology, "slaves only": Ideology, "mechs only" and "non-mechs only": Biotech) | The per-recipe and per-workbench bills of Defaults and Set my Defaults, Auto Bill Restore (1.1k, no 1.7) | 5 |
| 1.3 | Animal defaults per species: area, follow flags and training when an animal joins; born animals copy their mother; auto-slaughter limits for a species you own for the first time and for new maps. Auto-repair for new mechs (Biotech) | None (mech auto-repair: Biotech) | Animal Controls' join defaults (57k, no 1.7), Auto-repair On (61k, no 1.7), Auto Training (1.2k), the newborn copy of Assign Animal Food (25k, no 1.7) | 4 |
| 1.4 | Crops for new growing zones and hydroponics basins; settings for new doors, tables, traps, heaters, coolers and lamps, per building or for every door, lamp, heater or cooler | None | No Default Gather Spot (8.4k, no 1.7), Default White Lights (656), Always Auto-Rearm (67), Default Plant Selector (7) | 4 |
| 1.5 | Mech defaults per kind (Biotech): the work mode of the control group a new mech joins, its area, and a Defaults gizmo on mechs | Biotech | The mech work modes of 1trickPwnyta's Defaults | 2 |
| Total | | | | 25 |
Effort: S = 0.5 days, M = 2, L = 5, summed per release and rounded up. Workshop numbers are current subscribers from the Steam Web API (GetPublishedFileDetails), read on 2026-11-29; "no 1.7" means the item has no 1.7 tag. Needs: "None" means the release runs on the core game, and a DLC in brackets marks the parts that switch off without it (see "DLC support"). A DLC alone, as for 1.4, means the whole release switches off without it.
Effort: S = 0.5 days, M = 2, L = 5, summed per release and rounded up. Workshop numbers are current subscribers from the Steam Web API (GetPublishedFileDetails), read on 2026-11-29; "no 1.7" means the item has no 1.7 tag. Needs: "None" means the release runs on the core game, and a DLC in brackets marks the parts that switch off without it (see "DLC support"). A DLC alone, as for 1.5, means the whole release switches off without it.
Total: 22 working days, up from 19: half a day of repo and harness setup, the "every" rows for buildings, and rounding after the re-cut. 1.0 takes 6 working days, so it doesn't fit in a five-day week. If it slips, the bill values move to 1.0.1 and storage ships first.
Total: 25 working days, up from 22: the forbid rules grew from two half-day switches into filters with a strip switch and a wait for the fight to end (4 days instead of 1), and the animal release drops from 5 days to 4 without the corpse rules. 1.0 is built. 1.1 takes 4 working days, so it fits in one week.
## Defaults I picked
@ -39,13 +51,22 @@ Change if you disagree.
- One default per kind: per stockpile type, per building, per recipe, per workbench, per species, per mech kind. Animals and mechs also have an "every animal" and "every mech" row, and doors, lamps, and heaters and coolers an "every door", "every lamp" and "every heater or cooler" row, each used field by field where the kind's own row sets nothing. No "all storage" row: emptying every storage building at once breaks hoppers and pipe taps, a recurring complaint about [FSF] No Default Shelf Storage (comments 2023-07-08 and 2025-08-16). The quick setup covers the bulk case with a checkbox per kind.
- A default applies once, when the thing is created: designated, built, tamed, bought, born, gestated. Changing or forgetting a default never touches an existing stockpile, shelf, bill or animal. "Load your default" on one thing is the explicit way to update it.
- Only what you make or acquire. Ruins, map generation, trader stock and reinstalled minified buildings keep the game's settings. Benches in abandoned outposts never get your bills; a cook walking to one was a complaint about 1trickPwnyta's Defaults (2025-12-07).
- The one exception is the forbid rules (corpses in 1.2, dropped gear in 1.3). They act on gear and corpses you neither made nor acquired, and they are switches on the settings page, not a "Make default". All of them ship off.
- The one exception is the forbid rules (1.1). They act on gear and corpses you neither made nor acquired, and they live on the settings page, not behind a "Make default". All of them ship off.
- Forbid rules come in two groups: your colony (colonists, slaves, colony mechs, colony animals and prisoners, a rebelling slave or an escaping prisoner included) and enemies (anyone else hostile to you when they go down or die). Neutral visitors, traders and quest lodgers keep the game's rules: a downed visitor that gets up where it fell picks its weapon up again, and a trader's wares sit in its inventory.
- Each group's rule is one vanilla item filter with the hit points and quality ranges stockpiles have. What matches is allowed; what doesn't keeps the game's flag. A rule never forbids a dropped thing the game left allowed; only the opt-in strip switch forbids.
- Going down and dying share one rule: gear drops once, either when the pawn goes down or when it dies without going down. Raiders downed by violence often die on the spot instead (80% at population intent 0), so one rule covers both.
- "Where" defaults to anywhere. Inside the home area the game already leaves dropped food and medicine allowed and forbids only weapons and an enemy's loot, so a home-area rule would not reach the food left forbidden outdoors.
- Everything a rule allows waits until no enemy that can still fight is on the map, so no rule sends a hauler into a fight. No switch for it.
- A downed colonist's main weapon stays forbidden only while the colonist lies where it fell, for it to pick up after getting up, as vanilla does. Once the colonist is rescued, carried off or dies, it has forgotten the weapon, and the rule decides.
- A rule can't be turned on until it has a filter, saved with Edit or the suggested setup. Forgetting the filter turns the rule off.
- Suggested setups, applied only when you press the button: enemies get every item, but hit points 50 to 100% and Normal or better, anywhere, stripping on, so a Poor rifle or one below 50% stays forbidden while food, medicine, drugs and silver are allowed. Your colony gets every item, full ranges, anywhere, stripping off.
- Butchering strips corpses too but stays vanilla under the strip switch: what a butcher strips lands next to the bench, where a burn bill or a dumping stockpile takes it.
- Defaults are global, shared by every save, in their own file in the game's Config folder. Not in mod settings: a mod settings file that fails to load is replaced by fresh settings on the next write, which is how Defaults' users lost theirs. No per-colony layer yet.
- A storage default stores every item it allows and every item it refuses, plus a rule for items it doesn't list, such as those a mod adds later: follow the game's default for that kind (what "Make default" saves), refuse them or allow them. The quick setup saves "refuse", so an empty shelf stays empty when you add a mod. Items from a mod you removed stay in the file, are skipped, and work again when the mod comes back.
- Surgery bills and pasted bills are never touched. Pawn restrictions, a specific target stockpile, custom names, styles and xenogerms belong to one save and are left out of a bill default; "take to stockpile X" becomes "best stockpile".
- Born animals copy their mother's training wishes and follow flags and keep the mother's area, as vanilla already does for the area. The species default applies to tamed, bought, wanderer, quest and starting animals.
- Colonists, slaves and prisoners belong to Blax Castes. Defaults never writes to a humanlike pawn, with or without Castes.
- Values for every new bill ship in 1.0 next to storage; recipe defaults and workbench bill sets follow in 1.1. Storage already has working 1.7 mods ([FSF] No Default Shelf Storage, [KV] Save Storage, Adaptive Storage - Global Settings), while the default store mode of Better Workbench Management (452k) has no 1.7 build and is asked for on Defaults' page (2026-02-16). Bills also come up more often than storage in the comments on both builds of 1trickPwnyta's Defaults: 36 comments mention bills or workbenches, 24 shelves, storage or stockpiles (about 650 comments, read 2026-11-29).
- Values for every new bill ship in 1.0 next to storage; recipe defaults and workbench bill sets follow in 1.2. Storage already has working 1.7 mods ([FSF] No Default Shelf Storage, [KV] Save Storage, Adaptive Storage - Global Settings), while the default store mode of Better Workbench Management (452k) has no 1.7 build and is asked for on Defaults' page (2026-02-16). Bills also come up more often than storage in the comments on both builds of 1trickPwnyta's Defaults: 36 comments mention bills or workbenches, 24 shelves, storage or stockpiles (about 650 comments, read 2026-11-29).
- Name: Blax Defaults, always with the subtitle "Starting settings for storage, bills, crops, buildings, animals and mechs". The Workshop description's first line is "Colonists, slaves and prisoners: Blax Castes."
- Any DLC combination works, core only included. A feature that needs a DLC shows disabled on the settings page with "Needs Biotech" (or Ideology), and everything else keeps working.
- Not supported: multiplayer (the file differs per client), Anomaly corpse stockpiles, Odyssey fishing zones and gravship starts (neither DLC is installed here to test).
@ -54,11 +75,11 @@ Everything below is for the modder building it.
## Data model
Three parts carry everything. The library and the designation and blueprint hooks ship in 1.0, the build scope in 1.1 and the join funnel in 1.2; later releases only add kinds and hooks. Game code references are to the decompiled 1.7.5021 assembly (namespace folder, file, line); XML references are to the game's `Data` folder.
Three parts carry everything. The library and the designation and blueprint hooks ship in 1.0, the build scope in 1.2 and the join funnel in 1.3; later releases only add kinds and hooks. The forbid rules of 1.1 keep their filters in the library and use their own unsaved scopes. Game code references are to the decompiled 1.7.5021 assembly (namespace folder, file, line); XML references are to the game's `Data` folder.
### Defaults library, a file of names
- `DefaultsLibrary` (static) holds one entry per kind, keyed by a string: `stockpile:Stockpile`, `stockpile:Dumping`, `stockpile:<designator type name>`, `storage:<ThingDef>` and `bill:*` in 1.0; `bill:<RecipeDef>` and `bench:<ThingDef>` from 1.1; `animal:*`, `animal:<race ThingDef>`, `slaughter:<race ThingDef>`, `mech:*` and `mech:<race ThingDef>` (auto-repair) from 1.2; `grower:Zone_Growing`, `grower:<ThingDef>`, `building:<ThingDef>`, `building:*door`, `building:*lamp` and `building:*temperature` from 1.3; work mode and area fields on the `mech:` entries from 1.4.
- `DefaultsLibrary` (static) holds one entry per kind, keyed by a string: `stockpile:Stockpile`, `stockpile:Dumping`, `stockpile:<designator type name>`, `storage:<ThingDef>` and `bill:*` in 1.0; `forbid:colony` and `forbid:enemies` (the forbid rules' filters) from 1.1; `bill:<RecipeDef>` and `bench:<ThingDef>` from 1.2; `animal:*`, `animal:<race ThingDef>`, `slaughter:<race ThingDef>`, `mech:*` and `mech:<race ThingDef>` (auto-repair) from 1.3; `grower:Zone_Growing`, `grower:<ThingDef>`, `building:<ThingDef>`, `building:*door`, `building:*lamp` and `building:*temperature` from 1.4; work mode and area fields on the `mech:` entries from 1.5.
- File: `Config/BlaxDefaults/Defaults.xml` under the game's save data folder (`GenFilePaths.ConfigFolderPath`, Verse/GenFilePaths.cs:178).
- Writing, in this order:
1. `Scribe.saver.InitSaving` on `Defaults.xml.tmp`, the library inside a try. On an exception: `Scribe.saver.ForceStop()` (Verse/ScribeSaver.cs:213), delete the `.tmp`, one error in the log, both files untouched.
@ -66,33 +87,33 @@ Three parts carry everything. The library and the designation and blueprint hook
3. Only then `File.Replace(tmp, file, file + ".bak")`, or `File.Move(tmp, file)` when there is no main file. A crash at any step leaves the old file.
- Why not ModSettings: `LoadedModManager.ReadModSettings` catches any exception, logs a warning and returns fresh settings (Verse/LoadedModManager.cs:553-561), and the next `WriteModSettings` overwrites the old file, flushing whatever its `finally` has (:566-576). Mod settings (`BlaxDefaultsSettings`) keep only the toggles and the dismissed overlap warnings.
- Strings only: defNames, enum names, numbers. Nothing uses `Scribe_Defs`, and no `ThingFilter` is deep-saved (its `ExposeData` resolves `allowedDefs` as defs, Verse/ThingFilter.cs:290-299). Loading can never throw over a missing def. The file is read in the `[StaticConstructorOnStartup]` class, after defs exist.
- Names resolve at apply time with `DefDatabase<T>.GetNamedSilentFail`. A name that doesn't resolve is skipped and stays in the file. The settings page shows "N names from mods that are not active" per entry; a "Drop them" button follows in 1.1.
- Names resolve at apply time with `DefDatabase<T>.GetNamedSilentFail`. A name that doesn't resolve is skipped and stays in the file. The settings page shows "N names from mods that are not active" per entry; a "Drop them" button follows in 1.2.
- Loading: main file, then `.bak`. A file that fails to load is renamed at once to a name of its own, `Defaults.broken-<yyyyMMdd-HHmmss>.xml` for the main file and `Defaults.bak.broken-<yyyyMMdd-HHmmss>.xml` for the backup, with "-2", "-3" appended if that name exists. The main file is renamed even when the `.bak` loads, so the next write can't rotate the broken file into `.bak` over the only good copy: with no main file, that write is a `File.Move` and the `.bak` stays. If both fail: an empty library, one warning in the log and a red line on the settings page naming the broken copies. Renaming is the only file operation at load; nothing is written until the player saves or forgets a default.
- A format version in the root node. Changes are additive only.
- StorageTemplate: `priority` (enum name), `allowed` and `refused` (ThingDef names), `unlisted` (`Game`, `Refuse` or `Allow`), `allowedSpecial` and `refusedSpecial` (SpecialThingFilterDef names), the hit points range and the quality range. "Make default" fills `allowed` and `refused` from every def that is `EverStorable(willMinifyIfPossible: true)` (Verse/ThingDef.cs:1394) and passes the kind's parent filter, and saves `unlisted = Game`. Applying starts from the game's default for the kind (on a new thing, what vanilla just set), writes the priority through the `Priority` setter, calls `filter.SetAllow` per resolved def, then handles every storable def the parent allows that is in neither list: `Game` leaves it, `Refuse` and `Allow` set it. The edit window shows the rule as a dropdown under the filter.
- StorageTemplate: `priority` (enum name), `allowed` and `refused` (ThingDef names), `unlisted` (`Game`, `Refuse` or `Allow`), `allowedSpecial` and `refusedSpecial` (SpecialThingFilterDef names), the hit points range and the quality range. "Make default" fills `allowed` and `refused` from every def that is `EverStorable(willMinifyIfPossible: true)` (Verse/ThingDef.cs:1394) and passes the kind's parent filter, and saves `unlisted = Game`. Applying starts from the game's default for the kind (on a new thing, what vanilla just set), writes the priority through the `Priority` setter, calls `filter.SetAllow` per resolved def, then handles every storable def the parent allows that is in neither list: `Game` leaves it, `Refuse` and `Allow` set it. The edit window shows the rule as a dropdown under the filter. The forbid rules (1.1) reuse the template as a filter: the priority is unused, and `unlisted` is `Refuse` (stays forbidden) or `Allow`.
### Creation hooks, no state on things
Every write happens at one creation hook, apart from the forbid rules (1.2, 1.3), which act in `Pawn.Kill` and `Pawn.DropAndForbidEverything`. All of them go through vanilla setters onto vanilla fields. Nothing marks a thing as handled, so nothing needs saving.
Every write happens at one creation hook, apart from the forbid rules (1.1), which write the forbidden flag when a pawn goes down, dies or is stripped (`Pawn_HealthTracker.MakeDowned`, `Pawn.Kill`, `Pawn.Strip`). All of them go through vanilla setters onto vanilla fields. Nothing marks a thing as handled, so nothing needs saving.
- Designation hooks: postfixes on the zone designators' `MakeNewZone` (stockpiles in 1.0, growing zones in 1.3).
- Designation hooks: postfixes on the zone designators' `MakeNewZone` (stockpiles in 1.0, growing zones in 1.4).
- Blueprint hook (1.0): a postfix on `Blueprint_Storage.PostMake`, see "New storage buildings start from your default".
- Build scope (1.1): a prefix on `Frame.CompleteConstruction(Pawn)` (RimWorld/Frame.cs:262) opens a `[ThreadStatic]` scope when the frame's type is exactly `Frame` and its faction is the player's. It records the frame's map, cell, `entityDefToBuild` and `glowerColorOverride` (:17), because the frame destroys itself inside the method (:280). A Harmony finalizer closes the scope, even on an exception.
- Build scope (1.2): a prefix on `Frame.CompleteConstruction(Pawn)` (RimWorld/Frame.cs:262) opens a `[ThreadStatic]` scope when the frame's type is exactly `Frame` and its faction is the player's. It records the frame's map, cell, `entityDefToBuild` and `glowerColorOverride` (:17), because the frame destroys itself inside the method (:280). A Harmony finalizer closes the scope, even on an exception.
- Made hook: a postfix on `ThingMaker.MakeThing(ThingDef, ThingDef)` (Verse/ThingMaker.cs:8) while the scope is open and the def is the frame's. It records the new thing and applies the defaults that must be in place before spawn (storage parents without a storage blueprint, temperature targets, door hold-open, gather spot). The postfix runs after the thing's own `PostMake`, so a turret's gun already exists (RimWorld/Building_TurretGun.cs:164-169). Nested `MakeThing` calls inside it, such as `MakeGun` making the gun (:684-688), have another def and are skipped. For every other `MakeThing` call the cost is one static field read.
- Built hook: a postfix on `Frame.CompleteConstruction` applies the defaults that spawn code would overwrite (bills, crops, trap rearm, lamp colour) to the recorded thing, only if that thing is spawned.
- Replace Stuff (3526354009, 539,443, 1.7) revives a destroyed building by spawning the new building and then copying a few settings from the destroyed one it kept: its `Source/DestroyedRestore/ReviveBuilding.cs` wraps this method's `GenSpawn.Spawn` call and calls `DestroyedBuildings.ReviveBuilding` right after it. Its handlers are keyed by exact class (`BuildingReviver.cs`, `CanDo` uses `thing.GetType()`): bills for `Building_WorkTable`, the target temperature for `Building_Heater` and `Building_Cooler`, the plant for `Building_PlantGrower` and the settings for `Building_Storage`. `DestroyedBuildings.SaveBuilding` keeps no other building. The same names are in its 1.7 `Replace_Stuff.dll`. So the built hook runs on every revived building, and everything revival doesn't copy gets the default, as on any rebuild. Temperatures set by the made hook are overwritten by revival afterwards, so the old value wins.
- Revival guard: the scope's prefix reads Replace Stuff's `DestroyedBuildings` map component by reflection (`AccessTools.TypeByName("Replace_Stuff.DestroyedRestore.DestroyedBuildings")`, field `destroyedBuildings`, a dictionary keyed by cell) and notes whether it holds a building at the frame's position. Revival removes the entry later in the same call. When the prefix saw one, the built hook adds no bills and sets no crop, since revival restores those. Without Replace Stuff the guard is a null check.
- Exact `Frame` only: Replace Stuff's stuff replacement uses `ReplaceFrame : Frame` and completes through its own method (its `Source/Replace/ReplaceFrame.cs`, a prefix on `Frame.CompleteConstruction` that skips the vanilla body for it). That building keeps its settings.
- Not covered, on purpose: god-mode instant builds, map generation, minified reinstalls, gravship landings.
- Join funnel (1.2, animals, and mechs for auto-repair): animals and colony mechs entering the player faction. Collected in postfixes on `Pawn.SetFaction(Faction, Pawn)` (Verse/Pawn.cs:2702, a prefix snapshots the old faction) and `PawnGenerator.GeneratePawn(PawnGenerationRequest)` (Verse/PawnGenerator.cs:139). Applied when the outermost known caller returns: prefix and finalizer scopes on `Hediff_Pregnant.DoBirthSpawn`, `CompHatcher.Hatch`, `RecruitUtility.Recruit`, `Pawn.PreTraded` and `Bill_ProductionMech.CreateProducts` push and pop a depth counter, and the outermost finalizer applies the collected pawns. That way the defaults land after each caller's own writes. Outside any scope they apply at the end of the collecting postfix. Humanlike pawns never enter: `RaceProps.Animal` or `IsColonyMech` is the first check.
- Unsaved transient state only: the scope fields, the collected pawn list, the new growing zones of one drag, and for pawns that join without a map a `ConditionalWeakTable<Pawn, PendingJoin>` applied when they first spawn. A pawn bought into a caravan has no map, and neither has one bought from an orbital trader: `TradeShip.GiveSoldThingToPlayer` splits it off the ship, calls `PreTraded` and only then drops it in a pod (RimWorld/TradeShip.cs:199-208). `PendingJoin` carries the area label and the auto-slaughter first-animal check.
- Join funnel (1.3, animals, and mechs for auto-repair): animals and colony mechs entering the player faction. Collected in postfixes on `Pawn.SetFaction(Faction, Pawn)` (Verse/Pawn.cs:2702, a prefix snapshots the old faction) and `PawnGenerator.GeneratePawn(PawnGenerationRequest)` (Verse/PawnGenerator.cs:139). Applied when the outermost known caller returns: prefix and finalizer scopes on `Hediff_Pregnant.DoBirthSpawn`, `CompHatcher.Hatch`, `RecruitUtility.Recruit`, `Pawn.PreTraded` and `Bill_ProductionMech.CreateProducts` push and pop a depth counter, and the outermost finalizer applies the collected pawns. That way the defaults land after each caller's own writes. Outside any scope they apply at the end of the collecting postfix. Humanlike pawns never enter: `RaceProps.Animal` or `IsColonyMech` is the first check.
- Unsaved transient state only: the scope fields, the collected pawn list, the new growing zones of one drag, and for pawns that join without a map a `ConditionalWeakTable<Pawn, PendingJoin>` applied when they first spawn. A pawn bought into a caravan has no map, and neither has one bought from an orbital trader: `TradeShip.GiveSoldThingToPlayer` splits it off the ship, calls `PreTraded` and only then drops it in a pod (RimWorld/TradeShip.cs:199-208). `PendingJoin` carries the area label and the auto-slaughter first-animal check. The forbid rules (1.1) add their scope stack with the things recorded in it, the butchering flag and the wait list; a save and reload starts with all of them empty.
### Save safety
- No GameComponent, MapComponent, WorldComponent, ThingComp, def or field of ours ever enters a save. The only data Defaults writes are vanilla fields at creation, apart from the forbid rules (1.2, 1.3), which act in `Pawn.Kill` and `Pawn.DropAndForbidEverything`. Vanilla saves all of them.
- No GameComponent, MapComponent, WorldComponent, ThingComp, def or field of ours ever enters a save. The only data Defaults writes are vanilla fields at creation, apart from the forbid rules (1.1), which write the vanilla forbidden flag when a pawn goes down, dies or is stripped. Vanilla saves all of them.
- Adding the mod mid-save: nothing changes until the player saves a default. Existing things stay as they are.
- Removing it: things keep the values they got, the next load logs nothing, and the file stays in the Config folder, harmless.
- Loading a save runs no Defaults code. Every spawn hook skips `respawningAfterLoad`, and loading never calls a designator, `MakeThing` for a saved thing, `MakeNewBill` or `Frame.CompleteConstruction`.
- Loading a save runs no Defaults code. Every spawn hook skips `respawningAfterLoad`, and loading never calls a designator, `MakeThing` for a saved thing, `MakeNewBill`, `Frame.CompleteConstruction`, `Pawn.Kill`, `MakeDowned` or `Pawn.Strip`.
- Multiplayer: the file differs per client and the hooks fire inside synced commands, so it would desync. The Workshop page says "Multiplayer: not supported yet", as Castes does.
## DLC support
@ -102,7 +123,8 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
- About.xml lists no DLC as a dependency.
- A feature that needs a DLC switches off cleanly without it: its section or row on the settings page shows disabled with "Needs Biotech" (or the DLC it needs), its hooks do nothing, and everything else keeps working. No feature needs Royalty.
- DLC defs only through `MayRequire`: a DefOf field for DLC content carries `[MayRequireBiotech]` (or its DLC's attribute), and XML that names one carries `MayRequire="Ludeon.RimWorld.Biotech"`. So far none is needed: the DLC kinds below are reached through their class or storage parent, and saved names resolve with `GetNamedSilentFail`.
- DLC code behind `ModsConfig.<DLC>Active`, checked before a hook touches DLC content. The patch on `Bill_ProductionMech.CreateProducts` (1.2) is applied in every combination: the class is in the game's own assembly and never runs without Biotech.
- DLC code behind `ModsConfig.<DLC>Active`, checked before a hook touches DLC content. The patch on `Bill_ProductionMech.CreateProducts` (1.3) is applied in every combination: the class is in the game's own assembly and never runs without Biotech.
- The forbid rules (1.1) need no DLC. Slaves (Ideology) and colony mechs (Biotech) belong to your colony through `Faction == Faction.OfPlayer` when their DLC is loaded, with no DLC call. Every mechanoid kind destroys its weapon instead of dropping it in any DLC set (`destroyGearOnDrop` on Core's `BaseMechanoidKind`, `Races_Mechanoid.xml:59`). The special filters for tainted and biocoded things are Core defs (Core `Misc/SpecialThingFilterDefs/SpecialThingFilters.xml:149-203`). The chips superheavy mechs leave exist only with Biotech and reach the enemy rule like any other drop.
- The defaults file is shared by every DLC set. A saved default for a DLC kind that isn't loaded, such as a growth vat default without Biotech, stays in the file and shows on the settings page as a disabled row with "Needs Biotech" (or its DLC). A DLC name inside an entry, such as Wastepack in a stockpile filter, baby food in a bench set or toxipotato in a crop list, is skipped and counts with the names from inactive mods. Both work again when the DLC is back. The DLC of a kind that isn't loaded comes from the `[MayRequire<DLC>]` attribute of the vanilla DefOf field with its name (`ThingDefOf.GrowthVat` is `[MayRequireBiotech]`, ThingDefOf.cs:976-977; `ThingDefOf.BiosculpterPod` is `[MayRequireIdeology]`, :917-918), the way Castes' `DlcSupport` reads it. A kind with no such field, from a removed mod, counts as an inactive name.
- A save made with a DLC loads without it. Defaults keeps nothing in the save (see "Save safety"); the vanilla fields it wrote are the game's to load.
- Anomaly and Odyssey are not installed here, so they are guarded in code only. Defaults names none of their defs. Their content meets checks that are false without them: `RaceProps.Animal` excludes Anomaly entities (`IsAnomalyEntity` checks `ModsConfig.AnomalyActive`, Verse/RaceProperties.cs:265-275, :342), `Pawn.IsMutant` (Verse/Pawn.cs:662) skips mutants, and Odyssey's six trainables (`AttackTarget` to `SludgeSpew`, all `[MayRequireOdyssey]`, RimWorld/TrainableDefOf.cs:12-28) show in the species rows only when Odyssey loads them. The Harbinger tree's corpse stockpile, gravship stockpiles and grow zones, and fishing zones are not reached.
@ -122,28 +144,30 @@ Every Blax mod works with any DLC combination, core only included (rule of 2026-
| Quick setup | 1.0 | None | Works |
| Overlap warnings | 1.0 | None | Works |
| Values for every new bill | 1.0 | None | Works. Mech gestation bills don't exist |
| Graves, sarcophagi, mortars and modded storage | 1.1 | None | Works |
| Growth vats | 1.1 | Biotech | Not offered in the tab, the quick setup or "Add a default"; a saved default stays in the file and shows disabled with "Needs Biotech" |
| Biosculpter pods | 1.1 | Ideology | Not offered in the tab, the quick setup or "Add a default"; a saved default stays in the file and shows disabled with "Needs Ideology" |
| Add a default and drop inactive names | 1.1 | None | Works |
| Defaults per recipe | 1.1 | None | Works |
| "Slaves only" in a recipe default | 1.1 | Ideology | Skipped when a bill is made; kept in the file, and the default's summary marks it "Needs Ideology" |
| "Mechs only" and "non-mechs only" in a recipe default | 1.1 | Biotech | Skipped when a bill is made; kept in the file, and the default's summary marks it "Needs Biotech" |
| Bills for new workbenches | 1.1 | None | Works. A set entry for a DLC recipe, such as baby food (Biotech), is skipped and counted |
| Species defaults, born animals, Training tab | 1.2 | None | Works. Dryads (Ideology) don't exist |
| Auto-slaughter limits | 1.2 | None | Works |
| Corpse rules | 1.2 | None | Works |
| Auto-repair for new mechs | 1.2 | Biotech | Mech section disabled with "Needs Biotech"; saved rows stay |
| Crops for growing zones and plant growers | 1.3 | None | Works. A DLC crop in the list, such as toxipotato (Biotech), is skipped and the next one tried |
| Building settings | 1.3 | None | Works |
| Dropped gear rules | 1.3 | None | Works |
| Mech work modes, areas and gizmo | 1.4 | Biotech | Disabled with "Needs Biotech", no gizmo; saved rows stay |
| Gear rules for your colony and enemies | 1.1 | None | Works. Slaves (Ideology) and colony mechs (Biotech) don't exist; mechs drop no weapon in any set |
| Waiting until the fight is over | 1.1 | None | Works |
| Strip switch | 1.1 | None | Works. The tainted and biocoded filters are Core |
| Corpse rules | 1.1 | None | Works |
| Graves, sarcophagi, mortars and modded storage | 1.2 | None | Works |
| Growth vats | 1.2 | Biotech | Not offered in the tab, the quick setup or "Add a default"; a saved default stays in the file and shows disabled with "Needs Biotech" |
| Biosculpter pods | 1.2 | Ideology | Not offered in the tab, the quick setup or "Add a default"; a saved default stays in the file and shows disabled with "Needs Ideology" |
| Add a default and drop inactive names | 1.2 | None | Works |
| Defaults per recipe | 1.2 | None | Works |
| "Slaves only" in a recipe default | 1.2 | Ideology | Skipped when a bill is made; kept in the file, and the default's summary marks it "Needs Ideology" |
| "Mechs only" and "non-mechs only" in a recipe default | 1.2 | Biotech | Skipped when a bill is made; kept in the file, and the default's summary marks it "Needs Biotech" |
| Bills for new workbenches | 1.2 | None | Works. A set entry for a DLC recipe, such as baby food (Biotech), is skipped and counted |
| Species defaults, born animals, Training tab | 1.3 | None | Works. Dryads (Ideology) don't exist |
| Auto-slaughter limits | 1.3 | None | Works |
| Auto-repair for new mechs | 1.3 | Biotech | Mech section disabled with "Needs Biotech"; saved rows stay |
| Crops for growing zones and plant growers | 1.4 | None | Works. A DLC crop in the list, such as toxipotato (Biotech), is skipped and the next one tried |
| Building settings | 1.4 | None | Works |
| Mech work modes, areas and gizmo | 1.5 | Biotech | Disabled with "Needs Biotech", no gizmo; saved rows stay |
Where the content lives, checked in the 1.7 `Data` folder and the decompiled DefOf classes on 2026-11-29:
- Core: graves and sarcophagi (`Buildings_Misc.xml:771`, `:877`), the mortar (`Buildings_Security_Turrets.xml:532`, `:587`), shelves, bookcases (`Buildings_Furniture.xml:1697`, `:1733`), the hopper (`Buildings_Production.xml:1788`), the hydroponics basin and plant pot, the three lamps with a colour picker (`Buildings_Furniture.xml:1362`, `:1472`, `:1521`), the heater and cooler (`Buildings_Temperature.xml`), the five trainables (`Trainables.xml`), the husky, the chicken and the Scyther.
- Biotech: the growth vat (`Biotech/Defs/ThingDefs_Buildings/Buildings_Misc.xml:331`; `ThingDefOf.GrowthVat`, `[MayRequireBiotech]`, RimWorld/ThingDefOf.cs:977), wastepack (`Items_Resource_Manufactured.xml`; added to the stockpile presets only with Biotech, Verse/ThingFilter.cs:791, :800), toxipotato (`Plants_Cultivated_Farm.xml:5`; `[MayRequireBiotech]`, ThingDefOf.cs:1249), pollution (`PollutionGrid.IsPolluted` is false without Biotech, Verse/PollutionGrid.cs:62), baby food (`RecipeDefs/Recipes_Food.xml:5`, on both stoves through `MayRequire`, Core `Buildings_Production.xml:731-732`, `:824-825`), the militor (`Races_Mechanoids_Light.xml`), the mech gestator, the mechlink (`Hediffs_Mechanitor.xml`), and auto-repair (`CompProperties_MechRepairable` on Core's `BaseMechanoid` with `MayRequire`, Core `Races_Mechanoid.xml:52`). `Pawn.IsColonyMech` checks `ModsConfig.BiotechActive` first (Verse/Pawn.cs:798), and the bill menu offers the mech restrictions only with Biotech (RimWorld/Dialog_BillConfig.cs:561).
- Ideology: the biosculpter pod (`Buildings_Ideo.xml:410`; `ThingDefOf.BiosculpterPod`, `[MayRequireIdeology]`, ThingDefOf.cs:918), dryads (`animalType` Dryad, `Races_Animal_Special.xml:92`; `RaceProps.Dryad`, Verse/RaceProperties.cs:279), nutrifungus (`Plants_Special.xml:5`) and the bill menu's "slaves only" (Dialog_BillConfig.cs:550).
- Core: graves and sarcophagi (`Buildings_Misc.xml:771`, `:877`), the mortar (`Buildings_Security_Turrets.xml:532`, `:587`), shelves, bookcases (`Buildings_Furniture.xml:1697`, `:1733`), the hopper (`Buildings_Production.xml:1788`), the hydroponics basin and plant pot, the three lamps with a colour picker (`Buildings_Furniture.xml:1362`, `:1472`, `:1521`), the heater and cooler (`Buildings_Temperature.xml`), the five trainables (`Trainables.xml`), the husky, the chicken and the Scyther. For the forbid rules: the special filters for biocoded and tainted things (`Misc/SpecialThingFilterDefs/SpecialThingFilters.xml:149`, `:167`, `:185`, `:195`; core mercenaries already carry biocoded weapons, `PawnKindDefs_Humanlikes/PawnKinds_Mercenary.xml:14`), `destroyGearOnDrop` on `BaseMechanoidKind` (`ThingDefs_Races/Races_Mechanoid.xml:59`) and the humanlike weapon pickup (`ThinkTreeDefs/Humanlike.xml:297-300`).
- Biotech: the growth vat (`Biotech/Defs/ThingDefs_Buildings/Buildings_Misc.xml:331`; `ThingDefOf.GrowthVat`, `[MayRequireBiotech]`, RimWorld/ThingDefOf.cs:977), wastepack (`Items_Resource_Manufactured.xml`; added to the stockpile presets only with Biotech, Verse/ThingFilter.cs:791, :800), toxipotato (`Plants_Cultivated_Farm.xml:5`; `[MayRequireBiotech]`, ThingDefOf.cs:1249), pollution (`PollutionGrid.IsPolluted` is false without Biotech, Verse/PollutionGrid.cs:62), baby food (`RecipeDefs/Recipes_Food.xml:5`, on both stoves through `MayRequire`, Core `Buildings_Production.xml:731-732`, `:824-825`), the militor (`Races_Mechanoids_Light.xml`), the mech gestator, the mechlink (`Hediffs_Mechanitor.xml`), auto-repair (`CompProperties_MechRepairable` on Core's `BaseMechanoid` with `MayRequire`, Core `Races_Mechanoid.xml:52`), and the chips hostile superheavy mechs leave (`killedLeavingsPlayerHostile`, `Races_Mechanoids_SuperHeavy.xml:93-95`; RimWorld/GenLeaving.cs:78-80). `Pawn.IsColonyMech` checks `ModsConfig.BiotechActive` first (Verse/Pawn.cs:798), and the bill menu offers the mech restrictions only with Biotech (RimWorld/Dialog_BillConfig.cs:561).
- Ideology: the biosculpter pod (`Buildings_Ideo.xml:410`; `ThingDefOf.BiosculpterPod`, `[MayRequireIdeology]`, ThingDefOf.cs:918), dryads (`animalType` Dryad, `Races_Animal_Special.xml:92`; `RaceProps.Dryad`, Verse/RaceProperties.cs:279), nutrifungus (`Plants_Special.xml:5`), the bill menu's "slaves only" (Dialog_BillConfig.cs:550) and slaves themselves (`Pawn.IsSlaveOfColony`, Verse/Pawn.cs:648).
- Royalty: nothing Defaults touches.
## Releases
@ -154,7 +178,7 @@ Setup, S (half a day): the repo with About.xml, the csproj and the `[StaticConst
#### Defaults library and settings page
- **Players get:** Mod settings > Blax Defaults lists every saved default by section (Stockpiles, Storage buildings and Every new bill; later Recipes, Workbenches, Animals, Growers and buildings, Mechs). Each row says what it sets ("Shelf: Normal, allows 14 of 1,903 items, refuses unlisted items") and has Edit and Forget; Forget asks first. Edit opens the vanilla item filter with a priority dropdown and the rule for unlisted items. It all works from the main menu. A status line shows the entry count and any names from inactive mods. In 1.0 a default is made from the storage tab or the quick setup; "Add a default" and "Drop them" follow in 1.1.
- **Players get:** Mod settings > Blax Defaults lists every saved default by section (Stockpiles, Storage buildings and Every new bill; later Forbid rules, Recipes, Workbenches, Animals, Growers and buildings, Mechs). Each row says what it sets ("Shelf: Normal, allows 14 of 1,903 items, refuses unlisted items") and has Edit and Forget; Forget asks first. Edit opens the vanilla item filter with a priority dropdown and the rule for unlisted items. It all works from the main menu. A status line shows the entry count and any names from inactive mods. In 1.0 a default is made from the storage tab or the quick setup; "Add a default" and "Drop them" follow in 1.2.
- **How:** The library, file handling and templates from the data model. The window is `Mod.DoSettingsWindowContents`, one section per category, each with its master toggle. The storage edit window draws `ThingFilterUI.DoThingFilterConfigWindow` on a scratch `ThingFilter` built from the template. Its parent filter is the building's `fixedStorageSettings` (RimWorld/BuildingProperties.cs:287), else `StorageSettings.EverStorableFixedSettings()` (RimWorld/StorageSettings.cs:136-146). It needs defs only, not a running game.
- A section or saved default whose DLC is off is drawn disabled with "Needs Biotech" (or the DLC it needs) and stays in the file: the mech section, a growth vat or biosculpter pod default, the restriction in a recipe default's summary. DLC names inside an entry count with the names from inactive mods (see "DLC support").
- **Settings:** `enabled` (on; off applies nothing and keeps the file), `stockpileDefaults` (on), `storageDefaults` (on).
@ -174,11 +198,11 @@ Setup, S (half a day): the repo with About.xml, the csproj and the `[StaticConst
#### Defaults button in the storage tab
- **Players get:** A "Defaults" button at the top right of the storage tab of stockpiles and of every storage building Defaults covers: in 1.0 shelves, small shelves, bookcases, hoppers, fridges and weapon racks; from 1.1 graves, sarcophagi, mortars, growth vats, biosculpter pods and other storage too. Its menu has "Make default for new shelves" (always naming the kind), "Load your default", "Load the game's default" and "Forget the default for new shelves", which asks first. The tooltip says whether new shelves start from your default. On a stockpile each entry opens a submenu of stockpile types, and the tooltip lists every type that has a default.
- **Players get:** A "Defaults" button at the top right of the storage tab of stockpiles and of every storage building Defaults covers: in 1.0 shelves, small shelves, bookcases, hoppers, fridges and weapon racks; from 1.2 graves, sarcophagi, mortars, growth vats, biosculpter pods and other storage too. Its menu has "Make default for new shelves" (always naming the kind), "Load your default", "Load the game's default" and "Forget the default for new shelves", which asks first. The tooltip says whether new shelves start from your default. On a stockpile each entry opens a submenu of stockpile types, and the tooltip lists every type that has a default.
- **How:** A postfix on `ITab_Storage.FillTab` (RimWorld/ITab_Storage.cs:104). The tab is 300 by 480, contracted by 10 (`:13`, `:108`), and the priority button takes 160 px of the 35 px top row (`:113`), so ours sits at (180, 10, 110, 29) in tab coordinates. When `IsPrioritySettingVisible` is false (`:87`) the top row is 20 px (`:89`), and the button becomes a 20 px icon at (270, 10). The subclasses `ITab_Shells` and `ITab_BiosculpterNutritionStorage` don't override `FillTab`, so they get it too.
- Kind: from the protected `SelStoreSettingsParent` (`:15`, read through an AccessTools delegate). A `Zone_Stockpile` doesn't remember which designator made it: its constructor uses the preset only for the label and `SetFromPreset`, and `ExposeData` saves only the settings (RimWorld/Zone_Stockpile.cs:37-48). So on a stockpile all four entries open the same submenu: "stockpile", "dumping stockpile", and one entry per modded stockpile designator. A thing, or a comp of one, gives its def; a `Blueprint_Storage` gives its `BuildDef` and a `Frame` its `entityDefToBuild`. A `StorageGroup` of linked shelves (`:28-52`) gives its first member's def, and Load writes the group's settings.
- Turrets: `ITab_Shells` falls back to the turret's gun when the selected `Building_TurretGun` has no storage itself (RimWorld/ITab_Shells.cs:5-19), and the gun's `CompChangeableProjectile` reads the gun def's `building.defaultStorageSettings` (RimWorld/CompChangeableProjectile.cs:51-58; Core `Buildings_Security_Turrets.xml:618-640` puts both on `Artillery_Mortar`). When the selected object is a `Building_TurretGun`, the kind is the turret's def (`Turret_Mortar`), the settings are the gun comp's, and the game's default is the gun def's. The made hook in 1.1 uses the same key.
- No button: any parent that is none of the above, such as the `Zone_PresetStockpile` of Preset Filtered Zones (see "New stockpiles start from your default"). In 1.0 also any thing whose def has no storage blueprint, since nothing would apply its default yet; 1.1 lifts that.
- Turrets: `ITab_Shells` falls back to the turret's gun when the selected `Building_TurretGun` has no storage itself (RimWorld/ITab_Shells.cs:5-19), and the gun's `CompChangeableProjectile` reads the gun def's `building.defaultStorageSettings` (RimWorld/CompChangeableProjectile.cs:51-58; Core `Buildings_Security_Turrets.xml:618-640` puts both on `Artillery_Mortar`). When the selected object is a `Building_TurretGun`, the kind is the turret's def (`Turret_Mortar`), the settings are the gun comp's, and the game's default is the gun def's. The made hook in 1.2 uses the same key.
- No button: any parent that is none of the above, such as the `Zone_PresetStockpile` of Preset Filtered Zones (see "New stockpiles start from your default"). In 1.0 also any thing whose def has no storage blueprint, since nothing would apply its default yet; 1.2 lifts that.
- Load your default first loads the game's default for the kind, then applies the template, so it gives the same settings as a new one. The `Priority` setter notifies haul destinations and haulables while playing (RimWorld/StorageSettings.cs:23-56).
- The game's default is built on a scratch `new StorageSettings()` and written with `StorageSettings.CopyFrom` (:90-95), whose `ThingFilter.CopyAllowancesFrom` replaces the allowed defs, special filters and ranges (Verse/ThingFilter.cs:634-665). For stockpiles the scratch gets `SetFromPreset` with the type's preset and Priority Normal, as the vanilla constructor does (RimWorld/Zone_Stockpile.cs:37-43). `SetFromPreset` alone only adds categories (Verse/ThingFilter.cs:779-800), so on an existing stockpile it would keep everything already allowed. For buildings the scratch copies `def.building.defaultStorageSettings` (RimWorld/BuildingProperties.cs:289), or keeps the empty filter at the priority a fresh `StorageSettings(parent)` takes when the def has none, as `PostMake` leaves it. Defaults never edits that field, so it always holds the loaded value.
- **Settings:** covered by `enabled`.
@ -215,7 +239,7 @@ Setup, S (half a day): the repo with About.xml, the csproj and the `[StaticConst
#### New storage buildings start from your default
- **Players get:** Place a shelf, small shelf, bookcase, hopper, fridge or weapon rack and it starts with the default you saved for that building. Changes you make on the blueprint before it's built still win. A shelf, small shelf, hopper or other `Building_Storage` that auto-rebuild puts back keeps its old settings; a rebuilt bookcase starts from your default like a new one. Ruins, map generation and trader stock keep the game's settings. Graves, sarcophagi, mortars and other storage without a storage blueprint follow in 1.1.
- **Players get:** Place a shelf, small shelf, bookcase, hopper, fridge or weapon rack and it starts with the default you saved for that building. Changes you make on the blueprint before it's built still win. A shelf, small shelf, hopper or other `Building_Storage` that auto-rebuild puts back keeps its old settings; a rebuilt bookcase starts from your default like a new one. Ruins, map generation and trader stock keep the game's settings. Graves, sarcophagi, mortars and other storage without a storage blueprint follow in 1.2.
- **How:** Every def whose `building.blueprintClass` is `Blueprint_Storage` or a subclass (RimWorld/BuildingProperties.cs:45). In vanilla that is the shelves, the bookcases (`Blueprint_StorageWithRoomHighlight`, a subclass) and the hopper (`Core/Defs/ThingDefs_Buildings/Buildings_Furniture.xml:1550` and `:1670`, `Buildings_Production.xml:1809`). In the installed mods, RimFridge's fridges (its 1.6 `Defs/ThingDefs_Buildings/Fridge_Base.xml:33`) and Weapon Racks' racks (parent `StorageShelfBase`, its 1.7 `Defs/ThingDefs/ThingDefs_Buildings.xml:5`).
- A postfix on `Blueprint_Storage.PostMake` (RimWorld/Blueprint_Storage.cs:60-68) applies the template after vanilla copied the def's default. The blueprint hands its settings to the frame (`MakeSolidThing`, `:92-100`), and `Frame.CompleteConstruction` copies them onto every `IStorageGroupMember` after it spawns (RimWorld/Frame.cs:326-330), bookcases included. That replaces the def default the building's own `PostMake` set (RimWorld/Building_Storage.cs:142-150).
- Auto-rebuild: a destroyed frame hands its settings to the new blueprint for any `Blueprint_Storage` (RimWorld/Frame.cs:192-204), but a destroyed building only when it is a `Building_Storage` (Verse/Building.cs:322-327). `Building_Bookcase` isn't one (RimWorld/Building_Bookcase.cs:8), so a rebuilt bookcase keeps the new blueprint's `PostMake` settings, which are now the template.
@ -237,7 +261,7 @@ Setup, S (half a day): the repo with About.xml, the csproj and the `[StaticConst
#### Quick setup: new shelves start empty
- **Players get:** A settings-page button "New shelves start empty at Normal" opens a list of every storage building with a checkbox. General-purpose shelves are ticked; hoppers, bookcases and single-purpose storage such as chemfuel pumps and weapon racks start unticked. Confirming saves an empty default at Normal for each ticked kind, one that also refuses items mods add later. Kinds that already have a default are marked and start unticked.
- **How:** The list holds defs with a storage tab that Defaults covers: in 1.0 those with a storage blueprint, from 1.1 every one. A kind is ticked when all of these hold:
- **How:** The list holds defs with a storage tab that Defaults covers: in 1.0 those with a storage blueprint, from 1.2 every one. A kind is ticked when all of these hold:
- `thingClass` is `Building_Storage` or a subclass;
- `building.isHopper` (RimWorld/BuildingProperties.cs:138) is false, since an empty hopper starves the nutrient paste dispenser;
- its parent filter (`fixedStorageSettings`, else every storable item) allows things from at least two top-level item categories, the children of `ThingCategoryDefOf.Root`. Each allowed def counts under the top-level category its first `thingCategories` entry leads to; defs without one don't count.
@ -248,7 +272,7 @@ Setup, S (half a day): the repo with About.xml, the csproj and the `[StaticConst
- **Overlaps:** with [FSF] No Default Shelf Storage active, the button's tooltip says the two do the same thing.
- **Replaces:** [FSF] No Default Shelf Storage (945085502, 93,146, 1.7) and "No Default Storage Settings" in FrozenSnowFox Tweaks (40,720, 1.7), per kind instead of blanket.
- **Effort:** S, half a day.
- **Tests:** The setup with its preselection creates empty Normal templates for Shelf and ShelfSmall and none for Hopper or Bookcase. A shelf built afterwards allows nothing, at Normal. With the test mod's storable def `BlaxTest_Widget` removed from the template's lists, as if a mod had added it later, that shelf refuses it; the same template with `unlisted = Game` lets it follow the shelf's def default. -Compat: the RimFridge fridge is ticked and a Weapon Racks rack unticked; from 1.1, Rimefeller's ChemfuelHopper and ChemfuelSiphon are listed and unticked.
- **Tests:** The setup with its preselection creates empty Normal templates for Shelf and ShelfSmall and none for Hopper or Bookcase. A shelf built afterwards allows nothing, at Normal. With the test mod's storable def `BlaxTest_Widget` removed from the template's lists, as if a mod had added it later, that shelf refuses it; the same template with `unlisted = Game` lets it follow the shelf's def default. -Compat: the RimFridge fridge is ticked and a Weapon Racks rack unticked; from 1.2, Rimefeller's ChemfuelHopper and ChemfuelSiphon are listed and unticked.
- **Risks:** none known.
#### Overlap warnings
@ -265,7 +289,7 @@ Setup, S (half a day): the repo with About.xml, the csproj and the `[StaticConst
#### Values for every new bill
- **Players get:** A settings section "Every new bill": repeat mode (do X times, do until you have X, do forever), the count (1), the target (10), pause when satisfied (off) and resume at (5), ingredient radius (unlimited), allowed skill range (0 to 20), where products go (best stockpile or drop on floor), count equipped (off), count tainted (off), and the hit points and quality ranges used for counting. Each value starts at "the game's default", and only values you change are applied. In 1.0 they are set on the settings page; the bill window's Defaults button follows in 1.1.
- **Players get:** A settings section "Every new bill": repeat mode (do X times, do until you have X, do forever), the count (1), the target (10), pause when satisfied (off) and resume at (5), ingredient radius (unlimited), allowed skill range (0 to 20), where products go (best stockpile or drop on floor), count equipped (off), count tainted (off), and the hit points and quality ranges used for counting. Each value starts at "the game's default", and only values you change are applied. In 1.0 they are set on the settings page; the bill window's Defaults button follows in 1.2.
- **How:** A postfix on `BillUtility.MakeNewBill` (RimWorld/BillUtility.cs:36-55). Its only vanilla callers are the Bills tab's add menu (RimWorld/ITab_Bills.cs:114) and the dev colony maker.
- Applies to `Bill_Production` and `Bill_ProductionWithUft`. `Bill_ProductionMech`, `Bill_ResurrectMech` and `Bill_Autonomous`, also returned there, get only recipe defaults, because gestation and forming bills store no products.
- Fields: `repeatMode`, `repeatCount`, `targetCount`, `pauseWhenSatisfied`, `unpauseWhenYouHave`, `includeEquipped`, `includeTainted`, `hpRange`, `qualityRange` (RimWorld/Bill_Production.cs:12-36), `ingredientSearchRadius` and `allowedSkillRange` (RimWorld/Bill.cs:33, :35).
@ -280,7 +304,130 @@ Setup, S (half a day): the repo with About.xml, the csproj and the `[StaticConst
- **Tests:** With "drop on floor, radius 30, do until 20", `MakeNewBill` for CookMealSimple returns a bill with DropOnFloor, radius 30, TargetCount and target 20. A recipe whose counter can't count products gets RepeatCount. A clone of that bill keeps the source values when the global values change. `CreateSurgeryBill` returns an untouched bill. With Biotech (skipped without), a mech gestation bill keeps vanilla values.
- **Risks:** `MakeNewBill` is small and called from a lambda, so the JIT may inline it into the menu. Headless tests call it directly and can't prove the menu path. If a manual check shows the postfix skipped there, the fallback is a postfix on the `Bill_Production(RecipeDef, Precept_ThingStyle)` constructor (Bill_Production.cs:108-111), which runs for new bills only (cloning and loading use the parameterless one) but also for bills other mods create in code; the README then says so.
### 1.1 More storage, recipe defaults and workbench bills (5 days)
### 1.1 Forbid rules (4 days)
What stays forbidden when a pawn goes down, dies or is stripped, set per group with the vanilla item filter. Nothing here is a "Make default": every rule sits in a "Forbid rules" section of the settings page and ships off.
#### What the game forbids today
Read in the 1.7.5021 code. Two calls drop a pawn's things and forbid some of them: going down (`Pawn_HealthTracker.MakeDowned`, Verse/Pawn_HealthTracker.cs:837, sets the state at :848 and calls `DropAndForbidEverything(keepInventoryAndEquipmentIfInBed: true, rememberPrimary: true)` at :856-860 while the pawn is spawned) and dying (`Pawn.Kill`, Verse/Pawn.cs:2096, calls `DropAndForbidEverything()` at :2230-2233 when the pawn was spawned). `DropAndForbidEverything` is Pawn.cs:2890-2928. Stripping is the third way (`Pawn.Strip`, :3895-3921).
| Thing | Goes down | Dies | Stripped |
|---|---|---|---|
| Equipment (the weapon) | Dropped and forbidden anywhere (Pawn.cs:2921, Verse/Pawn_EquipmentTracker.cs:162). Kept when the pawn goes down in a bed (Pawn.cs:2919) | Dropped and forbidden anywhere, in a bed too | Dropped allowed (Pawn.cs:3913) |
| Inventory: food, medicine, drugs, silver, a trader's wares, Simple Sidearms' sidearms | Dropped, forbidden only outside the home area (Pawn.cs:2922-2925, Verse/Pawn_InventoryTracker.cs:182-187). A stack that merges into one on the ground forbids that stack. Kept in a bed | The same, in a bed too | Dropped with the flag it had (Pawn.cs:3915 passes neither forbid nor unforbid) |
| Carried thing | Dropped, forbidden anywhere when the pawn's faction is hostile to you, else unchanged (Pawn.cs:2915-2918, Verse/Pawn_CarryTracker.cs:136-139) | The same | Not stripped |
| Apparel | Stays worn | Stays on the corpse. A violent death costs each piece 15 to 40% of its hit points (RimWorld/Pawn_ApparelTracker.cs:612-618), and apparel with `careIfWornByCorpse` turns tainted (RimWorld/Apparel.cs:182-187) | Dropped allowed (Pawn.cs:3914) |
| Corpse | | Forbidden outside the home area, unless designated for hunting or slaughter or reserved by the hunter who killed it (Pawn.cs:2132-2133, :2197-2204) | |
What follows from it:
- Gear drops once: when the pawn goes down, or when it dies without going down. A pawn that goes down drops its weapon and inventory then, and when it dies later there is nothing left to drop. Violence that would down a pawn outside your faction often kills it on the spot instead, without `MakeDowned` (Verse/Pawn_HealthTracker.cs:527-572, `pawn.Kill(dinfo)` at :571): humanlikes 80% at population intent 0, 87% at -1 and 26% at 8 (Verse/HealthTuning.cs:115-122; 85%, 92% and 30% with wavering prisoners, :124-131), times the difficulty's enemy death factor (Pawn_HealthTracker.cs:557), animals 50% (:553) and mechs always (:557). Kinds with `forceDeathOnDowned` always die (:522-526). Your own pawns, prisoners and guests never roll it (:527). So one rule covers both, and a rule for either alone would miss gear.
- Inside the home area the game forbids only the weapon and an enemy's carried thing; dropped food and medicine are already allowed there. Food left forbidden outdoors lies outside the home area.
- Things deteriorate only on the ground (RimWorld/SteadyEnvironmentEffects.cs:120-135 walks the things in each cell), so food and medicine leave an inventory in the condition they went in.
- Going down remembers the main weapon (`mindState.droppedWeapon`, Pawn_EquipmentTracker.cs:174-177). Every humanlike picks it up after getting up, forbidden or not (`JobGiver_PickupDroppedWeapon` with `ignoreForbidden`, Core `ThinkTreeDefs/Humanlike.xml:297-300`; Verse.AI/JobGiver_PickupDroppedWeapon.cs:9-16), as long as both stay where they are. The link is cleared once the weapon isn't spawned, for example in a hauler's hands (Verse.AI/Pawn_MindState.cs:557-560), and once the pawn itself despawns (`Pawn.DeSpawn` sets `mindState.droppedWeapon = null`, Pawn.cs:2418). Rescue despawns it: `JobDriver_TakeToBed` carries the pawn through `Toils_Haul.StartCarryThing` (RimWorld/JobDriver_TakeToBed.cs:121, Verse.AI/Toils_Haul.cs:77), whose `Pawn_CarryTracker.TryStartCarry` splits it off the map (Verse/Pawn_CarryTracker.cs:94; `SplitOff` calls `DeSpawnOrDeselect`, Verse/Thing.cs:1616, :930-936). A kidnapper carrying it, leaving the map and death despawn it too; death despawns the pawn (Pawn.cs:2170) before `Pawn.Destroy` clears the mind (:2367). The pickup also needs the weapon on the pawn's own map (Verse.AI/JobGiver_PickupDroppedWeapon.cs:11-14). A rescued colonist therefore never goes back for its weapon, and vanilla leaves it forbidden where it fell. Equipping another weapon clears the link too (Verse/Pawn_EquipmentTracker.cs:227), and so does the pickup job as it starts (Verse.AI/JobDriver_Equip.cs:66), which then holds a reservation on the weapon (:57).
- Every mechanoid kind destroys its weapon instead of dropping it (`destroyGearOnDrop`, Core `Races_Mechanoid.xml:59`; Pawn.cs:2892-2896), yours and enemies' alike. A hostile superheavy mech (Biotech) leaves a chip, forbidden outside the home area (RimWorld/GenLeaving.cs:78-80, :180-183, reached from Pawn.cs:2236).
- Stripping is a player order: the Strip designation or right-click order (`JobDriver_Strip`, RimWorld/JobDriver_Strip.cs:31-38, which won't touch a forbidden target, :27), a corpse's Strip (Verse/Corpse.cs:386-389), butchering (`autoStripCorpses`, on by default, Verse/RecipeDef.cs:45; Verse.AI/Toils_Recipe.cs:336-339) and caravan forming's auto strip (RimWorld/Dialog_FormCaravan.cs:756-759). Cremation turns it off (Core `RecipeDefs/Recipes_Cremation.xml:13`), so a cremated corpse burns with its apparel. In a caravan, Strip moves everything into inventories (Pawn.cs:3898-3909).
- `DropAndForbidEverything` has three more callers: trading a pawn away (`PreTraded`, Pawn.cs:2612), capture (RimWorld/Pawn_GuestTracker.cs:461) and Anomaly's distress-call sites while their map is made (RimWorld.Planet/DistressCallUtility.cs:50).
Per pawn kind:
- Colonists: the weapon, the inventory (carried medicine, drugs, food) and whatever they were hauling, which keeps its flag.
- Slaves (Ideology): the same code; most carry no weapon.
- Prisoners: capture drops everything (Pawn_GuestTracker.cs:461), so a prisoner holds nothing unless it grabs a weapon in a prison break. Breaking out makes it hostile to you (RimWorld/GenHostility.cs:138-141), though never an active threat that holds up the wait (`IsPotentialThreat` skips prisoners, :277), and it stays a prisoner of your colony: a prison break only gives it a `LordJob_PrisonBreak` (RimWorld/PrisonBreakUtility.cs:195-203), and the host faction stays yours. Its drops follow the colony rule, like a rebelling slave's.
- Colony mechs (Biotech): the weapon is destroyed; a carried thing keeps its flag.
- Colony animals: no equipment; a pack animal's inventory drops, forbidden outside the home area.
- Raiders: the weapon forbidden; the inventory (medicine, drugs, food) forbidden outside the home area; stolen goods they carry forbidden anywhere; the corpse forbidden outside the home area. Hostile mechs drop nothing but superheavy chips.
- Neutral visitors and traders: as raiders, apart from what they carry. A trader's wares sit in its own and its pack animals' inventories (RimWorld/Pawn_TraderTracker.cs:17-37), so a downed trader drops them, forbidden outside the home area. Stripping a living member of a non-hostile faction costs 40 goodwill (RimWorld/Faction.cs:810-816).
- Quest lodgers belong to your faction with an extra home faction (`IsQuestLodger`, RimWorld/QuestUtility.cs:524-531); other quest pawns follow their faction.
#### Gear rules for your colony and for enemies
- **Players get:** Two rules on the settings page, "Gear your colony drops" and "Gear enemies drop", each off until you turn it on. When one of the group's pawns goes down or dies, everything the game forbids that matches the rule's filter is allowed again once the fight is over (next feature); what doesn't match stays forbidden, as in vanilla. A rule never forbids a dropped thing the game left allowed. Your colony is colonists, slaves (Ideology), colony mechs (Biotech), colony animals and prisoners, also while they break out; enemies are everyone else hostile to you when they go down or die. Neutral visitors, traders and quest lodgers keep the game's rules, and a line under the rules says so. A downed colonist's main weapon stays forbidden while the colonist lies where it fell, so it picks the weapon up after getting up, as vanilla does; once the colonist is rescued, carried off or dies, the rule decides. Each rule has:
- a filter: Edit opens the vanilla item filter with the hit points and quality sliders stockpiles have and its special filters (tainted, biocoded, rotten, smeltable). The row says what it allows ("all items, hit points 50 to 100%, Normal or better"). Until a filter is saved, by Edit or the suggested setup, the rule's checkbox and its strip switch are disabled and say "Edit the filter or use the suggested setup first". Forget on the row asks first, deletes the filter and turns the rule and its strip switch off;
- "Where": anywhere (the default) or only inside the home area;
- "Stripping forbids what doesn't match" (see below);
- "Use the suggested setup", which asks first. Enemies: every item, hit points 50 to 100%, Normal or better, anywhere, stripping on, so a Poor rifle or one below 50% stays forbidden while food, medicine, drugs and silver are allowed. Your colony: every item, full ranges, anywhere, stripping off.
- **How:**
- Groups, read in the prefix while the pawn is alive: your colony when `Faction == Faction.OfPlayer` and not `IsQuestLodger()` (RimWorld/QuestUtility.cs:524), or `IsPrisonerOfColony` (Verse/Pawn.cs:624); otherwise enemies when `HostileTo(Faction.OfPlayer)` (RimWorld/GenHostility.cs:118), which covers raiders, manhunting animals and predators hunting yours (:130-137); otherwise no rule. A dead pawn is destroyed (`Thing.Kill`, Verse/Thing.cs:1038-1041), and `HostileTo` is false for anything destroyed (GenHostility.cs:120-123), so the group can't be read afterwards. A berserk colonist, a rebelling slave and a prisoner breaking out stay in your colony: the colony test comes first, and a prison break leaves the pawn a prisoner of your colony (RimWorld/PrisonBreakUtility.cs:195-203), though `HostileTo` is true for it (GenHostility.cs:138-141).
- Scopes: a prefix on `Pawn.Kill(DamageInfo?, Hediff)` (Verse/Pawn.cs:2096) and one on the private `Pawn_HealthTracker.MakeDowned(DamageInfo?, Hediff)` (Verse/Pawn_HealthTracker.cs:837, called from :577 and :833) push the pawn and its group onto a `[ThreadStatic]` stack, while the game is playing and no map is being made (`MapGenerator.mapBeingGenerated`, Verse/MapGenerator.cs:12). A finalizer pops it, even on an exception. A death inside a death, such as a boomalope exploding in the death action (Pawn.cs:2281-2284), pushes its own scope. Both methods are long, so neither is inlined.
- Recorder: a prefix and a postfix on the setter of `CompForbiddable.Forbidden` (RimWorld/CompForbiddable.cs:20-45). While a scope is open, the prefix reads the old value and the postfix adds the thing to the innermost scope when it went from allowed to forbidden. So a scope holds exactly what the game forbade in that call: the weapon, inventory outside the home area (including a stack a drop merged into, since the game forbids the merged stack, Pawn_InventoryTracker.cs:182-187), an enemy's carried thing, the corpse (Pawn.cs:2203) and superheavy chips (GenLeaving.cs:180-183). A thing that was forbidden already isn't recorded and stays forbidden. Outside a scope the cost is one static field read, plus the wait list check below. The recorder never changes a forbid; the setter has some twenty lines and calls into the listers, so it isn't inlined. Nothing patches `ForbidUtility.SetForbidden` or `SetForbiddenIfOutsideHomeArea` (RimWorld/ForbidUtility.cs:16-58).
- Apply, in the postfixes of `Kill` and `MakeDowned`: a recorded thing that is no longer spawned or no longer forbidden is skipped; a corpse goes to the corpse rules. Any other thing is allowed when its group's rule is on and has a filter, its cell passes "Where" (`map.areaManager.Home[cell]`) and the filter allows it, through `SetForbidden(false, warnOnFail: false)`: at once when the map has no active threat, else through the wait list.
- Remembered weapon: for your colony with its rule on, the `MakeDowned` postfix never allows `pawn.mindState.droppedWeapon` at once, threat or not. It goes on the wait list with its owner, and the 250-tick check keeps that entry while `owner.mindState?.droppedWeapon == weapon`, which in practice is while the colonist lies where it fell. Rescue, a kidnapper, leaving the map and death despawn the owner and break the link (Pawn.cs:2418, see "What the game forbids today"), and from the next check the weapon is decided like any other entry: no threat, still spawned, still forbidden, inside "Where", allowed by the filter. A weapon no longer spawned leaves the list, because the colonist or a hauler took it. When the pickup job starts it breaks the link and reserves the weapon (Verse.AI/JobDriver_Equip.cs:57, :66), so a check that allows the weapon on the colonist's way changes nothing for it. The link is read in the check, so this needs no patch, and a colonist that dies after going down needs nothing in the `Kill` prefix.
- Filter: a StorageTemplate (see the data model) under `forbid:colony` and `forbid:enemies`, priority unused. Its parent filter is every storable item (`StorageSettings.EverStorableFixedSettings`, RimWorld/StorageSettings.cs:136-146) without the Corpses category, which the corpse rules cover. The edit window is the 1.0 storage editor without the priority, its unlisted rule offering "Refuse" (stays forbidden) and "Allow"; the suggested setups save "Allow", so items a mod adds later follow the ranges. Applying builds one scratch `ThingFilter` per rule, kept until the template changes, and calls `ThingFilter.Allows(Thing)` (Verse/ThingFilter.cs:874-906): the def, the hit points as a rounded percentage when the range isn't full (:881-889, `CaresAboutHitPoints` :263-273), the quality of things that have one (:894-897) and the special filters (:898-904).
- The ranges count for every item that has hit points or quality. Food and medicine have hit points but leave the inventory in the condition they went in, and silver has none (Core `ThingDefs_Items/Items_Resource_Stuff.xml:18`), so in practice the ranges sort weapons, and apparel when stripping.
- Not reached: trading a pawn away, capture and distress-call sites, which call `DropAndForbidEverything` outside `Kill` and `MakeDowned`.
- **Settings:** `forbidRules` (on, as a category), `colonyGearRule` (off), `colonyGearAnywhere` (on), `enemyGearRule` (off), `enemyGearAnywhere` (on). The filters live in the defaults file, so a mod settings file that fails to load turns the rules off and keeps the filters. Turning a rule on needs a saved filter under `forbid:colony` or `forbid:enemies`. Forget on that entry deletes it and sets the rule's toggle and its strip toggle to false. A rule that is on but finds no filter, because the defaults file failed to load, acts as off and its row says why; the toggle stays as saved, since nothing is written at load.
- **Save and removal:** the vanilla forbidden flag on each thing. Removing the mod leaves the flags as they are.
- **Overlaps:**
- KilledEnemyAutoAllowed (Continued) (2159090973, 5,232, 1.7) allows everything killed pawns drop, anywhere, for every pawn (its Workshop page); warned.
- Allow Everything (2592726874, 3,842, no 1.7) allows every item on the map, which undoes what a rule leaves forbidden; warned.
- Non uno Pinata (don't drop items) (1778821244, 143,710, no 1.7) keeps gear on downed and dead pawns, with options for colonists and outsiders, so little drops for the rules to sort; warned.
- Looting Manager (2002001082, 7,216, no 1.7) and No more weapons bloat (3069777660, 3,648, 1.7) remove, biocode or degrade enemy gear. The rules see what lands; a change those mods make after our postfix keeps the flag the rule gave.
- Mechanoids Drop Guns! (Continued) (2059921296, 2,409, 1.7) makes mechs drop their weapons, which then fall under the enemy rule.
- Simple Sidearms (927155256, 973,410, no 1.7) keeps sidearms in the inventory, so they drop as inventory, forbidden only outside the home area, and the filter sorts them as weapons.
- Forced Rearmament (3232549170, 22,494, 1.7) and Where is my weapon? (1539028008, 201,950, no 1.7) make colonists fetch their dropped weapon; the remembered weapon waiting while its owner lies where it fell suits both.
- Allow Tool (761421485, 1,388,637, no 1.7; its changelog lists an option to unforbid the items next to a downed pawn you finish off) and Keyz' Allow Utilities (3524716849, 91,139, 1.7) allow by hand and compose. Pick Up And Haul (1279012058, 1,784,724, no 1.7) hauls what is allowed. Hospitality (753498552, 768,458, no 1.7): guests stay vanilla.
- No Workshop mod found that allows dropped things by quality or condition (searched 2026-11-29).
- The overlap warnings gain this category: KilledEnemyAutoAllowed (Continued) and its 1.0 original (1858219355, 291), Allow Everything, Non uno Pinata and, for the corpse rules, Allow Dead Animals. Package ids are read from each mod's About.xml before shipping.
- **Replaces:** KilledEnemyAutoAllowed (Continued) (5.2k) for your colony and enemies: with both rules on, every item allowed, anywhere, and the corpse rules on, what dying pawns drop is allowed everywhere, while neutral pawns' drops stay vanilla. Allow Everything (3.8k) for what downed and dead pawns drop.
- **Effort:** M + S, 2.5 days, including the settings section and the suggested setups; the S is the remembered weapon's wait.
- **Tests:** No hostile pawn on the test map unless a test says so.
- A colonist downed by damage outside the home area, colony rule on with the suggested setup: its packaged survival meal and herbal medicine on the ground are allowed; its rifle is forbidden, is its `droppedWeapon` and stays forbidden over several checks. Killed afterwards: the rifle is allowed after the next check. With the rule off, all three stay forbidden.
- The same downed colonist carried to a bed by a rescuer: its rifle is allowed after the next check.
- The same downed colonist healed where it fell: it gets up and equips its still forbidden rifle, the entry leaves the list and nothing logs.
- A prisoner breaking out, downed outside the home area with a knife: the knife stays forbidden while the prisoner lies there and follows the colony rule once the prisoner is carried back to its cell.
- With no filter saved, `colonyGearRule` and `enemyGearRule` can't be set and a raider's drops stay vanilla. Forget on a saved enemy filter sets `enemyGearRule` and `enemyStripRule` to false. With `enemyGearRule` on in mod settings and an empty library, a raider's drops stay vanilla and nothing logs.
- A raider killed outside the home area, enemy rule on with the suggested setup: a Normal assault rifle at 80% is allowed, a Poor one at 80% and a Normal one at 40% stay forbidden, its go-juice and medicine are allowed, and its corpse stays forbidden (corpse rules off).
- A raider downed, not killed: its weapon is allowed. Captured afterwards: nothing else changes and nothing logs.
- "Only inside the home area": a raider killed outside stays vanilla; killed inside, its Normal 80% rifle is allowed.
- Two raiders with 5 medicine each killed on one cell outside the home area: one stack of 10, allowed. A stack of 10 medicine the player forbade next to a raider killed with 5: the merged stack stays forbidden.
- A raider carrying 200 silver killed inside the home area: allowed with the rule on, forbidden with it off.
- A filter refusing medicine never forbids: a raider killed inside the home area leaves its medicine allowed.
- With both rules on, a downed trader guest's wares outside the home area and a downed quest lodger's weapon stay forbidden.
- Ideology (skipped without): a downed slave's meal outside the home area follows the colony rule. Biotech (skipped without): a colony mech hauling steel goes down and the steel keeps its flag; a hostile Scyther dies, drops no weapon and nothing logs.
- -Compat: with Hospitality, a downed guest's weapon stays forbidden; with Pick Up And Haul, an allowed rifle gets hauled.
- Phase 2: the flags persist, and the .rws contains no "BlaxDefaults" outside the meta block.
- **Risks:** haulers walk to the far side of the map after a fight; "only inside the home area" keeps them close. A colonist drafted right after getting up keeps its remembered weapon waiting until it is undrafted and fetches it. A mod that forbids drops in a postfix after ours wins.
#### Wait until the fight is over
- **Players get:** Things a rule allows wait while an enemy that can still fight is on the map, and are allowed once none is left, so no rule sends a hauler into a fight. A downed colonist's weapon also waits while the colonist lies where it fell (see the gear rules). Changing a waiting thing's flag yourself takes it off the list. A save and reload forgets the list: things still waiting stay forbidden, as in vanilla.
- **How:** An unsaved list of thing, rule and, for a remembered weapon, its owner, with the `Game` it belongs to; a different `Current.Game` clears it. A postfix on `Map.MapPostTick` (Verse/Map.cs:966) returns at once while the list is empty. Otherwise, every 250 ticks for each map with entries: an entry whose thing is no longer spawned on that map leaves the list; a remembered weapon stays while `owner.mindState?.droppedWeapon == weapon`; if any other entry is left, it asks `GenHostility.AnyHostileActiveThreatToPlayer(map)` (RimWorld/GenHostility.cs:227-236), which skips downed pawns (Verse/Pawn.cs:4162-4172), sleeping, fleeing, dormant and fogged ones and hive defenders (GenHostility.cs:266-300, :311-334). With no threat, each of those entries whose rule is still on, still forbidden, still inside "Where" and matching the current filter is allowed, and all of them leave the list. Outside a scope and only while the list isn't empty, the recorder's postfix drops a thing whose flag changes. Removing a map drops its entries.
- An awake mech cluster or a siege camp keeps the list waiting until it is gone; a dormant cluster doesn't (`CompCanBeDormant`, GenHostility.cs:285-289).
- **Settings:** none; both gear rules and the corpse rules wait.
- **Save and removal:** the list is never saved.
- **Overlaps:** none.
- **Replaces:** nothing.
- **Effort:** S, half a day.
- **Tests:** With a hostile test pawn standing on the map, a raider killed with the enemy rule on leaves its rifle forbidden; after the hostile pawn is downed and 250 ticks pass, the rifle is allowed. A waiting rifle the player allows and forbids again stays forbidden at the end. A waiting rifle a pawn picks up leaves the list without a log line. A waiting rifle the filter no longer allows stays forbidden. Phase 2: a rifle still waiting at save time stays forbidden after the load, and nothing logs.
#### Stripping forbids what doesn't match
- **Players get:** Per rule, "Stripping forbids what doesn't match", off until you turn it on; the suggested enemy setup turns it on. Stripping one of the group's pawns or corpses then forbids each dropped thing the filter refuses, and the rest stays allowed, as vanilla leaves it. This is how the rules reach apparel: worn apparel never drops when a pawn goes down or dies, so a raider's duster reaches you through stripping. With the suggested enemy setup, a stripped Normal duster at 80% stays allowed and a Poor tuque is forbidden where it lands. Butchering strips too but stays vanilla, because what a butcher strips lands next to the bench, where a burn bill or a dumping stockpile can take it.
- **How:** A prefix on `Pawn.Strip(bool)` (Verse/Pawn.cs:3895), which a corpse's Strip calls (Verse/Corpse.cs:386-389), records the pawn's equipment, apparel and inventory in `__state`. The postfix, when the pawn's group has its strip switch on, forbids with `SetForbidden(true, warnOnFail: false)` each recorded thing now spawned on a map, inside "Where", that the filter refuses. A living pawn's group is read as in the gear rules. A corpse's pawn is destroyed, so its group comes from its faction alone: your faction (not a lodger) is your colony, a faction hostile to yours (`Faction.HostileTo(Faction.OfPlayer)`) is enemies, so a dead prisoner counts by the faction it came from.
- Butchering: a prefix and a finalizer on the private static `Toils_Recipe.CalculateIngredients(Job, Pawn)` (Verse.AI/Toils_Recipe.cs:301) set a `[ThreadStatic]` flag, and the strip postfix does nothing while it is set.
- In a caravan nothing lands (Pawn.cs:3898-3909), so nothing happens. A stripped inventory stack that merges into a stack on the ground keeps that stack's flag.
- **Settings:** `colonyStripRule` (off), `enemyStripRule` (off).
- **Save and removal:** the vanilla forbidden flag.
- **Overlaps:** Auto Strip on Haul (2560725133, 18,416, 1.7) strips corpses when they're hauled, through the vanilla strip code (its Workshop page), so its strips follow the switch, and its own option to forbid tainted apparel composes. Cremate Auto Strip (1575458517, 52,813, 1.7) strips before cremation; if its strip runs outside `CalculateIngredients`, it follows the switch, which a compat check settles for the README. Apparel Tainted Only When Corpse Rots (2413156320, 49,913, no 1.7) and Removes Tainted Clothes (2006356192, 22,391, no 1.7) change the tainted flag the filter reads. Non uno Pinata changes what stripping drops.
- **Replaces:** partly the tainted-apparel forbid of Auto Strip on Haul (18k).
- **Effort:** S, half a day.
- **Tests:** Enemy strip switch on, suggested setup: stripping a raider corpse wearing a Normal duster at 80% and a Poor tuque at 90% leaves the duster allowed and the tuque forbidden; with the switch off, both are allowed. The same corpse butchered at a butcher table with the switch on: both allowed. A colonist's corpse stripped with only the enemy switch on: both allowed. A raider stripped while down: its shirt isn't tainted and follows the filter. A strip inside a test caravan logs nothing.
#### Corpses outside the home area stay allowed
- **Players get:** Three switches, each off (vanilla) by default: "Animal corpses outside the home area are allowed", "Enemy corpses outside the home area are allowed" and "Other corpses outside the home area are allowed". Manhunters and predators count as animals. Haulers and butchers then see a hunt's or a raid's corpses without a click per body, once the fight is over.
- **How:** The game forbids a new corpse outside the home area unless a hunter reserved it or it was designated for hunting or slaughter (Verse/Pawn.cs:2132-2133, :2197-2204); the recorder catches that forbid inside the `Kill` scope. The `Kill` postfix allows the corpse when the switch for its kind is on, the first kind that fits deciding: animal (any `RaceProps.Animal`, your own, manhunters and predators hunting yours included, though the last two are in the enemies group through `HostileTo`, RimWorld/GenHostility.cs:130-137), then enemy (the group read in the prefix: hostile humanlikes, mechs and, with Anomaly, entities, which fail `RaceProps.Animal`), then other (everything else: your colony's humanlikes and mechs, neutral pawns, mechs that aren't hostile). It waits like the gear rules.
- Never patched: `ForbidUtility.SetForbidden` (RimWorld/ForbidUtility.cs:16), which player designators use too, and `SetForbiddenIfOutsideHomeArea` (:48), five lines that may be inlined.
- **Settings:** `animalCorpsesAllowed`, `enemyCorpsesAllowed` and `otherCorpsesAllowed`, all off, under `forbidRules`.
- **Save and removal:** the vanilla forbidden flag on each corpse.
- **Overlaps:** Allow Dead Animals (2403873031, 67,347, no 1.7) and the corpse half of KilledEnemyAutoAllowed (Continued); warned. Allow Tool is the manual way and composes.
- **Replaces:** Allow Dead Animals (67k).
- **Effort:** S, half a day.
- **Tests:** A wild animal killed outside the home area with the animal switch on: its corpse isn't forbidden; off, it is; a corpse a hunter reserved is unchanged. A raider killed outside the home area with the enemy switch on: not forbidden. A manhunter husky killed outside the home area with only the animal switch on: allowed; with only the enemy switch on: forbidden. A corpse inside the home area is never touched. With a hostile test pawn on the map, an enemy corpse waits and is allowed once the hostile pawn is downed.
### 1.2 More storage, recipe defaults and workbench bills (5 days)
#### Graves, mortars and other storage start from your default
@ -347,7 +494,7 @@ Setup, S (half a day): the repo with About.xml, the csproj and the `[StaticConst
- **Tests:** With a set for the electric stove (simple meals forever, fine meals until 10), a stove completed through a frame has both bills in order with those values. A stove spawned directly has none. With fine meal research missing, the stove gets one bill and the message. A set entry whose recipe's `AvailableOnNow` is false on the new bench (a test-only recipe worker) is skipped and counted in the message. -NoDlc: a stove set saved with Biotech, holding simple meals and baby food, gives a new stove the simple meal bill and the message, and the set still holds baby food. -Compat, with Replace Stuff: building an electric stove over a fueled stove that has bills keeps the old bills, not the set; an electric stove with bills destroyed with auto-rebuild on and rebuilt through the frame gets the set; an electric tailoring bench with two bills, destroyed and rebuilt the same way, has its two old bills and no set; the same bench with no bills stays empty.
- **Risks:** a bench whose bills another mod adds during spawn gets no set; that matches "the player already has bills there".
### 1.2 Animals, corpses and mech repair (5 days)
### 1.3 Animals and mech repair (4 days)
#### Species defaults when an animal joins
@ -411,24 +558,11 @@ Setup, S (half a day): the repo with About.xml, the csproj and the `[StaticConst
- **Tests:** Chicken template with max 10: the first player chicken on the test map sets the chicken config's maxTotal to 10; a second chicken doesn't apply it again; a config the player set to 5 stays at 5. A chicken bought from a test orbital trader through `TradeShip.GiveSoldThingToPlayer` has no map during `PreTraded`; once its drop pod opens on the test map, the chicken config's maxTotal is 10. A fresh `AutoSlaughterManager(map)` passed through the new-map apply takes the template. "Load the default onto this map" overwrites after the confirm.
- **Risks:** generating a full map in the headless suite is slow, hence the fresh manager instead of `GenerateMap`.
#### Corpses outside the home area stay allowed
- **Players get:** Three switches, each off (vanilla) by default: "Animal corpses outside the home area are allowed", "Enemy corpses outside the home area are allowed" and "Other corpses outside the home area are allowed". Haulers and butchers then see a hunt's or a raid's corpses without a click per body.
- **How:** A postfix on `Pawn.Kill(DamageInfo?, Hediff)` (Verse/Pawn.cs:2096). Vanilla forbids the corpse outside the home area unless a hunter reserved it (:2196-2204). The postfix unforbids a spawned, forbidden corpse outside the home area with `SetForbidden(false, warnOnFail: false)` when the rule for its kind is on: animal (`RaceProps.Animal`), enemy (`HostileTo(Faction.OfPlayer)`, recorded by a prefix in `__state` before the pawn dies), other (everything else, your own pawns included).
- Never patched: `ForbidUtility.SetForbidden` (RimWorld/ForbidUtility.cs:16), which player designators use too, and `SetForbiddenIfOutsideHomeArea` (:48), five lines that may be inlined.
- **Settings:** `corpseRules` (on as a category) and one switch per kind, all off.
- **Save and removal:** the vanilla forbidden flag on each corpse.
- **Overlaps:** Allow Dead Animals (2403873031, 67,347, no 1.7) and the corpse half of KilledEnemyAutoAllowed (Continued) (2159090973, 5,232, 1.7); warned. Allow Tool (761421485, 1,388,637, no 1.7) is the manual way and composes.
- **Replaces:** Allow Dead Animals (67k).
- **Effort:** S, half a day.
- **Tests:** A wild animal killed outside the home area with the animal rule on: its corpse isn't forbidden; with the rule off it is; a corpse a hunter reserved is unchanged. A raider killed outside the home area with the enemy rule on: not forbidden. A corpse inside the home area is never touched.
- **Risks:** none known.
#### Auto-repair for new mechs
Needs Biotech. Without it the mech section of the settings page shows disabled with "Needs Biotech", its rows stay in the file, and no hook acts on a mech.
- **Players get:** On the settings page, per mech kind plus an "every mech" row: auto-repair not set, on or off. A new colony mech, gestated, hacked or given by a quest, starts with it. Work mode, area and a Defaults gizmo on mechs follow in 1.4.
- **Players get:** On the settings page, per mech kind plus an "every mech" row: auto-repair not set, on or off. A new colony mech, gestated, hacked or given by a quest, starts with it. Work mode, area and a Defaults gizmo on mechs follow in 1.5.
- **How:** The join funnel, extended to `IsColonyMech` (Verse/Pawn.cs:794-808). Gestation runs inside the `Bill_ProductionMech.CreateProducts` scope (RimWorld/Bill_ProductionMech.cs:20-27). The write is `CompMechRepairable.autoRepair` (RimWorld/CompMechRepairable.cs:10). Resurrected mechs come back as the same pawn and keep their settings.
- DLC: every mech step checks `ModsConfig.BiotechActive` first. `IsColonyMech` checks it too (Verse/Pawn.cs:798), and the comp exists only with Biotech (`CompProperties_MechRepairable` on Core's `BaseMechanoid` with `MayRequire`, Core `Races_Mechanoid.xml:52`). The `CreateProducts` patch is applied in every combination and never runs without Biotech.
- **Settings:** `mechDefaults` (on).
@ -439,7 +573,7 @@ Needs Biotech. Without it the mech section of the settings page shows disabled w
- **Tests:** With Biotech (skipped without): with "Militor: auto-repair on", a militor generated with the player faction inside the `CreateProducts` scope helper has `autoRepair` true; a mech given through `SetFaction` gets the every-mech row's value. -NoDlc: a Scyther given the player faction through `SetFaction` is untouched by Defaults, and the Militor row stays in the file, in the mech section drawn disabled with "Needs Biotech", and is not counted as an inactive name.
- **Risks:** none known.
### 1.3 Growers, buildings and dropped gear (4 days)
### 1.4 Growers and buildings (4 days)
#### Growing zones and plant growers start with your crop
@ -478,29 +612,13 @@ Needs Biotech. Without it the mech section of the settings page shows disabled w
- **Tests:** Door default hold open: a door completed through a frame has `HoldOpen` true, a door spawned directly false. Table default gather spot off: `CompGatherSpot.Active` false. Trap outside the home area with rearm on: `autoRearm` true. Heater at 18 C: 18 after spawn; a template of 60 is clamped to the def's maximum. A standing lamp with a colour gets it; a frame from Build copy with its own colour keeps that colour. "Every lamp: white" with no standing-lamp row: a standing lamp built through a frame is white; with a standing-lamp row set to blue, it is blue. "Every door: hold open" gives an autodoor built through a frame `HoldOpen` true. -Compat: a Dubs radiator built through a frame takes the "every heater or cooler" target, or the test logs that the comp isn't a `CompTempControl`; a [DG]More Door Variants door takes the "every door" value; with Replace Stuff, a heater set to 25 C, destroyed with auto-rebuild on and rebuilt through the frame, is at 25 C while the template says 18.
- **Risks:** a building that resets these settings in its own spawn code overwrites ours; the tests cover the vanilla classes.
#### Dropped gear rules
### 1.5 Mech work modes and areas (2 days)
- **Players get:** Rules for what the game forbids when a pawn drops its gear, each off (vanilla) by default: "Gear your own pawns drop when downed or killed is allowed"; "Gear enemies drop inside the home area is allowed", with a second switch "anywhere, not only in the home area". Inside the home area the enemy rule changes weapons only, because vanilla already leaves dropped inventory allowed there.
- **How:** A prefix on `Pawn.DropAndForbidEverything` (Verse/Pawn.cs:2890) records the pawn's equipment, inventory and carried thing, and whether the pawn is the player's (`Faction == Faction.OfPlayer`: colonists, slaves, mechs, animals) or hostile (`HostileTo(Faction.OfPlayer)`), in `__state`. The postfix unforbids recorded things that are now spawned and forbidden, by rule, with `SetForbidden(false, warnOnFail: false)`.
- What vanilla forbids: equipment always (`Pawn_EquipmentTracker.TryDropEquipment` calls `SetForbidden(forbid)`, Verse/Pawn_EquipmentTracker.cs:162), inventory only outside the home area (`DropAllNearPawn` calls `SetForbiddenIfOutsideHomeArea`, Verse/Pawn_InventoryTracker.cs:186). Both are called with `forbid: true` (Pawn.cs:2921-2925).
- The enemy rule acts on things inside the home area, or anywhere with the second switch on.
- Callers: downed (Verse/Pawn_HealthTracker.cs:858), killed (Pawn.cs:2232), traded (:2612) and captured (RimWorld/Pawn_GuestTracker.cs:461). Neutral pawns, traders, guests and captured prisoners stay vanilla.
- Never patched: `ForbidUtility.SetForbidden` and `SetForbiddenIfOutsideHomeArea`, as for corpses.
- **Settings:** `gearRules` (on as a category), `ownGearAllowed` (off), `enemyGearAllowed` (off), `enemyGearAnywhere` (off).
- **Save and removal:** the vanilla forbidden flag on each thing.
- **Overlaps:** KilledEnemyAutoAllowed (Continued) (2159090973, 5,232, 1.7) allows what killed enemies drop wherever they die, for every pawn (its Workshop page, read 2026-11-29); warned. Hospitality (753498552, 768,458, no 1.7) references `DropAndForbidEverything` for guests, who stay vanilla here. Allow Tool (761421485, 1,388,637, no 1.7) is the manual way and composes.
- **Replaces:** partly KilledEnemyAutoAllowed (5.2k): with the anywhere switch and the enemy corpse rule (1.2) on, killed enemies' gear and corpses are allowed everywhere, but neutral pawns' drops stay vanilla.
- **Effort:** S, half a day.
- **Tests:** A colonist downed by damage: with the own-gear rule on its weapon on the ground isn't forbidden; off, it is. A raider killed inside the home area with the enemy rule on: its weapon isn't forbidden; killed outside: forbidden, and with the anywhere switch on, not forbidden, its dropped inventory included. A downed trader guest's gear stays vanilla.
- **Risks:** allowing enemy gear pulls haulers toward fights, hence home area by default and everything off.
### 1.4 Mech work modes and areas (2 days)
Needs Biotech. Without it the mech section shows disabled with "Needs Biotech", as in 1.2, the gizmo never appears and saved rows stay in the file.
Needs Biotech. Without it the mech section shows disabled with "Needs Biotech", as in 1.3, the gizmo never appears and saved rows stay in the file.
#### New mechs start with your settings
- **Players get:** The mech rows from 1.2 gain the work mode of the control group a new mech joins and an allowed area by name, each not set or set. A gestated mech goes into a control group in that mode when one is free; a mechanitor's group 1 is never switched to another mode for it. A "Defaults" gizmo on a selected colony mech saves its kind's default from it: auto-repair, its group's work mode and its area's name.
- **Players get:** The mech rows from 1.3 gain the work mode of the control group a new mech joins and an allowed area by name, each not set or set. A gestated mech goes into a control group in that mode when one is free; a mechanitor's group 1 is never switched to another mode for it. A "Defaults" gizmo on a selected colony mech saves its kind's default from it: auto-repair, its group's work mode and its area's name.
- **How:**
- Gestation runs inside the `Bill_ProductionMech.CreateProducts` scope (RimWorld/Bill_ProductionMech.cs:20-27): it generates the mech (:24), then adds the overseer relation (:25), whose `OnRelationCreated` calls `AssignPawnControlGroup` with no work mode (RimWorld/PawnRelationWorker_Overseer.cs:7-18), which puts the mech in group 1, `controlGroups[0]` (RimWorld/Pawn_MechanitorTracker.cs:204). At the scope's end the mech has an overseer.
- Work mode: Defaults picks the target group itself before touching the mech, and doesn't call `AssignPawnControlGroup(mech, mode)`. That method takes the first group with the mode, else switches the first empty group to the mode, else uses group 1 (:185-200). Called after `UnassignPawnFromAnyControlGroup` (:209), it often finds group 1 empty, for example when the new mech is the mechanitor's first, so it would switch group 1 from Work to Escort, and every later mech without a mode lands in group 1 (:204).
@ -522,37 +640,41 @@ Needs Biotech. Without it the mech section shows disabled with "Needs Biotech",
- Package ids: `blax.slaves`, `blax.castes`, `blax.zones`, `blax.defaults`. No hard dependencies. Defaults lists no sibling in About.xml and no sibling lists Defaults, so the load order doesn't matter. Defaults offers no API in 1.x.
- Detection: one Compat helper, `ModLister.GetActiveModWithIdentifier(id, ignorePostfix: true)`. Sibling APIs are bound by reflection (`AccessTools.TypeByName`, `AccessTools.Method`) into cached delegates at startup; a missing sibling or method is a silent no-op.
- Ownership line for every Blax design doc: "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 drop gear or die. It writes when something is made or joins, and through its opt-in forbid rules when a pawn drops gear or dies. It keeps nothing in the save."
- Ownership line for every Blax design doc: "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."
### Blax Castes: how Defaults defers
Castes owns every humanlike player pawn: colonists, slaves and prisoners, their apparel, food, drug and reading policies, medical care, schedule, work priorities, weapon loadout, area, hostility, self-tend, carried medicine, fire at will and prisoner interaction. Defaults never sets any of these, and stays out of the way in these ways:
Castes owns every humanlike player pawn: colonists, slaves and prisoners, their apparel, food, drug and reading policies, medical care, schedule, work priorities, weapon loadout, allowed area, hostility, self-tend, carried medicine, fire at will and prisoner interaction. Defaults never sets any of these, and stays out of the way in these ways:
- Pawn filter: the join funnel checks `RaceProps.Animal` or `IsColonyMech` first, so Defaults never writes to a humanlike pawn, with or without Castes. The forbid rules (`Pawn.Kill` in 1.2, `DropAndForbidEverything` in 1.3) see any pawn but write only the forbidden flag on its corpse and dropped things. Castes' join hooks filter the other way round on `RaceProps.Humanlike` (`JoinHooks.Watching` in blax-castes), so no pawn reaches both join funnels.
- Pawn filter: the join funnel checks `RaceProps.Animal` or `IsColonyMech` first, so Defaults never writes to a humanlike pawn, with or without Castes. The forbid rules (1.1: `Pawn.Kill`, `Pawn_HealthTracker.MakeDowned` and `Pawn.Strip`) see any pawn, colonists and slaves included, but write only the forbidden flag on its corpse and on the things it drops or is stripped of, never a caste slot. Castes' join hooks filter the other way round on `RaceProps.Humanlike` (`JoinHooks.Watching` in blax-castes), so no pawn reaches both join funnels.
- Caste guard: when Castes 1.1 or later is active (`CastesApi` version 1, where `CasteIdOf` arrives), Defaults binds `CastesApi.CasteIdOf(Pawn)`, checks `Active`, and skips any animal or mech that has a caste. Today none can; the guard keeps Castes in charge if it ever adds animal or mech castes.
- Policies: Defaults never creates, edits or assigns an apparel, food, drug or reading policy and adds nothing to the four policy dialogs. Castes' starter castes still find the Slave outfit and Simple food by their starting labels.
- Medical care: Defaults never writes `PlaySettings` medical defaults or a pawn's medical care. Animal medical care stays with the vanilla "Default medical care" window.
- Areas: Castes 1.2 gives humanlike pawns an area by name; Defaults gives animals and mechs an area by name. Neither creates areas in 1.x. The backlog item "areas every new map starts with" would create the named areas both mods then find.
- Areas: Castes 1.2 gives humanlike pawns an allowed area by name; Defaults gives animals (1.3) and mechs (1.5) an allowed area by name. Neither creates areas in 1.x, and neither can pick one of Zones' work rule areas, which aren't vanilla areas (see "Blax Zones"). The backlog item "areas every new map starts with" would create the named areas both mods then find.
- Bills: "slaves only" in a bill default is a bill setting. Castes' work slot decides who does a work type; the bill decides who may take that bill.
- Both mods postfix `Pawn.SetFaction`. The postfixes compose, and neither writes the other's pawns.
### Blax Zones
- Defaults hooks only `Designator_ZoneAddStockpile` and `Designator_ZoneAdd_Growing`. Zones' delivery and sleeping zones subclass `Zone` and `Designator_ZoneAdd` directly and use their own tabs (`ITab_Delivery` for delivery zones, the animal-zone and people-zone tabs for sleeping zones), so no Defaults hook or button reaches them.
- Ownership: Zones owns 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.
- Of the zone designators, Defaults hooks only `Designator_ZoneAddStockpile` (1.0) and `Designator_ZoneAdd_Growing` (1.4). Zones' delivery and sleeping zones subclass `Zone` and `Designator_ZoneAdd` directly and use their own tabs (`ITab_Delivery` for delivery zones, the animal-zone and people-zone tabs for sleeping zones), so no Defaults hook or button reaches them.
- Zones' "Receive deliveries", sell and direct-delivery flags live in Zones' MapComponent, keyed by zone ID and ThingID. "Make default" never reads or copies them, and a new stockpile starts unflagged, as Zones decides.
- Zone beds are spawned by Zones' `AddCell`, not by a frame, so the build scope never sees them.
- Zones' own zone defaults stay in Zones (suggested Zones backlog item below).
- Zone beds are spawned by Zones' `AddCell`, not by a frame, so the build scope (1.2) never sees them.
- Zones' own zone defaults stay in Zones: its backlog holds "Make default" for new delivery and sleeping zones.
- The forbid rules (1.1) act only inside `Pawn.Kill`, `Pawn_HealthTracker.MakeDowned` and `Pawn.Strip`, and the wait list holds only what they recorded there, so goods Zones delivers keep the forbid flag of the vanilla call.
- Work rule areas (Zones 1.6) compose with the forbid rules. A rule decides whether a dropped thing stays forbidden; Zones' "Don't haul from here" decides whether haulers fetch it, and "Haul first" brings it in before other hauling. So a Normal rifle allowed in a killbox painted "Don't haul from here" lies there until the player unticks the rule. "Only inside the home area" reads the vanilla home area (`map.areaManager.Home`), which work rule areas never change. Neither mod hooks the other's code.
### Blax Slaves
- No overlap. Surgery bills, which Slaves keeps through status changes and uses for hemogen, are `Bill_Medical` and never touched. Trade, prices and slave medicine are Slaves'.
- The forbid rules (1.1) count slaves with your colony, rebelling ones included. Slaves forbids nothing and patches none of their methods. Its sedation relay (its 1.5) downs a rebel with `HealthUtility.TryAnesthetize` (Verse/HealthUtility.cs:533-543), whose `AddHediff` reaches `MakeDowned` (Verse/Pawn_HealthTracker.cs:226, :237, :520, :577). With the colony rule on, the rebel's weapon is then a remembered weapon: it waits while the slave lies where it fell, and the colony rule decides once the slave is carried off.
### Shared conventions
- Patches are applied one class at a time from a `[StaticConstructorOnStartup]` class, logging "[Blax Defaults] N patches applied". One broken target doesn't take the others down.
- Every category has a ModSettings toggle, plus the master `enabled`.
- Tests: the headless in-game test mod from `blax-slaves/Tests` (BlaxSlavesTests harness, run-tests.ps1), copied in as `Tests/BlaxDefaultsTests` from Castes' copy, whose run-tests.ps1 already takes -NoDlc and -Dlc. Phase 1 runs in a quick-test colony, phase 2 after a save and reload. -Compat adds the installed mods Defaults is tested next to: RimFridge, Weapon Racks, Replace Stuff, Rimefeller, VFE Security, Vanilla Expanded Framework, Dubs Central Heating, [DG]More Door Variants, Pick Up And Haul, Haul to Stack, Prison Labor, Hospitality, plus Blax Castes (and Blax Zones once it has code). -NoDlc runs on the core game and -Dlc with a list loads only those installed DLCs; a release runs all 8 combinations of Royalty, Ideology and Biotech (see "DLC support"). The overlap mods aren't installed on the test machine; their detection is tested with an injected id.
- Every hook body sits in try/catch with a one-time log, so a Defaults bug never breaks a construction, a trade or a birth.
- Every hook body sits in try/catch with a one-time log, so a Defaults bug never breaks a construction, a trade, a birth or a death.
### Sibling doc changes, when this design is accepted
@ -560,7 +682,11 @@ Castes owns every humanlike player pawn: colonists, slaves and prisoners, their
- Done (2026-11-29), Castes `docs/design.md`: "Works with the other Blax mods" names Defaults as a `CastesApi` version 1 consumer, "Defaults 1.2 reads `Active` and `CasteIdOf` (API version 1, Castes 1.1) to skip any animal or mech that has a caste", and the API's risk notes say the contract spans four repos.
- Castes `README.md`: "Not supported yet: multiplayer, animal castes" becomes "Not supported yet: multiplayer. Animals and mechs: Blax Defaults."
- Castes UI labels, Scribe keys unchanged: the "Defaults" button above the Caste column becomes "On join" and the "Join defaults" window "Caste on join". Next to a mod called Blax Defaults, a "Defaults" button in Castes sends players to the wrong mod.
- Done (2026-11-29), Zones `docs/design.md`: the ownership line carries the Defaults sentence above, and the backlog carries "Make default for new delivery and sleeping zones, in Zones' own tabs, stored as names in Zones' own file (S)". The corpse and gear rules act only inside `Pawn.Kill` and `Pawn.DropAndForbidEverything`, never on goods Zones delivers, so Zones' note that Defaults has no rule for arriving goods stays true.
- Done (2026-11-29), Zones `docs/design.md`: the ownership line carries the Defaults sentence above, and the backlog carries "Make default for new delivery and sleeping zones, in Zones' own tabs, stored as names in Zones' own file (S)". The corpse and gear rules act only inside `Pawn.Kill` and `Pawn.DropAndForbidEverything` (since the forbid rework: `Pawn.Kill`, `Pawn_HealthTracker.MakeDowned` and `Pawn.Strip`), never on goods Zones delivers, so Zones' note that Defaults has no rule for arriving goods stays true.
- Done (2026-11-29), from the forbid rework: the ownership line in Castes `docs/design.md`, Zones `docs/design.md` and Slaves `docs/roadmap.md` takes the new wording above ("go down, die or are stripped").
- Done (2026-11-29), Castes `docs/design.md`: "Defaults 1.2 reads `Active` and `CasteIdOf`" becomes "Defaults 1.3", and its line on Defaults' forbid rules reads "see any pawn that goes down, dies or is stripped, colonists and slaves included, but write only the forbidden flag on the corpse and on the things it drops or is stripped of, never a caste slot".
- Done (2026-11-29), Zones `docs/design.md`: its Defaults notes name the new releases ("`Designator_ZoneAdd_Growing` (its 1.4)", "Defaults' build scope (its 1.2)") and read "Defaults' forbid rules (its 1.1) act only inside `Pawn.Kill`, `Pawn_HealthTracker.MakeDowned` and `Pawn.Strip`, never on goods Zones delivers". The rest of that note stays true: the recorder only records inside those calls, so drop pods and caravan goods keep the forbid flag of the vanilla call.
- Done (2026-11-29), after Zones' work rule areas (its 1.6): Castes `docs/design.md`, Zones `docs/design.md`, Slaves `docs/roadmap.md` and this doc carry the same Zones sentence ("per-cell work rules (work rule areas); it never changes a pawn's work priorities or allowed area") and say "allowed area" for Castes' area slot. Slaves' package ids gain `blax.defaults`.
## Backlog
@ -576,7 +702,8 @@ Castes owns every humanlike player pawn: colonists, slaves and prisoners, their
- A per-colony override, "this colony differs" (M).
- Gravship-start shelves (Odyssey) as a setting, since one player wants them included and others don't; fishing zone defaults through `Designator_ZoneAdd_Fishing.MakeNewZone`. Neither DLC is installed here.
- Multiplayer: needs the active defaults in the save, seeded from the file, and a 1.7 build of the Multiplayer mod to test.
- Gear of neutral pawns who died or were carried off (S): a third forbid rule for visitors and traders, since nobody comes back for that gear. It would use the colony's remembered-weapon wait, so their gear stays vanilla while they lie where they fell.
- "Use this stockpile's filter for a forbid rule" in the storage tab's Defaults menu (S), for players whose stockpiles already say what they want to keep.
## Cut
- Anything for colonists, slaves or prisoners: policies, medical care, schedule, work priorities, weapon loadout, hostility, self-tend, carried medicine, fire at will, area, prisoner interaction. Those are Castes'. Pregnancy approach and the starting xenotype are per-pawn humanlike settings too; if anyone builds them, Castes' DLC switches are the place. Baby feeding is stored per baby and per feeder, and Castes cut its baby autofeed slot.
@ -587,6 +714,11 @@ Castes owns every humanlike player pawn: colonists, slaves and prisoners, their
- Re-applying defaults on load, on a timer, or to existing things when a default changes: it would fight hand changes. "Load your default" covers the explicit case.
- Bills on benches the player didn't build (ruins, outposts): the cook walks there.
- Surgery bill defaults: `Bill_Medical`, and Slaves keeps those bills through status changes.
- Patching `StorageSettings.SetFromPreset`, `Zone_Growing.SetPlantDefToGrow`, `BillStack.AddBill` or `ForbidUtility.SetForbiddenIfOutsideHomeArea`: one- to five-line methods the JIT may inline. Patching `ForbidUtility.SetForbidden`: player designators use it.
- Patching `StorageSettings.SetFromPreset`, `Zone_Growing.SetPlantDefToGrow`, `BillStack.AddBill` or `ForbidUtility.SetForbiddenIfOutsideHomeArea`: one- to five-line methods the JIT may inline. Patching `ForbidUtility.SetForbidden`: player designators use it. The 1.1 recorder on the `CompForbiddable.Forbidden` setter only reads, and only inside a downing or a death.
- Forbid rules for neutral visitors, traders and quest lodgers: a downed visitor that gets up where it fell picks its weapon up again (Core `ThinkTreeDefs/Humanlike.xml:297-300`), and a downed trader drops wares that aren't yours (RimWorld/Pawn_TraderTracker.cs:17-37). One that is carried off or dies forgets its weapon (Verse/Pawn.cs:2418); that gear is the backlog's third rule.
- Forbidding drops the game leaves allowed (inventory inside the home area, what your pawns were hauling): the rules only take back the game's forbids. The strip switch is the one opt-in exception, because stripping allows everything.
- Keeping gear on downed or dead pawns, as Non uno Pinata does: it changes what drops, not what gets forbidden, and needs prefixes that skip vanilla code.
- Separate filters per kind of thing inside a group (one for weapons, one for food): the hit points and quality ranges only bite items that have them, and dropped food leaves the inventory as it went in, so one filter per group covers "good weapons, all food".
- Allowing a downed colonist's weapon while the colonist lies where it fell: once a hauler moves the weapon, the colonist forgets it (Verse.AI/Pawn_MindState.cs:557-560) and gets up unarmed. A colonist that is carried away has already forgotten it (Verse/Pawn.cs:2418), so the rule decides it then.
- Stack limits per stockpile (asked 2026-02-16): vanilla has no such field; that is a storage mod, not a default.
- A "do until X" default for every bill kind including mech gestation: gestation bills store no products. Recipe defaults cover them.