docs: design reviewed for 1.0, DLC support section
Overflow follows the reach rule, ZonesApi for other mods, any-DLC rule, release table per feature.
This commit is contained in:
parent
7771c9a60a
commit
09a1bc6c52
705
docs/design.md
705
docs/design.md
|
|
@ -1,281 +1,640 @@
|
||||||
# Blax Zones
|
# Blax Zones
|
||||||
|
|
||||||
Drag a delivery zone and everything you buy from orbital or caravan traders, plus quest and royal rewards, lands in it, sorted by item filter: medicine by the hospital, steel by the workshop. Drag a sleeping zone over the barn and every chicken and duck has a bed, so you stop placing sleeping spots one at a time.
|
Drag a delivery zone and everything you buy from orbital or caravan traders, plus quest rewards, lands in it, sorted by item filter: medicine by the hospital, steel by the workshop. Drag a sleeping zone over the barn and every chicken and duck has a bed, so you stop placing sleeping spots one at a time.
|
||||||
|
|
||||||
Status: not started. RimWorld 1.7, package id `blax.zones`, safe to remove from a save from the first release.
|
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.zones`. From the first release a plain unsubscribe leaves a loadable save with vanilla zones intact; from 1.2 a button removes it with no errors.
|
||||||
|
|
||||||
|
Changes on 2026-11-29, after two review rounds:
|
||||||
|
|
||||||
|
- Every hook is checked against the 1.7 code and cites file:line. Code paths are relative to the decompiled Assembly-CSharp, XML paths to the game's Data folder.
|
||||||
|
- Fixed what would have broken features or tests: prisoner zones refresh their room so it becomes a prison cell; zone beds never fly on gravships; the overflow radius starts at 5, because a smaller one can hang the game; zone beds can't be deconstructed and draw the sleeper's body; zone tints change at once instead of after a reload.
|
||||||
|
- Owner types: vanilla can no longer change a zone bed's owner type through either setter, and a prisoner zone never turns vanilla colonist or slave beds into prisoner beds without asking.
|
||||||
|
- Removal: vanilla re-creates a missing MapComponent on every save, load and new map, so the button now strips it there instead of inside `FinalizeInit`. The button moved to 1.2, where zone beds make a plain unsubscribe noisy, and the plain-unsubscribe error counts are corrected.
|
||||||
|
- Releases re-cut: caravan camps ship in 1.0 and caravan purchase routing in 1.1; sleeping zones split into animals (1.2) and people (1.4); royal title rewards, the age filter and the unusable-cell breakdown moved to the Backlog. 1.0 takes 6 days, the plan 29 instead of 28.
|
||||||
|
- Sell zones offer only items, never the shelves themselves, and flags on linked shelves follow the group.
|
||||||
|
- `ZonesApi` version 1 is `TryFindDropSpot` only, and callers spawn the pod exactly at the returned cell. `CastesApi` version 1 moves to Castes 1.1 with token-prefixed ids in both members; Castes' design carries the same table.
|
||||||
|
- New: the zone list follows `ZoneManager`, the drop-pod reach rule no longer counts zone beds as colony, notes for Blax Defaults and Prisoner Realism, corrected Hospitality and RimFridge notes, and tests with numbers instead of screenshots.
|
||||||
|
- Every routed path falls back to vanilla in a catch, so a Zones bug never loses an item.
|
||||||
|
- DLC support: Zones works with any DLC combination, core only included, and About.xml names no DLC. Slave sleeping zones (1.4) are the one part that needs a DLC (Ideology). Their guard is now `ModsConfig.IdeologyActive` instead of the setter's install check, the option shows disabled with "Needs Ideology", and a slave zone from a save made with Ideology keeps its type without it. The Wastepack refusal is null-checked for runs without Biotech. A release runs the tests in all 8 combinations of Royalty, Ideology and Biotech. No day count changes: each guard is a null or `Active` check inside work already budgeted.
|
||||||
|
- The Blax Defaults notes match its final scope: the ownership sentence adds what the game forbids when pawns drop gear or die, and the hooks name the Defaults release they arrive in.
|
||||||
|
- Matched with the Castes and Defaults docs: At a glance gains a Needs column in the shared format. The ownership line lists every Castes slot, work priorities and weapon loadout included, and Defaults' sentence now says its forbid rules write outside creation.
|
||||||
|
|
||||||
## At a glance
|
## At a glance
|
||||||
|
|
||||||
| Version | What players get | Replaces | Days |
|
| Version | What players get | Replaces | Needs | Days |
|
||||||
|---|---|---|---|
|
|---|---|---|---|---|
|
||||||
| 1.0 | Delivery zones: orbital buys and caravan buys land in them, by item filter and priority | Trade Ships Drop Spot (206k, no official 1.7), Trading Control drop spot (111k) | 5 |
|
| 1.0 | Delivery zones: orbital buys land in them, by item filter and priority. Trader caravans camp next to a zone you pick | The orbital half of Trade Ships Drop Spot (206k, no official 1.7) and of Trading Control (111k, no 1.7); [KV] Trading Spot (126k) and [GMT] Trading Spot (118k), both dead; Trading Spot (44k), 1.6 only. Stands down for Trading Spot Rewritten (2.2k), which has a 1.7 build | None | 6 |
|
||||||
| 1.1 | Quest and royal rewards land in delivery zones. Trader caravans camp next to a zone you pick | The reward half of Trade Ships Drop Spot and Trading Control, [KV] Trading Spot (126k), [GMT] Trading Spot (117k), Trading Spot (44k), all dead or 1.6-only | 3 |
|
| 1.1 | Quest rewards land in delivery zones. Goods bought from trader caravans and Hospitality guests appear in them | The quest-reward half of Trade Ships Drop Spot and Trading Control | None | 3 |
|
||||||
| 1.2 | Sleeping zones: every cell is a sleeping spot for colonists, slaves, prisoners or animals, with species and size filters | Designator Shapes for spot grids (331k), Barn Stall (29k), Hidden Spots (13k) | 10 |
|
| 1.2 | Animal sleeping zones: every cell is a sleeping spot, with species and body-size filters. A button removes Zones from a save with no errors | Covers the spot-grid use of Designator Shapes (332k, a general shape tool, so not a demand count), Barn Stall's size filter (29k) and Hidden Spots (13k), all alive on 1.7 | None | 6 |
|
||||||
| 1.3 | Goods go straight into stockpiles, onto shelves and under roofs; orbital traders buy from flagged storage; cargo pods land in a zone | Map Wide Orbital Trade Beacon (51k), Wall-Mounted Orbital Trade Beacon (16k), 3 small pod mods (6.5k combined) | 5 |
|
| 1.3 | Goods go straight into stockpiles, shelves, racks and fridges, and under roofs; orbital traders buy from flagged storage; cargo pods land in a zone | Covers the use of Map Wide Orbital Trade Beacon (51k) and Wall-Mounted Orbital Trade Beacon (16k), both alive on 1.7. Replaces 3 small pod mods with no 1.7 build (6.5k combined) | None | 6 |
|
||||||
| 1.4 | With Blax Castes, sleeping zones limited by caste | none | 1 |
|
| 1.4 | People sleeping zones for colonists, slaves (Ideology) and prisoners; medical and shared zones | None directly; extends 1.2 to people | None (slaves: Ideology) | 6 |
|
||||||
|
| 1.5 | With Blax Castes, sleeping zones limited by caste | None | None | 2 |
|
||||||
|
| Total | | | | 29 |
|
||||||
|
|
||||||
Total: 24 working days. Quest and royal rewards ship in 1.1, so 1.0 fits in a week. If 1.0 still slips, caravan routing moves to 1.0.1 and orbital ships first.
|
Effort: S = 0.5 days, M = 2, L = 5, summed per release and rounded up. Subscriber counts were read from the Workshop on 2026-11-29. 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").
|
||||||
|
|
||||||
|
Total: 29 working days, up from 28: the removal button, plus the test work of shipping sleeping zones in two releases. 1.0 takes 6 working days, so it doesn't fit in a five-day week. If it slips, caravan camps move to 1.0.1 and orbital routing ships first.
|
||||||
|
|
||||||
## Defaults I picked
|
## Defaults I picked
|
||||||
|
|
||||||
Change if you disagree.
|
Change if you disagree.
|
||||||
|
|
||||||
- Caravan purchases route in 1.0, not later. They are half a day of work and players see them every caravan.
|
- Caravan camps ship in 1.0 and caravan purchase routing in 1.1. Camping fills a 1.7 gap (the trading-spot mods are dead or 1.6 only), and with the caravan camped by the zone, vanilla's drops at the pack animal's feet already land near it.
|
||||||
- When every zone cell is taken, pods land within 16 cells of the top zone. A setting sends them to the vanilla spot instead.
|
- Deliveries get their own zone type in 1.0, not a flag on stockpiles. Most stockpiles are roofed, where pods can't land, and a landing pad keeps pods out of the warehouse. Flagged stockpiles and shelves come in 1.3 together with roofed delivery.
|
||||||
|
- Goods bought from Hospitality guests land in delivery zones too (1.1), because guests sell through the same caravan code. The caravan checkbox's tooltip says so.
|
||||||
|
- When every zone cell is taken, pods land within 16 cells of the top zone. The radius goes from 5 to 30, because the game's search can hang below 5. A setting sends overflow to the vanilla spot instead.
|
||||||
|
- Blax Slaves payouts (ransom, buy-back, wages) follow a zone's orbital checkbox. Its tooltip says so while Slaves is active.
|
||||||
- Roofed delivery (goods appear, no drop pod) exists, per zone, off by default, from 1.3.
|
- Roofed delivery (goods appear, no drop pod) exists, per zone, off by default, from 1.3.
|
||||||
- Sleeping-zone cells match vanilla sleeping spots exactly: 80% rest, "slept on ground" -4 mood, comfort 0.4, count for barracks.
|
- Sleeping-zone cells match vanilla sleeping spots: 80% rest, "slept on ground" -4 mood, comfort 0.4, count for barracks, sleeper drawn lying on the ground.
|
||||||
- Max 500 sleeping-zone cells per map, adjustable from 50 to 2000.
|
- Sleeping zones don't extend the home area. Delivery zones do, like every vanilla zone.
|
||||||
|
- A zone's owner type wins. Vanilla turns every bed in a prison cell into a prisoner bed; a colonist or slave zone in such a room stays as it is, and the inspect pane warns.
|
||||||
|
- A prisoner zone can't be dragged into a closed room that holds colonist or slave beds. Switching a zone to prisoners asks first and names the vanilla beds in its rooms that become prisoner beds, as vanilla's own bed gizmo does.
|
||||||
|
- Without Ideology the "Slaves" option shows disabled with "Needs Ideology" instead of hiding. A slave zone from a save made with Ideology stays a slave zone, as vanilla slave beds do, until you switch it.
|
||||||
|
- Zone beds can't be deconstructed. Shrink or delete the zone instead.
|
||||||
|
- Max 500 sleeping-zone cells per map, adjustable from 50 to 2000. A drag past the cap adds cells up to the cap and posts one message naming it.
|
||||||
|
- Shared applies to people zones only, and a zone is either medical or shared, never both.
|
||||||
- Bought colonists, slaves, prisoners and animals never land in a zone. They arrive as in vanilla.
|
- Bought colonists, slaves, prisoners and animals never land in a zone. They arrive as in vanilla.
|
||||||
- Caravan goods appear in the zone. Pack animals don't walk them over; I cut that.
|
- Caravan goods appear in the zone. Pack animals don't walk them over; I cut that.
|
||||||
- Odyssey gravships leave Blax zones behind. Beds carried along are removed on arrival.
|
- Trader caravans and tribute collectors camp at a "Caravans camp here" zone. Visitor groups don't.
|
||||||
|
- Odyssey gravships leave Blax zones and their beds behind. Zone beds never fly.
|
||||||
|
- Caste limits (1.5) apply to medical zones too, so a medical zone can be kept for the Miner caste.
|
||||||
|
- A Zones error never costs an item: every routed path falls back to vanilla.
|
||||||
|
|
||||||
Everything below is for the modder building it.
|
Everything below is for the modder building it.
|
||||||
|
|
||||||
## Data model
|
## Data model
|
||||||
|
|
||||||
Three parts carry everything. Build them first, in 1.0 and 1.2.
|
Three parts carry everything. Build them first, in 1.0 and 1.2. The rules and the DLC support after them apply to every feature.
|
||||||
|
|
||||||
### Zone store, safe to remove from a save
|
### Zone store, safe to remove from a save
|
||||||
|
|
||||||
All Blax state lives in one `MapComponent_BlaxZones` per map: our zones (1.0), the zone beds (1.2), the stockpile and shelf flags (1.3). No Blax zone or Blax field ever enters a vanilla save list.
|
All Blax state lives in one `MapComponent_BlaxZones` per map: our zones while saving and loading (1.0), the zone beds (1.2), the stockpile and shelf flags (1.3), and every cache (cell lists, reachability, pending respawns). No Blax zone or Blax field ever enters a vanilla save list.
|
||||||
|
|
||||||
- Why: `ZoneManager.ExposeData` deep-saves `allZones`, and `UpdateZoneManagerLinks` and `RebuildZoneGrid` read entries without a null check. An unknown zone class loads as null and the next load throws an NRE. A MapComponent with a missing class also loads as null, but `Map.FillComponents` runs `components.RemoveAll(null)`, so nothing breaks.
|
- Why: `ZoneManager.ExposeData` (ZoneManager.cs:21) deep-saves the private `allZones` (ZoneManager.cs:9). An unknown zone class falls back to the abstract `Zone`, throws and loads as null (ScribeExtractor.cs:105-118, 146-150). `UpdateZoneManagerLinks` (ZoneManager.cs:31) then throws an NRE in the same load. `Scribe_Deep` catches it in `SaveableFromNode` and leaves `map.zoneManager` null (Scribe_Deep.cs:84; Map.cs:873), so the map loses every zone and every later zone access throws. A MapComponent with a missing class also loads as null, but `Map.FillComponents` removes nulls (Map.cs:712, called again after loading at Map.cs:929), so nothing breaks.
|
||||||
- Save: a prefix on `ZoneManager.ExposeData`, only when `Scribe.mode == Saving`, swaps the private `allZones` field for a filtered copy without our zones. A finalizer puts the original list object back, even if saving throws.
|
- Save: a prefix on `ZoneManager.ExposeData`, only when `Scribe.mode == Saving`, swaps `allZones` for a filtered copy without our zones. A finalizer puts the original list object back, even if saving throws.
|
||||||
- Load: a prefix on `Map.FinalizeLoading` re-registers our zones and appends zone beds to the private `loadedFullThings`, so vanilla spawns them and their references resolve.
|
- Zone list: `ZoneManager` stays the only registry while the game runs; the component keeps no list of zones. Vanilla registers and deregisters zones without calling Zones: the designators register new zones (Designator_ZoneAdd.cs:149-151, 182-184), and `Zone.RemoveCell` deregisters a zone when its last cell goes (Zone.cs:248-251). That covers `Zone.Delete` (Zone.cs:259-277), walls spawning on cells, also in the load spawn loop (ZoneManager.cs:97-112), and gravship landings (GravshipPlacementUtility.cs:313). When saving, the component writes the Blax zones it finds in `zoneManager.AllZones`; the map saves `zoneManager` before the components (Map.cs:873, 898), and the finalizer has restored the list by then. After loading, the component holds the loaded zones only until the load prefix has registered them. A deleted zone is never saved again. Caches keyed by zone are dropped in our zone classes' `PostDeregister` override (ZoneManager.cs:58-62).
|
||||||
- Removal: a button in the mod settings strips everything from the loaded game. A plain unsubscribe still loads, with 2 logged errors per map.
|
- Load: a prefix on `Map.FinalizeLoading` (Map.cs:750) re-registers our zones and appends zone beds to the private `loadedFullThings` (Map.cs:17), so vanilla spawns them and their references resolve.
|
||||||
|
- Plain unsubscribe: the save loads. In 1.0 and 1.1 the log shows exactly 2 errors per map: "Could not find class BlaxZones.MapComponent_BlaxZones" and "SaveableFromNode exception: ... Can't load abstract class Verse.MapComponent" (ScribeExtractor.cs:111, 116; MapComponent.cs:3). From 1.2 the zone beds go with the component node, which adds:
|
||||||
|
- one "Could not resolve reference" warning per bed owner, job target and reservation that pointed at a zone bed;
|
||||||
|
- about two "tried to get CurToil with curToilIndex=2" errors (JobDriver.cs:52-66) per pawn that lay in a zone bed when the game was saved. Its `JobDriver_LayDown` had 3 toils with the bed (JobDriver_LayDown.cs:55-60). With the target unresolved, `SetupToils` on PostLoadInit (JobDriver.cs:268-271) builds 2 toils, or 1 for a pawn that can't move (JobDriver_LayDown.cs:61-69). The error comes at spawn, when `Pawn_RotationTracker.Notify_Spawned` reads `HandlingFacing` (Pawn_RotationTracker.cs:14-31; JobDriver.cs:122-131), and on the first tick in `DriverTick` (JobDriver.cs:350); the job then runs out of toils and ends. Saves made at night have many sleepers.
|
||||||
|
- The removal button (1.2) avoids all of these.
|
||||||
|
- Removal flag (1.2): vanilla re-creates a missing MapComponent. `Map.FillComponents` (Map.cs:710-726) adds every missing MapComponent subclass on new maps (Map.cs:617) and at the end of every `ExposeComponents`, saving included (Map.cs:929, after the components list is written at :898). So after the button, a postfix on the private `Map.FillComponents` removes `MapComponent_BlaxZones` again while the removal flag, a weak reference to the current `Game`, names the current game. That covers every later save, autosave and new map in that game. The component is never removed inside a `FinalizeInit`: `MapComponentUtility.FinalizeInit` loops by index (MapComponentUtility.cs:72-84), so removing an entry would skip the next component's `FinalizeInit`. Zones' own code never creates the component, and every patch reads `map.GetComponent<MapComponent_BlaxZones>()` and routes to vanilla on null.
|
||||||
|
- Map removal: a `MapRemoved` override (MapComponent.cs:40, called from Game.cs:766) only drops caches. It never calls `Zone.Delete` or `Deregister` on a removed map. Vanilla doesn't either: it unclaims the map's pawns and only notifies things (MapDeiniter.cs:218-254).
|
||||||
|
|
||||||
### DeliveryRouter, shared by every delivery path
|
### DeliveryRouter, shared by every delivery path
|
||||||
|
|
||||||
One static class that orbital trade, rewards, caravans, cargo pods, direct delivery and `ZonesApi.TryFindDropSpot` all call. Its build counts in the delivery zone's effort, so each routing feature stays small.
|
One static class that orbital trade, rewards, caravans, cargo pods, direct delivery and `ZonesApi.TryFindDropSpot` all call. Its build counts in the delivery zone's effort, so each routing feature stays small.
|
||||||
|
|
||||||
- Refuses: `Pawn`, `Corpse`, Wastepack, and maps with no zones.
|
- Refuses: `Pawn`, `Corpse`, Wastepack (Biotech; the check skips a null `ThingDefOf.Wastepack`), maps with no zones, and maps without the component (after the removal button).
|
||||||
- Candidates: delivery zones (from 1.3 also flagged stockpiles and shelves) that accept the source and pass the filter, ordered by priority, then zone ID.
|
- Candidates: delivery zones (from 1.3 also flagged stockpiles and shelves) that accept the source and pass the filter, ordered by priority, then zone ID (shelves: ThingID).
|
||||||
- Cells: sorted by distance to the zone centroid, cached and rebuilt in `AddCell`/`RemoveCell`. Pass 1 takes empty valid cells, pass 2 cells with a mergeable stack. At most 400 checks per stack.
|
- Cells: sorted by distance to the zone centroid, cached in the component and rebuilt in `AddCell`/`RemoveCell`. Delivery zones: pass 1 takes empty valid cells, pass 2 cells with a mergeable stack, because pods spread out. Storage targets (1.3): mergeable stacks first, then empty cells, the order Haul to Stack uses. At most 400 checks per stack.
|
||||||
- Pod rule: `DropCellFinder.IsGoodDropSpot(c, map, allowFogged: false, canRoofPunch: false)` and reachable from the colony. Placement rule (caravan, direct delivery): standable, unfogged, reachable, roof ignored.
|
- Reach rule: a spawned free colonist (`map.mapPawns.FreeColonistsSpawned`) can reach the cell, with `PathEndMode.OnCell` for pods and placement and `Touch` for storage. Checked once per district and cached in the component; with no free colonist on the map, `Reachability.CanReachColony` decides. Not `CanReachColony` first: it returns true for any cell that reaches any colony building (Reachability.cs:387-435), so a walled-off area holding a sleeping zone (1.2), or player walls, would count as colony.
|
||||||
- Overflow: `DropCellFinder.TryFindDropSpotNear` around the top zone's centroid, radius 16. Then the vanilla spot.
|
- Pod rule: `DropCellFinder.IsGoodDropSpot(c, map, allowFogged: false, canRoofPunch: false)` (DropCellFinder.cs:319-362) plus the reach rule. It refuses unwalkable cells, water and vacuum terrain (DropCellFinder.cs:509-516), any roof (:518-527), districts with an enclosed animal pen marker (:537-549), skyfallers and active transporters, and edifices that aren't clearable free buildings (:338-358). Shelves are edifices, so they fail it roofed or not.
|
||||||
- Context (from 1.1): callers that can't pass a source set a `[ThreadStatic] DeliveryContext` in a prefix and clear it in a finalizer. The `DropPodUtility.DropThingGroupsNear` prefix reads it.
|
- Placement rule (caravan goods, direct delivery into delivery zones): standable, unfogged, the reach rule, roof ignored.
|
||||||
|
- Storage rule (1.3 storage targets): `StoreUtility.IsValidStorageFor(c, map, thing)` (StoreUtility.cs:103-115: the slot group accepts the thing, no storage blockers, items per cell respected) and `StoreUtility.IsGoodStoreCell(c, map, thing, null, Faction.OfPlayer)` (StoreUtility.cs:327: no player reservation, no fire, no blocking frame), unfogged, and the reach rule with `Touch`. Not standable: vanilla shelves and RimFridge fridges are PassThroughOnly, RimFridge wall fridges Impassable, and `Standable` (GenGrid.cs:144-159) refuses both.
|
||||||
|
- Overflow center: the top zone's cell nearest its centroid, not the raw centroid. `TryFindDropSpotNear` needs reachability from its center (DropCellFinder.cs:309-312), and the centroid of an L-shaped zone can be a wall.
|
||||||
|
- Overflow: `DropCellFinder.TryFindDropSpotNear(center, map, out cell, allowFogged: false, canRoofPunch: false, maxRadius)` (DropCellFinder.cs:229) with the radius setting, never below 5. The search grows by `Mathf.Min(maxRadius / 5, 1)` (DropCellFinder.cs:272), which is 0 below 5, so a failed search never ends. Then the vanilla spot.
|
||||||
|
- Context (from 1.1): callers that can't pass a source set a `[ThreadStatic] DeliveryContext` in a prefix, keep the previous value in `__state` and restore it in a finalizer. The `DropPodUtility.DropThingGroupsNear` prefix reads it. A prefix on `SignalManager.SendSignal` (SignalManager.cs:38) saves and clears the context and its finalizer restores it: signals are delivered inside the same call (SignalManager.cs:38-60), so quest parts chained through `outSignalResult` (QuestPart_DropPods.cs:239-251, QuestPart_GiveNearPawn.cs:224-238) never see a context that wasn't set for them.
|
||||||
|
- Fallback: every entry point runs in try/catch. On an exception it logs once and calls the original vanilla method with the original arguments. The log-once flags reset in `FinalizeInit`.
|
||||||
|
|
||||||
### Zone beds
|
### Zone beds
|
||||||
|
|
||||||
One invisible bed per sleeping-zone cell: `Building_ZoneBed : Building_Bed`, player faction, not an edifice, def `isSaveable` false.
|
One invisible bed per sleeping-zone cell: `Building_ZoneBed : Building_Bed`, player faction, not an edifice, def `isSaveable` false. Animal zones use them from 1.2, people zones from 1.4.
|
||||||
|
|
||||||
- Why real beds: ownership, prisoner capture, slave beds, patients, rescue, babies and `Alert_NeedColonistBeds` keep working with no extra patches. Ground sleep without beds covers voluntary sleep only (see Cut).
|
- Why real beds: ownership, prisoner capture, slave beds, patients, rescue, babies and `Alert_NeedColonistBeds` keep working with no extra patches. Ground sleep without beds covers voluntary sleep only (see Cut).
|
||||||
- Not an edifice: an edifice without a `sowTag` blocks planting and wipes the pasture grass under it.
|
- Not an edifice: an edifice without a `sowTag` blocks planting and wipes the pasture grass under it (ThingDef.cs:625-655, 1360-1387; GenSpawn.cs:445-447).
|
||||||
- Saving: `Map.ExposeData` skips things whose def has `isSaveable` false, so the component deep-saves the beds instead and the load prefix hands them to vanilla. Without the mod they vanish with the component node, and the vanilla things list never holds a missing def.
|
- Saving: `Map.ExposeData` skips things whose def has `isSaveable` false (Map.cs:652, the only check in the code), so the component deep-saves the beds instead and the load prefix hands them to vanilla. Without the mod they vanish with the component node, and the vanilla things list never holds a missing def. Before saving, the component drops destroyed and despawned beds from its list; a destroyed bed left there would come back next to its replacement.
|
||||||
- Reconcile: `MapComponent.FinalizeInit` spawns missing beds and destroys beds whose cell is no longer in a sleeping zone.
|
- Spawning: make the bed, `SetFaction(Faction.OfPlayer)` (`IsValidBedFor` needs it, RestUtility.cs:185), set `ForOwnerType` and `Medical` while it is unspawned and the bypass flag below is set, then `GenSpawn.Spawn`. On an unspawned bed the setters find no owners and no room (Building_Bed.cs:92-131, 753-756). `Building_Bed.SpawnSetup` then recomputes the district and room with the bed already the right type (Building_Bed.cs:274-282), so a prisoner zone in a closed room becomes a prison cell. The bed never wipes anything: a cell holding a skyfaller, an active transporter or another bed waits for the next sweep.
|
||||||
|
- Owner type comes from the zone (people zones, 1.4): prefixes on the `ForPrisoners` setter (Building_Bed.cs:44-73) and the `ForOwnerType` setter (Building_Bed.cs:92-108) refuse any change to a zone bed unless Zones' own `[ThreadStatic]` bypass flag is set. Vanilla changes owner types behind the zone's back in three places, and each flip posts one message per owner (`RemoveAllOwners`, Building_Bed.cs:738-751):
|
||||||
|
- at spawn in a prison cell (Building_Bed.cs:272-276);
|
||||||
|
- on every room recalculation of a prison cell, through `ForPrisoners` (Room.cs:721-727);
|
||||||
|
- through the bed gizmo: `SetBedOwnerTypeByInterface` collects every bed in the room, all of them when switching to Prisoner in a room that can be a prison cell and every prisoner bed when switching away, and sets them through `ForOwnerType` (Building_Bed.cs:395-473, collected at :419-436, set at :448, :452).
|
||||||
|
- Zones sets the flag around its own owner-type changes and around `base.DeSpawn` in `Building_ZoneBed`, where vanilla resets the type to Colonist (Building_Bed.cs:301). Vanilla's confirm for the gizmo (:475-480) may still count zone-bed owners who keep their cells; accepted.
|
||||||
|
- Choke point: `Building_ZoneBed.DeSpawn` is our own override, no Harmony. If Zones didn't start the removal, the mode isn't `WillReplace` and the cell is still a sleeping-zone cell, it unclaims the owners silently and queues a respawn for the next tick with the zone's flags.
|
||||||
|
- Sweep: every 250 ticks the component trims sleeping-zone cells that hold an edifice (backstop for the 1.2 edifice postfix), and from 1.4 it also runs the shared-zone and caste checks.
|
||||||
|
- Reconcile: `MapComponent.FinalizeInit` (MapComponent.cs:32, called from Map.cs:851) drops sleeping-zone cells that hold an edifice, destroys beds whose cell is no longer in a sleeping zone and spawns missing beds. It never resets the owners, medical flag or owner type of a bed that still exists.
|
||||||
|
|
||||||
|
### Rules every feature follows
|
||||||
|
|
||||||
|
From the three Castes review rounds.
|
||||||
|
|
||||||
|
- Undo only what Zones did. When a zone, filter, caste limit or owner type changes, unclaim only owners of that zone's beds, and only those who no longer pass. The one exception is switching a zone to prisoners, which also unclaims owners of the vanilla beds that become prisoner beds, after a confirm that names them.
|
||||||
|
- No game state in statics. Caches live in the MapComponent. The copy/paste clipboard holds copied settings, never a Zone. The static loading, camp and bypass flags are set in a prefix or a `try` and cleared in a finalizer or `finally`, like Castes' JoinScopes.
|
||||||
|
- Store what the player chose, not what the game reads now. Species are stored as defNames and resolved with `GetNamedSilentFail`, so a removed animal mod leaves nothing unresolved. Caste ids stay stored while Castes is unbound.
|
||||||
|
- Bulk changes ask first and name the count: the removal button, and switching medical, shared or owner type on a zone that has owners. Owner losses Zones causes post one message naming the count, never one per pawn.
|
||||||
|
- Judge removals at the choke point, never in a passing state: `Building_ZoneBed.DeSpawn` for beds, reconcile after loading.
|
||||||
|
- Optional-mod state can be missing at load. Map `FinalizeInit` runs inside `Map.FinalizeLoading`, before the game components' `FinalizeInit` and `LoadedGame` (Game.cs:611-647), so nothing drops stored data because a sibling looks empty there.
|
||||||
|
- Every hook body sits in try/catch with a one-time log. On routing paths the catch calls the original vanilla method.
|
||||||
|
- Prefer a route without a patch where one exists, and never prefix a method of a few lines that the JIT may inline into its callers.
|
||||||
|
- Designators read their master toggle live through `Gizmo.Visible` (Gizmo.cs:31). A setting written into defs at startup says "restart required" in its tooltip, and code reads the def, not the setting.
|
||||||
|
|
||||||
|
### DLC support
|
||||||
|
|
||||||
|
Every Blax mod works with any DLC combination, core only included (rule of 2026-11-29). For Zones:
|
||||||
|
|
||||||
|
- About.xml names no DLC, neither as a dependency nor in loadAfter.
|
||||||
|
- Every feature runs on the core game. The one part that needs a DLC is slave sleeping zones (Ideology, 1.4). Tribute collectors and Empire quests exist only with Royalty, but they reach Zones through core code (the caravan incident's base class, `QuestPart_DropPods`), so camping and reward routing have no Royalty code.
|
||||||
|
- DLC defs only through `MayRequire` in XML and null-checked DefOf members in code. Zones' defs and patches name no DLC def: the designator patch anchors on Growing because the Fishing entry carries `MayRequire` Odyssey (Core Misc/Designations/DesignationCategories.xml:40-41), and the bed defs' `artificialForMeditationPurposes` and `bringAlongOnGravship` are core fields (BuildingProperties.cs:334, set by Core's own sleeping spots at Buildings_Furniture.xml:71 and :490; ThingDef.cs:167). The only DLC def the code reads is Biotech's Wastepack (Biotech ThingDefs_Items/Items_Resource_Manufactured.xml:280) through `ThingDefOf.Wastepack`, which is `[MayRequireBiotech]` (ThingDefOf.cs:235-236) and null without Biotech; every use checks for null.
|
||||||
|
- DLC code only behind `ModsConfig.<DLC>Active`. `ModLister.Check<DLC>` is no guard: it checks that the DLC is installed, not active (ModLister.cs:283-287, 347-364), so it passes in a run that leaves an installed DLC out and logs an error for a player who doesn't own it. Vanilla's `ForOwnerType` setter relies on it for slave beds (Building_Bed.cs:100), hence the 1.4 guard.
|
||||||
|
- Settings and gizmos: no global setting needs a DLC. A per-zone choice that does shows disabled with a "Needs <DLC>" note instead of hiding: the owner-type gizmo's "Slaves" shows "Needs Ideology".
|
||||||
|
- A save made with a DLC loads without it:
|
||||||
|
- A slave zone keeps its owner type, as vanilla keeps a slave bed's (`forOwnerType` loads with no DLC check, Building_Bed.cs:319), and can still be switched to colonists or prisoners. With Ideology back it works as a slave zone again.
|
||||||
|
- Delivery zone filters are vanilla `ThingFilter`s: items of a missing DLC drop out, with the same "Could not load reference" error per missing def that vanilla stockpile filters log (ScribeExtractor.cs:44-65), and the zone keeps working. Species deny-lists are names, so a missing species just doesn't resolve.
|
||||||
|
- Anomaly and Odyssey are guarded in code only; neither is installed here. Zones calls no Anomaly code. Odyssey reaches Zones only through vanilla code that runs with it: gravship landings call our `RemoveCell` (GravshipPlacementUtility.cs:311-313), vacuum terrain fails the pod rule, and zone beds never fly.
|
||||||
|
- Tests:
|
||||||
|
- `run-tests.ps1 -NoDlc` runs on the core game, `-Dlc Royalty,Biotech` with only the named installed DLCs. Both come from Castes' script, which lists every installed DLC as known, so the game never switches a left-out one on.
|
||||||
|
- A release runs the whole suite, phases 2 and 3 included, in all 8 combinations of Royalty, Ideology and Biotech: none, each alone, each pair and all three.
|
||||||
|
- A test that needs a DLC names it and skips without. Each feature's DLC-off test runs in every combination that lacks its DLC.
|
||||||
|
- Anomaly and Odyssey paths are not tested.
|
||||||
|
|
||||||
|
| Feature | Release | Needs | Without it |
|
||||||
|
|---|---|---|---|
|
||||||
|
| Save-safe zone storage | 1.0 | None | Unchanged |
|
||||||
|
| Delivery zones, orbital purchases | 1.0 | None | Unchanged; the Wastepack refusal is skipped, since the def doesn't exist |
|
||||||
|
| Caravans camp at a zone | 1.0 | None | Trader caravans camp; tribute collectors exist only with Royalty |
|
||||||
|
| Quest rewards land in the zone | 1.1 | None | Every item reward routes; Empire quests exist only with Royalty |
|
||||||
|
| Caravan purchases | 1.1 | None | Unchanged |
|
||||||
|
| Animal sleeping zones, animal filters, removal button | 1.2 | None | Unchanged |
|
||||||
|
| Stockpile and shelf deliveries, delivery under a roof, sell zones, cargo pods | 1.3 | None | Unchanged |
|
||||||
|
| People sleeping zones for colonists and prisoners; medical, shared and comfort; zone tints | 1.4 | None | Unchanged |
|
||||||
|
| Slave sleeping zones | 1.4 | Ideology | "Slaves" shows disabled with "Needs Ideology"; a slave zone from a save made with Ideology stays one and can be switched to colonists or prisoners |
|
||||||
|
| Caste filter | 1.5 | None (Blax Castes is a mod) | Unchanged |
|
||||||
|
| Royal title rewards | Backlog | Royalty | Not offered |
|
||||||
|
| Age limits on people zones | Backlog | Biotech | Shown disabled with "Needs Biotech" |
|
||||||
|
| Blax zones fly with gravships | Backlog | Odyssey | Zones stay behind, as today |
|
||||||
|
|
||||||
## Releases
|
## Releases
|
||||||
|
|
||||||
### 1.0 Delivery zones (5 days)
|
### 1.0 Delivery zones and caravan camps (6 days)
|
||||||
|
|
||||||
#### Save-safe zone storage
|
#### Save-safe zone storage
|
||||||
|
|
||||||
- **Players get:** Nothing to see. Zones survive save and load. To remove the mod mid-game, click "Remove Blax Zones from this game" in the mod settings, save, then disable the mod, and the save loads with no errors. A plain unsubscribe also loads: the zones are gone and the log shows 2 errors per map. From 1.2 on it also shows one "Could not resolve reference" warning per bed owner, job target and reservation.
|
- **Players get:** Nothing to see. Zones survive save and load. Removing the mod mid-game with a plain unsubscribe leaves a save that loads: the Blax zones are gone, vanilla zones stay, and the log shows the 2 errors per map named in the data model. The button that removes even those comes in 1.2.
|
||||||
- **How:** Save prefix and finalizer as in the data model, using `AccessTools.FieldRefAccess` for `allZones`. The `Map.FinalizeLoading` prefix runs while `zoneGrid` exists and nothing has spawned yet. It sets each zone's `zoneManager` link, calls `ZoneManager.RegisterZone`, then `AddZoneGridCell` per cell through an `AccessTools` delegate, since that method is internal. The `thingGrid` is still empty there, so don't filter cells by hand. Vanilla's spawn loop calls `ZoneManager.Notify_NoZoneOverlapThingSpawned` and trims our zones exactly as it trims stockpiles. A static loading flag stops `RemoveCell` from unclaiming or destroying beds that haven't spawned yet; reconcile cleans up after. I picked this over registering in `FinalizeInit`, because vanilla then handles overlap for our zones with its own code. Mark the zone mesh dirty; `Map.FinalizeInit` regenerates all meshes anyway. The removal button needs a confirmation dialog and a loaded game. On every map it deregisters our zones (from 1.2 it also unclaims and destroys zone beds and ends LayDown jobs on them), then removes the component from `map.components`, so the next save has no BlaxZones node. It ends with the message "Save now, then disable the mod". A dev debug action does the same.
|
- **How:**
|
||||||
- **Settings:** The removal button, enabled only while a game is loaded. No toggle, because this is the save format, not a feature.
|
- Save: the prefix and finalizer from the data model, with `AccessTools.FieldRefAccess` for `allZones`; the component writes the Blax zones from `AllZones` as the data model's zone-list rule says.
|
||||||
|
- Load: the `Map.FinalizeLoading` prefix runs while `zoneGrid` exists and nothing has spawned yet. Its whole body sits in try/catch, because vanilla catches an exception there as "Error in Map.FinalizeLoading()" and skips the rest of that map's load (Game.cs:619-623). On an exception it logs once and leaves our zones out of this load. It sets each zone's `zoneManager` link, calls the public `ZoneManager.RegisterZone` (ZoneManager.cs:52), then the internal `AddZoneGridCell` (ZoneManager.cs:68) per cell through an `AccessTools` delegate, and then clears the component's loaded-zone list.
|
||||||
|
- The `thingGrid` is still empty there, so don't filter cells by hand. Vanilla's spawn loop (Map.cs:751-799) calls `Notify_NoZoneOverlapThingSpawned` for every thing that can't overlap zones (Thing.cs:859-862, ZoneManager.cs:97-112) and trims our zones exactly as it trims stockpiles; a zone that loses its last cell there is deregistered and never saved again. I picked this over registering in `FinalizeInit`, because vanilla then handles overlap for our zones with its own code.
|
||||||
|
- A static loading flag, set in the prefix and cleared in a finalizer, stops `RemoveCell` from unclaiming or destroying beds that haven't spawned yet; reconcile cleans up after. Mark the zone mesh dirty; `Map.FinalizeInit` regenerates all meshes anyway (Map.cs:834-837).
|
||||||
|
- **Settings:** None. This is the save format, not a feature.
|
||||||
|
- **Save and removal:** This is the save format. Zones that vanilla saved would need a migration later, so it ships in 1.0. Adding the mod mid-save gives every map an empty component.
|
||||||
- **Replaces:** Nothing.
|
- **Replaces:** Nothing.
|
||||||
- **Effort:** M, 2 days.
|
- **Effort:** M, 2 days.
|
||||||
- **Tests:** Phase 1: create two delivery zones with different filters and priorities, save, parse the .rws. No "BlaxZones." inside `<zoneManager>` or `<things>`; both zones sit under the `MapComponent_BlaxZones` node. Phase 2, after reload: both zones are in `map.zoneManager.AllZones` with the same ID, label, cells, filter and priority, and `ZoneAt(cell)` returns them. A wall built on a zone cell before saving leaves that cell out. Phase 3, a new harness step: the runner renames the component's Class attribute in the save to a type that doesn't exist and loads it. Loading finishes, the log has no NRE and no errors beyond the expected "Could not find class", no Blax zones exist and vanilla stockpiles are intact. Removal button: afterwards `map.components` has no `MapComponent_BlaxZones`, and a fresh save contains no "BlaxZones".
|
- **Tests:**
|
||||||
- **Risks:** It must ship in 1.0. Zones that vanilla saved in an earlier version would need a migration. Saving runs on the main thread, and the finalizer guarantees the restore. A mod that reads zones during load before `FinalizeLoading` won't see ours (none known). Another mod that also swaps `allZones` while saving composes, since each restores its own list object.
|
- Phase 1: create two delivery zones with different filters and priorities, save, parse the .rws. No "BlaxZones." inside `<zoneManager>` or `<things>`; both zones sit under the `MapComponent_BlaxZones` node. After an autosave without a reload, our zones are still in `AllZones`, the list is the same object (`ReferenceEquals`) and `zoneGrid` is intact. A test-only zone whose ExposeData throws while saving: the finalizer still restores the list. Delete a third zone before saving: the .rws doesn't contain it. A fourth zone whose only cell gets a wall before saving is not in the .rws either.
|
||||||
|
- Phase 2: both zones are in `map.zoneManager.AllZones` with the same ID, label, cells, filter, priority and sources, and `ZoneAt(cell)` returns them. The deleted and walled-over zones stay gone. `Zone.ID` comes from `UniqueIDsManager` (Zone.cs:192), so a new vanilla zone never reuses it. A wall built on a zone cell before saving leaves that cell out.
|
||||||
|
- Phase 3: loading finishes, stockpiles are intact, no Blax zones exist, the log has exactly the two expected errors per map and no NRE.
|
||||||
|
- Added mid-save: a save made without Zones loads with an empty component on every map (Castes' "mod added mid-save" test).
|
||||||
|
- **Risks:** A mod that reads zones during load before `FinalizeLoading` won't see ours (none known). Saving runs on the main thread, and the finalizer guarantees the restore. Another mod that also swaps `allZones` while saving composes, since each restores its own list object.
|
||||||
|
|
||||||
#### Delivery zone
|
#### Delivery zone
|
||||||
|
|
||||||
- **Players get:** A new "Delivery zone" in the Zone menu, dragged like a stockpile. Its tab has an item filter (what may land here), a priority from Low to Critical, and source checkboxes for orbital traders and caravan traders (1.1 adds quest and royal rewards). While the zone is selected, red outlines mark cells drop pods can't use (roofed, inside an enclosed pen, blocked, fogged, unreachable), and the inspect pane counts them. Like every vanilla zone, it extends the home area 4 cells around itself; the tooltip says so.
|
- **Players get:** A new "Delivery zone" in the Zone menu, dragged like a stockpile. Its tab has an item filter (what may land here), a priority from Low to Critical, and source checkboxes (orbital traders now, quest rewards and caravan traders in 1.1). While the zone is selected, red outlines mark cells drop pods can't use (roofed, inside an enclosed pen, water or vacuum, a building in the way, blocked, fogged, unreachable), and the inspect pane gives their total. Like every vanilla zone, it extends the home area 4 cells around itself; the tooltip says so.
|
||||||
- **How:** `Zone_Delivery : Verse.Zone` with `ThingFilter filter` (all items allowed; Wastepack and corpses hidden and always refused), `StoragePriority priority = Normal`, and `acceptOrbital` and `acceptCaravan`, both true, each scribed with its default. 1.1 adds `acceptRewards` the same way. `Designator_ZoneAdd_Delivery` plus an `_Expand` subclass reached through `Verse.DesignatorUtility.FindAllowedDesignator`, as `Zone_Fishing` does. A namespace-qualified `PatchOperationInsert` adds it after the `Designator_ZoneAdd_Growing` entry in DesignationCategoryDef Zone `specialDesignatorClasses`; anchor on Growing, because the Fishing entry carries `MayRequire`. `ITab_Delivery` holds the priority dropdown, the source checkboxes, `ThingFilterUI.DoThingFilterConfigWindow` and copy/paste gizmos with our own clipboard. Cell validity uses the router's pod rule. Check reachability once per district of the zone, not per cell: `Reachability.CanReachColony` loops over every player pawn and colony building on a miss, and 1.2 adds hundreds of zone beds to that list. Cache the result per zone and recompute every 250 ticks, only while the zone is selected. `MapComponentUpdate` draws `GenDraw.DrawFieldEdges` over invalid cells. Zone color amber at alpha 0.09. Icon: the vanilla `UI/Designators/ZoneCreate_Stockpile` texture tinted amber through `defaultIconColor`. The home-area growth comes from the base `Zone.AddCell` calling `AutoHomeAreaMaker.Notify_ZoneCellAdded`. This feature also builds the DeliveryRouter and `ZonesApi`.
|
- **How:**
|
||||||
- **Settings:** Global "Delivery zones" master toggle (on). Per zone: filter (all items), priority (Normal), two source checkboxes (both on; 1.1 adds a third for rewards).
|
- `Zone_Delivery : Verse.Zone` with `ThingFilter filter` (all items allowed; corpses and, with Biotech, Wastepack hidden and always refused; a null `ThingDefOf.Wastepack` is skipped), `StoragePriority priority = Normal`, `acceptOrbital` (true) and `campHere` (false), each scribed with its default. 1.1 adds `acceptRewards` and `acceptCaravan`, 1.3 `acceptCargoPods` and `directDelivery`, the same way.
|
||||||
- **Replaces:** Together with the routing below: Trade Ships Drop Spot (1969732297, 206,325 subs, no official 1.7) and its unofficial 1.7 ports (3828260574, 124; 3837213962, 67), the orbital drop spot of Trading Control (2007107588, 111,063), Orbital Trade Goods Landing Zone (3015945224, 161).
|
- Designators: `Designator_ZoneAdd_Delivery` plus an `_Expand` subclass reached through `DesignatorUtility.FindAllowedDesignator` (DesignatorUtility.cs:25-46), as `Zone_Fishing` does (Zone_Fishing.cs:196-199). `Designator_ZoneAdd` compares the exact zone type and refuses cells in other zones (Designator_ZoneAdd.cs:46, 73, 114, 127). Expanding over the zone only adds new cells. A namespace-qualified `PatchOperationInsert` adds the designator after the `Designator_ZoneAdd_Growing` entry in DesignationCategoryDef Zone `specialDesignatorClasses` (Core Misc/Designations/DesignationCategories.xml:40); anchor on Growing, because the Fishing entry (:41) carries `MayRequire`. `Visible` reads the master toggle live.
|
||||||
|
- Tab: `ITab_Delivery` holds the priority dropdown, the source checkboxes, the camp checkbox, `ThingFilterUI.DoThingFilterConfigWindow` and copy/paste gizmos with our own clipboard.
|
||||||
|
- Cell validity uses the router's pod rule. `MapComponentUpdate` draws `GenDraw.DrawFieldEdges` over invalid cells while the zone is selected. `GetInspectString` adds "N cells drop pods can't use"; the breakdown by reason is in the Backlog.
|
||||||
|
- Reachability is checked once per district of the zone, not per cell, with the router's reach rule. Cache the result per zone in the component. Recompute every 250 ticks while the zone is selected; the router recomputes an entry older than 2500 ticks.
|
||||||
|
- Zone color amber at alpha 0.09, the vanilla zone opacity (ZoneColorUtility.cs:20). Icon: the vanilla `UI/Designators/ZoneCreate_Stockpile` texture tinted amber through `defaultIconColor`.
|
||||||
|
- The home-area growth comes from the base `Zone.AddCell` calling `AutoHomeAreaMaker.Notify_ZoneCellAdded` (Zone.cs:232), which marks a 4-cell border while auto home area is on (AutoHomeAreaMaker.cs:48-58).
|
||||||
|
- This feature also builds the DeliveryRouter and `ZonesApi`.
|
||||||
|
- **Settings:** Global "Delivery zones" master toggle (on); off hides the designators, existing zones stay and the routing toggles still apply. Per zone: filter (all items), priority (Normal), orbital checkbox (on; 1.1 adds rewards and caravan, both on), "Caravans camp here" (off).
|
||||||
|
- **Save and removal:** The zone and its filter save inside the component, never in `ZoneManager`. Removal deletes them with the component and the cells become plain ground.
|
||||||
|
- **Replaces:** Together with the routing below: Trade Ships Drop Spot (1969732297, 206,371 subs, official versions up to 1.6) and its unofficial 1.7 ports (3828260574, 127; 3837213962, 70), the orbital drop spot of Trading Control (2007107588, 111,091, up to 1.6), Orbital Trade Goods Landing Zone (3015945224, 161, 1.5). Quest rewards, the other half of what Trade Ships Drop Spot does, follow in 1.1.
|
||||||
- **Effort:** M, 2 days, router included.
|
- **Effort:** M, 2 days, router included.
|
||||||
- **Tests:** Designating unroofed cells creates a `Zone_Delivery`; the expand gizmo grows it. The designator refuses cells in an existing stockpile. Roof 3 cells and `GetInspectString` reports 3 unusable cells. A fenced pen around the zone makes every cell unusable. The default filter allows silver, medicine and steel and refuses Wastepack. Filter, priority and sources persist in phase 2. `ZonesApi.TryFindDropSpot` returns a zone cell for steel and false for a pawn.
|
- **Tests:** Designating unroofed cells creates a `Zone_Delivery`; the expand gizmo grows it and only adds cells. The designator refuses cells in an existing stockpile. Roof 3 cells and `GetInspectString` reports 3 unusable cells; a water cell makes it 4. A fence ring with an animal pen marker around the zone makes every cell unusable. The default filter allows silver, medicine and steel and refuses Wastepack (Biotech); without Biotech it builds with no error. Filter, priority, orbital and camp flags persist in phase 2. `ZonesApi.TryFindDropSpot` returns a zone cell for steel and false for a pawn; with the zone's orbital checkbox off it returns false. The overflow radius setting can't go below 5.
|
||||||
- **Risks:** One zone per cell, so a delivery zone can't overlap a stockpile. Goods land and haulers store them; 1.3 lets stockpiles receive deliveries directly. Pods never land in an enclosed pen (vanilla rule). The red overlay shows this instead of failing silently like Trading Control's spot.
|
- **Risks:** One zone per cell, so a delivery zone can't overlap a stockpile. Goods land and haulers store them; 1.3 lets stockpiles receive deliveries directly. Pods never land in an enclosed pen (vanilla rule). The red overlay shows this instead of failing silently like Trading Control's spot. Pick Up And Haul (1279012058, 1,784,752 subs) patches hauling only; it collects goods from the zone several stacks per trip, and nothing changes for us.
|
||||||
|
|
||||||
#### Orbital purchases land in the zone
|
#### Orbital purchases land in the zone
|
||||||
|
|
||||||
- **Players get:** Everything bought from an orbital trader, plus the silver from selling, drops into the best matching delivery zone instead of next to the first unroofed trade beacon. When every zone cell is taken, pods land next to the top zone. With no fitting zone they fall back to vanilla. Raids never come to the zone.
|
- **Players get:** Everything bought from an orbital trader, plus the silver from selling, drops into the best matching delivery zone instead of next to the first unroofed trade beacon. When every zone cell is taken, pods land next to the top zone. With no fitting zone they fall back to vanilla. Raids never come to the zone.
|
||||||
- **How:** A transpiler on `TradeShip.GiveSoldThingToPlayer` replaces its single `TradeUtility.SpawnDropPod(IntVec3, Map, Thing)` call with `DeliveryRouter.DeliverFromOrbit`, which has the same signature. A caller-scoped transpiler is also safer than a prefix on the 4-line `SpawnDropPod`, which the runtime may inline. `DropCellFinder.TradeDropSpot` is never patched, because center-drop raids (40% with a powered beacon), ransom pawns and returning lent colonists use it too. It still runs once per stack to supply the vanilla spot, the same cost as vanilla, and can log vanilla's own "Could find no good TradeDropSpot" error. The router picks a cell, then calls `TradeUtility.SpawnDropPod(cell, map, thing)`. A falling pod already makes its cell fail `IsGoodDropSpot`, so one trade spreads over the zone with no bookkeeping. Overflow within radius 16 lets a 1-cell zone act as a drop spot. Another mod's `TradeDropSpot` prefix (Trade Ships Drop Spot, Trading Control) still supplies the vanilla spot, so their spot becomes our fallback. If def `DropSpotTradeShip` exists, a one-time message says the player can unsubscribe from Trade Ships Drop Spot.
|
- **How:**
|
||||||
- **Settings:** Global "Route orbital trade" (on), "Overflow lands next to the zone" (on; off sends overflow to vanilla), overflow radius 16 (4 to 30). Per zone: orbital checkbox.
|
- A transpiler on `TradeShip.GiveSoldThingToPlayer` (TradeShip.cs:199-207) replaces its single `TradeUtility.SpawnDropPod(IntVec3, Map, Thing)` call (TradeUtility.cs:76-82) with `DeliveryRouter.DeliverFromOrbit`, which has the same signature. Bought pawns and sale silver go through the same call (Tradeable.cs:472-478); the router refuses pawns. A caller-scoped transpiler is also safer than a prefix on the 4-line `SpawnDropPod`, which the runtime may inline.
|
||||||
- **Replaces:** With the delivery zone: Trade Ships Drop Spot (206k), Trading Control's drop spot (111k).
|
- `DropCellFinder.TradeDropSpot` is never patched, because center-drop raids (40% with a powered beacon, PawnsArrivalModeWorker_CenterDrop.cs:44-46), ransom pawns (ChoiceLetter_RansomDemand.cs:42-43) and returning lent colonists (QuestPart_LendColonistsToFaction.cs:98, 108) use it too. It still runs once per stack as the replaced call's argument, the same cost as vanilla, and can log vanilla's own "Could find no good TradeDropSpot" (DropCellFinder.cs:26-75).
|
||||||
|
- The router picks a cell, then calls `TradeUtility.SpawnDropPod(cell, map, thing)`. A falling pod already makes its cell fail `IsGoodDropSpot` (DropCellFinder.cs:341-344), so one trade spreads over the zone with no bookkeeping. Overflow lets a 1-cell zone act as a drop spot. On any exception it calls `SpawnDropPod` with the vanilla spot.
|
||||||
|
- Another mod's `TradeDropSpot` prefix (Trade Ships Drop Spot, Trading Control) still supplies the vanilla spot, so their spot becomes our fallback. The message that the player can unsubscribe from Trade Ships Drop Spot waits for 1.1, because that mod also places quest rewards.
|
||||||
|
- **Settings:** Global "Route orbital trade" (on), "Overflow lands next to the zone" (on; off sends overflow to vanilla), overflow radius 16 (5 to 30). Per zone: orbital checkbox; while Blax Slaves is active its tooltip adds "Also Blax Slaves payouts".
|
||||||
|
- **Save and removal:** Nothing saved. Without the mod, pods go to the vanilla spot.
|
||||||
|
- **Replaces:** With the delivery zone: the orbital half of Trade Ships Drop Spot (206k) and Trading Control's drop spot (111k).
|
||||||
- **Effort:** S, half a day.
|
- **Effort:** S, half a day.
|
||||||
- **Tests:** Build a `TradeShip` from an orbital TraderKindDef and call `GiveSoldThingToPlayer(steel, 50, negotiator)`. A `DropPodIncoming` skyfaller holding the steel sits on a zone cell. This also proves the transpiler fires; Blax Slaves has no transpiler yet. With a medicine-only zone at Important plus a general zone, medicine lands in the first and steel in the second. Fully roofing the medicine zone sends medicine to the general zone. A 1-cell zone with 5 stacks gets 1 pod in the zone and 4 within 16 cells. With no zones, the pod lands near vanilla `TradeDropSpot`. A bought animal is not routed. With zones placed away from every beacon, 20 calls of `PawnsArrivalModeWorker_CenterDrop.TryResolveRaidSpawnCenter` never return a zone cell; a zone right next to a beacon can be picked by vanilla itself. Composition: a test-only prefix makes `TradeDropSpot` return a fixed cell. With no zone the pod lands there, with a zone it lands in the zone. After 300 ticks the item lies within 1 cell of the zone.
|
- **Tests:** Build a `TradeShip` from an orbital TraderKindDef and call `GiveSoldThingToPlayer(steel, 50, negotiator)`. A `DropPodIncoming` skyfaller holding the steel sits on a zone cell, checked right after the call without ticking. With a medicine-only zone at Important plus a general zone, medicine lands in the first and steel in the second. Fully roofing the medicine zone sends medicine to the general zone. A 1-cell zone with 5 stacks gets 1 pod in the zone and 4 within 16 cells. An L-shaped zone whose centroid is a wall still overflows. With no zones, the pod lands near vanilla `TradeDropSpot`. A bought animal is not routed. With zones placed away from every beacon, 20 calls of `PawnsArrivalModeWorker_CenterDrop.TryResolveRaidSpawnCenter` never return a zone cell; a zone right next to a beacon can be picked by vanilla itself. Composition: a test-only prefix makes `TradeDropSpot` return a fixed cell. With no zone the pod lands there, with a zone it lands in the zone. After 300 ticks the item lies within 1 cell of the zone. The router throws (test hook): the steel still lands at the vanilla spot and the log shows one Zones error.
|
||||||
- **Risks:** The transpiler expects exactly one `SpawnDropPod` call. On a different count it logs an error and skips, and one-class-at-a-time patching keeps the rest alive. Mods that replace the trade-ship purchase entirely bypass us, which is fine; Realistic Orbital Trade (3236257897) uses shuttles. Pods spill with `ThingPlaceMode.Near` when they open, so a stack can land one cell past the zone edge, as vanilla pods do.
|
- **Risks:** The transpiler expects exactly one `SpawnDropPod` call. On a different count it logs an error and skips, and one-class-at-a-time patching keeps the rest alive. Mods that replace the trade-ship purchase entirely bypass us, which is fine; Realistic Orbital Trade (3236257897, 3,348 subs) uses shuttles. Pods spill with `ThingPlaceMode.Near` when they open (ActiveTransporter.cs:105), so a stack can land a cell or more past the zone edge, as vanilla pods do.
|
||||||
|
|
||||||
#### Caravan purchases appear in the zone
|
|
||||||
|
|
||||||
- **Players get:** Goods bought from a visiting trader caravan appear in the best matching delivery zone instead of at a pack animal's feet outside the walls, and a message names the zone. Roofs don't matter here, so a medicine zone inside the hospital works for caravan goods. Bought animals and people stay with the caravan, as in vanilla.
|
|
||||||
- **How:** For items, `Pawn_TraderTracker.GiveSoldThingToPlayer` makes exactly one call to `GenPlace.TryPlaceThing(Thing, IntVec3, Map, ThingPlaceMode, Action<Thing,int>, Predicate<IntVec3>, Rot4?, int)` in Near mode at the carrier's `PositionHeld`. On success it adds the item to `lord.extraForbiddenThings`; on failure it logs an error and destroys the item. Pawns return early and are never touched. A transpiler replaces that call with `DeliveryRouter.PlaceFromCaravan`, same signature. For each candidate zone (caravan ticked, filter, priority) it tries `GenPlace.TryPlaceThing` at the best cell in Near mode with the router's placement rule plus "cell is in this zone" as validator. Next it tries Near at the top zone's centroid with no validator. Last it calls the original with the original arguments, so the vanilla destroy path is reached only where vanilla would reach it. Vanilla then adds the item to `extraForbiddenThings` as before. One message per `TradeSession.deal`, with look targets on the placed things. Vanilla selling also moves colony goods out of stockpiles instantly, so goods appearing matches it. Own patch class and toggle.
|
|
||||||
- **Settings:** Global "Route caravan purchases" (on), "Message when goods arrive" (on). Per zone: caravan checkbox.
|
|
||||||
- **Replaces:** Nothing directly. The trading-spot mods only move the caravan; 1.1 covers them.
|
|
||||||
- **Effort:** S, half a day.
|
|
||||||
- **Tests:** Force `IncidentWorker_TraderCaravanArrival`, take the trader pawn and a non-pawn Thing from `trader.Goods`, call `GiveSoldThingToPlayer(thing, 1, negotiator)`. The item is spawned in the zone and listed in the lord's `extraForbiddenThings`. A fully roofed zone still receives it. With every zone cell holding a different item, it lands near the zone. With no zones, next to the carrier. A bought animal doesn't move.
|
|
||||||
- **Risks:** Goods appear instead of being carried; carried delivery is cut. A mod that rewrites `Pawn_TraderTracker.GiveSoldThingToPlayer` would conflict (none in the installed set).
|
|
||||||
|
|
||||||
### 1.1 Rewards and caravan camps (3 days)
|
|
||||||
|
|
||||||
#### Quest and royal rewards land in the zone
|
|
||||||
|
|
||||||
- **Players get:** Item rewards from quests, royal titles and "defeat all enemies" requests drop into a delivery zone that has rewards ticked, and the quest letter points there. Refugees, prisoners, mechs, wastepacks, ransom returns and raids never come to the zone.
|
|
||||||
- **How:** This feature builds the DeliveryContext from the data model, which caravan camps and cargo pods reuse. A context prefix and finalizer sit on four callers: `QuestPart_DropPods.Notify_QuestSignalReceived`, only when `useTradeDropSpot` is true and `dropSpot` is invalid (exactly the drops vanilla sends to the trade spot); `Pawn_RoyaltyTracker.ApplyRewardsForTitle`, only on player home maps; `QuestPart_GiveNearPawn.Notify_QuestSignalReceived`; and the private `DefeatAllEnemiesQuestComp.GiveRewardsAndSendLetter`. While the context is set, a prefix on `DropPodUtility.DropThingGroupsNear` takes `thingsGroups` as a ref parameter. A group qualifies when it holds no Pawn and no Wastepack and all its things pass one zone (rewards ticked, filter). Each qualifying group goes out as its own pod: an `ActiveTransporterInfo` with the call's `openDelay`, `leaveSlag` and forbid flag (royal rewards pass false, the defeat-all-enemies reward the default true), dropped with `DropPodUtility.MakeDropPodAt(cell, map, info, faction)` using the call's faction, so faction pod skins survive. If the call has `instaDrop`, the group is placed directly, as vanilla does. The prefix then assigns a filtered copy holding the remaining groups, so vanilla drops only those and the caller's list is never changed. The letter needs no patch: `QuestPart_DropPods` builds its look target after dropping, from the first dropped thing's position. Ransom (`ChoiceLetter_RansomDemand` calls `SpawnDropPod`), lent-colonist returns, edge drops and center drops never set the context.
|
|
||||||
- **Settings:** Global "Route quest and royal rewards" (on). Per zone: rewards checkbox.
|
|
||||||
- **Replaces:** The quest-reward half of Trade Ships Drop Spot (206k) and Trading Control (111k).
|
|
||||||
- **Effort:** M, 2 days.
|
|
||||||
- **Tests:** `Quest.MakeRaw` plus a `QuestPart_DropPods` with `useTradeDropSpot = true`, things gold 50 and medicine 5, inSignal "blax.test". Call `Notify_QuestSignalReceived(new Signal("blax.test"))`. Both pods land on zone cells, split by filter, and the letter's look target lies in the zone. Add a refugee pawn: its pod is not in a zone, the items' pods are. A Wastepack is never routed. The list passed in still holds every group afterwards. With `instaDrop`, items appear with no pod. A faction-skinned call keeps its faction on the pod. `DropThingsNear` without the context, as a raid would call it, is untouched. With Royalty, `ApplyRewardsForTitle(Empire, null, title with rewards)` puts pods in the zone; skip without Royalty.
|
|
||||||
- **Risks:** Mod quests that drop rewards through their own code aren't covered unless they use `QuestPart_DropPods` with `useTradeDropSpot`. Finalizers keep the context from leaking.
|
|
||||||
|
|
||||||
#### Trader caravans camp at a zone
|
#### Trader caravans camp at a zone
|
||||||
|
|
||||||
- **Players get:** A per-zone option "Caravans camp here" on delivery zones. Visiting trader caravans gather next to that zone instead of a random spot outside the colony, so the trader is easy to reach and bought goods appear right beside the caravan.
|
- **Players get:** A per-zone option "Caravans camp here" on delivery zones. Visiting trader caravans and tribute collectors gather next to that zone instead of a random spot outside the colony, so the trader is easy to reach and goods bought from it appear at the pack animals' feet right beside the zone, even before 1.1 routes them.
|
||||||
- **How:** A DeliveryContext prefix and finalizer on `IncidentWorker_TraderCaravanArrival.TryExecuteWorker`. A prefix on the overload `RCellFinder.TryFindRandomSpotJustOutsideColony(IntVec3 root, Map, Pawn searcher, out IntVec3, Predicate<IntVec3> extraValidator)` runs while the context is set and a camp zone exists. It tries standable, unfogged, unroofed cells within 6 cells of the zone that pass the caller's `extraValidator`, preferring cells outside enclosed rooms. Vanilla's validator already checks that every caravan pawn can reach the cell. If none passes, vanilla runs. No constructor patch and no re-targeting afterwards: `LordToil_Travel` and `LordToil_DefendTraderCaravan` take the chill spot when the lord is made, so the spot must be right before that. Visitor groups and other lord jobs never set the context. If a known trading-spot mod is active (package ids listed in Compat), the feature stands down and logs once.
|
|
||||||
- **Settings:** Global "Caravans may camp at zones" (on). Per zone: off.
|
|
||||||
- **Replaces:** [KV] Trading Spot (1180719658, 125,716 subs) and [GMT] Trading Spot (2874517333, 117,497), both dead before 1.7; Trading Spot (3507108484, 44,228), 1.6 only; Trade Caravan Spot (3733234194, 2,766); Trading Spot Rewritten (3780903689, 2,199); the trade-marker half of Trading Control (2007107588, 111,063).
|
|
||||||
- **Effort:** S, half a day.
|
|
||||||
- **Tests:** Caravan arrival with a camp zone: the lord's chill spot is within 6 cells of the zone. A walled-off zone keeps the vanilla spot. Without the option, the vanilla spot. A visitor group ignores the zone.
|
|
||||||
- **Risks:** Traders still wander within the defend radius of 28. A zone deep inside the base brings visitors inside, which is the player's choice.
|
|
||||||
|
|
||||||
### 1.2 Sleeping zones (10 days)
|
|
||||||
|
|
||||||
#### Sleeping zones for people and animals
|
|
||||||
|
|
||||||
- **Players get:** Two new zone tools, "Sleeping zone" for people and "Animal sleeping zone". Every cell works like a sleeping spot, so one drag over the barn beds every chicken and duck, and colonists claim cells in a dorm zone. A gizmo switches a people zone between colonists, slaves and prisoners, as on a bed. Shrinking or deleting the zone removes its cells.
|
|
||||||
- **How:** Zone beds as in the data model. `Zone_SleepingBase : Zone` with subclasses `Zone_SleepingPeople` and `Zone_SleepingAnimals`; separate types keep the designators from expanding each other's zones, since `Designator_ZoneAdd` compares the exact type. `AddCell` spawns a `Building_ZoneBed` with `SetFaction(Faction.OfPlayer)`, which `IsValidBedFor` needs, then sets `ForOwnerType` from the zone, because `Building_Bed.SpawnSetup` flips a bed in a prison cell to prisoners. Each bed spawn runs `District.Notify_RoomShapeOrContainedBedsChanged` over every region of the district, so a 500-cell outdoor drag means 500 passes. Measure it in the harness; if it hitches visibly, spawn a drag's beds over several ticks. `RemoveCell` and deregistration unclaim owners first, then destroy, so there is no "lost assignment" spam; the loading flag skips this during load. Owner-type changes unclaim owners silently with `pawn.ownership.UnclaimBed()` before the vanilla setter, whose `RemoveAllOwners` posts one message per owner.
|
|
||||||
- Defs `BlaxZones_ZoneBed` (`bed_humanlike` true) and `BlaxZones_ZoneAnimalBed` (false): 1x1, Standable, FloorEmplacement, no `sowTag` (so `CanOverlapZones` stays true), `building.isEdifice` false, `selectable` false, `drawGUIOverlay` false, `drawerType` None, `useHitPoints` false, WorkToBuild 0, no cost list (no wealth), no designationCategory, `tickerType` Never, `isSaveable` false, `expandHomeArea` false (or every bed marks home area), `CompAssignableToPawn_Bed`. The uiIcon uses the vanilla AnimalSleepSpot texture.
|
|
||||||
- Copied from the vanilla spots: SurgerySuccessChanceFactor 0.7, Comfort 0.4 (humanlike def), `scatterableOnMapGen` false (needed for `IsClearableFreeBuilding`), `ai_chillDestination` false, `artificialForMeditationPurposes` false, `wakeDormantPawnsOnConstruction` false. The vanilla spots do carry `sowTag` SupportPlantsOnly; the research note was wrong.
|
|
||||||
- Bed search order: `RestUtility.Reset` builds the best-to-worst bed lists and runs before `[StaticConstructorOnStartup]`. A postfix moves our defs directly before SleepingSpot and AnimalSleepingSpot, and the patch class calls `RestUtility.Reset()` once after patching. Otherwise unowned pawns walk to any free vanilla spot first.
|
|
||||||
- A postfix on `EdificeGrid.Register` removes the sleeping-zone cell when any edifice spawns there, so no cell holds two beds. This replaces a hook on the hot virtual `Building.SpawnSetup`. The designator refuses cells with an edifice or bed and enforces the per-map cap. Building over a zone bed needs no patch: `GenConstruct.CanPlaceBlueprintOver` already allows it over non-edifices. Add a postfix only if a test fails.
|
|
||||||
- **Settings:** Global "Sleeping zones" (on); "Max sleeping-zone cells per map" (500, 50 to 2000); "Zone cells count for bedroom or barracks" (on, as vanilla spots; written to the defs' `bed_countsForBedroomOrBarracks` at startup). Per people zone: owner-type gizmo (colonists, slaves, prisoners).
|
|
||||||
- **Replaces:** Designator Shapes (1235181370, 331,361 subs), only its spot-grid use; BuilderTweaksReplica (3521096349, 7,982), drag-placing spots; Hidden Spots (3466316759, 13,238); Invisible Animal sleeping spot - Prettier Barn (2571118651, 398).
|
|
||||||
- **Effort:** L, 5 days.
|
|
||||||
- **Tests:** A 4x4 animal zone holds 16 `BlaxZones_ZoneAnimalBed`, player faction, not selectable; grass on those cells survives and the home area doesn't grow. A tamed chicken: `RestUtility.FindBedFor` returns a zone bed ahead of a free vanilla AnimalSleepingSpot; after it lies down, it owns the bed. People zone: a colonist gets a bed, and a screenshot shows an adult renders acceptably on the 1x1 bed (vanilla has 1x1 beds only for babies). Switched to slaves (Ideology): the colonist is refused, a slave accepted, and zero `MessageBedLostAssignment` appear. A prisoner zone in a walled room: `FindBedFor(prisoner, warden, Prisoner)` finds a bed. Shrinking by 4 cells removes 4 beds and clears their owners with no messages. A wall on a zone cell removes the cell and the bed. `Alert_NeedColonistBeds` clears with a large enough people zone. The test logs the time of a 500-cell drag. Phase 2: same bed count and ThingIDs, the chicken still owns its bed, no "Could not resolve reference" warnings. Phase 3: no beds, no zones, every former owner's owned bed is null, no NRE.
|
|
||||||
- **Risks:** Hundreds of Building things add to `listerBuildings` loops and room recalculations; the cell cap, `drawerType` None and `tickerType` Never limit the cost. An unowned pawn's `FindBedFor` scans past owned beds, as with many vanilla spots. Hospitality (753498552) patches `IsValidBedFor`; guests won't use player zone beds, same as vanilla spots. Other mods' bed lists will show zone beds. Odyssey gravships move only stockpile and growing zones, so ours stay behind and reconcile removes beds carried along; untested, because Odyssey isn't installed here.
|
|
||||||
|
|
||||||
#### Who may sleep here
|
|
||||||
|
|
||||||
- **Players get:** The zone tab lists animal species with checkboxes and a body-size range, so big stalls stay free of chickens. People zones can be limited to babies, children or adults, for example a nursery.
|
|
||||||
- **How:** `Zone_SleepingAnimals` gets `HashSet<ThingDef> disallowedRaces`, a deny-list so new species are allowed by default, and `FloatRange bodySize` (0 to unlimited). `Zone_SleepingPeople` gets `allowBabies`, `allowChildren`, `allowAdults` by DevelopmentalStage. A postfix on `RestUtility.CanUseBedNow(Thing bedThing, Pawn sleeper, bool checkSocialProperness, bool allowMedBedEvenIfSetToNoCare, GuestStatus? guestStatusOverride)` checks the bed type first. For a `Building_ZoneBed` whose zone rejects the sleeper it returns false. The zone comes from `zoneGrid` in O(1). This one patch covers `FindBedFor`, patients, rescue, capture, `Toils_Bed.BedNoLongerUsable`, childcare and rituals. Changing a filter unclaims owners that no longer pass, and vanilla's `FailOnBedNoLongerUsable` gets a pawn already lying there out of bed. The tab has a search field, the species list (species tamed on this map first, then all animal races) and `Widgets.FloatRange` for size.
|
|
||||||
- **Settings:** Per zone: species deny-list (empty), body size (any), age stages (all). No global setting.
|
|
||||||
- **Replaces:** Barn Stall (Continued) (2071768301, 29,299 subs), the size filter its author refused; Chicken nests Continued (3261309547, 5,719), species-only nests. The vanilla animal spot has no size limit (`bed_maxBodySize` 9999).
|
|
||||||
- **Effort:** M, 2 days.
|
|
||||||
- **Tests:** Chickens disallowed and only zone beds present: `FindBedFor(chicken)` returns null. Body size max 1.0: a muffalo (2.4) is refused, a chicken accepted. A filter change unclaims the now-refused owner. A babies-only zone refuses an adult colonist (Biotech; skip otherwise). Filters persist in phase 2.
|
|
||||||
- **Risks:** `CanUseBedNow` is hot; the postfix exits on the type check for every other bed. Ours only ever sets false, so it composes with other postfixes that set false. It runs at `Priority.Low`, after postfixes that allow a bed, such as Blax Slaves' shared infirmary, so a zone filter has the last word.
|
|
||||||
|
|
||||||
#### Medical, shared and comfort
|
|
||||||
|
|
||||||
- **Players get:** A gizmo makes a whole zone medical, so patients and injured animals are brought there. Another makes it shared: nobody keeps a cell, pawns take the nearest free one each night, and nobody gets a barracks thought. Cells in people zones give the same comfort as a vanilla sleeping spot.
|
|
||||||
- **How:**
|
- **How:**
|
||||||
- Medical: unclaim owners silently, then set `Building_Bed.Medical` on every bed through the vanilla setter.
|
- A prefix on `IncidentWorker_TraderCaravanArrival.TryExecuteWorker` sets a `[ThreadStatic] CampScope` flag, keeps the previous value in `__state`, and a finalizer restores it, even on an exception. It needs none of the 1.1 DeliveryContext machinery. The tribute collector inherits the method (IncidentWorker_CaravanArrivalTributeCollector.cs:7), so it camps there too. It exists only with Royalty: its incident def is in Royalty IncidentDefs/Incidents_Map_Special.xml:5 and it needs `Faction.OfEmpire` (:17, :29). The prefix sits on the base class, so there is no Royalty code to guard.
|
||||||
- Shared: vanilla claiming stays. Blocking `ClaimBedIfNonMedical` breaks sleep (see Cut). A MapComponent sweep every 250 ticks unclaims shared-zone beds whose owner isn't lying in them. Shared people zones use a third def, `BlaxZones_ZoneBedShared`, with `bed_countsForBedroomOrBarracks` false; flipping the toggle unclaims silently and respawns the zone's beds with the other def, so no SleptInBarracks or SleptInBedroom thought. The reviewer also offered a `CanUseBedNow` postfix that returns true for an unowned sleeper. I picked the sweep, because it never overrides a false from vanilla or another mod.
|
- A prefix on the overload `RCellFinder.TryFindRandomSpotJustOutsideColony(IntVec3 root, Map, Pawn searcher, out IntVec3, Predicate<IntVec3> extraValidator)` (RCellFinder.cs:714) runs while the flag is set and a camp zone exists. It tries standable, unfogged, unroofed cells within 6 cells of the zone that pass the caller's `extraValidator`, preferring cells outside enclosed rooms. Vanilla's validator already checks that every caravan pawn can reach the cell (IncidentWorker_TraderCaravanArrival.cs:112-125). If none passes, vanilla runs.
|
||||||
- Comfort: `PawnUtility.GainComfortFromCellIfPossible(this Pawn, int delta, bool chairsOnly)` reads only the edifice, so a non-edifice bed gives none. A postfix, gated on the 15-tick hash, `!chairsOnly` and `curDriver is JobDriver_LayDown`, calls `GainComfortFromThingIfPossible(pawn, bed, delta)`, which uses the def's Comfort 0.4.
|
- No constructor patch and no re-targeting afterwards: `LordJob_TradeWithColony` builds `LordToil_Travel` and `LordToil_DefendTraderCaravan` with the chill spot when the lord is made (LordJob_TradeWithColony.cs:28-42), so the spot must be right before that.
|
||||||
- Everything else already matches vanilla spots: rest effectiveness 0.8 (`BedRestEffectiveness` valueIfMissing), SleptOnGround -4 (given when the cost list is empty), SleptOutside outdoors. `Toils_LayDown.ApplyBedThoughts` is private and not patched. Animals have no mood need, so for them only location, ownership and medical matter.
|
- Visitor groups call the same patched overload: `IncidentWorker_VisitorGroup.CreateLordJob` calls `TryFindRandomSpotJustOutsideColony(pawns[0], out result)` (IncidentWorker_VisitorGroup.cs:22-26), which forwards to it (RCellFinder.cs:709-714). They never set the flag, so the prefix stays out; Hospitality's guests don't set it either.
|
||||||
- **Settings:** Per zone: Medical (off), Shared (off). Global: "Zone cells give sleeping-spot comfort" (on).
|
- Stand-down: if a known trading-spot mod is active, the feature stands down and logs once. Ids: `NachoToast.TradingSpot` (Trading Spot Rewritten, read from its repository's About.xml), plus [KV] Trading Spot, [GMT] Trading Spot, Trading Spot, Trade Caravan Spot and Trading Control, read from their About.xml before shipping and recorded in Compat.cs with their source, as Castes does.
|
||||||
- **Replaces:** Nothing.
|
- **Settings:** Global "Caravans may camp at zones" (on). Per zone: off.
|
||||||
- **Effort:** M, 2 days. The design said S; the shared fix adds the sweep and the def swap.
|
- **Save and removal:** `campHere` saves with the zone. A caravan already on the map keeps its chill spot after removal.
|
||||||
- **Tests:** Medical zone: `RestUtility.FindPatientBedFor` returns a zone bed for an injured colonist, an injured tamed animal goes to a medical animal zone, and no lost-assignment messages appear. Shared zone: a colonist sleeps a full night without `FailOnBedNoLongerUsable` ending the job; 250 ticks after waking, `ownership.OwnedBed` is null; no SleptInBarracks thought in a room of shared cells. Comfort rises over 2500 ticks in a zone bed and stays flat on bare ground. SleptOnGround is present after waking. Toggles persist in phase 2.
|
- **Replaces:** [KV] Trading Spot (1180719658, 125,658 subs, last version 1.3) and [GMT] Trading Spot (2874517333, 117,554, last 1.5), both dead; Trading Spot (3507108484, 44,236), 1.6 only; Trade Caravan Spot (3733234194, 2,770), 1.6 only; the trade-marker half of Trading Control (2007107588, 111,091). Trading Spot Rewritten (3780903689, 2,223) has had a 1.7 build since 2026-10-15 and re-targets the chill spot after the lord is made, so Zones stands down for it.
|
||||||
- **Risks:** `GainComfortFromCellIfPossible` is called from about 20 job drivers, hence the gate; a signature change breaks only this patch class. A medical prisoner zone still needs a prison cell, as in vanilla. A shared pawn owns its cell while asleep, so bed lists show it as claimed overnight.
|
- **Effort:** S, half a day.
|
||||||
|
- **Tests:** Caravan arrival with a camp zone: the lord's chill spot is within 6 cells of the zone. A walled-off zone keeps the vanilla spot. Without the option, the vanilla spot. A visitor group ignores the zone; with Hospitality in `-Compat`, its guests do too. An exception thrown inside `TryExecuteWorker` (test hook) leaves `CampScope` unset. With `NachoToast.TradingSpot` in `SimulatedActive`, camping stands down and logs once. With Royalty, a forced tribute collector arrival camps within 6 cells of the zone; skipped without.
|
||||||
|
- **Risks:** Traders still wander within the defend radius of 28 (LordToil_DefendPoint.cs:25). A zone deep inside the base brings visitors inside, which is the player's choice.
|
||||||
|
|
||||||
#### Visible zone state
|
#### Headless tests in 1.0
|
||||||
|
|
||||||
- **Players get:** The zone tint shows its type: colonist, slave, prisoner and medical zones each get their own color. The inspect pane shows the owner type, claimed and free cells, and a warning when a prisoner zone isn't in a prison cell.
|
- **Harness:** copy Castes' Tests/BlaxCastesTests to Tests/BlaxZonesTests. Command-line switch `-blaxzonestests`, data folder `%TEMP%\BlaxZonesTest`, results file `BlaxZonesTestResults.txt`. Keep from Castes' run-tests.ps1: the RimWorld path guard, the lock file and the junction check, `-AllowWhileRunning`, `-NoBuild`, `-NoDlc` and `-Dlc`, and deleting the settings files every run (renamed to `Mod_BlaxZones_*`). The game runs headless (run-tests.ps1:157), so no test asserts on a screenshot; what needs eyes goes into `docs/ingame-check.md`, as in Castes. A release runs all 8 DLC combinations (see "DLC support").
|
||||||
- **How:** Vanilla shows owner type and medical by sheet color, which `drawerType` None hides. The owner-type and medical gizmos set `Zone.color` from a fixed palette. `GetInspectString` counts owners over the zone's beds and checks `IsPrisonCell` on the zone's rooms, since vanilla prisoner beds need one.
|
- **Phase 3:** after phase 2 the runner saves as `BlaxZonesTest3` (saves are plain XML in 1.7, ScribeSaver.cs:45-49), replaces `Class="BlaxZones.MapComponent_BlaxZones"` with a type that doesn't exist, loads, and runs the `phase: 3` tests. Zones' assembly stays loaded, so `Map.FillComponents` adds a fresh, empty component: phase 3 proves the vanilla side of a removed-mod save loads cleanly, not that the game runs without the code (a full removal run is in the Backlog).
|
||||||
- **Settings:** None.
|
- **Expected errors:** add `T.ExpectErrors(fragment, count)`. Both removal errors include the node's OuterXml, so the harness's "ours" check would count them as Zones errors. Phase 3 allows exactly two per map. "Could not resolve reference" warnings are counted and reported as INFO. From 1.2, `T.ExpectCurToilErrorsFor(pawns)` accepts "tried to get CurToil" errors only when they name a pawn the phase-2 run recorded as lying in a zone bed, and requires at least one per such pawn.
|
||||||
|
- **KnownForeignErrors:** the `CanUseBedNow` postfix (1.2) and the `Toils_LayDown.ApplyBedRelatedEffects` postfix (1.4) sit in many stacks. Errors that Hospitality, Prison Labor or VEF log from their own code while a test ticks would name BlaxZones frames. Add each one with its text and frame, as Castes did for Weapons Tab Reborn.
|
||||||
|
- **Compat runs:** `-Compat` adds Hospitality, Pick Up And Haul, Haul to Stack, RimFridge, Weapon Racks, Prison Labor, Prisoner Realism, Replace Stuff, VEF with VFE Core and VFE Medical, Dubs Skylights, Vanilla Events Expanded, Blax Castes, Blax Slaves, and Blax Defaults once it has code. Mods that change `TradeDropSpot` or `AllLaunchableThingsForTrade` stay out of `-Compat`, so they can't hide Zones' own path (the Castes spec review found Trade as Slave or Colonist hiding Blax Slaves' buy mode). None of the replaced mods is installed; compose with them through test-only prefixes.
|
||||||
|
- **Stand-down tests:** inject package ids into a `SimulatedActive` set, the Castes overlap-warning pattern. One per trading-spot id in Compat.cs.
|
||||||
|
- **Fixtures to add**, only those 1.0 uses; later releases list their own:
|
||||||
|
- `TestArea(w, h)` carves a deterministic area on the quick-test map: clears things, sets soil, removes roofs, unfogs, keeps away from colonists and beacons, and wraps random calls in `Rand.PushState(seed)`. Quick-test maps vary; Castes never needed this because it tests pawns, not terrain.
|
||||||
|
- `Roof(rect)`, `Wall(cell)`, `Water(cell)`, `FenceRing(rect)` with a pen marker, `PoweredBeacon(cell)`, `Stockpile(rect)`.
|
||||||
|
- `DeliveryZone(rect, filter, priority, sources)`.
|
||||||
|
- `OrbitalTrader(kind)`, `TraderCaravan()` (forced incident).
|
||||||
|
- `Animal(def, tamed)` with chicken and muffalo (body size 2.4).
|
||||||
|
- Reused from Castes: Colonist, ColonySlave, Prisoner, Baby, `Tick`, `QuietStoryteller`, `SnapshotSettings` (Fixtures.cs:68, 71, 83, 114, 197, 243, 251). ColonySlave needs Ideology and Baby Biotech; tests that use them skip without, as in Castes.
|
||||||
|
- **Across features:** the orbital transpiler logged no "unexpected call count" error.
|
||||||
|
- **Effort:** S plus S, 1 day: the copy, phase 3, `ExpectErrors` and the map fixtures, which Castes never had.
|
||||||
|
|
||||||
|
### 1.1 Quest rewards and caravan purchases (3 days)
|
||||||
|
|
||||||
|
#### Quest rewards land in the zone
|
||||||
|
|
||||||
|
- **Players get:** Item rewards from quests (Empire quests included, with Royalty) drop into a delivery zone that has rewards ticked, and the quest letter points there. Refugees, prisoners, mechs, wastepacks, ransom returns and raids never come to the zone.
|
||||||
|
- **How:**
|
||||||
|
- This feature builds the DeliveryContext from the data model, which cargo pods (1.3) reuse. A context prefix and finalizer sit on two callers:
|
||||||
|
- `QuestPart_DropPods.Notify_QuestSignalReceived` (QuestPart_DropPods.cs:124), only when `useTradeDropSpot` is true and `dropSpot` is invalid (:165, 298-303): exactly the drops vanilla sends to the trade spot. `Reward_Items` creates these (Reward_Items.cs:180).
|
||||||
|
- `QuestPart_GiveNearPawn.Notify_QuestSignalReceived` (QuestPart_GiveNearPawn.cs:107), which always uses the trade spot (:187-188).
|
||||||
|
- While the context is set, a prefix on `DropPodUtility.DropThingGroupsNear` (DropPodUtility.cs:40) takes `thingsGroups` as a ref parameter. A group qualifies when it holds no Pawn and no Wastepack and all its things pass one zone (rewards ticked, filter). The prefix plans every group's target before it drops anything, so a failure halfway can't drop a group twice; on an exception vanilla gets the original list.
|
||||||
|
- Each qualifying group goes out as its own pod: an `ActiveTransporterInfo` with the call's `openDelay` and `leaveSlag`, the forbid flag applied per thing as vanilla does (DropPodUtility.cs:64-70), dropped with `DropPodUtility.MakeDropPodAt(cell, map, info, faction)` (DropPodUtility.cs:12-16) using the call's faction, so faction pod skins survive. With `instaDrop` the group is placed directly, as vanilla does.
|
||||||
|
- The prefix then assigns a new list holding the remaining groups, so vanilla drops only those and the caller's list is never changed. It never calls `DropThingsNear`: that method passes a shared static list to this call and clears it (DropPodUtility.cs:10, 27-38).
|
||||||
|
- With `dropAllInSamePod`, a pawn and the items share one group (QuestPart_DropPods.cs:209-212), so nothing routes.
|
||||||
|
- The letter needs no patch: `QuestPart_DropPods` builds its look target after dropping, from the first dropped thing that is spawned (:219-233), and `QuestPart_GiveNearPawn` does the same (:190-197). If a refugee comes first in the list, the letter points at the refugee's pod, as in vanilla.
|
||||||
|
- Ransom (`ChoiceLetter_RansomDemand` calls `SpawnDropPod`), lent-colonist returns, edge drops and center drops never set the context.
|
||||||
|
- Unsubscribe hint: if def `DropSpotTradeShip` exists (Trade Ships Drop Spot's marker; check the def name in its files before shipping) while "Route orbital trade" and "Route quest rewards" are both on, a one-time message says the player can unsubscribe from it.
|
||||||
|
- **Settings:** Global "Route quest rewards" (on). Per zone: rewards checkbox (on).
|
||||||
|
- **Save and removal:** Nothing saved. The context lives for one call.
|
||||||
|
- **Replaces:** The quest-reward half of Trade Ships Drop Spot (206k) and Trading Control (111k).
|
||||||
|
- **Effort:** M, 2 days.
|
||||||
|
- **Tests:**
|
||||||
|
- `Quest.MakeRaw` plus a `QuestPart_DropPods` with `useTradeDropSpot = true`, things gold 50 and medicine 5, inSignal "blax.test". Call `Notify_QuestSignalReceived(new Signal("blax.test"))`. Both pods land on zone cells, split by filter, and the letter's look target lies in the zone.
|
||||||
|
- Add a refugee pawn: its pod is not in a zone, the items' pods are. A Wastepack is never routed (Biotech; skipped without). `dropAllInSamePod` routes nothing.
|
||||||
|
- The list passed in still holds every group afterwards. With `instaDrop`, items appear with no pod. A faction-skinned call keeps its faction on the pod.
|
||||||
|
- `DropThingsNear` without the context, as a raid would call it, is untouched.
|
||||||
|
- A chained part: the first part's `outSignalResult` triggers a second `QuestPart_DropPods` with `useTradeDropSpot` false; the second part's drop is not routed.
|
||||||
|
- An exception inside the context leaves `DeliveryContext.Current` null. A failure on the second group drops nothing twice.
|
||||||
|
- With `DropSpotTradeShip` simulated, the unsubscribe message appears once with both routing toggles on and never with rewards off.
|
||||||
|
- **Risks:** Mod quests that drop rewards through their own code aren't covered unless they use `QuestPart_DropPods` with `useTradeDropSpot` or `DropThingsNear` inside one of the two callers. Finalizers keep the context from leaking.
|
||||||
|
|
||||||
|
#### Caravan purchases appear in the zone
|
||||||
|
|
||||||
|
- **Players get:** Goods bought from a visiting trader caravan, or from a Hospitality guest, appear in the best matching delivery zone instead of at a pack animal's feet, and one message per trade names the zone. Roofs don't matter here, so a medicine zone inside the hospital works for caravan goods. Bought animals and people stay with the caravan, as in vanilla.
|
||||||
|
- **How:**
|
||||||
|
- `Pawn_TraderTracker.GiveSoldThingToPlayer` (Pawn_TraderTracker.cs:178-203): pawns return early (:180-188) and are never touched. Items go through exactly one `GenPlace.TryPlaceThing(Thing, IntVec3, Map, ThingPlaceMode, Action<Thing,int>, Predicate<IntVec3>, Rot4?, int)` call (GenPlace.cs:27) at :194, in Near mode at the carrier's `PositionHeld`. On success vanilla adds the item to `lord.extraForbiddenThings` (:196); on failure it logs an error and destroys the item (:199-202).
|
||||||
|
- A transpiler replaces that call with `DeliveryRouter.PlaceFromCaravan`, same signature. For each candidate zone (caravan ticked, filter, priority) it tries `GenPlace.TryPlaceThing` at the best cell in Near mode with the placement rule plus "cell is in this zone" as validator. Next it tries Near at the top zone's overflow center with no validator. Last it calls the original with the original arguments, also on any exception, so the vanilla destroy path is reached only where vanilla would reach it. Vanilla then adds the item to `extraForbiddenThings` as before.
|
||||||
|
- Hospitality guests sell through `Pawn.GiveSoldThingToPlayer`, which calls this method (Verse/Pawn.cs:4711-4714), so their goods route too. Hospitality's own prefix there only records item IDs. Routing everything that comes through this method is the simple rule; checking for a `LordJob_TradeWithColony` lord would exclude guests (cut).
|
||||||
|
- Message: a prefix on `TradeDeal.TryExecute(out bool)` (TradeDeal.cs:150) opens a `[ThreadStatic]` list, and `PlaceFromCaravan` adds each placed thing and its zone to it. A postfix sends one message naming the zone (or "N delivery zones") with look targets on the placed things; a finalizer clears the list and sends what it collected if the trade threw. Outside a trade (a mod calling `GiveSoldThingToPlayer` directly), `PlaceFromCaravan` sends one message per call. Prefix and postfix only, so the trade mods that also touch `TryExecute` compose. Vanilla selling also moves colony goods out of stockpiles instantly (Pawn_TraderTracker.cs:149-176), so goods appearing matches it. Own patch class and toggle.
|
||||||
|
- **Settings:** Global "Route caravan purchases" (on), "Message when goods arrive" (on). Per zone: caravan checkbox (on), tooltip "Trader caravans and guests".
|
||||||
|
- **Save and removal:** Nothing saved. Goods already placed stay where they are.
|
||||||
|
- **Replaces:** Nothing directly. The trading-spot mods only move the caravan; 1.0 covers them.
|
||||||
|
- **Effort:** S, half a day.
|
||||||
|
- **Tests:** Force `IncidentWorker_TraderCaravanArrival`, take the trader pawn and a non-pawn Thing from `trader.Goods`, call `GiveSoldThingToPlayer(thing, 1, negotiator)`. The item is spawned in the zone and listed in the lord's `extraForbiddenThings`. A fully roofed zone still receives it. With every zone cell holding a different item, it lands near the zone. With no zones, next to the carrier. A bought animal doesn't move. The router throws: the item lands next to the carrier, nothing is destroyed. Buying 3 stacks in one `TradeDeal.TryExecute` posts exactly 1 message that names the zone. With Hospitality (`-Compat`), a purchase from a guest lands in the zone. The transpiler logged no "unexpected call count" error.
|
||||||
|
- **Risks:** Goods appear instead of being carried; carried delivery is cut. A mod that rewrites `Pawn_TraderTracker.GiveSoldThingToPlayer` would conflict; none in the active set. Hospitality (753498552, 768,480 subs, 1.6 build) only adds a pass-through prefix on `Pawn.GiveSoldThingToPlayer` (its Source/Patches/Pawn_Patch.cs), and its records don't depend on where the item lies.
|
||||||
|
|
||||||
|
#### Headless tests in 1.1
|
||||||
|
|
||||||
|
- Fixture `QuestDropPods(things, useTradeDropSpot)` with an optional chained second part.
|
||||||
|
- `-NoDlc` and `-Dlc` runs: everything runs on the core game; only the Wastepack test needs Biotech.
|
||||||
|
|
||||||
|
### 1.2 Animal sleeping zones (6 days)
|
||||||
|
|
||||||
|
#### Animal sleeping zones
|
||||||
|
|
||||||
|
- **Players get:** A new "Animal sleeping zone" in the Zone menu. Every cell works like an animal sleeping spot, so one drag over the barn beds every chicken and duck. Shrinking or deleting the zone removes its cells. Sleeping zones don't extend the home area.
|
||||||
|
- **How:**
|
||||||
|
- Zone beds as in the data model. `Zone_SleepingBase : Zone` holds what both kinds share; `Zone_SleepingAnimals` ships now and `Zone_SleepingPeople` in 1.4. Separate types keep the designators from expanding each other's zones, since `Designator_ZoneAdd` compares the exact type. Animal zones get one fixed tint, brown at alpha 0.09.
|
||||||
|
- `AddCell` calls the base, then spawns a `Building_ZoneBed` as the data model describes. The designator refuses cells with an edifice or bed.
|
||||||
|
- Cap: `Designator_ZoneAdd_SleepingBase` overrides `DesignateMultiCell` (Designator_ZoneAdd.cs:104). When the map's sleeping-zone cells plus the dragged cells exceed the cap, it passes only the first cells of the drag up to the cap to the base and posts one message naming the cap; at the cap it adds nothing and posts the same message.
|
||||||
|
- Home area: `Zone_SleepingBase.AddCell` sets `Find.PlaySettings.autoHomeArea` to false around `base.AddCell` and restores it in a `finally`. `AutoHomeAreaMaker.Notify_ZoneCellAdded` reads that setting first (AutoHomeAreaMaker.cs:9-16, 48-58), and the base `Zone.AddCell` always calls it (Zone.cs:232). No patch: a prefix on that 10-line static method could be inlined. `expandHomeArea` false on the bed def covers the bed's own spawn (AutoHomeAreaMaker.cs:18-24).
|
||||||
|
- Spawn cost: each bed spawn runs `District.Notify_RoomShapeOrContainedBedsChanged`, which walks regions only when the map has facilities (District.cs:235-247, FacilitiesUtility.cs:19-60), and `Room.Notify_RoomShapeChanged` with its temperature, auto roof area and prison-cell work (Room.cs:686-729). If a 500-cell drag takes more than 100 ms in the harness, spawn a drag's beds 50 per tick.
|
||||||
|
- `RemoveCell` and deregistration unclaim owners first with `pawn.ownership.UnclaimBed()`, then destroy, so there is no "lost assignment" spam; the loading flag skips this during load.
|
||||||
|
- Def `BlaxZones_ZoneAnimalBed` (`bed_humanlike` false): 1x1, Standable, FloorEmplacement, no `sowTag` (so `CanOverlapZones` stays true), `building.isEdifice` false, `building.deconstructible` false, `building.bed_showSleeperBody` true, `building.expandHomeArea` false, `bringAlongOnGravship` false, `selectable` false, `drawGUIOverlay` false, `drawerType` None, `useHitPoints` false, WorkToBuild 0, Flammability 0, no cost list (no wealth), no designationCategory, `tickerType` Never, `isSaveable` false, `CompAssignableToPawn_Bed`. The uiIcon uses the vanilla AnimalSleepSpot texture. 1.4 adds the humanlike defs with the same flags.
|
||||||
|
- Why those flags:
|
||||||
|
- `deconstructible` false: they are player buildings and `deconstructible` defaults to true (BuildingProperties.cs:21, 436-449). A deconstruct drag over a barn would destroy every bed at once, since work 0 destroys immediately (Designator_Deconstruct.cs:69-76).
|
||||||
|
- `bed_showSleeperBody` true: the default false hides a humanlike sleeper's body (BuildingProperties.cs:174; PawnRenderNodeWorker_Body.cs:29-31, PawnRenderer.cs:448), and with `drawerType` None there is no blanket either, so an adult would show as a floating head. Both vanilla spots set it (Core ThingDefs_Buildings/Buildings_Furniture.xml:64, :479). It matters for the 1.4 people defs; the animal def sets it to match.
|
||||||
|
- `bringAlongOnGravship` false (ThingDef.cs:167, checked in Gravship.cs:607-634): takeoff would otherwise despawn the beds with `WillReplace` (GravshipUtility.cs:389), keep their owners and, in a save made during flight, deep-save them inside `Gravship.things` (Gravship.cs:335). That bypasses `isSaveable`, which only `Map.ExposeData` checks, and would break the save after mod removal. Landing runs on a map that already exists (WorldComponent_GravshipController.cs:529-538), so reconcile never sees carried beds. It is a core `ThingDef` field (ThingDef.cs:167), so the def loads without Odyssey.
|
||||||
|
- Copied from the vanilla spots: SurgerySuccessChanceFactor 0.7, `scatterableOnMapGen` false (needed for `IsClearableFreeBuilding`, Building.cs:64-74), `ai_chillDestination` false, `artificialForMeditationPurposes` false, `wakeDormantPawnsOnConstruction` false (Core Buildings_Furniture.xml:49-79, 459-491). Like the vanilla spots they leave `socialPropernessMatters` off. The vanilla spots carry `sowTag` SupportPlantsOnly, which is why ours can't copy it.
|
||||||
|
- Bed search order: `RestUtility.Reset` (RestUtility.cs:25-44) builds the best-to-worst bed lists, sorted by `bed_maxBodySize`, then rest effectiveness, keeping definition order on ties. It runs before `[StaticConstructorOnStartup]` (PlayDataLoader.cs:207 vs 360). A postfix moves our animal def directly before AnimalSleepingSpot (1.4 adds the people defs before SleepingSpot), and the patch class calls `RestUtility.Reset()` once after patching. Otherwise unowned animals walk to any free vanilla spot first.
|
||||||
|
- Edifices: a postfix on `EdificeGrid.Register` (EdificeGrid.cs:21-33) queues the cell when any edifice spawns on a sleeping-zone cell, so no cell holds two beds. `Building.SpawnSetup` registers the edifice before the rest of its spawn (Building.cs:113-127), so destroying our bed inside the postfix would run mid-spawn. The component handles the queue on its next tick and before saving: `RemoveCell`, then `CheckContiguous`, as vanilla does for overlap (ZoneManager.cs:97-112). This replaces a hook on the hot virtual `Building.SpawnSetup`. If the JIT inlines `Register` into a caller and the postfix stops firing there, the 250-tick sweep from the data model trims the cell instead. Vanilla already trims zone cells for walls, storage and tables, which can't overlap zones (ThingDef.cs:625-655); beds and doors can, hence the postfix.
|
||||||
|
- Building over a zone bed needs no patch: `GenConstruct.CanPlaceBlueprintOver` already allows it over non-edifices (GenConstruct.cs:676-703), and `SpawnBuildingAsPossible` won't wipe a non-edifice zone bed on load (GenSpawn.cs:196-235).
|
||||||
|
- Cutting the zone: a wall line across it removes the wall cells, and `Zone.CheckContiguous` keeps the part holding the zone's first cell and removes the rest (Zone.cs:345-397). The zone does not split in two. Removed cells lose their beds and owners silently.
|
||||||
|
- Gravship landing calls our `RemoveCell` through `GravshipPlacementUtility.ClearThingsAt` (GravshipPlacementUtility.cs:311-313); our own code handles it.
|
||||||
|
- **Settings:** Global "Sleeping zones" (on); "Max sleeping-zone cells per map" (500, 50 to 2000).
|
||||||
|
- **Save and removal:** Zones and beds save in the component, beds with their owners and flags. A plain unsubscribe drops the beds with the component and logs the warnings and CurToil errors listed in the data model; the button below avoids them.
|
||||||
|
- **Replaces:** Covers the spot-grid use of Designator Shapes (1235181370, 331,540 subs, alive on 1.7; a general shape tool, so its count says little about demand for zones); BuilderTweaksReplica (3521096349, 7,977, alive on 1.7) for drag-placing spots; Hidden Spots (3466316759, 13,301, alive on 1.7). Replaces Invisible Animal sleeping spot - Prettier Barn (2571118651, 397, up to 1.6).
|
||||||
|
- **Effort:** M plus S, 2.5 days. The S is the zone-bed safety work: the choke point, the queue and the sweep.
|
||||||
|
- **Tests:**
|
||||||
|
- Def: not an edifice, not deconstructible, flammability 0, no cost list, not selectable, `isSaveable` false, `bringAlongOnGravship` false. `Designator_Deconstruct.CanDesignateThing(zoneBed)` (Designator_Deconstruct.cs:84) is refused.
|
||||||
|
- A 4x4 animal zone holds 16 `BlaxZones_ZoneAnimalBed`, player faction; grass on those cells survives, and with auto home area on the home area doesn't grow and `Find.PlaySettings.autoHomeArea` is still true afterwards.
|
||||||
|
- A tamed chicken: `RestUtility.FindBedFor` returns a zone bed ahead of a free vanilla AnimalSleepingSpot; after it lies down, it owns the bed.
|
||||||
|
- Shrinking by 4 cells removes 4 beds and clears their owners with no messages. A wall on a zone cell removes the cell and the bed. A wall line across a 6x4 zone removes the cut-off part, its beds and owners, with no messages. A vanilla bed built on a zone cell removes that cell on the next tick; with the `Register` postfix switched off (test hook), within 250 ticks.
|
||||||
|
- Foreign destroy: `bed.Destroy()` from outside Zones respawns the bed on the next tick. Destroy a bed and save immediately: after the reload there is one bed per cell.
|
||||||
|
- Cap set to 50: a 60-cell drag adds 50 cells and posts one message naming the cap; a second drag adds nothing and posts the same message.
|
||||||
|
- A 500-cell drag fails the test above 500 ms.
|
||||||
|
- A delivery zone inside a walled-off area that also holds a sleeping zone gets no pods, although `CanReachColony` is true there.
|
||||||
|
- Phase 2: same bed count and ThingIDs, the chicken still owns its bed, no "Could not resolve reference" warnings.
|
||||||
|
- Phase 3, with a chicken asleep in a zone bed at save time: no beds, no zones, the chicken's owned bed is null, warnings only, and beyond the two expected errors per map only CurToil errors that name the chicken (`ExpectCurToilErrorsFor`), no NRE.
|
||||||
|
- If `GravshipPlacementUtility.ClearThingsAt` runs without Odyssey, call it by reflection on a zone cell: the cell and bed go, with no messages.
|
||||||
|
- **Risks:**
|
||||||
|
- Cost: hundreds of Building things add to `listerBuildings` loops and room recalculations; the cell cap, `drawerType` None and `tickerType` Never limit it. An unowned pawn's `FindBedFor` scans past owned beds, as with many vanilla spots. Other mods' bed lists will show zone beds.
|
||||||
|
- Heuristics: vanilla sleeping spots are colony buildings too, but zone beds come by the hundred. When no chill destination works, `RCellFinder.TryFindRandomSpotJustOutsideColony` falls back to random colony buildings (RCellFinder.cs:736-750); visitor groups (IncidentWorker_VisitorGroup.cs:24), waiting prisoners (JobGiver_PrisonerWaitInsteadOfEscaping.cs:22) and immediate-attack raids (RaidStrategyWorker_ImmediateAttack.cs:20) use it, so those spots drift toward a big barn. `TradeDropSpot` without a powered beacon or comms console picks random colony buildings too (DropCellFinder.cs:51-69). `JobGiver_AITrashBuildingsDistant` draws 75 random colony buildings (JobGiver_AITrashBuildingsDistant.cs:28-46) and zone beds never qualify (`IsClearableFreeBuilding`, TrashUtility.cs:64), so raiders trash a little less. The cell cap bounds all three; they aren't tested, because each is random by design. The reach rule keeps them out of Zones' own routing.
|
||||||
|
- Overflow pods may land on sleeping-zone cells, as on vanilla spots, because zone beds are clearable free buildings; a bed the pod wipes respawns through the choke point.
|
||||||
|
- Odyssey gravships move only stockpile and growing zones (Gravship.cs:396-440), so ours stay behind; untested, because Odyssey isn't installed on the test machine.
|
||||||
|
- Dubs Mint Minimap (1662119905, 655,557 subs): draws edifices only, so zone beds don't show. Delivery zones don't either; zones aren't drawn.
|
||||||
|
|
||||||
|
#### Which animals may sleep here
|
||||||
|
|
||||||
|
- **Players get:** The animal zone tab lists species with checkboxes and a body-size range, so big stalls stay free of chickens. The inspect pane warns when the filter leaves out every tamed animal on the map.
|
||||||
|
- **How:**
|
||||||
|
- `Zone_SleepingAnimals` gets `HashSet<string> disallowedRaces`, a deny-list of race defNames resolved with `GetNamedSilentFail`, so new species are allowed by default and a removed animal mod leaves nothing unresolved. Plus `FloatRange bodySize` (0 to unlimited).
|
||||||
|
- A postfix on `RestUtility.CanUseBedNow(Thing bedThing, Pawn sleeper, bool checkSocialProperness, bool allowMedBedEvenIfSetToNoCare, GuestStatus? guestStatusOverride)` (RestUtility.cs:72) at `Priority.Low` checks the bed type first. For a `Building_ZoneBed` whose zone rejects the sleeper it sets false. The zone comes from `zoneGrid` in O(1). This one patch covers `FindBedFor` (RestUtility.cs:235), `FindPatientBedFor` (:328), rescue, capture, `Toils_Bed.BedNoLongerUsable` and `FailOnBedNoLongerUsable` (Toils_Bed.cs:58-96), childcare and rituals. 1.5 adds the caste check to the same postfix.
|
||||||
|
- Changing a filter, or pasting settings onto a zone, unclaims the owners that no longer pass, with one message naming the count. Vanilla's `FailOnBedNoLongerUsable` gets an animal already lying there out of bed.
|
||||||
|
- The tab has a search field, the species list (species tamed on this map first, then all animal races) and `Widgets.FloatRange` for size.
|
||||||
|
- **Settings:** Per animal zone: species deny-list (empty), body size (any). No global setting.
|
||||||
|
- **Save and removal:** Filters save with the zone in the component. A species whose mod is gone stays in the list and comes back with the mod.
|
||||||
|
- **Replaces:** Barn Stall (Continued) (2071768301, 29,391 subs, alive on 1.7): covers its size filter, which its author refused; Chicken nests Continued (3261309547, 5,715, up to 1.6), species-only nests. The vanilla animal spot has no size limit (`bed_maxBodySize` 9999, BuildingProperties.cs:178).
|
||||||
|
- **Effort:** M, 2 days.
|
||||||
|
- **Tests:** Chickens disallowed and only zone beds present: `FindBedFor(chicken)` returns null. Body size max 1.0: a muffalo (2.4) is refused, a chicken accepted. A filter change unclaims the now-refused owner, with one message naming the count. With every tamed species disallowed, the inspect string carries the warning. A species defName that doesn't resolve stays stored. Filters persist in phase 2.
|
||||||
|
- **Risks:** `CanUseBedNow` is hot; the postfix exits on the type check for every other bed. Ours only ever sets false, so it composes with other postfixes that set false. At `Priority.Low` it runs after postfixes that allow a bed, such as Blax Slaves' shared infirmary, so a zone filter has the last word.
|
||||||
|
|
||||||
|
#### Remove Blax Zones from a game
|
||||||
|
|
||||||
|
- **Players get:** Click "Remove Blax Zones from this game" in the mod settings, save, then disable the mod, and the save loads with no errors and no warnings from Zones. Without the button the save still loads, with the warnings and errors listed in the data model.
|
||||||
|
- **How:**
|
||||||
|
- Needs a loaded game and a confirmation dialog that names the counts (zones, zone beds; from 1.3 flagged storage).
|
||||||
|
- On every map: unclaim owners of zone beds silently, end every job whose target is a zone bed (`jobs.EndCurrentJob(JobCondition.InterruptForced)`), destroy the beds with the choke point told that Zones started it, deregister our zones, then remove the component from `map.components`.
|
||||||
|
- Set the removal flag from the data model; the `Map.FillComponents` postfix keeps the component off every map of this game from then on.
|
||||||
|
- It ends with the message "Save now, then disable the mod". A dev debug action does the same.
|
||||||
|
- **Settings:** The button, enabled only while a game is loaded. No toggle.
|
||||||
|
- **Save and removal:** This is the removal.
|
||||||
- **Replaces:** Nothing.
|
- **Replaces:** Nothing.
|
||||||
- **Effort:** S, half a day.
|
- **Effort:** S, half a day.
|
||||||
- **Tests:** Switching a zone to prisoners changes its color. After 3 chickens sleep in a 16-cell zone, the inspect string says 3 claimed, 13 free. An outdoor prisoner zone shows the warning.
|
- **Tests:**
|
||||||
- **Risks:** Two colonist zones share a color; the zone label tells them apart.
|
- The confirm names the counts.
|
||||||
|
- Press the button with a chicken asleep in a zone bed, save, then save again (an autosave counts): neither file contains "BlaxZones", and `map.components` has no `MapComponent_BlaxZones` after either save.
|
||||||
|
- A map generated afterwards in the same game has no component, and a test-only MapComponent added after ours in the type list still had its `FinalizeInit` called.
|
||||||
|
- An orbital purchase and a caravan arrival behave like vanilla, log no error and don't bring the component back.
|
||||||
|
- Load the saved file (Zones' assembly is still loaded, so `FillComponents` adds a fresh, empty component for the new game): no errors, no "Could not resolve reference" warnings, and the chicken has no owned bed and no CurToil error.
|
||||||
|
- **Risks:** A mod that caches our component across saves would hold a dead object; none known.
|
||||||
|
|
||||||
### 1.3 Stockpiles, shelves, roofs and selling (5 days)
|
#### Headless tests in 1.2
|
||||||
|
|
||||||
|
- Fixture `SleepingZone(rect, kind)`; 1.4 adds the owner type.
|
||||||
|
- Performance in `-Compat`: time 2500 ticks with and without 500 animal zone beds, median of three runs each, written to the results file. The test fails when the zone beds add more than 10%.
|
||||||
|
- KnownForeignErrors: add any foreign error found in these runs.
|
||||||
|
- Effort: S, half a day for the performance and compat runs.
|
||||||
|
|
||||||
|
### 1.3 Stockpiles, shelves, roofs and selling (6 days)
|
||||||
|
|
||||||
Stockpile deliveries and direct delivery ship together: most freezers and hospital shelves are roofed, so the flag alone does little for orbital goods.
|
Stockpile deliveries and direct delivery ship together: most freezers and hospital shelves are roofed, so the flag alone does little for orbital goods.
|
||||||
|
|
||||||
#### Stockpiles and shelves receive deliveries
|
#### Stockpiles and shelves receive deliveries
|
||||||
|
|
||||||
- **Players get:** A "Receive deliveries" gizmo on any stockpile or shelf lets bought goods and rewards go straight into it, by its own filter and priority: medicine onto the hospital shelves, food into the freezer, no hauling. Delivery zones and flagged storage compete by priority.
|
- **Players get:** A "Receive deliveries" gizmo on any stockpile, shelf, rack or fridge lets bought goods and rewards go straight into it, by its own filter and priority: medicine onto the hospital shelves, food into the freezer, no hauling. Delivery zones and flagged storage compete by priority.
|
||||||
- **How:** Flags live in `MapComponent_BlaxZones` as a `HashSet<int>` of stockpile zone IDs and a set of shelf ThingIDs, never as fields on `Zone_Stockpile` or `Building_Storage`, so removing the mod stays safe. Gizmos come from postfixes on `Zone_Stockpile.GetGizmos` and `Building_Storage.GetGizmos`. The router adds flagged storage as candidates, with accept from `StorageSettings.AllowedToAccept(thing)` and priority from `StorageSettings.Priority`; shelf cells come from `AllSlotCells()`. Pods use only stockpile cells that pass the pod rule. Shelves are roofed edifices, so they get orbital goods only with direct delivery. Caravan placement and direct delivery use any cell that passes the placement rule. Cells holding a different item or a full stack are skipped. A deleted stockpile or shelf drops its ID on the next lookup. The gizmo tooltip says roofed targets need direct delivery for orbital goods and rewards.
|
- **How:**
|
||||||
- **Settings:** Global "Stockpiles and shelves may receive deliveries" (on). Per stockpile and shelf: gizmo (off).
|
- Flags live in `MapComponent_BlaxZones` as a `HashSet<int>` of stockpile zone IDs and a `HashSet<int>` of storage building ThingIDs, never as fields on `Zone_Stockpile` or `Building_Storage`. Zone IDs and ThingIDs are never reused, so a stale flag can't land on a new storage.
|
||||||
- **Replaces:** [DHM] Organized Trade Pod System (3490887589, 1,818 subs), Skipdoor Delivery idea for trade goods (3233578663, 2,747).
|
- Gizmos come from postfixes on `Zone_Stockpile.GetGizmos` (Zone_Stockpile.cs:75) and `Building_Storage.GetGizmos` (Building_Storage.cs:227). RimFridge's and Weapon Racks' storage buildings call the base, so they get the gizmo.
|
||||||
- **Effort:** M, 2 days.
|
- Storage groups: shelves can be linked into a group (Building_Storage.cs:13), whose settings every member reads through `GetStoreSettings()` (Building_Storage.cs:100-107). Group membership changes through vanilla's link gizmos (Building_Storage.cs:241-244) without calling Zones. So a storage building counts as flagged when it or any member of its `StorageGroup` is flagged, and the gizmo on a grouped building sets or clears the flag on every member. A shelf linked into a flagged group later is flagged through the group. A shelf leaving a group keeps its own flag, as vanilla copies the group's settings onto it (StorageGroupUtility.cs:163-184); one that joined after the flag was set has none of its own and leaves unflagged.
|
||||||
- **Tests:** An unroofed flagged food stockpile at Important plus a general delivery zone at Normal: bought rice lands in the stockpile, steel in the zone. A flagged medicine shelf in a roofed hospital with direct delivery on: orbital medicine appears on the shelf. Caravan rice goes into a roofed flagged freezer. Flags survive reload. A deleted stockpile is no longer a target. Phase 3 loads with no errors from the flag sets.
|
- The router adds flagged storage as candidates, with accept from `StorageSettings.AllowedToAccept(thing)` and priority from `StorageSettings.Priority`, both through `GetStoreSettings()`; building cells come from `AllSlotCells()`. Storage targets use the storage rule from the data model and fill mergeable stacks first.
|
||||||
- **Risks:** Without direct delivery, roofed freezers and shelves get only caravan goods; the tooltip says so.
|
- Pods use only stockpile cells that pass the pod rule. Shelves are edifices, so they get orbital goods only with direct delivery. Caravan placement and direct delivery put the thing on a storage cell with `GenPlace.TryPlaceThing(thing, cell, map, ThingPlaceMode.Direct)` and try the next cell on failure.
|
||||||
|
- A deleted stockpile or storage building drops its ID on the next lookup. The gizmo tooltip says roofed targets need direct delivery for orbital goods and rewards.
|
||||||
|
- **Settings:** Global "Stockpiles and shelves may receive deliveries" (on). Per stockpile and storage building: gizmo (off).
|
||||||
|
- **Save and removal:** The flag sets save in the component. Without the mod they vanish with the component node; the stockpiles and shelves keep their own settings.
|
||||||
|
- **Replaces:** [DHM]Organized Trade Pod System (3490887589, 1,816 subs, no 1.7), Skipdoor Delivery (3233578663, 2,749, no 1.7) for trade goods.
|
||||||
|
- **Effort:** M plus S, 2.5 days. The S is the storage rule and storage groups.
|
||||||
|
- **Tests:** An unroofed flagged food stockpile at Important plus a general delivery zone at Normal: bought rice lands in the stockpile, steel in the zone. A flagged medicine shelf in a roofed hospital with direct delivery on: orbital medicine appears on the shelf. A vanilla shelf cell (PassThroughOnly) receives a direct delivery. Caravan rice goes into a roofed flagged freezer. A linked shelf group: flagging one shelf flags every member, and priority and filter come from the group. A new shelf linked into the flagged group receives a delivery; unlinked again, it doesn't. A shelf that was in the group when it was flagged keeps receiving after it is unlinked. Storage targets fill mergeable stacks before empty cells. Flags survive reload. A deleted stockpile is no longer a target. Phase 3 loads with no errors from the flag sets. `-Compat`: a RimFridge fridge (PassThroughOnly) and a RimFridge wall fridge (Impassable) each receive a delivery; a Weapon Racks rack holds no more than its items per cell.
|
||||||
|
- **Risks:** Without direct delivery, roofed freezers and shelves get only caravan goods; the tooltip says so. Overlapping mods:
|
||||||
|
- RimFridge: Now with Shelves! (2898411376, 282,094 subs, 1.6 build): `RimFridge_Building` is a `Building_Storage` (its Source/RimFridge_Building.cs:11) with its own items-per-cell setting, which the storage rule reads through `GetMaxItemsAllowedInCell`. Its fridges are PassThroughOnly and its wall fridge Impassable (its 1.6 Defs/ThingDefs_Buildings/Fridge_Base.xml:25, WallFridge_Building.xml:6), so neither is standable and both need the storage rule.
|
||||||
|
- Weapon Racks (2788630748, 57,447 subs, 1.7): `Building_WeaponStorage` holds 1 to 4 items per cell (its 1.7/Defs/ThingDefs/ThingDefs_Buildings.xml); the storage rule respects that. Bought weapons can land on a flagged rack.
|
||||||
|
- Haul to Stack (949498803, 77,412 subs, 1.6 build) makes haulers fill stacks first; storage targets use the same order.
|
||||||
|
- Vanilla Furniture Expanded's storage furniture is `Building_Storage`, so it is covered.
|
||||||
|
|
||||||
#### Delivery under a roof
|
#### Delivery under a roof
|
||||||
|
|
||||||
- **Players get:** An option "No drop pods, goods appear here" on delivery zones, flagged stockpiles and flagged shelves. Roofed warehouses and rooms then receive orbital goods and rewards. Off by default.
|
- **Players get:** An option "No drop pods, goods appear here" on delivery zones, flagged stockpiles and flagged storage buildings. Roofed warehouses and rooms then receive orbital goods and rewards. Off by default.
|
||||||
- **How:** For targets with direct delivery, orbital and reward routing skip the pod and call `GenPlace.TryPlaceThing(thing, cell, map, Near, null, validator)` with the placement rule, roof ignored. For rewards, the `DropThingGroupsNear` prefix takes the group out of the list and places it. A dust fleck marks the arrival. The stockpile and shelf flags sit in the MapComponent next to the receive flags. No roof punching: `Skyfaller.HitRoof` collapses 3x3.
|
- **How:** For targets with direct delivery, orbital and reward routing skip the pod. Delivery zones use `GenPlace.TryPlaceThing(thing, cell, map, Near, null, validator)` with the placement rule, roof ignored; storage targets use Direct mode with the storage rule. For rewards, the `DropThingGroupsNear` prefix takes the group out of the list and places it, applying the call's forbid flag. A dust fleck marks the arrival. The stockpile and storage flags sit in the MapComponent next to the receive flags, and follow storage groups the same way. No roof punching: `Skyfaller.HitRoof` collapses a 3x3 roof (Skyfaller.cs:399-435).
|
||||||
- **Settings:** Global "Allow direct delivery" (on, makes the per-target option available). Per zone, stockpile and shelf: off.
|
- **Settings:** Global "Allow direct delivery" (on, makes the per-target option available). Per zone, stockpile and storage building: off.
|
||||||
|
- **Save and removal:** The flags save in the component and vanish with it.
|
||||||
- **Replaces:** Nothing.
|
- **Replaces:** Nothing.
|
||||||
- **Effort:** S, half a day.
|
- **Effort:** S, half a day.
|
||||||
- **Tests:** In a fully roofed zone with the option on, orbital steel spawns on a zone cell the same tick with no pod. Without the option, it falls back. A quest reward goes to a roofed direct zone.
|
- **Tests:** In a fully roofed zone with the option on, orbital steel spawns on a zone cell the same tick with no pod. Without the option, it falls back. A quest reward goes to a roofed direct zone, forbid flag kept.
|
||||||
- **Risks:** Immersion only. Goods arrive either way, so balance is neutral.
|
- **Risks:** Immersion only. Goods arrive either way, so balance is neutral. Dubs Skylights (833899765, 272,595 subs, 1.7): skylights sit in roofed cells, so pods can't land under them; the red overlay shows those cells and direct delivery covers them.
|
||||||
|
|
||||||
#### Sell zone
|
#### Sell zone
|
||||||
|
|
||||||
- **Players get:** A gizmo "Orbital traders can buy from here" on stockpiles and shelves. While at least one powered trade beacon stands on the map, orbital traders see everything in flagged storage and can take payment silver from it, so goods don't have to be hauled to the beacon. Off by default for balance.
|
- **Players get:** A gizmo "Orbital traders can buy from here" on stockpiles and storage buildings. While at least one powered trade beacon stands on the map, orbital traders see every item in flagged storage and can take payment silver from it, so goods don't have to be hauled to the beacon. The shelves themselves are never for sale. Off by default for balance.
|
||||||
- **How:** Flags (zone IDs and shelf ThingIDs) in the MapComponent. A postfix on `TradeUtility.AllLaunchableThingsForTrade(Map, ITrader)` wraps the result and appends things on flagged cells that pass `TradeUtility.PlayerSellableNow`, only when `Building_OrbitalTradeBeacon.AllPowered(map)` is not empty. It skips pawns and things already in the list. A prefix on `TradeUtility.LaunchThingsOfType(ThingDef, ref int debt, Map, TradeShip)` pays from flagged cells first, the way vanilla pays from beacon cells, lowers `debt`, and lets vanilla pay the rest. Pawns are never offered, so prisoner and slave sales stay with vanilla and Blax Slaves.
|
- **How:**
|
||||||
- **Settings:** Global "Sell zones" (off). Per stockpile and shelf: off.
|
- Flags (zone IDs and storage ThingIDs) in the MapComponent, with the storage-group rule from "Stockpiles and shelves receive deliveries".
|
||||||
- **Replaces:** Map Wide Orbital Trade Beacon (1839069104, 50,596 subs), Wall-Mounted Orbital Trade Beacon (15.9k), Trade Beacon Shapes, Adjustable Trade Beacon Radius.
|
- A postfix on `TradeUtility.AllLaunchableThingsForTrade(Map, ITrader)` (TradeUtility.cs:84, an iterator) at `Priority.Last` wraps the result. It yields everything, keeping a HashSet, then appends things on flagged cells whose `def.category` is `Item` and that pass `TradeUtility.PlayerSellableNow` (TradeUtility.cs:43) and aren't in the set. Only when `Building_OrbitalTradeBeacon.AllPowered(map)` is not empty. RimFridge's "fridges act as beacons" postfix appends without deduping (its 1.6 Source/HarmonyPatches.cs, `LaunchItemsFromFridges`), hence the late priority and the full set.
|
||||||
- **Effort:** M, 2 days. The reviewer said S to M; I took M, because two trade methods change.
|
- Items only, as vanilla takes only `ThingCategory.Item` from beacon cells (TradeUtility.cs:134). `EverPlayerSellable` accepts minifiable buildings (TradeUtility.cs:32-39), vanilla shelves are minifiable and tradeable, so without the category check a flagged shelf or fridge, or a lamp standing on a flagged stockpile, would be offered, and selling it removes it from the map (TradeShip.cs:179-197). Pawns fail the check too, so prisoner and slave sales stay with vanilla and Blax Slaves. Bookcases and outfit stands aren't `Building_Storage` and get no gizmo.
|
||||||
- **Tests:** A flagged stockpile far from the beacon holds 100 steel. With a powered beacon the trade dialog lists the steel; with the beacon off it doesn't. Selling it removes it from the stockpile. Buying with silver that sits only in a flagged stockpile pays from it. A prisoner standing in a flagged stockpile isn't offered.
|
- The trade dialog lists and pays from what `TradeShip.ColonyThingsWillingToBuy` collects through that method (TradeShip.cs:89-100; Tradeable.cs:463-471), so the postfix alone lets trades sell from and pay with flagged storage.
|
||||||
- **Risks:** Beacon mods also patch `AllLaunchableThingsForTrade`; our wrapper skips things already in the list, so running Map Wide Orbital Trade Beacon alongside doesn't list items twice. It removes hauling to the beacon, hence off by default.
|
- `TradeUtility.LaunchThingsOfType(ThingDef resDef, int debt, Map map, TradeShip trader)` (TradeUtility.cs:185-222) searches beacon cells only. Its only vanilla callers are the ransom fee through `LaunchSilver` (:225) and the AI core information request (FactionDialogMaker.cs:196), and both check affordability through `AllLaunchableThingsForTrade`. A prefix with `ref int debt` (Harmony lets a prefix change a plain argument) pays from flagged cells first, the way vanilla pays from beacon cells, lowers `debt`, and lets vanilla pay the rest. Without it vanilla logs "Could not find any Silver" and underpays (:207-211).
|
||||||
|
- **Settings:** Global "Sell zones" (off). Per stockpile and storage building: off.
|
||||||
|
- **Save and removal:** The flags save in the component and vanish with it; trade goes back to beacon range.
|
||||||
|
- **Replaces:** Covers the use of Map Wide Orbital Trade Beacon (1839069104, 50,625 subs, alive on 1.7), Wall-Mounted Orbital Trade Beacon (3553078564, 15,875, alive on 1.7), Trade Beacon Shapes (3533891331, 610, a drawing shape for placing beacons; a weak overlap) and [DHM]Adjustable Trade Beacon Range (3823054506, 27).
|
||||||
|
- **Effort:** M, 2 days. Two trade methods change.
|
||||||
|
- **Tests:** A flagged stockpile far from the beacon holds 100 steel. With a powered beacon the trade dialog lists the steel; with the beacon off it doesn't. Selling it removes it from the stockpile. Buying with silver that sits only in a flagged stockpile pays from it. A ransom fee paid from flagged silver logs no error and takes the full amount. A flagged shelf and a standing lamp on a flagged stockpile never show up in `ColonyThingsWillingToBuy`. A prisoner standing in a flagged stockpile isn't offered. `-Compat`: with RimFridge's beacon setting on and a fridge also flagged as a sell zone, the dialog lists each item once.
|
||||||
|
- **Risks:** Beacon mods also patch `AllLaunchableThingsForTrade`; our wrapper skips things already in the list, so running Map Wide Orbital Trade Beacon alongside doesn't list items twice. It removes hauling to the beacon, hence off by default. [RH2] Rimdeed (2411722784, 83,107 subs, 1.6 build) reads `AllLaunchableThingsForTrade`, so sell-zone silver may pay its fees, which is harmless.
|
||||||
|
|
||||||
#### Cargo pod events land in the zone
|
#### Cargo pod events land in the zone
|
||||||
|
|
||||||
- **Players get:** Optional: random cargo pod events drop their goods into a delivery zone that has "Cargo pods" ticked.
|
- **Players get:** Optional: random cargo pod events drop their goods into a delivery zone that has "Cargo pods" ticked, and the letter points there.
|
||||||
- **How:** A DeliveryContext prefix and finalizer on `IncidentWorker_ResourcePodCrash.TryExecuteWorker` with source CargoPod. The `DropThingGroupsNear` prefix from rewards routes the groups and keeps the call's forbid (default true) and `leaveSlag` (true).
|
- **How:** A DeliveryContext prefix and finalizer on `IncidentWorker_ResourcePodCrash.TryExecuteWorker` (IncidentWorker_ResourcePodCrash.cs:8-16) with source CargoPod. While it is set, a prefix on `DropCellFinder.RandomDropSpot(Map, bool)` (DropCellFinder.cs:16) returns the top cargo-pod zone's overflow center, so the drop center and the letter target (IncidentWorker_ResourcePodCrash.cs:12-14) both point at the zone; with no such zone vanilla runs. The `DropThingGroupsNear` prefix from rewards routes the groups and keeps the call's forbid (default true) and `leaveSlag` (true, :13).
|
||||||
- **Settings:** Global "Route cargo pod events" (off). Per zone: "Cargo pods" (off).
|
- **Settings:** Global "Route cargo pod events" (off). Per zone: "Cargo pods" (off).
|
||||||
- **Replaces:** Resource Drop Pod Redirection (2944180046, 1,986 subs).
|
- **Save and removal:** The per-zone flag saves with the zone.
|
||||||
|
- **Replaces:** Resource Drop Pod Redirection (2944180046, 1,984 subs, no 1.7).
|
||||||
- **Effort:** S, half a day.
|
- **Effort:** S, half a day.
|
||||||
- **Tests:** The incident with the toggle on puts forbidden pods in the zone. With the toggle off, vanilla.
|
- **Tests:** The incident with the toggle on puts forbidden pods in the zone, and the letter's target is a zone cell. With the toggle off, vanilla. Vanilla Events Expanded's ApparelPod and WeaponPod events (`-Compat`) stay vanilla.
|
||||||
- **Risks:** It takes the surprise out of cargo pods, hence off by default.
|
- **Risks:** It takes the surprise out of cargo pods, hence off by default. Vanilla Events Expanded (1938420742, 836,672 subs, 1.7) drops apparel and weapon pods through `DropThingsNear` without our context; adding them is in the Backlog.
|
||||||
|
|
||||||
### 1.4 Caste filter (1 day)
|
#### Headless tests in 1.3
|
||||||
|
|
||||||
Ships once Blax Castes 1.3 publishes `CastesApi`.
|
- Fixtures: `Shelf(cell)`, `LinkShelves(a, b)`, `UnlinkShelf(a)`, a roofed `Stockpile(rect)`.
|
||||||
|
- Phase 2: every flag set survives. Phase 3: the flags vanish with no errors.
|
||||||
|
- `-Compat` adds the RimFridge, Weapon Racks and Vanilla Events Expanded tests above; RimFridge's beacon setting is switched on through its settings for the dedupe test.
|
||||||
|
|
||||||
|
### 1.4 People sleeping zones (6 days)
|
||||||
|
|
||||||
|
#### Sleeping zones for colonists, slaves and prisoners
|
||||||
|
|
||||||
|
- **Players get:** A new "Sleeping zone" for people. Colonists claim cells in a dorm zone. A gizmo switches the zone between colonists, slaves and prisoners, as on a bed; without Ideology "Slaves" shows disabled with "Needs Ideology". A prisoner zone can't be dragged into a closed room that holds colonist or slave beds, and switching a zone to prisoners asks first and names the vanilla beds in its rooms that become prisoner beds.
|
||||||
|
- **How:**
|
||||||
|
- `Zone_SleepingPeople : Zone_SleepingBase` with an owner type (Colonist by default), the same `AddCell`, cap and home-area handling as animal zones.
|
||||||
|
- Defs `BlaxZones_ZoneBed` (`bed_humanlike` true, Comfort 0.4) with the animal def's flags, uiIcon from the vanilla SleepSpot texture. `bed_showSleeperBody` true keeps an adult's body drawn on the 1x1 bed (vanilla has 1x1 beds only for babies, Biotech Buildings_Furniture.xml:165-177). `bed_maxBodySize` stays 9999, so `ForHumanBabies` is false and the owner-type setters work (Building_Bed.cs:52, 80-90, 100).
|
||||||
|
- The bed search order postfix also moves `BlaxZones_ZoneBed` directly before SleepingSpot.
|
||||||
|
- Owner-type change: unclaim owners silently, set `ForOwnerType` on every bed with the bypass flag set, then call `District.Notify_RoomShapeOrContainedBedsChanged` and `Room.Notify_RoomShapeChanged` once for each distinct district and room of the zone's beds, as vanilla's `SetBedOwnerTypeByInterface` does (Building_Bed.cs:395-473). The setter only marks the room's stats dirty (Building_Bed.cs:92-108, Room.cs:673-676), so without that call a prisoner zone never becomes a prison cell and `CanUseBedNow` fails on `ForPrisoners && !IsInPrisonCell` (RestUtility.cs:121-124). The slave option is enabled only while `ModsConfig.IdeologyActive`, otherwise it shows disabled with "Needs Ideology". The setter's own `ModLister.CheckIdeology("Slavery")` (Building_Bed.cs:100) checks that Ideology is installed, not active (ModLister.cs:283-287, 361-364), so it isn't the guard.
|
||||||
|
- Slave zones without Ideology, from a save made with it: the zone keeps Slave, as vanilla slave beds do (Building_Bed.cs:319). Beds spawned for it by reconcile or a drag get the type through `AccessTools.FieldRefAccess<Building_Bed, BedOwnerType>("forOwnerType")` while Ideology is inactive, because the setter refuses Slave and logs an error where Ideology isn't installed (ModLister.cs:347-353). On an unspawned bed that field is all the setter would write. The gizmo still switches the zone to colonists or prisoners.
|
||||||
|
- Vanilla beds in a prisoner zone's rooms: when a room that can be a prison cell (`Building_Bed.RoomCanBePrisonCell`, Building_Bed.cs:333-340) gets a prisoner bed, `Room.Notify_RoomShapeChanged` marks it a prison cell (Room.cs:704-715) and sets `ForPrisoners` on every bed in it (Room.cs:721-727). Each zone bed spawn triggers that (Building_Bed.cs:277-282), and so does the owner-type change. The vanilla beds' setter unclaims their owners with one message each (Building_Bed.cs:61, 738-751). So:
|
||||||
|
- Switching a zone to prisoners first collects, in the zone's rooms that can be prison cells, the vanilla beds that aren't for prisoners and their humanlike owners. The confirm names the zone's own owners and those beds and owners, as vanilla's own gizmo asks before such a change (Building_Bed.cs:475-480). On confirm, Zones unclaims all of those owners silently and posts one message naming the count, then switches the zone; the room recalculation makes the vanilla beds prisoner beds, as vanilla's gizmo would.
|
||||||
|
- Expanding a prisoner zone refuses cells whose room can be a prison cell and holds a vanilla bed that isn't for prisoners, with the reason "This room has colonist or slave beds". A drag can't stop to ask.
|
||||||
|
- A wall that later closes a room around a prisoner zone and vanilla colonist beds flips them, as it would for a vanilla prisoner bed; accepted.
|
||||||
|
- A closed room that holds a prisoner zone stays a prison cell, so vanilla beds there stay prisoner beds, as in any vanilla prison cell. The zone's owner type wins until the player switches the zone.
|
||||||
|
- New zones start as colonist zones. A new colonist zone in an existing prison cell keeps Colonist through the setter prefixes, and the inspect pane warns.
|
||||||
|
- **Settings:** Per people zone: owner-type gizmo (colonists, slaves with Ideology, prisoners). Global: "Zone cells count for bedroom or barracks" (on, as vanilla spots; written to the people defs' `bed_countsForBedroomOrBarracks` at startup, tooltip "restart required").
|
||||||
|
- **Save and removal:** The owner type saves with the zone and on each bed. Removal as in 1.2.
|
||||||
|
- **Replaces:** None directly. It extends 1.2's coverage of Designator Shapes and BuilderTweaksReplica spot grids to dorms and prisons.
|
||||||
|
- **Effort:** M plus S, 2.5 days. The S is the owner-type protection and the prison-room rules.
|
||||||
|
- **Tests:**
|
||||||
|
- A colonist gets a bed in a people zone. Render inputs for the drawn body: once it lies down, `CurrentBed()` is the zone bed, its posture is `LayingInBed` and the bed's def has `bed_showSleeperBody` true. Seeing the body is a step in `docs/ingame-check.md`.
|
||||||
|
- Switched to slaves (Ideology, skipped without): the colonist is refused, a slave accepted, and zero `MessageBedLostAssignment` appear.
|
||||||
|
- Without Ideology: the gizmo's "Slaves" entry is disabled with "Needs Ideology". A zone set to Slave through the field, as a save made with Ideology holds it, keeps Slave through phase 2. A drag adds Slave beds to it while a test-only counter on `ModLister.CheckIdeology` stays at 0, and switching it to colonists gives Colonist beds.
|
||||||
|
- A prisoner zone in a walled room: the room `IsPrisonCell`, and `FindBedFor(prisoner, warden, checkSocialProperness: false)` (RestUtility.cs:235) finds a zone bed.
|
||||||
|
- A colonist zone in a room that also holds a vanilla prisoner bed keeps its owner type and posts no messages.
|
||||||
|
- The bed gizmo: a closed room with a colonist zone (one cell owned) and a vanilla colonist bed. Select the vanilla bed (the method reads `Find.Selector`) and call `SetBedOwnerTypeByInterface(Prisoner)`; if vanilla opens its confirm, accept it through the dialog's first button. The zone beds stay Colonist, the owner keeps its cell and no `MessageBedLostAssignment` appears. The reverse, on a later frame (a second call in the same frame returns early, Building_Bed.cs:397-401): a prisoner zone and a vanilla prisoner bed, `SetBedOwnerTypeByInterface(Colonist)` on the vanilla bed; the zone beds stay Prisoner.
|
||||||
|
- Expanding a prisoner zone into a closed room with an owned vanilla colonist bed refuses those cells, and the bed keeps its owner and type.
|
||||||
|
- Switching a colonist zone in that room to prisoners: the confirm names 1 vanilla bed and 1 owner; after confirming, the vanilla bed is a prisoner bed and exactly one message appears.
|
||||||
|
- `Alert_NeedColonistBeds` clears with a large enough people zone; the alert only runs in the first 30 days (Alert_NeedColonistBeds.cs:20), which a quick-test game is.
|
||||||
|
- Phase 2: owner types and owners survive.
|
||||||
|
- Phase 3, with occupied beds at save time (a colonist asleep in a zone bed, a prisoner in a prison zone bed, a doctor's tend job on a patient in a medical zone bed): no beds, no zones, every former owner's owned bed is null, warnings only, and beyond the two expected errors per map only CurToil errors that name the colonist, the prisoner or the patient, no NRE.
|
||||||
|
- **Risks:** Overlapping mods:
|
||||||
|
- Hospitality (753498552): its `IsValidBedFor` postfix lets a guest use a plain `Building_Bed` when it needs medical rest, has any naturally healing injury, or is a prisoner or slave (its Source/Patches/RestUtility_Patch.cs). So an injured guest who doesn't need medical rest may take, and through `ClaimBedIfNonMedical` (JobDriver_LayDown.cs:58) claim, a free cell in a colonist zone, as with a vanilla colonist bed. Zones doesn't refuse guests; zone beds behave like vanilla beds.
|
||||||
|
- Prisoner Realism (3760196312, 23,829 subs, 1.6 and 1.7): it adds two zones, `Zone_PrisonCommons` and `Zone_PrisonWork` (its Source/Features/Commons/Zone_PrisonCommons.cs:12, Work/Zone_PrisonWork.cs:13), and `Designator_ZoneAdd` refuses cells of another zone type (Designator_ZoneAdd.cs:72-76), so a sleeping zone can't share cells with them. Its postfix on the `Room.IsPrisonCell` getter makes commons rooms count as prison cells (its Patch_CommonsIntegration.cs:22-40). Bed spawn reads that getter (Building_Bed.cs:272-276), so a colonist zone in a commons room would turn prisoner without the setter prefixes; with them it keeps Colonist. The "colonist zone in a prison cell" warning uses Zones' own test (a room that can be a prison cell and holds a prisoner bed) instead of the getter, so commons rooms don't trigger it. Its gratitude silver drops (its Features/Recidivism/RecidivismUtility.cs:127-138) use `TradeDropSpot` with `DropThingsNear` outside any Zones context, so they land at the vanilla spot.
|
||||||
|
- Replace Stuff - Continued (3526354009, 539,387 subs, 1.7): it replaces only beds whose def is deconstructible (its NewThingFrame.cs), so it leaves zone beds alone; a real bed built on a zone cell takes the cell through the edifice postfix.
|
||||||
|
- Prison Labor (1899474310, 174,952 subs, 1.7): its `FindBedFor` postfix nulls a bed a prisoner traveler can't reach, which composes. Its candidate prefix only affects the assign dialog, which zone beds never open.
|
||||||
|
- Vanilla Furniture Expanded (1718190143, 1,119,241 subs) and its Medical module (1718191613, 933,630): their beds sort before ours in the bed search order. No conflict.
|
||||||
|
|
||||||
|
#### Medical, shared and comfort
|
||||||
|
|
||||||
|
- **Players get:** A gizmo makes a whole zone medical, so patients and injured animals are brought there; it works on people and animal zones. On people zones another gizmo makes the zone shared: nobody keeps a cell, pawns take the nearest free one each night, and the shared cells don't make the room a barracks. A zone is medical or shared, not both: while one is on, the other gizmo is greyed out with the reason. Cells in people zones give the same comfort as a vanilla sleeping spot.
|
||||||
|
- **How:**
|
||||||
|
- Medical: unclaim owners silently, then set `Building_Bed.Medical` on every bed through the vanilla setter (Building_Bed.cs:110-131).
|
||||||
|
- Shared: vanilla claiming stays. Blocking `ClaimBedIfNonMedical` breaks sleep (see Cut). The component's 250-tick sweep unclaims shared-zone beds whose owner isn't lying in them. It skips owners whose `CurJob` targets the bed: `JobDriver_LayDown` claims the bed first and walks there afterwards (JobDriver_LayDown.cs:58-59), and a pawn that arrives as a non-owner fails `CanUseBedNow` on its sleeping slot (RestUtility.cs:142-146) and gets kicked out. Shared zones use a third def, `BlaxZones_ZoneBedShared`, with `bed_countsForBedroomOrBarracks` false; flipping the toggle unclaims silently and respawns the zone's beds with the other def. I picked the sweep over a `CanUseBedNow` postfix that returns true for an unowned sleeper, because the sweep never overrides a false from vanilla or another mod.
|
||||||
|
- Comfort: `PawnUtility.GainComfortFromCellIfPossible` (PawnUtility.cs:317-327) reads only the edifice, so a non-edifice bed gives none. A postfix on the private `Toils_LayDown.ApplyBedRelatedEffects(Pawn p, Building_Bed bed, bool asleep, bool gainRest, int delta)` (Toils_LayDown.cs:91), which the LayDown toil calls every tick with the bed (:73), calls `PawnUtility.GainComfortFromThingIfPossible(p, bed, delta)` (PawnUtility.cs:329) when `bed` is a `Building_ZoneBed` with a humanlike def; that uses the def's Comfort 0.4 and checks its own 15-tick interval. The method is larger and runs only while lying down, so it is a safer target than the small, widely called `GainComfortFromCellIfPossible`.
|
||||||
|
- Everything else already matches vanilla spots: rest effectiveness 0.8 (`BedRestEffectiveness` valueIfMissing, Toils_LayDown.cs:95-96; Stats_Building_Special.xml:36), SleptOnGround -4 when the cost list is empty, SleptOutside outdoors (Toils_LayDown.cs:208-215; Thoughts_Memory_Misc.xml:84-97). `Toils_LayDown.ApplyBedThoughts` (Toils_LayDown.cs:172) is private and not patched. Animals have no mood need, so for them only location, ownership and medical matter.
|
||||||
|
- Switching medical or shared on a zone that has owners asks first and names the count.
|
||||||
|
- **Settings:** Per zone: Medical (off); per people zone: Shared (off). Global: "Zone cells give sleeping-spot comfort" (on).
|
||||||
|
- **Save and removal:** Both flags save with the zone; the medical flag also saves on each bed. Removal leaves owners without a bed, as in 1.2.
|
||||||
|
- **Replaces:** Nothing.
|
||||||
|
- **Effort:** M, 2 days.
|
||||||
|
- **Tests:** Medical zone: `RestUtility.FindPatientBedFor` returns a zone bed for an injured colonist, an injured tamed animal goes to a medical animal zone, and no lost-assignment messages appear. With Medical on, the Shared gizmo is disabled, and the reverse; animal zones show no Shared gizmo. Shared zone: a colonist sleeps a full night without `FailOnBedNoLongerUsable` ending the job; 250 ticks after waking, `ownership.OwnedBed` is null; a pawn whose LayDown job targets a shared bed it doesn't lie in yet keeps its claim through a sweep; no SleptInBarracks thought in a room with only shared cells. Comfort rises over 2500 ticks in a zone bed and stays flat on bare ground. SleptOnGround is present after waking. Toggles persist in phase 2.
|
||||||
|
- **Risks:** A signature change of `ApplyBedRelatedEffects` breaks only this patch class. A medical prisoner zone still needs a prison cell, as in vanilla. A shared pawn owns its cell while asleep, so bed lists show it as claimed overnight. If the room also holds beds that count, it is still a barracks, and a shared sleeper gets SleptInBarracks, as on a vanilla spot (Toils_LayDown.cs:217-239; RoomRoleWorker_Barracks.cs:17). Priority Treatment Ressurected (3009738919, 135,928 subs, 1.7) carries downed colonists to bed first through the vanilla bed search, so medical zones help it.
|
||||||
|
|
||||||
|
#### Visible zone state
|
||||||
|
|
||||||
|
- **Players get:** The zone tint shows its type: colonist, slave, prisoner and medical zones each get their own color, and animal zones keep theirs. The inspect pane shows the owner type, claimed and free cells, and a warning when a prisoner zone isn't in a prison cell or a colonist or slave zone sits in one.
|
||||||
|
- **How:**
|
||||||
|
- Vanilla shows owner type and medical by sheet color, which `drawerType` None hides. The owner-type and medical gizmos set `Zone.color` from a fixed palette. `Zone.Material` builds its material once and caches it in the private `materialInt` (Zone.cs:26, 86-95), so after setting the color Zones nulls `materialInt` through `AccessTools.FieldRefAccess<Zone, Material>` and marks the zone mesh dirty on every cell (`MapMeshDirty(cell, MapMeshFlagDefOf.Zone)`, as `Zone.Hidden` does, Zone.cs:70-84). Without that the tint changes only after a reload.
|
||||||
|
- `GetInspectString` counts owners over the zone's beds. The prisoner-zone warning reads `IsPrisonCell` on the zone's rooms (GridsUtility.cs:475-485), the same check `CanUseBedNow` makes. The colonist or slave warning uses Zones' own test, `Building_Bed.RoomCanBePrisonCell(room)` plus a prisoner bed in `room.ContainedBeds`, so a room another mod counts as a prison cell, such as a Prisoner Realism commons, doesn't trigger it. It also shows the filter warning from "Which animals may sleep here" and, from 1.5, the caste warnings.
|
||||||
|
- **Settings:** None.
|
||||||
|
- **Save and removal:** The color saves with the zone, like any zone color.
|
||||||
|
- **Replaces:** Nothing.
|
||||||
|
- **Effort:** S, half a day.
|
||||||
|
- **Tests:** Switching a zone to prisoners changes `zone.Material.color`, not only `zone.color`. After 3 chickens sleep in a 16-cell zone, the inspect string says 3 claimed, 13 free. An outdoor prisoner zone shows the warning. A colonist zone in a room with a vanilla prisoner bed shows the prison-cell warning.
|
||||||
|
- **Risks:** Two colonist zones share a color; the zone label tells them apart.
|
||||||
|
|
||||||
|
#### Headless tests in 1.4
|
||||||
|
|
||||||
|
- Fixture `SleepingZone(rect, kind, ownerType)`.
|
||||||
|
- Performance: the 1.2 timing again with 500 people zone beds, same 10% limit.
|
||||||
|
- Compat (`-Compat`): Replace Stuff builds a real bed blueprint on a zone cell, the cell leaves the zone and no error is logged. Prison Labor: `FindBedFor(prisoner, warden, false)` finds a prison zone bed. Hospitality: a healthy guest is refused a zone cell, a guest with a naturally healing injury who doesn't need medical rest may use a free non-medical colonist zone cell, and one that needs medical rest may use a medical zone cell. Prisoner Realism: a colonist zone spawned in a commons room keeps Colonist and shows no prison-cell warning.
|
||||||
|
- KnownForeignErrors: add any foreign error found in these runs.
|
||||||
|
- Effort: S, half a day.
|
||||||
|
|
||||||
|
### 1.5 Caste filter (2 days)
|
||||||
|
|
||||||
|
Ships once Blax Castes publishes `CastesApi` version 1, planned for Castes 1.1 in both design docs.
|
||||||
|
|
||||||
#### Sleeping zones by caste
|
#### Sleeping zones by caste
|
||||||
|
|
||||||
- **Players get:** With Blax Castes active, a people sleeping zone can be limited to castes, for example field hands in the barn dorm. Without Castes the option doesn't show.
|
- **Players get:** With Blax Castes active, a people sleeping zone can be limited to castes, for example the field hands' barn dorm or a medical zone for the Miner caste. Without Castes the option doesn't show, and limits you set stay stored for when Castes comes back.
|
||||||
- **How:** The Compat helper detects `blax.castes`, resolves `BlaxCastes.CastesApi` with `AccessTools.TypeByName`, checks `Version`, and binds `CasteIdOf(Pawn)` and `CasteLabels()` into cached delegates at startup. A missing type or method is a silent no-op. `Zone_SleepingPeople` gains `HashSet<string> allowedCasteIds` (empty means any), always scribed and ignored while unbound. The `CanUseBedNow` postfix from 1.2 checks it only while bound. A pawn whose `CasteIdOf` returns null fits only zones with no caste limit.
|
- **How:**
|
||||||
- **Settings:** Per people zone: caste list, hidden without Castes.
|
- Binding: in the `[StaticConstructorOnStartup]` patcher, only when `Compat.IsActive("blax.castes")` (`ignorePostfix: true`). `AccessTools.TypeByName("BlaxCastes.CastesApi")`, with `Bind<T>`, `ReadVersion` and `WarnOnce` copied from Blax Slaves' Siblings.cs (Siblings.cs:27, 61, 153-157). It needs Version 1 or higher and `Active`, `CasteIdOf` and `CasteLabels`, bound by exact delegate and return types; otherwise it stays unbound with one log line. A call that throws turns the link off until the next game, with one warning, the rule Castes uses for Weapons Tab Reborn. Calls run on the main thread only.
|
||||||
|
- Ids: `CasteLabels()` and `CasteIdOf(Pawn)` both return the token-prefixed id `"<token>:<id>"`, so ids picked from the list compare directly with a pawn's id.
|
||||||
|
- Data on `Zone_SleepingPeople`: `HashSet<string> allowedCasteIds` (empty means any), `bool allowNoCaste` (only used while the set isn't empty) and `Dictionary<string, string> lastLabels`, so the UI can name a caste that has gone. All three are always scribed with `LookMode.Value`, kept while unbound, and never pruned in ExposeData, PostLoadInit or FinalizeInit: `CasteLabels()` can still be empty during map `FinalizeInit` (Game.cs:611-647), because Castes seeds its starter castes in `LoadedGame`.
|
||||||
|
- The check: in the 1.2 `CanUseBedNow` postfix, after the type and zone checks. It returns early when `__result` is already false, the zone has no caste limit, or the link isn't usable (bound and `Active`, read once per tick). Otherwise it gets the sleeper's id from a one-entry cache keyed by `(thingIDNumber, TicksGame)`. `FindBedFor` asks about one sleeper for hundreds of beds in a row through its `GenClosest` validators (RestUtility.cs:235 onwards), so the cache nearly always hits. It refuses when the id is null and `allowNoCaste` is off, or when the id isn't in the set.
|
||||||
|
- Caste changes: Castes moves pawns one tick after a join and calls no other mod, so Zones polls. The 250-tick sweep also silently unclaims owners of caste-limited beds who no longer pass, while the link is usable. A pawn asleep at that moment is woken by `Toils_Bed.BedNoLongerUsable` through the same postfix (Toils_Bed.cs:58-69). A pawn with another valid bed re-claims it on its own through `FindBedFor`.
|
||||||
|
- Filter edits unclaim owners that no longer pass, with one message naming the count.
|
||||||
|
- UI: a "Castes" section in the people-zone tab, shown only while bound. One checkbox per caste from `CasteLabels()`, sorted by label to match Castes' pickers, plus "Pawns without a caste". Stored ids whose caste is gone show greyed as "Deleted caste (last label)" with a remove button. While unbound with ids stored, the inspect pane says the caste limit is inactive because Blax Castes isn't loaded. The inspect pane also warns when no current pawn of the zone's owner type fits.
|
||||||
|
- Medical zones: the limit applies to them too. It still composes with Blax Slaves' shared infirmary, because Zones runs at `Priority.Low`.
|
||||||
|
- Load order: About.xml keeps loadAfter `blax.castes` only.
|
||||||
|
- **Settings:** Per people zone: caste list (empty, any caste) and "Pawns without a caste" (off), hidden without Castes. No global setting.
|
||||||
|
- **Save and removal:** Caste ids are strings in the zone, saved in the component. Removing Castes keeps them, unused. Removing Castes and adding it back creates a new caste token, so old ids match no new caste and show as deleted castes instead of silently matching a new caste with the same number. Removing Zones drops them with the component; Castes keeps nothing for Zones.
|
||||||
- **Replaces:** Nothing.
|
- **Replaces:** Nothing.
|
||||||
- **Effort:** S, half a day, rounded up to 1 day.
|
- **Effort:** M, 2 days: the token, the cache, the sweep and the deleted-caste UI.
|
||||||
- **Tests:** With the harness loading Blax Castes: a zone limited to caste A refuses a caste B pawn and accepts a caste A pawn. Without Castes the tab hides the section, the stored ids are ignored, and they survive a save.
|
- **Tests:** Run with Castes in `-Compat`; create castes through reflection on `BlaxCastes.CasteManager`, so the test mod gets no assembly reference to Castes. Skip without Castes.
|
||||||
- **Risks:** It depends on the Castes release. An older API version means a silent no-op.
|
- Phase 1, with Castes: a zone limited to caste A refuses a caste B pawn and accepts an A pawn. Every id from `CasteLabels()` has the same token prefix as `CasteIdOf` returns. A casteless pawn is refused until "Pawns without a caste" is ticked. A bought slave queued by Castes is refused before `Tick(1)` and accepted after it. Assigning the owner to caste B unclaims its zone bed within 250 ticks, and a sleeping owner is woken. A deleted caste's id stays stored and matches nobody. With Castes' API switched off, the limits are ignored and nobody is evicted. Ids from an older token (simulate a new component) match no new caste. `GC.GetAllocatedBytesForCurrentThread` across 1,000 `CanUseBedNow` calls on a caste-limited bed stays below 1 KB. `FindBedFor` across 500 caste-limited cells fails above 10 ms.
|
||||||
|
- Phase 1, without Castes: the section is hidden, stored ids are ignored but kept.
|
||||||
|
- Phase 2: ids and `allowNoCaste` survive the reload, and the binding still works.
|
||||||
|
- Load hook: a save loaded with Castes just added keeps every stored id, although `CasteLabels()` is empty during map `FinalizeInit`.
|
||||||
|
- **Risks:** It depends on Castes shipping API version 1 with `Active`, the token and `List<KeyValuePair<string, string>>`. An older or different API means unbound, with one log line.
|
||||||
|
|
||||||
|
#### Headless tests in 1.5
|
||||||
|
|
||||||
|
- Castes joins the default `-Compat` set; the caste tests skip in plain runs.
|
||||||
|
- A test helper builds castes through reflection only, so the test mod compiles without Castes.
|
||||||
|
|
||||||
## Works with the other Blax mods
|
## Works with the other Blax mods
|
||||||
|
|
||||||
- Package ids: `blax.slaves`, `blax.castes`, `blax.zones`. No hard dependencies. About.xml has one sibling entry, loadAfter `blax.castes`. Load order is Castes, Zones, Slaves. Slaves lists `blax.zones`, so Zones doesn't list Slaves back, which would form a loadAfter cycle.
|
- Package ids: `blax.slaves`, `blax.castes`, `blax.zones`, `blax.defaults`. No hard dependencies. About.xml has one sibling entry, loadAfter `blax.castes`. Load order is Castes, Zones, Slaves. Slaves lists `blax.zones`, so Zones doesn't list Slaves back, which would form a loadAfter cycle. Defaults lists no sibling and no sibling lists Defaults, so its position doesn't matter.
|
||||||
- Detection: one Compat helper calls `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. APIs change additively only and carry an int `Version`.
|
- Detection: one Compat helper calls `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. APIs change additively only and carry an int `Version`.
|
||||||
- Zones offers `BlaxZones.ZonesApi` (static) from 1.0:
|
- Zones offers `BlaxZones.ZonesApi` (static) from 1.0. Blax Slaves already binds it by exact delegate type and reads `Version` as a property or field (Siblings.cs:27, 61, 153-157), so version 1 is frozen and holds only:
|
||||||
- `Version` (int).
|
- `Version` (static int property), 1.
|
||||||
- `TryFindDropSpot(Map map, Thing thing, out IntVec3 cell)`: respects zone filters, priority and drop rules, false if no zone fits. It uses the orbital rules (orbital ticked, pod rule, overflow setting) and always returns false for a Pawn.
|
- `bool TryFindDropSpot(Map map, Thing thing, out IntVec3 cell)`: respects zone filters, priority and drop rules, false if no zone fits. It uses the orbital rules (orbital ticked, pod rule, overflow setting), always returns false for a Pawn, and returns false instead of throwing. The cell is for one pod holding that one thing: the caller spawns it exactly there with `TradeUtility.SpawnDropPod(cell, map, thing)` or `DropPodUtility.MakeDropPodAt`, and calls again per thing, after spawning the last pod, because a falling pod is what marks its cell as taken. `DropThingsNear` would not do: `DropThingGroupsNear` searches a new random cell around the center for every group (DropPodUtility.cs:44), starting within 5 cells (DropCellFinder.cs:271-276), so the pod would usually miss a small zone.
|
||||||
- `HasSleepingZoneFor(Map map, BedOwnerType type)`: returns false until 1.2.
|
- A member for sleeping zones is added once a sibling needs one, with its meaning written down then.
|
||||||
- Zones reads from Blax Castes, in 1.4 only: `CastesApi.Version`, `CasteIdOf(Pawn)` and `CasteLabels()`. Castes needs no Zones code. Zones reads nothing from Blax Slaves.
|
- Zones reads from Blax Castes, in 1.5 only, through `CastesApi` version 1, which Castes' design plans for its 1.1 with the same table:
|
||||||
- Ownership: Zones owns sleeping spots, beds by zone and every friendly drop location. Castes owns every per-pawn policy default (apparel, food, drugs, reading, medical care, schedule, area, hostility, self-tend, carried medicine); Zones never touches policies. Slaves owns slave status, trade, prices, suppression, rebellion, slave medicine and slave economy.
|
|
||||||
- Slaves routes its silver payouts through `ZonesApi.TryFindDropSpot`, with `DropCellFinder.TradeDropSpot` as fallback. Pawns are never routed into zones.
|
| Member | What Zones expects | Castes version |
|
||||||
|
|---|---|---|
|
||||||
|
| `Version` | static int property, 1 or higher | 1 (Castes 1.1) |
|
||||||
|
| `Active` | static bool; false with no game loaded or with Castes' `enableApi` off | 1 |
|
||||||
|
| `CasteIdOf(Pawn)` | `"<token>:<id>"`, or null (no record, casteless by choice, or not Active). The token is a random int made once per `GameComponent_BlaxCastes` and saved with it; the string is cached on the caste, so a call allocates nothing | 1 |
|
||||||
|
| `CasteLabels()` | `List<KeyValuePair<string, string>>` of (id, label), ids in the same `"<token>:<id>"` form, sorted by label; null while not Active | 1 |
|
||||||
|
| `HintJoinReason`, `NotifyJoined` | not used by Zones; Blax Slaves binds them by name | 2 (Castes 1.3) |
|
||||||
|
| `PrePick(Pawn, string casteId)` | not used by Zones; takes the token-prefixed id | 3 (Castes 1.4) |
|
||||||
|
|
||||||
|
Castes needs no Zones code. Zones reads nothing from Blax Slaves.
|
||||||
|
- Ownership: Zones owns sleeping spots, beds by zone and every friendly drop location. Castes owns every per-pawn policy default (apparel, food, drug, reading, medical care, schedule, work priorities, weapon loadout, area, hostility, self-tend, carried medicine, fire at will, prisoner interaction); Zones never touches policies. Slaves owns slave status, trade, prices, suppression, rebellion, slave medicine and slave economy. Defaults: starting settings of vanilla stockpiles and growing zones, storage buildings, production bills, workbenches, buildings, animals and mechs, and what the game forbids when pawns 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.
|
||||||
|
- Slaves routes its silver payouts through `ZonesApi.TryFindDropSpot` and spawns the pod at the returned cell with `TradeUtility.SpawnDropPod`, with `DropCellFinder.TradeDropSpot` and `DropThingsNear` as fallback (Blax Slaves docs/roadmap.md, purchase ledger and payouts). Pawns are never routed into zones. Payouts follow the zone's orbital checkbox, and its tooltip says so while Slaves is active.
|
||||||
- Buying: Zones never routes bought people. Slaves' buy-mode sets `guest.joinStatus` before vanilla `Pawn.PreTraded`, and Castes classifies by the final status in its own PreTraded scope. Zones touches neither.
|
- Buying: Zones never routes bought people. Slaves' buy-mode sets `guest.joinStatus` before vanilla `Pawn.PreTraded`, and Castes classifies by the final status in its own PreTraded scope. Zones touches neither.
|
||||||
- Slave sleeping zones use vanilla `BedOwnerType.Slave`, so `Alert_NeedSlaveBeds` counts them with no patch. No sibling calls `HasSleepingZoneFor` yet; it is not on the Blax Slaves roadmap.
|
- Slave sleeping zones (1.4) use vanilla `BedOwnerType.Slave`, so `Alert_NeedSlaveBeds` counts them with no patch (Alert_NeedSlaveBeds.cs:43). The alert runs only with Ideology (`requireIdeology`, Alert_NeedSlaveBeds.cs:14).
|
||||||
- Blax Slaves' shared infirmary (its 1.5) lets slaves use colonist medical beds, so a colonist sleeping zone set to medical takes slaves too. Zone filters still apply, because the `CanUseBedNow` postfix runs at `Priority.Low`.
|
- Blax Slaves' shared infirmary (its 1.5) lets slaves use colonist medical beds, so a colonist sleeping zone set to medical takes slaves too. Zone filters and caste limits still apply, because the `CanUseBedNow` postfix runs at `Priority.Low`.
|
||||||
- Each mod keeps its state in its own Map or Game components, so removing one leaves the others' saves intact.
|
- Blax Defaults ("Starting settings for storage, bills, crops, buildings, animals and mechs"): it hooks only `Designator_ZoneAddStockpile` (its 1.0) and `Designator_ZoneAdd_Growing` (its 1.3), and Zones' zones subclass `Zone` and `Designator_ZoneAdd` directly with their own tabs (`ITab_Delivery`, the animal-zone and people-zone tabs), so no Defaults hook or button reaches a delivery or sleeping zone. A new stockpile or shelf starts unflagged; "Make default" never copies Zones' flags, which live in Zones' component. Defaults' button sits inside the storage tab and Zones' 1.3 gizmos on the gizmo bar. Zone beds come from `AddCell`, not a frame, so Defaults' build scope (its 1.1) never sees them. Neither mod touches the home area. Defaults' forbid rules (corpses in its 1.2, dropped gear in its 1.3) act only inside `Pawn.Kill` and `Pawn.DropAndForbidEverything`, never on goods Zones delivers, so arriving goods keep the forbid flag of the vanilla call. If Defaults ever adds a rule for them, it must act where Zones' routed groups also pass, because routed reward groups drop through `MakeDropPodAt` and orbital goods through `SpawnDropPod`, never through `DropThingsNear`.
|
||||||
- Shared conventions: patches applied one class at a time from a `[StaticConstructorOnStartup]` class, logging "[Blax Zones] N patches applied"; a ModSettings toggle for every feature (zone storage has none, it is the save format); the headless in-game test mod copied from blax-slaves/Tests (BlaxSlavesTests harness, run-tests.ps1) as Tests/BlaxZonesTests, plus a phase 3 that simulates removing the mod.
|
- Each mod keeps its state in its own Map or Game components, or none (Defaults), so removing one leaves the others' saves intact.
|
||||||
|
- Shared conventions: patches applied one class at a time from a `[StaticConstructorOnStartup]` class, logging "[Blax Zones] N patches applied"; a ModSettings toggle for every feature (zone storage has none, it is the save format); any DLC combination, core only included (see "DLC support"); every hook body in try/catch with a one-time log; the headless in-game test mod copied from blax-castes/Tests (BlaxCastesTests harness, run-tests.ps1) as Tests/BlaxZonesTests, plus a phase 3 that simulates removing the mod.
|
||||||
|
|
||||||
## Backlog
|
## Backlog
|
||||||
|
|
||||||
|
- Royal title rewards land in the zone (S): a third context caller on `Pawn_RoyaltyTracker.ApplyRewardsForTitle` (Pawn_RoyaltyTracker.cs:822), only on player home maps, where it uses the trade spot (:838-840) and calls `DropThingsNear` once per title (:870). No vanilla `RoyalTitleDef` defines `rewards` and no mod in the active list adds them; build it when one does, behind `ModsConfig.RoyaltyActive`, with a Royalty-only test on a test-made title.
|
||||||
|
- Age limits on people zones, for example a nursery (S): `allowBabies`, `allowChildren`, `allowAdults` by DevelopmentalStage in the same `CanUseBedNow` postfix. Needs Biotech: behind `ModsConfig.BiotechActive`, shown disabled with "Needs Biotech" without it. Nobody asked yet.
|
||||||
|
- Unusable cells counted by reason in the inspect pane (S): a classifier that mirrors `IsGoodDropSpot` (DropCellFinder.cs:319-362, `CanPhysicallyDropInto` at :503-549) in this order: not standable or walkable, vacuum, water, roof, enclosed pen marker in the district, fogged, skyfaller or transporter, edifice, unreachable; one test per reason.
|
||||||
|
- "Make default" for new delivery and sleeping zones (S), in Zones' own tabs, stored as names in Zones' own file, as Blax Defaults suggests.
|
||||||
- Fewer drop pods (pod batching, M): the only consolidating mod has 1.8k subs and nobody asked. It adds a second deferred path through `TradeDeal.TryExecute`, which every trade mod touches, and big pods spill out of small zones. If built: flush per destination with `MakeDropPodAt(cell, map, info, faction)`, cap stacks per pod by zone size, keep a finalizer flush.
|
- Fewer drop pods (pod batching, M): the only consolidating mod has 1.8k subs and nobody asked. It adds a second deferred path through `TradeDeal.TryExecute`, which every trade mod touches, and big pods spill out of small zones. If built: flush per destination with `MakeDropPodAt(cell, map, info, faction)`, cap stacks per pod by zone size, keep a finalizer flush.
|
||||||
- Bought animals land in a zone, for example outside the pen gate (S): the cross-mod contract says pawns are never routed into zones. Narrow that rule to people first; then orbital only, per zone, off by default.
|
- Bought animals land in a zone, for example outside the pen gate (S): the cross-mod contract says pawns are never routed into zones. Narrow that rule to people first; then orbital only, per zone, off by default.
|
||||||
- Animals sleep on a stockpile, so the barn's hay stockpile is also the sleeping area (M): zone beds can't overlap zones, so this needs beds over stockpile cells stored in the MapComponent plus tests for items lying on bed cells. Two zones in one barn work until players ask.
|
- Animals sleep on a stockpile, so the barn's hay stockpile is also the sleeping area (M): zone beds can't overlap zones, so this needs beds over stockpile cells stored in the MapComponent plus tests for items lying on bed cells. Two zones in one barn work until players ask.
|
||||||
- Returning player caravans unload into a delivery zone (UnloadHere 3699782319, Homecoming 3833735329): small demand.
|
- Returning player caravans unload into a delivery zone (UnloadHere 3699782319, 522 subs; Homecoming 3833735329, 207): small demand.
|
||||||
- Ally drop pods and aid land next to a chosen zone (Allies Spot 2067847359, 3.7k): needs a faction check so hostile drops are never affected; small demand.
|
- Ally drop pods and aid land next to a chosen zone (Allies Spot 2067847359, 3,678 subs): needs a faction check so hostile drops are never affected; small demand.
|
||||||
- Blax zones fly with Odyssey gravships (`GravshipPlacementUtility`): Odyssey isn't installed here to build or test it.
|
- Vanilla Events Expanded's apparel and weapon pods in the cargo-pod context (S): the same context on those two incident workers, bound by reflection.
|
||||||
|
- A full removal test (`-Removal`, S): relaunch the game without blax.zones in ModsConfig plus a small verifier mod that loads the phase-3 save at the main menu and writes the error and warning counts.
|
||||||
|
- Blax zones fly with Odyssey gravships (`GravshipPlacementUtility`): Odyssey isn't installed on the test machine to build or test it. If built, behind `ModsConfig.OdysseyActive`.
|
||||||
|
|
||||||
## Cut
|
## Cut
|
||||||
|
|
||||||
- Pack animals walk purchases to the zone (L): many exit paths (lord transitions, duty reassignment, `ExitMap`, death, hostility), owed items must be hidden from the next trade, and nobody asked. Goods appearing plus caravan camping covers it.
|
- Pack animals walk purchases to the zone (L): many exit paths (lord transitions, duty reassignment, `ExitMap`, death, hostility), owed items must be hidden from the next trade, and nobody asked. Goods appearing plus caravan camping covers it.
|
||||||
- Shared zones by blocking `Pawn_Ownership.ClaimBedIfNonMedical`: the unowned sleeper fails `CanUseBedNow` and gets kicked out of bed in a loop.
|
- Stockpile flags instead of a delivery zone in 1.0: most stockpiles are roofed, so pods couldn't use them without direct delivery, and a flagged outdoor stockpile mixes landing pods with stored goods. The delivery zone is a landing pad with its own source checkboxes and the camp option. It wouldn't spare the zone save work either, which sleeping zones need in 1.2 anyway. Flags arrive in 1.3 together with direct delivery.
|
||||||
|
- Shared zones by blocking `Pawn_Ownership.ClaimBedIfNonMedical`: the unowned sleeper fails `CanUseBedNow` (RestUtility.cs:142-146) and gets kicked out of bed in a loop.
|
||||||
- Letter-target postfix on `QuestPart_DropPods.GetRandomDropSpot`: vanilla already points the letter at the first dropped thing, and the postfix would pull refugees and quest prisoners next to the zone.
|
- Letter-target postfix on `QuestPart_DropPods.GetRandomDropSpot`: vanilla already points the letter at the first dropped thing, and the postfix would pull refugees and quest prisoners next to the zone.
|
||||||
|
- Defeat-all-enemies rewards (`DefeatAllEnemiesQuestComp.GiveRewardsAndSendLetter`): nothing in vanilla 1.7 calls its `StartQuest`, so it never becomes active (RimWorld.Planet/DefeatAllEnemiesQuestComp.cs:25-55), and its letter would point at the trade spot (:74-81).
|
||||||
|
- Consuming the delivery context on the first `DropThingGroupsNear` call: a caller can drop several times inside one call (royal title rewards drop once per title, Pawn_RoyaltyTracker.cs:870), so later drops would miss the zone. The `SendSignal` prefix covers the leak instead.
|
||||||
|
- Routing only true trader caravans with a `LordJob_TradeWithColony` check: Hospitality guests would then drop goods at their feet, which players don't want either.
|
||||||
- Soft sleeping zone (ground sleep via `JobGiver_GetRest.TryFindGroundSleepSpotFor`, no beds): voluntary sleep only, so no ownership, no prisoner capture, no patients, `Alert_NeedColonistBeds` keeps firing, and any free spot elsewhere wins first.
|
- Soft sleeping zone (ground sleep via `JobGiver_GetRest.TryFindGroundSleepSpotFor`, no beds): voluntary sleep only, so no ownership, no prisoner capture, no patients, `Alert_NeedColonistBeds` keeps firing, and any free spot elsewhere wins first.
|
||||||
- Patching `DropCellFinder.TradeDropSpot` globally, as Trade Ships Drop Spot does: center-drop raids, ransom pawns and returning lent colonists use it too, so raiders would drop into the zone.
|
- Patching `DropCellFinder.TradeDropSpot` globally, as Trade Ships Drop Spot does: center-drop raids, ransom pawns and returning lent colonists use it too, so raiders would drop into the zone.
|
||||||
- Roof-punching delivery pods (Trading Control option): it collapses a 3x3 roof with damage below, and players report rock collapses in mountain bases. Direct delivery covers roofed rooms with no damage.
|
- Roof-punching delivery pods (Trading Control option): it collapses a 3x3 roof with damage below, and players report rock collapses in mountain bases. Direct delivery covers roofed rooms with no damage.
|
||||||
- Letting `ZoneManager` save Blax zones, with an uninstall button as the only safety net: a plain unsubscribe then throws an NRE on load.
|
- Letting `ZoneManager` save Blax zones, with an uninstall button as the only safety net: a plain unsubscribe then loses every zone on the map, vanilla ones included.
|
||||||
|
- Removing the component inside its own `FinalizeInit` after the removal button: `MapComponentUtility.FinalizeInit` loops by index, so the next component's `FinalizeInit` would be skipped, and vanilla re-creates the component on every save anyway. The `FillComponents` postfix replaces it.
|
||||||
|
- Patching `AutoHomeAreaMaker.Notify_ZoneCellAdded` or `PawnUtility.GainComfortFromCellIfPossible`: small methods the JIT may inline. Switching auto home area off around our own `AddCell` and the `ApplyBedRelatedEffects` postfix do the same without that risk.
|
||||||
- Edifice zone beds, or reusing vanilla AnimalSleepingSpot things: an edifice without a `sowTag` wipes pasture grass, and vanilla spots carry a `sowTag`, so they can't sit inside a zone.
|
- Edifice zone beds, or reusing vanilla AnimalSleepingSpot things: an edifice without a `sowTag` wipes pasture grass, and vanilla spots carry a `sowTag`, so they can't sit inside a zone.
|
||||||
- Delivery zone as a `Zone_Stockpile` subclass or an `Area`: vanilla designators can't expand a subclass, and an Area has no tab and the same save risk in `AreaManager`.
|
- Delivery zone as a `Zone_Stockpile` subclass or an `Area`: vanilla designators can't expand a subclass, and an Area has no tab and the same save risk in `AreaManager`.
|
||||||
- People and animals in one sleeping zone (two beds per cell): `bed_humanlike` is per def, and two beds on one cell make `RestUtility.CurrentBed` ambiguous. Players draw two zones.
|
- People and animals in one sleeping zone (two beds per cell): `bed_humanlike` is per def, and two beds on one cell make `RestUtility.CurrentBed` ambiguous (it takes the first bed, RestUtility.cs:499-529). Players draw two zones.
|
||||||
|
- Following vanilla's prison-cell flip for zone beds: one vanilla prisoner bed in a dorm would turn the whole colonist zone into prisoner beds and unclaim every colonist.
|
||||||
|
- Refusing Hospitality guests in colonist zones: zone beds behave like vanilla colonist beds, and a guest rule belongs to Hospitality.
|
||||||
- Routing ransom returns, lent colonists, quest pawns (refugees, prisoners, mechs), wastepacks and royal permit drops: never wanted in the zone, and the permit drop is already player-targeted.
|
- Routing ransom returns, lent colonists, quest pawns (refugees, prisoners, mechs), wastepacks and royal permit drops: never wanted in the zone, and the permit drop is already player-targeted.
|
||||||
- Converting Trade Ships Drop Spot markers into zones: one drag replaces a marker, and both mods work side by side.
|
- Converting Trade Ships Drop Spot markers into zones: one drag replaces a marker, and both mods work side by side.
|
||||||
- Trading Control's marketplace stall and trading buffs: outside zones, and it needs new art.
|
- Trading Control's marketplace stall and trading buffs: outside zones, and it needs new art.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue