private static void SwapBodyType() { List <DebugMenuOption> list = new List <DebugMenuOption>(); List <Thing> l = new List <Thing>(); l = Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).Where(x => x is Pawn).ToList <Thing>(); if (!l.NullOrEmpty()) { foreach (Pawn t in from kd in l orderby kd.def.defName select kd) { list.Add(new DebugMenuOption(t.def.LabelCap, DebugMenuOptionMode.Action, delegate() { List <DebugMenuOption> list2 = new List <DebugMenuOption>(); foreach (BodyTypeDef localDef3 in from def in DefDatabase <BodyTypeDef> .AllDefs where def != t.story.bodyType select def) { BodyTypeDef localDef = localDef3; list2.Add(new DebugMenuOption(localDef.defName, DebugMenuOptionMode.Action, delegate() { HarmonyPatches.ChangeBodyType(t, localDef); })); Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2)); } })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); } }
public void Remove(Pawn pawn) { if (pawn == null) { return; } if (pawn.story == null) { return; } HarmonyPatches.ChangeBodyType(pawn, bodyTypeDef); }
public bool Add(Pawn pawn) { // log.message(string.Format("On")); // Sanity test; if our pawn doesn't exist, don't even bother. if (pawn == null) { return(false); } if (pawn.story == null) { return(false); } bodyTypeDef = pawn.story.bodyType; HarmonyPatches.ChangeBodyType(pawn, RimWorld.BodyTypeDefOf.Hulk); return(true); }