public void Dress(Pawn pawn) { #if DRESSER_OUTFIT Log.Warning("Begin DefinedOutfit.Dress(Pawn: " + pawn.Name.ToStringShort + ")"); #endif List <Apparel> removed = ApparelUtil.RemoveApparel(pawn); ApparelUtil.StoreApparelInWorldDresser(removed, pawn); pawn.outfits.CurrentOutfit = this.Outfit; #if DRESSER_OUTFIT Log.Message(" Pawn's outfit is now: " + pawn.outfits.CurrentOutfit.label); #endif /* * bool done = false; * for(int i = 0; i < 10 && !done; ++i) * { * Apparel a; * Building_Dresser d; * if (!(done = WorldComp.TryFindBestApparel(pawn, out a, out d))) * { * if (d != null) * d.RemoveNoDrop(a); * pawn.apparel.Wear(a); * if (customApparel.Contains(a)) * pawn.outfits.forcedHandler.ForcedApparel.Add(a); * } * } */ ApparelUtil.OptimizeApparel(pawn); this.isBeingWorn = true; #if DRESSER_OUTFIT Log.Warning("End DefinedOutfit.Dress"); #endif }
public void Dress(Pawn pawn) { #if DRESSER_OUTFIT Log.Warning("Begin CustomOutfit.Dress(Pawn: " + pawn.Name.ToStringShort + ")"); #endif List <Apparel> removed = ApparelUtil.RemoveApparel(pawn); #if DRESSER_OUTFIT Log.Message(" Add Custom Apparel:"); #endif // Dress the pawn with this outfit's apparel foreach (Apparel a in this.Apparel) { #if DRESSER_OUTFIT Log.Message(" " + a.Label); #endif removed.Remove(a); pawn.apparel.Wear(a); // Force all apparel pawn.outfits.forcedHandler.ForcedApparel.Add(a); //tracker.RemoveCustomApparel(a); } if (this.Outfit != null) { pawn.outfits.CurrentOutfit = this.Outfit; ApparelUtil.OptimizeApparel(pawn); } /*/ Add any previously worn apparel that still can be worn * for (int i = 0; i < removed.Count; ++i) * { * Apparel a = wasWearing[i]; * if (pawn.apparel.CanWearWithoutDroppingAnything(a.def)) * { * pawn.apparel.Wear(a); * removed[i] = null; * } * }*/ ApparelUtil.StoreApparelInWorldDresser(removed, pawn); this.isBeingWorn = true; #if DRESSER_OUTFIT Log.Warning("End CustomOutfit.Dress"); #endif }
public bool FindBetterApparel(ref float baseApparelScore, ref Apparel betterApparel, Pawn pawn, Outfit currentOutfit, Building dresser) { #if BETTER_OUTFIT Log.Warning("Begin StoredApparel.FindBetterApparel"); #endif bool result = false; #if TRACE && BETTER_OUTFIT Log.Message(" Stored Apparel:"); #endif foreach (LinkedList <Apparel> ll in this.StoredApparelLookup.Values) { #if TRACE && BETTER_OUTFIT if (ll != null) { if (ll.Count > 0 && ll.First != null) { Log.Message(" Count: " + ll.Count + " Of Type: " + ll.First.Value.def.defName); } else { Log.Message(" Count: 0"); } } else { Log.Message(" <null> list"); } #endif if (ApparelUtil.FindBetterApparel(ref baseApparelScore, ref betterApparel, pawn, currentOutfit, ll, dresser)) { result = true; } } #if BETTER_OUTFIT Log.Warning("End StoredApparel.FindBetterApparel Found Better:" + result); #endif return(result); /* * Apparel betterApparel = null; * foreach (LinkedList<Apparel> ll in this.StoredApparelLookup.Values) * { * foreach (Apparel apparel in ll) * { * if (currentOutfit.filter.Allows(apparel)) * { * if (Settings.KeepForcedApparel) * { * List<Apparel> wornApparel = pawn.apparel.WornApparel; * for (int i = 0; i < wornApparel.Count; i++) * { * if (!ApparelUtility.CanWearTogether(wornApparel[i].def, apparel.def, pawn.RaceProps.body) && * !pawn.outfits.forcedHandler.AllowedToAutomaticallyDrop(wornApparel[i])) * { * continue; * } * } * } * * if (!apparel.IsForbidden(pawn)) * { * float gain = JobGiver_OptimizeApparel.ApparelScoreGain(pawn, apparel); * if (gain >= 0.05f && gain > baseApparelScore) * { * if (ApparelUtility.HasPartsToWear(pawn, apparel.def)) * { * if (ReservationUtility.CanReserveAndReach(pawn, dresser, PathEndMode.OnCell, pawn.NormalMaxDanger(), 1)) * { * betterApparel = apparel; * baseApparelScore = gain; * } * } * } * } * } * } * } * return betterApparel;*/ }