Пример #1
0
        private bool DockBoatTransferPawns()
        {
            DockedBoat dockedBoat = (DockedBoat)WorldObjectMaker.MakeWorldObject(WorldObjectDefOfShips.DockedBoat);

            dockedBoat.Tile = caravan.Tile;
            float randomInRange = Rand.Range(2f, 4f) + (50 * (1 - caravan.PawnsListForReading.Where(x => HelperMethods.IsShip(x)).Max(x => x.GetComp <CompShips>().Props.visibility)));

            dockedBoat.GetComponent <TimeoutComp>().StartTimeout(Mathf.CeilToInt(randomInRange * 60000));
            List <Pawn> boats = caravan.PawnsListForReading.Where(x => HelperMethods.IsShip(x)).ToList();
            List <Pawn> pawns = caravan.PawnsListForReading.Where(x => !HelperMethods.IsShip(x)).ToList();

            if (caravan.PawnsListForReading.Where(x => !HelperMethods.IsShip(x)).Count() <= 0)
            {
                return(false);
            }

            foreach (TransferableOneWay t in this.transferables)
            {
                TransferableUtility.TransferNoSplit(t.things, t.CountToTransfer, delegate(Thing thing, int numToTake)
                {
                    Pawn ownerOf = CaravanInventoryUtility.GetOwnerOf(this.caravan, thing);
                    if (ownerOf is null)
                    {
                        return;
                    }
                    CaravanInventoryUtility.MoveInventoryToSomeoneElse(ownerOf, thing, pawns, boats, numToTake);
                }, true, true);
            }

            for (int i = caravan.pawns.Count - 1; i >= 0; i--)
            {
                Pawn p = caravan.PawnsListForReading[i];
                if (HelperMethods.IsShip(p))
                {
                    dockedBoat.dockedBoats.TryAddOrTransfer(p, false);
                }
            }
            Find.WorldObjects.Add(dockedBoat);
            return(true);
        }
Пример #2
0
 public static FloatMenuAcceptanceReport CanVisit(Caravan caravan, DockedBoat dockedBoat)
 {
     return(dockedBoat != null && dockedBoat.Spawned);
 }
Пример #3
0
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(Caravan caravan, DockedBoat dockedBoat)
 {
     return(CaravanArrivalActionUtility.GetFloatMenuOptions <CaravanArrivalAction_DockedBoats>(() => CaravanArrivalAction_DockedBoats.CanVisit(caravan, dockedBoat), () => new CaravanArrivalAction_DockedBoats(dockedBoat),
                                                                                               "CommandUndockShip".Translate(dockedBoat.Label), caravan, dockedBoat.Tile, dockedBoat));
 }
Пример #4
0
 public CaravanArrivalAction_DockedBoats(DockedBoat dockedBoat)
 {
     this.dockedBoat = dockedBoat;
 }