Building_SupplyShip class.
Inheritance: Building
示例#1
0
        /// <summary>
        /// Find the supply ship if it exists.
        /// </summary>
        public static Building_SupplyShip FindSupplyShip(Faction faction)
        {
            List <Thing> supplyShipList = Find.ListerThings.ThingsOfDef(OG_Util.SupplyShipDef);

            foreach (Thing potentialSupplyShip in supplyShipList)
            {
                Building_SupplyShip supplyShip = potentialSupplyShip as Building_SupplyShip;
                if ((supplyShip != null) &&
                    (supplyShip.Faction != null) &&
                    (supplyShip.Faction == faction))
                {
                    return(supplyShip);
                }
            }
            return(null);
        }
        protected override Job TryGiveJob(Pawn pawn)
        {
            Building_SupplyShip supplyShip = OG_Util.FindSupplyShip(pawn.Faction);

            if (supplyShip == null)
            {
                return(null);
            }

            // Outpost has been captured or pawn has no weapon or an apparel in bad conditions.
            if (IsOutpostCaptured() ||
                IsLackingWeapon(pawn) ||
                IsWearingDamagedApparel(pawn) ||
                IsLackingPant(pawn))
            {
                if (pawn.CanReserveAndReach(supplyShip, PathEndMode.OnCell, Danger.Deadly))
                {
                    return(new Job(DefDatabase <JobDef> .GetNamed(OG_Util.JobDefName_BoardSupplyShip), supplyShip));
                }
            }
            return(null);
        }