private static void LayEggTogether() { var males = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Male); var females = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Female); if (males.Count() != 1 || females.Count() != 1) { return; } var female = females.First(); var eggLayerComp = female.GetComp <RimWorld.CompEggLayer>(); if (eggLayerComp == null) { return; } eggLayerComp.Fertilize(males.First()); var egg = eggLayerComp.ProduceEgg(); if (egg == null) { return; } GenSpawn.Spawn(egg, female.Position, female.Map, WipeMode.Vanish); DebugActionsUtility.DustPuffFrom(female); }
public static void MechClusterBuildingSelection() { List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (float item in DebugActionsUtility.PointsOptions(extended: false)) { float localPoints = item; list.Add(new DebugMenuOption(item.ToString("F0"), DebugMenuOptionMode.Action, delegate { string text = ""; for (int i = 0; i < 50; i++) { int num = Rand.Range(10, 20); List <ThingDef> buildingDefsForCluster_NewTemp = GetBuildingDefsForCluster_NewTemp(localPoints, new IntVec2(num, num), canBeDormant: true, localPoints); text = text + "points: " + localPoints + " , size: " + num; foreach (ThingDef item2 in buildingDefsForCluster_NewTemp) { text = text + "\n- " + item2.defName; } text += "\n\n"; } Log.Message(text); })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); }
private static void GiveAbility() { List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (Abilities.AbilityDef def in DefDatabase <Abilities.AbilityDef> .AllDefs) { Abilities.AbilityDef abilityDef = def; list.Add(new DebugMenuOption($"{(abilityDef.requiredHediff != null ? $"{abilityDef.requiredHediff.hediffDef.LabelCap} ({abilityDef.requiredHediff.minimumLevel}): " : string.Empty)}{abilityDef.LabelCap}", DebugMenuOptionMode.Tool, () => { foreach (Pawn item in (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()) where t is Pawn select t).Cast <Pawn>()) { CompAbilities abilityComp = item.TryGetComp <CompAbilities>(); if (abilityComp != null) { abilityComp.GiveAbility(abilityDef); DebugActionsUtility.DustPuffFrom(item); } } })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); }
public void DoTable_RaidFactionSampled() { int ticksGame = Find.TickManager.TicksGame; Find.TickManager.DebugSetTicksGame(36000000); List <TableDataGetter <Faction> > list = new List <TableDataGetter <Faction> >(); list.Add(new TableDataGetter <Faction>("name", (Faction f) => f.Name)); foreach (float item in DebugActionsUtility.PointsOptions(extended: false)) { Dictionary <Faction, int> factionCount = new Dictionary <Faction, int>(); foreach (Faction allFaction in Find.FactionManager.AllFactions) { factionCount.Add(allFaction, 0); } for (int i = 0; i < 500; i++) { IncidentParms incidentParms = new IncidentParms(); incidentParms.target = Find.CurrentMap; incidentParms.points = item; if (TryResolveRaidFaction(incidentParms)) { factionCount[incidentParms.faction]++; } } list.Add(new TableDataGetter <Faction>(item.ToString("F0"), (Faction str) => ((float)factionCount[str] / 500f).ToStringPercent())); } Find.TickManager.DebugSetTicksGame(ticksGame); DebugTables.MakeTablesDialog(Find.FactionManager.AllFactions, list.ToArray()); }
public void DoTable_RaidStrategySampled(Faction fac) { int ticksGame = Find.TickManager.TicksGame; Find.TickManager.DebugSetTicksGame(36000000); List <TableDataGetter <RaidStrategyDef> > list = new List <TableDataGetter <RaidStrategyDef> >(); list.Add(new TableDataGetter <RaidStrategyDef>("defName", (RaidStrategyDef d) => d.defName)); foreach (float item in DebugActionsUtility.PointsOptions(extended: false)) { Dictionary <RaidStrategyDef, int> strats = new Dictionary <RaidStrategyDef, int>(); foreach (RaidStrategyDef allDef in DefDatabase <RaidStrategyDef> .AllDefs) { strats.Add(allDef, 0); } for (int i = 0; i < 500; i++) { IncidentParms incidentParms = new IncidentParms(); incidentParms.target = Find.CurrentMap; incidentParms.points = item; incidentParms.faction = fac; if (TryResolveRaidFaction(incidentParms)) { ResolveRaidStrategy(incidentParms, PawnGroupKindDefOf.Combat); if (incidentParms.raidStrategy != null) { strats[incidentParms.raidStrategy]++; } } } list.Add(new TableDataGetter <RaidStrategyDef>(item.ToString("F0"), (RaidStrategyDef str) => ((float)strats[str] / 500f).ToStringPercent())); } Find.TickManager.DebugSetTicksGame(ticksGame); DebugTables.MakeTablesDialog(DefDatabase <RaidStrategyDef> .AllDefs, list.ToArray()); }
static void RecruitFormerHuman(Pawn pawn) { if (pawn?.IsSapientFormerHuman() == true) { Worker_FormerHumanRecruitAttempt.DoRecruit(pawn.Map.mapPawns.FreeColonists.FirstOrDefault(), pawn, 1f); DebugActionsUtility.DustPuffFrom(pawn); } }
public static void ToggleScoreLogging(Pawn p) { var man = p.Manager(); man.debugOpts.ScoreLogging = !man.debugOpts.ScoreLogging; DebugActionsUtility.DustPuffFrom(p); MoteMaker.ThrowText(p.DrawPos, p.Map, p.LabelShort + "\n" + (man.debugOpts.ScoreLogging ? "ON" : "OFF")); }
static void RecruitFormerHuman(Pawn pawn) { var sapienceState = pawn?.GetSapienceState(); if (sapienceState?.IsFormerHuman == true) { Worker_FormerHumanRecruitAttempt.DoRecruit(pawn.Map.mapPawns.FreeColonists.FirstOrDefault(), pawn, 1f); DebugActionsUtility.DustPuffFrom(pawn); } }
private static void MinHitPoints() { foreach (Thing thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>()) { if (thing.def.useHitPoints) { thing.HitPoints = 1; DebugActionsUtility.DustPuffFrom(thing); } } }
private static void DecodeBiocoded() { foreach (Thing thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>()) { CompBiocodable compBiocodable = thing.TryGetComp <CompBiocodable>(); if (compBiocodable != null && compBiocodable.Biocoded) { compBiocodable.UnCode(); } DebugActionsUtility.DustPuffFrom(thing); } }
private static void UninstalBuilding() { foreach (Thing thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>()) { DebugActionsUtility.DustPuffFrom(thing); if (thing is Building building && building.def.Minifiable) { MinifiedThing minifiedThing = building.MakeMinified(); GenSpawn.Spawn(minifiedThing, UI.MouseCell(), Find.CurrentMap, WipeMode.Vanish); } } }
private static void TransGender(Pawn pawn) { if (pawn.gender == Gender.Male) { pawn.gender = Gender.Female; } else if (pawn.gender == Gender.Female) { pawn.gender = Gender.Male; } pawn.Drawer.renderer.graphics.ResolveAllGraphics(); DebugActionsUtility.DustPuffFrom(pawn); }
private static void GiveBirthTogether() { var males = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Male); var females = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Female); if (males.Count() != 1 || females.Count() != 1) { return; } Hediff_Pregnant.DoBirthSpawn(females.First(), males.First()); DebugActionsUtility.DustPuffFrom(females.First()); }
public static void ForceWool(Pawn p) { CompShearable compShearable = p.TryGetComp <CompShearable>(); if (p.Faction != null && compShearable != null) { while (compShearable.Fullness < 1) { compShearable.CompTick(); } DebugActionsUtility.DustPuffFrom(p); } }
public static void ForceMilk(Pawn p) { CompMilkable compMilkable = p.TryGetComp <CompMilkable>(); if (compMilkable != null) { while (compMilkable.Fullness < 1) { compMilkable.CompTick(); } DebugActionsUtility.DustPuffFrom(p); } }
private static void ExecuteRaidWithFaction() { StorytellerComp storytellerComp = Find.Storyteller.storytellerComps.First((StorytellerComp x) => x is StorytellerComp_OnOffCycle || x is StorytellerComp_RandomMain); IncidentParms parms = storytellerComp.GenerateParms(IncidentCategoryDefOf.ThreatBig, Find.CurrentMap); List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (Faction localFac2 in Find.FactionManager.AllFactions) { Faction localFac = localFac2; list.Add(new DebugMenuOption(localFac.Name + " (" + localFac.def.defName + ")", DebugMenuOptionMode.Action, delegate() { parms.faction = localFac; List <DebugMenuOption> list2 = new List <DebugMenuOption>(); foreach (float num in DebugActionsUtility.PointsOptions(true)) { float localPoints = num; list2.Add(new DebugMenuOption(num + " points", DebugMenuOptionMode.Action, delegate() { parms.points = localPoints; IEnumerable <RaidStrategyDef> allDefs = DefDatabase <RaidStrategyDef> .AllDefs; Func <RaidStrategyDef, bool> predicate = ((RaidStrategyDef s) => s.Worker.CanUseWith(parms, PawnGroupKindDefOf.Combat)); List <RaidStrategyDef> source = allDefs.Where(predicate).ToList(); Log.Message("Available strategies: " + string.Join(", ", (from s in source select s.defName).ToArray <string>())); parms.raidStrategy = VehicleRaidStrategyDefOf.ArmoredAttack; if (parms.raidStrategy != null) { Log.Message("Strategy: " + parms.raidStrategy.defName); IEnumerable <PawnsArrivalModeDef> allDefs2 = DefDatabase <PawnsArrivalModeDef> .AllDefs; parms.raidArrivalMode = PawnsArrivalModeDefOf.EdgeWalkIn; //source2.RandomElement<PawnsArrivalModeDef>(); Log.Message("Arrival mode: " + parms.raidArrivalMode.defName); } IncidentDef incidentDef; if (parms.faction.HostileTo(Faction.OfPlayer)) { incidentDef = IncidentDefOf.RaidEnemy; } else { incidentDef = IncidentDefOf.RaidFriendly; } incidentDef.Worker.TryExecute(parms); })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2)); })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); }
public static void LogManagedVerbs(Pawn p) { var man = p.Manager(); if (man == null) { return; } DebugActionsUtility.DustPuffFrom(p); Log.Message("All ManagedVerbs for " + p.LabelCap); foreach (var verb in man.ManagedVerbs) { Log.Message(" " + verb.Verb + ": " + (verb.Enabled ? "Enabled" : "Disabled")); } }
private static void RemoveAbility(Pawn pawn) { List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (Ability ability in pawn.abilities.abilities) { list.Add(new DebugMenuOption(ability.def.LabelCap, DebugMenuOptionMode.Action, delegate() { //pawn.abilities.abilities.Remove(ability); pawn.abilities.RemoveAbility(ability.def); DebugActionsUtility.DustPuffFrom(pawn); })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); }
private static void GiveBirthTogether() { var males = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Male); var females = Find.Selector.SelectedPawns.Where(candidate => candidate.gender == Gender.Female); if (males.Count() != 1 || females.Count() != 1) { return; } Hediff_Pregnant hediff_Pregnant = (Hediff_Pregnant)HediffMaker.MakeHediff(RimWorld.HediffDefOf.Pregnant, females.First(), null); hediff_Pregnant.father = males.First(); females.First().health.AddHediff(hediff_Pregnant, null, null, null); Hediff_Pregnant.DoBirthSpawn(females.First(), males.First()); DebugActionsUtility.DustPuffFrom(females.First()); }
public static void ResurrectPawnFromVoid(Map map, IntVec3 loc, Pawn pawn) { Corpse corpse = pawn.Corpse; if (corpse != null) { corpse.Destroy(DestroyMode.Vanish); } if (pawn.IsWorldPawn()) { Find.WorldPawns.RemovePawn(pawn); } pawn.ForceSetStateToUnspawned(); PawnComponentsUtility.CreateInitialComponents(pawn); pawn.health.Notify_Resurrected(); if (pawn.Faction != null && pawn.Faction.IsPlayer) { if (pawn.workSettings != null) { pawn.workSettings.EnableAndInitialize(); } Find.StoryWatcher.watcherPopAdaptation.Notify_PawnEvent(pawn, PopAdaptationEvent.GainedColonist); } GenSpawn.Spawn(pawn, loc, map, WipeMode.Vanish); for (int i = 0; i < 10; i++) { //MoteMaker.ThrowAirPuffUp(pawn.DrawPos, map); DebugActionsUtility.DustPuffFrom(pawn); } if (pawn.Faction != null && pawn.Faction != Faction.OfPlayer && pawn.HostileTo(Faction.OfPlayer)) { LordMaker.MakeNewLord(pawn.Faction, new LordJob_AssaultColony(pawn.Faction, true, true, false, false, true), pawn.Map, Gen.YieldSingle <Pawn>(pawn)); } if (pawn.apparel != null) { List <Apparel> wornApparel = pawn.apparel.WornApparel; for (int j = 0; j < wornApparel.Count; j++) { wornApparel[j].Notify_PawnResurrected(); } } PawnDiedOrDownedThoughtsUtility.RemoveDiedThoughts(pawn); }
private static void ConvertToSilver() { float money = 0f; foreach (Thing thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>()) { DebugActionsUtility.DustPuffFrom(thing); money += thing.GetStatValue(StatDefOf.MarketValue, true) * thing.stackCount; thing.Destroy(DestroyMode.Vanish); } int silverCount = Mathf.RoundToInt(money); if (silverCount > 0) { Thing silver = ThingMaker.MakeThing(ThingDefOf.Silver); silver.stackCount = silverCount; GenPlace.TryPlaceThing(silver, UI.MouseCell(), Find.CurrentMap, ThingPlaceMode.Near); } }
private static void FlashRuleCost(DebugCellCostRule rule, Pawn pawn, TraverseMode traverseMode, bool canBash) { Map map = pawn.Map; CellRef pawnPosition = map.GetCellRef(pawn.Position); TraverseParms traverseParms = TraverseParms.For(pawn, mode: traverseMode, canBash: canBash); LocalTargetInfo targetInfo = new LocalTargetInfo(pawnPosition); PathfindData pathfindData = new PathfindData(map, pawnPosition, targetInfo, traverseParms, PathEndMode.OnCell); CellCostRule costRule = rule.ruleFactory.Invoke(pathfindData); if (costRule.Applies()) { foreach (IntVec3 c in map.AllCells) { int cost = costRule.GetCost(map.GetCellRef(c)); map.debugDrawer.FlashCell(c, cost / 100f, cost.ToString()); } } DebugActionsUtility.DustPuffFrom(pawn); }
private static void FlashRulePassability(DebugCellPassRule rule, Pawn pawn, TraverseMode traverseMode, bool canBash) { Map map = pawn.Map; CellRef pawnPosition = map.GetCellRef(pawn.Position); TraverseParms traverseParms = TraverseParms.For(pawn, mode: traverseMode, canBash: canBash); LocalTargetInfo targetInfo = new LocalTargetInfo(pawnPosition); PathfindData pathfindData = new PathfindData(map, pawnPosition, targetInfo, traverseParms, PathEndMode.OnCell); CellPassabilityRule passRule = rule.ruleFactory.Invoke(pathfindData); if (passRule.Applies()) { foreach (IntVec3 c in map.AllCells) { float color = passRule.IsPassable(map.GetCellRef(c)) ? 0.5f : 0f; map.debugDrawer.FlashCell(c, color); } } DebugActionsUtility.DustPuffFrom(pawn); }
public void DoTable_RaidStrategySampled(Faction fac) { int ticksGame = Find.TickManager.TicksGame; Find.TickManager.DebugSetTicksGame(36000000); List <TableDataGetter <RaidStrategyDef> > list = new List <TableDataGetter <RaidStrategyDef> >(); list.Add(new TableDataGetter <RaidStrategyDef>("defName", (RaidStrategyDef d) => d.defName)); foreach (float points in DebugActionsUtility.PointsOptions(false)) { Dictionary <RaidStrategyDef, int> strats = new Dictionary <RaidStrategyDef, int>(); foreach (RaidStrategyDef current in DefDatabase <RaidStrategyDef> .AllDefs) { strats.Add(current, 0); } for (int i = 0; i < 500; i++) { IncidentParms incidentParms = new IncidentParms(); incidentParms.target = Find.CurrentMap; incidentParms.points = points; incidentParms.faction = fac; if (this.TryResolveRaidFaction(incidentParms)) { this.ResolveRaidStrategy(incidentParms, PawnGroupKindDefOf.Combat); if (incidentParms.raidStrategy != null) { Dictionary <RaidStrategyDef, int> strats2; RaidStrategyDef raidStrategy; (strats2 = strats)[raidStrategy = incidentParms.raidStrategy] = strats2[raidStrategy] + 1; } } } list.Add(new TableDataGetter <RaidStrategyDef>(points.ToString("F0"), delegate(RaidStrategyDef str) { int num = strats[str]; return(((float)num / 500f).ToStringPercent()); })); } Find.TickManager.DebugSetTicksGame(ticksGame); DebugTables.MakeTablesDialog <RaidStrategyDef>(DefDatabase <RaidStrategyDef> .AllDefs, list.ToArray()); }
private static void RemoveTrait(Pawn pawn) { List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (Trait trait in pawn.story.traits.allTraits) { list.Add(new DebugMenuOption(string.Concat(new object[] { trait.LabelCap, " (", trait.Degree, ")" }), DebugMenuOptionMode.Action, delegate() { PolarisUtility.GainSkillsExtra(pawn, trait.CurrentData.skillGains, false); pawn.story.traits.RemoveTrait(trait); DebugActionsUtility.DustPuffFrom(pawn); })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); }
public static void PawnGroupsMade() { Dialog_DebugOptionListLister.ShowSimpleDebugMenu(Find.FactionManager.AllFactions.Where((Faction fac) => !fac.def.pawnGroupMakers.NullOrEmpty()), (Faction fac) => fac.Name + " (" + fac.def.defName + ")", delegate(Faction fac) { StringBuilder sb = new StringBuilder(); sb.AppendLine("FACTION: " + fac.Name + " (" + fac.def.defName + ") min=" + fac.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat)); Action <float> action = delegate(float points) { if (!(points < fac.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat))) { PawnGroupMakerParms pawnGroupMakerParms = new PawnGroupMakerParms { groupKind = PawnGroupKindDefOf.Combat, tile = Find.CurrentMap.Tile, points = points, faction = fac }; sb.AppendLine("Group with " + pawnGroupMakerParms.points + " points (max option cost: " + MaxPawnCost(fac, points, RaidStrategyDefOf.ImmediateAttack, PawnGroupKindDefOf.Combat) + ")"); float num = 0f; foreach (Pawn item in from pa in GeneratePawns(pawnGroupMakerParms, warnOnZeroResults: false) orderby pa.kindDef.combatPower select pa) { string text = ((item.equipment.Primary == null) ? "no-equipment" : item.equipment.Primary.Label); Apparel apparel = item.apparel.FirstApparelOnBodyPartGroup(BodyPartGroupDefOf.Torso); string text2 = ((apparel == null) ? "shirtless" : apparel.LabelCap); sb.AppendLine(" " + item.kindDef.combatPower.ToString("F0").PadRight(6) + item.kindDef.defName + ", " + text + ", " + text2); num += item.kindDef.combatPower; } sb.AppendLine(" totalCost " + num); sb.AppendLine(); } }; foreach (float item2 in DebugActionsUtility.PointsOptions(extended: false)) { action(item2); } Log.Message(sb.ToString()); }); }
private static void AddSkillPoints() { List <DebugMenuOption> list = new List <DebugMenuOption>(); for (int i = 500; i <= 5000; i += 500) { list.Add(new DebugMenuOption(i.ToString(), DebugMenuOptionMode.Tool, delegate() { Pawn pawn = (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()) where t is Pawn select t).Cast <Pawn>().FirstOrDefault <Pawn>(); if (pawn == null) { return; } // something Log.Message("Poof, extra xp"); DebugActionsUtility.DustPuffFrom(pawn); })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); }
private static void RemoveWeaponTrait() { foreach (Thing thing in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).ToList <Thing>()) { if (thing.IsBladelinkWeapon(out CompBladelinkWeapon compBladelink)) { List <WeaponTraitDef> curTraits = compBladelink.TraitsListForReading; List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (WeaponTraitDef curTrait in curTraits) { list.Add(new DebugMenuOption(curTrait.label, DebugMenuOptionMode.Action, delegate() { //curTraits.Remove(curTrait); //typeof(CompBladelinkWeapon).GetField("traits", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(compBladelink, curTraits); compBladelink.RemoveWeaponTrait(curTrait); })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); } DebugActionsUtility.DustPuffFrom(thing); } }
public void DoTable_RaidArrivalModeSampled(Faction fac) { int ticksGame = Find.TickManager.TicksGame; Find.TickManager.DebugSetTicksGame(36000000); List <TableDataGetter <PawnsArrivalModeDef> > list = new List <TableDataGetter <PawnsArrivalModeDef> >(); list.Add(new TableDataGetter <PawnsArrivalModeDef>("mode", (PawnsArrivalModeDef f) => f.defName)); foreach (float points in DebugActionsUtility.PointsOptions(false)) { Dictionary <PawnsArrivalModeDef, int> modeCount = new Dictionary <PawnsArrivalModeDef, int>(); foreach (PawnsArrivalModeDef current in DefDatabase <PawnsArrivalModeDef> .AllDefs) { modeCount.Add(current, 0); } for (int i = 0; i < 500; i++) { IncidentParms incidentParms = new IncidentParms(); incidentParms.target = Find.CurrentMap; incidentParms.points = points; incidentParms.faction = fac; if (this.TryResolveRaidFaction(incidentParms)) { this.ResolveRaidStrategy(incidentParms, PawnGroupKindDefOf.Combat); this.ResolveRaidArriveMode(incidentParms); Dictionary <PawnsArrivalModeDef, int> modeCount2; PawnsArrivalModeDef raidArrivalMode; (modeCount2 = modeCount)[raidArrivalMode = incidentParms.raidArrivalMode] = modeCount2[raidArrivalMode] + 1; } } list.Add(new TableDataGetter <PawnsArrivalModeDef>(points.ToString("F0"), delegate(PawnsArrivalModeDef str) { int num = modeCount[str]; return(((float)num / 500f).ToStringPercent()); })); } Find.TickManager.DebugSetTicksGame(ticksGame); DebugTables.MakeTablesDialog <PawnsArrivalModeDef>(DefDatabase <PawnsArrivalModeDef> .AllDefs, list.ToArray()); }
private static void ChangeBodyType() { List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (BodyTypeDef bodyType in DefDatabase <BodyTypeDef> .AllDefs) { list.Add(new DebugMenuOption(bodyType.defName, DebugMenuOptionMode.Tool, delegate() { foreach (Pawn pawn in (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()) where t is Pawn select t).Cast <Pawn>()) { pawn.story.bodyType = bodyType; PortraitsCache.SetDirty(pawn); PortraitsCache.PortraitsCacheUpdate(); pawn.Drawer.renderer.graphics.SetAllGraphicsDirty(); pawn.Drawer.renderer.graphics.ResolveAllGraphics(); DebugActionsUtility.DustPuffFrom(pawn); } })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); }