From afede583e6e5a7ba8020556e4928dbb9b15b58a9 Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Sat, 28 Nov 2026 23:22:36 +0100 Subject: [PATCH] feat: Blax Castes 1.0, work in progress Castes bundle a pawn's apparel, food, drug and reading policy and medical care. Join defaults put bought slaves, bought colonists, new colonists, new slaves and new prisoners into a caste one tick after they join. Includes the caste manager window, the Caste column in the Assign tab, the join defaults window, Workshop art and the in-game test suite. State: core and join defaults pass the suite (47 pass, 1 compat-only skip). The manager window and Assign column were merged afterwards and build, but the merged state has not run through the tests or review yet. --- .gitignore | 9 + 1.7/Assemblies/BlaxCastes.dll | Bin 0 -> 57344 bytes 1.7/Assemblies/BlaxCastes.pdb | Bin 0 -> 26368 bytes About/About.xml | 34 + About/ModIcon.png | Bin 0 -> 13822 bytes About/Preview.png | Bin 0 -> 66996 bytes CHANGELOG.md | 11 + Defs/BlaxCastes_PawnColumns.xml | 13 + Languages/English/Keyed/BlaxCastes.xml | 40 ++ Languages/English/Keyed/BlaxCastes_Join.xml | 21 + Languages/English/Keyed/BlaxCastes_UI.xml | 32 + Patches/BlaxCastes_Assign.xml | 28 + README.md | 84 +++ Source/Art/README.md | 15 + Source/Art/blax-monogram.svg | 16 + Source/Art/fonts/geist.woff2 | Bin 0 -> 29288 bytes Source/Art/icon.html | 6 + Source/Art/icon.svg | 28 + Source/Art/preview.html | 96 +++ Source/BlaxCastes/AssignColumn.cs | 60 ++ Source/BlaxCastes/BlaxCastes.csproj | 43 ++ Source/BlaxCastes/BlaxCastesMod.cs | 145 ++++ Source/BlaxCastes/Caste.cs | 132 ++++ Source/BlaxCastes/CasteData.cs | 126 ++++ Source/BlaxCastes/CasteManager.cs | 238 +++++++ Source/BlaxCastes/CasteUtility.cs | 207 ++++++ Source/BlaxCastes/Compat.cs | 20 + Source/BlaxCastes/Dialog_JoinDefaults.cs | 138 ++++ Source/BlaxCastes/Dialog_ManageCastes.cs | 286 ++++++++ Source/BlaxCastes/GameComponent_BlaxCastes.cs | 343 +++++++++ Source/BlaxCastes/JoinDefaults.cs | 342 +++++++++ Source/BlaxCastes/JoinHooks.cs | 149 ++++ Source/BlaxCastes/JoinScopes.cs | 61 ++ .../BlaxCastes/PawnColumnWorker_BlaxCaste.cs | 266 +++++++ Tests/BlaxCastesTests/About/About.xml | 20 + .../Source/BlaxCastesTests.csproj | 45 ++ Tests/BlaxCastesTests/Source/CasteTests.cs | 297 ++++++++ Tests/BlaxCastesTests/Source/Fixtures.cs | 279 ++++++++ Tests/BlaxCastesTests/Source/Harness.cs | 266 +++++++ Tests/BlaxCastesTests/Source/JoinTests.cs | 660 ++++++++++++++++++ Tests/BlaxCastesTests/Source/ManagerTests.cs | 152 ++++ .../Source/PersistenceTests.cs | 197 ++++++ Tests/BlaxCastesTests/Source/SettingsTests.cs | 131 ++++ Tests/BlaxCastesTests/Source/SmokeTests.cs | 77 ++ Tests/BlaxCastesTests/Source/UiTests.cs | 438 ++++++++++++ Tests/run-tests.ps1 | 162 +++++ docs/design.md | 466 +++++++++++++ 47 files changed, 6179 insertions(+) create mode 100644 .gitignore create mode 100644 1.7/Assemblies/BlaxCastes.dll create mode 100644 1.7/Assemblies/BlaxCastes.pdb create mode 100644 About/About.xml create mode 100644 About/ModIcon.png create mode 100644 About/Preview.png create mode 100644 CHANGELOG.md create mode 100644 Defs/BlaxCastes_PawnColumns.xml create mode 100644 Languages/English/Keyed/BlaxCastes.xml create mode 100644 Languages/English/Keyed/BlaxCastes_Join.xml create mode 100644 Languages/English/Keyed/BlaxCastes_UI.xml create mode 100644 Patches/BlaxCastes_Assign.xml create mode 100644 README.md create mode 100644 Source/Art/README.md create mode 100644 Source/Art/blax-monogram.svg create mode 100644 Source/Art/fonts/geist.woff2 create mode 100644 Source/Art/icon.html create mode 100644 Source/Art/icon.svg create mode 100644 Source/Art/preview.html create mode 100644 Source/BlaxCastes/AssignColumn.cs create mode 100644 Source/BlaxCastes/BlaxCastes.csproj create mode 100644 Source/BlaxCastes/BlaxCastesMod.cs create mode 100644 Source/BlaxCastes/Caste.cs create mode 100644 Source/BlaxCastes/CasteData.cs create mode 100644 Source/BlaxCastes/CasteManager.cs create mode 100644 Source/BlaxCastes/CasteUtility.cs create mode 100644 Source/BlaxCastes/Compat.cs create mode 100644 Source/BlaxCastes/Dialog_JoinDefaults.cs create mode 100644 Source/BlaxCastes/Dialog_ManageCastes.cs create mode 100644 Source/BlaxCastes/GameComponent_BlaxCastes.cs create mode 100644 Source/BlaxCastes/JoinDefaults.cs create mode 100644 Source/BlaxCastes/JoinHooks.cs create mode 100644 Source/BlaxCastes/JoinScopes.cs create mode 100644 Source/BlaxCastes/PawnColumnWorker_BlaxCaste.cs create mode 100644 Tests/BlaxCastesTests/About/About.xml create mode 100644 Tests/BlaxCastesTests/Source/BlaxCastesTests.csproj create mode 100644 Tests/BlaxCastesTests/Source/CasteTests.cs create mode 100644 Tests/BlaxCastesTests/Source/Fixtures.cs create mode 100644 Tests/BlaxCastesTests/Source/Harness.cs create mode 100644 Tests/BlaxCastesTests/Source/JoinTests.cs create mode 100644 Tests/BlaxCastesTests/Source/ManagerTests.cs create mode 100644 Tests/BlaxCastesTests/Source/PersistenceTests.cs create mode 100644 Tests/BlaxCastesTests/Source/SettingsTests.cs create mode 100644 Tests/BlaxCastesTests/Source/SmokeTests.cs create mode 100644 Tests/BlaxCastesTests/Source/UiTests.cs create mode 100644 Tests/run-tests.ps1 create mode 100644 docs/design.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4f1e836 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +Source/**/bin/ +Source/**/obj/ +.vs/ +*.user +Tests/**/1.7/ +Tests/**/bin/ +Tests/**/obj/ +Tools/**/bin/ +Tools/**/obj/ diff --git a/1.7/Assemblies/BlaxCastes.dll b/1.7/Assemblies/BlaxCastes.dll new file mode 100644 index 0000000000000000000000000000000000000000..268d9fe517fcf2b1280d316a54dc78a46f7180ce GIT binary patch literal 57344 zcmbrn34D~*^*4T==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ek?Dk12-4Om*NMLoy4H5RA$v^n|JFal_go;n{{nC&4 z{%y$QCJ@{B@`GCLE%M&V<&nfYYCAtCPaQh7<9`}2-}s07kALOqFSw76wf|T!cm|j^ zNbSqmdmpbb*%!n%mpr~ObJm@jn)uKYPr3l-^PdfH!1cEpt$%;#wV&QRJ2ZCn>yPkO z-{kX*!u2H9dEcKa2m7LT4qd){lt(??Z1WsSsA2B{QJtUe21eQ?;Vrt@OhMVd{QN(s zK*0uY#JN@{q9z0SA@JMMRc?y!Z@}r_*I0 ztWVpC+CKE3Z}vV8t_5)7p;L0SF?~BEe!Pq_`_sS2Ie-BT+>^+Efg=j@9LdlT$T_ws zk8#%_4ShD6`6>MwtCzH+X{rtesQm@-$nfh{e?N{wA;t4~>g!NPR_`&kPxq%^wTFjo zl+h8#Mex*7oea~B+8Jj%RvY>H;096u2z7NN@v`-JfxZf3f7H_WHqtpr8N3=c8*Up8N&v-!HqhDFyxyNADsq literal 0 HcmV?d00001 diff --git a/1.7/Assemblies/BlaxCastes.pdb b/1.7/Assemblies/BlaxCastes.pdb new file mode 100644 index 0000000000000000000000000000000000000000..faf6b2ff476299d58f3e87d75958ec5662673259 GIT binary patch literal 26368 zcmai72S60Z*PmOC<0wZJK~SU!SODq8N)=EL1baW=KomGU4)HAUP-E{kw%EHd8f(;8 zqS2_)XpD(5iBV%>Vq#*--D5oZnz7HUSYcC?L0}fbKm5U1<*d3S%F%V62INc)rn4T2WF(>9<=lrbHOf zC!gIzd^p9^`(&mfO!Z~#SU2G0GCdX6?04PF&9|E7tm!m^#fQ``Pn*8$3*2V?)*ftU zYsYx2-U5yX?E?9rnI9nZ1epokP$({wJ{hz{5b5pc>F>P++JPGlS-V)`Iqc4uOt?-UEFAx(2!l zdJb|7vtrSpQJ@8&6Jbhr4)iJL576JBX6=ov<FF&_2*@&OXUfj@%pT+lY7OcK8Vb^Zwt&6_eFIAFV$Vi^Lc7|tC7{nh&q0F{?b$NW zp+pCE9CQHte>`NNp;xIOD$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#JF;E8>O5SNb}tV zMx_(=XfzJ;?9!;nE}pjJQ#<%WN1;)eLOA^r&!gy}uRTBN4#SH>6-CYKt?fyc+?@{& z?Ya~|eW|d7ph#6m*pSxv2LK?AwqdGH_=QRccc=U^6S{ZC3YY`&^Fv@9zBDBV+nWui zvn$vs{A&P8b)4m3w@fgJF)lDPtQYk(pDv>8l1Bq0W(mqk93-pp4QH(Mbb^L9JJXVc)xRm$h*&=FaGq<+@|86%WW1WP3IX4B7EG=A zlyi1Y!Vx{)cBc{`aPz_FrszYc`5nw(-pWu~Ud9Nf{)t>rZOrG*77+cA76=r|^WZZ;do z70qp2Z>llayr4gYtooo8YfQm*c1Xqa zbA`(|343AzpG?JltMTU5*g~@em=4z#&R}A(3i^a4V{e1Tq~OvLo2Z)*o{P8|pddfi zMjh^k{$StKQ3$5kSU4SmEyackaJkx0%z(KjoFKcREa3|YrlsJI11VCFQVl!^talg* zoLS-Yb$k;qrm(~M#X6*++F%SPIxtTIZxODTT{OlQ$3Sctyl>i@)~Kl$11zjT_#nA! z53s7i#tP8|v=VCZUIc}ZobxuLL2k7-dMny(tORl zh-9xBN6N^2%~yRXY-zrmKw*;kJB~Y;Z?+0frv%KNpTn@HrEPOB2c=S3(}Oo`Vl=*l L?%Wv-W9 + + Blax Castes + Blax Gaming + blax.castes + 1.0.0 + +
  • 1.7
  • +
    + +
  • + brrainz.harmony + Harmony + steam://url/CommunityFilePage/2009463077 + https://github.com/pardeike/HarmonyRimWorld/releases/latest +
  • +
    + +
  • brrainz.harmony
  • +
    + Policy bundles and join defaults. Works without DLCs; slaves need Ideology. + +- A caste bundles an apparel, food, drug and reading policy and a medical care level. Putting a pawn in a caste sets all five in one step. +- Change a caste's policy and its members follow, except pawns you changed by hand. +- Prisoners in a caste get its food policy and medical care only. +- Assign tab: a Caste column (click a cell, or drag down the column to give several pawns the same caste), and the "Manage castes" and "Defaults" buttons above it. The caste manager works like the vanilla policy windows. +- Join defaults: pick a caste for bought slaves, bought colonists, new colonists, new slaves and new prisoners. A pawn you buy arrives already wearing its caste's outfit and eating its food, and a message names the caste. Every row starts at No caste, so nothing changes until you pick one. +- A recruited prisoner can leave the prisoner caste and go back to your default policies. +- A pawn that leaves your faction leaves its caste. +- Covers Automatic Slave Outfit, PrisonerDefaults and the join defaults of Better Pawn Control and 1trickPwnyta's Defaults. +- Turn it off in the mod settings and castes stop changing policies. Removing the mod leaves every pawn on its last policies. + +Multiplayer: not supported yet. +
    diff --git a/About/ModIcon.png b/About/ModIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..2fa664791e86a5fb54b47ae148ef82888020e798 GIT binary patch literal 13822 zcmX|obzD^M6YklCrDN&tZX~2(m+l5>7EoHcRAN~`QbeVsOF9LlVJQ(MC8a}BDM3K; z?)P^;_x`o}+0Qv==bf2%=6RkuZ@i(t1~CCW0RRBRTAHfH006>#1p#@e;z#(d6YB0UR80Z4~vN{1dEB@oR??6J$ zm*egtcp@fYXJ~qQdiio5LLN_30>(?R?Fbq)H#aZsSU#M*V24rQeG!B8OkzaJa3r9^a)9z`rwA0P^*Lzh=!zVmBQr-+nW4 z{k+))v4Dm?9Xe?i>i00x)gAdBiG^#9;w(xbD99sbc-Yjt_<{2*M2V&^Aj74AzHaOC zN=e=~dbs4~C{EFD<4+tl`Kpt>1o z{2!%Y6LkmoY&>-i2srD(C1nmJ;&gbuMTP$KbaBB6b`)gO*;2R`47@`{>t%%3lv?YX{dVr%kjdowdN6Yka~}~+UP%j{*;}pk0N{! zb-kh9=#lLX#8OCCUP{Wb&(TWPH@M?-!3N_8u@OQmc^bVsV689k7z@wFABO`;y`d?Y zS@q^Xwv@Lb)#;`8W`AQO$Ee=ZM%*pk5$zG$o4|*1`{3~aN>-fM(tX+Agz(t0ILf(a4$a98U3MeWkR{;au$7Vn7H zp1S1px_pw4|IAHKhrU!+K+m0K&5rBz(cCb$3=Ry~2u{U(c9NxGRZ@x|e}8iqozL2v z(Z_N(;i8u>6L!w}fYO8yumQx6&lT-zIu**E{iq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U`Md6Ps>H z{iGikO^lM_zjiy#jS(`I0HSZd?eHRHgXFO>L6l0=5`p*P&OMD+3@kr%fxiiFEwg@y zhWdH+gg$A1*0QGhU-aPN58C+ZV5%rt=OHGrFES_A-xQOu$QHZw Manage castes), built on the vanilla policy window: new, duplicate, rename, delete, make default, and per slot a managed checkbox, a dropdown and a pencil that opens the vanilla editor. +- Caste column in the Assign tab: click a cell or drag down the column to assign. Shows "*" and a tooltip when a pawn's policies differ from its caste, and "(pending)" until a join is applied. +- Join defaults (Assign tab > Defaults): pick No caste, the default caste or a specific caste for bought slaves, bought colonists, new colonists, new slaves and new prisoners. Every row starts at No caste. A bought slave arrives in its caste, and a message names it. A No caste row takes a pawn out of its old caste and resets its policies. Replaces Automatic Slave Outfit and PrisonerDefaults, and the join defaults of Better Pawn Control, Better Pawn Control Forked and 1trickPwnyta's Defaults. +- A pawn that leaves your faction leaves its caste. Deleting a caste leaves its members casteless on their current policies. +- Settings: castes on or off, join defaults, join messages, reset policies when a join removes a caste, the Assign column. While a game is loaded, the settings page also opens the caste manager and the join defaults. diff --git a/Defs/BlaxCastes_PawnColumns.xml b/Defs/BlaxCastes_PawnColumns.xml new file mode 100644 index 0000000..07f9e28 --- /dev/null +++ b/Defs/BlaxCastes_PawnColumns.xml @@ -0,0 +1,13 @@ + + + + + + BlaxCastes_Caste + + The pawn's caste. A caste sets apparel, food, drug and reading policy and medical care at once. Click a cell to pick a caste, or drag down the column to give several pawns the same one. + BlaxCastes.PawnColumnWorker_BlaxCaste + true + + + diff --git a/Languages/English/Keyed/BlaxCastes.xml b/Languages/English/Keyed/BlaxCastes.xml new file mode 100644 index 0000000..789db8d --- /dev/null +++ b/Languages/English/Keyed/BlaxCastes.xml @@ -0,0 +1,40 @@ + + + + + Caste {0} + Leave alone + Apparel + Food + Drugs + Reading + Medical care + + + No caste + Default caste + Bought as slave + Bought as colonist + New colonist + New slave + New prisoner + + + Manage castes + Join defaults + + + Castes set policies + Off: castes never change a pawn's apparel, food, drug or reading policy or medical care. Castes and memberships stay in the save. + Join defaults + A pawn that joins (bought, recruited, enslaved or captured) goes into the caste its join row picks. Every row starts at No caste. + Message when a joining pawn gets a caste + A message names the pawn and its new caste. + Reset policies when a join takes a pawn out of its caste + When a pawn's join row is No caste and it was in a caste, its managed policies go back to the defaults and its medical care is reset. Off: it keeps them. + Caste column in the Assign tab (needs a restart) + Shows each pawn's caste left of the policy columns. Click a cell to assign a caste. + Slaves need the Ideology DLC. Without it, castes still work for colonists and prisoners. + Reset to defaults + + diff --git a/Languages/English/Keyed/BlaxCastes_Join.xml b/Languages/English/Keyed/BlaxCastes_Join.xml new file mode 100644 index 0000000..caae237 --- /dev/null +++ b/Languages/English/Keyed/BlaxCastes_Join.xml @@ -0,0 +1,21 @@ + + + + + Pick the caste a pawn goes into when it joins your colony this way. Default caste uses the caste marked as default in the caste manager. + Join defaults are off in the mod settings. These picks do nothing until you turn them back on. + There are no castes yet. Make one in the Assign tab with Manage castes. + Default caste ({CASTE}) + Default caste (none set) + + A pawn you buy from a trader that joins as a slave. + A pawn you buy from a trader that joins as a colonist. + Any other pawn that becomes a colonist: recruited prisoners, freed slaves, rescued pawns, wanderers and quest joiners.\n\nNo caste: a pawn that was in a caste leaves it, for example a recruited prisoner leaves the prisoner caste. + Any other pawn that becomes a slave: enslaved prisoners, children raised as slaves and returned runaways.\n\nNo caste: a pawn that was in a caste leaves it. + Any pawn that becomes your prisoner: captured enemies, quest prisoners and arrested colonists. Prisoners only take the food policy and medical care of a caste.\n\nNo caste: a pawn that was in a caste leaves it. + + + {PAWN_labelShort} joined the {CASTE} caste. + {COUNT} pawns joined the {CASTE} caste: {PAWNS}. + + diff --git a/Languages/English/Keyed/BlaxCastes_UI.xml b/Languages/English/Keyed/BlaxCastes_UI.xml new file mode 100644 index 0000000..8d4f539 --- /dev/null +++ b/Languages/English/Keyed/BlaxCastes_UI.xml @@ -0,0 +1,32 @@ + + + + + A caste sets several policies at once. Join rows set to "Default caste" use the default caste. + Checked: members of this caste get this setting. Unchecked: the caste leaves it alone. + Changing a setting here also changes it for members that still have the old value. Pawns you changed by hand keep their own. + Could not delete {0}. + Blax Castes: make castes in Assign > Manage castes, then use the Defaults button to pick the caste new pawns join. + + + Manage castes + Make castes and choose the policies each one sets. + Defaults + Choose the caste a pawn joins when it is bought, recruited, enslaved or captured. + None + Not in a caste. + No caste, set by hand. The pawn keeps its current policies. + (pending) + Just joined. Gets its caste on the next tick. + Cannot change the caste of temporary faction members. + Caste: {0} + Different from the caste (changed by hand or by the game): + {0}: {1} (caste: {2}) + Click to pick a caste. Drag down the column to give several pawns the same caste. + Reset to caste + Edit caste + + + The same windows as the buttons above the Caste column: + + diff --git a/Patches/BlaxCastes_Assign.xml b/Patches/BlaxCastes_Assign.xml new file mode 100644 index 0000000..8596c73 --- /dev/null +++ b/Patches/BlaxCastes_Assign.xml @@ -0,0 +1,28 @@ + + + + + + Defs/PawnTableDef[defName="Assign"]/columns/li[text()="HostilityResponse"] + + Defs/PawnTableDef[defName="Assign"]/columns/li[text()="HostilityResponse"] + Prepend + +
  • BlaxCastes_Caste
  • +
    +
    + + Defs/PawnTableDef[defName="Assign"]/columns/li[text()="LabelShortWithIcon"] + + Defs/PawnTableDef[defName="Assign"]/columns/li[text()="LabelShortWithIcon"] + Append + +
  • BlaxCastes_Caste
  • +
    +
    +
    +
    + +
    diff --git a/README.md b/README.md new file mode 100644 index 0000000..7dcb017 --- /dev/null +++ b/README.md @@ -0,0 +1,84 @@ +# Blax Castes + +RimWorld mod (1.7) by Blax Gaming: policy bundles and join defaults. Every slave you buy needs its apparel, food, drug and reading policy set by hand. Blax Castes bundles those policies into castes such as Slave or Miner slave, and puts each new pawn into the right caste the moment it joins. Needs Harmony. Works without DLCs; slaves need Ideology. + +Design and roadmap: `docs/design.md`. + +## Features (1.0) + +- **Castes.** A caste manages up to five slots: apparel, food, drug and reading policy, and medical care. Each slot is either a vanilla policy (or a medical care level) or left alone. Putting a pawn in a caste writes every managed slot through the vanilla setters. `Source/BlaxCastes/Caste.cs`, `CasteUtility.cs` +- **Per-slot checks.** Apparel, drugs and reading need the pawn's tracker and skip quest lodgers, prisoners and mutants without policies. Food needs a configurable food tracker and skips babies. Medical care needs player settings and a flesh pawn. So a prisoner in a caste gets its food policy and medical care only. +- **Members follow their caste.** Change a caste's slot and every member still on the old value gets the new one. Members you changed by hand keep theirs. A slot that was left alone and becomes managed reaches every member; a slot that stops being managed changes nobody. Edits inside a policy (the Slave outfit's filter) reach members through the vanilla reference. `Source/BlaxCastes/CasteManager.cs` +- **Caste manager.** Assign tab > "Manage castes" above the Caste column. It is the vanilla policy manager: the caste list with new, duplicate, rename, delete and make default on the left, and one row per slot on the right with a "managed" checkbox, a dropdown and a pencil that opens the vanilla editor for that policy. Ticking a slot starts it at the game's default policy (or the colonist default medical care). Deleting a caste leaves its members casteless on their current policies, and join rows that pointed at it fall back to No caste. `Source/BlaxCastes/Dialog_ManageCastes.cs` +- **Caste column.** A Caste column in the Assign tab, left of hostility, medical care and the policy columns. Click a cell for the menu (No caste, every caste, Reset to caste, Edit caste), or drag down the column to give several pawns the same caste. The cell shows the caste, the caste with "*" when one of the pawn's managed policies differs (the tooltip names each slot with both values), "No caste" when you took the pawn out by hand, "None" when it never had one, "(pending)" while a join waits for the next tick, and "Unchangeable" for quest lodgers. The column sorts by caste, pawns without one last. `Source/BlaxCastes/PawnColumnWorker_BlaxCaste.cs`, `Patches/BlaxCastes_Assign.xml` +- **Join defaults.** Assign tab > "Defaults" above the Caste column. Five rows pick a caste for bought as slave, bought as colonist, new colonist, new slave and new prisoner: No caste, Default caste (the one marked default in the manager) or a specific caste. Every row starts at No caste, so nothing changes until you pick one. Without Ideology the two slave rows are hidden. `Source/BlaxCastes/JoinDefaults.cs`, `Dialog_JoinDefaults.cs` + - Buying a pawn from a trader uses the bought rows; the pawn's final status picks slave or colonist. Everything else goes by final status: recruiting and freeing to new colonist, enslaving and returned runaways to new slave, capturing, quest prisoners and arrests to new prisoner. + - Castes applies a join one tick after it happens, after the game's own status-change resets, so its choice wins over mods that set policies in the same call. A bought slave arrives wearing its caste's outfit and eating its food, and a message names the caste. + - A caste you pick by hand before the join is applied wins over the row. A pawn sold or released before then is dropped. + - A No caste row takes a pawn out of the caste it was in. With "Reset policies" on, the caste's managed policies go back to the game defaults and medical care is reset, so a recruited prisoner does not keep the prisoner food. This also applies to an arrested colonist while the new prisoner row is No caste. + - Babies, quest lodgers and mutants without policies are skipped. +- **Leaving.** A pawn that leaves your faction (sold, released, gone to another faction) leaves its caste on the next tick, and a check every 2500 ticks catches the rest. Its policies stay as they are. +- **First load.** A new game, or the first load of a save with Castes, posts one message that points to Assign > Manage castes. +- **Settings.** `enabled` (off: castes never write a policy; castes and memberships stay in the save), `enableJoinDefaults`, `joinMessages`, `revertOnLeave` ("Reset policies when a join takes a pawn out of its caste"), `showAssignColumn` (needs a restart). All on by default. While a game is loaded, the settings page also has "Manage castes" and "Join defaults" buttons, the way in while the column is off. `Source/BlaxCastes/BlaxCastesMod.cs` + +Save safety: all state lives in one game component (`GameComponent_BlaxCastes`), nothing is stored on vanilla objects, and the only vanilla data Castes writes is each pawn's own policy fields. Memberships drop pawns that are discarded or destroyed without being dead, on every save and after loading. A policy that left its database (a mod deleting it without `TryDelete`, or a delete in a vanilla editor opened from the manager) becomes unmanaged with one warning per caste. Joins waiting for the next tick are saved with the game. Adding the mod to a running save works; removing it leaves every pawn on its last policies and one "type not found" line for the component. + +Replaces: Automatic Slave Outfit and PrisonerDefaults, the join defaults of Better Pawn Control, Better Pawn Control Forked and 1trickPwnyta's Defaults, and partly Save My Settings (clothing and food presets per pawn). + +Compat: + +- Blax Slaves: its buy-as-slave-or-colonist button lands in the right bought row, and returned runaways land in the new slave row. Castes calls nothing in Blax Slaves. +- Trade as Slave or Colonist: same as Blax Slaves' buy mode. +- Better Pawn Control, its fork and 1trickPwnyta's Defaults have join defaults of their own. Castes applies a tick after the join, so its row wins. Turn theirs off so two mods don't write the same policies. +- Tested next to Hospitality, Custom Prisoner Interactions and Prisoner Realism. +- Numbers builds its own tables, so the Caste column shows only in the vanilla Assign tab. + +Not supported yet: multiplayer, animal castes. Ready-made castes, a caste button on selected pawns and overlap warnings come in 1.1. + +## 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); `Tests/run-tests.ps1` creates it if it is missing: + +```powershell +New-Item -ItemType Junction -Path "E:\SteamLibrary\steamapps\common\RimWorld\Mods\BlaxCastes" -Target (Get-Location).Path +``` + +Build (needs the .NET 10 SDK; output goes to `1.7/Assemblies/BlaxCastes.dll`): + +```powershell +dotnet build Source\BlaxCastes\BlaxCastes.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` (Workshop 2009463077). Reference it, don't ship it. Parameterless `PatchAll()` is obsolete in Harmony 3. +- Patches are applied from a `[StaticConstructorOnStartup]` class, one class at a time, so one broken target can't disable the rest. Check `Player.log` for `[Blax Castes] 3 patches applied` (the join hooks on `Pawn.SetFaction`, `Pawn_GuestTracker.SetGuestStatus` and `Pawn.PreTraded`). + +Every change to castes, memberships, join rows and the default caste goes through `CasteManager`, so the sync rules and the `enabled` switch hold whichever window or hook made the change. + +Works with the other Blax mods: Castes has no hard dependency on Blax Slaves or Blax Zones and calls nothing in them. Load order is Castes, Zones, Slaves; Castes lists no sibling in `loadAfter`. Detection goes through `Compat.IsActive(packageId)`, which matches a local copy next to a Workshop copy. Before 1.3 there is no API. + +Workshop art (`About/Preview.png`, `About/ModIcon.png`) is rendered from `Source/Art`; see `Source/Art/README.md`. + +### Tests + +`Tests/BlaxCastesTests` 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 -blaxcastestests`, no window) with its own save data folder in `%TEMP%\BlaxCastesTest`, 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 `BlaxCastesTestResults.txt` and quits. It takes under a minute and needs Steam running. + +```powershell +.\Tests\run-tests.ps1 # refuses while RimWorld is open +.\Tests\run-tests.ps1 -AllowWhileRunning # runs next to an open game, at below-normal priority +.\Tests\run-tests.ps1 -AllowWhileRunning -Compat -NoBuild +``` + +If PowerShell blocks scripts, run it as `powershell -ExecutionPolicy Bypass -File .\Tests\run-tests.ps1 -AllowWhileRunning`. + +`-Compat` also loads Blax Slaves and the installed mods Castes overlaps with (Hospitality, Trade as Slave or Colonist, Custom Prisoner Interactions, Prisoner Realism), in the load order Castes, then Slaves. `-NoBuild` skips the build. Only one run at a time: a lock file in the data folder holds the running script's process id, and a lock left by a dead process is taken over. `Mods\BlaxCastes` must be a junction to this repo; the script creates it if missing and stops if a real folder is in the way. Exit code 0 means all passed, 1 failures, 2 the run didn't finish (see `game.log` and `game.err.log` in the data folder). + +Tests are `public static void` methods marked `[BlaxTest("area: what", phase: 1)]`, using `T` for assertions and `Fixtures` for colonists, prisoners, slaves, quest lodgers, babies, castes, policies and ticks. Phase 2 runs after the save and reload; carry ids through `T.Carry`, or `T.CarryAtSave` for values later phase-1 tests may still change. Without Ideology the slave tests skip; without Biotech the baby tests skip. The buy-mode compat test needs `-Compat`. Headless runs have no GUI, so the tests drive the logic behind the windows and the column; drawing is checked by hand. + +Useful 1.7 switches for manual runs: `-quicktest` (straight into a generated colony), `-headless`, `-savedatafolder=`, `-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). diff --git a/Source/Art/README.md b/Source/Art/README.md new file mode 100644 index 0000000..9b910a3 --- /dev/null +++ b/Source/Art/README.md @@ -0,0 +1,15 @@ +# Preview art + +`preview.html` renders `About/Preview.png` (1280x720) and `icon.html` renders `About/ModIcon.png` (256x256) from `icon.svg`. Both follow the Blax CI from https://www.blax.at/ui-ci and match Blax Slaves' art, so the mods read as one label: Blax black `#050805`, Blax green `#19C63C`, logo gray `#CDCDCD`, Geist for the title and subtitle. `geist.woff2` is the file blax.at self-hosts (SIL Open Font License); icons are lucide (ISC license). + +The preview's right column shows three join rows (new colonist, bought slave, new prisoner), each pointing at the policy bundle its caste sets: apparel, food, drugs, reading and medical care. Green slots are managed, gray ones are left alone. The icon is the Blax monogram with a green "layers" badge, so it stands apart from Blax Slaves' plain monogram in the mod list. + +Render with Edge headless from this folder. The separate profile folder keeps the headless run away from an open Edge window, and `| Out-Null` waits for each screenshot. + +```powershell +$edge = 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe' +$here = (Get-Location).Path -replace '\\','/' +$edgeData = "$env:TEMP\blax-art-edge" +& $edge --headless=new --disable-gpu --hide-scrollbars --user-data-dir="$edgeData" --virtual-time-budget=3000 --window-size=1280,720 --screenshot="$PWD\..\..\About\Preview.png" "file:///$here/preview.html" | Out-Null +& $edge --headless=new --disable-gpu --hide-scrollbars --user-data-dir="$edgeData" --virtual-time-budget=2000 --window-size=256,256 --default-background-color=00000000 --screenshot="$PWD\..\..\About\ModIcon.png" "file:///$here/icon.html" | Out-Null +``` diff --git a/Source/Art/blax-monogram.svg b/Source/Art/blax-monogram.svg new file mode 100644 index 0000000..a628153 --- /dev/null +++ b/Source/Art/blax-monogram.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/Source/Art/fonts/geist.woff2 b/Source/Art/fonts/geist.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..8f01e7630ba2f88ffa1acd90d69f67efb5bd3092 GIT binary patch literal 29288 zcmV)3K+C^(Pew8T0RR910CH#m6951J0RZp-0CDvI0RR9100000000000000000000 z0000Qh6NjepB@~COg~6gK~jfXKTTFaQalD=KT}jeRDn1Eg%B@(5e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s2l=+j}dC9AK%@Ct@+Cb8>OytD7ZOp?dg z)XikFFZ|9zSh(V_Iao#)3>V%q9V3Rl@uom0gp5abB{C5xf);kNN9E%Q0>Pq*KhuaV z)@P)JCOHL`L$n#s*uDzh|eb(cF2 zY8v<4_rOEi;HRte-Dfj+H6u=d{YIhYrCY3(O3 zuvergnWDWDBTEuvvc;Yz&KI{^WQnCIhQ$)XLi7{h`JpT`)^d4P$hFT(XN>d7coR%i zW|Bnt3jAc1$&w^9`{0TxnGbbtWdwGs3JXLhSFLPd(T zR-%nkZIx-KTzeHdNa?7P&bsKTQa7&Y_op9G>8^)rHEPxAsUAFD8uZo&D}448jw2l4 zWWPH~aM1~k$S{ovoOMnZHjWgjf`zEp;JgcJU35&f8*ZW@)>xfD zgP7_Ki|ZH}PLVBmKKtSliX#UbO>1W(W_5Fl1kxz)}dFY zE`6bLQ@Q&WvXs>&p29d9&*O-iwm|H|-Fa2!=s72Lc+On>n@_(dwMo_ScdT`Xh$ha@ ze$`j$w@}P0!DF*H&Qd}3$I~scU-hYVDK4oLe_*6?`gFcP^ig|paiFKXpoSezh0U*y z=nf)4P#aMc)I^k^h{zBTP$ceBB-TVkAR?Sf8-VTr2qYjPpacN{fPP7!h=72A5|Gct zIZVXIU_7h4%tiC~C}5YnOYXw3$e+`AZvU&?EI9#5&3Y) zr2MC_zx&X4g)ax(Z~olDl0C6#?^?mKFJX{9JiJ>cQds%1j>F2&Htd&wc`nte-|%Bn zmiRR>K5wwlyn9fvG3C1=FW%^Ke;$t%BO%c)7G=DHu8EbUvqfS{0P``4kvXZJLj387 b8!pPm;9xHet}Nue;WfOmfZz)$T2MUu_`HMY literal 0 HcmV?d00001 diff --git a/Source/Art/icon.html b/Source/Art/icon.html new file mode 100644 index 0000000..f83e334 --- /dev/null +++ b/Source/Art/icon.html @@ -0,0 +1,6 @@ + + + diff --git a/Source/Art/icon.svg b/Source/Art/icon.svg new file mode 100644 index 0000000..4e502a9 --- /dev/null +++ b/Source/Art/icon.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Art/preview.html b/Source/Art/preview.html new file mode 100644 index 0000000..f699f77 --- /dev/null +++ b/Source/Art/preview.html @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + +
    + +
    +

    Blax
    Castes

    +
    policy bundles
    and join defaults
    +
    + +
    + +
    + + +
    + + + + + +
    +
    + +
    + + +
    + + + + + +
    +
    + +
    + + +
    + + + + + +
    +
    +
    + + diff --git a/Source/BlaxCastes/AssignColumn.cs b/Source/BlaxCastes/AssignColumn.cs new file mode 100644 index 0000000..54f6425 --- /dev/null +++ b/Source/BlaxCastes/AssignColumn.cs @@ -0,0 +1,60 @@ +using System; +using RimWorld; +using Verse; + +namespace BlaxCastes +{ + /// + /// The Caste column in the Assign table. Patches/BlaxCastes_Assign.xml puts it right before + /// HostilityResponse; at startup this removes it again when the showAssignColumn setting is off, + /// so turning the setting on or off takes effect after a restart. + /// + [StaticConstructorOnStartup] + public static class AssignColumn + { + public const string AnchorColumn = "HostilityResponse"; + + static AssignColumn() + { + try + { + bool show = BlaxCastesMod.Settings == null || BlaxCastesMod.Settings.showAssignColumn; + PawnTableDef table = Table; + bool missing = show && table?.columns != null && Column != null && !table.columns.Contains(Column); + Apply(show); + if (missing) + Log.Warning("[Blax Castes] The XML patch did not place the Caste column in the Assign table; it was added in code instead."); + } + catch (Exception e) + { + Log.Error("[Blax Castes] Setting up the Caste column failed: " + e); + } + } + + public static PawnTableDef Table => PawnTableDefOf.Assign; + + public static PawnColumnDef Column => DefDatabase.GetNamedSilentFail(PawnColumnWorker_BlaxCaste.DefName); + + /// + /// Off: removes the column from the Assign table def. On: adds it back right before + /// HostilityResponse (or after the first column if that is gone) unless it is already there. + /// Returns true if the table changed. Open Assign tabs pick the change up the next time they open. + /// + public static bool Apply(bool show) + { + PawnTableDef table = Table; + PawnColumnDef column = Column; + if (table?.columns == null || column == null) + return false; + if (!show) + return table.columns.RemoveAll(c => c == column) > 0; + if (table.columns.Contains(column)) + return false; + int at = table.columns.FindIndex(c => c != null && c.defName == AnchorColumn); + if (at < 0) + at = Math.Min(1, table.columns.Count); + table.columns.Insert(at, column); + return true; + } + } +} diff --git a/Source/BlaxCastes/BlaxCastes.csproj b/Source/BlaxCastes/BlaxCastes.csproj new file mode 100644 index 0000000..cc4afe0 --- /dev/null +++ b/Source/BlaxCastes/BlaxCastes.csproj @@ -0,0 +1,43 @@ + + + + + net10.0 + BlaxCastes + BlaxCastes + latest + disable + disable + ..\..\1.7\Assemblies\ + false + false + false + false + portable + true + + $(MSBuildProjectDirectory)=Source/BlaxCastes + + + + + E:\SteamLibrary\steamapps\common\RimWorld + E:\SteamLibrary\steamapps\workshop\content\294100\2009463077\1.7\Assemblies + + + + + $(RimWorldDir)\Assembly-CSharp.dll + false + + + $(RimWorldDir)\UnityStubs.dll + false + + + $(HarmonyDir)\0Harmony.dll + false + + + + diff --git a/Source/BlaxCastes/BlaxCastesMod.cs b/Source/BlaxCastes/BlaxCastesMod.cs new file mode 100644 index 0000000..9dba24d --- /dev/null +++ b/Source/BlaxCastes/BlaxCastesMod.cs @@ -0,0 +1,145 @@ +using System; +using HarmonyLib; +using UnityEngine; +using Verse; + +namespace BlaxCastes +{ + public class BlaxCastesSettings : ModSettings + { + /// Off: castes never write a pawn's policies. Castes, rows and memberships stay in the save. + public bool enabled = true; + /// Joining pawns are put into the caste their join row picks. + public bool enableJoinDefaults = true; + /// A message names the caste a joining pawn was put into. + public bool joinMessages = true; + /// A join row set to No caste takes a pawn out of its caste and resets the managed policies. + public bool revertOnLeave = true; + /// The Caste column in the Assign tab. Read once at startup. + public bool showAssignColumn = true; + + public override void ExposeData() + { + base.ExposeData(); + Scribe_Values.Look(ref enabled, "enabled", true); + Scribe_Values.Look(ref enableJoinDefaults, "enableJoinDefaults", true); + Scribe_Values.Look(ref joinMessages, "joinMessages", true); + Scribe_Values.Look(ref revertOnLeave, "revertOnLeave", true); + Scribe_Values.Look(ref showAssignColumn, "showAssignColumn", true); + } + + public void Reset() + { + var d = new BlaxCastesSettings(); + enabled = d.enabled; + enableJoinDefaults = d.enableJoinDefaults; + joinMessages = d.joinMessages; + revertOnLeave = d.revertOnLeave; + showAssignColumn = d.showAssignColumn; + } + } + + public class BlaxCastesMod : Mod + { + public static BlaxCastesSettings Settings; + + /// + /// Raised after the settings window closes and the settings are written. Features that read + /// a setting once (the Assign column) can react here. + /// + public static event Action SettingsChanged; + + /// The "enabled" setting. True before the settings exist, so nothing is lost while loading. + public static bool Enabled => Settings == null || Settings.enabled; + + public BlaxCastesMod(ModContentPack content) : base(content) + { + Settings = GetSettings(); + } + + public override string SettingsCategory() => "Blax Castes"; + + public override void WriteSettings() + { + base.WriteSettings(); + try + { + SettingsChanged?.Invoke(); + } + catch (Exception e) + { + Log.Error("[Blax Castes] Re-applying settings failed: " + e); + } + } + + public override void DoSettingsWindowContents(Rect inRect) + { + BlaxCastesSettings s = Settings; + var l = new Listing_Standard(); + l.maxOneColumn = true; + l.Begin(inRect); + + l.CheckboxLabeled("BlaxCastes_SettingEnabled".Translate(), ref s.enabled, "BlaxCastes_SettingEnabledTip".Translate()); + l.GapLine(); + + l.CheckboxLabeled("BlaxCastes_SettingJoinDefaults".Translate(), ref s.enableJoinDefaults, "BlaxCastes_SettingJoinDefaultsTip".Translate()); + l.CheckboxLabeled("BlaxCastes_SettingJoinMessages".Translate(), ref s.joinMessages, "BlaxCastes_SettingJoinMessagesTip".Translate()); + l.CheckboxLabeled("BlaxCastes_SettingRevertOnLeave".Translate(), ref s.revertOnLeave, "BlaxCastes_SettingRevertOnLeaveTip".Translate()); + l.GapLine(); + + l.CheckboxLabeled("BlaxCastes_SettingShowAssignColumn".Translate(), ref s.showAssignColumn, "BlaxCastes_SettingShowAssignColumnTip".Translate()); + if (Current.Game != null && GameComponent_BlaxCastes.Instance != null) + { + // The way in while the Caste column is off. + l.Gap(6f); + l.Label("BlaxCastes_SettingOpenWindows".Translate()); + if (l.ButtonText("BlaxCastes_ManageCastesButton".Translate())) + Find.WindowStack.Add(new Dialog_ManageCastes()); + if (l.ButtonText("BlaxCastes_JoinDefaultsTitle".Translate())) + Find.WindowStack.Add(new Dialog_JoinDefaults()); + } + if (!ModsConfig.IdeologyActive) + { + l.GapLine(); + l.Label("BlaxCastes_SettingNoIdeology".Translate()); + } + + l.Gap(); + if (l.ButtonText("BlaxCastes_SettingsReset".Translate())) + s.Reset(); + l.End(); + } + } + + /// + /// Applies the Harmony patches after every Mod class exists (so the Harmony mod has set up + /// its 1.7 backend), one class at a time so a single broken target can't take the rest down. + /// + [StaticConstructorOnStartup] + public static class BlaxCastesStartup + { + public const string HarmonyId = "blax.castes"; + public static readonly Harmony Harmony = new Harmony(HarmonyId); + + static BlaxCastesStartup() + { + int ok = 0, failed = 0; + foreach (Type type in typeof(BlaxCastesStartup).Assembly.GetTypes()) + { + if (!type.IsDefined(typeof(HarmonyPatch), false)) + continue; + try + { + Harmony.CreateClassProcessor(type).Patch(); + ok++; + } + catch (Exception e) + { + failed++; + Log.Error("[Blax Castes] Patch " + type.Name + " failed: " + e); + } + } + Log.Message("[Blax Castes] " + ok + " patches applied" + (failed > 0 ? ", " + failed + " failed" : "")); + } + } +} diff --git a/Source/BlaxCastes/Caste.cs b/Source/BlaxCastes/Caste.cs new file mode 100644 index 0000000..f94f61f --- /dev/null +++ b/Source/BlaxCastes/Caste.cs @@ -0,0 +1,132 @@ +using RimWorld; +using Verse; + +namespace BlaxCastes +{ + /// The five policy slots a caste can manage in 1.0. + public enum CasteSlot + { + Apparel, + Food, + Drug, + Reading, + MedCare, + } + + /// + /// A bundle of policies. Ids, load IDs, rename and duplicate work the vanilla Policy way. A null + /// policy slot, or medCare -1, means the caste leaves that slot alone. + /// Read the slots freely; change them only through CasteManager.SetSlot, which keeps members in sync. + /// + public class Caste : Policy + { + public const int Unmanaged = -1; + + private ApparelPolicy apparelPolicy; + private FoodPolicy foodPolicy; + private DrugPolicy drugPolicy; + private ReadingPolicy readingPolicy; + private int medCare = Unmanaged; + + protected override string LoadKey => "BlaxCaste"; + + public Caste() + { + } + + public Caste(int id, string label) : base(id, label) + { + } + + public ApparelPolicy ApparelPolicy => apparelPolicy; + public FoodPolicy FoodPolicy => foodPolicy; + public DrugPolicy DrugPolicy => drugPolicy; + public ReadingPolicy ReadingPolicy => readingPolicy; + + /// -1 (Unmanaged), otherwise a MedicalCareCategory. + public int MedCare => medCare; + + public MedicalCareCategory? MedCareCategory => medCare < 0 ? (MedicalCareCategory?)null : (MedicalCareCategory)medCare; + + /// The slot's value: a Policy, a boxed int for MedCare (-1 = unmanaged), or null. + public object GetSlot(CasteSlot slot) + { + switch (slot) + { + case CasteSlot.Apparel: return apparelPolicy; + case CasteSlot.Food: return foodPolicy; + case CasteSlot.Drug: return drugPolicy; + case CasteSlot.Reading: return readingPolicy; + case CasteSlot.MedCare: return medCare; + default: return null; + } + } + + public bool IsManaged(CasteSlot slot) + { + if (slot == CasteSlot.MedCare) + return medCare >= 0; + return GetSlot(slot) != null; + } + + public bool AnyManaged() + { + foreach (CasteSlot slot in CasteUtility.AllSlots) + { + if (IsManaged(slot)) + return true; + } + return false; + } + + /// Raw write without member sync. Only CasteManager calls this. + internal void SetSlotRaw(CasteSlot slot, object value) + { + switch (slot) + { + case CasteSlot.Apparel: + apparelPolicy = value as ApparelPolicy; + break; + case CasteSlot.Food: + foodPolicy = value as FoodPolicy; + break; + case CasteSlot.Drug: + drugPolicy = value as DrugPolicy; + break; + case CasteSlot.Reading: + readingPolicy = value as ReadingPolicy; + break; + case CasteSlot.MedCare: + medCare = CasteUtility.ToMedCare(value); + break; + } + } + + /// Copies every slot, not the id or the label (vanilla duplicate keeps the new policy's label). + public override void CopyFrom(Policy other) + { + if (other is Caste caste) + { + apparelPolicy = caste.apparelPolicy; + foodPolicy = caste.foodPolicy; + drugPolicy = caste.drugPolicy; + readingPolicy = caste.readingPolicy; + medCare = caste.medCare; + } + } + + public override void ExposeData() + { + base.ExposeData(); + Scribe_References.Look(ref apparelPolicy, "apparelPolicy"); + Scribe_References.Look(ref foodPolicy, "foodPolicy"); + Scribe_References.Look(ref drugPolicy, "drugPolicy"); + Scribe_References.Look(ref readingPolicy, "readingPolicy"); + Scribe_Values.Look(ref medCare, "medCare", Unmanaged); + if (Scribe.mode == LoadSaveMode.PostLoadInit) + medCare = CasteUtility.ToMedCare(medCare); + } + + public override string ToString() => "Caste(" + id + ", " + label + ")"; + } +} diff --git a/Source/BlaxCastes/CasteData.cs b/Source/BlaxCastes/CasteData.cs new file mode 100644 index 0000000..6acc7c0 --- /dev/null +++ b/Source/BlaxCastes/CasteData.cs @@ -0,0 +1,126 @@ +using Verse; + +namespace BlaxCastes +{ + /// + /// A pawn's place in the caste system. Caste null means "casteless by choice": the player (or a + /// deleted caste) took the pawn out, and later safety nets leave it alone. A pawn with no record at + /// all never had a caste. + /// + public class CasteMembership : IExposable + { + public Caste caste; + /// True when a join row set it, false when the player did. + public bool auto; + public string reason; + public int tick; + + public CasteMembership() + { + } + + public CasteMembership(Caste caste, bool auto, string reason, int tick) + { + this.caste = caste; + this.auto = auto; + this.reason = reason; + this.tick = tick; + } + + public bool Casteless => caste == null; + + public void ExposeData() + { + Scribe_References.Look(ref caste, "caste"); + Scribe_Values.Look(ref auto, "auto"); + Scribe_Values.Look(ref reason, "reason"); + Scribe_Values.Look(ref tick, "tick"); + } + } + + public enum JoinRowMode + { + NoCaste, + DefaultCaste, + SpecificCaste, + } + + /// What a way of joining does: no caste, the default caste, or one specific caste. + public class JoinRow : IExposable + { + public string reason; + public JoinRowMode mode = JoinRowMode.NoCaste; + /// Only used with SpecificCaste. + public Caste caste; + + public JoinRow() + { + } + + public JoinRow(string reason) + { + this.reason = reason; + } + + public void ExposeData() + { + Scribe_Values.Look(ref reason, "reason"); + Scribe_Values.Look(ref mode, "mode", JoinRowMode.NoCaste); + Scribe_References.Look(ref caste, "caste"); + } + } + + /// A join waiting for the next tick. Filled and applied by JoinDefaults. + public class QueuedJoin : IExposable + { + public Pawn pawn; + public string reason; + public int tick; + + public QueuedJoin() + { + } + + public QueuedJoin(Pawn pawn, string reason, int tick) + { + this.pawn = pawn; + this.reason = reason; + this.tick = tick; + } + + public void ExposeData() + { + Scribe_References.Look(ref pawn, "pawn"); + Scribe_Values.Look(ref reason, "reason"); + Scribe_Values.Look(ref tick, "tick"); + } + } + + /// Reason strings stored in memberships, join rows and the join queue. + public static class JoinReason + { + // The five join rows in 1.0. + public const string BoughtSlave = "boughtSlave"; + public const string BoughtColonist = "boughtColonist"; + public const string NewColonist = "newColonist"; + public const string NewSlave = "newSlave"; + public const string NewPrisoner = "newPrisoner"; + + // Reasons that are not join rows. + public const string Manual = "manual"; + public const string CasteDeleted = "casteDeleted"; + + /// The join rows in display order. + public static readonly string[] Rows = { BoughtSlave, BoughtColonist, NewColonist, NewSlave, NewPrisoner }; + + public static bool IsRow(string reason) + { + for (int i = 0; i < Rows.Length; i++) + { + if (Rows[i] == reason) + return true; + } + return false; + } + } +} diff --git a/Source/BlaxCastes/CasteManager.cs b/Source/BlaxCastes/CasteManager.cs new file mode 100644 index 0000000..5303198 --- /dev/null +++ b/Source/BlaxCastes/CasteManager.cs @@ -0,0 +1,238 @@ +using System.Collections.Generic; +using RimWorld; +using Verse; + +namespace BlaxCastes +{ + /// + /// Every change to castes, memberships, join rows and the default caste goes through here, so the + /// rules (member sync, delete fallbacks, the enabled switch) hold no matter which window or hook + /// made the change. Methods do nothing and return false or null when no game is loaded. + /// + public static class CasteManager + { + private static GameComponent_BlaxCastes Comp => GameComponent_BlaxCastes.Instance; + + private static int Now => Find.TickManager?.TicksGame ?? 0; + + // ---- castes ------------------------------------------------------------------------ + + /// A new caste with the next free id, labelled "Caste N", managing nothing. + public static Caste CreateCaste(string label = null) + { + GameComponent_BlaxCastes comp = Comp; + if (comp == null) + return null; + int id = comp.TakeNextId(); + var caste = new Caste(id, label.NullOrEmpty() ? (string)"BlaxCastes_NewCasteLabel".Translate(id) : label); + comp.AddCaste(caste); + return caste; + } + + /// A new caste with every slot copied from the source, the vanilla duplicate way. + public static Caste DuplicateCaste(Caste source) + { + GameComponent_BlaxCastes comp = Comp; + if (comp == null || source == null) + return null; + Caste copy = CreateCaste(); + copy.CopyFrom(source); + return copy; + } + + /// + /// Removes the caste. Its members become casteless and keep their current policies, join rows + /// that point at it fall back to No caste, and it stops being the default. + /// + public static bool DeleteCaste(Caste caste) + { + GameComponent_BlaxCastes comp = Comp; + if (comp == null || !comp.HasCaste(caste)) + return false; + foreach (Pawn member in comp.MembersOf(caste)) + { + if (CasteUtility.CanBeMember(member)) + comp.SetMembership(member, new CasteMembership(null, false, JoinReason.CasteDeleted, Now)); + else + comp.RemoveMembership(member); + } + foreach (JoinRow row in comp.JoinRows) + { + if (row.mode == JoinRowMode.SpecificCaste && row.caste == caste) + comp.SetRowRaw(row.reason, JoinRowMode.NoCaste, null); + } + if (comp.DefaultCaste == caste) + comp.SetDefaultRaw(null); + comp.RemoveCaste(caste); + return true; + } + + /// Sets the caste that "Default caste" rows use. Null clears it, so those rows act as No caste. + public static bool SetDefault(Caste caste) + { + GameComponent_BlaxCastes comp = Comp; + if (comp == null || (caste != null && !comp.HasCaste(caste))) + return false; + comp.SetDefaultRaw(caste); + return true; + } + + /// + /// Changes one slot. Members still on the old value get the new one; members on another value + /// keep it (the Follow rule). A slot that was unmanaged had no old value, so every member gets + /// the new one. Unmanaging a slot changes no pawn. Returns how many members were moved. + /// + public static int SetSlot(Caste caste, CasteSlot slot, object newValue) + { + GameComponent_BlaxCastes comp = Comp; + if (comp == null || !comp.HasCaste(caste)) + return 0; + if (!CasteUtility.FitsSlot(slot, newValue)) + { + Log.Warning("[Blax Castes] " + newValue.GetType().Name + " does not fit the " + slot + " slot of " + caste.label + "."); + return 0; + } + if (slot == CasteSlot.MedCare) + newValue = CasteUtility.ToMedCare(newValue); + else if (newValue != null && !CasteUtility.PolicyExists((Policy)newValue)) + { + Log.Warning("[Blax Castes] Policy " + ((Policy)newValue).label + " is not in the game's database; " + caste.label + " keeps its " + slot + " slot."); + return 0; + } + + object oldValue = caste.GetSlot(slot); + bool wasManaged = caste.IsManaged(slot); + if (CasteUtility.SameValue(oldValue, newValue)) + return 0; + caste.SetSlotRaw(slot, newValue); + if (!caste.IsManaged(slot) || !BlaxCastesMod.Enabled) + return 0; + + int moved = 0; + foreach (Pawn member in comp.MembersOf(caste)) + { + if (GameComponent_BlaxCastes.IsGone(member) || !CasteUtility.CanUse(member, slot)) + continue; + if (wasManaged && !CasteUtility.SameValue(CasteUtility.CurrentValue(member, slot), oldValue)) + continue; + if (CasteUtility.WriteSlot(member, slot, newValue)) + moved++; + } + return moved; + } + + // ---- memberships ------------------------------------------------------------------- + + /// + /// Puts the pawn into the caste and writes every managed slot it can take. auto: a join row did + /// it, not the player. A null caste makes the pawn casteless. False if the pawn can't be a member + /// (not humanlike, gone, or not player faction or player prisoner) or the caste isn't in this game. + /// + public static bool Assign(Pawn pawn, Caste caste, bool auto, string reason) + { + if (caste == null) + return MakeCasteless(pawn, auto, reason); + GameComponent_BlaxCastes comp = Comp; + if (comp == null || !comp.HasCaste(caste) || !CasteUtility.CanBeMember(pawn)) + return false; + comp.SetMembership(pawn, new CasteMembership(caste, auto, reason ?? JoinReason.Manual, Now)); + CasteUtility.Apply(pawn, caste); + return true; + } + + /// Casteless by choice: the pawn leaves its caste and keeps its current policies. + public static bool MakeCasteless(Pawn pawn, bool auto = false, string reason = JoinReason.Manual) + { + GameComponent_BlaxCastes comp = Comp; + if (comp == null || !CasteUtility.CanBeMember(pawn)) + return false; + comp.SetMembership(pawn, new CasteMembership(null, auto, reason ?? JoinReason.Manual, Now)); + return true; + } + + /// Re-writes every managed slot of the pawn's caste, clearing its overrides. + public static bool ResetToCaste(Pawn pawn) + { + GameComponent_BlaxCastes comp = Comp; + Caste caste = comp?.CasteOf(pawn); + if (caste == null || !CasteUtility.CanBeMember(pawn)) + return false; + CasteUtility.Apply(pawn, caste); + return true; + } + + /// Removes the pawn's record, as if it never had a caste. Its policies stay as they are. + public static bool EndMembership(Pawn pawn) + { + GameComponent_BlaxCastes comp = Comp; + return comp != null && comp.RemoveMembership(pawn); + } + + /// + /// The managed slots of the pawn's caste where the pawn has another value (a hand change or a + /// vanilla reset). Slots the pawn can't take are never overrides. + /// + public static List Overrides(Pawn pawn) + { + var result = new List(); + Caste caste = Comp?.CasteOf(pawn); + if (caste == null) + return result; + foreach (CasteSlot slot in CasteUtility.AllSlots) + { + if (!caste.IsManaged(slot) || !CasteUtility.CanUse(pawn, slot)) + continue; + if (!CasteUtility.SameValue(CasteUtility.CurrentValue(pawn, slot), caste.GetSlot(slot))) + result.Add(slot); + } + return result; + } + + // ---- join rows --------------------------------------------------------------------- + + /// Sets what a join row does. SpecificCaste needs a caste of this game. + public static bool SetJoinRow(string reason, JoinRowMode mode, Caste caste = null) + { + GameComponent_BlaxCastes comp = Comp; + if (comp == null || reason.NullOrEmpty()) + return false; + if (mode == JoinRowMode.SpecificCaste && !comp.HasCaste(caste)) + return false; + comp.SetRowRaw(reason, mode, caste); + return true; + } + + // ---- save safety ------------------------------------------------------------------- + + /// Unmanages every slot whose policy left its database, with one warning per caste. + internal static void CheckPolicies(GameComponent_BlaxCastes comp) + { + if (comp == null) + return; + foreach (Caste caste in comp.Castes) + UnmanageMissingPolicies(caste); + } + + /// Unmanages the caste's slots whose policy is no longer in its database. Returns how many. + internal static int UnmanageMissingPolicies(Caste caste) + { + if (caste == null || Current.Game == null) + return 0; + List missing = null; + foreach (CasteSlot slot in CasteUtility.AllSlots) + { + if (slot == CasteSlot.MedCare || !(caste.GetSlot(slot) is Policy policy)) + continue; + if (CasteUtility.PolicyExists(policy)) + continue; + (missing ??= new List()).Add(slot + " (" + policy.label + ")"); + caste.SetSlotRaw(slot, null); + } + if (missing == null) + return 0; + Log.Warning("[Blax Castes] Caste \"" + caste.label + "\": " + string.Join(", ", missing) + + " no longer in the game's policies. The slot is now unmanaged."); + return missing.Count; + } + } +} diff --git a/Source/BlaxCastes/CasteUtility.cs b/Source/BlaxCastes/CasteUtility.cs new file mode 100644 index 0000000..1acf93b --- /dev/null +++ b/Source/BlaxCastes/CasteUtility.cs @@ -0,0 +1,207 @@ +using System.Collections.Generic; +using RimWorld; +using Verse; + +namespace BlaxCastes +{ + /// + /// Reads and writes a pawn's policy slots through the vanilla setters, with the checks that decide + /// which slots a pawn can take. CasteManager decides when to write; nothing else should call Apply. + /// + public static class CasteUtility + { + public static readonly CasteSlot[] AllSlots = { CasteSlot.Apparel, CasteSlot.Food, CasteSlot.Drug, CasteSlot.Reading, CasteSlot.MedCare }; + + /// Player faction (colonists, slaves, dead colonists) or a prisoner of the player. + public static bool IsPlayerSide(Pawn pawn) + { + if (pawn == null) + return false; + return pawn.Faction == Faction.OfPlayer || pawn.IsPrisonerOfColony; + } + + /// Humanlike, still around, and player-side. + public static bool CanBeMember(Pawn pawn) => + pawn != null && !GameComponent_BlaxCastes.IsGone(pawn) && pawn.RaceProps != null && pawn.RaceProps.Humanlike && IsPlayerSide(pawn); + + private static bool PoliciesDisabled(Pawn pawn) => pawn.IsMutant && pawn.mutant.Def.disablePolicies; + + /// Apparel, drug and reading: tracker, not a quest lodger, not a prisoner, no policy-less mutant. + private static bool CanTakeOwnPolicies(Pawn pawn) => + !pawn.IsQuestLodger() && !pawn.IsPrisoner && !PoliciesDisabled(pawn); + + /// Whether the slot can be written on this pawn right now. + public static bool CanUse(Pawn pawn, CasteSlot slot) + { + if (pawn == null || (pawn.Destroyed && !pawn.Dead)) + return false; + switch (slot) + { + case CasteSlot.Apparel: + return pawn.outfits != null && CanTakeOwnPolicies(pawn) && !(pawn.IsMutant && pawn.mutant.Def.disableApparel); + case CasteSlot.Drug: + return pawn.drugs != null && CanTakeOwnPolicies(pawn); + case CasteSlot.Reading: + return pawn.reading != null && CanTakeOwnPolicies(pawn); + case CasteSlot.Food: + return pawn.foodRestriction != null && pawn.foodRestriction.Configurable + && !pawn.DevelopmentalStage.Baby() && !PoliciesDisabled(pawn); + case CasteSlot.MedCare: + return pawn.playerSettings != null && pawn.RaceProps != null && pawn.RaceProps.IsFlesh; + default: + return false; + } + } + + /// The pawn's current value for a slot (a Policy, or a boxed int for MedCare), or null if it has none. + public static object CurrentValue(Pawn pawn, CasteSlot slot) + { + if (pawn == null) + return null; + switch (slot) + { + case CasteSlot.Apparel: return pawn.outfits?.CurrentApparelPolicy; + case CasteSlot.Food: return pawn.foodRestriction?.CurrentFoodPolicy; + case CasteSlot.Drug: return pawn.drugs?.CurrentPolicy; + case CasteSlot.Reading: return pawn.reading?.CurrentPolicy; + case CasteSlot.MedCare: return pawn.playerSettings == null ? (object)null : (int)pawn.playerSettings.medCare; + default: return null; + } + } + + /// Equality for slot values: policies by reference, med care by value. + public static bool SameValue(object a, object b) + { + if (a is int ia && b is int ib) + return ia == ib; + return ReferenceEquals(a, b); + } + + /// + /// Writes every managed slot of the caste the pawn can take, through the vanilla setters, and + /// returns those slots. A policy that is no longer in its database is skipped and unmanaged. + /// Does nothing while the "enabled" setting is off. + /// + public static List Apply(Pawn pawn, Caste caste) + { + var applied = new List(); + if (!BlaxCastesMod.Enabled || pawn == null || caste == null || GameComponent_BlaxCastes.IsGone(pawn)) + return applied; + bool missing = false; + foreach (CasteSlot slot in AllSlots) + { + if (!caste.IsManaged(slot)) + continue; + object value = caste.GetSlot(slot); + if (slot != CasteSlot.MedCare && !PolicyExists(value as Policy)) + { + missing = true; + continue; + } + if (WriteSlot(pawn, slot, value)) + applied.Add(slot); + } + if (missing) + CasteManager.UnmanageMissingPolicies(caste); + return applied; + } + + /// Writes one slot value if the pawn can take it. Null policies and medCare -1 are never written. + internal static bool WriteSlot(Pawn pawn, CasteSlot slot, object value) + { + if (!CanUse(pawn, slot)) + return false; + switch (slot) + { + case CasteSlot.Apparel: + if (!(value is ApparelPolicy apparel)) + return false; + pawn.outfits.CurrentApparelPolicy = apparel; + return true; + case CasteSlot.Food: + if (!(value is FoodPolicy food)) + return false; + pawn.foodRestriction.CurrentFoodPolicy = food; + return true; + case CasteSlot.Drug: + if (!(value is DrugPolicy drug)) + return false; + pawn.drugs.CurrentPolicy = drug; + return true; + case CasteSlot.Reading: + if (!(value is ReadingPolicy reading)) + return false; + pawn.reading.CurrentPolicy = reading; + return true; + case CasteSlot.MedCare: + int care = ToMedCare(value); + if (care < 0) + return false; + pawn.playerSettings.medCare = (MedicalCareCategory)care; + return true; + default: + return false; + } + } + + /// True if the policy is still in its game database. + public static bool PolicyExists(Policy policy) + { + Game game = Current.Game; + if (policy == null || game == null) + return false; + switch (policy) + { + case ApparelPolicy a: return game.outfitDatabase?.AllOutfits?.Contains(a) == true; + case FoodPolicy f: return game.foodRestrictionDatabase?.AllFoodRestrictions?.Contains(f) == true; + case DrugPolicy d: return game.drugPolicyDatabase?.AllPolicies?.Contains(d) == true; + case ReadingPolicy r: return game.readingPolicyDatabase?.AllReadingPolicies?.Contains(r) == true; + default: return false; + } + } + + /// A med care slot value: -1 for unmanaged, otherwise a valid MedicalCareCategory. + public static int ToMedCare(object value) + { + int v; + switch (value) + { + case null: return Caste.Unmanaged; + case MedicalCareCategory c: v = (int)c; break; + case int i: v = i; break; + case byte b: v = b; break; + default: return Caste.Unmanaged; + } + return v >= (int)MedicalCareCategory.NoCare && v <= (int)MedicalCareCategory.Best ? v : Caste.Unmanaged; + } + + /// Which slot type a value belongs in; false for a value that fits no slot. + public static bool FitsSlot(CasteSlot slot, object value) + { + if (value == null) + return true; + switch (slot) + { + case CasteSlot.Apparel: return value is ApparelPolicy; + case CasteSlot.Food: return value is FoodPolicy; + case CasteSlot.Drug: return value is DrugPolicy; + case CasteSlot.Reading: return value is ReadingPolicy; + case CasteSlot.MedCare: return value is int || value is MedicalCareCategory || value is byte; + default: return false; + } + } + + public static string SlotLabel(CasteSlot slot) => ("BlaxCastes_Slot" + slot).Translate(); + + /// A slot value as the player sees it: the policy label, the med care label, or "unmanaged". + public static string ValueLabel(CasteSlot slot, object value) + { + if (slot == CasteSlot.MedCare) + { + int care = ToMedCare(value); + return care < 0 ? (string)"BlaxCastes_Unmanaged".Translate() : ((MedicalCareCategory)care).GetLabel(); + } + return value is Policy p ? p.label : (string)"BlaxCastes_Unmanaged".Translate(); + } + } +} diff --git a/Source/BlaxCastes/Compat.cs b/Source/BlaxCastes/Compat.cs new file mode 100644 index 0000000..eb286ca --- /dev/null +++ b/Source/BlaxCastes/Compat.cs @@ -0,0 +1,20 @@ +using Verse; + +namespace BlaxCastes +{ + /// + /// Shared mod detection. Castes has no hard dependency on any other mod and calls nothing in the + /// sibling Blax mods; they reach Castes, never the other way round. + /// + public static class Compat + { + public const string BlaxSlaves = "blax.slaves"; + public const string BlaxZones = "blax.zones"; + + /// + /// Active by packageId, local or Steam copy. ModsConfig.IsActive misses a mod that is installed + /// both ways (the Steam copy gets a "_steam" postfix), so nothing in Blax Castes uses it. + /// + public static bool IsActive(string packageId) => ModLister.GetActiveModWithIdentifier(packageId, ignorePostfix: true) != null; + } +} diff --git a/Source/BlaxCastes/Dialog_JoinDefaults.cs b/Source/BlaxCastes/Dialog_JoinDefaults.cs new file mode 100644 index 0000000..85f2053 --- /dev/null +++ b/Source/BlaxCastes/Dialog_JoinDefaults.cs @@ -0,0 +1,138 @@ +using System.Collections.Generic; +using RimWorld; +using UnityEngine; +using Verse; + +namespace BlaxCastes +{ + /// + /// The join defaults window, laid out like the vanilla medical defaults: a title, a short text, then + /// one row per way of joining with a label on the left and a caste picker on the right. Picks go + /// through CasteManager.SetJoinRow. The slave rows are hidden without Ideology. + /// + public class Dialog_JoinDefaults : Window + { + private const float LabelWidth = 200f; + private const float ButtonWidth = 160f; + private const float RowHeight = 28f; + private const float RowStep = 34f; + + public Dialog_JoinDefaults() + { + forcePause = true; + doCloseX = true; + doCloseButton = true; + closeOnClickedOutside = true; + absorbInputAroundWindow = true; + } + + public override Vector2 InitialSize => new Vector2(406f, 470f); + + public override string CloseButtonText => "OK".Translate(); + + /// The rows the window shows: all five with Ideology, without the slave rows otherwise. + public static List VisibleRows() + { + var rows = new List(); + foreach (string reason in JoinReason.Rows) + { + if (!ModsConfig.IdeologyActive && (reason == JoinReason.BoughtSlave || reason == JoinReason.NewSlave)) + continue; + rows.Add(reason); + } + return rows; + } + + public override void DoWindowContents(Rect inRect) + { + GameComponent_BlaxCastes comp = GameComponent_BlaxCastes.Instance; + float y = 0f; + using (new TextBlock(GameFont.Medium)) + Widgets.Label(inRect, ref y, "BlaxCastes_JoinDefaultsTitle".Translate()); + Text.Font = GameFont.Small; + Widgets.Label(inRect, ref y, "BlaxCastes_JoinDefaultsDesc".Translate()); + if (comp == null) + return; + if (!JoinDefaults.Active) + { + y += 4f; + using (new TextBlock(ColorLibrary.RedReadable)) + Widgets.Label(inRect, ref y, "BlaxCastes_JoinDefaultsOff".Translate()); + } + if (comp.Castes.Count == 0) + { + y += 4f; + using (new TextBlock(ColoredText.SubtleGrayColor)) + Widgets.Label(inRect, ref y, "BlaxCastes_JoinDefaultsNoCastes".Translate()); + } + y += 10f; + + Text.Anchor = TextAnchor.MiddleLeft; + foreach (string reason in VisibleRows()) + DoRow(inRect, ref y, reason); + Text.Anchor = TextAnchor.UpperLeft; + } + + private static void DoRow(Rect inRect, ref float y, string reason) + { + var row = new Rect(inRect.x, y, inRect.width, RowHeight); + var label = new Rect(inRect.x, y, LabelWidth, RowHeight); + var button = new Rect(inRect.xMax - ButtonWidth, y, ButtonWidth, RowHeight); + if (Mouse.IsOver(row)) + Widgets.DrawLightHighlight(row); + TooltipHandler.TipRegionByKey(row, "BlaxCastes_RowTip_" + reason); + Widgets.LabelFit(label, ("BlaxCastes_Row_" + reason).Translate()); + if (Widgets.ButtonText(button, RowButtonLabel(reason).Truncate(button.width - 12f))) + Find.WindowStack.Add(new FloatMenu(RowMenu(reason))); + y += RowStep; + } + + /// The picker's label: No caste, Default caste (with the default's name) or the caste's name. + public static string RowButtonLabel(string reason) + { + GameComponent_BlaxCastes comp = GameComponent_BlaxCastes.Instance; + if (comp == null) + return "BlaxCastes_NoCaste".Translate(); + JoinRow row = comp.GetRow(reason); + switch (row.mode) + { + case JoinRowMode.DefaultCaste: + return comp.HasCaste(comp.DefaultCaste) + ? "BlaxCastes_DefaultCasteNamed".Translate(comp.DefaultCaste.label.Named("CASTE")) + : "BlaxCastes_DefaultCasteNone".Translate(); + case JoinRowMode.SpecificCaste: + return comp.HasCaste(row.caste) ? row.caste.label : (string)"BlaxCastes_NoCaste".Translate(); + default: + return "BlaxCastes_NoCaste".Translate(); + } + } + + /// The picker's menu: No caste, Default caste, then every caste. Public so tests can invoke entries. + public static List RowMenu(string reason) + { + var options = new List + { + new FloatMenuOption("BlaxCastes_NoCaste".Translate(), () => CasteManager.SetJoinRow(reason, JoinRowMode.NoCaste)), + new FloatMenuOption(DefaultOptionLabel(), () => CasteManager.SetJoinRow(reason, JoinRowMode.DefaultCaste)), + }; + GameComponent_BlaxCastes comp = GameComponent_BlaxCastes.Instance; + if (comp != null) + { + foreach (Caste caste in comp.Castes) + { + Caste c = caste; + options.Add(new FloatMenuOption(c.label, () => CasteManager.SetJoinRow(reason, JoinRowMode.SpecificCaste, c))); + } + } + return options; + } + + private static string DefaultOptionLabel() + { + GameComponent_BlaxCastes comp = GameComponent_BlaxCastes.Instance; + return comp != null && comp.HasCaste(comp.DefaultCaste) + ? "BlaxCastes_DefaultCasteNamed".Translate(comp.DefaultCaste.label.Named("CASTE")) + : "BlaxCastes_DefaultCasteNone".Translate(); + } + } +} diff --git a/Source/BlaxCastes/Dialog_ManageCastes.cs b/Source/BlaxCastes/Dialog_ManageCastes.cs new file mode 100644 index 0000000..c6bdbbc --- /dev/null +++ b/Source/BlaxCastes/Dialog_ManageCastes.cs @@ -0,0 +1,286 @@ +using System.Collections.Generic; +using RimWorld; +using UnityEngine; +using Verse; + +namespace BlaxCastes +{ + /// + /// The caste manager, built on the vanilla policy manager: the base class draws the caste list and + /// handles new, duplicate, rename, delete (with its confirm) and make default. The right side has one + /// row per slot: a managed checkbox, a dropdown and a pencil that opens the vanilla policy editor. + /// Every change goes through CasteManager, so member sync and the delete rules always apply. + /// The base layout changed in 1.6, so DoContentsRect only draws inside the rect it is given. + /// + public class Dialog_ManageCastes : Dialog_ManagePolicies + { + private const float RowHeight = 32f; + private const float RowGap = 6f; + private const float SlotLabelWidth = 110f; + private const float IconSize = 24f; + private const float Gap = 8f; + + private static readonly List NoCastes = new List(); + private static Texture2D[] medCareIcons; + + public Dialog_ManageCastes() : this(null) + { + } + + /// Opens with the given caste selected, or with none selected when it is null. + public Dialog_ManageCastes(Caste caste) : base(caste) + { + } + + protected override string TitleKey => "BlaxCastes_ManageCastesTitle"; + + protected override string TipKey => "BlaxCastes_ManageCastesTip"; + + public override Vector2 InitialSize => new Vector2(700f, 540f); + + private static GameComponent_BlaxCastes Comp => GameComponent_BlaxCastes.Instance; + + public override void DoWindowContents(Rect inRect) + { + GameComponent_BlaxCastes comp = Comp; + // A policy deleted in a vanilla editor opened from here must not stay in a caste slot. + CasteManager.CheckPolicies(comp); + if (SelectedPolicy != null && (comp == null || !comp.HasCaste(SelectedPolicy))) + SelectedPolicy = null; + base.DoWindowContents(inRect); + } + + // ---- base class hooks ------------------------------------------------------------------ + + /// A new caste with the next free id, labelled "Caste N", managing nothing. + protected override Caste CreateNewPolicy() => CasteManager.CreateCaste(); + + protected override List GetPolicies() => Comp?.Castes ?? NoCastes; + + protected override Caste GetDefaultPolicy() => Comp?.DefaultCaste; + + protected override void SetDefaultPolicy(Caste policy) => CasteManager.SetDefault(policy); + + /// Members become casteless and keep their policies; rows pointing at the caste fall back to No caste. + protected override AcceptanceReport TryDeletePolicy(Caste policy) + { + if (CasteManager.DeleteCaste(policy)) + return AcceptanceReport.WasAccepted; + return "BlaxCastes_DeleteFailed".Translate(policy?.label ?? ""); + } + + protected override void DoContentsRect(Rect rect) + { + Caste caste = SelectedPolicy; + if (caste == null) + return; + float y = rect.y; + foreach (CasteSlot slot in CasteUtility.AllSlots) + { + DoSlotRow(new Rect(rect.x, y, rect.width, RowHeight), caste, slot); + y += RowHeight + RowGap; + } + y += Gap; + if (y < rect.yMax) + { + using (new TextBlock(GameFont.Tiny, Color.gray)) + Widgets.Label(new Rect(rect.x, y, rect.width, rect.yMax - y), "BlaxCastes_ManagerHint".Translate()); + } + } + + // ---- slot rows ----------------------------------------------------------------------- + + private static void DoSlotRow(Rect row, Caste caste, CasteSlot slot) + { + float iconY = row.y + (row.height - IconSize) / 2f; + Rect labelRect = new Rect(row.x, row.y, SlotLabelWidth, row.height); + Rect checkRect = new Rect(labelRect.xMax, iconY, IconSize, IconSize); + Rect pencilRect = new Rect(row.xMax - IconSize, iconY, IconSize, IconSize); + Rect dropRect = new Rect(checkRect.xMax + Gap, row.y + 2f, 0f, row.height - 4f); + dropRect.xMax = pencilRect.x - Gap; + + if (Mouse.IsOver(row)) + Widgets.DrawHighlight(row); + + using (new TextBlock(TextAnchor.MiddleLeft)) + Widgets.Label(labelRect, CasteUtility.SlotLabel(slot).Truncate(labelRect.width)); + + bool managed = caste.IsManaged(slot); + bool wasManaged = managed; + Widgets.Checkbox(checkRect.x, checkRect.y, ref managed, IconSize); + TooltipHandler.TipRegion(checkRect, "BlaxCastes_ManagedTip".Translate()); + if (managed != wasManaged) + SetManaged(caste, slot, managed); + + string valueLabel = CasteUtility.ValueLabel(slot, caste.GetSlot(slot)).CapitalizeFirst(); + if (slot == CasteSlot.MedCare) + { + Widgets.Dropdown(dropRect, caste, c => c.MedCare, c => MedCareMenu(c), valueLabel.Truncate(dropRect.width)); + return; + } + + Widgets.Dropdown(dropRect, caste, c => c.GetSlot(slot) as Policy, c => PolicyMenu(c, slot), valueLabel.Truncate(dropRect.width)); + if (Widgets.ButtonImage(pencilRect, TexButton.Rename, tooltip: EditorTip(slot))) + OpenPolicyEditor(slot, caste.GetSlot(slot) as Policy); + } + + /// The vanilla Assign tab's "Manage ... policies" text for the slot's editor. + private static string EditorTip(CasteSlot slot) + { + switch (slot) + { + case CasteSlot.Apparel: return "ManageApparelPolicies".Translate(); + case CasteSlot.Food: return "ManageFoodPolicies".Translate(); + case CasteSlot.Drug: return "ManageDrugPolicies".Translate(); + case CasteSlot.Reading: return "ManageReadingPolicies".Translate(); + default: return null; + } + } + + private static IEnumerable> PolicyMenu(Caste caste, CasteSlot slot) + { + yield return new Widgets.DropdownMenuElement + { + option = new FloatMenuOption("BlaxCastes_Unmanaged".Translate(), () => CasteManager.SetSlot(caste, slot, null)), + payload = null, + }; + foreach (Policy policy in PoliciesFor(slot)) + { + Policy local = policy; + yield return new Widgets.DropdownMenuElement + { + option = new FloatMenuOption(local.label, () => CasteManager.SetSlot(caste, slot, local)), + payload = local, + }; + } + } + + private static IEnumerable> MedCareMenu(Caste caste) + { + yield return new Widgets.DropdownMenuElement + { + option = new FloatMenuOption("BlaxCastes_Unmanaged".Translate(), () => CasteManager.SetSlot(caste, CasteSlot.MedCare, null)), + payload = Caste.Unmanaged, + }; + for (int i = (int)MedicalCareCategory.NoCare; i <= (int)MedicalCareCategory.Best; i++) + { + var care = (MedicalCareCategory)i; + yield return new Widgets.DropdownMenuElement + { + option = new FloatMenuOption(care.GetLabel().CapitalizeFirst(), () => CasteManager.SetSlot(caste, CasteSlot.MedCare, care), MedCareIcon(care), Color.white), + payload = i, + }; + } + } + + /// The same icons the vanilla medical care button uses. Loaded on first draw. + private static Texture2D MedCareIcon(MedicalCareCategory care) + { + if (medCareIcons == null) + { + medCareIcons = new[] + { + ContentFinder.Get("UI/Icons/Medical/NoCare", reportFailure: false), + ContentFinder.Get("UI/Icons/Medical/NoMeds", reportFailure: false), + ThingDefOf.MedicineHerbal?.uiIcon, + ThingDefOf.MedicineIndustrial?.uiIcon, + ThingDefOf.MedicineUltratech?.uiIcon, + }; + } + int i = (int)care; + return i >= 0 && i < medCareIcons.Length ? medCareIcons[i] : null; + } + + private static void OpenPolicyEditor(CasteSlot slot, Policy policy) + { + switch (slot) + { + case CasteSlot.Apparel: + Find.WindowStack.Add(new Dialog_ManageApparelPolicies(policy as ApparelPolicy)); + break; + case CasteSlot.Food: + Find.WindowStack.Add(new Dialog_ManageFoodPolicies(policy as FoodPolicy)); + break; + case CasteSlot.Drug: + Find.WindowStack.Add(new Dialog_ManageDrugPolicies(policy as DrugPolicy)); + break; + case CasteSlot.Reading: + Find.WindowStack.Add(new Dialog_ManageReadingPolicies(policy as ReadingPolicy)); + break; + } + } + + // ---- helpers the rows use; public so the tests can drive them -------------------------- + + /// The game's policies that fit a slot, in database order. Empty for MedCare. + public static IEnumerable PoliciesFor(CasteSlot slot) + { + Game game = Current.Game; + if (game == null) + yield break; + IEnumerable source; + switch (slot) + { + case CasteSlot.Apparel: source = game.outfitDatabase?.AllOutfits; break; + case CasteSlot.Food: source = game.foodRestrictionDatabase?.AllFoodRestrictions; break; + case CasteSlot.Drug: source = game.drugPolicyDatabase?.AllPolicies; break; + case CasteSlot.Reading: source = game.readingPolicyDatabase?.AllReadingPolicies; break; + default: source = null; break; + } + if (source == null) + yield break; + foreach (Policy p in source) + { + if (p != null) + yield return p; + } + } + + /// + /// What ticking the managed box sets: the database's default policy, or the colonist default + /// medical care. Null when no game is loaded. + /// + public static object DefaultValue(CasteSlot slot) + { + Game game = Current.Game; + if (game == null) + return null; + switch (slot) + { + case CasteSlot.Apparel: return game.outfitDatabase?.DefaultOutfit(); + case CasteSlot.Food: return game.foodRestrictionDatabase?.DefaultFoodRestriction(); + case CasteSlot.Drug: return game.drugPolicyDatabase?.DefaultDrugPolicy(); + case CasteSlot.Reading: return game.readingPolicyDatabase?.DefaultReadingPolicy(); + case CasteSlot.MedCare: return (int)(game.playSettings?.defaultCareForColonist ?? MedicalCareCategory.Best); + default: return null; + } + } + + /// + /// The managed checkbox. Ticking a slot sets the default value (members follow, see + /// CasteManager.SetSlot); unticking leaves every pawn as it is. Returns how many members moved. + /// + public static int SetManaged(Caste caste, CasteSlot slot, bool managed) + { + if (caste == null || caste.IsManaged(slot) == managed) + return 0; + return CasteManager.SetSlot(caste, slot, managed ? DefaultValue(slot) : null); + } + + // ---- first-load message ---------------------------------------------------------------- + + /// + /// Posts the message that points to Assign > Manage castes. The game component calls this once + /// per save and stores the result. Returns false (try again on the next load) while the Caste + /// column is turned off, because the message would point to a button that is not there. + /// + public static bool ShowFirstLoadMessage() + { + if (BlaxCastesMod.Settings != null && !BlaxCastesMod.Settings.showAssignColumn) + return false; + string text = "BlaxCastes_FirstLoadMessage".Translate(); + LongEventHandler.ExecuteWhenFinished(() => Messages.Message(text, MessageTypeDefOf.NeutralEvent)); + return true; + } + } +} diff --git a/Source/BlaxCastes/GameComponent_BlaxCastes.cs b/Source/BlaxCastes/GameComponent_BlaxCastes.cs new file mode 100644 index 0000000..17b58a7 --- /dev/null +++ b/Source/BlaxCastes/GameComponent_BlaxCastes.cs @@ -0,0 +1,343 @@ +using System; +using System.Collections.Generic; +using RimWorld.Planet; +using Verse; + +namespace BlaxCastes +{ + /// + /// All Blax Castes state for one game: the castes, the default caste, the memberships, the join rows + /// and the join queue. Nothing is stored on vanilla objects; the only vanilla data Castes writes is a + /// pawn's own policy fields. Read through the properties; change through CasteManager. + /// Added to a running save by Game.ExposeData (FillComponents), so adding the mod mid-save works. + /// + public class GameComponent_BlaxCastes : GameComponent + { + public const int SweepInterval = 2500; + + private List castes = new List(); + private int nextCasteId = 1; + private Caste defaultCaste; + private Dictionary memberships = new Dictionary(); + private List joinRows = new List(); + private List joinQueue = new List(); + private bool firstLoadMessageShown; + + private List membershipKeys; + private List membershipValues; + + private static GameComponent_BlaxCastes cached; + private static Game cachedGame; + private static bool tickErrorLogged; + + public GameComponent_BlaxCastes() + { + EnsureRows(); + } + + public GameComponent_BlaxCastes(Game game) : this() + { + } + + /// The component of the running game, or null when no game is loaded. + public static GameComponent_BlaxCastes Instance + { + get + { + Game game = Current.Game; + if (game == null) + { + // Don't keep the last game alive from the main menu. + cached = null; + cachedGame = null; + return null; + } + if (cachedGame == game && cached != null) + return cached; + GameComponent_BlaxCastes found = game.GetComponent(); + if (found != null) + { + cached = found; + cachedGame = game; + } + return found; + } + } + + /// The castes in display order. Do not change the list; use CasteManager. + public List Castes => castes; + + /// What join rows set to "Default caste" use. Null: those rows act as No caste. + public Caste DefaultCaste => defaultCaste; + + public IReadOnlyDictionary Memberships => memberships; + + public IReadOnlyList JoinRows => joinRows; + + /// Joins waiting for the next tick. Owned by JoinDefaults. + public List JoinQueue => joinQueue; + + public int NextCasteId => nextCasteId; + + /// The message that points to Assign > Manage castes was posted in this save. + public bool FirstLoadMessageShown => firstLoadMessageShown; + + // ---- lookups ----------------------------------------------------------------------- + + public CasteMembership MembershipOf(Pawn pawn) + { + if (pawn == null) + return null; + memberships.TryGetValue(pawn, out CasteMembership m); + return m; + } + + /// The pawn's caste, or null when it has none or is casteless by choice. + public Caste CasteOf(Pawn pawn) => MembershipOf(pawn)?.caste; + + public List MembersOf(Caste caste) + { + var result = new List(); + if (caste == null) + return result; + foreach (KeyValuePair kv in memberships) + { + if (kv.Key != null && kv.Value != null && kv.Value.caste == caste) + result.Add(kv.Key); + } + return result; + } + + public bool HasCaste(Caste caste) => caste != null && castes.Contains(caste); + + /// The row for a join reason, created at No caste if the save has none yet. + public JoinRow GetRow(string reason) + { + for (int i = 0; i < joinRows.Count; i++) + { + if (joinRows[i].reason == reason) + return joinRows[i]; + } + var row = new JoinRow(reason); + joinRows.Add(row); + return row; + } + + /// The caste a join row puts a pawn into, or null for No caste. + public Caste ResolveRow(string reason) + { + JoinRow row = GetRow(reason); + switch (row.mode) + { + case JoinRowMode.DefaultCaste: + return HasCaste(defaultCaste) ? defaultCaste : null; + case JoinRowMode.SpecificCaste: + return HasCaste(row.caste) ? row.caste : null; + default: + return null; + } + } + + // ---- writes, for CasteManager only ------------------------------------------------ + + internal int TakeNextId() + { + int max = 0; + foreach (Caste c in castes) + { + if (c != null && c.id > max) + max = c.id; + } + if (nextCasteId <= max) + nextCasteId = max + 1; + return nextCasteId++; + } + + internal void AddCaste(Caste caste) => castes.Add(caste); + + internal void RemoveCaste(Caste caste) => castes.Remove(caste); + + internal void SetDefaultRaw(Caste caste) => defaultCaste = caste; + + internal void SetMembership(Pawn pawn, CasteMembership membership) => memberships[pawn] = membership; + + internal bool RemoveMembership(Pawn pawn) => pawn != null && memberships.Remove(pawn); + + internal void SetRowRaw(string reason, JoinRowMode mode, Caste caste) + { + JoinRow row = GetRow(reason); + row.mode = mode; + row.caste = mode == JoinRowMode.SpecificCaste ? caste : null; + } + + // ---- upkeep ------------------------------------------------------------------------ + + /// + /// Drops membership and queue entries whose pawn is null, discarded, or destroyed without being + /// dead. A dead pawn keeps its caste in case it is resurrected, as long as its corpse or the + /// world still holds it, so its reference resolves on load. Returns the number removed. + /// + public int Purge() + { + int removed = 0; + List gone = null; + foreach (KeyValuePair kv in memberships) + { + if (IsGone(kv.Key) || kv.Value == null) + (gone ??= new List()).Add(kv.Key); + } + if (gone != null) + { + foreach (Pawn p in gone) + { + if (memberships.Remove(p)) + removed++; + } + } + removed += joinQueue.RemoveAll(q => q == null || IsGone(q.pawn)); + return removed; + } + + public static bool IsGone(Pawn pawn) + { + if (pawn == null || pawn.Discarded) + return true; + if (!pawn.Destroyed) + return false; + if (!pawn.Dead) + return true; + return pawn.Corpse == null && !pawn.IsWorldPawn(); + } + + /// Ends the memberships of pawns that are no longer player faction or player prisoners. + public int Sweep() + { + Purge(); + List left = null; + foreach (Pawn p in memberships.Keys) + { + if (!CasteUtility.IsPlayerSide(p)) + (left ??= new List()).Add(p); + } + if (left == null) + return 0; + foreach (Pawn p in left) + CasteManager.EndMembership(p); + return left.Count; + } + + public override void GameComponentTick() + { + try + { + JoinDefaults.ApplyQueue(); + if (Find.TickManager.TicksGame % SweepInterval == 0) + Sweep(); + } + catch (Exception e) + { + if (!tickErrorLogged) + { + tickErrorLogged = true; + Log.Error("[Blax Castes] Tick failed (logged once): " + e); + } + } + } + + public override void FinalizeInit() + { + cached = this; + cachedGame = Current.Game; + } + + public override void StartedNewGame() => ShowFirstLoadMessageOnce(); + + public override void LoadedGame() => ShowFirstLoadMessageOnce(); + + /// The message that points to Assign > Manage castes, once per save. + private void ShowFirstLoadMessageOnce() + { + try + { + if (!firstLoadMessageShown) + firstLoadMessageShown = Dialog_ManageCastes.ShowFirstLoadMessage(); + } + catch (Exception e) + { + Log.Error("[Blax Castes] First-load message failed: " + e); + } + } + + // ---- save -------------------------------------------------------------------------- + + public override void ExposeData() + { + if (Scribe.mode == LoadSaveMode.Saving) + { + Purge(); + CasteManager.CheckPolicies(this); + } + + Scribe_Collections.Look(ref castes, "castes", LookMode.Deep); + Scribe_Values.Look(ref nextCasteId, "nextCasteId", 1); + Scribe_References.Look(ref defaultCaste, "defaultCaste"); + Scribe_Collections.Look(ref memberships, "memberships", LookMode.Reference, LookMode.Deep, + ref membershipKeys, ref membershipValues, logNullErrors: false, saveDestroyedKeys: true); + Scribe_Collections.Look(ref joinRows, "joinRows", LookMode.Deep); + Scribe_Collections.Look(ref joinQueue, "joinQueue", LookMode.Deep); + Scribe_Values.Look(ref firstLoadMessageShown, "firstLoadMessageShown"); + + if (Scribe.mode == LoadSaveMode.LoadingVars) + { + cached = this; + cachedGame = Current.Game; + } + if (Scribe.mode == LoadSaveMode.PostLoadInit) + { + EnsureState(); + Purge(); + CasteManager.CheckPolicies(this); + } + } + + /// Missing lists (older saves), null entries and rows that point at nothing. + private void EnsureState() + { + castes ??= new List(); + castes.RemoveAll(c => c == null); + memberships ??= new Dictionary(); + joinRows ??= new List(); + joinRows.RemoveAll(r => r == null || r.reason.NullOrEmpty()); + joinQueue ??= new List(); + EnsureRows(); + if (defaultCaste != null && !castes.Contains(defaultCaste)) + defaultCaste = null; + foreach (JoinRow row in joinRows) + { + if (row.mode == JoinRowMode.SpecificCaste && !HasCaste(row.caste)) + { + row.mode = JoinRowMode.NoCaste; + row.caste = null; + } + if (row.mode != JoinRowMode.SpecificCaste) + row.caste = null; + } + foreach (CasteMembership m in memberships.Values) + { + if (m != null && m.caste != null && !castes.Contains(m.caste)) + m.caste = null; + } + foreach (Caste c in castes) + { + if (c.id >= nextCasteId) + nextCasteId = c.id + 1; + } + } + + private void EnsureRows() + { + foreach (string reason in JoinReason.Rows) + GetRow(reason); + } + } +} diff --git a/Source/BlaxCastes/JoinDefaults.cs b/Source/BlaxCastes/JoinDefaults.cs new file mode 100644 index 0000000..e89bce7 --- /dev/null +++ b/Source/BlaxCastes/JoinDefaults.cs @@ -0,0 +1,342 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using RimWorld; +using Verse; + +namespace BlaxCastes +{ + /// Which player-side status a pawn has, for join classification. + public enum JoinSide + { + None, + Colonist, + Slave, + Prisoner, + } + + /// + /// Join defaults: puts a pawn that joins into the caste of its join row. + /// + /// The join hooks (JoinHooks: Pawn.SetFaction, Pawn_GuestTracker.SetGuestStatus, Pawn.PreTraded) + /// classify the join where it happens and call Enqueue with the innermost scope's reason, or with + /// StatusFallback. The queue lives in GameComponent_BlaxCastes.JoinQueue, so it survives a save. + /// GameComponentTick calls ApplyQueue every tick, which applies entries queued on an earlier tick: + /// never inside SetFaction or SetGuestStatus, and only while the pawn is still player-side. + /// + /// Reason to row, first match wins: the scope ("bought": the final status picks bought as slave or + /// bought as colonist; a row id is used as it is), then the status fallback from the final status: + /// new colonist, new slave or new prisoner. + /// + public static class JoinDefaults + { + /// Queue reason when no scope covered the join: the final status picks the row. + public const string StatusFallback = "status"; + + // Pawns that left the player side, checked on the next ApplyQueue. Not saved: the 2500-tick + // sweep ends any membership a save cut short. + private static readonly HashSet left = new HashSet(); + private static Game leftGame; + + private static GameComponent_BlaxCastes Comp => GameComponent_BlaxCastes.Instance; + + private static int Now => Find.TickManager?.TicksGame ?? 0; + + /// Castes is on and the join defaults setting is on. + public static bool Active => + BlaxCastesMod.Enabled && (BlaxCastesMod.Settings == null || BlaxCastesMod.Settings.enableJoinDefaults); + + // ---- classification ---------------------------------------------------------------- + + public static JoinSide SideOf(Pawn pawn) + { + if (pawn == null) + return JoinSide.None; + Pawn_GuestTracker guest = pawn.guest; + return Classify(pawn.Faction, guest != null, guest != null ? guest.guestStatusInt : GuestStatus.Guest, guest?.HostFaction); + } + + /// + /// Player faction: slave, prisoner of the colony (an arrested colonist) or colonist (also one held + /// by another faction, so it keeps its caste when it comes back). Another faction: prisoner of the + /// colony or nothing. + /// + internal static JoinSide Classify(Faction faction, bool hasGuest, GuestStatus status, Faction host) + { + Faction player = Faction.OfPlayerSilentFail; + if (player == null) + return JoinSide.None; + bool prisonerOfColony = hasGuest && status == GuestStatus.Prisoner && host == player; + if (faction == player) + { + if (hasGuest && status == GuestStatus.Slave) + return JoinSide.Slave; + return prisonerOfColony ? JoinSide.Prisoner : JoinSide.Colonist; + } + return prisonerOfColony ? JoinSide.Prisoner : JoinSide.None; + } + + /// Humanlike, not a baby, not a quest lodger, not a mutant without policies. Others never join a caste. + public static bool Eligible(Pawn pawn) => + pawn != null && pawn.RaceProps != null && pawn.RaceProps.Humanlike + && !pawn.DevelopmentalStage.Baby() && !pawn.IsQuestLodger() + && !(pawn.IsMutant && pawn.mutant.Def.disablePolicies); + + /// A scope reason or a row id, as opposed to the status fallback. + public static bool IsSpecific(string reason) => !reason.NullOrEmpty() && reason != StatusFallback; + + /// + /// The join row a queued reason resolves to for the pawn's status now, or null when the pawn has + /// no player-side status. + /// + public static string RowFor(string reason, Pawn pawn) + { + JoinSide side = SideOf(pawn); + if (reason == JoinScopes.Bought) + { + if (side == JoinSide.Slave) + return JoinReason.BoughtSlave; + if (side == JoinSide.Colonist) + return JoinReason.BoughtColonist; + } + else if (JoinReason.IsRow(reason)) + { + return reason; + } + switch (side) + { + case JoinSide.Colonist: return JoinReason.NewColonist; + case JoinSide.Slave: return JoinReason.NewSlave; + case JoinSide.Prisoner: return JoinReason.NewPrisoner; + default: return null; + } + } + + // ---- queue ------------------------------------------------------------------------- + + /// The pawn's waiting join, or null. + public static QueuedJoin QueuedFor(Pawn pawn) + { + GameComponent_BlaxCastes comp = Comp; + if (comp == null || pawn == null) + return null; + List queue = comp.JoinQueue; + for (int i = 0; i < queue.Count; i++) + { + if (queue[i] != null && queue[i].pawn == pawn) + return queue[i]; + } + return null; + } + + /// True while the pawn waits for its join to be applied (the column's "pending"). + public static bool IsQueued(Pawn pawn) => QueuedFor(pawn) != null; + + /// + /// Queues a join for the next tick: a scope reason, a row id or StatusFallback. One entry per pawn; + /// a specific reason replaces a status fallback, never the other way round. Does nothing while + /// Castes or the join defaults are off, and for pawns that never join a caste. + /// + public static void Enqueue(Pawn pawn, string reason) + { + if (!Active || pawn == null) + return; + GameComponent_BlaxCastes comp = Comp; + if (comp == null || GameComponent_BlaxCastes.IsGone(pawn) || !Eligible(pawn)) + return; + if (reason.NullOrEmpty()) + reason = StatusFallback; + left.Remove(pawn); + int now = Now; + QueuedJoin queued = QueuedFor(pawn); + if (queued == null) + { + comp.JoinQueue.Add(new QueuedJoin(pawn, reason, now)); + return; + } + if (IsSpecific(reason) || !IsSpecific(queued.reason)) + queued.reason = reason; + if (now > queued.tick) + queued.tick = now; + } + + /// A pawn left the player side. Its membership ends on the next tick if it has not come back. + internal static void NoteLeft(Pawn pawn) + { + if (pawn == null || Current.Game == null) + return; + if (leftGame != Current.Game) + { + left.Clear(); + leftGame = Current.Game; + } + left.Add(pawn); + } + + /// + /// Applies the joins queued on an earlier tick and ends the memberships of pawns that left. + /// Called by GameComponent_BlaxCastes every tick. + /// + public static void ApplyQueue() + { + GameComponent_BlaxCastes comp = Comp; + if (comp == null || Find.TickManager == null) + return; + EndLeftMemberships(); + List queue = comp.JoinQueue; + if (queue.Count == 0) + return; + + int now = Now; + List due = null; + foreach (QueuedJoin q in queue) + { + if (q == null || q.tick < now) + (due ??= new List()).Add(q); + } + if (due == null) + return; + queue.RemoveAll(q => q == null || q.tick < now); + + Dictionary> joined = null; + foreach (QueuedJoin q in due) + { + if (q == null) + continue; + try + { + Caste caste = ApplyOne(comp, q); + if (caste != null) + { + joined ??= new Dictionary>(); + if (!joined.TryGetValue(caste, out List pawns)) + joined[caste] = pawns = new List(); + pawns.Add(q.pawn); + } + } + catch (Exception e) + { + JoinHooks.LogOnce("Applying a join", e); + } + } + if (joined != null) + SendMessages(joined); + } + + /// Applies one join. Returns the caste the pawn joined, or null. + private static Caste ApplyOne(GameComponent_BlaxCastes comp, QueuedJoin q) + { + Pawn pawn = q.pawn; + if (GameComponent_BlaxCastes.IsGone(pawn) || pawn.Dead || pawn.Destroyed) + return null; + if (!CasteUtility.IsPlayerSide(pawn)) + { + // Sold, released or gone over to another faction before the join was applied. + CasteManager.EndMembership(pawn); + return null; + } + if (!Active || !Eligible(pawn)) + return null; + + CasteMembership membership = comp.MembershipOf(pawn); + // A caste picked by hand after the join was queued wins over the join row. + if (membership != null && !membership.auto && membership.reason != JoinReason.CasteDeleted && membership.tick >= q.tick) + return null; + + string row = RowFor(q.reason, pawn); + if (row == null) + return null; + Caste caste = comp.ResolveRow(row); + if (caste != null) + return CasteManager.Assign(pawn, caste, true, row) ? caste : null; + + if (membership?.caste != null) + LeaveCaste(pawn, membership.caste); + return null; + } + + /// + /// The pawn's join row is No caste while it was in a caste: it leaves the caste. With revertOnLeave + /// the caste's managed slots go back to the database defaults and medical care is reset, so a + /// recruited prisoner does not keep the prisoner food. + /// + private static void LeaveCaste(Pawn pawn, Caste caste) + { + CasteManager.EndMembership(pawn); + if (!BlaxCastesMod.Enabled || (BlaxCastesMod.Settings != null && !BlaxCastesMod.Settings.revertOnLeave)) + return; + foreach (CasteSlot slot in CasteUtility.AllSlots) + { + if (slot == CasteSlot.MedCare || !caste.IsManaged(slot)) + continue; + object value = DatabaseDefault(slot); + if (value != null) + CasteUtility.WriteSlot(pawn, slot, value); + } + pawn.playerSettings?.ResetMedicalCare(); + } + + private static object DatabaseDefault(CasteSlot slot) + { + Game game = Current.Game; + switch (slot) + { + case CasteSlot.Apparel: return game?.outfitDatabase?.DefaultOutfit(); + case CasteSlot.Food: return game?.foodRestrictionDatabase?.DefaultFoodRestriction(); + case CasteSlot.Drug: return game?.drugPolicyDatabase?.DefaultDrugPolicy(); + case CasteSlot.Reading: return game?.readingPolicyDatabase?.DefaultReadingPolicy(); + default: return null; + } + } + + private static void EndLeftMemberships() + { + if (left.Count == 0) + return; + if (leftGame != Current.Game) + { + left.Clear(); + return; + } + List pawns = left.ToList(); + left.Clear(); + foreach (Pawn pawn in pawns) + { + try + { + if (!GameComponent_BlaxCastes.IsGone(pawn) && !pawn.Dead && !CasteUtility.IsPlayerSide(pawn)) + CasteManager.EndMembership(pawn); + } + catch (Exception e) + { + JoinHooks.LogOnce("Ending a membership", e); + } + } + } + + /// One message per caste per tick, so buying ten slaves does not post ten messages. + private static void SendMessages(Dictionary> joined) + { + if (BlaxCastesMod.Settings != null && !BlaxCastesMod.Settings.joinMessages) + return; + foreach (KeyValuePair> kv in joined) + { + List pawns = kv.Value; + string text = MessageText(kv.Key, pawns); + if (!text.NullOrEmpty()) + Messages.Message(text, new LookTargets(pawns), MessageTypeDefOf.NeutralEvent, historical: false); + } + } + + /// The join message for pawns that joined one caste. + public static string MessageText(Caste caste, List pawns) + { + if (caste == null || pawns == null || pawns.Count == 0) + return null; + if (pawns.Count == 1) + return "BlaxCastes_JoinedCaste".Translate(pawns[0].Named("PAWN"), caste.label.Named("CASTE")); + string names = pawns.Select(p => p.LabelShort).ToCommaList(useAnd: true); + return "BlaxCastes_JoinedCasteMany".Translate(pawns.Count.Named("COUNT"), caste.label.Named("CASTE"), names.Named("PAWNS")); + } + } +} diff --git a/Source/BlaxCastes/JoinHooks.cs b/Source/BlaxCastes/JoinHooks.cs new file mode 100644 index 0000000..f26ea6f --- /dev/null +++ b/Source/BlaxCastes/JoinHooks.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using HarmonyLib; +using RimWorld; +using Verse; + +namespace BlaxCastes +{ + /// A pawn's faction, guest status and host faction, taken before a status change. + internal struct JoinSnapshot + { + public bool valid; + public Faction faction; + public bool hasGuest; + public GuestStatus status; + public Faction host; + + public static JoinSnapshot Of(Pawn pawn) + { + Pawn_GuestTracker guest = pawn.guest; + return new JoinSnapshot + { + valid = true, + faction = pawn.Faction, + hasGuest = guest != null, + status = guest != null ? guest.guestStatusInt : GuestStatus.Guest, + host = guest?.HostFaction, + }; + } + + public JoinSide Side => JoinDefaults.Classify(faction, hasGuest, status, host); + } + + /// + /// Shared bodies of the join hooks. The prefixes snapshot the pawn, the postfixes compare. Only a + /// change into player colonist, player slave or player prisoner queues a join, so the + /// SetGuestStatus(null) that vanilla runs on existing members (inside SetFaction, before a trade) + /// queues nothing. A change out of the player side is noted, and the membership ends on the next + /// tick if the pawn is still gone by then. Nothing is applied here: SetFaction and SetGuestStatus + /// reset medical care, areas, work and slave mode right after, so joins wait for the next tick. + /// + internal static class JoinHooks + { + private static readonly HashSet logged = new HashSet(); + + /// Logs a hook failure once per hook, so a Castes bug can never break a trade or a capture. + public static void LogOnce(string where, Exception e) + { + try + { + if (logged.Add(where)) + Log.Error("[Blax Castes] " + where + " failed (logged once): " + e); + } + catch + { + } + } + + private static bool Watching(Pawn pawn) => + pawn != null && Current.Game != null && Scribe.mode == LoadSaveMode.Inactive + && pawn.RaceProps != null && pawn.RaceProps.Humanlike; + + public static JoinSnapshot Before(Pawn pawn) + { + try + { + return Watching(pawn) ? JoinSnapshot.Of(pawn) : default; + } + catch (Exception e) + { + LogOnce("Join snapshot", e); + return default; + } + } + + public static void After(Pawn pawn, JoinSnapshot before) + { + if (!before.valid) + return; + try + { + JoinSide was = before.Side; + JoinSide now = JoinSnapshot.Of(pawn).Side; + if (was == now) + return; + if (now != JoinSide.None) + JoinDefaults.Enqueue(pawn, JoinScopes.ReasonFor(pawn) ?? JoinDefaults.StatusFallback); + else + JoinDefaults.NoteLeft(pawn); + } + catch (Exception e) + { + LogOnce("Join check", e); + } + } + } + + [HarmonyPatch(typeof(Pawn), nameof(Pawn.SetFaction), new[] { typeof(Faction), typeof(Pawn) })] + internal static class Patch_Pawn_SetFaction + { + public static void Prefix(Pawn __instance, out JoinSnapshot __state) => __state = JoinHooks.Before(__instance); + + public static void Postfix(Pawn __instance, JoinSnapshot __state) => JoinHooks.After(__instance, __state); + } + + [HarmonyPatch(typeof(Pawn_GuestTracker), nameof(Pawn_GuestTracker.SetGuestStatus))] + internal static class Patch_GuestTracker_SetGuestStatus + { + public static void Prefix(Pawn ___pawn, out JoinSnapshot __state) => __state = JoinHooks.Before(___pawn); + + public static void Postfix(Pawn ___pawn, JoinSnapshot __state) => JoinHooks.After(___pawn, __state); + } + + /// + /// Buying: the pawn's status changes inside Pawn.PreTraded, so a "bought" scope covers it. The + /// finalizer pops the scope even when PreTraded throws. Blax Slaves and Trade as Slave or Colonist + /// only set guest.joinStatus before this call, so the final status (slave or not) picks the row. + /// + [HarmonyPatch(typeof(Pawn), nameof(Pawn.PreTraded))] + internal static class Patch_Pawn_PreTraded + { + public static void Prefix(Pawn __instance, TradeAction action, out int __state) + { + __state = 0; + try + { + if (action == TradeAction.PlayerBuys) + __state = JoinScopes.Push(JoinScopes.Bought, __instance); + } + catch (Exception e) + { + JoinHooks.LogOnce("Buy scope", e); + } + } + + public static Exception Finalizer(Exception __exception, int __state) + { + try + { + JoinScopes.Pop(__state); + } + catch (Exception e) + { + JoinHooks.LogOnce("Buy scope", e); + } + return __exception; + } + } +} diff --git a/Source/BlaxCastes/JoinScopes.cs b/Source/BlaxCastes/JoinScopes.cs new file mode 100644 index 0000000..f0bcb57 --- /dev/null +++ b/Source/BlaxCastes/JoinScopes.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using Verse; + +namespace BlaxCastes +{ + /// + /// Where a join happens, as a stack of scopes. A hook pushes a scope in a prefix and pops it in a + /// Harmony finalizer, so an exception inside the scope never leaves the stack dirty. When a pawn's + /// status changes, the innermost scope that covers the pawn names the join reason; without one, + /// the reason is the status fallback, resolved from the final status when the join is applied. + /// Only touched from the main thread. + /// + public static class JoinScopes + { + /// Pawn.PreTraded while the player buys. Resolves to bought as slave or bought as colonist. + public const string Bought = "bought"; + + private struct Scope + { + public string reason; + public Pawn pawn; + } + + private static readonly List stack = new List(); + + /// Open scopes. 0 outside every hooked call. + public static int Depth => stack.Count; + + /// + /// Opens a scope. With a pawn it covers only that pawn, without one it covers every pawn. + /// Returns the token Pop needs. + /// + public static int Push(string reason, Pawn pawn = null) + { + stack.Add(new Scope { reason = reason, pawn = pawn }); + return stack.Count; + } + + /// + /// Closes the scope the token came from and any scope opened inside it that was not closed. + /// Token 0 (nothing was pushed) does nothing. + /// + public static void Pop(int token) + { + if (token <= 0 || token > stack.Count) + return; + stack.RemoveRange(token - 1, stack.Count - token + 1); + } + + /// The reason of the innermost scope that covers the pawn, or null. + public static string ReasonFor(Pawn pawn) + { + for (int i = stack.Count - 1; i >= 0; i--) + { + if (stack[i].pawn == null || stack[i].pawn == pawn) + return stack[i].reason; + } + return null; + } + } +} diff --git a/Source/BlaxCastes/PawnColumnWorker_BlaxCaste.cs b/Source/BlaxCastes/PawnColumnWorker_BlaxCaste.cs new file mode 100644 index 0000000..3b7c410 --- /dev/null +++ b/Source/BlaxCastes/PawnColumnWorker_BlaxCaste.cs @@ -0,0 +1,266 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using RimWorld; +using UnityEngine; +using Verse; +using Verse.Sound; + +namespace BlaxCastes +{ + public enum CasteChoiceKind + { + /// The pawn has no membership record. Nothing in the menu matches it, so painting from it does nothing. + None, + Casteless, + Caste, + Reset, + Edit, + } + + /// + /// The dropdown payload of the Caste column. Painting copies the source cell's payload onto every + /// cell it passes and runs the menu entry with the same payload, so Reset and Edit get kinds of their + /// own and a pawn without a record paints nothing. + /// + public readonly struct CasteChoice : IEquatable + { + public readonly CasteChoiceKind Kind; + public readonly Caste Caste; + + public CasteChoice(CasteChoiceKind kind, Caste caste = null) + { + Kind = kind; + Caste = kind == CasteChoiceKind.Caste ? caste : null; + } + + public bool Equals(CasteChoice other) => Kind == other.Kind && ReferenceEquals(Caste, other.Caste); + + public override bool Equals(object obj) => obj is CasteChoice other && Equals(other); + + public override int GetHashCode() => ((int)Kind * 397) ^ (Caste?.id ?? 0); + + public override string ToString() => Kind == CasteChoiceKind.Caste ? "Caste(" + Caste?.label + ")" : Kind.ToString(); + } + + /// One entry of the cell menu. A null Action means the entry is shown but disabled. + public sealed class CasteMenuEntry + { + public CasteChoice Choice; + public string Label; + public Action Action; + } + + /// + /// The Caste column in the Assign tab, modelled on the vanilla apparel policy column. A cell shows + /// the pawn's caste ("*" when a managed slot differs from the caste), "(pending)" while a join waits + /// for the next tick, or "Unchangeable" for quest lodgers. Click to pick, or drag down to paint. + /// The header holds the "Manage castes" and "Defaults" buttons in the same 65 px area the apparel + /// column uses for its button. + /// + public class PawnColumnWorker_BlaxCaste : PawnColumnWorker + { + public const string DefName = "BlaxCastes_Caste"; + public const int TopAreaHeight = 65; + public const int MinCellWidth = 100; + public const int OptimalCellWidth = 140; + public const int MaxCellWidth = 160; + + private const float HeaderButtonHeight = 19f; + private const float HeaderButtonGap = 2f; + + private static GameComponent_BlaxCastes Comp => GameComponent_BlaxCastes.Instance; + + // ---- header ------------------------------------------------------------------------------ + + public override void DoHeader(Rect rect, PawnTable table) + { + base.DoHeader(rect, table); + MouseoverSounds.DoRegion(rect); + // Two stacked buttons above the 25 px sort area at the bottom of the header. + float top = rect.y + (rect.height - TopAreaHeight); + Rect manage = new Rect(rect.x, top, rect.width, HeaderButtonHeight); + Rect defaults = new Rect(rect.x, manage.yMax + HeaderButtonGap, rect.width, HeaderButtonHeight); + using (new TextBlock(GameFont.Tiny)) + { + if (Widgets.ButtonText(manage, "BlaxCastes_ManageCastesButton".Translate().Truncate(manage.width - 4f))) + Find.WindowStack.Add(new Dialog_ManageCastes()); + if (Widgets.ButtonText(defaults, "BlaxCastes_JoinDefaultsButton".Translate().Truncate(defaults.width - 4f))) + Find.WindowStack.Add(new Dialog_JoinDefaults()); + } + TooltipHandler.TipRegion(manage, "BlaxCastes_ManageCastesButtonTip".Translate()); + TooltipHandler.TipRegion(defaults, "BlaxCastes_JoinDefaultsButtonTip".Translate()); + } + + public override int GetMinHeaderHeight(PawnTable table) => Mathf.Max(base.GetMinHeaderHeight(table), TopAreaHeight); + + public override int GetMinWidth(PawnTable table) => Mathf.Max(base.GetMinWidth(table), MinCellWidth); + + public override int GetMaxWidth(PawnTable table) => Mathf.Max(GetMinWidth(table), Mathf.Min(base.GetMaxWidth(table), MaxCellWidth)); + + public override int GetOptimalWidth(PawnTable table) => Mathf.Clamp(OptimalCellWidth, GetMinWidth(table), GetMaxWidth(table)); + + // ---- cell -------------------------------------------------------------------------------- + + public override void DoCell(Rect rect, Pawn pawn, PawnTable table) + { + if (Comp == null || !CasteUtility.CanBeMember(pawn)) + return; + Rect cell = new Rect(rect.x, rect.y + 2f, rect.width - 4f, rect.height - 4f); + string label = CellLabel(pawn); + if (pawn.IsQuestLodger()) + { + using (new TextBlock(TextAnchor.MiddleCenter)) + Widgets.Label(cell, label.Truncate(cell.width)); + TooltipHandler.TipRegion(cell, "BlaxCastes_CellLodgerTip".Translate()); + return; + } + string dragLabel = Comp.CasteOf(pawn)?.label ?? label; + Widgets.Dropdown(cell, pawn, ChoiceOf, MenuFor, label.Truncate(cell.width), dragLabel: dragLabel, paintable: true); + if (Mouse.IsOver(cell)) + TooltipHandler.TipRegion(cell, () => CellTip(pawn), pawn.thingIDNumber ^ 0x2B1A5C); + } + + /// + /// The cell text: "Unchangeable" for quest lodgers, "(pending)" while a join is queued, the caste + /// label with "*" when a managed slot differs, "No caste" when casteless by choice, else "None". + /// + public static string CellLabel(Pawn pawn) + { + if (pawn == null) + return ""; + if (pawn.IsQuestLodger()) + return "Unchangeable".Translate(); + if (IsPending(pawn)) + return "BlaxCastes_CellPending".Translate(); + CasteMembership m = Comp?.MembershipOf(pawn); + if (m == null) + return "BlaxCastes_CellNone".Translate(); + if (m.caste == null) + return "BlaxCastes_NoCaste".Translate(); + return CasteManager.Overrides(pawn).Count > 0 ? m.caste.label + "*" : m.caste.label; + } + + /// The cell tooltip: the state, every overridden slot with both values, and how to use the cell. + public static string CellTip(Pawn pawn) + { + var sb = new StringBuilder(); + CasteMembership m = Comp?.MembershipOf(pawn); + if (IsPending(pawn)) + sb.AppendLine("BlaxCastes_CellPendingTip".Translate()); + if (m == null) + { + sb.AppendLine("BlaxCastes_CellNoneTip".Translate()); + } + else if (m.caste == null) + { + sb.AppendLine("BlaxCastes_CellCastelessTip".Translate()); + } + else + { + sb.AppendLine("BlaxCastes_CellCasteTip".Translate(m.caste.label)); + List overrides = CasteManager.Overrides(pawn); + if (overrides.Count > 0) + { + sb.AppendLine(); + sb.AppendLine("BlaxCastes_CellOverrides".Translate()); + foreach (CasteSlot slot in overrides) + { + string mine = CasteUtility.ValueLabel(slot, CasteUtility.CurrentValue(pawn, slot)); + string casteValue = CasteUtility.ValueLabel(slot, m.caste.GetSlot(slot)); + sb.AppendLine(" " + "BlaxCastes_CellOverrideLine".Translate(CasteUtility.SlotLabel(slot), mine, casteValue)); + } + } + } + sb.AppendLine(); + sb.Append("BlaxCastes_CellHint".Translate()); + return sb.ToString(); + } + + /// True while the pawn waits in the join queue for the next tick. + public static bool IsPending(Pawn pawn) => JoinDefaults.IsQueued(pawn); + + // ---- menu and painting ------------------------------------------------------------------- + + /// What the cell currently holds, as a dropdown payload. + public static CasteChoice ChoiceOf(Pawn pawn) + { + CasteMembership m = Comp?.MembershipOf(pawn); + if (m == null) + return new CasteChoice(CasteChoiceKind.None); + return m.caste == null ? new CasteChoice(CasteChoiceKind.Casteless) : new CasteChoice(CasteChoiceKind.Caste, m.caste); + } + + /// + /// The menu entries in order: No caste (casteless by choice), every caste by label, Reset to caste + /// (disabled without a caste) and Edit caste. Building them needs no GUI. + /// + public static List MenuEntries(Pawn pawn) + { + var entries = new List(); + GameComponent_BlaxCastes comp = Comp; + if (comp == null || pawn == null) + return entries; + entries.Add(new CasteMenuEntry + { + Choice = new CasteChoice(CasteChoiceKind.Casteless), + Label = "BlaxCastes_NoCaste".Translate(), + Action = () => CasteManager.MakeCasteless(pawn), + }); + foreach (Caste caste in comp.Castes.Where(c => c != null).OrderBy(c => c.label, StringComparer.CurrentCultureIgnoreCase).ThenBy(c => c.id)) + { + Caste local = caste; + entries.Add(new CasteMenuEntry + { + Choice = new CasteChoice(CasteChoiceKind.Caste, local), + Label = local.label, + Action = () => CasteManager.Assign(pawn, local, false, JoinReason.Manual), + }); + } + Caste current = comp.CasteOf(pawn); + entries.Add(new CasteMenuEntry + { + Choice = new CasteChoice(CasteChoiceKind.Reset), + Label = "BlaxCastes_MenuReset".Translate(), + Action = current == null ? null : () => CasteManager.ResetToCaste(pawn), + }); + entries.Add(new CasteMenuEntry + { + Choice = new CasteChoice(CasteChoiceKind.Edit), + Label = "BlaxCastes_MenuEdit".Translate() + "...", + Action = () => Find.WindowStack.Add(new Dialog_ManageCastes(comp.CasteOf(pawn))), + }); + return entries; + } + + private static IEnumerable> MenuFor(Pawn pawn) + { + foreach (CasteMenuEntry entry in MenuEntries(pawn)) + { + yield return new Widgets.DropdownMenuElement + { + option = new FloatMenuOption(entry.Label, entry.Action), + payload = entry.Choice, + }; + } + } + + // ---- sorting ----------------------------------------------------------------------------- + + public override int Compare(Pawn a, Pawn b) => CompareCastes(Comp?.CasteOf(a), Comp?.CasteOf(b)); + + /// By caste label, then id; pawns without a caste last. + public static int CompareCastes(Caste x, Caste y) + { + if (ReferenceEquals(x, y)) + return 0; + if (x == null) + return 1; + if (y == null) + return -1; + int byLabel = string.Compare(x.label, y.label, StringComparison.CurrentCultureIgnoreCase); + return byLabel != 0 ? byLabel : x.id.CompareTo(y.id); + } + } +} diff --git a/Tests/BlaxCastesTests/About/About.xml b/Tests/BlaxCastesTests/About/About.xml new file mode 100644 index 0000000..403b0a5 --- /dev/null +++ b/Tests/BlaxCastesTests/About/About.xml @@ -0,0 +1,20 @@ + + + Blax Castes Tests + Blax Gaming + blax.castes.tests + +
  • 1.7
  • +
    + +
  • + blax.castes + Blax Castes +
  • +
    + +
  • blax.castes
  • +
  • blax.slaves
  • +
    + In-game test suite for Blax Castes. Does nothing unless the game is started with -blaxcastestests (see Tests/run-tests.ps1). Not for players. +
    diff --git a/Tests/BlaxCastesTests/Source/BlaxCastesTests.csproj b/Tests/BlaxCastesTests/Source/BlaxCastesTests.csproj new file mode 100644 index 0000000..b8749dc --- /dev/null +++ b/Tests/BlaxCastesTests/Source/BlaxCastesTests.csproj @@ -0,0 +1,45 @@ + + + + + net10.0 + BlaxCastesTests + BlaxCastesTests + latest + disable + disable + ..\1.7\Assemblies\ + false + false + false + false + portable + $(MSBuildProjectDirectory)=Tests/BlaxCastesTests/Source + + + + E:\SteamLibrary\steamapps\common\RimWorld + E:\SteamLibrary\steamapps\workshop\content\294100\2009463077\1.7\Assemblies + $(MSBuildProjectDirectory)\..\..\..\1.7\Assemblies + + + + + $(RimWorldDir)\Assembly-CSharp.dll + false + + + $(RimWorldDir)\UnityStubs.dll + false + + + $(HarmonyDir)\0Harmony.dll + false + + + $(BlaxCastesDir)\BlaxCastes.dll + false + + + + diff --git a/Tests/BlaxCastesTests/Source/CasteTests.cs b/Tests/BlaxCastesTests/Source/CasteTests.cs new file mode 100644 index 0000000..519f708 --- /dev/null +++ b/Tests/BlaxCastesTests/Source/CasteTests.cs @@ -0,0 +1,297 @@ +using System.Collections.Generic; +using System.Linq; +using BlaxCastes; +using RimWorld; +using Verse; + +namespace BlaxCastesTests +{ + /// Applying castes to pawns: the per-slot checks, the Follow rule, the sweep and the enabled switch. + public static class CasteTests + { + // ---- policies used across tests ------------------------------------------------------ + + /// The Slave outfit with Ideology, otherwise the Soldier outfit (both differ from Anything, Worker and Nudist). + private static ApparelPolicy SlaveOrSoldier() => + Fixtures.Need(Fixtures.Outfit(ModsConfig.IdeologyActive ? "OutfitSlave" : "OutfitSoldier"), "Slave or Soldier outfit"); + + private static ApparelPolicy Worker() => Fixtures.Need(Fixtures.Outfit("OutfitWorker"), "Worker outfit"); + private static ApparelPolicy Nudist() => Fixtures.Need(Fixtures.Outfit("OutfitNudist"), "Nudist outfit"); + private static FoodPolicy Simple() => Fixtures.Need(Fixtures.Food("FoodRestrictionSimple"), "Simple food policy"); + private static FoodPolicy Paste() => Fixtures.Need(Fixtures.Food("FoodRestrictionPaste"), "Paste food policy"); + private static DrugPolicy NoDrugs() => Fixtures.Need(Fixtures.Drug("NoDrugs"), "No drugs policy (sourceDef NoDrugs)"); + private static DrugPolicy Social() => Fixtures.Need(Fixtures.Drug("SocialDrugs"), "Social drugs policy (sourceDef SocialDrugs)"); + private static ReadingPolicy NoneReading() => Fixtures.Need(Fixtures.Reading("NoneReadingPolicy"), "None reading policy"); + private static ReadingPolicy AllReading() => Fixtures.Need(Fixtures.Reading("AllReadingPolicy"), "All reading policy"); + + /// A caste managing all five slots with the given values. + private static Caste FullCaste(string label, ApparelPolicy apparel, FoodPolicy food, DrugPolicy drug, ReadingPolicy reading, MedicalCareCategory care) + { + Caste c = Fixtures.NewCaste(label); + CasteManager.SetSlot(c, CasteSlot.Apparel, apparel); + CasteManager.SetSlot(c, CasteSlot.Food, food); + CasteManager.SetSlot(c, CasteSlot.Drug, drug); + CasteManager.SetSlot(c, CasteSlot.Reading, reading); + CasteManager.SetSlot(c, CasteSlot.MedCare, care); + foreach (CasteSlot slot in CasteUtility.AllSlots) + T.Check(c.IsManaged(slot), "setup: " + slot + " slot of " + c.label + " is not managed after SetSlot"); + return c; + } + + private static string Values(Pawn p) => + string.Join(", ", CasteUtility.AllSlots.Select(s => s + "=" + CasteUtility.ValueLabel(s, CasteUtility.CurrentValue(p, s)))); + + // ---- tests --------------------------------------------------------------------------- + + [BlaxTest("join rows: a new game has no castes, no default caste and five No caste rows")] + public static void NewGameState() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + T.NotNull(comp, "GameComponent_BlaxCastes.Instance"); + T.Equal(0, comp.Castes.Count, "castes in a new game"); + T.Check(comp.DefaultCaste == null, "a new game has a default caste: " + comp.DefaultCaste); + foreach (string reason in JoinReason.Rows) + { + JoinRow row = comp.JoinRows.FirstOrDefault(r => r.reason == reason); + T.NotNull(row, "join row " + reason); + T.Equal(JoinRowMode.NoCaste, row.mode, "mode of join row " + reason); + T.Check(comp.ResolveRow(reason) == null, "join row " + reason + " resolves to a caste"); + } + T.Equal(JoinReason.Rows.Length, comp.JoinRows.Count, "join rows in a new game"); + } + + [BlaxTest("castes: assigning sets apparel, food, drugs, reading and medical care on a colonist")] + public static void ApplyFiveSlots() + { + ApparelPolicy outfit = SlaveOrSoldier(); + FoodPolicy food = Simple(); + DrugPolicy drug = NoDrugs(); + ReadingPolicy reading = NoneReading(); + const MedicalCareCategory care = MedicalCareCategory.HerbalOrWorse; + + Pawn p = Fixtures.Colonist(); + // Start from values the caste doesn't use (a generated colonist's ideo can already give it No drugs). + p.outfits.CurrentApparelPolicy = Worker(); + p.foodRestriction.CurrentFoodPolicy = Paste(); + p.drugs.CurrentPolicy = Social(); + p.reading.CurrentPolicy = AllReading(); + p.playerSettings.medCare = MedicalCareCategory.Best; + T.Info("before: " + Values(p)); + T.Check(p.outfits.CurrentApparelPolicy != outfit && p.foodRestriction.CurrentFoodPolicy != food && p.drugs.CurrentPolicy != drug + && p.reading.CurrentPolicy != reading && p.playerSettings.medCare != care, + "setup: the colonist already has one of the caste's values, so the test proves nothing: " + Values(p)); + + Caste c = FullCaste("Slave test", outfit, food, drug, reading, care); + T.Check(CasteManager.Assign(p, c, false, JoinReason.Manual), "Assign returned false for a colonist"); + + T.Check(p.outfits.CurrentApparelPolicy == outfit, "apparel: " + Values(p)); + T.Check(p.foodRestriction.CurrentFoodPolicy == food, "food: " + Values(p)); + T.Check(p.drugs.CurrentPolicy == drug, "drugs: " + Values(p)); + T.Check(p.reading.CurrentPolicy == reading, "reading: " + Values(p)); + T.Equal(care, p.playerSettings.medCare, "medical care"); + + CasteMembership m = Fixtures.Comp.MembershipOf(p); + T.NotNull(m, "membership"); + T.Check(m.caste == c && !m.auto && m.reason == JoinReason.Manual, $"membership: caste={m.caste}, auto={m.auto}, reason={m.reason}"); + T.Equal(0, CasteManager.Overrides(p).Count, "overrides right after Assign"); + } + + [BlaxTest("castes: a colony slave gets all five slots (Ideology)")] + public static void SlaveGetsFiveSlots() + { + Pawn p = Fixtures.ColonySlave(); + T.Check(p.outfits != null && p.drugs != null && p.reading != null, "setup: slave lacks a policy tracker"); + p.outfits.CurrentApparelPolicy = Worker(); + p.drugs.CurrentPolicy = Social(); + p.reading.CurrentPolicy = AllReading(); + p.foodRestriction.CurrentFoodPolicy = Paste(); + p.playerSettings.medCare = MedicalCareCategory.Best; + + Caste c = FullCaste("Slave caste test", SlaveOrSoldier(), Simple(), NoDrugs(), NoneReading(), MedicalCareCategory.NoMeds); + T.Check(CasteManager.Assign(p, c, true, JoinReason.NewSlave), "Assign returned false for a colony slave"); + T.Check(p.outfits.CurrentApparelPolicy == SlaveOrSoldier() && p.foodRestriction.CurrentFoodPolicy == Simple() + && p.drugs.CurrentPolicy == NoDrugs() && p.reading.CurrentPolicy == NoneReading(), "slave's policies: " + Values(p)); + T.Equal(MedicalCareCategory.NoMeds, p.playerSettings.medCare, "slave's medical care"); + } + + [BlaxTest("castes: a player prisoner gets food and medical care only; its outfit, drug and reading trackers are untouched")] + public static void PrisonerFoodAndCareOnly() + { + Pawn p = Fixtures.Prisoner(); + // An arrested colonist keeps the trackers a colonist has; a captured raider has none. + p.outfits ??= new Pawn_OutfitTracker(p); + p.drugs ??= new Pawn_DrugPolicyTracker(p); + p.reading ??= new Pawn_ReadingTracker(p); + p.outfits.CurrentApparelPolicy = Worker(); + p.drugs.CurrentPolicy = Social(); + p.reading.CurrentPolicy = AllReading(); + T.NotNull(p.foodRestriction, "prisoner's food tracker"); + T.NotNull(p.playerSettings, "prisoner's player settings"); + + FoodPolicy food = p.foodRestriction.CurrentFoodPolicy == Paste() ? Simple() : Paste(); + MedicalCareCategory care = p.playerSettings.medCare == MedicalCareCategory.NoMeds ? MedicalCareCategory.NormalOrWorse : MedicalCareCategory.NoMeds; + Caste c = FullCaste("Prisoner test", Nudist(), food, NoDrugs(), NoneReading(), care); + + T.Check(CasteManager.Assign(p, c, true, JoinReason.NewPrisoner), "Assign returned false for a player prisoner"); + T.Check(p.foodRestriction.CurrentFoodPolicy == food, "food not set: " + Values(p)); + T.Equal(care, p.playerSettings.medCare, "medical care"); + T.Check(p.outfits.CurrentApparelPolicy == Worker(), "prisoner's outfit changed: " + Values(p)); + T.Check(p.drugs.CurrentPolicy == Social(), "prisoner's drug policy changed: " + Values(p)); + T.Check(p.reading.CurrentPolicy == AllReading(), "prisoner's reading policy changed: " + Values(p)); + T.Equal(0, CasteManager.Overrides(p).Count, "overrides on a prisoner (slots it can't take are never overrides)"); + } + + [BlaxTest("castes: a quest lodger gets food and medical care, not apparel, drugs or reading")] + public static void QuestLodgerSkips() + { + Pawn p = Fixtures.QuestLodger(); + p.outfits.CurrentApparelPolicy = Worker(); + p.drugs.CurrentPolicy = Social(); + p.reading.CurrentPolicy = AllReading(); + p.foodRestriction.CurrentFoodPolicy = Paste(); + p.playerSettings.medCare = MedicalCareCategory.Best; + + Caste c = FullCaste("Lodger test", Nudist(), Simple(), NoDrugs(), NoneReading(), MedicalCareCategory.NoMeds); + T.Check(CasteManager.Assign(p, c, false, JoinReason.Manual), "Assign returned false for a quest lodger"); + T.Check(p.outfits.CurrentApparelPolicy == Worker(), "lodger's outfit changed: " + Values(p)); + T.Check(p.drugs.CurrentPolicy == Social(), "lodger's drug policy changed: " + Values(p)); + T.Check(p.reading.CurrentPolicy == AllReading(), "lodger's reading policy changed: " + Values(p)); + T.Check(p.foodRestriction.CurrentFoodPolicy == Simple(), "lodger's food not set: " + Values(p)); + T.Equal(MedicalCareCategory.NoMeds, p.playerSettings.medCare, "lodger's medical care"); + } + + [BlaxTest("castes: a baby gets apparel, drugs, reading and medical care, not food")] + public static void BabySkipsFood() + { + Pawn p = Fixtures.Baby(); + T.Check(p.outfits != null && p.drugs != null && p.reading != null && p.playerSettings != null && p.foodRestriction != null, + "setup: baby lacks a tracker: outfits=" + (p.outfits != null) + " drugs=" + (p.drugs != null) + " reading=" + (p.reading != null) + + " playerSettings=" + (p.playerSettings != null) + " food=" + (p.foodRestriction != null)); + p.outfits.CurrentApparelPolicy = Worker(); + p.drugs.CurrentPolicy = Social(); + p.reading.CurrentPolicy = AllReading(); + p.foodRestriction.CurrentFoodPolicy = Paste(); + p.playerSettings.medCare = MedicalCareCategory.Best; + + Caste c = FullCaste("Baby test", Nudist(), Simple(), NoDrugs(), NoneReading(), MedicalCareCategory.NoMeds); + T.Check(CasteManager.Assign(p, c, false, JoinReason.Manual), "Assign returned false for a baby"); + T.Check(p.foodRestriction.CurrentFoodPolicy == Paste(), "baby's food changed: " + Values(p)); + T.Check(p.outfits.CurrentApparelPolicy == Nudist(), "baby's outfit not set: " + Values(p)); + T.Check(p.drugs.CurrentPolicy == NoDrugs(), "baby's drug policy not set: " + Values(p)); + T.Check(p.reading.CurrentPolicy == NoneReading(), "baby's reading policy not set: " + Values(p)); + T.Equal(MedicalCareCategory.NoMeds, p.playerSettings.medCare, "baby's medical care"); + } + + [BlaxTest("castes: changing a slot moves members on the old value and keeps hand changes (Follow rule)")] + public static void FollowRule() + { + ApparelPolicy first = SlaveOrSoldier(); + Caste c = Fixtures.NewCaste("Follow test"); + CasteManager.SetSlot(c, CasteSlot.Apparel, first); + Pawn a = Fixtures.Colonist(); + Pawn b = Fixtures.Colonist(); + T.Check(CasteManager.Assign(a, c, false, JoinReason.Manual) && CasteManager.Assign(b, c, false, JoinReason.Manual), "Assign failed"); + T.Check(a.outfits.CurrentApparelPolicy == first && b.outfits.CurrentApparelPolicy == first, "setup: members not on " + first.label); + + b.outfits.CurrentApparelPolicy = Worker(); // by hand + List overrides = CasteManager.Overrides(b); + T.Check(overrides.Count == 1 && overrides[0] == CasteSlot.Apparel, "B's overrides: " + string.Join(", ", overrides)); + + int moved = CasteManager.SetSlot(c, CasteSlot.Apparel, Nudist()); + T.Equal(1, moved, "members moved by the apparel change"); + T.Check(a.outfits.CurrentApparelPolicy == Nudist(), "A did not follow the caste: " + a.outfits.CurrentApparelPolicy.label); + T.Check(b.outfits.CurrentApparelPolicy == Worker(), "B lost its hand-set outfit: " + b.outfits.CurrentApparelPolicy.label); + T.Check(c.ApparelPolicy == Nudist(), "caste slot not changed"); + + // A slot that was unmanaged has no old value: every member gets it. + moved = CasteManager.SetSlot(c, CasteSlot.Food, Simple()); + T.Equal(2, moved, "members moved when the food slot became managed"); + T.Check(a.foodRestriction.CurrentFoodPolicy == Simple() && b.foodRestriction.CurrentFoodPolicy == Simple(), "food not set on both members"); + + // Medical care follows the same rule. + CasteManager.SetSlot(c, CasteSlot.MedCare, MedicalCareCategory.HerbalOrWorse); + b.playerSettings.medCare = MedicalCareCategory.Best; + moved = CasteManager.SetSlot(c, CasteSlot.MedCare, MedicalCareCategory.NoMeds); + T.Equal(1, moved, "members moved by the medical care change"); + T.Equal(MedicalCareCategory.NoMeds, a.playerSettings.medCare, "A's medical care"); + T.Equal(MedicalCareCategory.Best, b.playerSettings.medCare, "B's hand-set medical care"); + + // Unmanaging a slot changes nobody. + moved = CasteManager.SetSlot(c, CasteSlot.Food, null); + T.Equal(0, moved, "members moved by unmanaging food"); + T.Check(!c.IsManaged(CasteSlot.Food), "food slot still managed"); + T.Check(a.foodRestriction.CurrentFoodPolicy == Simple() && b.foodRestriction.CurrentFoodPolicy == Simple(), "unmanaging food changed a member"); + } + + [BlaxTest("castes: with the enabled setting off, assigning and slot changes write no policy")] + public static void DisabledAppliesNothing() + { + Pawn p = Fixtures.Colonist(); + Caste c = FullCaste("Disabled test", SlaveOrSoldier(), Simple(), NoDrugs(), NoneReading(), MedicalCareCategory.HerbalOrWorse); + string before = Values(p); + + Fixtures.Settings.enabled = false; + T.Check(CasteManager.Assign(p, c, false, JoinReason.Manual), "Assign returned false while disabled"); + T.Equal(before, Values(p), "policies after Assign while disabled"); + T.Equal(0, CasteUtility.Apply(p, c).Count, "slots Apply wrote while disabled"); + T.Equal(0, CasteManager.SetSlot(c, CasteSlot.Apparel, Nudist()), "members moved by SetSlot while disabled"); + T.Equal(before, Values(p), "policies after SetSlot while disabled"); + T.Check(Fixtures.Comp.CasteOf(p) == c, "membership not recorded while disabled"); + + Fixtures.Settings.enabled = true; + T.Check(CasteManager.ResetToCaste(p), "ResetToCaste returned false"); + T.Check(p.outfits.CurrentApparelPolicy == Nudist() && p.foodRestriction.CurrentFoodPolicy == Simple(), "re-enabled ResetToCaste did not apply: " + Values(p)); + } + + [BlaxTest("castes: the 2500-tick sweep ends the membership of a pawn that left the faction")] + public static void SweepEndsMembership() + { + Caste c = Fixtures.NewCaste("Sweep test"); + CasteManager.SetSlot(c, CasteSlot.Food, Simple()); + Pawn leaver = Fixtures.Colonist(); + Pawn stayer = Fixtures.Colonist(); + foreach (Pawn p in new[] { leaver, stayer }) + T.Check(CasteManager.Assign(p, c, false, JoinReason.Manual), "Assign failed for " + p.LabelShort); + + Faction other = Fixtures.FriendlyFaction(); + T.NotNull(other, "a friendly faction"); + leaver.SetFaction(other); + T.Check(Fixtures.Comp.MembershipOf(leaver) != null, "membership ended before the sweep ran"); + + Fixtures.TickThroughSweep(); + T.Check(Fixtures.Comp.MembershipOf(leaver) == null, "the sweep kept the membership of a pawn of " + other.Name); + T.Check(Fixtures.Comp.CasteOf(stayer) == c, "the sweep ended a colonist's membership"); + + // A player prisoner stays a member. Swept directly: a fixture prisoner outside a prison cell makes + // vanilla's prisoner job givers throw when the game ticks. + Pawn prisoner = Fixtures.Prisoner(); + T.Check(CasteManager.Assign(prisoner, c, false, JoinReason.Manual), "Assign failed for the prisoner"); + Fixtures.Comp.Sweep(); + T.Check(Fixtures.Comp.CasteOf(prisoner) == c, "the sweep ended a player prisoner's membership"); + prisoner.guest.SetGuestStatus(null); + prisoner.SetFaction(other); + Fixtures.Comp.Sweep(); + T.Check(Fixtures.Comp.MembershipOf(prisoner) == null, "the sweep kept the membership of a released prisoner of " + other.Name); + } + + [BlaxTest("castes: a policy removed from its database is skipped and unmanaged, without errors")] + public static void MissingPolicySkipped() + { + ApparelPolicy temp = Current.Game.outfitDatabase.MakeNewOutfit(); + temp.label = "BlaxCastes test outfit"; + Caste c = Fixtures.NewCaste("Missing policy test"); + CasteManager.SetSlot(c, CasteSlot.Apparel, temp); + CasteManager.SetSlot(c, CasteSlot.Food, Simple()); + T.Check(c.ApparelPolicy == temp, "setup: apparel slot not set"); + + Pawn p = Fixtures.Colonist(); + ApparelPolicy before = p.outfits.CurrentApparelPolicy; + Current.Game.outfitDatabase.AllOutfits.Remove(temp); // a mod deleting it without TryDelete + + T.Check(CasteManager.Assign(p, c, false, JoinReason.Manual), "Assign failed"); + T.Check(p.outfits.CurrentApparelPolicy == before, "the removed outfit was written: " + p.outfits.CurrentApparelPolicy.label); + T.Check(p.foodRestriction.CurrentFoodPolicy == Simple(), "the food slot was not written next to the missing outfit"); + T.Check(!c.IsManaged(CasteSlot.Apparel), "the missing outfit is still managed"); + } + } +} diff --git a/Tests/BlaxCastesTests/Source/Fixtures.cs b/Tests/BlaxCastesTests/Source/Fixtures.cs new file mode 100644 index 0000000..7039cf3 --- /dev/null +++ b/Tests/BlaxCastesTests/Source/Fixtures.cs @@ -0,0 +1,279 @@ +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using BlaxCastes; +using RimWorld; +using RimWorld.Planet; +using Verse; + +namespace BlaxCastesTests +{ + /// + /// Shared helpers for tests. Pawns and castes made here are removed after each test unless passed to + /// Keep() or KeepCaste(). Mod settings, join rows and the default caste are restored after each test, + /// so tests may change them freely. + /// + public static class Fixtures + { + private static readonly List made = new List(); + private static readonly HashSet kept = new HashSet(); + private static readonly List madeCastes = new List(); + private static readonly HashSet keptCastes = new HashSet(); + private static readonly List lodgerParts = new List(); + private static List<(string reason, JoinRowMode mode, Caste caste)> rowSnapshot; + private static Caste defaultSnapshot; + private static bool keepCasteState; + + public static Map Map => Find.CurrentMap; + + public static BlaxCastesSettings Settings => BlaxCastesMod.Settings; + + public static GameComponent_BlaxCastes Comp => GameComponent_BlaxCastes.Instance; + + // ---- factions -------------------------------------------------------------------- + + /// A visible, non-player, humanlike faction that is not hostile to the player. + public static Faction FriendlyFaction() => + Find.FactionManager.AllFactionsVisible + .Where(f => !f.IsPlayer && !f.defeated && f.def.humanlikeFaction && !f.HostileTo(Faction.OfPlayer)) + .OrderBy(f => f.loadID).FirstOrDefault(); + + /// A visible, non-player, humanlike faction hostile to the player. + public static Faction HostileFaction() => + Find.FactionManager.AllFactionsVisible + .Where(f => !f.IsPlayer && !f.defeated && f.def.humanlikeFaction && f.HostileTo(Faction.OfPlayer)) + .OrderBy(f => f.loadID).FirstOrDefault(); + + // ---- pawns ----------------------------------------------------------------------- + + /// A fresh pawn, not spawned. Relations off so no accidental family ties. + public static Pawn Generate(PawnKindDef kind, Faction faction, DevelopmentalStage stage = DevelopmentalStage.Adult) + { + var req = new PawnGenerationRequest(kind, faction, PawnGenerationContext.NonPlayer, + forceGenerateNewPawn: true, allowDowned: stage.Baby(), canGeneratePawnRelations: false, + colonistRelationChanceFactor: 0f, developmentalStages: stage); + Pawn p = PawnGenerator.GeneratePawn(req); + made.Add(p); + return p; + } + + public static Pawn Spawn(Pawn p) + { + IntVec3 cell = CellFinder.RandomClosewalkCellNear(Map.Center, Map, 12); + GenSpawn.Spawn(p, cell, Map); + return p; + } + + /// A spawned free adult colonist. + public static Pawn Colonist() => Spawn(Generate(PawnKindDefOf.Colonist, Faction.OfPlayer)); + + /// A spawned slave of the colony. Skips the test without Ideology. + public static Pawn ColonySlave(Faction origin = null) + { + if (!ModsConfig.IdeologyActive) + T.Skip("slaves need Ideology"); + Pawn p = Generate(PawnKindDefOf.Slave, origin ?? FriendlyFaction()); + Spawn(p); + p.guest.SetGuestStatus(Faction.OfPlayer, GuestStatus.Slave); + T.Check(p.IsSlaveOfColony, "slave fixture is not a slave of the colony"); + return p; + } + + /// A spawned prisoner of the colony, from a hostile faction when there is one. + public static Pawn Prisoner() + { + Faction from = HostileFaction() ?? FriendlyFaction(); + Pawn p = Spawn(Generate(PawnKindDefOf.Slave, from)); + p.guest.SetGuestStatus(Faction.OfPlayer, GuestStatus.Prisoner); + T.Check(p.IsPrisonerOfColony, "prisoner fixture is not a prisoner of the colony"); + return p; + } + + /// + /// A spawned colonist that is a quest lodger: an ongoing quest gives it an extra home faction, + /// the way vanilla lodger quests do. The quest part is removed again after the test. + /// + public static Pawn QuestLodger() + { + Faction home = FriendlyFaction(); + if (home == null) + T.Skip("no friendly faction to lodge from"); + Pawn p = Colonist(); + Quest quest = Quest.MakeRaw(); + quest.acceptanceTick = Find.TickManager.TicksGame; + var part = new QuestPart_ExtraFaction { extraFaction = new ExtraFaction(home, ExtraFactionType.HomeFaction) }; + part.affectedPawns.Add(p); + quest.AddPart(part); + Find.QuestManager.ExtraFactionQuestParts.Add(part); + lodgerParts.Add(part); + T.Check(p.IsQuestLodger(), "lodger fixture is not a quest lodger (QuestUtility changed?)"); + return p; + } + + /// A spawned baby of the colony. Skips the test without Biotech. + public static Pawn Baby() + { + if (!ModsConfig.BiotechActive) + T.Skip("babies need Biotech"); + Pawn p = Spawn(Generate(PawnKindDefOf.Colonist, Faction.OfPlayer, DevelopmentalStage.Baby)); + T.Check(p.DevelopmentalStage.Baby(), "baby fixture is " + p.DevelopmentalStage + ", not a baby"); + return p; + } + + /// Exclude a pawn from the per-test cleanup (phase-1 setup for phase-2 checks). + public static Pawn Keep(Pawn p) + { + kept.Add(p); + return p; + } + + public static Pawn FindPawnById(string thingId) + { + if (thingId == null) return null; + foreach (Map m in Find.Maps) + foreach (Pawn p in m.mapPawns.AllPawns) + if (p.ThingID == thingId) return p; + foreach (Pawn p in Find.WorldPawns.AllPawnsAliveOrDead) + if (p.ThingID == thingId) return p; + return null; + } + + // ---- castes and policies --------------------------------------------------------- + + /// A new caste through CasteManager, deleted after the test unless passed to KeepCaste(). + public static Caste NewCaste(string label = null) + { + Caste c = CasteManager.CreateCaste(label); + T.NotNull(c, "CasteManager.CreateCaste"); + madeCastes.Add(c); + return c; + } + + public static Caste KeepCaste(Caste c) + { + keptCastes.Add(c); + return c; + } + + /// Leave the join rows and the default caste as this test set them (phase-1 setup). + public static void KeepCasteState() => keepCasteState = true; + + public static ApparelPolicy Outfit(string labelKey) => + Current.Game.outfitDatabase.AllOutfits.FirstOrDefault(o => o.label == (string)labelKey.Translate()); + + public static FoodPolicy Food(string labelKey) => + Current.Game.foodRestrictionDatabase.AllFoodRestrictions.FirstOrDefault(o => o.label == (string)labelKey.Translate()); + + public static DrugPolicy Drug(string sourceDefName) => + Current.Game.drugPolicyDatabase.AllPolicies.FirstOrDefault(o => o.sourceDef?.defName == sourceDefName); + + public static ReadingPolicy Reading(string labelKey) => + Current.Game.readingPolicyDatabase.AllReadingPolicies.FirstOrDefault(o => o.label == (string)labelKey.Translate()); + + /// A starting policy that must exist; fails the test otherwise. + public static TP Need(TP policy, string what) where TP : Policy + { + T.NotNull(policy, what); + return policy; + } + + // ---- time ------------------------------------------------------------------------ + + public static void Tick(int ticks) + { + for (int i = 0; i < ticks; i++) Find.TickManager.DoSingleTick(); + } + + /// Ticks until the 2500-tick sweep has run once. + public static void TickThroughSweep() + { + int interval = GameComponent_BlaxCastes.SweepInterval; + int left = interval - Find.TickManager.TicksGame % interval; + Tick(left == 0 ? interval : left); + } + + public static void QuietStoryteller() + { + Find.Storyteller.incidentQueue.Clear(); + Find.Storyteller.storytellerComps.Clear(); + } + + // ---- settings and cleanup (used by the runner) ----------------------------------- + + public static Dictionary SnapshotSettings() + { + var d = new Dictionary(); + keepCasteState = false; + GameComponent_BlaxCastes comp = Comp; + rowSnapshot = comp?.JoinRows.Select(r => (r.reason, r.mode, r.caste)).ToList(); + defaultSnapshot = comp?.DefaultCaste; + if (Settings == null) return d; + foreach (FieldInfo f in typeof(BlaxCastesSettings).GetFields(BindingFlags.Public | BindingFlags.Instance)) + d[f] = f.GetValue(Settings); + return d; + } + + public static void RestoreSettings(Dictionary snapshot) + { + if (Settings != null) + foreach (var kv in snapshot) kv.Key.SetValue(Settings, kv.Value); + GameComponent_BlaxCastes comp = Comp; + if (comp == null || keepCasteState || rowSnapshot == null) return; + foreach (var (reason, mode, caste) in rowSnapshot) + { + bool ok = mode == JoinRowMode.SpecificCaste && !comp.HasCaste(caste) + ? CasteManager.SetJoinRow(reason, JoinRowMode.NoCaste) + : CasteManager.SetJoinRow(reason, mode, caste); + if (!ok) TestRunner.Note("could not restore join row " + reason); + } + CasteManager.SetDefault(comp.HasCaste(defaultSnapshot) ? defaultSnapshot : null); + } + + public static void Cleanup() + { + foreach (QuestPart_ExtraFaction part in lodgerParts) + Find.QuestManager.ExtraFactionQuestParts.Remove(part); + lodgerParts.Clear(); + + foreach (Caste c in madeCastes) + { + if (c != null && !keptCastes.Contains(c)) + CasteManager.DeleteCaste(c); + } + madeCastes.Clear(); + + foreach (Pawn p in made) + { + if (p == null || kept.Contains(p)) continue; + if (p.Dead) DropRitualObligations(p); + if (p.Corpse != null && p.Corpse.Spawned) p.Corpse.Destroy(DestroyMode.Vanish); + else if (p.Spawned) p.Destroy(DestroyMode.Vanish); + else if (p.IsWorldPawn()) Find.WorldPawns.RemoveAndDiscardPawnViaGC(p); + } + made.Clear(); + } + + /// + /// A fixture colonist that died gets a funeral obligation (Ideology). The cleanup destroys its corpse, + /// so drop the obligation too, or the save warns about a reference to a discarded pawn. + /// + private static void DropRitualObligations(Pawn p) + { + if (!ModsConfig.IdeologyActive || Find.IdeoManager == null) return; + Corpse corpse = p.Corpse; + bool Hits(TargetInfo t) => t.HasThing && (t.Thing == p || (corpse != null && t.Thing == corpse)); + foreach (Ideo ideo in Find.IdeoManager.IdeosListForReading) + { + foreach (Precept precept in ideo.PreceptsListForReading) + { + if (!(precept is Precept_Ritual ritual) || ritual.activeObligations == null) continue; + foreach (RitualObligation o in ritual.activeObligations.ToList()) + { + if (o != null && (Hits(o.targetA) || Hits(o.targetB) || Hits(o.targetC))) + ritual.RemoveObligation(o); + } + } + } + } + } +} diff --git a/Tests/BlaxCastesTests/Source/Harness.cs b/Tests/BlaxCastesTests/Source/Harness.cs new file mode 100644 index 0000000..5035bbe --- /dev/null +++ b/Tests/BlaxCastesTests/Source/Harness.cs @@ -0,0 +1,266 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using RimWorld; +using UnityEngine; +using Verse; + +namespace BlaxCastesTests +{ + /// + /// Marks a public static void method without parameters as a test. Phase 1 runs in a fresh + /// quick-test colony. Phase 2 runs after the runner saved that game and loaded it again. + /// + [AttributeUsage(AttributeTargets.Method)] + public sealed class BlaxTestAttribute : Attribute + { + public readonly string Name; + public readonly int Phase; + + public BlaxTestAttribute(string name, int phase = 1) + { + Name = name; + Phase = phase; + } + } + + public class TestFailure : Exception + { + public TestFailure(string message) : base(message) { } + } + + public class TestSkipped : Exception + { + public TestSkipped(string message) : base(message) { } + } + + /// Assertions and notes for test bodies. + public static class T + { + /// Values carried from phase 1 into phase 2. Store ThingIDs or def names, never objects. + public static readonly Dictionary Carry = new Dictionary(); + + /// Carry values read right before the save, after every phase-1 test ran. + internal static readonly Dictionary> CarryAtSaveTime = new Dictionary>(); + + /// + /// Carries a value read right before the save instead of now, for state that later phase-1 + /// tests may still change (the next caste id, for example). + /// + public static void CarryAtSave(string key, Func read) => CarryAtSaveTime[key] = read; + + public static void Check(bool condition, string message) + { + if (!condition) throw new TestFailure(message); + } + + public static void Equal(TV expected, TV actual, string what) + { + if (!EqualityComparer.Default.Equals(expected, actual)) + throw new TestFailure($"{what}: expected {Show(expected)}, got {Show(actual)}"); + } + + public static void NotNull(object value, string what) + { + if (value == null) throw new TestFailure(what + " is null"); + } + + public static void Fail(string message) => throw new TestFailure(message); + + public static void Skip(string reason) => throw new TestSkipped(reason); + + /// Adds an INFO line under the current test in the results file. + public static void Info(string message) => TestRunner.Note(message); + + private static string Show(object o) => o == null ? "null" : o.ToString(); + } + + /// + /// Drives the suite when the game runs with -quicktest -blaxcastestests: phase 1, save, load, + /// phase 2, then writes BlaxCastesTestResults.txt into the save data folder and quits. + /// + public class TestRunner : GameComponent + { + public const string SaveName = "BlaxCastesTest"; + public const string ResultFile = "BlaxCastesTestResults.txt"; + + private static int stage; // 0 waiting, 1 phase 1 done + reload queued, 2 finished + private static bool reloaded; + private static int pass, fail, skip; + private static string currentTest; + private static readonly List modErrors = new List(); + private static readonly List otherErrors = new List(); + private static bool hooked; + private int settleFrames; + + public static bool Enabled => GenCommandLine.CommandLineArgPassed("blaxcastestests"); + + public static string ResultPath => Path.Combine(GenFilePaths.SaveDataFolderPath, ResultFile); + + public TestRunner(Game game) { } + + public override void LoadedGame() + { + if (Enabled && stage == 1) reloaded = true; + } + + public override void GameComponentUpdate() + { + if (!Enabled || stage == 2) return; + if (LongEventHandler.AnyEventNowOrWaiting || Find.CurrentMap == null) return; + if (++settleFrames < 30) return; + + if (stage == 0) + { + stage = 1; + Begin(); + RunPhase(1); + Line("STAGE save+reload"); + try + { + foreach (var kv in T.CarryAtSaveTime) + { + try { T.Carry[kv.Key] = kv.Value(); } + catch (Exception e) { Note("carry " + kv.Key + " failed: " + e.Message); } + } + GameDataSaveLoader.SaveGame(SaveName); + GameDataSaveLoader.LoadGame(SaveName); + } + catch (Exception e) + { + Record("FAIL", "save and reload", e.ToString()); + Finish(); + } + } + else if (stage == 1 && reloaded) + { + stage = 2; + Line("STAGE phase 2 (after reload)"); + RunPhase(2); + Finish(); + } + } + + private static void Begin() + { + try { File.Delete(ResultPath); } catch { } + HookLog(); + Line("BEGIN Blax Castes in-game tests, RimWorld " + VersionControl.CurrentVersionStringWithRev); + Fixtures.QuietStoryteller(); + Find.TickManager.CurTimeSpeed = TimeSpeed.Paused; + } + + private static void HookLog() + { + if (hooked) return; + hooked = true; + Application.logMessageReceivedThreaded += (text, stack, type) => + { + if (type != LogType.Error && type != LogType.Exception) return; + string where = currentTest ?? "(between tests)"; + string entry = where + ": " + OneLine(text); + bool ours = (text != null && (text.Contains("BlaxCastes") || text.Contains("Blax Castes"))) || (stack != null && stack.Contains("BlaxCastes")); + lock (modErrors) (ours ? modErrors : otherErrors).Add(entry); + }; + } + + private static void RunPhase(int phase) + { + var tests = typeof(TestRunner).Assembly.GetTypes() + .SelectMany(t => t.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static)) + .Select(m => (method: m, attr: m.GetCustomAttribute())) + .Where(x => x.attr != null && x.attr.Phase == phase) + .OrderBy(x => x.method.DeclaringType.FullName) + .ThenBy(x => x.method.MetadataToken) + .ToList(); + foreach (var (method, attr) in tests) RunOne(attr.Name, method); + } + + private static void RunOne(string name, MethodInfo method) + { + currentTest = name; + int modErrorsBefore, otherErrorsBefore; + lock (modErrors) { modErrorsBefore = modErrors.Count; otherErrorsBefore = otherErrors.Count; } + var settings = Fixtures.SnapshotSettings(); + string status = "PASS", detail = ""; + try + { + Find.TickManager.CurTimeSpeed = TimeSpeed.Paused; + method.Invoke(null, null); + } + catch (TargetInvocationException tie) when (tie.InnerException is TestSkipped s) + { + status = "SKIP"; detail = s.Message; + } + catch (TargetInvocationException tie) when (tie.InnerException is TestFailure f) + { + status = "FAIL"; detail = f.Message; + } + catch (TargetInvocationException tie) + { + status = "FAIL"; detail = "exception: " + tie.InnerException; + } + catch (Exception e) + { + status = "FAIL"; detail = "runner exception: " + e; + } + finally + { + Fixtures.RestoreSettings(settings); + try { Fixtures.Cleanup(); } catch (Exception e) { Note("cleanup threw: " + OneLine(e.Message)); } + } + + List newModErrors, newOtherErrors; + lock (modErrors) + { + newModErrors = modErrors.Skip(modErrorsBefore).ToList(); + newOtherErrors = otherErrors.Skip(otherErrorsBefore).ToList(); + } + if (status == "PASS" && newModErrors.Count > 0) + { + status = "FAIL"; + detail = "Blax Castes logged errors: " + string.Join(" | ", newModErrors.Take(3)); + } + Record(status, name, detail); + foreach (string e in newOtherErrors.Take(5)) Line(" LOGERR " + e); + currentTest = null; + } + + private static void Finish() + { + stage = 2; + List stray; + lock (modErrors) stray = modErrors.Where(e => e.StartsWith("(between tests)")).ToList(); + foreach (string e in stray.Take(10)) Line(" MODERR " + e); + Line($"SUMMARY pass={pass} fail={fail} skip={skip} strayModErrors={stray.Count}"); + Line("END"); + Log.Message($"[BlaxTest] finished: pass={pass} fail={fail} skip={skip}"); + Root.Shutdown(); + } + + internal static void Note(string message) => Line(" INFO " + OneLine(message)); + + private static void Record(string status, string name, string detail) + { + if (status == "PASS") pass++; + else if (status == "FAIL") fail++; + else skip++; + Line(string.IsNullOrEmpty(detail) ? $"{status} {name}" : $"{status} {name}: {OneLine(detail)}"); + } + + private static void Line(string text) + { + Log.Message("[BlaxTest] " + text); + try { File.AppendAllText(ResultPath, text + Environment.NewLine); } catch { } + } + + private static string OneLine(string s) + { + if (s == null) return ""; + s = s.Replace("\r", " ").Replace("\n", " ⏎ "); + return s.Length > 1500 ? s.Substring(0, 1500) + "…" : s; + } + } +} diff --git a/Tests/BlaxCastesTests/Source/JoinTests.cs b/Tests/BlaxCastesTests/Source/JoinTests.cs new file mode 100644 index 0000000..22d2dbf --- /dev/null +++ b/Tests/BlaxCastesTests/Source/JoinTests.cs @@ -0,0 +1,660 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using BlaxCastes; +using HarmonyLib; +using RimWorld; +using Verse; + +namespace BlaxCastesTests +{ + /// + /// Join defaults: classification in the SetFaction, SetGuestStatus and PreTraded hooks, the one-tick + /// deferral, the rows, the No caste revert, the settings and the window. Fixture prisoners are never + /// ticked while they are still prisoners: outside a prison cell vanilla's prisoner job givers throw. + /// + public static class JoinTests + { + private const string TaSoC = "Rhajiit.tradepurchasemode"; + + // ---- policies and castes ------------------------------------------------------------- + + private static ApparelPolicy SlaveOrSoldier() => + Fixtures.Need(Fixtures.Outfit(ModsConfig.IdeologyActive ? "OutfitSlave" : "OutfitSoldier"), "Slave or Soldier outfit"); + + private static ApparelPolicy Worker() => Fixtures.Need(Fixtures.Outfit("OutfitWorker"), "Worker outfit"); + private static FoodPolicy Simple() => Fixtures.Need(Fixtures.Food("FoodRestrictionSimple"), "Simple food policy"); + private static FoodPolicy Fine() => Fixtures.Need(Fixtures.Food("FoodRestrictionFine"), "Fine food policy"); + private static FoodPolicy Paste() => Fixtures.Need(Fixtures.Food("FoodRestrictionPaste"), "Paste food policy"); + + /// A caste managing apparel and food. + private static Caste RowCaste(string label, ApparelPolicy apparel, FoodPolicy food) + { + Caste c = Fixtures.NewCaste(label); + CasteManager.SetSlot(c, CasteSlot.Apparel, apparel); + CasteManager.SetSlot(c, CasteSlot.Food, food); + T.Check(c.IsManaged(CasteSlot.Apparel) && c.IsManaged(CasteSlot.Food), "setup: " + label + " does not manage apparel and food"); + return c; + } + + /// A caste managing food only, plus medical care when given. + private static Caste FoodCaste(string label, FoodPolicy food, MedicalCareCategory? care = null) + { + Caste c = Fixtures.NewCaste(label); + CasteManager.SetSlot(c, CasteSlot.Food, food); + if (care.HasValue) + CasteManager.SetSlot(c, CasteSlot.MedCare, care.Value); + return c; + } + + private static void Row(string reason, Caste caste) => + T.Check(CasteManager.SetJoinRow(reason, JoinRowMode.SpecificCaste, caste), "setup: SetJoinRow " + reason + " failed"); + + private static string Who(Pawn p) => p.LabelShort + " [" + p.ThingID + "]"; + + private static string Policies(Pawn p) => + string.Join(", ", CasteUtility.AllSlots.Select(s => s + "=" + CasteUtility.ValueLabel(s, CasteUtility.CurrentValue(p, s)))); + + private static void CheckMember(Pawn p, Caste caste, string reason) + { + CasteMembership m = Fixtures.Comp.MembershipOf(p); + T.NotNull(m, Who(p) + "'s membership after the join"); + T.Check(m.caste == caste, Who(p) + " is in " + (m.caste?.label ?? "no caste") + ", expected " + caste.label); + T.Check(m.auto, Who(p) + "'s membership is not marked as set by a join row"); + T.Equal(reason, m.reason, Who(p) + "'s membership reason"); + } + + private static void Unqueue(Pawn p) => Fixtures.Comp.JoinQueue.RemoveAll(q => q != null && q.pawn == p); + + // ---- trading ------------------------------------------------------------------------- + + /// + /// A trader that hands pawns over the way Pawn_TraderTracker does (PreTraded, nothing else), so + /// Tradeable_Pawn.ResolveTrade and the buy-mode patches on it run without a ship or a caravan. + /// + private sealed class TestTrader : ITrader + { + private readonly Faction faction; + private readonly TraderKindDef kind; + + public TestTrader() + { + faction = Fixtures.FriendlyFaction(); + kind = DefDatabase.AllDefs.FirstOrDefault(k => k.defName != "RD_PawnTrader" && k.WillTrade(ThingDefOf.Human)) + ?? DefDatabase.AllDefs.FirstOrDefault(); + } + + public TraderKindDef TraderKind => kind; + public IEnumerable Goods => Enumerable.Empty(); + public int RandomPriceFactorSeed => 1; + public string TraderName => "Blax Castes test trader"; + public bool CanTradeNow => true; + public float TradePriceImprovementOffsetForPlayer => 0f; + public Faction Faction => faction; + public TradeCurrency TradeCurrency => TradeCurrency.Silver; + public IEnumerable ColonyThingsWillingToBuy(Pawn playerNegotiator) => Enumerable.Empty(); + + public void GiveSoldThingToTrader(Thing toGive, int countToGive, Pawn playerNegotiator) => + toGive.PreTraded(TradeAction.PlayerSells, playerNegotiator, this); + + public void GiveSoldThingToPlayer(Thing toGive, int countToGive, Pawn playerNegotiator) => + toGive.PreTraded(TradeAction.PlayerBuys, playerNegotiator, this); + } + + /// An unspawned, recruitable pawn as trader stock holds it. + private static Pawn StockPawn(JoinStatus status) + { + Faction from = Fixtures.FriendlyFaction(); + if (from == null) + T.Skip("no friendly faction to buy from"); + Pawn p = Fixtures.Generate(PawnKindDefOf.Slave, from); + p.guest.Recruitable = true; + p.guest.joinStatus = status; + return p; + } + + /// Buys the pawn through vanilla Pawn.PreTraded(PlayerBuys), then lets it arrive on the map. + private static void Buy(Pawn p, Pawn negotiator, ITrader trader) + { + p.PreTraded(TradeAction.PlayerBuys, negotiator, trader); + if (!p.Spawned) + Fixtures.Spawn(p); + } + + private static readonly FieldInfo LiveMessages = AccessTools.Field(typeof(Messages), "liveMessages"); + + private static bool MessageShown(string part) + { + T.NotNull(LiveMessages, "Messages.liveMessages (renamed in this game version?)"); + var live = (List)LiveMessages.GetValue(null); + return live.Any(m => m.text != null && m.text.Contains(part)); + } + + // ---- buying -------------------------------------------------------------------------- + + [BlaxTest("join: a pawn bought as slave through PreTraded(PlayerBuys) is queued, then after one tick wears and eats its caste's policies")] + public static void BoughtAsSlave() + { + if (!ModsConfig.IdeologyActive) + T.Skip("slaves need Ideology"); + Caste bought = RowCaste("Bought slaves join test", SlaveOrSoldier(), Simple()); + Caste wrong = FoodCaste("Wrong row (bought slave)", Paste()); + Row(JoinReason.BoughtSlave, bought); + Row(JoinReason.BoughtColonist, wrong); + Row(JoinReason.NewSlave, wrong); + + Pawn negotiator = Fixtures.Colonist(); + Pawn p = StockPawn(JoinStatus.JoinAsSlave); + p.PreTraded(TradeAction.PlayerBuys, negotiator, new TestTrader()); + T.Check(p.IsSlaveOfColony, Who(p) + " is not a slave of the colony after the purchase"); + T.Equal(0, JoinScopes.Depth, "open join scopes after PreTraded"); + QueuedJoin q = JoinDefaults.QueuedFor(p); + T.NotNull(q, Who(p) + "'s queued join"); + T.Equal(JoinScopes.Bought, q.reason, "queued reason"); + T.Check(Fixtures.Comp.MembershipOf(p) == null, "the join was applied inside PreTraded instead of on the next tick"); + + Fixtures.Spawn(p); + Fixtures.Tick(1); + T.Check(!JoinDefaults.IsQueued(p), Who(p) + " is still queued after one tick"); + CheckMember(p, bought, JoinReason.BoughtSlave); + T.Check(p.outfits.CurrentApparelPolicy == bought.ApparelPolicy && p.foodRestriction.CurrentFoodPolicy == Simple(), + Who(p) + " does not wear and eat its caste's policies: " + Policies(p)); + T.Check(MessageShown(bought.label), "no message names the caste " + bought.label); + } + + [BlaxTest("join: a pawn bought as colonist ends in the bought-as-colonist caste, and no message shows with messages off")] + public static void BoughtAsColonist() + { + Caste bought = RowCaste("Bought colonists join test", Worker(), Fine()); + Caste wrong = FoodCaste("Wrong row (bought colonist)", Paste()); + Row(JoinReason.BoughtColonist, bought); + Row(JoinReason.BoughtSlave, wrong); + Row(JoinReason.NewColonist, wrong); + Fixtures.Settings.joinMessages = false; + + Pawn p = StockPawn(JoinStatus.JoinAsColonist); + Buy(p, Fixtures.Colonist(), new TestTrader()); + T.Check(p.IsColonist && !p.IsSlave, Who(p) + " is not a free colonist after the purchase"); + T.Equal(JoinScopes.Bought, JoinDefaults.QueuedFor(p)?.reason, "queued reason"); + + Fixtures.Tick(1); + CheckMember(p, bought, JoinReason.BoughtColonist); + T.Check(p.outfits.CurrentApparelPolicy == Worker() && p.foodRestriction.CurrentFoodPolicy == Fine(), + Who(p) + " does not have its caste's policies: " + Policies(p)); + T.Check(!MessageShown(bought.label), "a join message showed with joinMessages off"); + } + + // ---- status changes ------------------------------------------------------------------ + + [BlaxTest("join: GenGuest.EnslavePrisoner puts a prisoner into the new-slave caste")] + public static void EnslavedPrisoner() + { + if (!ModsConfig.IdeologyActive) + T.Skip("slaves need Ideology"); + Caste slaves = RowCaste("New slaves join test", SlaveOrSoldier(), Simple()); + Caste wrong = FoodCaste("Wrong row (enslaved)", Paste()); + Row(JoinReason.NewSlave, slaves); + Row(JoinReason.NewPrisoner, wrong); + Row(JoinReason.BoughtSlave, wrong); + + Pawn warden = Fixtures.Colonist(); + Pawn p = Fixtures.Prisoner(); + GenGuest.EnslavePrisoner(warden, p); + T.Check(p.IsSlaveOfColony, Who(p) + " is not a slave of the colony after EnslavePrisoner"); + T.Check(JoinDefaults.IsQueued(p), Who(p) + " was not queued"); + T.Check(Fixtures.Comp.MembershipOf(p) == null, "the join was applied before the next tick"); + + Fixtures.Tick(1); + CheckMember(p, slaves, JoinReason.NewSlave); + T.Check(p.outfits.CurrentApparelPolicy == slaves.ApparelPolicy && p.foodRestriction.CurrentFoodPolicy == Simple(), + Who(p) + " does not have the new-slave caste's policies: " + Policies(p)); + } + + [BlaxTest("join: RecruitUtility.Recruit moves a prisoner from the prisoner caste into the new-colonist caste")] + public static void RecruitedPrisoner() + { + Caste prisoners = FoodCaste("Prisoners join test", Paste()); + Caste colonists = RowCaste("New colonists join test", Worker(), Fine()); + Row(JoinReason.NewPrisoner, prisoners); + Row(JoinReason.NewColonist, colonists); + + Pawn p = Fixtures.Prisoner(); + // In the prisoner caste the way its join would put it (applied directly: see the class comment). + T.Check(CasteManager.Assign(p, prisoners, true, JoinReason.NewPrisoner), "setup: Assign to the prisoner caste failed"); + T.Check(p.foodRestriction.CurrentFoodPolicy == Paste(), "setup: the prisoner does not eat the prisoner caste's food"); + + RecruitUtility.Recruit(p, Faction.OfPlayer, Fixtures.Colonist()); + T.Check(p.IsColonist, Who(p) + " is not a colonist after Recruit"); + T.Check(JoinDefaults.IsQueued(p), Who(p) + " was not queued"); + + Fixtures.Tick(1); + CheckMember(p, colonists, JoinReason.NewColonist); + T.Check(p.foodRestriction.CurrentFoodPolicy != Paste(), Who(p) + " still eats the prisoner food"); + T.Check(p.foodRestriction.CurrentFoodPolicy == Fine() && p.outfits.CurrentApparelPolicy == Worker(), + Who(p) + " does not have the new-colonist caste's policies: " + Policies(p)); + } + + [BlaxTest("join: CapturedBy on a downed raider puts it into the new-prisoner caste, after vanilla's medical care reset")] + public static void CapturedRaider() + { + Faction hostile = Fixtures.HostileFaction(); + if (hostile == null) + T.Skip("no hostile faction to take a raider from"); + Caste captured = FoodCaste("Captured join test", Simple(), MedicalCareCategory.NoMeds); + Row(JoinReason.NewPrisoner, captured); + + Pawn raider = Fixtures.Spawn(Fixtures.Generate(hostile.def.basicMemberKind ?? PawnKindDefOf.Slave, hostile)); + HealthUtility.DamageUntilDowned(raider, allowBleedingWounds: false); + if (raider.Dead) + T.Skip("the raider died while being downed"); + T.Check(raider.Downed, "setup: the raider is not downed"); + + raider.guest.CapturedBy(Faction.OfPlayer, Fixtures.Colonist()); + T.Check(raider.IsPrisonerOfColony, Who(raider) + " is not a prisoner of the colony after CapturedBy"); + T.Equal(JoinDefaults.StatusFallback, JoinDefaults.QueuedFor(raider)?.reason, "queued reason"); + + Fixtures.Tick(1); + CheckMember(raider, captured, JoinReason.NewPrisoner); + T.Check(raider.foodRestriction.CurrentFoodPolicy == Simple(), Who(raider) + " does not eat the caste's food: " + Policies(raider)); + T.Equal(MedicalCareCategory.NoMeds, raider.playerSettings.medCare, Who(raider) + "'s medical care"); + } + + [BlaxTest("join: SetGuestStatus on existing members (null on a colonist, the same status on a slave or prisoner) queues nothing")] + public static void ExistingMembersNotRequeued() + { + Caste c = FoodCaste("Existing members join test", Simple()); + var members = new List(); + + Pawn colonist = Fixtures.Colonist(); + members.Add(colonist); + Pawn prisoner = Fixtures.Prisoner(); + members.Add(prisoner); + Pawn slave = ModsConfig.IdeologyActive ? Fixtures.ColonySlave() : null; + if (slave != null) + members.Add(slave); + foreach (Pawn p in members) + { + T.Check(CasteManager.Assign(p, c, false, JoinReason.Manual), "setup: Assign failed for " + Who(p)); + Unqueue(p); + } + + colonist.guest.SetGuestStatus(null); + prisoner.guest.SetGuestStatus(Faction.OfPlayer, GuestStatus.Prisoner); + slave?.guest.SetGuestStatus(Faction.OfPlayer, GuestStatus.Slave); + foreach (Pawn p in members) + { + T.Check(!JoinDefaults.IsQueued(p), Who(p) + " was queued again by a status call that changed nothing"); + T.Check(Fixtures.Comp.CasteOf(p) == c, Who(p) + " lost its caste"); + } + if (slave == null) + T.Skip("slaves need Ideology; the colonist and prisoner checks passed"); + } + + [BlaxTest("join: a pawn sold between queue and apply is dropped without errors, and a sold member leaves its caste")] + public static void SoldBeforeApply() + { + Caste c = RowCaste("Sold join test", Worker(), Simple()); + Row(JoinReason.BoughtColonist, c); + var trader = new TestTrader(); + Pawn negotiator = Fixtures.Colonist(); + + Pawn p = StockPawn(JoinStatus.JoinAsColonist); + Buy(p, negotiator, trader); + T.Check(JoinDefaults.IsQueued(p), "setup: the bought pawn was not queued"); + p.PreTraded(TradeAction.PlayerSells, negotiator, trader); + T.Check(p.Faction != Faction.OfPlayer, Who(p) + " is still in the player faction after being sold"); + + Pawn member = Fixtures.Colonist(); + T.Check(CasteManager.Assign(member, c, false, JoinReason.Manual), "setup: Assign failed"); + member.PreTraded(TradeAction.PlayerSells, negotiator, trader); + T.Check(Fixtures.Comp.CasteOf(member) == c, "the membership ended inside PreTraded instead of on the next tick"); + + Fixtures.Tick(1); + T.Check(!JoinDefaults.IsQueued(p), "the sold pawn is still queued"); + T.Check(Fixtures.Comp.MembershipOf(p) == null, "the sold pawn got a caste: " + Fixtures.Comp.CasteOf(p)); + T.Check(Fixtures.Comp.MembershipOf(member) == null, "the sold member kept its caste"); + } + + [BlaxTest("join: an exception inside the buy scope leaves the scope stack empty")] + public static void ScopeSurvivesException() + { + MethodInfo preTraded = AccessTools.Method(typeof(Pawn), nameof(Pawn.PreTraded)); + Patches info = Harmony.GetPatchInfo(preTraded); + T.Check(info != null && info.Prefixes.Any(x => x.owner == BlaxCastesStartup.HarmonyId) && info.Finalizers.Any(x => x.owner == BlaxCastesStartup.HarmonyId), + "Pawn.PreTraded has no Blax Castes prefix and finalizer"); + + Pawn p = StockPawn(JoinStatus.JoinAsColonist); + // Without needs, vanilla throws inside PreTraded right after the scope opened. + Pawn_NeedsTracker needs = p.needs; + p.needs = null; + Exception thrown = null; + try + { + p.PreTraded(TradeAction.PlayerBuys, Fixtures.Colonist(), new TestTrader()); + } + catch (Exception e) + { + thrown = e; + } + finally + { + p.needs = needs; + } + T.NotNull(thrown, "PreTraded without needs did not throw (vanilla changed); the test needs another way to throw inside the scope"); + T.Info("thrown inside the scope: " + thrown.GetType().Name); + T.Equal(0, JoinScopes.Depth, "open join scopes after the exception"); + Fixtures.Spawn(p); + + // A scope left open inside another is closed with it. + Pawn other = Fixtures.Colonist(); + int outer = JoinScopes.Push("outer test scope"); + JoinScopes.Push("inner test scope", p); + T.Equal("inner test scope", JoinScopes.ReasonFor(p), "innermost scope for its pawn"); + T.Equal("outer test scope", JoinScopes.ReasonFor(other), "scope for another pawn (the inner one is bound to its pawn)"); + JoinScopes.Pop(outer); + T.Equal(0, JoinScopes.Depth, "open join scopes after popping the outer scope"); + JoinScopes.Pop(0); + T.Equal(0, JoinScopes.Depth, "Pop(0) changed the stack"); + } + + // ---- rows and settings --------------------------------------------------------------- + + [BlaxTest("join: a No caste row takes a recruited prisoner out of its caste and resets its policies; revertOnLeave off keeps them")] + public static void NoCasteReverts() + { + Caste prisoners = FoodCaste("Revert join test", Paste(), MedicalCareCategory.NoMeds); + Row(JoinReason.NewPrisoner, prisoners); + T.Check(CasteManager.SetJoinRow(JoinReason.NewColonist, JoinRowMode.NoCaste), "setup: SetJoinRow failed"); + FoodPolicy defaultFood = Current.Game.foodRestrictionDatabase.DefaultFoodRestriction(); + T.Check(defaultFood != Paste(), "setup: Paste is the default food policy"); + + Pawn p = Fixtures.Prisoner(); + T.Check(CasteManager.Assign(p, prisoners, true, JoinReason.NewPrisoner), "setup: Assign failed"); + T.Equal(MedicalCareCategory.NoMeds, p.playerSettings.medCare, "setup: prisoner's medical care"); + RecruitUtility.Recruit(p, Faction.OfPlayer); + Fixtures.Tick(1); + T.Check(Fixtures.Comp.MembershipOf(p) == null, Who(p) + " is still in " + Fixtures.Comp.CasteOf(p)); + T.Check(p.foodRestriction.CurrentFoodPolicy == defaultFood, Who(p) + "'s food did not return to the default: " + Policies(p)); + T.Equal(Find.PlaySettings.defaultCareForColonist, p.playerSettings.medCare, Who(p) + "'s medical care after the revert"); + + Fixtures.Settings.revertOnLeave = false; + Pawn kept = Fixtures.Prisoner(); + T.Check(CasteManager.Assign(kept, prisoners, true, JoinReason.NewPrisoner), "setup: Assign failed"); + RecruitUtility.Recruit(kept, Faction.OfPlayer); + Fixtures.Tick(1); + T.Check(Fixtures.Comp.MembershipOf(kept) == null, Who(kept) + " is still in " + Fixtures.Comp.CasteOf(kept)); + T.Check(kept.foodRestriction.CurrentFoodPolicy == Paste(), Who(kept) + " lost the caste's food with revertOnLeave off: " + Policies(kept)); + } + + [BlaxTest("join: with join defaults off, buying, capturing and recruiting queue nothing")] + public static void DisabledQueuesNothing() + { + Caste c = RowCaste("Disabled join test", Worker(), Fine()); + foreach (string reason in JoinReason.Rows) + Row(reason, c); + Fixtures.Settings.enableJoinDefaults = false; + + Pawn bought = StockPawn(JoinStatus.JoinAsColonist); + Buy(bought, Fixtures.Colonist(), new TestTrader()); + Pawn prisoner = Fixtures.Prisoner(); + T.Check(!JoinDefaults.IsQueued(prisoner), "a captured prisoner was queued with join defaults off"); + RecruitUtility.Recruit(prisoner, Faction.OfPlayer); + JoinDefaults.Enqueue(bought, JoinReason.NewColonist); + foreach (Pawn p in new[] { bought, prisoner }) + T.Check(!JoinDefaults.IsQueued(p), Who(p) + " was queued with join defaults off"); + + Fixtures.Settings.enableJoinDefaults = true; + Fixtures.Settings.enabled = false; + JoinDefaults.Enqueue(bought, JoinReason.NewColonist); + T.Check(!JoinDefaults.IsQueued(bought), "a pawn was queued with Castes off"); + + Fixtures.Tick(1); + foreach (Pawn p in new[] { bought, prisoner }) + T.Check(Fixtures.Comp.MembershipOf(p) == null, Who(p) + " got a caste with join defaults off"); + } + + [BlaxTest("join: a specific reason beats a status fallback when a pawn is queued twice; reasons resolve to rows by final status")] + public static void SpecificBeatsFallback() + { + Pawn p = Fixtures.Colonist(); + Unqueue(p); + JoinDefaults.Enqueue(p, JoinDefaults.StatusFallback); + T.Equal(JoinDefaults.StatusFallback, JoinDefaults.QueuedFor(p)?.reason, "first reason"); + JoinDefaults.Enqueue(p, JoinScopes.Bought); + T.Equal(JoinScopes.Bought, JoinDefaults.QueuedFor(p)?.reason, "reason after a specific one"); + JoinDefaults.Enqueue(p, JoinDefaults.StatusFallback); + T.Equal(JoinScopes.Bought, JoinDefaults.QueuedFor(p)?.reason, "reason after a second status fallback"); + T.Equal(1, Fixtures.Comp.JoinQueue.Count(q => q != null && q.pawn == p), "queue entries for one pawn"); + Unqueue(p); + + T.Equal(JoinReason.BoughtColonist, JoinDefaults.RowFor(JoinScopes.Bought, p), "bought colonist row"); + T.Equal(JoinReason.NewColonist, JoinDefaults.RowFor(JoinDefaults.StatusFallback, p), "status row of a colonist"); + T.Equal(JoinReason.NewSlave, JoinDefaults.RowFor(JoinReason.NewSlave, p), "a row id resolves to itself"); + Pawn prisoner = Fixtures.Prisoner(); + T.Equal(JoinReason.NewPrisoner, JoinDefaults.RowFor(JoinDefaults.StatusFallback, prisoner), "status row of a prisoner"); + T.Equal(JoinReason.NewPrisoner, JoinDefaults.RowFor(JoinScopes.Bought, prisoner), "bought row of a prisoner falls back to its status"); + Unqueue(prisoner); + if (!ModsConfig.IdeologyActive) + T.Skip("slaves need Ideology; colonist and prisoner rows passed"); + Pawn slave = Fixtures.ColonySlave(); + T.Equal(JoinReason.BoughtSlave, JoinDefaults.RowFor(JoinScopes.Bought, slave), "bought slave row"); + T.Equal(JoinReason.NewSlave, JoinDefaults.RowFor(JoinDefaults.StatusFallback, slave), "status row of a slave"); + Unqueue(slave); + } + + [BlaxTest("join: babies and quest lodgers are never queued")] + public static void BabiesAndLodgersSkipped() + { + Pawn lodger = Fixtures.QuestLodger(); + JoinDefaults.Enqueue(lodger, JoinDefaults.StatusFallback); + T.Check(!JoinDefaults.IsQueued(lodger), "a quest lodger was queued"); + if (!ModsConfig.BiotechActive) + T.Skip("babies need Biotech; the lodger check passed"); + Pawn baby = Fixtures.Baby(); + JoinDefaults.Enqueue(baby, JoinDefaults.StatusFallback); + T.Check(!JoinDefaults.IsQueued(baby), "a baby was queued"); + + Faction other = Fixtures.FriendlyFaction(); + T.NotNull(other, "a friendly faction"); + Pawn foreignBaby = Fixtures.Spawn(Fixtures.Generate(PawnKindDefOf.Colonist, other, DevelopmentalStage.Baby)); + foreignBaby.SetFaction(Faction.OfPlayer); + T.Check(!JoinDefaults.IsQueued(foreignBaby), "a baby that joined the colony was queued"); + } + + [BlaxTest("join: a caste picked by hand before the join is applied wins over the row")] + public static void HandPickWins() + { + Caste rowCaste = FoodCaste("Row caste (hand pick test)", Paste()); + Caste handCaste = FoodCaste("Hand caste (hand pick test)", Fine()); + Row(JoinReason.BoughtColonist, rowCaste); + + Pawn p = StockPawn(JoinStatus.JoinAsColonist); + Buy(p, Fixtures.Colonist(), new TestTrader()); + T.Check(JoinDefaults.IsQueued(p), "setup: the bought pawn was not queued"); + T.Check(CasteManager.Assign(p, handCaste, false, JoinReason.Manual), "setup: Assign failed"); + + Fixtures.Tick(1); + T.Check(Fixtures.Comp.CasteOf(p) == handCaste, Who(p) + " is in " + Fixtures.Comp.CasteOf(p) + ", not the hand-picked caste"); + T.Check(p.foodRestriction.CurrentFoodPolicy == Fine(), Who(p) + " lost the hand-picked caste's food: " + Policies(p)); + } + + [BlaxTest("join defaults window: rows, picker labels, menu entries and strings")] + public static void Window() + { + T.NotNull(new Dialog_JoinDefaults(), "new Dialog_JoinDefaults()"); + List rows = Dialog_JoinDefaults.VisibleRows(); + T.Equal(ModsConfig.IdeologyActive ? 5 : 3, rows.Count, "rows shown"); + + Caste c = FoodCaste("Window join test", Simple()); + Caste other = FoodCaste("Window join test default", Fine()); + CasteManager.SetDefault(null); + const string reason = JoinReason.NewColonist; + List menu = Dialog_JoinDefaults.RowMenu(reason); + T.Equal(2 + Fixtures.Comp.Castes.Count, menu.Count, "menu entries (No caste, Default caste, one per caste)"); + + menu.First(o => o.Label == c.label).action(); + T.Check(Fixtures.Comp.ResolveRow(reason) == c, "picking a caste did not set the row"); + T.Equal(c.label, Dialog_JoinDefaults.RowButtonLabel(reason), "picker label for a caste"); + + menu[1].action(); + T.Equal(JoinRowMode.DefaultCaste, Fixtures.Comp.GetRow(reason).mode, "row mode after picking Default caste"); + T.Equal((string)"BlaxCastes_DefaultCasteNone".Translate(), Dialog_JoinDefaults.RowButtonLabel(reason), "picker label with no default set"); + CasteManager.SetDefault(other); + T.Check(Dialog_JoinDefaults.RowButtonLabel(reason).Contains(other.label), "picker label does not name the default caste"); + + menu[0].action(); + T.Equal(JoinRowMode.NoCaste, Fixtures.Comp.GetRow(reason).mode, "row mode after picking No caste"); + T.Equal((string)"BlaxCastes_NoCaste".Translate(), Dialog_JoinDefaults.RowButtonLabel(reason), "picker label for No caste"); + + Pawn a = Fixtures.Colonist(), b = Fixtures.Colonist(); + string one = JoinDefaults.MessageText(c, new List { a }); + string two = JoinDefaults.MessageText(c, new List { a, b }); + T.Check(one.Contains(a.LabelShort) && one.Contains(c.label), "single join message: " + one); + T.Check(two.Contains(a.LabelShort) && two.Contains(b.LabelShort) && two.Contains("2") && two.Contains(c.label), "grouped join message: " + two); + + var keys = new List + { + "BlaxCastes_JoinDefaultsDesc", "BlaxCastes_JoinDefaultsOff", "BlaxCastes_JoinDefaultsNoCastes", + "BlaxCastes_DefaultCasteNamed", "BlaxCastes_DefaultCasteNone", "BlaxCastes_JoinedCaste", "BlaxCastes_JoinedCasteMany", + }; + keys.AddRange(JoinReason.Rows.Select(r => "BlaxCastes_RowTip_" + r)); + List missing = keys.Where(k => !k.CanTranslate()).ToList(); + T.Check(missing.Count == 0, "strings missing from Keyed: " + string.Join(", ", missing)); + } + + // ---- other mods ---------------------------------------------------------------------- + + [BlaxTest("join compat: a buy-mode slave or colonist choice (Blax Slaves or Trade as Slave or Colonist) lands in the right bought row")] + public static void BuyModeChoice() + { + if (!ModsConfig.IdeologyActive) + T.Skip("slaves need Ideology"); + bool tasoc = Compat.IsActive(TaSoC); + bool slaves = Compat.IsActive(Compat.BlaxSlaves); + if (!tasoc && !slaves) + T.Skip("neither Blax Slaves nor Trade as Slave or Colonist is active (run with -Compat)"); + + Caste slaveCaste = RowCaste("Bought slaves (buy mode test)", SlaveOrSoldier(), Simple()); + Caste colonistCaste = RowCaste("Bought colonists (buy mode test)", Worker(), Fine()); + Row(JoinReason.BoughtSlave, slaveCaste); + Row(JoinReason.BoughtColonist, colonistCaste); + Row(JoinReason.NewSlave, colonistCaste); + Row(JoinReason.NewColonist, slaveCaste); + + // Stock that starts the other way, so the choice has to flip it. + Pawn toSlave = StockPawn(JoinStatus.JoinAsColonist); + Pawn toColonist = StockPawn(JoinStatus.JoinAsSlave); + Pawn negotiator = Fixtures.Colonist(); + var trader = new TestTrader(); + T.NotNull(trader.TraderKind, "a trader kind"); + + ITrader oldTrader = TradeSession.trader; + Pawn oldNegotiator = TradeSession.playerNegotiator; + TradeDeal oldDeal = TradeSession.deal; + bool oldGift = TradeSession.giftMode; + try + { + TradeSession.trader = trader; + TradeSession.playerNegotiator = negotiator; + TradeSession.deal = null; + TradeSession.giftMode = false; + foreach ((Pawn pawn, bool wantSlave) in new[] { (toSlave, true), (toColonist, false) }) + { + var tradeable = new Tradeable_Pawn(); + tradeable.AddThing(pawn, Transactor.Trader); + if (tasoc) + ChooseWithTaSoC(tradeable, pawn, wantSlave); + else + ChooseWithBlaxSlaves(tradeable, pawn, wantSlave); + tradeable.ForceToSource(1); + T.Equal(TradeAction.PlayerBuys, tradeable.ActionToDo, "trade action for " + Who(pawn)); + tradeable.ResolveTrade(); + T.Check(pawn.IsSlaveOfColony == wantSlave, Who(pawn) + (wantSlave ? " did not join as slave" : " did not join as colonist")); + T.Equal(JoinScopes.Bought, JoinDefaults.QueuedFor(pawn)?.reason, Who(pawn) + "'s queued reason"); + Fixtures.Spawn(pawn); + } + } + finally + { + TradeSession.trader = oldTrader; + TradeSession.playerNegotiator = oldNegotiator; + TradeSession.deal = oldDeal; + TradeSession.giftMode = oldGift; + } + T.Info("buy mode driven through " + (tasoc ? "Trade as Slave or Colonist" : "Blax Slaves")); + + Fixtures.Tick(1); + CheckMember(toSlave, slaveCaste, JoinReason.BoughtSlave); + CheckMember(toColonist, colonistCaste, JoinReason.BoughtColonist); + } + + /// Trade as Slave or Colonist keeps the choice per trade row and sets joinStatus only during ResolveTrade. + private static void ChooseWithTaSoC(Tradeable tradeable, Pawn pawn, bool wantSlave) + { + MethodInfo getOrCreate = AccessTools.Method("TradeAsSlaveOrColonist.Choices:GetOrCreate"); + T.NotNull(getOrCreate, "TradeAsSlaveOrColonist.Choices.GetOrCreate (mod updated?)"); + object selection = getOrCreate.Invoke(null, new object[] { tradeable, pawn }); + T.NotNull(selection, "Trade as Slave or Colonist selection"); + FieldInfo mode = AccessTools.Field(selection.GetType(), "Mode"); + T.NotNull(mode, "Selection.Mode (mod updated?)"); + mode.SetValue(selection, wantSlave ? JoinStatus.JoinAsSlave : JoinStatus.JoinAsColonist); + } + + /// Blax Slaves' buy mode flips joinStatus on the pawn, as its trade-row button does. + private static void ChooseWithBlaxSlaves(Tradeable tradeable, Pawn pawn, bool wantSlave) + { + MethodInfo toggle = AccessTools.Method("BlaxSlaves.BuyMode:Toggle"); + T.NotNull(toggle, "BlaxSlaves.BuyMode.Toggle"); + bool isSlave = pawn.guest.joinStatus == JoinStatus.JoinAsSlave; + if (isSlave != wantSlave) + T.Check((bool)toggle.Invoke(null, new object[] { tradeable }), "Blax Slaves refused to switch " + Who(pawn) + " (buy mode off in its settings?)"); + T.Equal(wantSlave ? JoinStatus.JoinAsSlave : JoinStatus.JoinAsColonist, pawn.guest.joinStatus, Who(pawn) + "'s joinStatus after the switch"); + } + + // ---- save and reload ----------------------------------------------------------------- + + // Runs last in this class (source order): the queued join is checked after the reload. + [BlaxTest("join: set up a queued join for the reload")] + public static void ReloadSetup() + { + Fixtures.KeepCasteState(); + Caste c = Fixtures.KeepCaste(RowCaste("Reload join test", Worker(), Fine())); + Row(JoinReason.BoughtColonist, c); + Pawn p = Fixtures.Keep(StockPawn(JoinStatus.JoinAsColonist)); + Buy(p, Fixtures.Colonist(), new TestTrader()); + QueuedJoin q = JoinDefaults.QueuedFor(p); + T.NotNull(q, "setup: the bought pawn was not queued"); + T.Check(Fixtures.Comp.MembershipOf(p) == null, "setup: the join was applied before the save"); + // Queued "on an earlier tick", so phase 2 can apply it without ticking the kept fixture prisoners. + q.tick--; + T.Carry["joinPawn"] = p.ThingID; + T.Carry["joinCaste"] = c.id.ToString(); + } + + [BlaxTest("join: a join queued before saving survives the reload and is applied", phase: 2)] + public static void QueuedJoinSurvives() + { + string casteId = null; + T.Check(T.Carry.TryGetValue("joinPawn", out string pawnId) && T.Carry.TryGetValue("joinCaste", out casteId), "phase 1 setup did not run"); + Pawn p = Fixtures.FindPawnById(pawnId); + T.NotNull(p, "the bought pawn after reload"); + Caste c = Fixtures.Comp.Castes.FirstOrDefault(x => x.id.ToString() == casteId); + T.NotNull(c, "the join test caste after reload"); + QueuedJoin q = JoinDefaults.QueuedFor(p); + if (q != null) + { + T.Equal(JoinScopes.Bought, q.reason, "queued reason after reload"); + JoinDefaults.ApplyQueue(); + } + else + { + T.Info("the game ticked after the reload; the join was already applied"); + } + T.Check(!JoinDefaults.IsQueued(p), Who(p) + " is still queued"); + CheckMember(p, c, JoinReason.BoughtColonist); + T.Check(p.foodRestriction.CurrentFoodPolicy == c.FoodPolicy && p.outfits.CurrentApparelPolicy == c.ApparelPolicy, + Who(p) + " does not have the caste's policies after the reload: " + Policies(p)); + } + } +} diff --git a/Tests/BlaxCastesTests/Source/ManagerTests.cs b/Tests/BlaxCastesTests/Source/ManagerTests.cs new file mode 100644 index 0000000..d5e48fb --- /dev/null +++ b/Tests/BlaxCastesTests/Source/ManagerTests.cs @@ -0,0 +1,152 @@ +using System.Collections.Generic; +using System.Linq; +using BlaxCastes; +using RimWorld; +using Verse; + +namespace BlaxCastesTests +{ + /// CasteManager: create, duplicate, delete, default caste, join rows and memberships. + public static class ManagerTests + { + private static Caste Full(string label) + { + Caste c = Fixtures.NewCaste(label); + CasteManager.SetSlot(c, CasteSlot.Apparel, Fixtures.Need(Fixtures.Outfit("OutfitNudist"), "Nudist outfit")); + CasteManager.SetSlot(c, CasteSlot.Food, Fixtures.Need(Fixtures.Food("FoodRestrictionSimple"), "Simple food")); + CasteManager.SetSlot(c, CasteSlot.Drug, Fixtures.Need(Fixtures.Drug("NoDrugs"), "No drugs")); + CasteManager.SetSlot(c, CasteSlot.Reading, Fixtures.Need(Fixtures.Reading("NoneReadingPolicy"), "None reading")); + CasteManager.SetSlot(c, CasteSlot.MedCare, MedicalCareCategory.HerbalOrWorse); + return c; + } + + private static string Policies(Pawn p) => + string.Join(", ", CasteUtility.AllSlots.Select(s => s + "=" + CasteUtility.ValueLabel(s, CasteUtility.CurrentValue(p, s)))); + + [BlaxTest("manager: CreateCaste gives unique, rising ids and manages nothing")] + public static void CreateUniqueIds() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + int maxBefore = comp.Castes.Count == 0 ? 0 : comp.Castes.Max(c => c.id); + Caste a = Fixtures.NewCaste(); + Caste b = Fixtures.NewCaste(); + Caste c3 = Fixtures.NewCaste(); + var ids = new[] { a.id, b.id, c3.id }; + T.Check(ids.Distinct().Count() == 3, "ids not unique: " + string.Join(", ", ids)); + T.Check(ids.All(id => id > maxBefore), "ids not above the existing ones: " + string.Join(", ", ids) + ", max before " + maxBefore); + T.Check(a.id < b.id && b.id < c3.id, "ids not rising: " + string.Join(", ", ids)); + T.Check(comp.Castes.Contains(a) && comp.Castes.Contains(b) && comp.Castes.Contains(c3), "new castes not in the component"); + T.Equal((string)"BlaxCastes_NewCasteLabel".Translate(a.id), a.label, "default label"); + T.Check(!a.AnyManaged(), "a new caste manages a slot"); + T.Check(a.GetUniqueLoadID() != b.GetUniqueLoadID(), "two castes share a load ID"); + T.Check(a.GetUniqueLoadID().StartsWith("BlaxCaste_"), "load ID does not use LoadKey BlaxCaste: " + a.GetUniqueLoadID()); + + // Deleting the newest caste does not hand its id out again. + int deletedId = c3.id; + T.Check(CasteManager.DeleteCaste(c3), "DeleteCaste failed"); + Caste d = Fixtures.NewCaste(); + T.Check(d.id > deletedId, $"id {d.id} reused after deleting caste {deletedId}"); + } + + [BlaxTest("manager: DuplicateCaste copies every slot into a new caste with its own id")] + public static void DuplicateCopiesSlots() + { + Caste src = Full("Duplicate source"); + Pawn member = Fixtures.Colonist(); + CasteManager.Assign(member, src, false, JoinReason.Manual); + + Caste dup = CasteManager.DuplicateCaste(src); + T.NotNull(dup, "DuplicateCaste result"); + T.Check(Fixtures.Comp.HasCaste(dup), "duplicate not in the component"); + T.Check(dup.id != src.id, "duplicate has the source's id"); + foreach (CasteSlot slot in CasteUtility.AllSlots) + T.Check(CasteUtility.SameValue(src.GetSlot(slot), dup.GetSlot(slot)), $"{slot}: source {CasteUtility.ValueLabel(slot, src.GetSlot(slot))}, duplicate {CasteUtility.ValueLabel(slot, dup.GetSlot(slot))}"); + T.Equal(0, Fixtures.Comp.MembersOf(dup).Count, "members of the duplicate"); + T.Check(Fixtures.Comp.CasteOf(member) == src, "the source's member moved to the duplicate"); + CasteManager.DeleteCaste(dup); + } + + [BlaxTest("manager: DeleteCaste removes the caste, makes members casteless, resets its rows and leaves policies alone")] + public static void DeleteCaste() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + Caste doomed = Full("Doomed"); + Caste other = Fixtures.NewCaste("Other"); + Pawn a = Fixtures.Colonist(); + Pawn b = Fixtures.Colonist(); + CasteManager.Assign(a, doomed, false, JoinReason.Manual); + CasteManager.Assign(b, doomed, true, JoinReason.NewColonist); + CasteManager.SetJoinRow(JoinReason.BoughtSlave, JoinRowMode.SpecificCaste, doomed); + CasteManager.SetJoinRow(JoinReason.NewPrisoner, JoinRowMode.SpecificCaste, doomed); + CasteManager.SetJoinRow(JoinReason.NewSlave, JoinRowMode.SpecificCaste, other); + CasteManager.SetJoinRow(JoinReason.NewColonist, JoinRowMode.DefaultCaste); + CasteManager.SetDefault(doomed); + T.Check(comp.ResolveRow(JoinReason.NewColonist) == doomed, "setup: Default caste row does not resolve to the default"); + string aBefore = Policies(a), bBefore = Policies(b); + + T.Check(CasteManager.DeleteCaste(doomed), "DeleteCaste returned false"); + T.Check(!comp.HasCaste(doomed), "caste still in the component"); + T.Equal(0, comp.MembersOf(doomed).Count, "members left in the deleted caste"); + foreach (Pawn p in new[] { a, b }) + { + CasteMembership m = comp.MembershipOf(p); + T.NotNull(m, p.LabelShort + "'s membership record"); + T.Check(m.caste == null && m.reason == JoinReason.CasteDeleted, $"{p.LabelShort}: caste={m.caste}, reason={m.reason}"); + } + T.Equal(aBefore, Policies(a), "A's policies after delete"); + T.Equal(bBefore, Policies(b), "B's policies after delete"); + T.Equal(JoinRowMode.NoCaste, comp.GetRow(JoinReason.BoughtSlave).mode, "bought-as-slave row"); + T.Equal(JoinRowMode.NoCaste, comp.GetRow(JoinReason.NewPrisoner).mode, "new-prisoner row"); + T.Check(comp.GetRow(JoinReason.NewSlave).mode == JoinRowMode.SpecificCaste && comp.GetRow(JoinReason.NewSlave).caste == other, "a row pointing at another caste changed"); + T.Check(comp.DefaultCaste == null, "the deleted caste is still the default"); + T.Check(comp.ResolveRow(JoinReason.NewColonist) == null, "a Default caste row resolves to a caste with no default set"); + T.Check(!CasteManager.DeleteCaste(doomed), "deleting twice returned true"); + } + + [BlaxTest("manager: SetDefault changes what Default caste rows resolve to")] + public static void SetDefaultResolves() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + Caste one = Fixtures.NewCaste("One"); + Caste two = Fixtures.NewCaste("Two"); + CasteManager.SetDefault(null); + T.Check(CasteManager.SetJoinRow(JoinReason.NewColonist, JoinRowMode.DefaultCaste), "SetJoinRow failed"); + T.Check(comp.ResolveRow(JoinReason.NewColonist) == null, "Default caste row resolves without a default"); + T.Check(CasteManager.SetDefault(one), "SetDefault(one) failed"); + T.Check(comp.ResolveRow(JoinReason.NewColonist) == one, "row does not resolve to the first default"); + T.Check(CasteManager.SetDefault(two), "SetDefault(two) failed"); + T.Check(comp.ResolveRow(JoinReason.NewColonist) == two, "row does not resolve to the new default"); + T.Check(CasteManager.SetDefault(null), "SetDefault(null) failed"); + T.Check(comp.DefaultCaste == null && comp.ResolveRow(JoinReason.NewColonist) == null, "clearing the default left a default"); + + var stranger = new Caste(9999, "Not in this game"); + T.Check(!CasteManager.SetDefault(stranger), "SetDefault accepted a caste that is not in the game"); + T.Check(!CasteManager.SetJoinRow(JoinReason.NewColonist, JoinRowMode.SpecificCaste, stranger), "SetJoinRow accepted a caste that is not in the game"); + T.Check(!CasteManager.SetJoinRow(JoinReason.NewColonist, JoinRowMode.SpecificCaste, null), "SetJoinRow accepted SpecificCaste without a caste"); + T.Check(CasteManager.SetJoinRow(JoinReason.NewColonist, JoinRowMode.SpecificCaste, one) && comp.ResolveRow(JoinReason.NewColonist) == one, "SpecificCaste row does not resolve to its caste"); + } + + [BlaxTest("manager: only player-side humanlikes can be members; MakeCasteless keeps policies")] + public static void MembershipRules() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + Caste c = Full("Rules"); + Faction other = Fixtures.FriendlyFaction(); + T.NotNull(other, "a friendly faction"); + Pawn visitor = Fixtures.Spawn(Fixtures.Generate(other.def.basicMemberKind ?? PawnKindDefOf.Colonist, other)); + T.Check(!CasteManager.Assign(visitor, c, false, JoinReason.Manual), "a pawn of another faction joined a caste"); + T.Check(comp.MembershipOf(visitor) == null, "a refused Assign left a record"); + T.Check(!CasteManager.Assign(null, c, false, JoinReason.Manual), "Assign(null) returned true"); + + Pawn p = Fixtures.Colonist(); + T.Check(CasteManager.Assign(p, c, false, JoinReason.Manual), "Assign failed"); + string withCaste = Policies(p); + T.Check(CasteManager.MakeCasteless(p), "MakeCasteless failed"); + CasteMembership m = comp.MembershipOf(p); + T.Check(m != null && m.Casteless && !m.auto, "MakeCasteless did not leave a casteless-by-choice record"); + T.Equal(withCaste, Policies(p), "policies after MakeCasteless"); + T.Check(CasteManager.EndMembership(p) && comp.MembershipOf(p) == null, "EndMembership left a record"); + T.Check(CasteManager.Assign(p, null, false, JoinReason.Manual) && comp.MembershipOf(p).Casteless, "Assign(pawn, null) did not make the pawn casteless"); + } + } +} diff --git a/Tests/BlaxCastesTests/Source/PersistenceTests.cs b/Tests/BlaxCastesTests/Source/PersistenceTests.cs new file mode 100644 index 0000000..00e4c63 --- /dev/null +++ b/Tests/BlaxCastesTests/Source/PersistenceTests.cs @@ -0,0 +1,197 @@ +using System.Linq; +using BlaxCastes; +using RimWorld; +using RimWorld.Planet; +using Verse; + +namespace BlaxCastesTests +{ + /// Save safety: purging, a component added mid-save, and state that must survive save and reload. + public static class PersistenceTests + { + [BlaxTest("save: Purge drops destroyed and discarded pawns and keeps a dead one its corpse still holds")] + public static void PurgeRules() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + Caste c = Fixtures.NewCaste("Purge test"); + + Pawn destroyed = Fixtures.Colonist(); + Pawn discarded = Fixtures.Generate(PawnKindDefOf.Colonist, Faction.OfPlayer); + Pawn dead = Fixtures.Colonist(); + Pawn alive = Fixtures.Colonist(); + foreach (Pawn p in new[] { destroyed, discarded, dead, alive }) + T.Check(CasteManager.Assign(p, c, false, JoinReason.Manual), "Assign failed for " + p.LabelShort); + + destroyed.Destroy(DestroyMode.Vanish); + Find.WorldPawns.PassToWorld(discarded); + Find.WorldPawns.RemoveAndDiscardPawnViaGC(discarded); + dead.Kill(null); + T.Check(destroyed.Destroyed && !destroyed.Dead, "setup: destroyed pawn is not destroyed-but-alive"); + T.Check(discarded.Discarded, "setup: discarded pawn is not discarded"); + T.Check(dead.Dead && dead.Corpse != null, "setup: dead pawn has no corpse"); + + int removed = comp.Purge(); + T.Check(comp.MembershipOf(destroyed) == null, "Purge kept a destroyed, living pawn"); + T.Check(comp.MembershipOf(discarded) == null, "Purge kept a discarded pawn"); + T.Check(comp.CasteOf(dead) == c, "Purge dropped a dead pawn whose corpse still exists"); + T.Check(comp.CasteOf(alive) == c, "Purge dropped a living colonist"); + T.Check(removed >= 2, "Purge reported " + removed + " removed, expected at least 2"); + } + + [BlaxTest("save: a component created for a save without one (mod added mid-save) starts empty with five No caste rows")] + public static void FreshComponent() + { + var fresh = new GameComponent_BlaxCastes(Current.Game); + T.Equal(0, fresh.Castes.Count, "castes"); + T.Equal(0, fresh.Memberships.Count, "memberships"); + T.Equal(0, fresh.JoinQueue.Count, "queued joins"); + T.Check(fresh.DefaultCaste == null, "default caste set"); + T.Equal(1, fresh.NextCasteId, "next caste id"); + T.Equal(JoinReason.Rows.Length, fresh.JoinRows.Count, "join rows"); + T.Check(fresh.JoinRows.All(r => r.mode == JoinRowMode.NoCaste), "a join row of a fresh component is not No caste"); + T.Check(GameComponent_BlaxCastes.Instance != fresh, "a stray component became Instance"); + T.Equal(1, Current.Game.components.Count(x => x is GameComponent_BlaxCastes), "GameComponent_BlaxCastes in the game"); + } + + // Runs last in this class (source order): the castes, rows and pawns it keeps are checked after the reload. + [BlaxTest("save: set up castes, rows and memberships for the reload")] + public static void ReloadSetup() + { + Fixtures.KeepCasteState(); + ApparelPolicy worker = Fixtures.Need(Fixtures.Outfit("OutfitWorker"), "Worker outfit"); + FoodPolicy simple = Fixtures.Need(Fixtures.Food("FoodRestrictionSimple"), "Simple food"); + FoodPolicy paste = Fixtures.Need(Fixtures.Food("FoodRestrictionPaste"), "Paste food"); + DrugPolicy noDrugs = Fixtures.Need(Fixtures.Drug("NoDrugs"), "No drugs"); + ReadingPolicy none = Fixtures.Need(Fixtures.Reading("NoneReadingPolicy"), "None reading"); + + Caste full = Fixtures.KeepCaste(Fixtures.NewCaste("Reload full")); + CasteManager.SetSlot(full, CasteSlot.Apparel, worker); + CasteManager.SetSlot(full, CasteSlot.Food, simple); + CasteManager.SetSlot(full, CasteSlot.Drug, noDrugs); + CasteManager.SetSlot(full, CasteSlot.Reading, none); + CasteManager.SetSlot(full, CasteSlot.MedCare, MedicalCareCategory.HerbalOrWorse); + Caste partial = Fixtures.KeepCaste(Fixtures.NewCaste("Reload partial")); + CasteManager.SetSlot(partial, CasteSlot.Food, paste); + + T.Check(CasteManager.SetDefault(partial), "SetDefault failed"); + T.Check(CasteManager.SetJoinRow(JoinReason.BoughtSlave, JoinRowMode.SpecificCaste, full), "SetJoinRow boughtSlave failed"); + T.Check(CasteManager.SetJoinRow(JoinReason.NewPrisoner, JoinRowMode.DefaultCaste), "SetJoinRow newPrisoner failed"); + T.Check(CasteManager.SetJoinRow(JoinReason.NewColonist, JoinRowMode.NoCaste), "SetJoinRow newColonist failed"); + + Pawn member = Fixtures.Keep(Fixtures.Colonist()); + Pawn casteless = Fixtures.Keep(Fixtures.Colonist()); + Pawn prisoner = Fixtures.Keep(Fixtures.Prisoner()); + Pawn gone = Fixtures.Colonist(); // destroyed by the cleanup after this test; its record must not survive the save + T.Check(CasteManager.Assign(member, full, true, JoinReason.NewColonist), "Assign member failed"); + T.Check(CasteManager.Assign(casteless, full, false, JoinReason.Manual) && CasteManager.MakeCasteless(casteless), "casteless setup failed"); + T.Check(CasteManager.Assign(prisoner, partial, true, JoinReason.NewPrisoner), "Assign prisoner failed"); + T.Check(CasteManager.Assign(gone, full, false, JoinReason.Manual), "Assign gone failed"); + + T.Carry["fullId"] = full.id.ToString(); + T.Carry["partialId"] = partial.id.ToString(); + T.Carry["worker"] = worker.id.ToString(); + T.Carry["simple"] = simple.id.ToString(); + T.Carry["paste"] = paste.id.ToString(); + T.Carry["noDrugs"] = noDrugs.id.ToString(); + T.Carry["none"] = none.id.ToString(); + T.Carry["member"] = member.ThingID; + T.Carry["casteless"] = casteless.ThingID; + T.Carry["prisoner"] = prisoner.ThingID; + T.Carry["gone"] = gone.ThingID; + // Later phase-1 tests (UiTests) still create and delete castes, so read the id at save time. + T.CarryAtSave("nextId", () => Fixtures.Comp.NextCasteId.ToString()); + } + + // ---- phase 2 ----------------------------------------------------------------------------- + + private static Caste CasteById(string key) + { + T.Check(T.Carry.TryGetValue(key, out string id), "phase 1 value " + key + " missing (did the setup run?)"); + Caste c = Fixtures.Comp.Castes.FirstOrDefault(x => x.id.ToString() == id); + T.NotNull(c, "caste " + key + " (id " + id + ") after reload"); + return c; + } + + private static Pawn PawnById(string key) + { + T.Check(T.Carry.TryGetValue(key, out string id), "phase 1 value " + key + " missing (did the setup run?)"); + return Fixtures.FindPawnById(id); + } + + private static void CheckPolicy(object slotValue, string carryKey, string what) + { + T.Check(slotValue is Policy p, what + " is not a policy after reload: " + (slotValue ?? "null")); + Policy policy = (Policy)slotValue; + T.Equal(T.Carry[carryKey], policy.id.ToString(), what + " policy id"); + T.Check(CasteUtility.PolicyExists(policy), what + " policy " + policy.label + " is not the game's own instance after reload"); + } + + [BlaxTest("save: castes, slots, default caste and join rows survive save and reload", phase: 2)] + public static void CastesSurvive() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + T.NotNull(comp, "GameComponent_BlaxCastes.Instance after reload"); + Caste full = CasteById("fullId"); + Caste partial = CasteById("partialId"); + T.Equal("Reload full", full.label, "full caste label"); + T.Equal("Reload partial", partial.label, "partial caste label"); + + CheckPolicy(full.ApparelPolicy, "worker", "full caste apparel"); + CheckPolicy(full.FoodPolicy, "simple", "full caste food"); + CheckPolicy(full.DrugPolicy, "noDrugs", "full caste drugs"); + CheckPolicy(full.ReadingPolicy, "none", "full caste reading"); + T.Equal((int)MedicalCareCategory.HerbalOrWorse, full.MedCare, "full caste medical care"); + + CheckPolicy(partial.FoodPolicy, "paste", "partial caste food"); + T.Check(!partial.IsManaged(CasteSlot.Apparel) && !partial.IsManaged(CasteSlot.Drug) && !partial.IsManaged(CasteSlot.Reading) && !partial.IsManaged(CasteSlot.MedCare), + "partial caste gained managed slots over the reload"); + + T.Check(comp.DefaultCaste == partial, "default caste after reload: " + comp.DefaultCaste); + JoinRow bought = comp.GetRow(JoinReason.BoughtSlave); + T.Check(bought.mode == JoinRowMode.SpecificCaste && bought.caste == full, $"bought-as-slave row: {bought.mode} {bought.caste}"); + T.Equal(JoinRowMode.DefaultCaste, comp.GetRow(JoinReason.NewPrisoner).mode, "new-prisoner row mode"); + T.Check(comp.ResolveRow(JoinReason.NewPrisoner) == partial, "new-prisoner row does not resolve to the default caste"); + T.Equal(JoinRowMode.NoCaste, comp.GetRow(JoinReason.NewColonist).mode, "new-colonist row mode"); + T.Equal(JoinReason.Rows.Length, comp.JoinRows.Count, "join rows after reload"); + T.Equal(T.Carry["nextId"], comp.NextCasteId.ToString(), "next caste id after reload"); + } + + [BlaxTest("save: memberships survive save and reload, including a casteless-by-choice entry", phase: 2)] + public static void MembershipsSurvive() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + Caste full = CasteById("fullId"); + Caste partial = CasteById("partialId"); + + Pawn member = PawnById("member"); + T.NotNull(member, "member pawn after reload"); + CasteMembership m = comp.MembershipOf(member); + T.NotNull(m, "member's record after reload"); + T.Check(m.caste == full && m.auto && m.reason == JoinReason.NewColonist, $"member's record: caste={m.caste}, auto={m.auto}, reason={m.reason}"); + T.Equal(0, CasteManager.Overrides(member).Count, "member's overrides after reload"); + + Pawn casteless = PawnById("casteless"); + T.NotNull(casteless, "casteless pawn after reload"); + CasteMembership cm = comp.MembershipOf(casteless); + T.NotNull(cm, "casteless-by-choice record after reload (lost, so the pawn looks like it never had a caste)"); + T.Check(cm.Casteless, "casteless-by-choice pawn is in caste " + cm.caste); + + Pawn prisoner = PawnById("prisoner"); + T.NotNull(prisoner, "prisoner after reload"); + T.Check(comp.CasteOf(prisoner) == partial, "prisoner's caste after reload: " + comp.CasteOf(prisoner)); + + T.Check(comp.Memberships.Keys.All(p => !GameComponent_BlaxCastes.IsGone(p)), "a purged-worthy pawn is still a key after reload"); + string goneId = T.Carry["gone"]; + T.Check(!comp.Memberships.Keys.Any(p => p.ThingID == goneId), "the destroyed pawn's record survived the save"); + } + + [BlaxTest("save: Instance is the loaded component and the game holds exactly one", phase: 2)] + public static void InstanceAfterReload() + { + GameComponent_BlaxCastes comp = Current.Game.GetComponent(); + T.NotNull(comp, "component after reload"); + T.Check(GameComponent_BlaxCastes.Instance == comp, "Instance is not the loaded game's component"); + T.Equal(1, Current.Game.components.Count(x => x is GameComponent_BlaxCastes), "GameComponent_BlaxCastes in the game"); + } + } +} diff --git a/Tests/BlaxCastesTests/Source/SettingsTests.cs b/Tests/BlaxCastesTests/Source/SettingsTests.cs new file mode 100644 index 0000000..b8e0c16 --- /dev/null +++ b/Tests/BlaxCastesTests/Source/SettingsTests.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using BlaxCastes; +using HarmonyLib; +using Verse; + +namespace BlaxCastesTests +{ + /// + /// The settings (BlaxCastesSettings, BlaxCastesMod). Settings files go through vanilla's own + /// LoadedModManager.WriteModSettings and ReadModSettings under a test-only mod id, so they land in the + /// test run's Config folder (run-tests.ps1 passes -savedatafolder) and are deleted again. The window + /// itself needs OnGUI, so it isn't drawn. + /// + public static class SettingsTests + { + private const string TestModId = "BlaxCastesSettingsTest"; + private const string Handle = nameof(BlaxCastesMod); + + private static readonly string[] Expected = { "enabled", "enableJoinDefaults", "joinMessages", "revertOnLeave", "showAssignColumn" }; + + private static readonly string[] SettingsUiKeys = + { + "BlaxCastes_SettingEnabled", "BlaxCastes_SettingEnabledTip", "BlaxCastes_SettingJoinDefaults", "BlaxCastes_SettingJoinDefaultsTip", + "BlaxCastes_SettingJoinMessages", "BlaxCastes_SettingJoinMessagesTip", "BlaxCastes_SettingRevertOnLeave", "BlaxCastes_SettingRevertOnLeaveTip", + "BlaxCastes_SettingShowAssignColumn", "BlaxCastes_SettingShowAssignColumnTip", "BlaxCastes_SettingNoIdeology", "BlaxCastes_SettingsReset", + }; + + private static FieldInfo[] Fields => typeof(BlaxCastesSettings).GetFields(BindingFlags.Public | BindingFlags.Instance); + + [BlaxTest("settings: mod has a settings category and Settings is the mod's own instance")] + public static void ModRegistered() + { + BlaxCastesMod mod = LoadedModManager.GetMod(); + T.NotNull(mod, "LoadedModManager.GetMod()"); + T.Check(!mod.SettingsCategory().NullOrEmpty(), "SettingsCategory() is empty, so the mod gets no settings window"); + T.NotNull(BlaxCastesMod.Settings, "BlaxCastesMod.Settings"); + T.Check(ReferenceEquals(mod.GetSettings(), BlaxCastesMod.Settings), + "BlaxCastesMod.Settings is not the instance the mod writes on close"); + var missing = SettingsUiKeys.Where(k => !k.CanTranslate()).ToList(); + T.Check(missing.Count == 0, "settings window strings missing from Keyed: " + string.Join(", ", missing)); + } + + [BlaxTest("settings: the five 1.0 toggles exist and default to on")] + public static void DefaultsOn() + { + var names = Fields.Select(f => f.Name).ToList(); + T.Check(Expected.All(names.Contains), "missing settings fields: " + string.Join(", ", Expected.Where(n => !names.Contains(n)))); + T.Check(names.All(Expected.Contains), "settings fields this test doesn't know (extend it): " + string.Join(", ", names.Where(n => !Expected.Contains(n)))); + var d = new BlaxCastesSettings(); + var off = Fields.Where(f => !(f.GetValue(d) is bool b && b)).Select(f => f.Name).ToList(); + T.Check(off.Count == 0, "settings not defaulting to on: " + string.Join(", ", off)); + } + + [BlaxTest("settings: every field round-trips through the settings file, and Reset restores the defaults")] + public static void RoundTripAndReset() + { + var src = new BlaxCastesSettings(); + foreach (FieldInfo f in Fields) + f.SetValue(src, false); + string path = SettingsPath(); + try + { + LoadedModManager.WriteModSettings(TestModId, Handle, src); + StopScribe(); + T.Check(File.Exists(path), "WriteModSettings wrote no file at " + path); + BlaxCastesSettings back = LoadedModManager.ReadModSettings(TestModId, Handle); + StopScribe(); + T.NotNull(back, "ReadModSettings result"); + var diff = Fields.Where(f => !Equals(f.GetValue(src), f.GetValue(back))).Select(f => f.Name).ToList(); + T.Check(diff.Count == 0, "settings changed over write and read (missing Scribe key or wrong default?): " + string.Join(", ", diff)); + + back.Reset(); + var notReset = Fields.Where(f => !Equals(f.GetValue(back), f.GetValue(new BlaxCastesSettings()))).Select(f => f.Name).ToList(); + T.Check(notReset.Count == 0, "Reset left fields changed: " + string.Join(", ", notReset)); + } + finally + { + StopScribe(); + try { if (File.Exists(path)) File.Delete(path); } catch (Exception e) { T.Info("could not delete " + path + ": " + e.Message); } + } + } + + [BlaxTest("settings: closing the window (WriteSettings) raises SettingsChanged once, without errors")] + public static void WriteSettingsRaisesChanged() + { + BlaxCastesMod mod = LoadedModManager.GetMod(); + T.NotNull(mod, "LoadedModManager.GetMod()"); + int raised = 0; + Action handler = () => raised++; + BlaxCastesMod.SettingsChanged += handler; + try + { + mod.WriteSettings(); + } + finally + { + BlaxCastesMod.SettingsChanged -= handler; + StopScribe(); + } + T.Equal(1, raised, "SettingsChanged raised by WriteSettings"); + } + + [BlaxTest("settings: the window draws only fields Reset restores")] + public static void WindowFieldsAreReset() + { + MethodInfo window = AccessTools.DeclaredMethod(typeof(BlaxCastesMod), nameof(BlaxCastesMod.DoSettingsWindowContents)); + T.NotNull(window, "BlaxCastesMod.DoSettingsWindowContents"); + List drawn = PatchProcessor.ReadMethodBody(window).Select(op => op.Value).OfType() + .Where(f => f.DeclaringType == typeof(BlaxCastesSettings) && !f.IsStatic).Select(f => f.Name).Distinct().ToList(); + T.Info("window uses " + string.Join(", ", drawn)); + var notDrawn = Expected.Where(n => !drawn.Contains(n)).ToList(); + T.Check(notDrawn.Count == 0, "settings the window never draws: " + string.Join(", ", notDrawn)); + } + + private static string SettingsPath() => + Path.Combine(GenFilePaths.ConfigFolderPath, GenText.SanitizeFilename($"Mod_{TestModId}_{Handle}.xml")); + + /// A Scribe left mid-load or mid-save would break the runner's save and reload after phase 1. + private static void StopScribe() + { + if (Scribe.mode == LoadSaveMode.Inactive) + return; + T.Info("Scribe was left in mode " + Scribe.mode + "; forced stop"); + Scribe.ForceStop(); + } + } +} diff --git a/Tests/BlaxCastesTests/Source/SmokeTests.cs b/Tests/BlaxCastesTests/Source/SmokeTests.cs new file mode 100644 index 0000000..301f1b4 --- /dev/null +++ b/Tests/BlaxCastesTests/Source/SmokeTests.cs @@ -0,0 +1,77 @@ +using System.Linq; +using BlaxCastes; +using HarmonyLib; +using RimWorld; +using Verse; + +namespace BlaxCastesTests +{ + public static class SmokeTests + { + private static readonly string[] CoreKeys = + { + "BlaxCastes_NewCasteLabel", "BlaxCastes_Unmanaged", "BlaxCastes_SlotApparel", "BlaxCastes_SlotFood", "BlaxCastes_SlotDrug", + "BlaxCastes_SlotReading", "BlaxCastes_SlotMedCare", "BlaxCastes_NoCaste", "BlaxCastes_DefaultCaste", + "BlaxCastes_ManageCastesTitle", "BlaxCastes_JoinDefaultsTitle", + }; + + [BlaxTest("startup: patcher ran and logged, no errors mentioning Blax Castes")] + public static void StartupLogged() + { + int ours = Harmony.GetAllPatchedMethods() + .Select(Harmony.GetPatchInfo) + .Where(info => info != null) + .SelectMany(info => info.Prefixes.Concat(info.Postfixes).Concat(info.Finalizers).Concat(info.Transpilers)) + .Count(p => p.owner == BlaxCastesStartup.HarmonyId); + T.Info("Harmony patches owned by " + BlaxCastesStartup.HarmonyId + ": " + ours); + bool logged = Log.Messages.Any(m => m.text != null && m.text.Contains("[Blax Castes]") && m.text.Contains("patches applied")); + T.Check(logged, "startup line '[Blax Castes] N patches applied' not in the log"); + var errors = Log.Messages.Where(m => m.type == LogMessageType.Error && m.text != null && (m.text.Contains("Blax Castes") || m.text.Contains("BlaxCastes"))).ToList(); + T.Check(errors.Count == 0, "errors mentioning Blax Castes at startup: " + string.Join(" | ", errors.Take(3).Select(e => e.text))); + } + + [BlaxTest("startup: settings, game component and strings are loaded")] + public static void Loaded() + { + T.NotNull(BlaxCastesMod.Settings, "BlaxCastesMod.Settings"); + T.NotNull(GameComponent_BlaxCastes.Instance, "GameComponent_BlaxCastes.Instance"); + T.Check(GameComponent_BlaxCastes.Instance == Current.Game.GetComponent(), "Instance is not the game's component"); + var missing = CoreKeys.Concat(JoinReason.Rows.Select(r => "BlaxCastes_Row_" + r)).Where(k => !k.CanTranslate()).ToList(); + T.Check(missing.Count == 0, "strings missing from Keyed: " + string.Join(", ", missing)); + foreach (CasteSlot slot in CasteUtility.AllSlots) + T.Check(!CasteUtility.SlotLabel(slot).NullOrEmpty(), "no label for slot " + slot); + } + + [BlaxTest("compat: IsActive finds Blax Castes and the base game, not a made-up id")] + public static void IsActiveWorks() + { + T.Check(Compat.IsActive("blax.castes"), "Compat.IsActive(\"blax.castes\") is false while Blax Castes runs"); + T.Check(Compat.IsActive("ludeon.rimworld"), "Compat.IsActive(\"ludeon.rimworld\") is false"); + T.Check(!Compat.IsActive("blax.castes.does.not.exist"), "Compat.IsActive is true for a made-up id"); + T.Info("Blax Slaves active: " + Compat.IsActive(Compat.BlaxSlaves) + ", Ideology: " + ModsConfig.IdeologyActive + ", Biotech: " + ModsConfig.BiotechActive); + } + + [BlaxTest("windows: the manager and join defaults windows construct, the join queue is callable")] + public static void WindowsConstruct() + { + T.NotNull(new Dialog_ManageCastes(), "new Dialog_ManageCastes()"); + T.NotNull(new Dialog_JoinDefaults(), "new Dialog_JoinDefaults()"); + Pawn p = Fixtures.Colonist(); + JoinDefaults.Enqueue(p, JoinReason.NewColonist); + JoinDefaults.ApplyQueue(); + } + + [BlaxTest("harness: colonist, prisoner and colony slave fixtures")] + public static void Fixtures_() + { + Pawn c = Fixtures.Colonist(); + T.Check(c.Spawned && c.IsFreeColonist, "colonist fixture is not a spawned free colonist"); + Pawn pr = Fixtures.Prisoner(); + T.Check(pr.IsPrisonerOfColony, "prisoner fixture is not a prisoner of the colony"); + if (!ModsConfig.IdeologyActive) + T.Skip("slaves need Ideology; colonist and prisoner fixtures passed"); + Pawn s = Fixtures.ColonySlave(); + T.Check(s.IsSlaveOfColony, "slave fixture is not a slave of the colony"); + } + } +} diff --git a/Tests/BlaxCastesTests/Source/UiTests.cs b/Tests/BlaxCastesTests/Source/UiTests.cs new file mode 100644 index 0000000..d326729 --- /dev/null +++ b/Tests/BlaxCastesTests/Source/UiTests.cs @@ -0,0 +1,438 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using BlaxCastes; +using HarmonyLib; +using RimWorld; +using Verse; + +namespace BlaxCastesTests +{ + /// + /// The Caste column in the Assign tab and the caste manager window. Headless runs have no GUI, so + /// these drive the logic behind the widgets: the table def, the cell menu, labels, sorting and the + /// manager's overrides. Drawing is checked by hand. + /// + public static class UiTests + { + // ---- helpers ----------------------------------------------------------------------------- + + private static PawnColumnDef NeedColumn() + { + PawnColumnDef col = AssignColumn.Column; + T.NotNull(col, "PawnColumnDef " + PawnColumnWorker_BlaxCaste.DefName); + return col; + } + + private static string ColumnList(PawnTableDef table) => string.Join(", ", table.columns.Select(c => c?.defName ?? "null")); + + private static void CheckRightBeforeHostility(PawnTableDef table, PawnColumnDef col) + { + int at = table.columns.IndexOf(col); + int hostility = table.columns.FindIndex(c => c != null && c.defName == AssignColumn.AnchorColumn); + T.Check(at >= 0, "Caste column not in the Assign table: " + ColumnList(table)); + T.Check(hostility >= 0, "HostilityResponse not in the Assign table: " + ColumnList(table)); + T.Equal(hostility - 1, at, "Caste column index (columns: " + ColumnList(table) + ")"); + T.Equal(1, table.columns.Count(c => c == col), "times the Caste column is listed"); + } + + private static FoodPolicy Simple => Fixtures.Need(Fixtures.Food("FoodRestrictionSimple"), "Simple food"); + + private static FoodPolicy Lavish => Fixtures.Need(Fixtures.Food("FoodRestrictionLavish"), "Lavish food"); + + private static Caste Full(string label) + { + Caste c = Fixtures.NewCaste(label); + CasteManager.SetSlot(c, CasteSlot.Apparel, Fixtures.Need(Fixtures.Outfit("OutfitNudist"), "Nudist outfit")); + CasteManager.SetSlot(c, CasteSlot.Food, Simple); + CasteManager.SetSlot(c, CasteSlot.Drug, Fixtures.Need(Fixtures.Drug("NoDrugs"), "No drugs")); + CasteManager.SetSlot(c, CasteSlot.Reading, Fixtures.Need(Fixtures.Reading("NoneReadingPolicy"), "None reading")); + CasteManager.SetSlot(c, CasteSlot.MedCare, MedicalCareCategory.HerbalOrWorse); + return c; + } + + private static string Policies(Pawn p) => + string.Join(", ", CasteUtility.AllSlots.Select(s => s + "=" + CasteUtility.ValueLabel(s, CasteUtility.CurrentValue(p, s)))); + + private static string Labels(List menu) => string.Join(" | ", menu.Select(e => e.Label)); + + /// Calls one of the manager's protected overrides, the way the base class does. + private static TR Call(Dialog_ManageCastes dialog, string method, params object[] args) + { + MethodInfo m = AccessTools.Method(typeof(Dialog_ManageCastes), method); + T.NotNull(m, "Dialog_ManageCastes." + method); + return (TR)m.Invoke(dialog, args); + } + + // ---- Assign table ------------------------------------------------------------------------ + + [BlaxTest("ui: at startup the Assign table has the Caste column right before HostilityResponse")] + public static void ColumnPlaced() + { + if (!Fixtures.Settings.showAssignColumn) + T.Skip("showAssignColumn is off in this run"); + PawnColumnDef col = NeedColumn(); + T.Equal(typeof(PawnColumnWorker_BlaxCaste), col.workerClass, "worker class"); + T.Check(col.Worker is PawnColumnWorker_BlaxCaste, "Worker is " + col.Worker?.GetType().Name); + T.Check(col.sortable, "the column is not sortable"); + CheckRightBeforeHostility(PawnTableDefOf.Assign, col); + T.Info("Ideology " + ModsConfig.IdeologyActive + ", Biotech " + ModsConfig.BiotechActive + ", columns: " + ColumnList(PawnTableDefOf.Assign)); + } + + [BlaxTest("ui: showAssignColumn off removes the column at startup; on puts it back before HostilityResponse")] + public static void ColumnToggle() + { + PawnTableDef table = PawnTableDefOf.Assign; + PawnColumnDef col = NeedColumn(); + bool had = table.columns.Contains(col); + try + { + AssignColumn.Apply(false); + T.Check(!table.columns.Contains(col), "Apply(false) left the column in the table"); + T.Check(!AssignColumn.Apply(false), "removing a missing column reported a change"); + T.Check(AssignColumn.Apply(true), "Apply(true) did not add the column back"); + CheckRightBeforeHostility(table, col); + T.Check(!AssignColumn.Apply(true), "adding a present column reported a change"); + CheckRightBeforeHostility(table, col); + } + finally + { + AssignColumn.Apply(had); + } + } + + // ---- cell menu --------------------------------------------------------------------------- + + [BlaxTest("ui: the cell menu has No caste, one entry per caste, Reset and Edit; picking an entry assigns")] + public static void MenuAssigns() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + Fixtures.NewCaste("Menu A"); + Caste b = Fixtures.NewCaste("Menu B"); + CasteManager.SetSlot(b, CasteSlot.Food, Simple); + Pawn p = Fixtures.Colonist(); + p.foodRestriction.CurrentFoodPolicy = Lavish; + + List menu = PawnColumnWorker_BlaxCaste.MenuEntries(p); + T.Equal(comp.Castes.Count + 3, menu.Count, "menu entries (" + Labels(menu) + ")"); + T.Equal(CasteChoiceKind.Casteless, menu[0].Choice.Kind, "first entry"); + T.Equal((string)"BlaxCastes_NoCaste".Translate(), menu[0].Label, "first entry label"); + foreach (Caste c in comp.Castes) + T.Equal(1, menu.Count(e => e.Choice.Kind == CasteChoiceKind.Caste && e.Choice.Caste == c), "entries for caste " + c.label); + List casteLabels = menu.Where(e => e.Choice.Kind == CasteChoiceKind.Caste).Select(e => e.Label).ToList(); + T.Check(casteLabels.SequenceEqual(casteLabels.OrderBy(l => l, StringComparer.CurrentCultureIgnoreCase)), "castes not sorted by label: " + string.Join(", ", casteLabels)); + T.Equal(CasteChoiceKind.Reset, menu[menu.Count - 2].Choice.Kind, "second to last entry"); + T.Equal(CasteChoiceKind.Edit, menu[menu.Count - 1].Choice.Kind, "last entry"); + T.Check(menu[menu.Count - 2].Action == null, "Reset is enabled for a pawn without a caste"); + T.Check(menu.Where(e => e.Choice.Kind != CasteChoiceKind.Reset).All(e => e.Action != null), "an entry other than Reset is disabled: " + Labels(menu)); + + menu.Single(e => e.Choice.Caste == b).Action(); + CasteMembership m = comp.MembershipOf(p); + T.Check(m != null && m.caste == b && !m.auto && m.reason == JoinReason.Manual, + $"after picking B: caste={m?.caste}, auto={m?.auto}, reason={m?.reason}"); + T.Check(p.foodRestriction.CurrentFoodPolicy == Simple, "picking B did not set its food policy: " + Policies(p)); + + p.foodRestriction.CurrentFoodPolicy = Lavish; + CasteMenuEntry reset = PawnColumnWorker_BlaxCaste.MenuEntries(p).Single(e => e.Choice.Kind == CasteChoiceKind.Reset); + T.NotNull(reset.Action, "Reset action for a member"); + reset.Action(); + T.Check(p.foodRestriction.CurrentFoodPolicy == Simple, "Reset did not restore the caste's food policy: " + Policies(p)); + + string before = Policies(p); + PawnColumnWorker_BlaxCaste.MenuEntries(p)[0].Action(); + m = comp.MembershipOf(p); + T.Check(m != null && m.caste == null && !m.auto && m.reason == JoinReason.Manual, $"after No caste: caste={m?.caste}, auto={m?.auto}, reason={m?.reason}"); + T.Equal(before, Policies(p), "policies after No caste"); + } + + [BlaxTest("ui: painting copies the source cell's caste; a pawn without a record paints nothing")] + public static void PaintPayload() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + Caste a = Fixtures.NewCaste("Paint A"); + Pawn member = Fixtures.Colonist(); + Pawn casteless = Fixtures.Colonist(); + Pawn fresh = Fixtures.Colonist(); + Pawn target = Fixtures.Colonist(); + CasteManager.Assign(member, a, false, JoinReason.Manual); + CasteManager.MakeCasteless(casteless); + + T.Equal(new CasteChoice(CasteChoiceKind.Caste, a), PawnColumnWorker_BlaxCaste.ChoiceOf(member), "member's payload"); + T.Equal(new CasteChoice(CasteChoiceKind.Casteless), PawnColumnWorker_BlaxCaste.ChoiceOf(casteless), "casteless pawn's payload"); + T.Equal(new CasteChoice(CasteChoiceKind.None), PawnColumnWorker_BlaxCaste.ChoiceOf(fresh), "unassigned pawn's payload"); + + // Widgets.Dropdown matches the painted payload with object.Equals against each menu entry. + List menu = PawnColumnWorker_BlaxCaste.MenuEntries(target); + object none = PawnColumnWorker_BlaxCaste.ChoiceOf(fresh); + T.Check(!menu.Any(e => Equals(e.Choice, none)), "an unassigned pawn's payload matches a menu entry"); + foreach (CasteMenuEntry e in menu.Where(e => e.Choice.Kind == CasteChoiceKind.Reset || e.Choice.Kind == CasteChoiceKind.Edit)) + { + foreach (Pawn source in new[] { member, casteless, fresh }) + T.Check(!Equals(e.Choice, PawnColumnWorker_BlaxCaste.ChoiceOf(source)), e.Label + " matches the payload of " + source.LabelShort); + } + + object painted = PawnColumnWorker_BlaxCaste.ChoiceOf(member); + CasteMenuEntry hit = menu.FirstOrDefault(e => Equals(e.Choice, painted)); + T.NotNull(hit, "menu entry for the painted caste"); + hit.Action(); + T.Check(comp.CasteOf(target) == a, "painting caste A did not assign it"); + + painted = PawnColumnWorker_BlaxCaste.ChoiceOf(casteless); + hit = PawnColumnWorker_BlaxCaste.MenuEntries(target).FirstOrDefault(e => Equals(e.Choice, painted)); + T.NotNull(hit, "menu entry for the painted No caste"); + hit.Action(); + T.Check(comp.MembershipOf(target) != null && comp.MembershipOf(target).caste == null, "painting No caste did not make the pawn casteless"); + } + + [BlaxTest("ui: sorting orders by caste label, pawns without a caste last")] + public static void CompareOrder() + { + Caste zeta = Fixtures.NewCaste("Zeta sort"); + Caste alpha = Fixtures.NewCaste("alpha sort"); + Pawn z = Fixtures.Colonist(); + Pawn a = Fixtures.Colonist(); + Pawn none = Fixtures.Colonist(); + Pawn casteless = Fixtures.Colonist(); + CasteManager.Assign(z, zeta, false, JoinReason.Manual); + CasteManager.Assign(a, alpha, false, JoinReason.Manual); + CasteManager.MakeCasteless(casteless); + + var worker = (PawnColumnWorker_BlaxCaste)NeedColumn().Worker; + var list = new List { none, z, casteless, a }; + list.Sort(worker.Compare); + T.Check(list[0] == a && list[1] == z, "castes not first and by label: " + string.Join(", ", list.Select(p => p.LabelShort + "=" + PawnColumnWorker_BlaxCaste.CellLabel(p)))); + T.Check(list.Skip(2).All(p => p == none || p == casteless), "pawns without a caste are not last"); + T.Equal(0, worker.Compare(none, casteless), "two pawns without a caste"); + T.Check(worker.Compare(a, none) < 0 && worker.Compare(none, a) > 0, "a caste does not sort before no caste"); + } + + // ---- cell label and tooltip -------------------------------------------------------------- + + [BlaxTest("ui: the cell shows the caste, * with a tooltip naming overrides, No caste and (pending)")] + public static void CellLabels() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + Caste c = Fixtures.NewCaste("Label caste"); + CasteManager.SetSlot(c, CasteSlot.Food, Simple); + Pawn p = Fixtures.Colonist(); + int stray = comp.JoinQueue.RemoveAll(q => q != null && q.pawn == p); + if (stray > 0) + T.Info("a fresh colonist fixture was in the join queue; removed it"); + + T.Equal((string)"BlaxCastes_CellNone".Translate(), PawnColumnWorker_BlaxCaste.CellLabel(p), "label without a record"); + CasteManager.Assign(p, c, false, JoinReason.Manual); + T.Equal(c.label, PawnColumnWorker_BlaxCaste.CellLabel(p), "label of a member"); + + p.foodRestriction.CurrentFoodPolicy = Lavish; + T.Equal(c.label + "*", PawnColumnWorker_BlaxCaste.CellLabel(p), "label with an override"); + string tip = PawnColumnWorker_BlaxCaste.CellTip(p); + T.Check(tip.Contains(CasteUtility.SlotLabel(CasteSlot.Food)) && tip.Contains(Lavish.label) && tip.Contains(Simple.label), + "tooltip does not name the slot and both values: " + tip); + + CasteManager.MakeCasteless(p); + T.Equal((string)"BlaxCastes_NoCaste".Translate(), PawnColumnWorker_BlaxCaste.CellLabel(p), "label when casteless by choice"); + + var queued = new QueuedJoin(p, JoinReason.NewColonist, Find.TickManager.TicksGame); + comp.JoinQueue.Add(queued); + try + { + T.Check(PawnColumnWorker_BlaxCaste.IsPending(p), "IsPending false for a queued pawn"); + T.Equal((string)"BlaxCastes_CellPending".Translate(), PawnColumnWorker_BlaxCaste.CellLabel(p), "label while queued"); + } + finally + { + comp.JoinQueue.Remove(queued); + } + T.Check(!PawnColumnWorker_BlaxCaste.IsPending(p), "IsPending true after the queue entry left"); + } + + [BlaxTest("ui: a quest lodger's cell says Unchangeable")] + public static void LodgerLabel() + { + Pawn lodger = Fixtures.QuestLodger(); + T.Equal((string)"Unchangeable".Translate(), PawnColumnWorker_BlaxCaste.CellLabel(lodger), "lodger label"); + } + + // ---- caste manager ----------------------------------------------------------------------- + + [BlaxTest("ui: manager CreateNewPolicy gives unique ids, labels Caste N and manages nothing")] + public static void ManagerCreate() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + var dialog = new Dialog_ManageCastes(); + var made = new List(); + try + { + for (int i = 0; i < 3; i++) + made.Add(Call(dialog, "CreateNewPolicy")); + T.Check(made.All(c => c != null && comp.HasCaste(c)), "a new caste is null or not in the component"); + T.Equal(3, made.Select(c => c.id).Distinct().Count(), "distinct ids among " + string.Join(", ", made.Select(c => c.id))); + T.Equal(comp.Castes.Count, comp.Castes.Select(c => c.id).Distinct().Count(), "distinct ids in the component"); + foreach (Caste c in made) + { + T.Equal((string)"BlaxCastes_NewCasteLabel".Translate(c.id), c.label, "label of caste " + c.id); + T.Check(!c.AnyManaged(), c.label + " manages a slot"); + } + T.Check(ReferenceEquals(Call>(dialog, "GetPolicies"), comp.Castes), "GetPolicies is not the component's caste list"); + } + finally + { + foreach (Caste c in made) + CasteManager.DeleteCaste(c); + } + } + + [BlaxTest("ui: manager duplicate (CreateNewPolicy then CopyFrom, as the base button does) copies every slot")] + public static void ManagerDuplicate() + { + Caste src = Full("Dialog duplicate source"); + Pawn member = Fixtures.Colonist(); + CasteManager.Assign(member, src, false, JoinReason.Manual); + var dialog = new Dialog_ManageCastes(src); + Caste copy = Call(dialog, "CreateNewPolicy"); + try + { + copy.CopyFrom(src); + T.Check(copy.id != src.id, "duplicate has the source's id"); + foreach (CasteSlot slot in CasteUtility.AllSlots) + T.Check(CasteUtility.SameValue(src.GetSlot(slot), copy.GetSlot(slot)), + $"{slot}: source {CasteUtility.ValueLabel(slot, src.GetSlot(slot))}, duplicate {CasteUtility.ValueLabel(slot, copy.GetSlot(slot))}"); + T.Equal(0, Fixtures.Comp.MembersOf(copy).Count, "members of the duplicate"); + T.Check(Fixtures.Comp.CasteOf(member) == src, "the source's member moved"); + } + finally + { + CasteManager.DeleteCaste(copy); + } + } + + [BlaxTest("ui: manager TryDeletePolicy removes the caste, empties its memberships, resets its rows, keeps policies")] + public static void ManagerDelete() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + Caste doomed = Full("Dialog doomed"); + Pawn a = Fixtures.Colonist(); + CasteManager.Assign(a, doomed, false, JoinReason.Manual); + CasteManager.SetJoinRow(JoinReason.BoughtSlave, JoinRowMode.SpecificCaste, doomed); + CasteManager.SetJoinRow(JoinReason.NewColonist, JoinRowMode.DefaultCaste); + CasteManager.SetDefault(doomed); + string before = Policies(a); + var dialog = new Dialog_ManageCastes(doomed); + + AcceptanceReport report = Call(dialog, "TryDeletePolicy", doomed); + T.Check(report.Accepted, "TryDeletePolicy refused: " + report.Reason); + T.Check(!comp.HasCaste(doomed), "caste still in the component"); + T.Equal(0, comp.MembersOf(doomed).Count, "members left in the deleted caste"); + CasteMembership m = comp.MembershipOf(a); + T.Check(m != null && m.caste == null && m.reason == JoinReason.CasteDeleted, $"member record: caste={m?.caste}, reason={m?.reason}"); + T.Equal(before, Policies(a), "member's policies after delete"); + T.Equal(JoinRowMode.NoCaste, comp.GetRow(JoinReason.BoughtSlave).mode, "row that pointed at the caste"); + T.Check(Call(dialog, "GetDefaultPolicy") == null, "the deleted caste is still the default"); + T.Check(comp.ResolveRow(JoinReason.NewColonist) == null, "a Default caste row still resolves"); + + AcceptanceReport again = Call(dialog, "TryDeletePolicy", doomed); + T.Check(!again.Accepted, "deleting twice was accepted"); + T.Check(!again.Reason.NullOrEmpty(), "a refused delete gives no reason"); + } + + [BlaxTest("ui: manager Get/SetDefaultPolicy change what Default caste rows resolve to")] + public static void ManagerDefault() + { + GameComponent_BlaxCastes comp = Fixtures.Comp; + Caste one = Fixtures.NewCaste("Dialog default one"); + Caste two = Fixtures.NewCaste("Dialog default two"); + CasteManager.SetJoinRow(JoinReason.NewSlave, JoinRowMode.DefaultCaste); + var dialog = new Dialog_ManageCastes(); + Call(dialog, "SetDefaultPolicy", one); + T.Check(Call(dialog, "GetDefaultPolicy") == one && comp.DefaultCaste == one, "default after SetDefaultPolicy(one)"); + T.Check(comp.ResolveRow(JoinReason.NewSlave) == one, "Default caste row does not resolve to one"); + Call(dialog, "SetDefaultPolicy", two); + T.Check(comp.ResolveRow(JoinReason.NewSlave) == two, "Default caste row does not resolve to two"); + } + + [BlaxTest("ui: manager managed checkbox sets the database default; unticking changes no pawn")] + public static void ManagedCheckbox() + { + Game game = Current.Game; + Caste c = Fixtures.NewCaste("Checkbox caste"); + Pawn p = Fixtures.Colonist(); + CasteManager.Assign(p, c, false, JoinReason.Manual); + p.foodRestriction.CurrentFoodPolicy = Lavish; + FoodPolicy dbDefault = game.foodRestrictionDatabase.DefaultFoodRestriction(); + + Dialog_ManageCastes.SetManaged(c, CasteSlot.Food, true); + T.Check(c.FoodPolicy == dbDefault, "ticking Food set " + CasteUtility.ValueLabel(CasteSlot.Food, c.FoodPolicy) + ", not the database default " + dbDefault?.label); + T.Check(p.foodRestriction.CurrentFoodPolicy == dbDefault, "a member did not follow the newly managed slot: " + Policies(p)); + + Dialog_ManageCastes.SetManaged(c, CasteSlot.MedCare, true); + T.Equal((int)Find.PlaySettings.defaultCareForColonist, c.MedCare, "ticking medical care"); + + p.foodRestriction.CurrentFoodPolicy = Simple; + Dialog_ManageCastes.SetManaged(c, CasteSlot.Food, false); + T.Check(c.FoodPolicy == null && !c.IsManaged(CasteSlot.Food), "unticking Food left it managed"); + T.Check(p.foodRestriction.CurrentFoodPolicy == Simple, "unticking changed a member's food policy"); + T.Equal(0, Dialog_ManageCastes.SetManaged(c, CasteSlot.Food, false), "unticking twice moved pawns"); + + T.Check(Dialog_ManageCastes.PoliciesFor(CasteSlot.Apparel).SequenceEqual(game.outfitDatabase.AllOutfits.Cast()), "apparel dropdown is not the outfit database"); + T.Check(Dialog_ManageCastes.PoliciesFor(CasteSlot.Reading).SequenceEqual(game.readingPolicyDatabase.AllReadingPolicies.Cast()), "reading dropdown is not the reading database"); + T.Check(!Dialog_ManageCastes.PoliciesFor(CasteSlot.MedCare).Any(), "medical care lists policies"); + } + + [BlaxTest("ui: every string the manager, the column and the settings buttons use is in Keyed")] + public static void UiStrings() + { + string[] keys = + { + "BlaxCastes_ManageCastesTip", "BlaxCastes_ManagedTip", "BlaxCastes_ManagerHint", "BlaxCastes_DeleteFailed", + "BlaxCastes_FirstLoadMessage", "BlaxCastes_ManageCastesButton", "BlaxCastes_ManageCastesButtonTip", + "BlaxCastes_JoinDefaultsButton", "BlaxCastes_JoinDefaultsButtonTip", "BlaxCastes_CellNone", "BlaxCastes_CellNoneTip", + "BlaxCastes_CellCastelessTip", "BlaxCastes_CellPending", "BlaxCastes_CellPendingTip", "BlaxCastes_CellLodgerTip", + "BlaxCastes_CellCasteTip", "BlaxCastes_CellOverrides", "BlaxCastes_CellOverrideLine", "BlaxCastes_CellHint", + "BlaxCastes_MenuReset", "BlaxCastes_MenuEdit", "BlaxCastes_SettingOpenWindows", + "Unchangeable", "ManageApparelPolicies", "ManageFoodPolicies", "ManageDrugPolicies", "ManageReadingPolicies", + }; + var missing = keys.Where(k => !k.CanTranslate()).ToList(); + T.Check(missing.Count == 0, "strings missing from Keyed: " + string.Join(", ", missing)); + } + + [BlaxTest("ui: a new game posts the first-load message once and stores that in the save")] + public static void FirstLoadMessageOnNewGame() + { + if (!Fixtures.Settings.showAssignColumn) + T.Skip("showAssignColumn is off in this run, so the message waits"); + T.Check(Fixtures.Comp.FirstLoadMessageShown, "StartedNewGame did not post the first-load message"); + T.Equal(1, FirstLoadMessages(), "first-load messages in the history of a new game"); + } + + [BlaxTest("ui: the first-load message points to Manage castes, and waits while the column is off")] + public static void FirstLoadMessage() + { + // Vanilla drops a message whose text is still on screen (the new game's copy), so clear the live ones first. + Messages.Clear(); + int before = FirstLoadMessages(); + T.Check(Dialog_ManageCastes.ShowFirstLoadMessage(), "returned false with the column on"); + T.Equal(before + 1, FirstLoadMessages(), "first-load messages in the history after posting one"); + Fixtures.Settings.showAssignColumn = false; + T.Check(!Dialog_ManageCastes.ShowFirstLoadMessage(), "returned true with the column off"); + T.Equal(before + 1, FirstLoadMessages(), "first-load messages after a call with the column off"); + T.Carry["firstLoadMessages"] = FirstLoadMessages().ToString(); + } + + private static int FirstLoadMessages() + { + string text = ((string)"BlaxCastes_FirstLoadMessage".Translate()).CapitalizeFirst(); + return Find.Archive.ArchivablesListForReading.OfType().Count(m => m.text == text); + } + + [BlaxTest("ui: after the reload the first-load flag is still set and no second message was posted", phase: 2)] + public static void FirstLoadMessageNotRepeated() + { + T.Check(Fixtures.Comp.FirstLoadMessageShown, "the first-load flag was not saved"); + if (!T.Carry.TryGetValue("firstLoadMessages", out string carried)) + T.Skip("phase 1 did not record the message count"); + int expected = int.Parse(carried); + T.Check(FirstLoadMessages() <= expected, "first-load messages after the reload: " + FirstLoadMessages() + ", before: " + expected); + } + } +} diff --git a/Tests/run-tests.ps1 b/Tests/run-tests.ps1 new file mode 100644 index 0000000..0204a7f --- /dev/null +++ b/Tests/run-tests.ps1 @@ -0,0 +1,162 @@ +<# +Runs the in-game test suite. RimWorld 1.7 starts headless (no window, no focus change) with its +own save data folder, so your mod list, saves and settings stay untouched. Needs Steam running and +the Harmony mod from the Workshop. Exit code: 0 all passed, 1 failures, 2 the run didn't finish. + + .\Tests\run-tests.ps1 Harmony, the installed DLCs, Blax Castes + .\Tests\run-tests.ps1 -Compat also Blax Slaves and the installed mods Castes overlaps with + .\Tests\run-tests.ps1 -NoBuild skip dotnet build + .\Tests\run-tests.ps1 -AllowWhileRunning run next to an open RimWorld (the test game runs at below-normal priority) + +Mods\BlaxCastes must be a directory junction to this repo; it is created if missing and left in place. +While the suite runs, the test mod is linked into the game's Mods folder; that link is removed afterwards. +Only one run at a time: a lock file in the data folder holds the running script's process id. +#> +param( + [string]$RimWorldDir = 'E:\SteamLibrary\steamapps\common\RimWorld', + [string]$DataDir = (Join-Path $env:TEMP 'BlaxCastesTest'), + [switch]$Compat, + [switch]$NoBuild, + [switch]$AllowWhileRunning, + [int]$TimeoutSeconds = 900 +) +$ErrorActionPreference = 'Stop' +$repo = Split-Path -Parent $PSScriptRoot +$testMod = Join-Path $PSScriptRoot 'BlaxCastesTests' +$modLink = Join-Path $RimWorldDir 'Mods\BlaxCastes' +$link = Join-Path $RimWorldDir 'Mods\BlaxCastesTests' +$workshop = Join-Path $RimWorldDir '..\..\workshop\content\294100' +$lockFile = Join-Path $DataDir 'run.lock' + +if ((Get-Process -Name RimWorld -ErrorAction SilentlyContinue) -and -not $AllowWhileRunning) { + throw 'RimWorld is running. Close it first, or pass -AllowWhileRunning.' +} + +function Get-FullPath([string]$path) { [IO.Path]::GetFullPath($path).TrimEnd('\') } + +# One run at a time. A lock whose process is gone is stale and taken over. +New-Item -ItemType Directory -Force $DataDir | Out-Null +function Enter-Lock { + for ($try = 0; $try -lt 2; $try++) { + try { + $stream = [IO.File]::Open($lockFile, [IO.FileMode]::CreateNew, [IO.FileAccess]::Write, [IO.FileShare]::Read) + $bytes = [Text.Encoding]::ASCII.GetBytes([string]$PID) + $stream.Write($bytes, 0, $bytes.Length) + $stream.Close() + return + } + catch [IO.IOException] { + $owner = (Get-Content -LiteralPath $lockFile -Raw -ErrorAction SilentlyContinue) + $ownerPid = 0 + if ($owner -and [int]::TryParse($owner.Trim(), [ref]$ownerPid) -and $ownerPid -ne $PID -and (Get-Process -Id $ownerPid -ErrorAction SilentlyContinue)) { + throw "Another test run (process $ownerPid) is in progress. Lock: $lockFile" + } + Write-Warning "removing stale lock from process $owner" + Remove-Item -LiteralPath $lockFile -Force -ErrorAction SilentlyContinue + } + } + throw "Could not take the lock $lockFile" +} +Enter-Lock + +try { + # Mods\BlaxCastes: a junction to this repo. Created if missing, never replaced. + if (Test-Path -LiteralPath $modLink) { + $item = Get-Item -LiteralPath $modLink -Force + if (-not ($item.Attributes -band [IO.FileAttributes]::ReparsePoint)) { + throw "$modLink is a real folder, not a junction to $repo. Move it away and run again." + } + $target = @($item.Target)[0] + if (-not $target -or (Get-FullPath $target) -ne (Get-FullPath $repo)) { + throw "$modLink points to '$target', not to $repo." + } + } + else { + New-Item -ItemType Junction -Path $modLink -Target $repo | Out-Null + Write-Host "Created junction $modLink -> $repo" + } + + if (-not $NoBuild) { + foreach ($proj in (Join-Path $repo 'Source\BlaxCastes\BlaxCastes.csproj'), (Join-Path $testMod 'Source\BlaxCastesTests.csproj')) { + & dotnet build $proj -c Release -nologo -v q "-p:RimWorldDir=$RimWorldDir" + if ($LASTEXITCODE -ne 0) { throw "build failed: $proj" } + } + } + + # packageId (lower case) -> About.xml, for every installed local and Workshop mod + $installed = @{} + foreach ($about in @(Get-ChildItem (Join-Path $RimWorldDir 'Mods\*\About\About.xml') -ErrorAction SilentlyContinue) + + @(Get-ChildItem (Join-Path $workshop '*\About\About.xml') -ErrorAction SilentlyContinue)) { + $x = [xml](Get-Content -LiteralPath $about.FullName -Raw -Encoding UTF8) + if ($x.ModMetaData.packageId) { $installed[$x.ModMetaData.packageId.Trim().ToLower()] = $x } + } + function Add-WithDependencies([string]$id, [System.Collections.ArrayList]$list) { + $id = $id.ToLower() + if ($list -contains $id -or $id -like 'ludeon.*') { return } + $x = $installed[$id] + if (-not $x) { Write-Warning "not installed, skipped: $id"; return } + foreach ($dep in @($x.ModMetaData.modDependencies.li)) { if ($dep.packageId) { Add-WithDependencies $dep.packageId $list } } + [void]$list.Add($id) + } + + # Load order: Harmony, core, DLCs, overlap mods, Blax Castes, Blax Slaves (Castes loads before Slaves), the tests. + $mods = New-Object System.Collections.ArrayList + $expansions = @() + [void]$mods.Add('brrainz.harmony') + [void]$mods.Add('ludeon.rimworld') + foreach ($dlc in 'Royalty', 'Ideology', 'Biotech', 'Anomaly', 'Odyssey') { + if (Test-Path (Join-Path $RimWorldDir "Data\$dlc")) { $id = 'ludeon.rimworld.' + $dlc.ToLower(); [void]$mods.Add($id); $expansions += $id } + } + if ($Compat) { + foreach ($id in 'orion.hospitality', 'rhajiit.tradepurchasemode', 'mlie.customprisonerinteractions', 'legator.prisonerrealism') { + Add-WithDependencies $id $mods + } + } + [void]$mods.Add('blax.castes') + if ($Compat) { Add-WithDependencies 'blax.slaves' $mods } + [void]$mods.Add('blax.castes.tests') + + # fresh test data folder: mod list only, no old save, results or mod settings + New-Item -ItemType Directory -Force (Join-Path $DataDir 'Config') | Out-Null + Remove-Item -Force -ErrorAction SilentlyContinue (Join-Path $DataDir 'Saves\BlaxCastesTest.rws'), (Join-Path $DataDir 'BlaxCastesTestResults.txt'), (Join-Path $DataDir 'Config\Mod_blax.castes_*.xml') + $li = { param($ids) ($ids | ForEach-Object { "
  • $_
  • " }) -join "`n" } + $modsConfig = "`n`n 1.7`n `n" + + (& $li $mods) + "`n `n `n" + (& $li $expansions) + "`n `n`n" + [IO.File]::WriteAllText((Join-Path $DataDir 'Config\ModsConfig.xml'), $modsConfig) + Write-Host ("Mods: " + ($mods -join ', ')) + + $createdLink = $false + try { + if (-not (Test-Path $link)) { + New-Item -ItemType Junction -Path $link -Target $testMod | Out-Null + $createdLink = $true + } + $gameArgs = "-headless -quicktest -blaxcastestests -NoFileLog -NoCrashDialog `"-savedatafolder=$DataDir`"" + $sw = [Diagnostics.Stopwatch]::StartNew() + $p = Start-Process -FilePath (Join-Path $RimWorldDir 'RimWorld.exe') -WorkingDirectory $RimWorldDir -ArgumentList $gameArgs ` + -RedirectStandardOutput (Join-Path $DataDir 'game.log') -RedirectStandardError (Join-Path $DataDir 'game.err.log') ` + -WindowStyle Hidden -PassThru + if ($AllowWhileRunning) { + try { $p.PriorityClass = [Diagnostics.ProcessPriorityClass]::BelowNormal } catch { Write-Warning "could not lower the test game's priority: $_" } + } + if (-not $p.WaitForExit($TimeoutSeconds * 1000)) { + $p.Kill() + Write-Warning "timed out after $TimeoutSeconds s, test game (process $($p.Id)) killed" + } + Write-Host ("Game ran {0:N0} s. Log: {1}" -f $sw.Elapsed.TotalSeconds, (Join-Path $DataDir 'game.log')) + } + finally { + if ($createdLink -and (Test-Path $link)) { cmd /c rmdir "$link" | Out-Null } + } +} +finally { + Remove-Item -LiteralPath $lockFile -Force -ErrorAction SilentlyContinue +} + +$results = Join-Path $DataDir 'BlaxCastesTestResults.txt' +if (-not (Test-Path $results)) { Write-Host 'No results file: the suite never started. See game.log.'; exit 2 } +$lines = Get-Content -LiteralPath $results -Encoding UTF8 +$lines | ForEach-Object { Write-Host $_ } +if (-not ($lines -match '^END$')) { Write-Host 'The run did not finish.'; exit 2 } +if ($lines -match '^FAIL ') { exit 1 } +exit 0 diff --git a/docs/design.md b/docs/design.md new file mode 100644 index 0000000..2513ff7 --- /dev/null +++ b/docs/design.md @@ -0,0 +1,466 @@ +# Blax Castes design and roadmap + +Every slave you buy needs its apparel, food, drug and reading policy set by hand. Blax Castes bundles those policies into castes such as Slave or Miner slave, and puts each new pawn into the right caste the moment it joins. + +## At a glance + +| Version | What players get | Replaces (subs) | Days | +|---|---|---|---| +| 1.0 | Castes that set apparel, food, drug, reading and medical care in one click. Bought slaves join their caste automatically. | Automatic Slave Outfit (16.7k), PrisonerDefaults (1.1k), and the join defaults of Better Pawn Control (228k), BPC Forked (1.3k) and 1trickPwnyta's Defaults (75k) | 6 | +| 1.1 | Ready-made Colonist, Slave and Prisoner castes, a caste button on selected pawns, warnings for clashes | Food Restriction Eleven starting policies, partly (15.4k) | 4 | +| 1.2 | Castes also set schedule, allowed area, hostility, self-tend, carried medicine and fire at will | Defaults' area, hostility and medicine defaults (75k), Plug and Play Joiner area (1.5k) | 3 | +| 1.3 | A caste for every way a pawn joins, adult and child. Returning pawns get their old caste. Pickers in the prisoner tab. API for Blax Slaves and Zones. | Defaults' child defaults (75k), BPC's rescued-joiner fix (228k), PrisonerDefaults per-prisoner picks (1.1k) | 3 | +| 1.4 | Work priorities, shift schedules, default prisoner interaction, DLC switches, API support for a caste picker in Blax Slaves' trade window | Work Manager shifts, partly (14.2k), Plug and Play Joiner work (1.5k), prisoner defaults of Prison Labor and Custom Prisoner Interactions, partly | 4 | +| 1.5 | Castes exported to other colonies, caste colours | Better Policies (3.9k), Export Agency (16.3k), Save My Settings (3.8k), all partly | 3 | +| Total | | | 23 | + +Effort: S = 0.5 days, M = 2, L = 5, summed per release and rounded up. + +## Defaults I picked + +Change if you disagree. + +- In 1.0 every join row starts at No caste, so nothing changes until you pick a caste. +- From 1.1, colonist rows use the Colonist caste. It copies your current default policies, so colonists see no change. +- Starter Slave caste: Slave outfit, Simple food, No drugs. Reading and medical care stay vanilla. Starter Prisoner caste: Simple food. +- Hand changes win. Editing a caste moves only members still on the old value. "Apply to all members" (1.1) forces it. +- In an existing save the starter castes appear, but nobody moves until you click "Assign by status". +- The name stays Blax Castes, with the subtitle "policy bundles and join defaults", because three other Workshop mods already use "caste". +- Castes 1.4 adds `PrePick` so Blax Slaves can put a caste picker next to its buy-as-slave toggle. The picker itself sits in the Blax Slaves backlog. +- Not supported for now: multiplayer and animal castes. + +## Data model + +### Caste + +- `Caste : Policy` with LoadKey "BlaxCaste". Ids, load IDs, rename (IRenameable) and duplicate (`CopyFrom`) work the vanilla way. +- The Policy int id is the caste id. The API passes it as a string. +- Slots in 1.0: `ApparelPolicy`, `FoodPolicy`, `DrugPolicy` and `ReadingPolicy` (null = the caste leaves it alone), and medCare as an int (-1 = leave alone, otherwise a `MedicalCareCategory`). +- Later slots store defNames, labels or ints, never def references, and resolve with `GetNamedSilentFail`: schedule (24 `TimeAssignmentDef` names), area (label, per map), hostility, self-tend, carried medicine, fire at will, work priorities, prisoner modes, DLC switches. + +### Membership store + +- One `GameComponent_BlaxCastes` holds all state: the caste list, `Dictionary`, the join rows (reason to No caste, Default caste or a caste), the join queue, API hints and pre-picks (1.3), former-caste records (1.3), the next id and a seeded flag (1.1). +- `CasteMembership`: caste, auto flag (set by a join row or by hand), reason, tick. Caste = null means "casteless by choice". Later safety nets skip those pawns instead of reassigning them. +- No ThingComp and no data on vanilla objects. The only vanilla data Castes writes is the pawn's own policy fields. +- Overrides are not stored. A slot value that differs from the caste is an override. + +### Join classification and deferral + +- Classify where the join happens. Apply after the whole call chain returns. +- Enqueue only on a real transition into player colonist, player slave or player prisoner. A prefix on `Pawn.SetFaction` and `Pawn_GuestTracker.SetGuestStatus` snapshots faction, guest status and host faction, and the postfix compares. +- Reason, first match wins: API hint, innermost scope (for example "bought" from `Pawn.PreTraded`), status fallback. The fallback is resolved at apply time from the final status: new colonist, new slave or new prisoner. +- Scopes push in a prefix and pop in a Harmony finalizer, so an exception never leaves the stack dirty. +- `GameComponentTick` applies the queue on the first tick after the queueing tick, after checking the pawn is still player-side. Never inside `SetFaction` or `SetGuestStatus`, which reset medical care, areas, work and slave mode right after. +- Every hook body sits in try/catch with a one-time log, so a Castes bug can never break a trade. + +### Save safety + +- Memberships save with `Scribe_Collections` (LookMode.Reference / Deep) and `logNullErrors: false`, because world-pawn GC leaves null keys. Null, Discarded and destroyed-but-not-dead keys are purged on save and after load. +- PostLoadInit checks every slot with `db.All*.Contains`. A missing policy becomes unmanaged, with one warning per caste. Apply checks the same before every write. +- Policy load IDs contain the label. That is safe, because the caste and the policy sit in the same save. +- Former-caste records are keyed by ThingID string, not by reference, so a discarded pawn leaves no unresolved reference. +- Removing the mod: pawns keep their last policies. The only trace is one "type not found" line for the component. +- Adding it mid-save: `Game.ExposeData` creates the component. From 1.1 the starter castes are seeded once on `LoadedGame`. + +## 1.0: castes and bought slaves (6 days) + +Moved to 1.1 to keep 1.0 near a week: starter castes, overlap warnings, the policy delete guard, manager tools and the gizmo. Reviewers wanted starter castes and overlap warnings in 1.0. I picked the safer cut: 1.0 rows start at No caste and change nothing without a pick, and Castes already wins over other mods by applying a tick later. + +#### Castes + +- **Players get:** Make castes such as Slave or Miner slave. Putting a pawn in a caste sets its apparel, food, drug and reading policy and its medical care in one step. Change a caste's food policy and every member follows, except pawns you changed by hand. +- **How:** + - `CasteUtility.Apply(pawn, caste)` writes each managed slot through the vanilla setters: `CurrentApparelPolicy`, `CurrentFoodPolicy`, `CurrentPolicy` (drugs and reading), `playerSettings.medCare`. + - Per-slot checks. Apparel, drug and reading need the tracker, `!IsQuestLodger()` and no `disablePolicies` mutant. Food needs `foodRestriction.Configurable` and a non-baby. Medical care needs `playerSettings` and a flesh pawn. Prisoners get food and medical care only. + - Assigning a caste, by hand or by a join row, writes every managed slot. + - Sync: every slot edit goes through `CasteManager.SetSlot`. Members still on the old value get the new one. Members on another value keep it (the Follow rule from 1trickPwnyta's Defaults). + - Edits inside a policy, such as the Slave outfit's filter, reach members through the vanilla reference already. + - A sweep every 2500 ticks ends memberships of pawns that are no longer player faction or player prisoners. +- **Settings:** `enabled` (on). Off: nothing is applied, castes stay in the save. +- **Replaces:** Save My Settings (3648714184, 3,827 subs), applying clothing and food presets to pawns, partly. +- **Effort:** M, plus S for sync and S for the save safety in the data model (3 days). +- **Tests:** Phase 1: a caste with Slave outfit, Simple food, No drugs, None reading and HerbalOrWorse sets all five on `Fixtures.Colonist`. On a player prisoner, food and medical care change and the outfit tracker is untouched. A quest lodger and a baby skip the right slots. Two members, B set to Worker by hand: changing the caste from Slave to Nudist moves A only. Phase 2: castes, slots and memberships survive save and reload, including a casteless-by-choice entry. +- **Risks:** A pawn that happens to match the old value counts as following. Vanilla writes (ResetMedicalCare on a status change, TryDelete nulling fields, the mutant tracker nulling policies) show up as overrides. The column tooltip names the slot and its value, so the cause is visible. + +#### Caste manager + +- **Players get:** A window like the vanilla policy managers. On the left, the caste list with new, duplicate, rename, delete and make default. On the right, one row per policy with a "managed" checkbox, a dropdown and a pencil that opens the vanilla editor for that policy. +- **How:** + - `Dialog_ManageCastes : Dialog_ManagePolicies`. The base class already draws the list and handles duplicate, rename and the delete confirm. + - Overrides: `CreateNewPolicy` (next id, label "Caste N", nothing managed), `GetPolicies`, `GetDefaultPolicy` / `SetDefaultPolicy`, `TryDeletePolicy`, `DoContentsRect` (five slot rows), `TitleKey`, `TipKey`. + - The default caste is what rows set to "Default caste" use. With no default set, those rows act as No caste. The "Make default" button keeps the vanilla tooltip, which the base class draws. `TipKey` explains the default caste. + - Delete: members become casteless and keep their current policies. Rows pointing at the caste fall back to No caste. + - Pencils open `Dialog_ManageApparelPolicies`, `Dialog_ManageFoodPolicies`, `Dialog_ManageDrugPolicies` or `Dialog_ManageReadingPolicies` on the slot's policy. + - A first-load message points to Assign > Manage castes. +- **Settings:** none, covered by `enabled`. +- **Replaces:** none. +- **Effort:** S (0.5 days). Trimmed: member count, "Apply to all" and "Assign by status" move to 1.1. +- **Tests:** CreateNewPolicy gives unique ids. Duplicate copies every slot. TryDeletePolicy removes the caste, empties its memberships, resets its rows to No caste and leaves pawn policies unchanged. SetDefaultPolicy changes what "Default caste" resolves to. +- **Risks:** Generic methods over reference types share one JIT body, so another mod's patch on `Dialog_ManagePolicies` (Better Policies, Defaults, both 1.6-only today) also runs here. If a -Compat run shows a break, switch to a plain Window. The base layout changed in 1.6, so keep `DoContentsRect` self-contained. + +#### Caste column in the Assign tab + +- **Players get:** A Caste column left of the hostility, medical and policy columns. Click a cell, or drag-paint down the column, to assign. Header buttons open the caste manager and the join defaults. +- **How:** + - A `PatchOperationInsert` (order Prepend) before `li[text()="HostilityResponse"]` in `PawnTableDef[defName="Assign"]/columns` adds `PawnColumnDef BlaxCastes_Caste` with `PawnColumnWorker_BlaxCaste`. `PawnColumnWorker_Outfit` is the template. + - Cell: `Widgets.Dropdown(..., paintable: true)`. The label is the caste name, "*" plus a tooltip naming overridden slots and their values, "(pending)" while a join is queued, or "Unchangeable" for quest lodgers. + - Menu: No caste (stored as casteless by choice), each caste, Reset to caste, Edit caste. + - `Compare` sorts by caste label, casteless last. Width 100 to 160 px. Header buttons "Manage castes" and "Defaults" sit in the same 65 px area as the outfit column's. + - The Assign tab never lists prisoners. In 1.0 prisoners join castes only through the "New prisoner" row. The gizmo adds a manual path in 1.1. +- **Settings:** `showAssignColumn` (on). The column is removed from the table def at startup, so a change needs a restart. +- **Replaces:** none. +- **Effort:** S (0.5 days). +- **Tests:** At startup the Assign table def has `BlaxCastes_Caste` right before `HostilityResponse`, with and without the Ideology and Biotech columns. The menu has No caste, one entry per caste and Reset, and invoking an entry assigns. Drawing is checked by hand, since headless runs have no GUI. +- **Risks:** Numbers builds its own tables, so the column shows only in vanilla Assign (Numbers has no 1.7 build today). The table gets wider on small screens. + +#### Join defaults for buying and status changes + +- **Players get:** A defaults window picks a caste for five rows: bought as slave, bought as colonist, new colonist, new slave, new prisoner. A bought slave arrives already wearing its caste's outfit and eating its food, and a message names the caste. +- **How:** + - Each row is No caste, Default caste or a specific caste. Rows live in the save component. Layout follows `Dialog_MedicalDefaults`. + - Buying: a prefix on `Pawn.PreTraded` with PlayerBuys pushes "bought", a finalizer pops it. At apply time `IsSlave` picks the bought-as-slave or bought-as-colonist row. This covers Blax Slaves' buy mode, which only sets `guest.joinStatus` before `PreTraded`. + - Everything else goes to the new colonist, new slave or new prisoner row by final status: enslaving, recruiting, capturing, quest prisoners, slave-born children, Blax Slaves' returned runaways, modded paths. + - Transition snapshot and deferral as in the data model. Vanilla's internal `SetGuestStatus(null)` calls on existing members do not re-queue them. A pawn sold between queue and apply is dropped. A specific reason beats a status fallback when a pawn is queued twice. + - If the row is No caste and the pawn was in a caste, it leaves the caste, its managed slots return to the database defaults, and `ResetMedicalCare` runs. This is PrisonerDefaults' revert on recruit. + - Leaving the player faction, for example by being sold, ends the membership. + - Babies and quest lodgers are skipped until 1.3. +- **Settings:** `enableJoinDefaults` (on), `joinMessages` (on), `revertOnLeave` (on). +- **Replaces:** Automatic Slave Outfit (2912063732, 16,672 subs). PrisonerDefaults (3531556159, 1,086 subs). The join defaults of Better Pawn Control (1541460369, 227,665 subs), Better Pawn Control Forked (3724294345, 1,308 subs) and 1trickPwnyta's Defaults (3285178686, 75,424 subs). +- **Effort:** M (2 days). +- **Tests:** + - A pawn with joinStatus JoinAsSlave through `PreTraded(PlayerBuys, ...)` is queued. After `Fixtures.Tick(1)` it is in the bought-as-slave caste with that caste's outfit and food. + - JoinAsColonist ends in the bought-as-colonist caste. + - `GenGuest.EnslavePrisoner` on a prisoner fixture ends in the new-slave caste. + - `RecruitUtility.Recruit` ends in the new-colonist caste, and the food policy is no longer the prisoner one. + - `CapturedBy` on a downed raider ends in the new-prisoner caste. + - `SetGuestStatus(null)` on an existing member does not re-queue it. + - A pawn sold between queue and apply is dropped without errors. + - An exception inside the scope leaves the stack empty. + - -Compat with Blax Slaves: its buy mode's slave or colonist choice lands in the right row. +- **Risks:** Better Pawn Control and its fork write policies in their own SetGuestStatus postfix. Castes applies a tick later and wins, and 1.1 warns about it. While the game is paused after a trade, the pawn shows "(pending)" until the next tick. + +## 1.1: ready out of the box (4 days) + +#### Starter castes + +- **Players get:** A new colony starts with Colonist, Slave and Prisoner castes, already wired to the join rows. Colonists see no change. In an existing save the castes appear, but nobody moves until you click "Assign by status". +- **How:** + - Colonist: each slot is set to the database's current default (`DefaultOutfit()`, `DefaultFoodRestriction()`, `DefaultDrugPolicy()`, `DefaultReadingPolicy()`). These already carry the ideo drug rule set in `PostIdeoChosen` and any earlier "Make default". Medical care is unmanaged. + - Slave: the Ideology Slave apparel policy, Simple food, No drugs. Reading stays unmanaged, because slave children need books for the Learning need. Medical care stays unmanaged, so vanilla `defaultCareForSlave` stays in charge. + - Prisoner: Simple food. + - Lookup: No drugs by `DrugPolicy.sourceDef` defName "NoDrugs", first match (`CopyFrom` copies sourceDef). Slave outfit and Simple food by their translated starting labels (OutfitSlave, FoodRestrictionSimple). On a miss the slot stays unmanaged and the manager shows a "Create Slave outfit" button. Castes never creates vanilla policies silently. + - Rows: starting colonists, bought as colonist and new colonist use Default caste (Colonist). Bought as slave and new slave use Slave. New prisoner uses Prisoner. + - New game: seeded in `StartedNewGame`, then starting colonists are assigned through the new "starting colonists" row. Existing save: `GameComponent.LoadedGame` seeds once per save, only if the save has no castes, with one message. Not `FinalizeInit`, which also runs on every new game. + - The Slave caste's tooltip and the manager warn that the vanilla Slave outfit has no cold protection. +- **Settings:** `seedStarterCastes` (on). +- **Replaces:** Food Restriction Eleven (2780048210, 15,428 subs), sane starting policies, partly. Automatic Slave Outfit (16,672 subs) in any language, because Castes uses the policy reference, not the label. +- **Effort:** S (0.5 days). +- **Tests:** A quick-test game has three castes. The Slave caste's apparel is the database's Slave outfit. No drugs is matched by sourceDef. Rows map as listed. Starting colonists are Colonist members with unchanged policies. A start with a drug-prohibiting ideo keeps NoDrugs on the Colonist caste. Phase 2: no second seeding after reload. Removing the Slave outfit before seeding leaves the slot unmanaged. +- **Risks:** Policies the player renamed before adding Castes miss the label match. The slot stays unmanaged and the create button shows. Slaves in the Slave outfit freeze in cold biomes; the warning makes that visible. + +#### Manager tools + +- **Players get:** The manager footer shows the member count, "Apply to all members" and "Assign pawns without a caste by status". +- **How:** "Apply to all members" writes every managed slot to every member, after a confirm that names the member count. "Assign by status" runs the new colonist, new slave and new prisoner rows on pawns with no membership record, and is shown only while such pawns exist. Casteless-by-choice pawns are skipped. +- **Settings:** none, covered by `enabled`. +- **Replaces:** none. +- **Effort:** S (0.5 days). +- **Tests:** "Apply to all" clears an override. "Assign by status" puts an unassigned slave in Slave and leaves a casteless-by-choice slave alone. +- **Risks:** "Apply to all" overwrites hand changes, hence the confirm. + +#### Policy delete guard + +- **Players get:** Deleting a policy a caste uses is refused with "Used by caste Slave", like vanilla's "in use" message. +- **How:** Prefixes on `OutfitDatabase.TryDelete`, `FoodRestrictionDatabase.TryDelete`, `DrugPolicyDatabase.TryDelete` and `ReadingPolicyDatabase.TryDelete` return a rejected `AcceptanceReport` when a caste slot uses the policy. With the setting off, a postfix on accept unmanages that slot and posts a message. The four vanilla dialogs are the only callers. +- **Settings:** `protectPoliciesInUse` (on). +- **Replaces:** none. +- **Effort:** S (0.5 days). +- **Tests:** TryDelete on a policy used only by a memberless caste is refused and the policy stays in the database. With the setting off it is accepted and the slot is unmanaged. +- **Risks:** Mods that delete policies without TryDelete are caught only by the load check. + +#### Overlap warnings + +- **Players get:** If Better Pawn Control, its fork, 1trickPwnyta's Defaults, Automatic Slave Outfit or PrisonerDefaults is active, the settings page and a one-time message say which of their join defaults overlap and suggest turning them off. +- **How:** Detection through the shared Compat helper (`ModLister.GetActiveModWithIdentifier(id, ignorePostfix: true)`), so a dev copy and a Workshop copy both match. Package ids are read from each mod's About.xml before shipping. No patches against those mods. The message explains that Castes applies one tick after a join, so its choice wins. +- **Settings:** `warnOverlaps` (on). +- **Replaces:** none. +- **Effort:** S (0.5 days). +- **Tests:** Inject a fake active id into the detection list. The settings text and the message name it. +- **Risks:** A wrong package id misses silently, so check the ids against Workshop copies. + +#### Caste gizmo + +- **Players get:** With colonists, slaves or prisoners selected, a "Caste: Slave" button opens one caste menu and assigns the pick to every selected pawn. It is the manual way to put a prisoner in a caste. +- **How:** + - A postfix on `Pawn.GetGizmos` yields `Command_BlaxCaste : Command`. + - It sets `alsoClickIfOtherInGroupClicked = false`, `ProcessInput` only plays the sound, and `ProcessGroupInput(Event, List)` opens one FloatMenu for the whole group. Without the flag the menu opens once per pawn. + - `GroupsWith` returns true for any other `Command_BlaxCaste`, because the base matches on the label. + - Shown for player colonists, slaves, children and player prisoners. Not for quest lodgers or `disablePolicies` mutants. + - Icon: a vanilla texture checked with `ContentFinder` at startup, with a text-only fallback. +- **Settings:** `showGizmo` (on). +- **Replaces:** none. +- **Effort:** S (0.5 days). +- **Tests:** GetGizmos yields one `Command_BlaxCaste` on a colonist and on a prisoner, and none on a lodger. Group input with three pawns builds one menu and assigns all three. +- **Risks:** Gizmo clutter, hence the toggle. + +#### New caste from pawn + +- **Players get:** "New caste from this pawn" in the column menu, the gizmo menu and the manager. It copies a pawn's current apparel, food, drug and reading policy and medical care into a new caste, so an existing colony gets its castes in a few clicks. +- **How:** Creates a caste with all five slots managed from the pawn's current values, then makes the pawn a member. Slots the pawn cannot use, such as a prisoner's apparel, stay unmanaged. +- **Settings:** none, covered by `enabled`. +- **Replaces:** none. +- **Effort:** S (0.5 days). +- **Tests:** A colonist on Worker, Fine, Social, All and Best gives a caste with those five values, and the colonist is a member with no overrides. +- **Risks:** none known. + +#### Ideo conflict warning + +- **Players get:** The manager flags a caste whose drug or food policy clashes with a member's ideoligion, for example Social drugs for a drug-prohibiting ideo, or food with meat for a vegetarian ideo. Surprise mood hits are the main reason players blame a defaults mod. +- **How:** Drug: the member's ideo has a precept with `defaultDrugPolicyOverride`, and the caste's drug policy is not the matching policy. Food: the ideo has a `MeatEating_Disapproved`, `MeatEating_Horrible` or `MeatEating_Abhorrent` precept, and the caste's food filter allows meat. Checked when the manager opens, a member joins or a slot changes, never per tick. Shown as a warning line in the manager and a "!" in the column tooltip. Ideology only. +- **Settings:** `warnIdeoConflicts` (on). +- **Replaces:** none. +- **Effort:** S (0.5 days). +- **Tests:** A member with a drug-prohibiting ideo in a Social drugs caste is flagged, and on No drugs it is not. A member with a vegetarian ideo in a Lavish caste is flagged. Skipped without Ideology. +- **Risks:** Modded precepts that forbid drugs without `defaultDrugPolicyOverride` are missed. + +## 1.2: more settings per caste (3 days) + +#### Schedule and allowed area + +- **Players get:** Castes can also set the daily schedule and the allowed area. Pawns still in a drop pod or caravan, or arriving on another map, get the area when they arrive. +- **How:** + - Schedule: 24 `TimeAssignmentDef` defNames (null = leave alone), resolved with `GetNamedSilentFail`. Meditate becomes Anything without Royalty. Written with `Pawn_TimetableTracker.SetAssignment`. + - Area: the area label, resolved per map with `AreaManager.GetLabeled` and `Area.AssignableAsAllowed()`. Applied when `MapHeld != null`, `SupportsAllowedAreas`, `Faction.IsPlayer` and `HostFaction == null`. Not gated on `RespectsAllowedArea`, which is false for any pawn in a Lord (rituals, parties, caravan forming). + - Otherwise the pawn goes on a pending list. A `Pawn.SpawnSetup` postfix applies pending entries, and the area on a map where Castes never set one for that pawn (tracked per pawn per map id), then clears them. A 250-tick sweep retries pending entries. + - It never re-applies on every spawn, so manual choices and AAAA's "#safe" swaps survive caravans, transport pods and map moves. + - A label missing on the map means leave alone. The manager shows "missing on " with a "Create area" button (`AreaManager.TryMakeNewAllowed`). A renamed area shows as missing until re-picked. + - The caste column is also added to `PawnTableDef` Restrict (the Schedule tab). +- **Settings:** `allowScheduleAndArea` (on), `applyAreaOnSpawn` (on). +- **Replaces:** 1trickPwnyta's Defaults (75,424 subs), default area per pawn type. Plug and Play Joiner (Continued) (3383245777, 1,489 subs), preset area for joiners. +- **Effort:** M (2 days). +- **Tests:** A caste with a test area and a night schedule. A bought-slave fixture left unspawned gets the schedule at once and the area pending, and spawning applies the area. A second spawn on the same map after a manual change keeps the manual area. Deleting the area makes the slot report missing, and Apply does nothing, without errors. An unknown time defName becomes Anything. +- **Risks:** AAAA (3264193512, 100,585 subs) swaps areas on threats. Castes writes areas only on assign, join, first arrival on a map and caste edits. + +#### Hostility, self-tend, carried medicine, fire at will + +- **Players get:** Castes can also set the hostility response, self-tend, carried medicine and fire at will. A Guard caste can be set to Attack and carry 2 industrial medicine. +- **How:** + - Hostility: an int (-1 = leave alone). Attack falls back to Flee when `WorkTagIsDisabled(Violent)`. + - Self-tend: -1, 0 or 1, plus an optional "only if Medicine skill is at least N". Skipped when Doctor is disabled. + - Carry: a Medicine stock group thing defName and count via `Pawn_InventoryStockTracker.SetThingForGroup` and `SetCountForGroup`, which clamp to the group. + - Fire at will: written on assign and restored in the SpawnSetup postfix, because `drafter` is nulled on despawn. + - The manager warns when members x count exceeds the colony's medicine. + - No slave interaction mode slot. Suppression belongs to Blax Slaves. +- **Settings:** `allowBehaviourSlots` (on). +- **Replaces:** 1trickPwnyta's Defaults (75,424 subs): default hostility, medicine carry and self-tend at a minimum skill. +- **Effort:** S (0.5 days). +- **Tests:** A violent colonist gets Attack, 2 industrial medicine and self-tend. A pacifist gets Flee. A pawn with Doctor disabled keeps self-tend off. After despawn and spawn, FireAtWill is restored. +- **Risks:** Big castes with carry above 0 drain the hospital, hence the warning. + +## 1.3: every join path, Blax Slaves and Zones (3 days) + +#### Every join path, adult and child + +- **Players get:** The defaults window lists every way a pawn joins, each with an adult caste and a child caste: wanderer, quest reward, rescued, lodger recruited, freed slave, born, child chosen as colonist or slave, coming of age. Pawns that come back (re-bought, released after arrest, re-enslaved, returned runaways) get their old caste. +- **How:** + - Rows: starting, boughtSlave, boughtColonist, enslaved, recruitedPrisoner, captured, wanderer, questJoiner, rescued, lodgerArrived (default No caste), lodgerRecruited, emancipated, recruitedSlave, born (incl. growth vat), childColonist, childSlave, cameOfAge, creepjoiner (Anomaly only), and the three status fallbacks. Each row has an adult and a child dropdown; the child one defaults to "same as adult". Picks from 1.0 carry over. + - New scopes: `GenGuest.TryEnslavePrisoner` (EnslavePrisoner is a one-line wrapper that CoreCLR may inline), `RecruitUtility.Recruit` (records whether the pawn was a prisoner or a slave), `Pawn_GuestTracker.CapturedBy`. + - One scope on `Quest.Notify_SignalReceived` carries `quest.root`: WandererJoins goes to wanderer, creepjoiner roots to creepjoiner, everything else to questJoiner. It is the only dispatcher of `QuestPart.Notify_QuestSignalReceived`, so it covers SetFaction, PawnsArrive, JoinPlayer, DropPods, GiveToCaravan, GiveNearPawn and modded quest parts. + - Other hooks: `Pawn_GuestTracker.Notify_PawnUndowned` and `Pawn_MindState.JoinColonyBecauseRescuedBy` (rescued), `GenGuest.EmancipateSlave`, `ChoiceLetter_BabyToChild.ChoseColonist` / `ChoseSlave` (private), `LifeStageWorker_HumanlikeChild` and `LifeStageWorker_HumanlikeAdult.Notify_LifeStageStarted`, `PregnancyUtility.ApplyBirthOutcome`, `Faction.Notify_MemberLeftExtraFaction` (a lodger stops being one). + - Status rows always move the pawn. Growth rows move only members whose membership is still auto-assigned. + - Previous caste: when a member leaves the player faction, is sold, or becomes a prisoner (arrest, slave Imprison mode), Castes writes a former-caste record (caste id, status class, tick). If the pawn comes back within `formerCasteDays` with the same status class, it gets that caste back. An arrested colonist who is then enslaved goes to the enslaved row instead. + - Order at apply time: pre-pick, then previous caste, then the row. + - Safety net: on spawn, a player humanlike with no membership record whose `playerSettings.joinTick` is after the component's creation tick gets its status-fallback row once. Casteless-by-choice pawns are skipped. +- **Settings:** `returnToPreviousCaste` (on), `formerCasteDays` (60), `catchAllOnSpawn` (on). +- **Replaces:** 1trickPwnyta's Defaults (75,424 subs): child colonist defaults and the child-to-adult switch. Better Pawn Control (227,665 subs): its rescued and guest joiners arriving on Lavish food and Glitter medicine. +- **Effort:** M (2 days). It would be L with one patch per QuestPart. +- **Tests:** + - One per path the harness can trigger: `Notify_PawnUndowned` by reflection on a downed friendly pawn (forced roll), `Quest.Notify_SignalReceived` with a fake quest whose root is WandererJoins, `EmancipateSlave` on a colony-born slave, the `ChoiceLetter_BabyToChild` actions on a baby fixture, a life-stage change from setting biological age, `ApplyBirthOutcome` (Biotech only, skipped without it). + - A child fixture uses the child dropdown. + - A Miner slave sold with `PreTraded(PlayerSells)` and re-bought returns to Miner slave. An arrested Miner colonist who is released returns to Miner. An arrested colonist who is enslaved goes to the enslaved row. + - Lodger arrival gives no caste. A recruited lodger gets the lodgerRecruited row. + - A casteless-by-choice pawn stays casteless after a caravan returns. +- **Risks:** Quest code shifts between 1.7 builds. The status fallbacks and the spawn safety net keep unknown paths working. Hospitality guests are never player faction and are ignored. + +#### Public API + +- **Players get:** With Blax Slaves, returned runaways come back into their old caste and indentured pawns are sorted correctly. With Blax Zones, a sleeping zone can be limited to a caste. +- **How:** + - `BlaxCastes.CastesApi`, Version 1: `HintJoinReason`, `NotifyJoined`, `CasteIdOf`, `CasteLabels`. Signatures and the reason table are in "Works with the other Blax mods". + - Hints sit in a per-pawn map. The next classification consumes a hint, and any hint left is cleared at the end of the tick. + - `NotifyJoined` queues the pawn with that reason like any other join. The specific reason replaces a status fallback, even if the fallback already ran. + - Unknown reasons use the status fallbacks. Castes calls nothing in the other mods. +- **Settings:** `enableApi` (on). Off: API calls are ignored. +- **Replaces:** none. +- **Effort:** S (0.5 days). +- **Tests:** `CasteIdOf` and `CasteLabels` round-trip. A hint beats the status fallback and is gone on the next tick. `NotifyJoined` on a pawn the fallback already placed moves it to the reason's row. -Compat with Blax Slaves: a returned runaway lands in its previous caste. +- **Risks:** This is a contract across three repos. Add methods only, never change a signature, and raise Version on each addition. + +#### Pre-pick in the prisoner and slave tabs + +- **Players get:** The prisoner tab shows the prisoner's caste plus two pickers: caste when recruited and caste when enslaved. The slave tab shows the slave's caste and a "caste when freed" picker. A pick beats every default for that pawn. +- **How:** Postfixes on the private `ITab_Pawn_Visitor.DoPrisonerTab(bool, Listing_Standard)` and `DoSlaveTab(Listing_Standard)` append rows at the end. The tab sizes itself from `listing.CurHeight`. Picks are stored in the component as pawn to (reason to caste), saved by reference, and cleared when used, when the pawn leaves, or when the caste is deleted. Hidden for wild men and non-player captives. +- **Settings:** `showVisitorTabPickers` (on). +- **Replaces:** PrisonerDefaults (1,086 subs): per-prisoner food choice, partly. +- **Effort:** S (0.5 days). +- **Tests:** A prisoner with "when enslaved" set to Miner slave ends in Miner slave after `EnslavePrisoner`, and the pick is gone. Without a pick, the row applies. Phase 2: the pick survives save and reload. +- **Risks:** Prison Labor and Prisoner Realism also draw in this tab. Appending at the end avoids overlap; check with -Compat. + +## 1.4: work and prisoners (4 days) + +#### Work priorities per caste (optional) + +- **Players get:** A caste can carry work priorities. A Hauler slave caste sets Hauling 1 and Cleaning 2 and leaves the rest alone. Off unless the caste turns it on. +- **How:** Each caste holds work type defName to priority 0 to 4 (absent = leave alone). Applied after the status is final, because `SetFaction(player)` runs `EnableAndInitialize` and slaves ignore backstory disables. Types where `Pawn.WorkTypeIsDisabled` is true are skipped, which avoids the `SetPriority` error. With manual priorities off (`PlaySettings.useWorkPriorities`), any nonzero value means "on". Per caste: "Start from vanilla" keeps vanilla's picks, "Start from nothing" runs `DisableAll` first. The caste column is also added to `PawnTableDef` Work. +- **Settings:** `allowWorkSlot` (on). The slot is greyed out with a note when WorkRoles, Work Tab, Free Will, Work Manager or AutoPriorities is active. +- **Replaces:** Plug and Play Joiner (Continued) (1,489 subs): joiner work priorities. 1trickPwnyta's Defaults (75,424 subs): rule-based default work priorities, done by caste instead. +- **Effort:** M (2 days). +- **Tests:** A slave fixture in a caste with Hauling 1 has Hauling 1. A disabled work type stays 0 with no log error. "Start from nothing" leaves only the caste's types. With manual priorities off, nonzero becomes 3. +- **Risks:** Automatic work managers reset priorities all the time and would fight Castes, hence off per caste plus detection. + +#### Shift schedules + +- **Players get:** A caste can hold up to three schedules. New members are dealt out in turn so day and night shifts fill evenly, and "Rebalance" spreads current members again. +- **How:** The schedule slot becomes a list of 1 to 3 timetables plus a per-caste counter. Each membership stores its shift index. Rebalance sorts members by ThingID and assigns index i mod n, so the result is the same on every machine. Needs the 1.2 schedule slot. +- **Settings:** `allowShifts` (on). +- **Replaces:** 1trickPwnyta's Defaults (75,424 subs): round-robin default schedules. Work Manager (2029596262, 14,211 subs): shift schedules, partly. +- **Effort:** S (0.5 days). +- **Tests:** With two shifts, four assigned pawns split 2 and 2. After removing two and rebalancing, they split 1 and 1. +- **Risks:** none known. + +#### Default prisoner interaction + +- **Players get:** A prisoner caste can set the interaction mode on capture, such as Reduce resistance, Enslave or Convert, plus Biotech's bloodfeed and hemogen farm toggles. +- **How:** An exclusive `PrisonerInteractionModeDef` defName written with `Pawn_GuestTracker.SetExclusiveInteraction`, plus non-exclusive defNames written with `ToggleNonExclusiveInteraction`, each checked against the active DLCs and the def's exclusive flag. Applied on join only, because `SetGuestStatus(Prisoner)` resets the mode first. Existing members change only through "Apply to all members". +- **Settings:** `prisonerModeSlot` (on). The slot defaults off when Prison Labor or Custom Prisoner Interactions is active. +- **Replaces:** Custom Prisoner Interactions (2841231775): default action for new prisoners, partly. Prison Labor (1899474310): default interaction mode, partly. +- **Effort:** S (0.5 days). +- **Tests:** A Prisoner caste with Enslave: after `CapturedBy`, the exclusive mode is Enslave. The hemogen farm toggle applies only with Biotech. +- **Risks:** Prison Labor sets its own mode on capture. Castes runs a tick later and overrides it, hence the detection. + +#### DLC switches + +- **Players get:** Castes can also set Royalty room and apparel requirements, psyfocus target and entropy limit, hemogen pack use and deathrest auto-wake. +- **How:** Each is a nullable slot, shown only when its DLC is active and applied only when the pawn has the tracker or gene. Royalty: `allowRoomRequirements`, `allowApparelRequirements`. Psycasters: `limitEntropyAmount`, `SetPsyfocusTarget`. Genes: `Gene_Hemogen.hemogenPacksAllowed`, `Gene_Deathrest.autoWake`, found with `pawn.genes?.GetFirstGeneOfType()`, never by cast. +- **Settings:** `allowDlcSlots` (on). +- **Replaces:** none. +- **Effort:** S (0.5 days). +- **Tests:** Each slot is set on a pawn with the tracker or gene and skipped without errors on one without. Slots for a missing DLC are hidden; those tests skip when the DLC is absent. +- **Risks:** Xenotype mods vary the gene classes, hence the type check. + +#### Trade-row caste picker support + +- **Players get:** Nothing visible yet. Once Blax Slaves adds its trade-row picker (in its backlog), you pick a caste for each pawn you buy, next to the buy-as-slave toggle. +- **How:** `CastesApi.PrePick(Pawn, string casteId)`, API Version 2. It writes into the 1.3 pre-pick store under the bought reasons. Blax Slaves owns the picker in its trade row; Castes adds no trade dialog patch. +- **Settings:** covered by `enableApi`. +- **Replaces:** none. +- **Effort:** S (0.5 days). +- **Tests:** `PrePick` then `PreTraded(PlayerBuys)`: the pawn lands in the picked caste, not the row's. An unknown id is ignored. +- **Risks:** A cancelled trade leaves a pick on a pawn that never joins. The 2500-tick sweep drops picks on pawns that are not player-side after one in-game day. + +## 1.5: templates and colours (3 days) + +#### Caste templates across saves + +- **Players get:** Export a caste, together with the policies it uses, and import it into another colony. New games can start from your saved castes instead of the starter set. +- **How:** Export writes the caste plus deep copies of its policies with `Scribe.saver` to `GenFilePaths.ConfigFolderPath/BlaxCastes/.xml`. Import creates new policies through each database's `MakeNewOutfit`, `MakeNewFoodRestriction`, `MakeNewDrugPolicy` or `MakeNewReadingPolicy` plus `CopyFrom` (label kept, suffixed if taken), then the caste. "Seed new games from templates" replaces the starter castes in `StartedNewGame`. Game data stays in the save; files are read only on an explicit action. +- **Settings:** `seedFromTemplates` (off). +- **Replaces:** Better Policies (3400923070, 3,857 subs): saving policies across saves, partly. Save My Settings (3,827 subs), partly. Export Agency (1467209473, 16,333 subs): policy export, partly. +- **Effort:** M (2 days). +- **Tests:** Export the Slave caste to a temp folder, delete it, import: the caste and its three policies come back with equal filters (compare allowed defs). Importing twice suffixes the labels. +- **Risks:** Filters that reference defs from removed mods drop entries on load. Report the count. + +#### Caste colour and inspect line + +- **Players get:** Each caste can have a colour. The caste name shows in its colour in the Assign column, the gizmo and the pawn's inspect pane, so you see at a glance who is a field slave and who is a house slave. +- **How:** A per-caste colour from 12 presets, saved as a Color. The column cell and gizmo label are tinted. A postfix on `Pawn.GetInspectString` adds a "Caste: X" line. No textures. +- **Settings:** `showInspectLine` (on). +- **Replaces:** none. +- **Effort:** S (0.5 days). +- **Tests:** The inspect string has the caste line when the setting is on and lacks it when off. +- **Risks:** The inspect pane has little room on some UI mods, hence the toggle. + +## Works with the other Blax mods + +### Detection and binding + +- Package ids: `blax.slaves`, `blax.castes`, `blax.zones`. No hard dependencies. Siblings appear in About.xml only as loadAfter entries. +- Detection: `ModLister.GetActiveModWithIdentifier(id, ignorePostfix: true)` in one shared Compat helper per mod, so a dev copy next to a Workshop copy still matches. +- 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. +- Castes uses neither ZonesApi nor SlavesApi. The others reach Castes only through `BlaxCastes.CastesApi`. +- Load order is Castes, Zones, Slaves. Each mod loads after the APIs it calls: Castes lists no sibling, Zones lists `blax.castes`, Slaves lists `blax.castes` and `blax.zones`. No two mods list each other, so RimWorld reports no cycle. + +### CastesApi (static class) + +| Member | What it does | Since | +|---|---|---| +| `Version` | int, raised on every addition | 1.3 | +| `HintJoinReason(Pawn pawn, string reason)` | Consumed by that pawn's next join classification. Expires at the end of the current tick. | 1.3 | +| `NotifyJoined(Pawn pawn, string reason)` | For joins Castes cannot see itself. Called one tick after the status is final. | 1.3 | +| `CasteIdOf(Pawn)` | Caste id as a string, or null | 1.3 | +| `CasteLabels()` | List of (id, label) | 1.3 | +| `PrePick(Pawn, string casteId)` | Pre-pick for Blax Slaves' trade-row picker | 1.4 | + +### Join reasons from Blax Slaves + +| Reason | Castes does | +|---|---| +| `blax.slaves.runawayReturned` | Previous caste. Without a record, the new-slave row. | +| `blax.slaves.slaveRecruited` | Treated as recruited (recruitedSlave row) | +| `blax.slaves.indentureServed` | Treated as recruited (recruitedSlave row) | +| `blax.slaves.boughtIndentured` | Treated as bought as slave | +| `blax.slaves.contractReturned` | Keeps the current caste | + +- Buying needs no API call. Blax Slaves' buy mode only sets `guest.joinStatus` before vanilla `Pawn.PreTraded`, and Castes classifies by the final status in its own PreTraded scope (1.0). +- Before 1.3 there is no API. Purchases and returned runaways still work: runaways end in `SetGuestStatus(player, Slave)` and land in the new-slave row. +- Blax Slaves ships no policy defaults. Its README points slave outfit, food and drug automation to Castes. + +### Blax Zones + +- Zones' sleeping-zone filter gains "caste: X" entries when Castes is active, using `CasteLabels` and `CasteIdOf`. Zones stores the caste ids per save. +- Castes has no bed or sleep slot. +- The caste area slot writes the vanilla allowed area, so Zones would need no API to read it. Zones has no area check planned. + +### Ownership + +- Castes: every per-pawn policy default (apparel, food, drug, reading, medical care, schedule, area, hostility, self-tend, carried medicine). +- Zones: sleeping spots, beds by zone and every friendly drop location. +- Slaves: slave status, trade, prices, suppression, rebellion, slave medicine and the slave economy. Slaves routes its silver payouts through `ZonesApi.TryFindDropSpot`, with `DropCellFinder.TradeDropSpot` as fallback. Pawns are never routed into zones. + +### Shared conventions + +- Patches are applied one class at a time from a `[StaticConstructorOnStartup]` class, logging "[Blax Castes] N patches applied". One broken patch class does not take the others down. +- Every feature has a ModSettings toggle. Reviewers wanted toggles that change the simulation in the save for multiplayer; the shared contract puts them in ModSettings, so they stay there until multiplayer is built. +- Tests use the headless in-game test mod from `blax-slaves/Tests` (`BlaxSlavesTests` harness, `run-tests.ps1`), copied into this repo as `BlaxCastesTests`. Phase 1 runs in a fresh game, phase 2 after save and reload, and -Compat with the sibling and overlap mods active. + +## Backlog + +- Multiplayer support: needs a 1.7 build of the Multiplayer mod, and real sync needs two clients. The groundwork is in place (tick-based apply, every write through `CasteManager`). The Workshop page says "Multiplayer: not supported yet" until then. +- Colony bar grouped by caste, like [LTO] Colony Groups (231k subs, no 1.7 build): L and UI-heavy, only as a late optional release. +- Animal and mech castes: a different set of settings (master, follow, training, control groups) and different tables. +- A custom 64x64 gizmo icon: polish only, the vanilla icon works. + +## Cut + +- Strict sync mode: it duplicates "Apply to all members", and as a ModSetting it would differ per client. +- Slave interaction mode slot: suppression belongs to Blax Slaves. +- Baby autofeed slot: stored per baby and per feeder, so it must be rewritten whenever a feeder joins or leaves. Low value. +- Custom "Make default" tooltip: the base dialog always draws the vanilla one. `TipKey` explains the default caste instead. +- Creating missing vanilla policies at seed time: it duplicates renamed policies. A "Create" button replaces it. +- Reading None in the Slave caste: it does nothing for adult slaves and blocks slave children's learning. +- One patch per QuestPart: one `Quest.Notify_SignalReceived` scope covers all of them, modded parts included. +- A single "other" fallback row: it filed slave-born children, quest prisoners and returned runaways as colonists. Three status rows replace it. +- `RegisterJoinReason` in the API: not in the shared contract. Castes maps the Blax Slaves reasons itself. +- Colony-wide presets or emergency mode: a different model (colony modes, not roles). BPC Forked has it on 1.7, and AAAA covers threat areas. +- Defaults' non-pawn defaults (storyteller, world, bills, shelves, zones, policy locks): out of scope, and that bulk is why players find Defaults too big. +- Ideology roles in a caste: roles are for free colonists only and mostly have one holder, so bulk assignment makes no sense. +- A caste picker in the trade dialog owned by Castes: Blax Slaves owns the trade row, and Castes offers `PrePick` instead. +- A sleeping-zone or bed slot: beds by zone belong to Blax Zones, which filters by caste instead. +- Caste mood, social or precept rules and stat bonuses: that is what Ideology: Social Castes and Caste System do. It is not a policy bundle. +- An appearance or style bundle: not a policy. It queues styling-station jobs and has no clean "apply". +- Guest and visitor defaults: visitors lack the policy trackers, and Hospitality already handles guests. +- A rule engine for assignment: too abstract. Join rows plus pre-picks cover the real cases with far less UI. +- Periodic re-sync of members: it would fight AAAA's area swaps and hand changes. Castes writes only on assign, join, first arrival and caste edits. +- Policy templates in ModSettings in 1.0: they need policy serialization and label re-linking. Templates arrive in 1.5 as files.