Пример #1
0
        static bool Prefix(ref Pawn __result, Quest quest, PawnKindDef kindDef, Faction faction, bool allowAddictions = true, IEnumerable <TraitDef> forcedTraits = null, float biocodeWeaponChance = 0f, bool mustBeCapableOfViolence = true, Pawn extraPawnForExtraRelationChance = null, float relationWithExtraPawnChanceFactor = 0f, float biocodeApparelChance = 0f, bool ensureNonNumericName = false, bool forceGenerateNewPawn = false)
        {
            if (faction == FactionColonies.getPlayerColonyFaction())
            {
                List <PawnKindDef> list = new List <PawnKindDef>();
                foreach (ThingDef def in Find.World.GetComponent <FactionFC>().raceFilter.AllowedThingDefs)
                {
                    list.Add(def.race.AnyPawnKind);
                }



                Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(list.RandomElement(), faction, PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn, false, false, false, true, mustBeCapableOfViolence, 1f, false, true, true, allowAddictions, false, false, false, false, biocodeWeaponChance, extraPawnForExtraRelationChance, relationWithExtraPawnChanceFactor, null, null, forcedTraits, null, null, null, null, null, null, null, null, null)
                {
                    BiocodeApparelChance = biocodeApparelChance
                });
                if (ensureNonNumericName && (pawn.Name == null || pawn.Name.Numerical))
                {
                    pawn.Name = PawnBioAndNameGenerator.GeneratePawnName(pawn, NameStyle.Full, null);
                }
                QuestGen.AddToGeneratedPawns(pawn);
                if (!pawn.IsWorldPawn())
                {
                    Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Decide);
                }
                __result = pawn;


                return(false);
            }
            else
            {
                return(true);
            }
        }
Пример #2
0
        protected override void RunInt()
        {
            var pawn = GameComponent.GetRandomAllyForSpawning();

            Slate slate = QuestGen.slate;

            if (storeAs.GetValue(slate) != null)
            {
                QuestGen.slate.Set(storeAs.GetValue(slate), pawn, false);
            }
            if (addToList.GetValue(slate) != null)
            {
                QuestGenUtility.AddToOrMakeList(QuestGen.slate, addToList.GetValue(slate), pawn);
            }
            QuestGen.AddToGeneratedPawns(pawn);

            // Vanilla code: adds the pawn to the World.
            // For this mod, remove them from the available list and put them in the spawned list instead.
        }