/// <summary> /// Initializes a new instance of the <see cref="AwesomeInventoryLoadout"/> class. /// </summary> /// <param name="pawn"> Initialize <see cref="AwesomeInventoryLoadout"/> with items on this <paramref name="pawn"/>. </param> public AwesomeInventoryLoadout(Pawn pawn) { ValidateArg.NotNull(pawn, nameof(pawn)); this.AddItems(pawn.equipment?.AllEquipmentListForReading); this.AddItems(pawn.apparel?.WornApparel); this.AddItems(pawn.inventory?.innerContainer); if (pawn.outfits?.CurrentOutfit?.filter is ThingFilter filter) { this.filter.CopyAllowancesFrom(filter); } else { this.filter.SetAllow(ThingCategoryDefOf.Apparel, true); } this.uniqueId = Current.Game.outfitDatabase.AllOutfits.Max(o => o.uniqueId) + 1; CompAwesomeInventoryLoadout compLoadout = pawn.TryGetComp <CompAwesomeInventoryLoadout>(); this.label = compLoadout?.Loadout == null ? AwesomeInventoryLoadout.GetDefaultLoadoutName(pawn) : LoadoutManager.GetIncrementalLabel(compLoadout.Loadout.label); pawn.SetLoadout(this); }
/// <summary> /// Initializes a new instance of the <see cref="AwesomeInventoryLoadout"/> class. /// </summary> /// <param name="pawn"> Initialize <see cref="AwesomeInventoryLoadout"/> with items on this <paramref name="pawn"/>. </param> public AwesomeInventoryLoadout(Pawn pawn) { ValidateArg.NotNull(pawn, nameof(pawn)); this.AddItems(pawn.equipment?.AllEquipmentListForReading); this.AddItems(pawn.apparel?.WornApparel); this.AddItems(pawn.inventory?.innerContainer); this.uniqueId = Current.Game.outfitDatabase.AllOutfits.Max(o => o.uniqueId) + 1; CompAwesomeInventoryLoadout compLoadout = pawn.TryGetComp <CompAwesomeInventoryLoadout>(); this.label = compLoadout?.Loadout == null ? AwesomeInventoryLoadout.GetDefaultLoadoutName(pawn) : LoadoutManager.GetIncrementalLabel(compLoadout.Loadout.label); pawn.SetLoadout(this); }