Ejemplo n.º 1
0
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     if (this.parent.Faction == Faction.OfPlayer)
     {
         StaticCollectionsClass.AddHumanoidHybridToList(this.parent);
     }
 }
Ejemplo n.º 2
0
        public override void WorldComponentTick()
        {
            base.WorldComponentTick();



            if (tickCounter > checkInterval)
            {
                foreach (Thing thing in StaticCollectionsClass.failures_in_map)
                {
                    Pawn pawn = thing as Pawn;

                    if (pawn != null && pawn.Dead)
                    {
                        StaticCollectionsClass.RemoveFailuresFromList(thing);
                    }

                    if (thing.Map == null)
                    {
                        StaticCollectionsClass.RemoveFailuresFromList(thing);
                    }
                }
            }
            tickCounter++;
        }
Ejemplo n.º 3
0
 protected override bool Satisfied(Pawn pawn)
 {
     if (StaticCollectionsClass.IsHumanoidHybrid(pawn))
     {
         return(true);
     }
     return(false);
 }
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     if (StaticCollectionsClass.AnyMechAntennas())
     {
         hybridsList = DefDatabase <PawnKindDef> .AllDefsListForReading.Where(x => (x.race.tradeTags?.Contains("AnimalGenetic") == true) && x.race.tradeTags?.Contains("AnimalGeneticCentipede") == false).ToHashSet();
     }
     else
     {
         hybridsList = DefDatabase <PawnKindDef> .AllDefsListForReading.Where(x => (x.race.tradeTags?.Contains("AnimalGenetic") == true) && x.race.tradeTags?.Contains("AnimalGeneticMechanoid") == false).ToHashSet();
     }
 }
 public override float RandomSelectionWeight(Pawn initiator, Pawn recipient)
 {
     if (StaticCollectionsClass.IsHumanoidHybrid(initiator) && recipient.RaceProps.Humanlike)
     {
         return(1f);
     }
     else
     {
         return(0);
     }
 }
Ejemplo n.º 6
0
        public override void CompTick()
        {
            if (parent.IsHashIntervalTick(interval))
            {
                Pawn pawn = parent as Pawn;

                if (CaravanUtility.IsCaravanMember(pawn))
                {
                    StaticCollectionsClass.AddManffaloAndExperience((Pawn)parent);

                    if (xp <= 2)
                    {
                        xp += 0.01f;
                        StaticCollectionsClass.SetManffaloExperience((Pawn)parent, xp);
                    }
                }
            }
        }
 public override void PostDestroy(DestroyMode mode, Map previousMap)
 {
     StaticCollectionsClass.RemoveHorseHybridFromList((Pawn)this.parent);
 }
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     StaticCollectionsClass.AddHorseHybridToList((Pawn)this.parent);
 }
Ejemplo n.º 9
0
 public override void PostDestroy(DestroyMode mode, Map previousMap)
 {
     StaticCollectionsClass.RemoveFailuresFromList(this.parent);
 }
Ejemplo n.º 10
0
 public override void PostDeSpawn(Map map)
 {
     StaticCollectionsClass.RemoveFailuresFromList(this.parent);
 }
Ejemplo n.º 11
0
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     StaticCollectionsClass.AddFailuresToList(this.parent);
 }
Ejemplo n.º 12
0
 public override void PostDestroy(DestroyMode mode, Map previousMap)
 {
     StaticCollectionsClass.RemoveManffaloAndExperience((Pawn)parent);
 }
Ejemplo n.º 13
0
 public override void PostDestroy(DestroyMode mode, Map previousMap)
 {
     StaticCollectionsClass.RemoveMechAntennaFromList((Building_MechahybridAntenna)this.parent);
 }
Ejemplo n.º 14
0
 public override void PostDeSpawn(Map map)
 {
     StaticCollectionsClass.RemoveMechAntennaFromList((Building_MechahybridAntenna)this.parent);
 }
Ejemplo n.º 15
0
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     StaticCollectionsClass.AddMechAntennaToList((Building_MechahybridAntenna)this.parent);
 }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map = (Map)parms.target;

            float totalPoints = parms.points / 2;

            HashSet <PawnKindDef> hybridsList;

            if (StaticCollectionsClass.AnyMechAntennas())
            {
                hybridsList = DefDatabase <PawnKindDef> .AllDefsListForReading.Where(x => (x.race.tradeTags?.Contains("AnimalGenetic") == true) && (x.race.tradeTags?.Contains("AnimalGeneticFailure") == false) && (x.race.tradeTags?.Contains("AnimalGeneticCentipede") == false)).ToHashSet();
            }
            else
            {
                hybridsList = DefDatabase <PawnKindDef> .AllDefsListForReading.Where(x => (x.race.tradeTags?.Contains("AnimalGenetic") == true) && (x.race.tradeTags?.Contains("AnimalGeneticFailure") == false) && (x.race.tradeTags?.Contains("AnimalGeneticMechanoid") == false)).ToHashSet();
            }

            List <Pawn> list = new List <Pawn>();

            PawnKindDef firstPawn;

            hybridsList.TryRandomElementByWeight((PawnKindDef a) => ManhunterPackIncidentUtility.ManhunterAnimalWeight(a, parms.points), out firstPawn);
            IntVec3 result = parms.spawnCenter;

            if (firstPawn != null)
            {
                if (!result.IsValid && !RCellFinder.TryFindRandomPawnEntryCell(out result, map, CellFinder.EdgeRoadChance_Animal))
                {
                    return(false);
                }
                Pawn item = PawnGenerator.GeneratePawn(new PawnGenerationRequest(firstPawn, null, PawnGenerationContext.NonPlayer, map.Tile));
                list.Add(item);
                totalPoints -= item.kindDef.combatPower;
                while (totalPoints > 0)
                {
                    PawnKindDef nextPawn;
                    hybridsList.TryRandomElementByWeight((PawnKindDef a) => ManhunterPackIncidentUtility.ManhunterAnimalWeight(a, totalPoints), out nextPawn);
                    Pawn nextitem = PawnGenerator.GeneratePawn(new PawnGenerationRequest(nextPawn, null, PawnGenerationContext.NonPlayer, map.Tile));
                    list.Add(nextitem);
                    totalPoints -= nextitem.kindDef.combatPower;
                }
            }


            Rot4 rot = Rot4.FromAngleFlat((map.Center - result).AngleFlat);

            for (int i = 0; i < list.Count; i++)
            {
                Pawn    pawn = list[i];
                IntVec3 loc  = CellFinder.RandomClosewalkCellNear(result, map, 10);
                QuestUtility.AddQuestTag(GenSpawn.Spawn(pawn, loc, map, rot), parms.questTag);
                pawn.health.AddHediff(InternalDefOf.GR_GreaterScaria);
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent);
                CompHybrid compHybrid = pawn.TryGetComp <CompHybrid>();

                if (compHybrid != null)
                {
                    compHybrid.quality = QualityUtility.GenerateQualityRandomEqualChance();
                }
            }
            SendStandardLetter("GR_LetterLabelMonstrositiesArrived".Translate(), "GR_LetterMonstrositiesArrived".Translate(), LetterDefOf.ThreatBig, parms, list[0]);
            Find.TickManager.slower.SignalForceNormalSpeedShort();

            return(true);
        }
Ejemplo n.º 17
0
 public override void PostDeSpawn(Map map)
 {
     StaticCollectionsClass.RemoveHumanoidHybridFromList(this.parent);
 }