Exemple #1
0
            static bool doStripCorpse(RecipeDef def, Thing thing)
            {
                if (!def.autoStripCorpses)
                {
                    IStrippable strippable = thing as IStrippable;
                    Corpse      corpse     = thing as Corpse;
                    Pawn        pawn;
                    if (corpse == null)
                    {
                        pawn = thing as Pawn;
                    }
                    else
                    {
                        pawn = corpse.InnerPawn;
                    }

                    int val = 0;
                    if (pawn != null)
                    {
                        if (Settings.strip_inventory)
                        {
                            val += 1;
                        }
                        if (Settings.strip_equipment)
                        {
                            val += 2;
                        }
                        if (Settings.strip_apparel)
                        {
                            val += 4;
                        }
                        if (!CompStripChecker.MarkAll(pawn, true, val))
                        {
                            val = 0;
                        }
                    }

                    return(strippable != null && thing.MapHeld != null && (val != 0 || thing.MapHeld.designationManager.DesignationOn(thing, DesignationDefOf.Strip) != null));
                }
                else
                {
                    return(true);
                }
            }
 static bool Prefix(Designation __instance)
 {
     //return true;
     // designation gets removed before stripping is happened, so it doesn't work as intended
     if (__instance.def == DesignationDefOf.Strip && __instance.target.HasThing)
     {
         Corpse c = __instance.target.Thing as Corpse;
         if (c != null)
         {
             if (c.InnerPawn != null)
             {
                 CompStripChecker.MarkAll(c.InnerPawn, false);
             }
         }
         else
         {
             CompStripChecker.MarkAll((Pawn)__instance.target.Thing, false);
         }
         return(false);
     }
     return(true);
 }