Ejemplo n.º 1
0
        public static bool IgnoreWristblade(Pawn __instance)
        {
            bool result = true;

            if (__instance.RaceProps.Humanlike)
            {
                result = !(__instance.apparel.WornApparel.Any(x => x.def.defName.Contains("RRY_Equipment_HunterGauntlet")) && !__instance.Dead);
            }
            //    Log.Message(string.Format("Pawn_StripPatch IgnoreWristblade: {0}", result));
            if (!result)
            {
                Caravan caravan = __instance.GetCaravan();
                if (caravan != null)
                {
                    CaravanInventoryUtility.MoveAllInventoryToSomeoneElse(__instance, caravan.PawnsListForReading, null);
                    if (__instance.apparel != null)
                    {
                        CaravanInventoryUtility.MoveAllApparelToSomeonesInventory(__instance, caravan.PawnsListForReading);
                    }
                    if (__instance.equipment != null)
                    {
                        CaravanInventoryUtility.MoveAllEquipmentToSomeonesInventory(__instance, caravan.PawnsListForReading);
                    }
                }
                else
                {
                    IntVec3 pos = (__instance.Corpse == null) ? __instance.PositionHeld : __instance.Corpse.PositionHeld;
                    if (__instance.equipment != null)
                    {
                        __instance.equipment.DropAllEquipment(pos, false);
                    }
                    if (__instance.apparel != null)
                    {
                        DropAll(__instance, pos, false);
                    }
                    if (__instance.inventory != null)
                    {
                        __instance.inventory.DropAllNearPawn(pos, false, false);
                    }
                }
            }
            return(result);
        }