public static void StoreApparelInWorldDresser(List <Apparel> apparel, Pawn pawn) { #if DRESSER_OUTFIT Log.Warning("Begin ApparelUtil.StoreApparelInWorldDresser(Pawn: " + pawn.Name.ToStringShort + ")"); Log.Message(" Store Apparel in World Dressers:"); #endif foreach (Apparel a in apparel) { #if DRESSER_OUTFIT Log.Message(" " + a.Label); #endif if (!WorldComp.AddApparel(a)) { #if DRESSER_OUTFIT Log.Warning(" Unable to place apparel in dresser, dropping to floor"); #endif BuildingUtil.DropThing(a, pawn.Position, pawn.Map, false); } } #if DRESSER_OUTFIT Log.Warning("End ApparelUtil.StoreApparelInWorldDresser"); #endif }
private bool DropThing(Thing t, bool makeForbidden = true) { WorldComp.ApparelColorTracker.RemoveApparel(t as Apparel); return(BuildingUtil.DropThing(t, this, this.CurrentMap, makeForbidden)); }
public void Undress(Pawn pawn, List <Apparel> customApparel) { #if DRESSER_OUTFIT Log.Warning("Begin CustomOutfit.Undress(Pawn: " + pawn.Name.ToStringShort + ")"); #endif List <Apparel> wornApparel = new List <Apparel>(pawn.apparel.WornApparel); pawn.outfits.forcedHandler.ForcedApparel.Clear(); #if DRESSER_OUTFIT Log.Warning(" Remove Apparel:"); #endif foreach (Apparel a in wornApparel) { #if DRESSER_OUTFIT Log.Warning(" " + a.Label); #endif pawn.apparel.Remove(a); if (!customApparel.Contains(a)) { #if DRESSER_OUTFIT Log.Warning(" -- Not a custom piece of apparel. Storing in Dresser."); #endif if (!WorldComp.AddApparel(a)) { BuildingUtil.DropThing(a, pawn.Position, pawn.Map, false); } } } this.isBeingWorn = false; /*#if DRESSER_OUTFIT * Log.Warning("Begin CustomOutfit.Undress(Pawn: " + pawn.Name.ToStringShort + ")"); #endif #if DRESSER_OUTFIT * Log.Warning(" Find any changes in Custom Outfit:"); #endif * LinkedList<Apparel> noLongerWearing = new LinkedList<Apparel>(this.Apparel); * foreach (Apparel a in pawn.apparel.WornApparel) * { * if (!noLongerWearing.Remove(a)) * { #if DRESSER_OUTFIT * Log.Warning(" No longer wearing: " + a.Label); #endif * } #if DRESSER_OUTFIT * else * Log.Message(" Is still wearing: " + a.Label); #endif * } * #if DRESSER_OUTFIT * if (noLongerWearing.Count > 0) * Log.Message(" Remove Apparel from Custom Outfit:"); #endif * #if DRESSER_OUTFIT * System.Text.StringBuilder sb = new System.Text.StringBuilder(" Tracker-CustomApparel: "); * foreach(Apparel a in customApparel) * { * sb.Append("[" + a.Label + "] "); * } #endif * * // Remove any apparel that's no longer being worn * foreach (Apparel a in noLongerWearing) * { #if DRESSER_OUTFIT * Log.Message(" " + a.Label); #endif * this.Apparel.Remove(a); * if (!customApparel.Contains(a)) * { #if DRESSER_OUTFIT * Log.Message(" " + a.Label + " NOT custom apparel, going back to dresser"); #endif * WorldComp.AddApparel(a); * } * } * pawn.outfits.forcedHandler.ForcedApparel.Clear();*/ /*foreach (Apparel a in this.Apparel) * { * tracker.AddCustomApparel(a); * }*/ #if DRESSER_OUTFIT Log.Warning("End CustomOutfit.Undress"); #endif }
private bool DropThing(Thing t, bool makeForbidden = true) { return(BuildingUtil.DropThing(t, this, this.CurrentMap, makeForbidden)); }