protected override void GeneratePawns(PawnGroupMakerParms parms, PawnGroupMaker groupMaker, List <Pawn> outPawns, bool errorOnZeroResults = true)
 {
     if (!CanGenerateFrom(parms, groupMaker))
     {
         if (errorOnZeroResults)
         {
             Log.Error("Cannot generate pawns for " + parms.faction + " with " + parms.points + ". Defaulting to a single random cheap group.");
         }
     }
     else
     {
         bool             allowFood         = parms.raidStrategy == null || parms.raidStrategy.pawnsCanBringFood || (parms.faction != null && !parms.faction.HostileTo(Faction.OfPlayer));
         Predicate <Pawn> validatorPostGear = (parms.raidStrategy != null) ? ((Predicate <Pawn>)((Pawn p) => parms.raidStrategy.Worker.CanUsePawn(p, outPawns))) : null;
         bool             flag = false;
         foreach (PawnGenOption item in PawnGroupMakerUtility.ChoosePawnGenOptionsByPoints(parms.points, groupMaker.options, parms))
         {
             Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(item.kind, parms.faction, PawnGenerationContext.NonPlayer, parms.tile, forceGenerateNewPawn: false, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, mustBeCapableOfViolence: true, 1f, forceAddFreeWarmLayerIfNeeded: false, allowGay: true, allowFood, allowAddictions: true, parms.inhabitants, certainlyBeenInCryptosleep: false, forceRedressWorldPawnIfFormerColonist: false, worldPawnFactionDoesntMatter: false, 0f, null, 1f, null, validatorPostGear));
             if (parms.forceOneIncap && !flag)
             {
                 pawn.health.forceIncap           = true;
                 pawn.mindState.canFleeIndividual = false;
                 flag = true;
             }
             outPawns.Add(pawn);
         }
     }
 }
 protected override void GeneratePawns(PawnGroupMakerParms parms, PawnGroupMaker groupMaker, List <Pawn> outPawns, bool errorOnZeroResults = true)
 {
     if (!this.CanGenerateFrom(parms, groupMaker))
     {
         if (errorOnZeroResults)
         {
             Log.Error("Cannot generate pawns for " + parms.faction + " with " + parms.points + ". Defaulting to a single random cheap group.");
         }
     }
     else
     {
         bool flag  = parms.raidStrategy == null || parms.raidStrategy.pawnsCanBringFood || (parms.faction != null && !parms.faction.HostileTo(Faction.OfPlayer));
         bool flag2 = false;
         foreach (PawnGenOption item in PawnGroupMakerUtility.ChoosePawnGenOptionsByPoints(parms.points, groupMaker.options, parms))
         {
             PawnKindDef           kind        = item.kind;
             Faction               faction     = parms.faction;
             int                   tile        = parms.tile;
             bool                  allowFood   = flag;
             bool                  inhabitants = parms.inhabitants;
             PawnGenerationRequest request     = new PawnGenerationRequest(kind, faction, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, true, 1f, false, true, allowFood, inhabitants, false, false, false, null, null, null, null, null, null, null);
             Pawn                  pawn        = PawnGenerator.GeneratePawn(request);
             if (parms.forceOneIncap && !flag2)
             {
                 pawn.health.forceIncap           = true;
                 pawn.mindState.canFleeIndividual = false;
                 flag2 = true;
             }
             outPawns.Add(pawn);
         }
     }
 }
 public override IEnumerable <PawnKindDef> GeneratePawnKindsExample(PawnGroupMakerParms parms, PawnGroupMaker groupMaker)
 {
     foreach (PawnGenOption item in PawnGroupMakerUtility.ChoosePawnGenOptionsByPoints(parms.points, groupMaker.options, parms))
     {
         yield return(item.kind);
     }
 }
 public override bool CanGenerateFrom(PawnGroupMakerParms parms, PawnGroupMaker groupMaker)
 {
     if (!base.CanGenerateFrom(parms, groupMaker))
     {
         return(false);
     }
     if (!PawnGroupMakerUtility.ChoosePawnGenOptionsByPoints(parms.points, groupMaker.options, parms).Any())
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 5
0
        public override IEnumerable <PawnKindDef> GeneratePawnKindsExample(PawnGroupMakerParms parms, PawnGroupMaker groupMaker)
        {
            using (IEnumerator <PawnGenOption> enumerator = PawnGroupMakerUtility.ChoosePawnGenOptionsByPoints(parms.points, groupMaker.options, parms).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    PawnGenOption p = enumerator.Current;
                    yield return(p.kind);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_00d4:
            /*Error near IL_00d5: Unexpected return in MoveNext()*/;
        }
 private void GenerateGuards(PawnGroupMakerParms parms, PawnGroupMaker groupMaker, Pawn trader, List <Thing> wares, List <Pawn> outPawns)
 {
     if (groupMaker.guards.Any <PawnGenOption>())
     {
         float points = parms.points;
         foreach (PawnGenOption pawnGenOption in PawnGroupMakerUtility.ChoosePawnGenOptionsByPoints(points, groupMaker.guards, parms))
         {
             PawnKindDef           kind        = pawnGenOption.kind;
             Faction               faction     = parms.faction;
             int                   tile        = parms.tile;
             bool                  inhabitants = parms.inhabitants;
             PawnGenerationRequest request     = new PawnGenerationRequest(kind, faction, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, true, 1f, false, true, true, inhabitants, false, false, false, null, null, null, null, null, null, null, null);
             Pawn                  item        = PawnGenerator.GeneratePawn(request);
             outPawns.Add(item);
         }
     }
 }
Ejemplo n.º 7
0
 private void GenerateGuards(PawnGroupMakerParms parms, PawnGroupMaker groupMaker, Pawn trader, List <Thing> wares, List <Pawn> outPawns)
 {
     if (groupMaker.guards.Any())
     {
         float points = parms.points;
         foreach (PawnGenOption item2 in PawnGroupMakerUtility.ChoosePawnGenOptionsByPoints(points, groupMaker.guards, parms))
         {
             PawnKindDef           kind        = item2.kind;
             Faction               faction     = parms.faction;
             int                   tile        = parms.tile;
             bool                  inhabitants = parms.inhabitants;
             PawnGenerationRequest request     = new PawnGenerationRequest(kind, faction, PawnGenerationContext.NonPlayer, tile, forceGenerateNewPawn: false, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, mustBeCapableOfViolence: true, 1f, forceAddFreeWarmLayerIfNeeded: false, allowGay: true, allowFood: true, inhabitants);
             Pawn                  item        = PawnGenerator.GeneratePawn(request);
             outPawns.Add(item);
         }
     }
 }
Ejemplo n.º 8
0
 private void GenerateGuards(PawnGroupMakerParms parms, PawnGroupMaker groupMaker, Pawn trader, List <Thing> wares, List <Pawn> outPawns)
 {
     if (groupMaker.guards.Any())
     {
         foreach (PawnGenOption item2 in PawnGroupMakerUtility.ChoosePawnGenOptionsByPoints(parms.points, groupMaker.guards, parms))
         {
             PawnGenerationRequest request = PawnGenerationRequest.MakeDefault();
             request.KindDef = item2.kind;
             request.Faction = parms.faction;
             request.Tile    = parms.tile;
             request.MustBeCapableOfViolence = true;
             request.Inhabitant       = parms.inhabitants;
             request.RedressValidator = ((Pawn x) => x.royalty == null || !x.royalty.AllTitlesForReading.Any());
             Pawn item = PawnGenerator.GeneratePawn(request);
             outPawns.Add(item);
         }
     }
 }
Ejemplo n.º 9
0
        protected override void GeneratePawns(PawnGroupMakerParms parms, PawnGroupMaker groupMaker, List <Pawn> outPawns, bool errorOnZeroResults = true)
        {
            if (!this.CanGenerateFrom(parms, groupMaker))
            {
                if (errorOnZeroResults)
                {
                    Log.Error(string.Concat(new object[]
                    {
                        "Cannot generate pawns for ",
                        parms.faction,
                        " with ",
                        parms.points,
                        ". Defaulting to a single random cheap group."
                    }), false);
                }
                return;
            }
            bool             flag      = parms.raidStrategy == null || parms.raidStrategy.pawnsCanBringFood || (parms.faction != null && !parms.faction.HostileTo(Faction.OfPlayer));
            Predicate <Pawn> predicate = (parms.raidStrategy == null) ? null : new Predicate <Pawn>((Pawn p) => parms.raidStrategy.Worker.CanUsePawn(p, outPawns));
            bool             flag2     = false;

            foreach (PawnGenOption pawnGenOption in PawnGroupMakerUtility.ChoosePawnGenOptionsByPoints(parms.points, groupMaker.options, parms))
            {
                PawnKindDef           kind              = pawnGenOption.kind;
                Faction               faction           = parms.faction;
                int                   tile              = parms.tile;
                bool                  allowFood         = flag;
                bool                  inhabitants       = parms.inhabitants;
                Predicate <Pawn>      validatorPostGear = predicate;
                PawnGenerationRequest request           = new PawnGenerationRequest(kind, faction, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, true, 1f, false, true, allowFood, inhabitants, false, false, false, null, validatorPostGear, null, null, null, null, null, null);
                Pawn                  pawn              = PawnGenerator.GeneratePawn(request);
                if (parms.forceOneIncap && !flag2)
                {
                    pawn.health.forceIncap           = true;
                    pawn.mindState.canFleeIndividual = false;
                    flag2 = true;
                }
                outPawns.Add(pawn);
            }
        }
Ejemplo n.º 10
0
 public override bool CanGenerateFrom(PawnGroupMakerParms parms, PawnGroupMaker groupMaker)
 {
     return(base.CanGenerateFrom(parms, groupMaker) && PawnGroupMakerUtility.ChoosePawnGenOptionsByPoints(parms.points, groupMaker.options, parms).Any <PawnGenOption>());
 }