FindOutpostCommandConsole() public static method

Find the outpost command console building if it exists.
public static FindOutpostCommandConsole ( Faction faction ) : Building_OutpostCommandConsole
faction Faction
return Building_OutpostCommandConsole
Beispiel #1
0
        protected override IntVec3 GetExactWanderDest(Pawn pawn)
        {
            Area outpostArea = OG_Util.FindOutpostArea();

            if ((outpostArea != null) &&
                outpostArea.ActiveCells.Contains(pawn.Position))
            {
                return(RCellFinder.RandomWanderDestFor(pawn, pawn.Position, this.wanderRadius, this.wanderDestValidator, PawnUtility.ResolveMaxDanger(pawn, this.maxDanger)));
            }
            else
            {
                Building_OutpostCommandConsole console = OG_Util.FindOutpostCommandConsole(OG_Util.FactionOfMiningCo);
                if (console != null)
                {
                    IntVec3 cell1 = WanderUtility.BestCloseWanderRoot(console.Position, pawn);
                    return(cell1);
                }
                else
                {
                    for (int cellIndex = 0; cellIndex < 50; cellIndex++)
                    {
                        IntVec3 cell2 = outpostArea.ActiveCells.RandomElement();
                        if (pawn.CanReserveAndReach(cell2, PathEndMode.Touch, Danger.Some))
                        {
                            return(cell2);
                        }
                    }
                    IntVec3 cell3 = WanderUtility.BestCloseWanderRoot(pawn.Position, pawn);
                    return(cell3);
                }
            }
        }
        private bool IsOutpostCaptured()
        {
            Building_OutpostCommandConsole commandConsole = OG_Util.FindOutpostCommandConsole(OG_Util.FactionOfMiningCo);

            if ((commandConsole == null) ||
                (commandConsole.Faction != OG_Util.FactionOfMiningCo))
            {
                return(true);
            }
            return(false);
        }