rimworld-blax-slaves/README.md

7.1 KiB

Blax Slaves

RimWorld mod (1.7) that makes slavery an everyday part of the rim. First mod under the Blax Gaming label. Needs Harmony; slaves need Ideology.

Features

  • Slavers are common. The three vanilla slavers (outlander "slaver" caravan, tribal "slaver" caravan, orbital "slave ship") get commonality 2 instead of 1, and big colonies keep seeing them at half weight instead of zero. They carry more: outlander 5~9, tribal 4~7, slave ship 6~10 (vanilla 2~4). Allied outlanders and tribes send a slaver caravan on request (vanilla hides slavers from the comms console request). Every other caravan and orbital trader has a ~50% chance of 1~2 slaves, settlements stock 1~4. Patches/BlaxSlaves_Traders.xml
  • Branding. "Brand" surgery for colony slaves (adults, Medicine 2, never fails). The brand remembers its owner (shown as "slave brand (Owner)"), slows suppression loss by 15%, gives the slave a -3 "branded" mood and a fresh torso burn. "Rebrand" burns your mark over another owner's. Defs/BlaxSlaves_Brand.xml, Source/BlaxSlaves/Brand.cs
  • Trader slaves come branded. 35% of adult slaves in trader stock carry the trader faction's brand (orbital ships: a random faction).
  • Runaways come back. A slave with your brand who escapes (slave rebellion, or a caravan whose last free member dies) is tracked. If the faction they end up with is hostile, they keep them. Otherwise, after 3~10 days (80% chance) a non-hostile faction returns them as your slave, walking in (tribal/medieval) or by drop pod. Source/BlaxSlaves/Runaways.cs
  • Harming slaves doesn't upset colonists. Executing, harvesting, selling (trade or gift pod), banishing, butchering, blinding, gibbeting a slave gives free colonists no negative thoughts. Deaths only count when the colony caused them: a slave killed by raiders, animals or disease is mourned normally. Branded pawns count too unless they became free colonists. Pacifists (Kind, or incapable of violence) still mind, family still grieves, and the banish dialog shows the reduced cost. Source/BlaxSlaves/SlaveHarm.cs
  • Buy as slave or colonist (1.2). In the trade window, "Joins as slave / Joins as colonist" on a pawn the trader sells is a button: click to switch, and the price updates (a slave costs 60% of the colonist price, as in vanilla). Unwaveringly loyal pawns can only be bought as slaves. A setting picks what new stock starts as: the vanilla 25/75 roll, always slave or always colonist. Stands down while Trade as Slave or Colonist is active. Source/BlaxSlaves/BuyMode.cs
  • Every trader buys captives (1.2). Visitor groups, the Empire's caravans and modded traders without a humanlike stock generator get one, so anyone you trade with buys your slaves and prisoners. Optional: factions whose ideoligion rejects slavery refuse, except their own people (ransom). Slave stock ignores colony size, so settlements keep selling slaves to big colonies. Source/BlaxSlaves/TraderBuyers.cs
  • Price sliders (1.2). What slaves cost and what captives fetch, both vanilla 60% by default (30 to 100%). Above vanilla, a captive's sale price is capped at 90% of what the same trader would charge you for that pawn as a slave, so buy-low-sell-high loops don't pay. Source/BlaxSlaves/SlavePrices.cs
  • Time as a slave (1.2). A Records tab entry, and "Enslaved for ..." in the slave tab (counted from the moment 1.2 is installed). Source/BlaxSlaves/TimeAsSlave.cs
  • Mod settings for all the numbers and toggles, in tabs (Trade, General, Compat). The Compat tab lists active mods that Blax Slaves replaces, so you know what you can unsubscribe.

Compat: War Crimes Expanded 2 torture and Harvest Organs Post Mortem autopsies count as slave harm when their mods are active. Hospitality visitor groups never take a runaway who is due to be returned. No Sympathy For Prisoners already removes slavery and execution precept thoughts for everyone, pacifists included. Everybody Buys Slaves and [SYR] More Slaves can stay installed but aren't needed any more; with More Slaves, its extra 3~5 slaves per trader stack on ours. Blax Castes and Blax Zones (planned, see docs/) are optional companions; Blax Slaves binds their APIs by reflection when they are loaded.

Roadmap: docs/roadmap.md.

Not covered: eating slave meat, slave-leather apparel, slaves lost when a map closes or kidnapped by raiders (vanilla ransom handles those).

Development

The repo is the mod folder. Link it into the game with a directory junction, run from the repo root (adjust the RimWorld path):

New-Item -ItemType Junction -Path "E:\SteamLibrary\steamapps\common\RimWorld\Mods\BlaxSlaves" -Target (Get-Location).Path

Build (needs the .NET 10 SDK; output goes to 1.7/Assemblies/BlaxSlaves.dll):

dotnet build Source\BlaxSlaves\BlaxSlaves.csproj -c Release

RimWorldDir and HarmonyDir in the csproj point at the Steam install and the Harmony mod; override them with -p:RimWorldDir=... elsewhere.

RimWorld 1.7 no longer runs on Unity/Mono. It runs on .NET 10 (CoreCLR) with Ludeon's own engine ("Waylith"):

  • Assembly-CSharp.dll and UnityStubs.dll (Rect, Color...) sit in the install root, and target net10.0.
  • Harmony for 1.7 is the Harmony mod's 1.7/Assemblies/0Harmony.dll (3.0-rc.7, Workshop 2009463077). Reference it, don't ship it. Parameterless PatchAll() is obsolete in Harmony 3.
  • In game, the Harmony mod swaps in a Waylith method-body backend (HarmonyMod.RuntimeIL.dll). Check Player.log for [Blax Slaves] N patches applied and Harmony's runtime-body provider line.
  • Patches are applied from a [StaticConstructorOnStartup] class, one class at a time, so one broken target can't disable the rest.

Tests

Tests/BlaxSlavesTests is a separate test mod. Tests/run-tests.ps1 builds both projects, links the test mod into the game's Mods folder for the run, and starts RimWorld headless (-headless -quicktest -blaxslavestests, no window) with its own save data folder in %TEMP%\BlaxSlavesTest, so your mod list, saves and settings stay untouched. The suite runs in a quick-test colony, saves and reloads the game, runs the persistence tests, writes BlaxSlavesTestResults.txt and quits. It takes about a minute and needs Steam running.

.\Tests\run-tests.ps1

-Compat also loads the installed mods Blax Slaves has compat code for (Hospitality, Harvest Organs Post Mortem, War Crimes Expanded 2, SYR More Slaves, Everybody Buys Slaves, Trade as Slave or Colonist); tests whose assumptions those mods change skip or relax only that assertion and say why. Exit code 0 means all passed, 1 failures, 2 the run didn't finish (see game.log in the data folder).

Tests are public static void methods marked [BlaxTest("area: what", phase: 1)], using T for assertions and Fixtures for pawns, ticks and memories. Phase 2 runs after the save and reload; carry ThingIDs through T.Carry.

Useful 1.7 switches for manual runs: -quicktest (straight into a generated colony), -headless, -savedatafolder=<dir>, -QuitAfterBoot, -NoFileLog.

A decompiled copy of the 1.7 game code for reference lives outside the repo in ..\rimworld-src-1.7 (never commit or publish it).