示例#1
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            //--Log.Message("IncidentWorker_NymphVisitorGroup::TryExecute() called");

            if (!RJWSettings.NymphRaidEasy)
            {
                return(false);
            }
            if (MP.IsInMultiplayer)
            {
                return(false);
            }

            Map map = (Map)parms.target;

            if (map == null)
            {
                //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - map is null, abort!");
                return(false);
            }
            else
            {
                //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - map is ok");
            }

            //Rand.PopState();
            //Rand.PushState(RJW_Multiplayer.PredictableSeed());
            if (!RCellFinder.TryFindRandomPawnEntryCell(out IntVec3 loc, map, CellFinder.EdgeRoadChance_Friendly + 0.2f))
            {
                //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - no entry, abort!");
                return(false);
            }

            //var PlayerHomeMap = Find.Maps.Find(map => map.IsPlayerHome);
            var count = (Find.World.worldPawns.AllPawnsAlive.Count + map.mapPawns.FreeColonistsAndPrisonersSpawnedCount);

            //Log.Message("IncidentWorker_NymphJoins::TryExecute() -count:" + count + " map:" + PlayerHomeMap);
            for (int i = 1; i <= count || i <= 100; ++i)
            {
                Pawn pawn = Nymph_Generator.GenerateNymph(loc, ref map);
                //pawn.SetFaction(Faction.OfPlayer);
                GenSpawn.Spawn(pawn, loc, map);

                pawn.ChangeKind(PawnKindDefOf.WildMan);
                //if (pawn.Faction != null)
                //	pawn.SetFaction(null);
                if (RJWSettings.NymphPermanentManhunter)
                {
                    pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent);
                }
                else
                {
                    pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter);
                }
            }
            Find.LetterStack.ReceiveLetter("Nymphs!!!", "A whole group of nymphs has wandered into your colony.", LetterDefOf.ThreatBig, null);

            return(true);
        }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            //--Log.Message("IncidentWorker_NymphVisitor::TryExecute() called");

            if (!RJWSettings.NymphWild)
            {
                return(false);
            }
            if (MP.IsInMultiplayer)
            {
                return(false);
            }
            Map map = (Map)parms.target;

            if (map == null)
            {
                //--Log.Message("IncidentWorker_NymphVisitor::TryExecute() - map is null, abort!");
                return(false);
            }
            else
            {
                //--Log.Message("IncidentWorker_NymphVisitor::TryExecute() - map is ok");
            }

            //Rand.PopState();
            //Rand.PushState(RJW_Multiplayer.PredictableSeed());
            if (!RCellFinder.TryFindRandomPawnEntryCell(out IntVec3 loc, map, CellFinder.EdgeRoadChance_Friendly + 0.2f))
            {
                //--Log.Message("IncidentWorker_NymphVisitor::TryExecute() - no entry, abort!");
                return(false);
            }

            Pawn pawn = Nymph_Generator.GenerateNymph(loc, ref map);             //generates with null faction, mod conflict ?!

            GenSpawn.Spawn(pawn, loc, map);

            pawn.ChangeKind(PawnKindDefOf.WildMan);
            //if (pawn.Faction != null)
            //	pawn.SetFaction(null);

            if (RJWSettings.NymphPermanentManhunter)
            {
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent);
            }
            else
            {
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter);
            }

            Find.LetterStack.ReceiveLetter("Nymph! ", "A wandering nymph has decided to visit your colony.", LetterDefOf.ThreatSmall, pawn);

            return(true);
        }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            //--Log.Message("IncidentWorker_NymphJoins::TryExecute() called");

            if (!RJWSettings.NymphTamed)
            {
                return(false);
            }
            if (MP.IsInMultiplayer)
            {
                return(false);
            }
            Map map = (Map)parms.target;

            if (map == null)
            {
                //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - map is null, abort!");
                return(false);
            }
            else
            {
                //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - map is ok");
            }

            //Rand.PopState();
            //Rand.PushState(RJW_Multiplayer.PredictableSeed());
            if (!RCellFinder.TryFindRandomPawnEntryCell(out IntVec3 loc, map, CellFinder.EdgeRoadChance_Friendly + 0.2f))
            {
                //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - no entry, abort!");
                return(false);
            }

            Pawn pawn = Nymph_Generator.GenerateNymph(loc, ref map);             //generates with null faction, mod conflict ?!

            pawn.SetFaction(Faction.OfPlayer);
            GenSpawn.Spawn(pawn, loc, map);

            Find.LetterStack.ReceiveLetter("Nymph Joins", "A wandering nymph has decided to join your colony.", LetterDefOf.PositiveEvent, pawn);

            return(true);
        }