Beispiel #1
0
 /// <summary>
 /// Create new Widget for VehicleCaravan with <paramref name="transferables"/>
 /// </summary>
 /// <param name="transferables"></param>
 /// <param name="pawnsTransfer"></param>
 /// <param name="vehiclesTransfer"></param>
 /// <param name="itemsTransfer"></param>
 /// <param name="thingCountTip"></param>
 /// <param name="ignorePawnInventoryMass"></param>
 /// <param name="availableMassGetter"></param>
 /// <param name="ignoreSpawnedCorpsesGearAndInventoryMass"></param>
 /// <param name="tile"></param>
 /// <param name="playerPawnsReadOnly"></param>
 public static void CreateVehicleCaravanTransferableWidgets(List <TransferableOneWay> transferables, out TransferableOneWayWidget pawnsTransfer, out TransferableVehicleWidget vehiclesTransfer, out TransferableOneWayWidget itemsTransfer, string thingCountTip, IgnorePawnsInventoryMode ignorePawnInventoryMass, Func <float> availableMassGetter, bool ignoreSpawnedCorpsesGearAndInventoryMass, int tile, bool playerPawnsReadOnly = false)
 {
     pawnsTransfer    = new TransferableOneWayWidget(null, null, null, thingCountTip, true, ignorePawnInventoryMass, false, availableMassGetter, 0f, ignoreSpawnedCorpsesGearAndInventoryMass, tile, true, true, true, false, true, false, playerPawnsReadOnly);
     vehiclesTransfer = new TransferableVehicleWidget(null, null, null, thingCountTip, true, ignorePawnInventoryMass, false, availableMassGetter, 0f, ignoreSpawnedCorpsesGearAndInventoryMass, tile, true, false, false, playerPawnsReadOnly);
     AddVehicleAndPawnSections(pawnsTransfer, vehiclesTransfer, transferables);
     itemsTransfer = new TransferableOneWayWidget(from x in transferables
                                                  where x.ThingDef.category != ThingCategory.Pawn
                                                  select x, null, null, thingCountTip, true, ignorePawnInventoryMass, false, availableMassGetter, 0f, ignoreSpawnedCorpsesGearAndInventoryMass, tile, true, false, false, true, false, true, false);
 }
Beispiel #2
0
        /// <summary>
        /// Create sections in VehicleCaravan dialog for proper listing
        /// </summary>
        /// <param name="pawnWidget"></param>
        /// <param name="vehicleWidget"></param>
        /// <param name="transferables"></param>
        public static void AddVehicleAndPawnSections(TransferableOneWayWidget pawnWidget, TransferableVehicleWidget vehicleWidget, List <TransferableOneWay> transferables)
        {
            IEnumerable <TransferableOneWay> source = from x in transferables
                                                      where x.ThingDef.category == ThingCategory.Pawn
                                                      select x;

            vehicleWidget.AddSection("VehiclesTab".Translate(), from x in source
                                     where x.AnyThing is VehiclePawn vehicle && vehicle.CanMove
                                     select x);
            pawnWidget.AddSection("ColonistsSection".Translate(), from x in source
                                  where ((Pawn)x.AnyThing).IsFreeColonist
                                  select x);
            pawnWidget.AddSection("PrisonersSection".Translate(), from x in source
                                  where ((Pawn)x.AnyThing).IsPrisoner
                                  select x);
            pawnWidget.AddSection("CaptureSection".Translate(), from x in source
                                  where ((Pawn)x.AnyThing).Downed && CaravanUtility.ShouldAutoCapture((Pawn)x.AnyThing, Faction.OfPlayer)
                                  select x);
            pawnWidget.AddSection("AnimalsSection".Translate(), from x in source
                                  where ((Pawn)x.AnyThing).RaceProps.Animal
                                  select x);
            vehicleWidget.AvailablePawns = source.Where(x => x.AnyThing is Pawn pawn && !(pawn is VehiclePawn) && pawn.IsColonistPlayerControlled).ToList();
        }