Пример #1
0
 public static Site TryMakeSite(SiteCoreDef core, IEnumerable <SitePartDef> siteParts, int tile, bool disallowNonHostileFactions = true, Predicate <Faction> extraFactionValidator = null, bool ifHostileThenMustRemainHostile = true, float?threatPoints = default(float?))
 {
     if (!SiteMakerHelper.TryFindRandomFactionFor(core, siteParts, out Faction faction, disallowNonHostileFactions, extraFactionValidator))
     {
         return(null);
     }
     return(MakeSite(core, siteParts, tile, faction, ifHostileThenMustRemainHostile, threatPoints));
 }
Пример #2
0
        public static Site TryMakeSite(SiteCoreDef core, IEnumerable <SitePartDef> siteParts, bool disallowAlliedFactions = true, Predicate <Faction> extraFactionValidator = null)
        {
            Faction faction = default(Faction);

            if (!SiteMakerHelper.TryFindRandomFactionFor(core, siteParts, out faction, disallowAlliedFactions, extraFactionValidator))
            {
                return(null);
            }
            return(SiteMaker.MakeSite(core, siteParts, faction));
        }
Пример #3
0
        public static Site TryMakeSite(SiteCoreDef core, IEnumerable <SitePartDef> siteParts, bool disallowNonHostileFactions = true, Predicate <Faction> extraFactionValidator = null, bool ifHostileThenMustRemainHostile = true)
        {
            Faction faction;
            Site    result;

            if (!SiteMakerHelper.TryFindRandomFactionFor(core, siteParts, out faction, disallowNonHostileFactions, extraFactionValidator))
            {
                result = null;
            }
            else
            {
                result = SiteMaker.MakeSite(core, siteParts, faction, ifHostileThenMustRemainHostile);
            }
            return(result);
        }
Пример #4
0
 public static bool TryFindSiteParams_SingleSitePart(SiteCoreDef core, IEnumerable <SitePartDef> singleSitePartCandidates, out SitePartDef sitePart, out Faction faction, Faction factionToUse = null, bool disallowAlliedFactions = true, Predicate <Faction> extraFactionValidator = null)
 {
     faction = factionToUse;
     if (singleSitePartCandidates != null)
     {
         if (!SiteMakerHelper.TryFindNewRandomSitePartFor(core, null, singleSitePartCandidates, faction, out sitePart, disallowAlliedFactions, extraFactionValidator))
         {
             return(false);
         }
     }
     else
     {
         sitePart = null;
     }
     if (faction == null)
     {
         IEnumerable <SitePartDef> parts = (sitePart == null) ? null : Gen.YieldSingle <SitePartDef>(sitePart);
         if (!SiteMakerHelper.TryFindRandomFactionFor(core, parts, out faction, disallowAlliedFactions, extraFactionValidator))
         {
             return(false);
         }
     }
     return(true);
 }