using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using BlaxLaws; using RimWorld; using Verse; using Verse.AI; namespace BlaxLawsTests { /// /// The act catalogue (design: "Act catalogue and detection", Tests, Catalogue; "Lawbook tab", Tests, the /// parts the catalogue answers): every def of the loaded game has its entry, the groups cover what their /// rules say, breaks carry their stages and links, labels can be found and told apart, DLC entries appear /// only with their DLC, and the watched sets follow the lawbook. /// public static class CatalogueTests { private const string TestModPackageId = "blax.laws.tests"; private static ActEntry Entry(string key) { ActEntry e = ActCatalogue.Get(key); T.NotNull(e, "catalogue entry " + key); return e; } private static string Key(string category, Def def) => ActKey.Of(category, def.defName); [BlaxTest("catalogue: every break state, edible thing, usable, interaction, recorded act, counting record, recipe and special act has an entry; no Time record, plant or excluded state has one")] public static void EveryDefHasAnEntry() { var sw = Stopwatch.StartNew(); ActCatalogue.Build(); sw.Stop(); Watch.Rebuild(); T.Info("catalogue built in " + sw.ElapsedMilliseconds + " ms: " + string.Join(", ", ActCatalogue.Categories.Select(c => c.defName + " " + ActCatalogue.EntriesOf(c.defName).Count)) + ", " + ActCatalogue.All.Count + " in all"); var missing = new List(); void Need(string category, Def def) { if (def != null && ActCatalogue.Get(Key(category, def)) == null) missing.Add(Key(category, def)); } ActCategoryDef breaks = DefDatabase.GetNamed(ActCategories.Break); foreach (MentalBreakDef b in DefDatabase.AllDefsListForReading) { if (b.mentalState != null && !CatalogueRules.Excluded(breaks, b.mentalState.defName)) Need(ActCategories.Break, b.mentalState); } foreach (string name in CatalogueRules.BreakInclude) Need(ActCategories.Break, DefDatabase.GetNamedSilentFail(name)); foreach (ThingDef t in DefDatabase.AllDefsListForReading) { if (CatalogueRules.IsEdible(t)) Need(ActCategories.Ate, t); if (CatalogueRules.IsUsable(t)) Need(ActCategories.Used, t); } foreach (InteractionDef i in DefDatabase.AllDefsListForReading) Need(ActCategories.Interaction, i); ActCategoryDef recorded = DefDatabase.GetNamed(ActCategories.RecordedAct); foreach (HistoryEventDef h in DefDatabase.AllDefsListForReading) { if (!CatalogueRules.Excluded(recorded, h.defName)) Need(ActCategories.RecordedAct, h); } foreach (RecordDef r in DefDatabase.AllDefsListForReading) { if (r.type != RecordType.Time) Need(ActCategories.Record, r); } foreach (RecipeDef r in DefDatabase.AllDefsListForReading) Need(ActCategories.Bill, r); foreach (ActDef a in DefDatabase.AllDefsListForReading) Need(ActCategories.Special, a); T.Check(missing.Count == 0, missing.Count + " def(s) without an entry, first: " + string.Join(", ", missing.Take(8))); var wrong = new List(); foreach (RecordDef r in DefDatabase.AllDefsListForReading.Where(r => r.type == RecordType.Time)) { if (ActCatalogue.Get(Key(ActCategories.Record, r)) != null) wrong.Add("Time record " + r.defName); } foreach (string name in CatalogueRules.BreakExclude) { if (ActCatalogue.Get(ActKey.Of(ActCategories.Break, name)) != null) wrong.Add("excluded state " + name); } foreach (ThingDef plant in DefDatabase.AllDefsListForReading.Where(t => t.category == ThingCategory.Plant && t.ingestible != null).Take(20)) { if (ActCatalogue.Get(Key(ActCategories.Ate, plant)) != null) wrong.Add("plant " + plant.defName); } if (ActCatalogue.Get(ActKey.Of(ActCategories.RecordedAct, "Traded")) != null) wrong.Add("faction-level event Traded"); T.Check(wrong.Count == 0, "entries that must not exist: " + string.Join(", ", wrong.Take(8))); // The examples of the design, all Core. Entry("Break/Binging_DrugExtreme"); Entry("Break/FireStartingSpree"); Entry("Break/CorpseObsession"); Entry("Break/Berserk"); Entry("Ate/WakeUp"); Entry("Used/MechSerumHealer"); Entry("Interaction/Insult"); Entry("Interaction/SparkJailbreak"); Entry("RecordedAct/ExecutedPrisoner"); Entry("Record/BodiesStripped"); Entry("Bill/" + RecipeDefOf.RemoveBodyPart.defName); Entry("Special/SetFire"); Entry("Special/DisplayedCorpse"); Entry("Special/StartedSocialFight"); } [BlaxTest("catalogue: every group of the design exists with its label, comes before the defs and covers what its rule says")] public static void Groups() { var groups = new (string category, string id)[] { (ActCategories.Break, ActGroups.Any), (ActCategories.Break, ActGroups.AnyDrugBinge), (ActCategories.Break, ActGroups.AnyTantrum), (ActCategories.Break, ActGroups.AnyInsultingSpree), (ActCategories.Break, ActGroups.AnyAggressive), (ActCategories.Ate, ActGroups.Any), (ActCategories.Ate, ActGroups.AnyDrug), (ActCategories.Ate, ActGroups.HardDrugs), (ActCategories.Ate, ActGroups.SocialDrugs), (ActCategories.Ate, ActGroups.MedicalDrugs), (ActCategories.Ate, ActGroups.AnyMeat), (ActCategories.Ate, ActGroups.RawMeatOrCorpse), (ActCategories.Ate, ActGroups.HumanMeat), (ActCategories.Ate, ActGroups.InsectMeat), (ActCategories.Ate, ActGroups.RawFood), (ActCategories.Ate, ActGroups.AnyMeal), (ActCategories.Interaction, ActGroups.InsultOrSlight), (ActCategories.Bill, ActGroups.AnySurgery), }; foreach (var (category, id) in groups) { ActEntry e = Entry(ActKey.OfGroup(category, id)); T.Check(e.IsGroup && e.def == null, e.key + " is not a group entry"); T.Check(e.group.labelKey.CanTranslate(), e.key + ": label " + e.group.labelKey + " missing from Keyed"); T.Check(e.label == e.group.labelKey.Translate().ToString(), e.key + " reads '" + e.label + "', not its Keyed label"); T.Equal(DlcSupport.CoreName, e.sourceMod, e.key + " source"); T.Check(e.group.size > 0, e.key + " covers no def of the loaded game"); } foreach (ActCategoryDef cat in ActCatalogue.Categories) { IReadOnlyList list = ActCatalogue.EntriesOf(cat.defName); int firstDef = list.Count; for (int i = 0; i < list.Count; i++) { if (list[i].def != null) { firstDef = i; break; } } T.Check(list.Skip(firstDef).All(e => e.def != null), cat.defName + ": a group comes after a def entry"); } ActGroup G(string key) => Entry(key).group; void In(string key, Def def, bool expected) { T.NotNull(def, "def for " + key); T.Check(G(key).MatchesDef(def) == expected, key + (expected ? " misses " : " takes in ") + def.defName); } MentalStateDef State(string name) => DefDatabase.GetNamed(name); In("Break/@anyDrugBinge", State("Binging_DrugExtreme"), true); In("Break/@anyDrugBinge", State("Binging_DrugMajor"), true); In("Break/@anyDrugBinge", State("Binging_Food"), false); In("Break/@anyTantrum", State("Tantrum"), true); In("Break/@anyTantrum", State("TargetedTantrum"), true); In("Break/@anyTantrum", State("BedroomTantrum"), true); In("Break/@anyTantrum", State("MurderousRage"), false); In("Break/@anyInsultingSpree", State("InsultingSpree"), true); In("Break/@anyInsultingSpree", State("TargetedInsultingSpree"), true); In("Break/@anyAggressive", State("Berserk"), true); In("Break/@anyAggressive", State("Wander_Sad"), false); In("Break/@any", State("Wander_Sad"), true); In("Break/@any", MentalStateDefOf.SocialFighting, false); In("Break/@any", MentalStateDefOf.Manhunter, false); ThingDef cowMeat = ThingDefOf.Cow.race.meatDef; ThingDef insect = DefDatabase.GetNamed("Megaspider"); In("Ate/@any", ThingDefOf.MealSimple, true); In("Ate/@anyDrug", ThingDefOf.Beer, true); In("Ate/@anyDrug", ThingDefOf.MealSimple, false); In("Ate/@hardDrugs", ThingDefOf.WakeUp, true); In("Ate/@hardDrugs", ThingDefOf.Yayo, true); In("Ate/@hardDrugs", ThingDefOf.Beer, false); In("Ate/@socialDrugs", ThingDefOf.Beer, true); In("Ate/@socialDrugs", ThingDefOf.SmokeleafJoint, true); In("Ate/@medicalDrugs", ThingDefOf.Penoxycyline, true); In("Ate/@rawMeatOrCorpse", cowMeat, true); In("Ate/@rawMeatOrCorpse", ThingDefOf.Human.race.corpseDef, true); In("Ate/@rawMeatOrCorpse", ThingDefOf.MealSimple, false); In("Ate/@humanMeat", ThingDefOf.Meat_Human, true); In("Ate/@humanMeat", ThingDefOf.Human.race.corpseDef, true); In("Ate/@humanMeat", cowMeat, false); In("Ate/@insectMeat", insect.race.meatDef, true); In("Ate/@insectMeat", insect.race.corpseDef, true); In("Ate/@insectMeat", cowMeat, false); In("Ate/@anyMeat", cowMeat, true); In("Ate/@rawFood", ThingDefOf.RawPotatoes, true); In("Ate/@rawFood", ThingDefOf.MealSimple, false); In("Ate/@anyMeal", ThingDefOf.MealSimple, true); In("Ate/@anyMeal", ThingDefOf.MealSurvivalPack, true); In("Ate/@anyMeal", ThingDefOf.Beer, false); In("Ate/@anyMeal", ThingDefOf.Chocolate, false); In("Interaction/@insultOrSlight", InteractionDefOf.Insult, true); In("Interaction/@insultOrSlight", DefDatabase.GetNamed("Slight"), true); In("Interaction/@insultOrSlight", InteractionDefOf.Chitchat, false); In("Bill/@anySurgery", RecipeDefOf.RemoveBodyPart, true); In("Bill/@anySurgery", DefDatabase.GetNamed("CookMealSimple"), false); // The thing decides for meals: a simple meal is human meat only with human meat in it. Thing mealHuman = ThingMaker.MakeThing(ThingDefOf.MealSimple); mealHuman.TryGetComp().RegisterIngredient(ThingDefOf.Meat_Human); Thing mealVeg = ThingMaker.MakeThing(ThingDefOf.MealSimple); mealVeg.TryGetComp().RegisterIngredient(ThingDefOf.RawPotatoes); ActEvent Ate(Thing food) => new ActEvent(ActCategories.Ate, food.def, null) { thing = food, facts = FoodFacts.Of(food) }; T.Check(G("Ate/@humanMeat").Matches(Ate(mealHuman)), "a simple meal with human meat isn't human meat"); T.Check(G("Ate/@anyMeat").Matches(Ate(mealHuman)), "a simple meal with human meat isn't meat"); T.Check(!G("Ate/@humanMeat").Matches(Ate(mealVeg)), "a simple meal of potatoes is human meat"); T.Check(!G("Ate/@anyMeat").Matches(Ate(mealVeg)), "a simple meal of potatoes is meat"); T.Check(!G("Ate/@rawMeatOrCorpse").Matches(Ate(mealHuman)), "a simple meal is raw meat"); // The smaller group wins: sizes must order the nested groups. T.Check(G("Ate/@hardDrugs").size < G("Ate/@anyDrug").size, "hard drugs aren't smaller than any drug"); T.Check(G("Ate/@humanMeat").size < G("Ate/@anyMeat").size, "human meat isn't smaller than any meat"); T.Check(G("Break/@anyDrugBinge").size < G("Break/@any").size, "any drug binge isn't smaller than any break"); } [BlaxTest("catalogue: breaks get Planning, a Did it through their link, hostility and the drug option; other entries are Did it only")] public static void BreakStagesAndLinks() { ActEntry fire = Entry("Break/FireStartingSpree"); T.Check(fire.hasPlanning && fire.hasDidIt, "fire-starting spree stages: planning " + fire.hasPlanning + ", did it " + fire.hasDidIt); T.Check(fire.links.Any(l => l.act == "Special/SetFire"), "fire-starting spree isn't linked to Special/SetFire"); ActEntry sad = Entry("Break/Wander_Sad"); T.Check(sad.hasPlanning && !sad.hasDidIt, "sad wandering offers Did it without a link"); T.Check(Entry("Break/CorpseObsession").links.Any(l => l.act == "Special/DisplayedCorpse"), "corpse obsession isn't linked to DisplayedCorpse"); T.Check(Entry("Break/Jailbreaker").links.Any(l => l.act == "Interaction/SparkJailbreak"), "jailbreaker isn't linked to SparkJailbreak"); T.Check(Entry("Break/TargetedInsultingSpree").links.Any(l => l.act == "Interaction/@insultOrSlight"), "targeted insulting spree isn't linked to insult or slight"); ActEntry extreme = Entry("Break/Binging_DrugExtreme"); T.Check(extreme.links.Count == 1 && extreme.links[0].act == "Ate/@anyDrug" && extreme.hasDrugOption, "a drug binge takes the drug link (most derived class) with the option, has: " + string.Join(", ", extreme.links.Select(l => l.act))); ActEntry food = Entry("Break/Binging_Food"); T.Check(food.links.Count == 1 && food.links[0].act == "Ate/@any" && !food.hasDrugOption, "food binge link: " + string.Join(", ", food.links.Select(l => l.act))); ActEntry anyBinge = Entry("Break/@anyDrugBinge"); T.Check(anyBinge.hasPlanning && anyBinge.hasDidIt && anyBinge.hasDrugOption, "any drug binge: planning, did it and the drug option expected"); T.Check(Entry("Break/Berserk").hostileBreak, "berserk isn't hostile to the colony"); T.Check(!Entry("Break/Tantrum").hostileBreak && !Entry("Break/MurderousRage").hostileBreak, "a tantrum or murderous rage is marked hostile"); T.Check(!Entry("Break/@anyAggressive").hostileBreak, "any aggressive break is marked hostile, but holds tantrums"); foreach (BreakLinkDef link in DefDatabase.AllDefsListForReading) T.NotNull(ActCatalogue.Get(link.act), "the act of " + link.defName + " (" + link.act + ")"); foreach (ActEntry e in ActCatalogue.All.Where(x => !x.IsBreak)) T.Check(!e.hasPlanning && e.hasDidIt, e.key + " should be Did it only"); } [BlaxTest("catalogue: a Berserk row offers Warn, Guilty and Jail, never Subdue; a Tantrum or MurderousRage row also offers Subdue; a Planning row never offers Guilty")] public static void PunishmentsByEntry() { string Names(string key, LawStage stage) => string.Join(",", Lawbook.PunishmentsFor(Entry(key), stage).Select(p => p.defName)); T.Equal("Warn,Guilty,Jail", Names("Break/Berserk", LawStage.Planning), "Berserk planning"); T.Equal("Warn,Subdue,Jail", Names("Break/Tantrum", LawStage.Planning), "Tantrum planning"); T.Equal("Warn,Subdue,Jail", Names("Break/MurderousRage", LawStage.Planning), "MurderousRage planning"); T.Check(Names("Break/FireStartingSpree", LawStage.DidIt).Contains("Subdue"), "a linked break's did-it lacks Subdue"); T.Check(!Names("Interaction/Insult", LawStage.DidIt).Contains("Subdue"), "an interaction offers Subdue"); } [BlaxTest("catalogue: the drug option list holds WakeUp, every option is a drug's chemical, and no other chemical")] public static void ChemicalOptions() { IReadOnlyList options = ActCatalogue.ChemicalOptions; T.Check(options.Contains("WakeUp"), "WakeUp missing from the drug options: " + string.Join(", ", options)); var drugChemicals = new HashSet(DefDatabase.AllDefsListForReading.Select(DrugInfo.ChemicalOf).Where(c => c != null).Select(c => c.defName)); T.Check(options.All(drugChemicals.Contains), "a drug option no drug carries: " + string.Join(", ", options.Where(o => !drugChemicals.Contains(o)))); T.Equal(DrugCategory.Hard, DrugInfo.CategoryOfChemical(DefDatabase.GetNamed("WakeUp")), "category of the wake-up chemical"); T.Equal(DrugCategory.Social, DrugInfo.CategoryOfChemical(DefDatabase.GetNamed("Alcohol")), "category of the alcohol chemical"); } [BlaxTest("catalogue: searching 'wake' finds Wake-up under Ate and the make wake-up bill; 'insult' finds Insult and the insulting sprees; equal labels are told apart")] public static void LabelsAndSearch() { // The picker matches the label and the def name (design: "Act picker"). List Search(string text) => ActCatalogue.All.Where(e => (e.label ?? "").IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0 || (e.def?.defName ?? "").IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0).ToList(); List wake = Search("wake"); T.Check(wake.Any(e => e.categoryId == ActCategories.Ate && e.def == ThingDefOf.WakeUp), "'wake' doesn't find Ate: wake-up"); ActEntry makeWake = wake.FirstOrDefault(e => e.categoryId == ActCategories.Bill && (e.def as RecipeDef)?.ProducedThingDef == ThingDefOf.WakeUp); T.NotNull(makeWake, "'wake' finding the bill that makes wake-up"); T.Check(makeWake.label.IndexOf("wake-up", StringComparison.OrdinalIgnoreCase) >= 0, "the wake-up bill reads '" + makeWake.label + "'"); List insult = Search("insult"); T.Check(insult.Any(e => e.key == "Interaction/Insult"), "'insult' doesn't find Interaction: insult"); T.Check(insult.Any(e => e.key == "Break/InsultingSpree") && insult.Any(e => e.key == "Break/TargetedInsultingSpree"), "'insult' doesn't find both insulting sprees under breaks"); string extreme = Entry("Break/Binging_DrugExtreme").label, major = Entry("Break/Binging_DrugMajor").label; T.Check(extreme != major, "both drug binges read '" + extreme + "'"); T.Equal("Tantrum", Entry("Break/Tantrum").label, "the plain tantrum's label"); T.Check(Entry("Break/TargetedTantrum").label != "Tantrum", "the targeted tantrum reads like the plain one"); // Strict for the official content; a mod list may hold two defs whose names read alike, noted only. foreach (ActCategoryDef cat in ActCatalogue.Categories) { var shared = ActCatalogue.EntriesOf(cat.defName).Where(e => e.def != null) .GroupBy(e => e.label, StringComparer.OrdinalIgnoreCase).Where(g => g.Count() > 1).ToList(); var official = shared.Where(g => g.All(e => e.sourcePackageId == DlcSupport.CorePackageId || DlcSupport.IsDlcPackageId(e.sourcePackageId))) .Select(g => g.Key).ToList(); T.Check(official.Count == 0, cat.defName + ": labels still shared: " + string.Join(", ", official.Take(5))); if (shared.Count > official.Count) T.Info(cat.defName + ": " + (shared.Count - official.Count) + " label(s) shared by modded entries, first: " + shared.First(g => !official.Contains(g.Key)).Key); } T.Equal(DlcSupport.CoreName, Entry("Ate/WakeUp").sourceMod, "source of Ate: wake-up"); } [BlaxTest("catalogue: the test mod's drug, interaction, recipe and break appear with the test mod as source; the test break offers Did it through its class's link")] public static void TestModDefs() { string[] keys = { "Ate/BlaxLawsTest_Drug", "Interaction/BlaxLawsTest_Interaction", "Bill/BlaxLawsTest_Recipe", "Break/BlaxLawsTest_FireSpree" }; if (DefDatabase.GetNamedSilentFail("BlaxLawsTest_FireSpree") == null) T.Fail("the test mod's catalogue defs aren't loaded: Tests/BlaxLawsTests/Defs/BlaxLawsTests_Catalogue.xml is missing"); foreach (string key in keys) { ActEntry e = Entry(key); T.Equal(TestModPackageId, e.sourcePackageId, key + " source package"); T.Check(e.sourceMod != DlcSupport.CoreName && !e.sourceMod.NullOrEmpty(), key + " source reads '" + e.sourceMod + "'"); } ActEntry spree = Entry("Break/BlaxLawsTest_FireSpree"); T.Check(spree.hasPlanning && spree.hasDidIt && spree.links.Any(l => l.act == "Special/SetFire"), "the test break reusing MentalState_FireStartingSpree lacks the SetFire link"); T.Check(Entry("Ate/@anyDrug").group.MatchesDef(DefDatabase.GetNamed("BlaxLawsTest_Drug")), "the test drug isn't in any drug"); } [BlaxTest("catalogue: no entry of an inactive DLC appears, each active DLC's entries name it, and every starter row resolves")] public static void DlcEntries() { var bySource = ActCatalogue.All.GroupBy(e => e.sourceMod).Select(g => g.Key + " " + g.Count()); T.Info("entries by source: " + string.Join(", ", bySource)); var stray = ActCatalogue.All.Where(e => DlcSupport.IsDlcPackageId(e.sourcePackageId) && !DlcSupport.IsDlcActive(DlcSupport.DlcName(e.sourcePackageId))).ToList(); T.Check(stray.Count == 0, "entries of an inactive DLC: " + string.Join(", ", stray.Take(5))); if (ModsConfig.IdeologyActive) T.Equal("Ideology", Entry("Break/IdeoChange").sourceMod, "source of the Ideology break IdeoChange"); else T.Check(ActCatalogue.Get("Break/IdeoChange") == null, "Ideology's IdeoChange break is listed without Ideology"); if (ModsConfig.BiotechActive) T.Equal("Biotech", Entry("Break/PanicFleeFire").sourceMod, "source of the Biotech break PanicFleeFire"); foreach (Lawbook.StarterRow s in Lawbook.StarterRows) { ActEntry e = Entry(s.actKey); T.Check(e.HasStage(s.stage), "starter row " + s.actKey + " has no " + s.stage + " stage"); T.Check(!DlcSupport.IsDlcPackageId(e.sourcePackageId), "starter row " + s.actKey + " comes from " + e.sourceMod); } } [BlaxTest("watch: an any-drug-binge row watches both binge states and every drug through its link; deleting it clears them; a meal group watches every meal")] public static void WatchFollowsRows() { MentalStateDef extreme = DefDatabase.GetNamed("Binging_DrugExtreme"); MentalStateDef major = DefDatabase.GetNamed("Binging_DrugMajor"); MentalStateDef sad = DefDatabase.GetNamed("Wander_Sad"); T.Check(!Watch.Break && !Watch.Ate, "the book isn't empty at the start"); Law binge = Fixtures.LawRow("Break/@anyDrugBinge", DrugOptions.Any, LawStage.Planning, LawSeverity.Moderate, "Warn", 3); T.Check(Watch.Any && Watch.Break, "the Break flag is off with a binge row"); T.Check(Watch.IsWatched(ActCategories.Break, extreme) && Watch.IsWatched(ActCategories.Break, major), "a binge state isn't watched"); T.Check(!Watch.IsWatched(ActCategories.Break, sad), "sad wandering is watched by a binge row"); T.Check(Watch.Ate && Watch.IsWatched(ActCategories.Ate, ThingDefOf.WakeUp) && Watch.IsWatched(ActCategories.Ate, ThingDefOf.Beer), "the binge's link doesn't watch the drugs"); T.Check(!Watch.MayMatch(ActCategories.Ate, ThingDefOf.MealSimple), "a binge row watches simple meals"); T.Check(!Watch.Interaction && !Watch.Special, "a binge row turned an unrelated flag on"); Lawbook.Delete(binge); T.Check(!Watch.Any && !Watch.Break && !Watch.Ate, "deleting the binge row left a flag on"); T.Check(!Watch.IsWatched(ActCategories.Break, extreme), "deleting the binge row left the state watched"); Law fire = Fixtures.LawRow("Break/FireStartingSpree", null, LawStage.Planning, LawSeverity.Moderate, "Warn", 3); T.Check(Watch.SetFire && Watch.Special && !Watch.DisplayedCorpse, "a fire spree row must watch SetFire only among the special acts"); Lawbook.SetEnabled(fire, false); T.Check(!Watch.Any, "a disabled row still watches"); Lawbook.SetEnabled(fire, true); Fixtures.LawRow("Ate/@anyMeal", null, LawStage.DidIt, LawSeverity.Minor, "Warn", 1); T.Check(Watch.IsWatched(ActCategories.Ate, ThingDefOf.MealSimple) && Watch.IsWatched(ActCategories.Ate, ThingDefOf.MealFine), "any meal doesn't watch the meals"); T.Check(!Watch.IsWatched(ActCategories.Ate, ThingDefOf.RawPotatoes), "any meal watches raw potatoes"); Fixtures.LawRow("Ate/@humanMeat", null, LawStage.DidIt, LawSeverity.Minor, "Warn", 1); T.Check(Watch.ThingGroups(ActCategories.Ate) && Watch.MayMatch(ActCategories.Ate, ThingDefOf.RawPotatoes), "a group that reads the thing must let every act of the category through"); } } }