public static bool TransferAsOne(Thing a, Thing b, TransferAsOneMode mode) { if (a == b) { return(true); } if (a.def != b.def) { return(false); } a = a.GetInnerIfMinified(); b = b.GetInnerIfMinified(); if (a.def.tradeNeverStack || b.def.tradeNeverStack) { return(false); } if (!TransferableUtility.CanStack(a) || !TransferableUtility.CanStack(b)) { return(false); } if (a.def != b.def || a.Stuff != b.Stuff) { return(false); } if (mode == TransferAsOneMode.PodsOrCaravanPacking) { float num = -1f; CompRottable compRottable = a.TryGetComp <CompRottable>(); if (compRottable != null) { num = compRottable.RotProgressPct; } float num2 = -1f; CompRottable compRottable2 = b.TryGetComp <CompRottable>(); if (compRottable2 != null) { num2 = compRottable2.RotProgressPct; } if (Mathf.Abs(num - num2) > 0.1f) { return(false); } } if (a is Corpse && b is Corpse) { Pawn innerPawn = ((Corpse)a).InnerPawn; Pawn innerPawn2 = ((Corpse)b).InnerPawn; return(innerPawn.def == innerPawn2.def && innerPawn.kindDef == innerPawn2.kindDef && !innerPawn.RaceProps.Humanlike && !innerPawn2.RaceProps.Humanlike && (innerPawn.Name == null || innerPawn.Name.Numerical) && (innerPawn2.Name == null || innerPawn2.Name.Numerical)); } if (a.def.category == ThingCategory.Pawn) { if (b.def != a.def) { return(false); } Pawn pawn = (Pawn)a; Pawn pawn2 = (Pawn)b; return(pawn.kindDef == pawn2.kindDef && pawn.gender == pawn2.gender && pawn.ageTracker.CurLifeStageIndex == pawn2.ageTracker.CurLifeStageIndex && Mathf.Abs(pawn.ageTracker.AgeBiologicalYearsFloat - pawn2.ageTracker.AgeBiologicalYearsFloat) <= 1f); } else { Apparel apparel = a as Apparel; Apparel apparel2 = b as Apparel; if (apparel != null && apparel2 != null && apparel.WornByCorpse != apparel2.WornByCorpse) { return(false); } if (mode != TransferAsOneMode.InactiveTradeable && a.def.useHitPoints && Mathf.Abs(a.HitPoints - b.HitPoints) >= 10) { return(false); } QualityCategory qualityCategory; QualityCategory qualityCategory2; if (a.TryGetQuality(out qualityCategory) && b.TryGetQuality(out qualityCategory2) && qualityCategory != qualityCategory2) { return(false); } if (a.def.category == ThingCategory.Item) { return(a.CanStackWith(b)); } if (a.def.category == ThingCategory.Building) { return(true); } Log.Error(string.Concat(new object[] { "Unknown TransferAsOne pair: ", a, ", ", b }), false); return(false); } }