示例#1
0
        public static float ApproxDaysWorthOfFood_Ship(ShipBase ship, List <TransferableOneWay> transferables)
        {
            List <TransferableOneWay> tmp = new List <TransferableOneWay>();

            tmp.AddRange(transferables);

            List <TransferableOneWay> tmpPawns = new List <TransferableOneWay>();
            List <TransferableOneWay> tmpItems = new List <TransferableOneWay>();

            foreach (Pawn current in ship.GetInnerContainer().Where(x => x is Pawn))
            {
                if (!current.RaceProps.Eats(FoodTypeFlags.Plant))
                {
                    DropShipUtility.AddThingsToTransferables(tmp, current);
                }
            }
            for (int i = 0; i < ship.GetInnerContainer().Count; i++)
            {
                if (!(ship.GetInnerContainer()[i] is Pawn))
                {
                    DropShipUtility.AddThingsToTransferables(tmp, ship.GetInnerContainer()[i]);
                }
            }

            return(DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(tmp));
        }
示例#2
0
        private void AddToTransferables(Thing t)
        {
            TransferableOneWay transferableOneWay = TransferableUtility.TransferableMatching <TransferableOneWay>(t, this.transferables);

            if (transferableOneWay == null)
            {
                transferableOneWay = new TransferableOneWay();
                this.transferables.Add(transferableOneWay);
            }
            transferableOneWay.things.Add(t);
            transferableOneWay.countToTransfer -= ship.GetInnerContainer().ToList().FindAll(x => transferableOneWay.ThingDef == x.def).Count;
        }
示例#3
0
        public static void ReimbarkWorldPawnsForLandedShip(ShipBase ship)
        {
            List <Thing> pawnsToMove = new List <Thing>();

            foreach (Pawn current in ship.worldPawns)
            {
                if (!ship.GetInnerContainer().Contains(current))
                {
                    pawnsToMove.Add(current);
                }
            }
            ship.GetInnerContainer().TryAddMany(pawnsToMove);
            ship.worldPawns.RemoveAll(x => pawnsToMove.Contains(x));
        }
示例#4
0
        public static List <Pawn> AllPawnsInShip(ShipBase ship)
        {
            List <Pawn> tmp = new List <Pawn>();

            for (int i = 0; i > ship.GetInnerContainer().Count; i++)
            {
                Pawn pawn = ship.GetInnerContainer()[i] as Pawn;
                if (pawn != null)
                {
                    tmp.Add(pawn);
                }
            }

            return(tmp);
        }
示例#5
0
        public static void PassWorldPawnsForLandedShip(ShipBase ship)
        {
            List <Pawn> pawnsToMove = new List <Pawn>();

            foreach (Thing current in ship.GetInnerContainer())
            {
                Pawn pawn = current as Pawn;
                if (pawn != null && !ship.worldPawns.Contains(pawn))
                {
                    pawnsToMove.Add(pawn);
                }
            }

            ship.worldPawns.AddRange(pawnsToMove);
            ship.GetInnerContainer().RemoveAll(x => pawnsToMove.Contains <Pawn>(x as Pawn));
        }
示例#6
0
 private void InterfaceDrop(Thing thing, ShipBase ship)
 {
     ship.GetInnerContainer().TryDrop(thing, ThingPlaceMode.Near, out thing);
     if (thing is Pawn)
     {
         Pawn pawn     = (Pawn)thing;
         Lord LoadLord = LoadShipCargoUtility.FindLoadLord(ship, ship.Map);
         if (LoadLord != null)
         {
             LoadLord.ownedPawns.Remove(pawn);
         }
     }
 }
示例#7
0
        public static void InitiateGovernorArrestEvent(Map map)
        {
            if (CorruptionStoryTrackerUtilities.currentStoryTracker.PlanetaryGovernor == null)
            {
                return;
            }
            Faction     faction = CorruptionStoryTrackerUtilities.currentStoryTracker.ImperialGuard;
            List <Pawn> arbites = new List <Pawn>();

            for (int i = 0; i < 5; i++)
            {
                Pawn member = PawnGenerator.GeneratePawn(PawnKindDef.Named("IoM_Arbites"), faction);
                arbites.Add(member);
            }

            OHUShips.ShipBase dropShip = (OHUShips.ShipBase)ThingMaker.MakeThing(ThingDef.Named("AquilaLander"));
            dropShip.shipState      = OHUShips.ShipState.Incoming;
            dropShip.drawTickOffset = dropShip.compShip.sProps.TicksToImpact;
            Thing initialFuel = ThingMaker.MakeThing(DefOfs.C_ThingDefOfs.Chemfuel);

            initialFuel.stackCount = 2000;
            dropShip.refuelableComp.Refuel(initialFuel);
            dropShip.SetFaction(arbites[0].Faction);
            foreach (Pawn current in arbites)
            {
                dropShip.GetInnerContainer().TryAdd(current);
            }

            List <ShipBase> tmp = new List <ShipBase>();

            tmp.Add(dropShip);
            IntVec3 dropCenter;

            if (!DropCellFinder.TryFindRaidDropCenterClose(out dropCenter, map))
            {
                dropCenter = DropCellFinder.FindRaidDropCenterDistant(map);
            }
            DropShipUtility.DropShipGroups(dropCenter, map, tmp, TravelingShipArrivalAction.EnterMapFriendly);
            LordMaker.MakeNewLord(dropShip.Faction, new IoM.LordJob_ArrestGovernor(dropShip, dropCenter), map, arbites);
        }