rimworld-blax-defaults/docs/features.md

191 lines
23 KiB
Markdown
Raw Permalink Normal View History

# Blax Defaults feature plan
When Blax Defaults is complete, everything you designate, build, tame or gestate starts the way you set it up once: stockpiles and shelves, bills and workbenches, crops, doors, lamps and heaters, animals and mechs, and the named areas of a new map. Its forbid rules decide what stays forbidden after a fight. Colonists, slaves and prisoners stay with Blax Castes, and nothing ever goes into a save.
Status: 1.0 (storage defaults, values for every new bill) and 1.1 (forbid rules) are on the Workshop as item 3848261264, 1.1.0 since 2026-11-30. Everything else is designed in [design.md](design.md) or new in this plan, with no code yet.
2026-12-01 18:09:46 +00:00
Planned 2026-12-01 and reviewed the same day (the fixes are listed at the top of design.md). This file is the plan of record for what the mod covers and in which order the areas come. [design.md](design.md) holds the spec of every designed feature.
## Scope
Blax Defaults covers:
- the starting settings of what the player makes or acquires: stockpiles, growing zones, storage buildings, bills, workbenches, other buildings, animals and mechs;
- the named areas every new map starts with;
- what the game forbids when a pawn goes down, dies or is stripped (opt-in forbid rules);
- one defaults file per player, shared by every save.
2026-12-01 18:09:46 +00:00
Every feature keeps the design's rules: nothing changes until you save a default or turn a rule on; a default applies once, when the thing is made or joins, never to what you already have, apart from the forbid rules and "Young animals learn what they outgrew", which both ship off; nothing goes into the save; any DLC combination works, core only included; every feature has a toggle; no new art.
Left to the other Blax mods:
2026-12-01 18:09:46 +00:00
- Blax Castes: every humanlike player pawn and its per-pawn settings (policies, medical care, schedule, work priorities, weapon loadout, allowed area, hostility, self-tend, carried medicine, fire at will, prisoner interaction), and caste templates across saves. Defaults never writes to a humanlike pawn. Castes' allowed area slot can create a missing area on demand; Defaults creates its named areas when a map is made, and each mod finds the other's by label.
- Blax Zones: delivery and sleeping zones, beds by zone, drop spots and work rule areas. "Make default" for its own zones lives in Zones, in its own file.
- Blax Slaves: slave status, trade, prices, suppression, slave medicine and the surgery bills it keeps through status changes.
- Blax Laws (designed, not built): lawbook, cases, punishments and court. Its "lawbook templates shared across saves" stay in Laws: Laws keeps its own file under the game's Config folder and copies Defaults' write, read-back and backup rules. Defaults' file never holds a lawbook. Laws' arrests and subdue meet the forbid rules only through vanilla calls (design.md, "Blax Laws").
## Areas
Status words: **Shipped x.y**; **Designed** (spec in design.md); **New** (in this plan, no spec yet; its hook is not checked against the game code unless the line says so); **Idea** (waits for players to ask).
### Defaults file and settings page
Defaults are only worth setting up if they survive mod updates, broken files and removed mods, and if you can edit them from the main menu. Every other area adds its rows to this page.
- **Defaults library and settings page.** One file shared by every save, written through a temporary file, read back and backed up; every saved default with Edit and Forget. Shipped 1.0.
- **Overlap warnings.** Mods that set the same things are named on the settings page and once per session, with "Don't remind me". Shipped 1.0; each area adds the mods of its category.
- **Add a default and drop inactive names.** Make a default from the main menu, and clear the names a removed mod left in an entry. Designed ([spec](design.md#add-a-default-and-drop-inactive-names)).
- **Export and import of the defaults file.** Share a setup with another player. Idea; 1trickPwnyta's Defaults has backup and restore.
2026-12-01 18:09:46 +00:00
Steps: "Add a default and drop inactive names" ships with the rest of storage, because its picker lists the storage kinds that step adds. Export and import follows demand.
### Storage
Every new shelf starts at Preferred and pulls meals out of the freezer, and every new stockpile allows nearly everything.
- **New stockpiles start from your default**, per stockpile type. Shipped 1.0.
- **New storage buildings start from your default**: shelves, bookcases, hoppers, fridges, weapon racks and other storage with a storage blueprint. Shipped 1.0.
- **Defaults button in the storage tab**: make, load, load the game's default, forget. Shipped 1.0.
- **Quick setup: new shelves start empty**, per kind, leaving hoppers and single-purpose storage alone. Shipped 1.0.
- **Graves, mortars and other storage start from your default**: graves, sarcophagi, mortars, growth vats, biosculpter pods and modded storage without a storage blueprint. Designed ([spec](design.md#graves-mortars-and-other-storage-start-from-your-default)). Needs: growth vats Biotech, biosculpter pods Ideology. It brings the build scope, the hook that bills for new workbenches, growers and building settings use.
2026-12-01 18:09:46 +00:00
- **Named setups.** Save the settings of a stockpile or storage building under a name ("Freezer", "Armory", "Meals shelf") and load it onto any stockpile or storage building from the storage tab's Defaults menu; loading never widens what a building takes. A named setup can also go into the Zone menu as a stockpile designator of its own, and dragging it makes a plain vanilla stockpile with that setup. New stockpiles and shelves still start from their kind's default. Removing the mod keeps every stockpile. New; it joins the earlier "your own stockpile types" and the idea "several named defaults per kind" (asked once on 1trickPwnyta's Defaults page, 2026-01-31), since both are named setups of the same storage settings. Demand: custom stockpile types in 1trickPwnyta's Defaults (75k, no official 1.7 build), Preset Filtered Zones (Continued) (16k, 1.7), Simple Stockpile Presets (Continued) (16k, 1.7), and the save and load by name of [KV] Save Storage (109k, 1.7). Hook, checked against the shipped code and 1.7.5021:
- Each setup has its own library key, `setup:<name>`.
- Its designator is an instance of one Blax subclass of `Designator_ZoneAddStockpile`. `AllResolvedDesignators` returns the Zone category's private list itself (Verse/DesignationCategoryDef.cs:77), and the architect reads that list on every draw (RimWorld/ArchitectCategoryTab.cs:49), so adding or removing an instance when a setup is saved, renamed or forgotten needs no reflection. The constructor sets `hotKey = null`: `Designator_ZoneAdd` gives every zone designator Misc6 (RimWorld/Designator_ZoneAdd.cs:40), the dumping stockpile's key.
- The shipped stockpile hook can't tell instances apart as it is: `StockpileTypeOf` keys any modded designator by its class (`Source/BlaxDefaults/StorageKinds.cs:188-198`), and `BuildStockpileTypes` adds one "modded designator" type per class it finds in that list (:294-311). So `StockpileTypeOf` checks for the Blax subclass first and returns that instance's setup, and `BuildStockpileTypes` skips the subclass.
- Vanilla stockpile icon, no art. Test: two named setups, one drag with each; each new zone carries its own setup, and the storage tab's stockpile submenu gains no entry.
- **Preset Filtered Zones support.** Its zones get the Defaults button and its designators a default. Idea, only if the mod enters the tested list.
- **Gravship-start shelves** (Odyssey). Idea; Odyssey isn't installed on the test machine.
Steps, in order:
1. Shipped in 1.0.
2. Graves, mortars and other storage, with "Add a default and drop inactive names".
2026-12-01 18:09:46 +00:00
3. Named setups. It reuses the editor "Add a default" opens.
### Bills
Every new bill searches the whole map, takes any ingredient and sends products to the best stockpile, and a new or rebuilt workbench comes empty.
- **Values for every new bill**: repeat mode, counts, radius, skill range, where products go, counting options. Shipped 1.0.
- **Defaults per recipe from the bill window.** "Make these the default for new simple meal bills", ingredient filter and restrictions included. Designed ([spec](design.md#defaults-per-recipe-from-the-bill-window)). Needs: "slaves only" Ideology, the mech restrictions Biotech.
- **Bills for new workbenches.** A new or rebuilt electric stove comes with the bills you saved for stoves, in order. Designed ([spec](design.md#bills-for-new-workbenches)). Needs the build scope from storage.
2026-12-01 18:09:46 +00:00
- **Materials no new bill uses.** A list of materials (hyperweave, thrumbofur, gold, jade) that every new bill refuses where its recipe would take them, unless that recipe's own default explicitly allows them again. A recipe for which the list would leave one of its ingredients with nothing allowed keeps its filter, so no new bill is left unable to run. New. Demand: Material Filter (11k, no 1.7 build) lets players filter bills by material by hand, one bill at a time.
- Precedence: a recipe default saves its ingredient filter only as the difference from what a new bill of that recipe gets at that moment ([sparse rule](design.md#defaults-per-recipe-from-the-bill-window)), which is the recipe's `defaultIngredientFilter` minus the listed materials. A listed material the player ticks again on a bill is saved as an explicit allow, and only such an allow wins over the list. A recipe default that only refuses human leather leaves the list in force.
- Hook: the shipped `MakeNewBill` postfix, before the recipe default: `ingredientFilter.SetAllow(def, false)` for each listed def the bill's filter allows, skipped for the whole recipe when an entry of `recipe.ingredients` would be left with nothing allowed. The recipe default's allows and refuses then apply on top.
Steps, in order:
1. Shipped in 1.0.
2. Defaults per recipe. It needs no build scope.
3. Bills for new workbenches. Each set entry is a full recipe default, and the bench hook needs the build scope.
2026-12-01 18:09:46 +00:00
4. Materials no new bill uses. Its precedence rule needs recipe defaults that save their filter as a difference.
### Forbid rules
After a raid the good loot lies forbidden all over the map, and allowing it by hand drags the junk in too.
- **Gear rules for your colony and for enemies**, a vanilla item filter with hit points and quality ranges each. Shipped 1.1.
- **Wait until the fight is over.** Shipped 1.1.
- **Stripping forbids what doesn't match.** Shipped 1.1.
- **Corpses outside the home area stay allowed**, per animal, enemy and other. Shipped 1.1.
- **Gear of neutral pawns who died or were carried off.** A third rule for visitors and traders, whose gear nobody comes back for. Idea.
- **Use this stockpile's filter for a forbid rule**, from the storage tab's Defaults menu. Idea.
No step is planned. The area is complete for now; the two ideas wait for players to ask.
### Animals
Every tamed husky starts with no area and no training, every animal gets the same medical care as a thrumbo, and a species new to a map has no slaughter limits.
- **Species defaults when an animal joins**: area by name, follow when drafted, follow during fieldwork, training, per species and for every animal. Designed ([spec](design.md#species-defaults-when-an-animal-joins)). It brings the join funnel, which mechs reuse.
- **Born animals copy their mother**, or take the species default per a switch. Designed ([spec](design.md#born-animals-copy-their-mother)).
- **Defaults button in the Training tab.** Designed ([spec](design.md#defaults-button-in-the-training-tab)).
2026-12-01 18:09:46 +00:00
- **Medical care per species.** Species rows gain medical care: chickens get no medicine, the thrumbo the best. A species without a value keeps what the game gives every tame animal, the tamed-animal setting of vanilla's "Default medical care" window; the every-animal row has no medical care, so that window stays the one place for the colony-wide value. Born animals copy their mother's. Animals only: Defaults never writes a humanlike pawn's medical care or the `PlaySettings` defaults. New. Demand: vanilla's window has one setting for every tame animal, and Animal Controls (57k, no 1.7 build) copies medical care to newborns. Hook, checked against 1.7.5021: `Pawn_PlayerSettings.medCare` (RimWorld/Pawn_PlayerSettings.cs:27), written in the join funnel after the game's `ResetMedicalCare` (:342-364), which `Pawn.SetFaction` calls (Verse/Pawn.cs:2753).
- **Auto-slaughter limits for new species and new maps.** Designed ([spec](design.md#auto-slaughter-limits-for-new-species-and-new-maps)).
2026-12-01 18:09:46 +00:00
- **Young animals learn what they outgrew.** When one of your animals reaches its next life stage, it wants the training it was too small for at the previous stage and can be assigned now. The wishes come from the source birth uses: its mother's current wishes while the mother is alive and yours and the species switch "Born animals use this default instead" is off, otherwise the species row, then the every-animal row. Birth copies only what a newborn can be assigned, so without this a pup never gets Haul or Rescue. It only ever adds a want, never removes one. It reaches animals you already have, including ones that joined before the default existed or changed, so it is an exception to "a default applies once" ([design.md](design.md#defaults-i-picked)) and ships off behind its own switch. New (from the backlog). Hook, checked against 1.7.5021: a postfix on `LifeStageWorker.Notify_LifeStageStarted` (called from Verse/Pawn_AgeTracker.cs:577), skipped when the previous life stage is null, as on load. The mother is the Parent relation birth and hatching add (Verse/Hediff_Pregnant.cs:180, RimWorld/CompHatcher.cs:103), read with `GetMother` (RimWorld/ParentRelationUtility.cs:40). No saved state. Test: a player husky mother with Haul wanted and no species row; her pup wants Haul once it reaches the juvenile stage.
- **New pens start with your settings.** A pen marker you build takes the animal filter and auto-cut setting you saved for pens. Idea. Hook: `CompAnimalPenMarker.AnimalFilter`, `CompAutoCut.autoCut` and `AutoCutFilter` (checked in the reference assembly), through the build scope.
Steps, in order:
2026-12-01 18:09:46 +00:00
1. Species defaults, born animals, the Training tab button, medical care per species and young animals learn what they outgrew. They share one species row, one edit window, the join funnel and the training code, and the growth step fills the hole birth leaves.
2. Auto-slaughter limits. Same funnel, its own window button.
### Mechs
Needs Biotech. Every gestated mech starts with auto-repair off and lands in group 1, and the player sets both by hand on each new mech.
- **Auto-repair for new mechs**, per mech kind and for every mech. Designed ([spec](design.md#auto-repair-for-new-mechs)).
- **New mechs start with your settings**: the work mode of the control group a new mech joins, its area by name, and a Defaults gizmo on mechs. Designed ([spec](design.md#new-mechs-start-with-your-settings)).
- **Control groups added later start in a work mode by group number.** Idea.
One step: auto-repair, work mode, area and the gizmo share the mech row, the join funnel and the gizmo. The old release plan split them across two releases by size; they ship together. Needs the join funnel from animals.
### New maps
2026-12-01 18:09:46 +00:00
Every new map starts with the home area and one empty allowed area, "Area 1" (Verse/AreaManager.cs:32-45), so the defaults that pick an area by name (animals, mechs, Castes' allowed area slot) find nothing until you make and paint one.
2026-12-01 18:09:46 +00:00
- **Areas every new map starts with.** Up to 10 named, coloured areas ("Barn", "Inside", "Fields") on every new player home map, empty and ready to paint. Vanilla's empty "Area 1" becomes the first of them, so no unused area is left over. New (from the backlog; asked on 1trickPwnyta's Defaults page on 2025-06-17 and 2025-07-27). Hook, checked against 1.7.5021:
- A postfix on `AreaManager.AddStartingAreas` (Verse/AreaManager.cs:32), which `MapGenerator.GenerateMap` calls once per map before any content is generated (Verse/MapGenerator.cs:183). Starting animals and mechs spawn during content generation (`GenStep_ScenParts`, RimWorld/GenStep_ScenParts.cs:11, generating them at RimWorld/ScenPart_StartingAnimal.cs:167), so their pending area finds its label when they spawn. A `MapGenerator.GenerateMap` postfix would come after them.
- Only when `map.IsPlayerHome` (Verse/Map.cs:354).
- Vanilla's area is the one `Area_Allowed` the base call made; it is renamed and recoloured with `Area_Allowed.SetLabel` and `SetColor` (RimWorld/Area_Allowed.cs:75-84). The others come from `TryMakeNewAllowed` (Verse/AreaManager.cs:147). A name `GetLabeled` already finds is skipped, and creating stops when `CanMakeNewAllowed` is false. A map holds at most 10 allowed areas (:13, :142-145), so the settings list takes at most 10 names and says why.
- Gravship landing maps (Odyssey) are skipped, as vanilla skips its own "Area 1" there (:42). The ship brings its allowed areas and recreates them by label (RimWorld.Planet/MoveableArea_Allowed.cs:31-35), and named areas made first could fill the cap and lose one of the ship's areas with its pawn assignments.
2026-12-01 18:48:12 +00:00
One step.
### Growing
Every new growing zone and hydroponics basin starts on potatoes.
- **Growing zones and plant growers start with your crop**: an ordered list of three crops per grower kind, allow sowing and cutting for zones, "Make default" on the vanilla plant button's right-click. Designed ([spec](design.md#growing-zones-and-plant-growers-start-with-your-crop)). Needs the build scope for growers.
- **Fishing zones** (Odyssey). Idea; Odyssey isn't installed on the test machine.
One step.
### Buildings
Every new door, table, trap, heater and lamp starts with the game's setting, and a copied building forgets what its source had.
- **Building settings for new buildings**: door hold-open, gather spot, trap auto-rearm, target temperature and lamp colour, per building or for every door, lamp, or heater and cooler, with a Defaults gizmo. Designed ([spec](design.md#building-settings-for-new-buildings)).
2026-12-01 18:09:46 +00:00
- **Build copy carries the source's settings.** A building placed with Build copy starts with the copied building's storage filter, bills, crop and building settings instead of your default. New (from the backlog; asked in the Steam thread "Why does 'build copy' not copy the settings too?", 2021-10-10). Needs every applier above. Hook, checked against 1.7.5021, along vanilla's lamp colour path:
- `Building.GetGizmos` passes only the def, stuff, style and lamp colour to `BuildCopyCommand` (Verse/Building.cs:420-428), and the command selects the one `Designator_Build` cached per def, which the architect menu shares (RimWorld/BuildCopyCommandUtility.cs:9-14, :26). Nothing on that path knows the source building.
- A postfix on `Building.GetGizmos` wraps the Build copy command's action, so a click records a snapshot of the source's storage, bill, crop and building settings on the selected designator. A postfix on `Designator_Build.Deselected` clears it, where vanilla clears the lamp colour (RimWorld/Designator_Build.cs:251-258). A snapshot, not a link: deconstructing or replacing the source before the frame completes changes nothing.
- Storage: a postfix on `Designator_Build.DesignateSingleCell` (:455) writes the snapshot onto the placed `Blueprint_Storage`'s settings, which vanilla saves and hands to the frame and the building (RimWorld/Blueprint_Storage.cs:92-100, RimWorld/Frame.cs:326-330).
- Bills, crop and building settings: the same postfix keeps the snapshot for the blueprint placed at :522 in an unsaved table, a postfix on `Blueprint.TryReplaceWithSolidThing` (RimWorld/Blueprint.cs:45) moves it to the frame, and the built hook applies it instead of the default. After a save and reload these fall back to your default; the storage filter stays.
- **Beds in a hospital room start as medical beds.** Idea. Hook: the `Building_Bed.Medical` setter (checked in the reference assembly) in the build scope's built hook. Zone beds stay Zones'.
- **Fuel settings for new buildings**: auto-refuel on or off and the target fuel level per building (torches, campfires, generators). Idea. Hook: `CompRefuelable.allowAutoRefuel` and `TargetFuelLevel` (checked in the reference assembly).
Steps, in order:
1. Building settings.
2. Build copy carries the source's settings. It comes last of all building work, because it reuses the storage, bill, crop and building appliers.
## Order
2026-12-01 18:09:46 +00:00
1. **Storage**, step 2, with "Add a default and drop inactive names". It brings the build scope that workbench bills, growers and buildings need, and finishes the storage the README already sells.
2. **Bills.** The most asked-for area: 36 of about 650 comments on 1trickPwnyta's Defaults mention bills or workbenches, 24 storage. Its per-recipe and per-workbench bills are the last reason players keep that mod and Set my Defaults next to Blax Defaults.
3. **Animals.** It brings the join funnel. Animal Controls (57k) has no 1.7 build, and slaughter limits per species were asked for on 1trickPwnyta's Defaults page (2026-01-26).
4. **Mechs.** It reuses the join funnel. Auto-repair On (61k) has no 1.7 build. Biotech only, so after animals.
2026-12-01 18:09:46 +00:00
5. **New maps.** With animals and mechs in place, area names that resolve on a new map make their area defaults, starting animals included, and Castes' allowed area slot work from day one.
6. **Storage**, step 3, named setups. The mods players use for it today have 1.7 builds ([KV] Save Storage, Preset Filtered Zones, Simple Stockpile Presets), while those behind animals and mechs don't.
7. **Growing**, then **Buildings.** The mods they replace are small (8.4k and less). Build copy closes the building work.
2026-12-01 18:09:46 +00:00
The file area's idea and the forbid ideas come when players ask.
## Left out
Reasons in [design.md](design.md#cut):
- Anything on colonists, slaves or prisoners, policy contents and default policies: Castes.
- An animal food policy: vanilla has none, so it would be a new system, not a default.
2026-12-01 18:09:46 +00:00
- Editing defs at startup, re-applying defaults on load or to things you already have. The one exception, "Young animals learn what they outgrew", ships off and only adds training wishes.
- Surgery bill defaults: Slaves keeps those bills. Bills on benches you didn't build.
- Forbid rules for downed visitors, traders and quest lodgers. Forbidding drops the game left allowed (only the strip switch does).
- Stack limits per stockpile: a storage mod's job, not a default.
- Per-colony override and multiplayer: both need state in the save, which this mod never writes (moved here from the backlog on 2026-12-01).
- Storyteller, difficulty and world presets: a new-game screen tool, and the bulk players called too much in 1trickPwnyta's Defaults (Castes' Cut). Save Storyteller Settings (32k) does the storyteller part.
2026-12-01 18:48:12 +00:00
- Play settings and medical defaults for new colonies (decided 2026-12-01): what fits Defaults' rules is a new-game screen tool too, and the rest belongs to Castes or to "Medical care per species".
2026-12-01 18:48:12 +00:00
## Decided 2026-12-01
2026-12-01 18:48:12 +00:00
1. **No play settings for new colonies.** Blax Defaults doesn't take them in and they stay in Left out, because what fits Defaults' rules (auto home area, auto rebuild, zone visibility, tame-animal, wildlife and entity care) is a new-game screen tool that pays off once per colony, manual work priorities are Castes' ground, and other factions' medical care would reach humanlike pawns.