public void AddOutfit(IDresserOutfit outfit) { #if DRESSER_OUTFIT Log.Warning("Begin PawnOutfitTracker.AddOutfit(IDresserOutfit: " + outfit.Label + ")"); #endif this.ApplyUniqueId(outfit); if (outfit is DefinedOutfit) { bool found = false; foreach (DefinedOutfit o in this.DefinedOutfits) { if (o.UniqueId.Equals(outfit.UniqueId)) { found = true; break; } } if (!found) { this.DefinedOutfits.Add(outfit as DefinedOutfit); #if DRESSER_OUTFIT Log.Message(" Adding to DefinedOutfits -- New Count " + DefinedOutfits.Count); #endif } #if DRESSER_OUTFIT else { Log.Message(" Outfit is already being tracked"); } #endif } else { bool found = false; foreach (CustomOutfit o in this.CustomOutfits) { if (o.UniqueId.Equals(outfit.UniqueId)) { found = true; break; } } if (!found) { this.CustomOutfits.Add(outfit as CustomOutfit); #if DRESSER_OUTFIT Log.Message(" Adding to CustomOutfits -- New Count " + DefinedOutfits.Count); #endif } #if DRESSER_OUTFIT else { Log.Message(" Outfit is already being tracked"); } #endif } #if DRESSER_OUTFIT Log.Warning("End PawnOutfitTracker.AddOutfit"); #endif }
public bool ChangeToCivilianOutfit() { #if DRESSER_OUTFIT Log.Warning("Begin PawnOutfitTracker.ChangeToCivilianOutfit"); #endif if (this.lastCivilianOutfit != null) { #if DRESSER_OUTFIT Log.Message(" Last Civilian Outfit: " + lastCivilianOutfit); #endif IDresserOutfit o = this.GetOutfit(this.lastCivilianOutfit); if (o != null && o.OutfitType == OutfitType.Civilian) { this.ChangeTo(o); #if DRESSER_OUTFIT Log.Warning("End PawnOutfitTracker.ChangeToCivilianOutfit -> True"); #endif return(true); } } #if DRESSER_OUTFIT Log.Warning("End PawnOutfitTracker.ChangeToCivilianOutfit -> ChangeToOutfitType(OutfitType.Civilian)"); #endif return(ChangeToOutfitType(OutfitType.Civilian)); }
public void ChangeTo(IDresserOutfit outfit) { if (string.IsNullOrEmpty(outfit.UniqueId)) { this.ApplyUniqueId(outfit); } #if DRESSER_OUTFIT Log.Warning("Begin PawnOutfitTracker.ChangeTo(IDresserOutfit: " + outfit.Label + ")"); #endif if (currentlyWorn != null) { #if DRESSER_OUTFIT Log.Message(" Currently Worn: " + currentlyWorn); #endif IDresserOutfit o = this.GetOutfit(this.currentlyWorn); if (o != null) { #if DRESSER_OUTFIT Log.Message(" Currently Worn Found: " + o.Label + ". Undress"); #endif o.Undress(this.Pawn, this.customApparel); } #if DRESSER_OUTFIT else { Log.Warning(" Currently Worn NOT Found"); } #endif } #if DRESSER_OUTFIT Log.Message(" Dress into: " + outfit.Label); #endif outfit.Dress(this.Pawn); if (outfit.OutfitType == OutfitType.Battle) { #if DRESSER_OUTFIT Log.Message(" Set Last Battle Outfit to: " + outfit.Label + " " + outfit.UniqueId); #endif this.lastBattleOutfit = outfit.UniqueId; } else // OutfitType.Civilian { #if DRESSER_OUTFIT Log.Message(" Set Last Civilian Outfit to: " + outfit.Label + " " + outfit.UniqueId); #endif this.lastCivilianOutfit = outfit.UniqueId; } this.currentlyWorn = outfit.UniqueId; #if DRESSER_OUTFIT Log.Message(" Currently Worn is now: " + currentlyWorn); #endif #if DRESSER_OUTFIT Log.Warning("End PawnOutfitTracker.ChangeTo(uniqueId: " + outfit.UniqueId + ")"); #endif }
private void ApplyUniqueId(IDresserOutfit outfit) { #if DRESSER_OUTFIT Log.Warning("Begin PawnOutfitTracker.ApplyUniqueId(IDresserOutfit: " + outfit.Label + " " + outfit.UniqueId + ")"); #endif if (string.IsNullOrEmpty(outfit.UniqueId)) { outfit.UniqueId = ((outfit is DefinedOutfit) ? "d" : "c") + WorldComp.NextDresserOutfitId; } #if DRESSER_OUTFIT Log.Warning("End PawnOutfitTracker.ApplyUniqueId -> " + outfit.UniqueId); #endif }
private void HandleOutfitAssign(bool assign, Outfit outfit, PawnOutfitTracker po) { Pawn pawn = po.Pawn; if (assign) { po.DefinedOutfits.Add(new DefinedOutfit(outfit, WorldComp.GetOutfitType(outfit))); } else { po.Remove(outfit); if (pawn.outfits.CurrentOutfit.Equals(outfit)) { bool newOutfitFound; if (pawn.Drafted) { newOutfitFound = !po.ChangeToBattleOutfit(); } else { newOutfitFound = !po.ChangeToCivilianOutfit(); } if (!newOutfitFound) { Messages.Message( pawn.Name.ToStringShort + " will no longer wear " + outfit.label + ". Could not find another Outfit for them to wear. Please fix this manually.", MessageTypeDefOf.CautionInput); } else { IDresserOutfit o = po.CurrentOutfit; if (o != null) { Messages.Message( pawn.Name.ToStringShort + " will no longer wear " + outfit.label + " and will instead be assigned to wear " + o.Label, MessageTypeDefOf.CautionInput); } else { Messages.Message( pawn.Name.ToStringShort + " will no longer wear " + outfit.label + " but could not be assigned anything else to wear.", MessageTypeDefOf.CautionInput); } } } } }
public bool Remove(IDresserOutfit outfit) { #if DRESSER_OUTFIT Log.Warning("Begin PawnOutfitTracker.Remove(IDresserOutfit: " + outfit.Label + " " + outfit.UniqueId + ")"); #endif if (outfit is DefinedOutfit) { foreach (DefinedOutfit o in this.DefinedOutfits) { if (o.UniqueId.Equals(outfit.UniqueId)) { this.DefinedOutfits.Remove(o); #if DRESSER_OUTFIT Log.Warning("End PawnOutfitTracker.Remove -- True (DefinedOutfit removed)"); #endif return(true); } } } else { foreach (CustomOutfit o in this.CustomOutfits) { if (o.UniqueId.Equals(outfit.UniqueId)) { this.CustomOutfits.Remove(o); #if DRESSER_OUTFIT Log.Warning("End PawnOutfitTracker.Remove -- True (CustomOutfits removed)"); #endif return(true); } } } #if DRESSER_OUTFIT Log.Warning("End PawnOutfitTracker.Remove -- False"); #endif return(false); }