public PawnSummoned SpawnPawn(SpawnThings spawnables, Faction faction)
        {
            var newPawn = (PawnSummoned)PawnGenerator.GeneratePawn(spawnables.kindDef, faction);

            newPawn.Spawner   = Caster;
            newPawn.Temporary = spawnables.temporary;
            if (newPawn.Faction != Faction.OfPlayerSilentFail && this?.Caster?.Faction is Faction f)
            {
                newPawn.SetFaction(f);
            }
            GenSpawn.Spawn(newPawn, PositionHeld, Find.CurrentMap);
            if (faction != null && faction != Faction.OfPlayer)
            {
                Lord lord = null;
                if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any(p => p != newPawn))
                {
                    Predicate <Thing> validator = p => p != newPawn && ((Pawn)p).GetLord() != null;
                    var p2 = (Pawn)GenClosest.ClosestThing_Global(newPawn.Position,
                                                                  newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, validator);
                    lord = p2.GetLord();
                }
                if (lord == null)
                {
                    var lordJob = new LordJob_DefendPoint(newPawn.Position);
                    lord = LordMaker.MakeNewLord(faction, lordJob, Find.CurrentMap, null);
                }
                lord.AddPawn(newPawn);
            }
            return(newPawn);
        }
Пример #2
0
        public override void CompTick()
        {
            base.CompTick();
            if (!AlphaAnimalsEvents_Mod.settings.flagAlphaMechanoidsSappers)
            {
                if (parent.Map != null)
                {
                    PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDef.Named(Props.defToChangeTo), Find.FactionManager.FirstFactionOfDef(FactionDefOf.Mechanoid), PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 1f, false, true, true, false, false);
                    Pawn pawn = PawnGenerator.GeneratePawn(request);
                    GenSpawn.Spawn(pawn, this.parent.Position, parent.Map, WipeMode.Vanish);

                    Lord lord = null;
                    if (pawn.Map.mapPawns.SpawnedPawnsInFaction(Faction.OfMechanoids).Any((Pawn p) => p != pawn))
                    {
                        lord = ((Pawn)GenClosest.ClosestThing_Global(pawn.Position, pawn.Map.mapPawns.SpawnedPawnsInFaction(Faction.OfMechanoids), 99999f, (Thing p) => p != pawn && ((Pawn)p).GetLord() != null, null)).GetLord();
                    }
                    if (lord == null)
                    {
                        LordJob_DefendPoint lordJob = new LordJob_DefendPoint(pawn.Position, null, false, true);
                        lord = LordMaker.MakeNewLord(Faction.OfMechanoids, lordJob, Find.CurrentMap, null);
                    }
                    lord.AddPawn(pawn);


                    this.parent.Destroy();
                }
            }
        }
Пример #3
0
        private static void SpawnPawn()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (PawnKindDef item in DefDatabase <PawnKindDef> .AllDefs.OrderBy((PawnKindDef kd) => kd.defName))
            {
                PawnKindDef localKindDef = item;
                list.Add(new DebugMenuOption(localKindDef.defName, DebugMenuOptionMode.Tool, delegate
                {
                    Faction faction = FactionUtility.DefaultFactionFrom(localKindDef.defaultFactionType);
                    Pawn newPawn    = PawnGenerator.GeneratePawn(localKindDef, faction);
                    GenSpawn.Spawn(newPawn, UI.MouseCell(), Find.CurrentMap);
                    if (faction != null && faction != Faction.OfPlayer)
                    {
                        Lord lord = null;
                        if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                        {
                            lord = ((Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null)).GetLord();
                        }
                        if (lord == null)
                        {
                            LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                            lord = LordMaker.MakeNewLord(faction, lordJob, Find.CurrentMap);
                        }
                        lord.AddPawn(newPawn);
                    }
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
Пример #4
0
        private static void SpawnPawnQuality()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (PawnKindDef item in DefDatabase <PawnKindDef> .AllDefs.Where(x => x.GetModExtension <DefExtension_Hybrid>() != null || x.race.tradeTags?.Contains("AnimalGeneticMechanoid") == true).OrderBy((PawnKindDef kd) => kd.defName))
            {
                PawnKindDef localKindDef = item;
                list.Add(new DebugMenuOption(localKindDef.defName, DebugMenuOptionMode.Tool, delegate
                {
                    Faction faction = FactionUtility.DefaultFactionFrom(localKindDef.defaultFactionType);
                    Pawn newPawn    = PawnGenerator.GeneratePawn(localKindDef, faction);
                    GenSpawn.Spawn(newPawn, UI.MouseCell(), Find.CurrentMap);
                    CompHybrid compHybrid = newPawn.TryGetComp <CompHybrid>();
                    if (compHybrid != null)
                    {
                        compHybrid.quality = QualityUtility.GenerateQualityRandomEqualChance();
                    }
                    if (faction != null && faction != Faction.OfPlayer)
                    {
                        Lord lord = null;
                        if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                        {
                            lord = ((Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null)).GetLord();
                        }
                        if (lord == null)
                        {
                            LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                            lord = LordMaker.MakeNewLord(faction, lordJob, Find.CurrentMap);
                        }
                        lord.AddPawn(newPawn);
                    }
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
        public override void CompTick()
        {
            base.CompTick();
            if (!TacticalMechanoids_Settings.MechanoidIsEnabled(Props.defToChangeFrom))
            {
                if (parent.Map != null)
                {
                    for (int i = 0; i < Props.numToSpawn; i++)
                    {
                        PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDef.Named(Props.defToChangeTo), Find.FactionManager.FirstFactionOfDef(FactionDefOf.Mechanoid), PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 1f, false, true, true, false, false);
                        Pawn pawn = PawnGenerator.GeneratePawn(request);
                        GenSpawn.Spawn(pawn, this.parent.Position, parent.Map, WipeMode.Vanish);

                        Lord lord = null;
                        if (this.parent is Pawn parentPawn)
                        {
                            lord = parentPawn.GetLord();
                        }
                        if (lord == null)
                        {
                            LordJob_DefendPoint lordJob = new LordJob_DefendPoint(pawn.Position, null, false, true);
                            lord = LordMaker.MakeNewLord(Faction.OfMechanoids, lordJob, Find.CurrentMap, null);
                        }
                        lord.AddPawn(pawn);
                    }


                    this.parent.Destroy();
                }
            }
        }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            //Log.Message("Building_LandedShip TrySetDeepOneFaction");
            if (!TrySetDeepOneFaction(parms))
            {
                return(false);
            }

            var map = parms.target as Map;

            //Find a drop spot
            if (!CultUtility.TryFindDropCell(map.Center, map, 70, out var intVec))
            {
                return(false);
            }

            parms.spawnCenter = intVec;
            var list = SpawnPawns(parms);

            if (list.Count == 0)
            {
                return(false);
            }

            var spotFound = RCellFinder.TryFindRandomSpotJustOutsideColony(list[0], out var chillSpot);
            //LordJob_VisitColony lordJob = new LordJob_VisitColony(parms.faction, chillSpot);

            //If they have the sign of dagon, then use it.
            var chillSpot2 = IntVec3.Invalid;
            var dagonSign  =
                map.listerBuildings.allBuildingsColonist.FirstOrDefault(bld => bld.def == CultsDefOf.Cults_SignOfDagon);

            if (dagonSign != null)
            {
                chillSpot2 = dagonSign.Position;
            }

            if (chillSpot2 != null)
            {
                chillSpot = chillSpot2;
            }

            if (chillSpot == null)
            {
                return(false);
            }

            //Log.Message("SpellWorker_DefendTheBrood LordJob_DefendPoint");
            var lordJob = new LordJob_DefendPoint(chillSpot);

            Utility.TemporaryGoodwill(parms.faction);
            LordMaker.MakeNewLord(parms.faction, lordJob, map, list);
            //Find.LetterStack.ReceiveLetter("DeepOnesArrive".Translate(), "DeepOnesArriveDesc".Translate(), letterDef.Good, list[0]);
            map.GetComponent <MapComponent_SacrificeTracker>().lastLocation = list[0].Position;
            map.GetComponent <MapComponent_SacrificeTracker>().defendTheBroodPawns.AddRange(list);


            return(true);
        }
Пример #7
0
        public static TMPawnSummoned SpawnPawn(Pawn caster, SpawnThings spawnables, Faction faction, IntVec3 position, int duration)
        {
            TMPawnSummoned newPawn = (TMPawnSummoned)PawnGenerator.GeneratePawn(spawnables.kindDef, faction);

            newPawn.validSummoning = true;
            newPawn.Spawner        = caster;
            newPawn.Temporary      = spawnables.temporary;
            newPawn.TicksToDestroy = duration;
            //Faction val = default(Faction);
            //int num;
            //if (newPawn.Faction != Faction.OfPlayerSilentFail)
            //{
            //    Faction obj = null;

            //    obj = ((caster != null) ? caster.Faction : null);

            //    val = obj;
            //    num = ((obj != null) ? 1 : 0);
            //}
            //else
            //{
            //    num = 0;
            //}
            //if (num != 0)
            //{
            //    newPawn.SetFaction(val, null);
            //}
            GenSpawn.Spawn(newPawn, position, Find.CurrentMap, 0);

            if (newPawn.Faction != null && newPawn.Faction != Faction.OfPlayer)
            {
                Lord lord = null;
                if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                {
                    Predicate <Thing> validator = (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null;
                    Pawn p2 = (Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, validator, null);
                    lord = p2.GetLord();
                }
                bool flag4 = lord == null;
                if (flag4)
                {
                    LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                    lord = LordMaker.MakeNewLord(faction, lordJob, newPawn.Map, null);
                }
                else
                {
                    try
                    {
                        newPawn.mindState.duty = new PawnDuty(DutyDefOf.Defend);
                    }
                    catch
                    {
                        Log.Message("error attempting to assign a duty to summoned object");
                    }
                }
                lord.AddPawn(newPawn);
            }
            return(newPawn);
        }
Пример #8
0
        public override void SpawnSetup(Map map, bool bla)
        {
            base.SpawnSetup(map, bla);
            Building_SignOfDagon toDestroy = null;

            foreach (Building bld in map.listerBuildings.allBuildingsColonist)
            {
                if (bld == this)
                {
                    continue;
                }
                if (bld is Building_SignOfDagon)
                {
                    toDestroy = (Building_SignOfDagon)bld;
                }
            }
            if (toDestroy != null)
            {
                toDestroy.Destroy(0);
            }


            List <Pawn> list = map.GetComponent <MapComponent_SacrificeTracker>().defendTheBroodPawns;

            if (list != null)
            {
                if (list.Count > 0)
                {
                    Faction f = null;
                    if (Cthulhu.Utility.IsCosmicHorrorsLoaded())
                    {
                        f = Find.FactionManager.FirstFactionOfDef(FactionDef.Named("ROM_DeepOne"));
                    }
                    else
                    {
                        Messages.Message("Cosmic horrors mod is not loaded. Using insectoids instead.", MessageTypeDefOf.NegativeEvent);
                        f = Find.FactionManager.FirstFactionOfDef(FactionDef.Named("ROM_DeepOneAlt"));
                    }

                    Lord lord = null;

                    LordJob_DefendPoint lordJob = new LordJob_DefendPoint(this.Position);
                    Cthulhu.Utility.TemporaryGoodwill(f, false);
                    foreach (Pawn current in list)
                    {
                        if (lord == null)
                        {
                            lord = current.GetLord();
                        }
                        if (lord != null)
                        {
                            map.lordManager.RemoveLord(lord);
                        }
                    }
                    LordMaker.MakeNewLord(f, lordJob, map, list);
                }
            }
        }
        private void TrySpawnMadSailors()
        {
            var lordList = new List <Pawn>();
            var faction  = Find.FactionManager.FirstFactionOfDef(CultsDefOf.Cults_Sailors);

            Utility.DebugReport(faction.ToString());
            //Log.Message("Building_LandedShip LordJob_DefendPoint");
            var lordJob = new LordJob_DefendPoint(Position);

            if (pointsLeft <= 0f)
            {
                return;
            }

            if (lord == null)
            {
                lord = LordMaker.MakeNewLord(faction, lordJob, Map, lordList);
            }

            while (pointsLeft > 0f)
            {
                if (!(from cell in GenAdj.CellsAdjacent8Way(this)
                      where cell.Walkable(Map)
                      select cell).TryRandomElement(out var center))
                {
                    continue;
                }

                var request = new PawnGenerationRequest(CultsDefOf.Cults_Sailor, faction,
                                                        PawnGenerationContext.NonPlayer, Map.Tile, false, false, false, false, true, true, 20f, false,
                                                        true, true, false, false, false, false, false, 0, 0, null, 0);
                var pawn = PawnGenerator.GeneratePawn(request);
                if (!GenPlace.TryPlaceThing(pawn, center, Map, ThingPlaceMode.Near))
                {
                    continue;
                }

                if (pawn.GetLord() != null)
                {
                    pawn.GetLord().Cleanup();
                    pawn.GetLord().CurLordToil.Cleanup();
                    pawn.GetLord().LordJob.Cleanup();
                }

                lord.AddPawn(pawn);
                pointsLeft -= pawn.kindDef.combatPower;
                Utility.ApplySanityLoss(pawn, 1f);

                //Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard);
            }

            pointsLeft = 0f;
            SoundDefOf.PsychicPulseGlobal.PlayOneShotOnCamera();
        }
Пример #10
0
        public void SingleSpawnLoop(SpawnThings spawnables, IntVec3 position, Map map)
        {
            Log.Message("single spawn loop start");
            bool flag = spawnables.def != null;

            if (flag)
            {
                Faction faction = Faction.OfPlayer;
                bool    flag2   = spawnables.def.race != null;
                if (flag2)
                {
                    bool flag3 = spawnables.kindDef == null;
                    if (flag3)
                    {
                        Log.Error("Missing kinddef");
                    }
                    else
                    {
                        PawnSummoned newPawn = (PawnSummoned)PawnGenerator.GeneratePawn(spawnables.kindDef, faction);
                        newPawn.Spawner   = this.CasterPawn;
                        newPawn.Temporary = false;
                        if (newPawn.Faction != Faction.OfPlayerSilentFail)
                        {
                            Log.Message("Failing check for newpawn faction: " + newPawn.Faction);
                            newPawn.SetFaction(this.CasterPawn.Faction, null);
                        }
                        Log.Message("attempting to spawn " + newPawn.def.defName + " of " + newPawn.kindDef.defName + " of faction " + newPawn.Faction);
                        GenSpawn.Spawn(newPawn, position, Find.VisibleMap);
                        if (newPawn.Faction != null && newPawn.Faction != Faction.OfPlayer)
                        {
                            Lord lord = null;
                            if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                            {
                                Predicate <Thing> validator = (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null;
                                Pawn p2 = (Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, validator, null);
                                lord = p2.GetLord();
                            }
                            bool flag4 = lord == null;
                            if (flag4)
                            {
                                LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                                lord = LordMaker.MakeNewLord(faction, lordJob, Find.VisibleMap, null);
                            }
                            lord.AddPawn(newPawn);
                        }
                    }
                }
                else
                {
                    Log.Message("Missing race");
                }
            }
        }
Пример #11
0
        private static void CallDeepstrikeOf()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (PawnKindDef localKindDef2 in from f in DefDatabase <PawnKindDef> .AllDefs
                     //  where f.RoyalTitlesAwardableInSeniorityOrderForReading.Count > 0
                     orderby f.defName
                     select f)
            {
                PawnKindDef localKindDef = localKindDef2;

                /*
                 * if (!localKindDef.HasModExtension<DeepStrikeExtension>())
                 * {
                 *  continue;
                 * }
                 */
                list.Add(new DebugMenuOption(localKindDef.defName, DebugMenuOptionMode.Tool, delegate()
                {
                    List <FloatMenuOption> list2 = new List <FloatMenuOption>();
                    IntVec3 cell = UI.MouseCell();
                    for (int i = 0; i < 6; i++)
                    {
                        DeepStrikeType strikeType = (DeepStrikeType)i;
                        list2.Add(new FloatMenuOption(DeepStrikeUtility.DeepstrikeArrivalmode(strikeType) + " - ", delegate()
                        {
                            Faction faction = FactionUtility.DefaultFactionFrom(localKindDef.defaultFactionType);
                            Pawn newPawn    = PawnGenerator.GeneratePawn(localKindDef, faction);
                            DeepStrikeUtility.DropThingsNear(cell, Find.CurrentMap, Gen.YieldSingle <Thing>(newPawn), 110, false, false, true, strikeType);
                            if (faction != null && faction != Faction.OfPlayer)
                            {
                                Lord lord = null;
                                if (Find.CurrentMap.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                                {
                                    lord = ((Pawn)GenClosest.ClosestThing_Global(cell, Find.CurrentMap.mapPawns.SpawnedPawnsInFaction(faction), 99999f, (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null, null)).GetLord();
                                }
                                if (lord == null)
                                {
                                    LordJob_DefendPoint lordJob = new LordJob_DefendPoint(cell, null, false, true);
                                    lord = LordMaker.MakeNewLord(faction, lordJob, Find.CurrentMap, null);
                                }
                                lord.AddPawn(newPawn);
                            }
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                    Find.WindowStack.Add(new FloatMenu(list2));
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
Пример #12
0
        private static void SpawnPawn(int skill, AorB ab, HediffDef hediffs, bool AffectsEye, SkillDef skilldef)
        {
            Faction faction = FactionUtility.DefaultFactionFrom(ft: ab.fac);

            var pawngen = new PawnGenerationRequest(
                kind: ab.pkd,
                faction: faction,
                context: PawnGenerationContext.NonPlayer,
                mustBeCapableOfViolence: true,
                forceGenerateNewPawn: true,
                worldPawnFactionDoesntMatter: true
                );

            Pawn newPawn = PawnGenerator.GeneratePawn(request: pawngen);

            newPawn.skills.GetSkill(skillDef: skilldef).Level = skill;

            newPawn.story.traits.allTraits.RemoveAll(match: trt => ab.undesired.Contains(item: trt.def.defName));

            if (hediffs != null)
            {
                if (AffectsEye)
                {
                    foreach (BodyPartRecord bpr in newPawn.RaceProps.body.GetPartsWithTag(tag: Defs_Rimworld.EyeTag))
                    {
                        newPawn.health.AddHediff(def: hediffs, part: bpr, dinfo: null, result: null);
                    }
                }
                else
                {
                    newPawn.health.AddHediff(def: hediffs);
                }
            }

            GenSpawn.Spawn(newThing: newPawn, loc: UI.MouseCell(), map: Find.CurrentMap, wipeMode: WipeMode.Vanish);

            if (faction != null && faction != Faction.OfPlayer)
            {
                Lord lord = null;

                var lordJob = new LordJob_DefendPoint(point: newPawn.Position);
                lord = LordMaker.MakeNewLord(faction: faction, lordJob: lordJob, map: Find.CurrentMap, startingPawns: null);


                lord.AddPawn(p: newPawn);
            }
        }
Пример #13
0
        public bool SpawnRandomWildAnimalAt(Map map, IntVec3 loc)
        {
            PawnKindDef pawnKindDef = (from a in biome1.AllWildAnimals
                                       where map.mapTemperature.SeasonAcceptableFor(a.race)
                                       select a).RandomElementByWeight((PawnKindDef def) => biome1.CommonalityOfAnimal(def) / def.wildGroupSize.Average);

            if (pawnKindDef == null)
            {
                Log.Error("No spawnable animals right now.");
                return(false);
            }
            int randomInRange = pawnKindDef.wildGroupSize.RandomInRange;
            int radius        = Mathf.CeilToInt(Mathf.Sqrt((float)pawnKindDef.wildGroupSize.max));

            for (int i = 0; i < randomInRange; i++)
            {
                IntVec3 loc2    = CellFinder.RandomClosewalkCellNear(loc, map, radius, null);
                Faction faction = FactionUtility.DefaultFactionFrom(pawnKindDef.defaultFactionType);

                //Pawn newThing = PawnGenerator.GeneratePawn(pawnKindDef, faction);

                Pawn newPawn = PawnGenerator.GeneratePawn(pawnKindDef, faction);
                GenSpawn.Spawn(newPawn, loc2, map);
                if (faction != null && faction != Faction.OfPlayer)
                {
                    Lord lord = null;

                    LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                    lord = LordMaker.MakeNewLord(faction, lordJob, newPawn.Map, null);

                    /* if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                     * {
                     *   Pawn p2 = (Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null, null);
                     *   lord = p2.GetLord();
                     * }
                     * if (lord == null)
                     * {
                     *
                     * }*/
                    lord.AddPawn(newPawn);
                }


                //GenSpawn.Spawn(newThing, loc2, map);
            }
            return(true);
        }
Пример #14
0
        private void TrySpawnMadSailors()
        {
            List <Pawn> lordList = new List <Pawn>();
            Faction     faction  = Find.FactionManager.FirstFactionOfDef(CultsDefOf.Cults_Sailors);

            Cthulhu.Utility.DebugReport(faction.ToString());
            LordJob_DefendPoint lordJob = new LordJob_DefendPoint(this.Position);

            if (this.pointsLeft <= 0f)
            {
                return;
            }
            if (this.lord == null)
            {
                this.lord = LordMaker.MakeNewLord(faction, lordJob, Map, lordList);
            }
            while (pointsLeft > 0f)
            {
                IntVec3 center;
                if ((from cell in GenAdj.CellsAdjacent8Way(this)
                     where cell.Walkable(Map)
                     select cell).TryRandomElement(out center))
                {
                    PawnGenerationRequest request = new PawnGenerationRequest(CultsDefOf.Cults_Sailor, faction, PawnGenerationContext.NonPlayer, Map.Tile, false, false, false, false, true, true, 20f, false, true, true, false, false, false, false, null, null, null, null);
                    Pawn pawn = PawnGenerator.GeneratePawn(request);
                    if (GenPlace.TryPlaceThing(pawn, center, Map, ThingPlaceMode.Near, null))
                    {
                        if (LordUtility.GetLord(pawn) != null)
                        {
                            LordUtility.GetLord(pawn).Cleanup();
                            LordUtility.GetLord(pawn).CurLordToil.Cleanup();
                            LordUtility.GetLord(pawn).LordJob.Cleanup();
                        }
                        this.lord.AddPawn(pawn);
                        this.pointsLeft -= pawn.kindDef.combatPower;
                        Cthulhu.Utility.ApplySanityLoss(pawn, 1f);
                        continue;
                    }
                    //Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard);
                }
            }
            AvoidGridMaker.RegenerateAvoidGridsFor(faction, Map);
            this.pointsLeft = 0f;
            SoundDefOf.PsychicPulseGlobal.PlayOneShotOnCamera();
            return;
        }
        public override void Resolve(ResolveParams rp)
        {
            int? mechanoidsCount = rp.mechanoidsCount;
            int  num             = (mechanoidsCount == null) ? SymbolResolver_RandomMechanoidGroup.DefaultMechanoidCountRange.RandomInRange : mechanoidsCount.Value;
            Lord lord            = rp.singlePawnLord;

            if (lord == null && num > 0)
            {
                Map     map = BaseGen.globalSettings.map;
                IntVec3 point;
                LordJob lordJob;
                if (Rand.Bool && (from x in rp.rect.Cells
                                  where !x.Impassable(map)
                                  select x).TryRandomElement(out point))
                {
                    lordJob = new LordJob_DefendPoint(point);
                }
                else
                {
                    lordJob = new LordJob_AssaultColony(Faction.OfMechanoids, false, false, false, false, false);
                }
                lord = LordMaker.MakeNewLord(Faction.OfMechanoids, lordJob, map, null);
            }
            for (int i = 0; i < num; i++)
            {
                PawnKindDef pawnKindDef = rp.singlePawnKindDef;
                if (pawnKindDef == null)
                {
                    pawnKindDef = (from kind in DefDatabase <PawnKindDef> .AllDefsListForReading
                                   where kind.RaceProps.IsMechanoid
                                   select kind).RandomElementByWeight((PawnKindDef kind) => 1f / kind.combatPower);
                }
                ResolveParams resolveParams = rp;
                resolveParams.singlePawnKindDef = pawnKindDef;
                resolveParams.singlePawnLord    = lord;
                resolveParams.faction           = Faction.OfMechanoids;
                BaseGen.symbolStack.Push("pawn", resolveParams);
            }
        }
Пример #16
0
        public void SpawnPawn(SpawnThings spawnables, Faction faction)
        {
            Pawn newPawn = PawnGenerator.GeneratePawn(spawnables.kindDef, faction);

            GenSpawn.Spawn(newPawn, this.PositionHeld, Find.VisibleMap);
            if (faction != null && faction != Faction.OfPlayer)
            {
                Lord lord = null;
                if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                {
                    Predicate <Thing> validator = (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null;
                    Pawn p2 = (Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, validator);
                    lord = p2.GetLord();
                }
                if (lord == null)
                {
                    LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                    lord = LordMaker.MakeNewLord(faction, lordJob, Find.VisibleMap, null);
                }
                lord.AddPawn(newPawn);
            }
        }
Пример #17
0
        void LaunchSecurityDropPods(int dropPodsNumber, PawnKindDef securityForcesDef, bool assaultColony)
        {
            IntVec3     dropPodSpot;
            List <Pawn> securityForcesList = new List <Pawn>();

            if ((dropPodsNumber == 0) || (securityForcesDef == null))
            {
                return;
            }
            OG_Inhabitants.InitializeUniformColorAccordingToBiome(); // Necessary in case of small outpost (no inhabitants were generated).
            for (int soldierIndex = 0; soldierIndex < dropPodsNumber; soldierIndex++)
            {
                bool validDropPodCellIsFound = DropCellFinder.TryFindDropSpotNear(this.dropZoneCenter, out dropPodSpot, true, false);
                if (validDropPodCellIsFound)
                {
                    Pawn soldier = OG_Inhabitants.GeneratePawn(securityForcesDef);
                    securityForcesList.Add(soldier);
                    DropPodUtility.MakeDropPodAt(dropPodSpot, new DropPodInfo
                    {
                        SingleContainedThing = soldier,
                        openDelay            = 240,
                        leaveSlag            = false
                    });
                }
            }

            LordJob lordJob;

            if (assaultColony)
            {
                lordJob = new LordJob_AssaultColony(OG_Util.FactionOfMAndCo, true, true, false);
            }
            else
            {
                lordJob = new LordJob_DefendPoint(this.dropZoneCenter);
            }
            Lord lord = LordMaker.MakeNewLord(OG_Util.FactionOfMAndCo, lordJob, securityForcesList);
        }
Пример #18
0
        private void MakeBlueprintRoom(CellRect mapRect, Map map, MapGeneratorBlueprintDef blueprint, ThingDef stuffDef)
        {
            blueprint.buildingData = CleanUpBlueprintData(blueprint.buildingData);
            blueprint.floorData    = CleanUpBlueprintData(blueprint.floorData);
            blueprint.pawnData     = CleanUpBlueprintData(blueprint.pawnData);
            blueprint.itemData     = CleanUpBlueprintData(blueprint.itemData);

            if (blueprint.buildingData == null && blueprint.floorData == null)
            {
                Log.ErrorOnce(string.Format("After cleaning the BlueprintData and FloorData of blueprint {0} -> both are null, nothing will be done!", blueprint.defName), 313001);
                return;
            }

            IntVec3 spawnBaseCell = new IntVec3(mapRect.BottomLeft.x, mapRect.TopRight.y, mapRect.TopRight.z);
            IntVec3 spawnCell;

            foreach (IntVec3 cell in mapRect)
            {
                // Check all cells and abort if there is something indestructible found
                if (!CheckCell(cell, map))
                {
                    return;
                }
            }

            allSpawnedPawns = null;
            try
            {
                // Work through blueprint. Note: top-left to bottom-right
                for (int zn = 0; zn < blueprint.size.z; zn++)
                {
                    for (int x = 0; x < blueprint.size.x; x++)
                    {
                        //// map can be clipped, don't work with the clipped parts
                        //if (x > mapRect.Width - 1 || zn > mapRect.Height - 1)
                        //    continue;

                        spawnCell = spawnBaseCell + new IntVec3(x, 0, -zn);

                        int         itemPos     = x + blueprint.size.x * zn;
                        ThingDef    thingDef    = TryGetThingDefFromBuildingData(blueprint, itemPos);
                        Rot4        thingRot    = TryGetRotationFromBuildingData(blueprint, itemPos);
                        TerrainDef  terrainDef  = TryGetTerrainDefFromFloorData(blueprint, itemPos);
                        PawnKindDef pawnKindDef = TryGetPawnKindDefFromPawnData(blueprint, itemPos);
                        ThingDef    itemDef     = TryGetItemDefFromItemData(blueprint, itemPos);

                        List <Thing> list = map.thingGrid.ThingsListAt(spawnCell);
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (list[i].def == thingDef)
                            {
                                continue;
                            }
                        }

                        //Only clear the space, if something will be made here
                        if (thingDef != null || terrainDef != null || pawnKindDef != null || itemDef != null)
                        {
                            ClearCell(spawnCell, map);
                        }

                        if ((blueprint.canHaveHoles ||
                             (MapGenerator_ModSettings.createAllNonPawnBPsWithHoles && (blueprint.pawnLegend == null || blueprint.pawnLegend.Count <= 0))) &&
                            Rand.Value < MapGenerator_ModSettings.chanceForHoles)
                        {
                            continue;
                        }

                        // If placed on water, increase the hole chance, if no pawns are to be placed!
                        if (spawnCell.GetTerrain(map).defName.ToLower().Contains("water") &&
                            (blueprint.pawnLegend == null || blueprint.pawnLegend.Count <= 0) &&
                            Rand.Value < MapGenerator_ModSettings.chanceForHolesOnWater)
                        {
                            continue;
                        }

                        TrySetCellAs(spawnCell, map, thingDef, thingRot, stuffDef, terrainDef, pawnKindDef, itemDef, blueprint);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Warning("Misc. MapGenerator -- Error with blueprint '" + blueprint.defName + "'. Placement position at " +
                            mapRect.CenterCell.ToString() + " on a map of the size " + map.Size.ToString() + "\n" +
                            ex.Message + "\n" + ex.StackTrace);
            }


            // If pawns are spawned, place ancient shrine trigger
            if (allSpawnedPawns != null && allSpawnedPawns.Count > 0)
            {
                int    nextSignalTagID = Find.UniqueIDsManager.GetNextSignalTagID();
                string signalTag       = "ancientTempleApproached-" + nextSignalTagID;
                SignalAction_Letter signalAction_Letter = (SignalAction_Letter)ThingMaker.MakeThing(ThingDefOf.SignalAction_Letter, null);
                signalAction_Letter.signalTag = signalTag;
                signalAction_Letter.letter    = LetterMaker.MakeLetter("LetterLabelAncientShrineWarning".Translate(), "AncientShrineWarning".Translate(), LetterDefOf.NeutralEvent, new TargetInfo(mapRect.CenterCell, map, false));
                GenSpawn.Spawn(signalAction_Letter, mapRect.CenterCell, map);
                RectTrigger rectTrigger = (RectTrigger)ThingMaker.MakeThing(ThingDefOf.RectTrigger, null);
                rectTrigger.signalTag         = signalTag;
                rectTrigger.Rect              = mapRect.ExpandedBy(1).ClipInsideMap(map);
                rectTrigger.destroyIfUnfogged = true;
                GenSpawn.Spawn(rectTrigger, mapRect.CenterCell, map);
            }

            // also if pawns are spawned make the appropriate LordJob
            LordJob lordJob;

            if (allSpawnedPawns != null && allSpawnedPawns.Count > 0)
            {
                if (blueprint.factionSelection == FactionSelection.friendly)
                {
                    lordJob = new LordJob_AssistColony(allSpawnedPawns[0].Faction, allSpawnedPawns[0].Position);
                }
                else
                {
                    if (Rand.Value < 0.5f)
                    {
                        lordJob = new LordJob_DefendPoint(allSpawnedPawns[0].Position);
                    }
                    else
                    {
                        lordJob = new LordJob_AssaultColony(allSpawnedPawns[0].Faction, false, false, false, false, false);
                    }
                }
                LordMaker.MakeNewLord(allSpawnedPawns[0].Faction, lordJob, map, allSpawnedPawns);

                allSpawnedPawns = null;
            }
        }
Пример #19
0
        public void SingleSpawnLoop(SpawnThings spawnables, IntVec3 position, Map map)
        {
            bool flag = spawnables.def != null;

            if (flag)
            {
                Faction faction = pawn.Faction;
                bool    flag2   = spawnables.def.race != null;
                if (flag2)
                {
                    bool flag3 = spawnables.kindDef == null;
                    if (flag3)
                    {
                        Log.Error("Missing kinddef");
                    }
                    else
                    {
                        newPawn = (TMPawnSummoned)PawnGenerator.GeneratePawn(spawnables.kindDef, faction);
                        newPawn.validSummoning = true;
                        newPawn.Spawner        = this.Caster;
                        newPawn.Temporary      = true;
                        newPawn.TicksToDestroy = this.duration;
                        //if (newPawn.Faction != Faction.OfPlayerSilentFail)
                        //{
                        //    newPawn.SetFaction(this.Caster.Faction, null);
                        //}
                        try
                        {
                            GenSpawn.Spawn(newPawn, position, map, Rot4.North, WipeMode.Vanish, false);
                            //GenPlace.TryPlaceThing(newPawn, position, map, ThingPlaceMode.Near, null, null);
                        }
                        catch
                        {
                            pawn.GetComp <CompAbilityUserMagic>().Mana.CurLevel += pawn.GetComp <CompAbilityUserMagic>().ActualManaCost(TorannMagicDefOf.TM_SummonElemental);
                            Log.Message("TM_Exception".Translate(
                                            pawn.LabelShort,
                                            this.def.defName
                                            ));
                            this.Destroy(DestroyMode.Vanish);
                        }
                        if (newPawn.Faction != null && newPawn.Faction != Faction.OfPlayer)
                        {
                            Lord lord = null;
                            if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                            {
                                Predicate <Thing> validator = (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null;
                                Pawn p2 = (Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, validator, null);
                                lord = p2.GetLord();
                            }
                            bool flag4 = lord == null;
                            if (flag4)
                            {
                                LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                                lord = LordMaker.MakeNewLord(faction, lordJob, map, null);
                            }
                            else
                            {
                                try
                                {
                                    //PawnDuty duty = this.pawn.mindState.duty;
                                    newPawn.mindState.duty = new PawnDuty(DutyDefOf.Defend);
                                }
                                catch
                                {
                                    Log.Message("error attempting to assign a duty to elemental");
                                }
                            }
                            lord.AddPawn(newPawn);
                        }
                    }
                }
                else
                {
                    Log.Message("Missing race");
                }
            }
        }
Пример #20
0
        public void SingleSpawnLoop(SpawnThings spawnables, IntVec3 position, Map map)
        {
            bool flag = spawnables.def != null;

            if (flag)
            {
                Faction faction = this.launcher.Faction;
                bool    flag2   = spawnables.def.race != null;
                if (flag2)
                {
                    bool flag3 = spawnables.kindDef == null;
                    if (flag3)
                    {
                        Log.Error("Missing kinddef");
                    }
                    else
                    {
                        TMPawnSummoned newPawn = new TMPawnSummoned();
                        newPawn = (TMPawnSummoned)PawnGenerator.GeneratePawn(spawnables.kindDef, faction);
                        newPawn.validSummoning = true;
                        newPawn.Spawner        = this.casterPawn;
                        newPawn.Temporary      = true;
                        newPawn.TicksToDestroy = this.duration;
                        try
                        {
                            GenSpawn.Spawn(newPawn, position, map);
                            this.demonPawn = newPawn;
                        }
                        catch
                        {
                            this.age = this.duration;
                            Log.Message("TM_Exception".Translate(
                                            this.casterPawn.LabelShort,
                                            this.def.defName
                                            ));
                            this.Destroy(DestroyMode.Vanish);
                        }
                        if (newPawn.Faction != null && newPawn.Faction != Faction.OfPlayer)
                        {
                            Lord lord = null;
                            if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                            {
                                Predicate <Thing> validator = (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null;
                                Pawn p2 = (Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, validator, null);
                                lord = p2.GetLord();
                            }
                            bool flag4 = lord == null;
                            if (flag4)
                            {
                                LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                                lord = LordMaker.MakeNewLord(faction, lordJob, map, null);
                            }
                            lord.AddPawn(newPawn);
                        }
                    }
                }
                else
                {
                    Log.Message("Missing race");
                }
            }
        }
Пример #21
0
        public void SingleSpawnLoop(SpawnThings spawnables, IntVec3 position, Map map)
        {
            bool flag = spawnables.def != null;

            if (flag)
            {
                Faction faction = pawn.Faction;
                bool    flag2   = spawnables.def.race != null;
                if (flag2)
                {
                    bool flag3 = spawnables.kindDef == null;
                    if (flag3)
                    {
                        Log.Error("Missing kinddef");
                    }
                    else
                    {
                        newPawn                = (TMPawnSummoned)PawnGenerator.GeneratePawn(spawnables.kindDef, faction);
                        newPawn.Spawner        = this.Caster;
                        newPawn.Temporary      = true;
                        newPawn.TicksToDestroy = this.duration;
                        if (newPawn.Faction != Faction.OfPlayerSilentFail)
                        {
                            newPawn.SetFaction(this.Caster.Faction, null);
                        }
                        try
                        {
                            GenSpawn.Spawn(newPawn, position, Find.VisibleMap);
                        }
                        catch
                        {
                            pawn.GetComp <CompAbilityUserMagic>().Mana.CurLevel += pawn.GetComp <CompAbilityUserMagic>().ActualManaCost(TorannMagicDefOf.TM_SummonElemental);
                            Log.Message("TM_Exception".Translate(new object[]
                            {
                                pawn.LabelShort,
                                this.def.defName
                            }));
                            this.Destroy(DestroyMode.Vanish);
                        }
                        if (newPawn.Faction != null && newPawn.Faction != Faction.OfPlayer)
                        {
                            Lord lord = null;
                            if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                            {
                                Predicate <Thing> validator = (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null;
                                Pawn p2 = (Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, validator, null);
                                lord = p2.GetLord();
                            }
                            bool flag4 = lord == null;
                            if (flag4)
                            {
                                LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                                lord = LordMaker.MakeNewLord(faction, lordJob, Find.VisibleMap, null);
                            }
                            lord.AddPawn(newPawn);
                        }
                    }
                }
                else
                {
                    Log.Message("Missing race");
                }
            }
        }
        // Token: 0x06000004 RID: 4 RVA: 0x00002428 File Offset: 0x00000628
        private void MakeBlueprintRoom(CellRect mapRect, MapGeneratorBlueprintDef blueprint, Map map, ThingDef stuffDef)
        {
            blueprint.buildingData = CleanUpBlueprintData(blueprint.buildingData);
            blueprint.floorData    = CleanUpBlueprintData(blueprint.floorData);
            blueprint.pawnData     = CleanUpBlueprintData(blueprint.pawnData);
            blueprint.itemData     = CleanUpBlueprintData(blueprint.itemData);
            if (blueprint.buildingData == null && blueprint.floorData == null)
            {
                Log.ErrorOnce(
                    $"After cleaning the BlueprintData and FloorData of blueprint {blueprint.defName} -> both are null, nothing will be done!",
                    313001);
            }
            else
            {
                var a = new IntVec3(mapRect.BottomLeft.x, mapRect.TopRight.y, mapRect.TopRight.z);
                foreach (var c in mapRect)
                {
                    if (!CheckCell(c, map))
                    {
                        return;
                    }
                }

                allSpawnedPawns = null;
                for (var i = 0; i < blueprint.size.z; i++)
                {
                    for (var j = 0; j < blueprint.size.x; j++)
                    {
                        var c2          = a + new IntVec3(j, 0, -i);
                        var itemPos     = j + (blueprint.size.x * i);
                        var thingDef    = TryGetThingDefFromBuildingData(blueprint, itemPos);
                        var thingRot    = TryGetRotationFromBuildingData(blueprint, itemPos);
                        var terrainDef  = TryGetTerrainDefFromFloorData(blueprint, itemPos);
                        var pawnKindDef = TryGetPawnKindDefFromPawnData(blueprint, itemPos);
                        var thingDef2   = TryGetItemDefFromItemData(blueprint, itemPos);
                        var list        = map.thingGrid.ThingsListAt(c2);
                        foreach (var thing in list)
                        {
                            if (thing.def == thingDef)
                            {
                            }
                        }

                        if (thingDef != null || terrainDef != null || pawnKindDef != null || thingDef2 != null)
                        {
                            ClearCell(c2, map);
                        }

                        if (!(blueprint.canHaveHoles && Rand.Value < 0.08f))
                        {
                            TrySetCellAs(c2, thingDef, thingRot, map, stuffDef, terrainDef, pawnKindDef, thingDef2,
                                         blueprint);
                        }
                    }
                }

                if (allSpawnedPawns != null && allSpawnedPawns.Count > 0)
                {
                    var rectTrigger = (RectTrigger)ThingMaker.MakeThing(ThingDefOf.RectTrigger);
                    rectTrigger.Rect = mapRect.ExpandedBy(1).ClipInsideMap(map);
                    //rectTrigger.letter = new Letter(Translator.Translate("LetterLabelAncientShrineWarning"), Translator.Translate("AncientShrineWarning"), 1, mapRect.CenterCell);
                    rectTrigger.destroyIfUnfogged = false;
                    GenSpawn.Spawn(rectTrigger, mapRect.CenterCell, map);
                }

                if (allSpawnedPawns == null || allSpawnedPawns.Count <= 0)
                {
                    return;
                }

                LordJob lordJob;
                if (blueprint.factionSelection == FactionSelection.friendly)
                {
                    lordJob = new LordJob_AssistColony(allSpawnedPawns[0].Faction, allSpawnedPawns[0].Position);
                }
                else
                {
                    if (Rand.Value < 0.5f)
                    {
                        lordJob = new LordJob_DefendPoint(allSpawnedPawns[0].Position);
                    }
                    else
                    {
                        lordJob = new LordJob_AssaultColony(allSpawnedPawns[0].Faction, false, false);
                    }
                }

                LordMaker.MakeNewLord(allSpawnedPawns[0].Faction, lordJob, map, allSpawnedPawns);
                allSpawnedPawns = null;
            }
        }
Пример #23
0
        public static void SpawnPawns(List <MapObject> mapObjects, Map map, Faction forceFaction, List <Pawn> spawnedPawns, Lord forceLord)
        {
            foreach (var thing in mapObjects)
            {
                ThingData data = thing.key;

                if (data.Kind != null)
                {
                    Faction faction = forceFaction;
                    if (faction == null)
                    {
                        faction = Find.FactionManager.FirstFactionOfDef(data.Faction);
                    }

                    if (faction != null)
                    {
                        foreach (var pos in thing.value)
                        {
                            Pawn pawn = PawnGenerator.GeneratePawn(data.Kind, faction);

                            if (pawn.RaceProps.Animal && data.Faction == null)
                            {
                                pawn.SetFaction(null);
                            }

                            if (pawn.RaceProps.FleshType == FleshTypeDefOf.Insectoid && pawn.Faction != Faction.OfInsects)
                            {
                                pawn.SetFaction(Faction.OfInsects);
                            }

                            if (pawn.RaceProps.IsMechanoid && pawn.Faction != Faction.OfMechanoids)
                            {
                                pawn.SetFaction(Faction.OfMechanoids);
                            }

                            pawn = GenSpawn.Spawn(pawn, pos, map) as Pawn;
                            spawnedPawns.Add(pawn);

                            if (forceLord == null)
                            {
                                LordJob_DefendPoint lordJob = new LordJob_DefendPoint(pawn.Position);
                                Lord lord = LordMaker.MakeNewLord(faction, lordJob, map);
                                lord.numPawnsLostViolently = int.MaxValue;

                                lord.AddPawn(pawn);
                            }
                            else
                            {
                                forceLord.AddPawn(pawn);
                            }
                        }
                    }
                    else
                    {
                        foreach (var pos in thing.value)
                        {
                            Pawn pawn = PawnGenerator.GeneratePawn(data.Kind, faction);
                            pawn = GenSpawn.Spawn(pawn, pos, map) as Pawn;
                        }
                    }
                }
            }
        }
        public void SendAssaultWave(Faction faction, bool finalAssault = false)
        {
            Lord        assaultLord = null;
            Lord        defendLord  = null;
            List <Lord> allLords    = this.SingleMap.lordManager.lords;

            for (int i = 0; i < allLords.Count; i++)
            {
                Lord lord = allLords[i];
                if (lord.faction != null && lord.faction == faction)
                {
                    if (lord.CurLordToil != null && lord.CurLordToil is LordToil_DefendPoint)
                    {
                        defendLord = lord;
                        LordToil_DefendPoint lordToil = defendLord.CurLordToil as LordToil_DefendPoint;
                        lordToil.SetDefendPoint(this.centerLocation.ToIntVec3);
                    }
                    else if (lord.CurLordToil != null && lord.CurLordToil is LordToil_AssaultColony)
                    {
                        assaultLord = lord;
                    }
                }
            }
            if (assaultLord == null)
            {
                LordJob_AssaultColony lordJob = new LordJob_AssaultColony(faction, false, false, false, false, false);
                Traverse.Create(root: lordJob).Field(name: "canTimeoutOrFlee").SetValue(false);
                assaultLord = LordMaker.MakeNewLord(faction, lordJob, this.SingleMap, null);
            }
            if (defendLord == null)
            {
                LordJob_DefendPoint lordJob = new LordJob_DefendPoint(this.centerLocation.ToIntVec3);
                defendLord = LordMaker.MakeNewLord(faction, lordJob, this.SingleMap, null);
            }

            List <Pawn> allPawns = this.SingleMap.mapPawns.AllPawnsSpawned;

            for (int i = 0; i < allPawns.Count; i++)
            {
                if (allPawns[i].Faction != null && allPawns[i].Faction == faction)
                {
                    Lord pawnLord = allPawns[i].GetLord();
                    if (allPawns[i].def == TorannMagicDefOf.TM_SkeletonR && pawnLord != null)
                    {
                        if (pawnLord != null)
                        {
                            if (pawnLord != assaultLord && (Rand.Chance(.4f) || finalAssault))
                            {
                                allPawns[i].GetLord()?.Notify_PawnLost(allPawns[i], PawnLostCondition.ForcedToJoinOtherLord);
                                assaultLord.AddPawn(allPawns[i]);
                            }
                        }
                        else
                        {
                            defendLord.AddPawn(allPawns[i]);
                        }
                    }
                    if (allPawns[i].def == TorannMagicDefOf.TM_GiantSkeletonR && pawnLord != null)
                    {
                        if (pawnLord != null)
                        {
                            if (pawnLord != assaultLord && (Rand.Chance(.25f) || finalAssault))
                            {
                                allPawns[i].GetLord()?.Notify_PawnLost(allPawns[i], PawnLostCondition.ForcedToJoinOtherLord);
                                assaultLord.AddPawn(allPawns[i]);
                            }
                        }
                        else
                        {
                            defendLord.AddPawn(allPawns[i]);
                        }
                    }
                    if (allPawns[i].def == TorannMagicDefOf.TM_SkeletonLichR)
                    {
                        if (finalAssault)
                        {
                            if (pawnLord != null && pawnLord != assaultLord)
                            {
                                allPawns[i].GetLord()?.Notify_PawnLost(allPawns[i], PawnLostCondition.ForcedToJoinOtherLord);
                                //pawnLord.ownedPawns.Remove(allPawns[i]);
                            }
                            assaultLord.AddPawn(allPawns[i]);
                        }
                    }
                }
            }
        }
        public override void SpawnSetup(Map map, bool bla)
        {
            //Log.Message("Building_SignOfDagon SpawnSetup");
            base.SpawnSetup(map, bla);
            Building_SignOfDagon toDestroy = null;

            foreach (var bld in map.listerBuildings.allBuildingsColonist)
            {
                if (bld == this)
                {
                    continue;
                }

                if (bld is Building_SignOfDagon dagon)
                {
                    toDestroy = dagon;
                }
            }

            if (toDestroy != null)
            {
                toDestroy.Destroy();
            }

            var list = map.GetComponent <MapComponent_SacrificeTracker>().defendTheBroodPawns;

            if (list == null)
            {
                return;
            }

            if (list.Count <= 0)
            {
                return;
            }

            Faction f;

            if (Utility.IsCosmicHorrorsLoaded())
            {
                f = Find.FactionManager.FirstFactionOfDef(FactionDef.Named("ROM_DeepOne"));
            }
            else
            {
                Messages.Message("Cosmic horrors mod is not loaded. Using insectoids instead.",
                                 MessageTypeDefOf.NegativeEvent);
                f = Find.FactionManager.FirstFactionOfDef(FactionDef.Named("ROM_DeepOneAlt"));
            }

            Lord lord = null;
            //Log.Message("Building_SignOfDagon LordJob_DefendPoint");
            var lordJob = new LordJob_DefendPoint(Position);

            Utility.TemporaryGoodwill(f);
            foreach (var current in list)
            {
                if (lord == null)
                {
                    lord = current.GetLord();
                }

                if (lord != null)
                {
                    map.lordManager.RemoveLord(lord);
                }
            }

            LordMaker.MakeNewLord(f, lordJob, map, list);
        }
Пример #26
0
        public void SingleSpawnLoop(SpawnThings spawnables, IntVec3 position, Map map)
        {
            bool flag = spawnables.def != null;

            if (flag)
            {
                Faction faction = pawn.Faction;
                bool    flag2   = spawnables.def.race != null;
                if (flag2)
                {
                    bool flag3 = spawnables.kindDef == null;
                    if (flag3)
                    {
                        Log.Error("Missing kinddef");
                    }
                    else
                    {
                        newPawn                = (TMPawnSummoned)PawnGenerator.GeneratePawn(spawnables.kindDef, faction);
                        newPawn.Spawner        = this.Caster;
                        newPawn.Temporary      = true;
                        newPawn.TicksToDestroy = this.duration;
                        //if (newPawn.Faction != Faction.OfPlayerSilentFail)
                        //{
                        //    newPawn.SetFaction(this.Caster.Faction, null);
                        //}
                        //newPawn.playerSettings.master = this.Caster;
                        if (comp.summonedMinions.Count >= 4)
                        {
                            Thing dismissMinion = comp.summonedMinions[0];
                            if (dismissMinion != null && dismissMinion.Position.IsValid)
                            {
                                MoteMaker.ThrowSmoke(dismissMinion.Position.ToVector3(), base.Map, 1);
                                MoteMaker.ThrowHeatGlow(dismissMinion.Position, base.Map, 1);
                            }
                            comp.summonedMinions.Remove(comp.summonedMinions[0]);
                            if (!dismissMinion.Destroyed)
                            {
                                dismissMinion.Destroy();
                                Messages.Message("TM_SummonedCreatureLimitExceeded".Translate(new object[]
                                {
                                    this.launcher.LabelShort
                                }), MessageTypeDefOf.NeutralEvent);
                            }
                            if (comp.summonedMinions.Count > 4)
                            {
                                while (comp.summonedMinions.Count > 4)
                                {
                                    Pawn excessMinion = comp.summonedMinions[comp.summonedMinions.Count - 1] as Pawn;
                                    comp.summonedMinions.Remove(excessMinion);
                                    if (excessMinion != null && !excessMinion.Dead && !excessMinion.Destroyed)
                                    {
                                        excessMinion.Destroy();
                                    }
                                }
                            }
                        }
                        try
                        {
                            GenSpawn.Spawn(newPawn, position, this.Map);
                        }
                        catch
                        {
                            this.age            = this.duration;
                            comp.Mana.CurLevel += comp.ActualManaCost(TorannMagicDefOf.TM_SummonMinion);
                            Log.Message("TM_Exception".Translate(new object[]
                            {
                                pawn.LabelShort,
                                this.def.defName
                            }));
                            this.Destroy(DestroyMode.Vanish);
                        }

                        comp.summonedMinions.Add(newPawn);
                        if (newPawn.Faction != null && newPawn.Faction != Faction.OfPlayer)
                        {
                            Lord lord = null;
                            if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                            {
                                Predicate <Thing> validator = (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null;
                                Pawn p2 = (Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, validator, null);
                                lord = p2.GetLord();
                            }
                            bool flag4 = lord == null;
                            if (flag4)
                            {
                                LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                                lord = LordMaker.MakeNewLord(faction, lordJob, this.Map, null);
                            }
                            lord.AddPawn(newPawn);
                        }
                    }
                }
                else
                {
                    Log.Message("Missing race");
                }
            }
        }
Пример #27
0
        private bool TrySpawnPawn(out Pawn pawn)
        {
            if (ModLister.HasActiveModWithName("Alpha Animals"))
            {
                if (!this.canSpawnPawns)
                {
                    pawn = null;
                    return(false);
                }

                int totalCount = 0;

                IEnumerable <string> listUnique = Props.spawnablePawnKinds.Distinct();
                foreach (string pawnkindInList in listUnique)
                {
                    totalCount += this.parent.Map.listerThings.ThingsOfDef(ThingDef.Named(pawnkindInList)).Count;
                }


                if (totalCount < 25)
                {
                    PawnKindDef pawnkind = null;
                    pawnkind = DefDatabase <PawnKindDef> .GetNamed(this.Props.spawnablePawnKinds.RandomElement(), false);

                    if (pawnkind != null)
                    {
                        Pawn pawnToCreate = PawnGenerator.GeneratePawn(pawnkind, Faction.OfInsects);
                        GenSpawn.Spawn(pawnToCreate, CellFinder.RandomClosewalkCellNear(this.parent.Position, this.parent.Map, this.Props.pawnSpawnRadius, null), this.parent.Map, WipeMode.Vanish);

                        if (this.parent.Map != null)
                        {
                            Lord lord = null;
                            if (this.parent.Map.mapPawns.SpawnedPawnsInFaction(Faction.OfInsects).Any((Pawn p) => p != pawnToCreate))
                            {
                                lord = ((Pawn)GenClosest.ClosestThing_Global(this.parent.Position, this.parent.Map.mapPawns.SpawnedPawnsInFaction(Faction.OfInsects), 30f, (Thing p) => p != pawnToCreate && ((Pawn)p).GetLord() != null, null)).GetLord();
                            }
                            if (lord == null)
                            {
                                LordJob_DefendPoint lordJob = new LordJob_DefendPoint(this.parent.Position, 10f, false, true);
                                lord = LordMaker.MakeNewLord(Faction.OfInsects, lordJob, this.parent.Map, null);
                            }
                            lord.AddPawn(pawnToCreate);
                        }



                        pawn = pawnToCreate;
                        if (this.Props.spawnSound != null)
                        {
                            this.Props.spawnSound.PlayOneShot(this.parent);
                        }

                        return(true);
                    }
                    else
                    {
                        pawn = null;
                        return(false);
                    }
                }
                else
                {
                    pawn = null;
                    return(false);
                }
            }
            else
            {
                pawn = null;
                return(false);
            }
        }
Пример #28
0
        public static Pawn PolymorphPawn(Pawn caster, Pawn original, Pawn polymorphFactionPawn, SpawnThings spawnables, IntVec3 position, bool temporary, int duration)
        {
            Pawn polymorphPawn = null;
            bool flag          = spawnables.def != null;

            if (flag)
            {
                Faction faction = TM_Action.ResolveFaction(polymorphFactionPawn, spawnables);
                bool    flag2   = spawnables.def.race != null;
                if (flag2)
                {
                    bool flag3 = spawnables.kindDef == null;
                    if (flag3)
                    {
                        Log.Error("Missing kinddef");
                    }
                    else
                    {
                        try
                        {
                            if (ModCheck.Validate.GiddyUp.Core_IsInitialized())
                            {
                                ModCheck.GiddyUp.ForceDismount(original);
                            }
                        }
                        catch
                        {
                        }

                        Pawn newPawn = new Pawn();

                        newPawn = (Pawn)PawnGenerator.GeneratePawn(spawnables.kindDef, faction);
                        newPawn.AllComps.Add(new CompPolymorph());
                        CompPolymorph compPoly = newPawn.GetComp <CompPolymorph>();
                        //CompProperties_Polymorph props = new CompProperties_Polymorph();
                        //compPoly.Initialize(props);

                        if (compPoly != null)
                        {
                            compPoly.ParentPawn     = newPawn;
                            compPoly.Spawner        = caster;
                            compPoly.Temporary      = temporary;
                            compPoly.TicksToDestroy = duration;
                            compPoly.Original       = original;
                        }
                        else
                        {
                            Log.Message("CompPolymorph was null.");
                        }

                        try
                        {
                            GenSpawn.Spawn(newPawn, position, original.Map);
                            polymorphPawn = newPawn;

                            polymorphPawn.drafter   = new Pawn_DraftController(polymorphPawn);
                            polymorphPawn.equipment = new Pawn_EquipmentTracker(polymorphPawn);
                            polymorphPawn.story     = new Pawn_StoryTracker(polymorphPawn);

                            //polymorphPawn.apparel = new Pawn_ApparelTracker(polymorphPawn);
                            //polymorphPawn.mindState = new Pawn_MindState(polymorphPawn);
                            //polymorphPawn.thinker = new Pawn_Thinker(polymorphPawn);
                            //polymorphPawn.jobs = new Pawn_JobTracker(polymorphPawn);
                            //polymorphPawn.records = new Pawn_RecordsTracker(polymorphPawn);
                            //polymorphPawn.skills = new Pawn_SkillTracker(polymorphPawn);
                            //PawnComponentsUtility.AddAndRemoveDynamicComponents(polymorphPawn, true);

                            polymorphPawn.Name   = original.Name;
                            polymorphPawn.gender = original.gender;

                            if (original.health.hediffSet.HasHediff(HediffDef.Named("TM_SoulBondPhysicalHD")) || original.health.hediffSet.HasHediff(HediffDef.Named("TM_SoulBondMentalHD")))
                            {
                                TM_Action.TransferSoulBond(original, polymorphPawn);
                            }
                        }
                        catch (NullReferenceException ex)
                        {
                            Log.Message("TM_Exception".Translate(
                                            caster.LabelShort,
                                            ex.ToString()
                                            ));
                            polymorphPawn = null;
                        }
                        if (polymorphPawn != null && newPawn.Faction != null && newPawn.Faction != Faction.OfPlayer)
                        {
                            Lord lord = null;
                            if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                            {
                                Predicate <Thing> validator = (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null;
                                Pawn p2 = (Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, validator, null);
                                lord = p2.GetLord();
                            }
                            bool flag4 = lord == null;
                            if (flag4)
                            {
                                LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                                lord = LordMaker.MakeNewLord(faction, lordJob, original.Map, null);
                            }
                            lord.AddPawn(newPawn);
                        }
                    }
                }
                else
                {
                    Log.Message("Missing race");
                }
            }
            return(polymorphPawn);
        }
        private static void MakeBlueprintObject(CellRect mapRect, Map map, Faction faction, MapGeneratorBlueprintDef blueprint, ThingDef stuffDef)
        {
            blueprint.buildingData = GetCleanedBlueprintData(blueprint.buildingData);
            blueprint.floorData    = GetCleanedBlueprintData(blueprint.floorData);
            blueprint.pawnData     = GetCleanedBlueprintData(blueprint.pawnData);
            blueprint.itemData     = GetCleanedBlueprintData(blueprint.itemData);

            if (blueprint.buildingData == null && blueprint.floorData == null)
            {
                Log.Error(string.Format("After cleaning the BlueprintData and FloorData of blueprint {0} -> both are null, nothing will be done!", blueprint.defName));
                return;
            }

            IntVec3 spawnBaseCell = new IntVec3(mapRect.BottomLeft.x, mapRect.TopRight.y, mapRect.TopRight.z);
            IntVec3 spawnCell;

            // Check all cells and abort if there is something indestructible found
            foreach (IntVec3 cell in mapRect)
            {
                if (!CheckCell(cell, map))
                {
                    return;
                }
            }

            allSpawnedPawns = null;


            // Disable automatic room updating
            map.regionAndRoomUpdater.Enabled = false;

            int step = 1;

            while (step <= 4)
            {
                // Work through blueprint - Note: top-left to bottom-right
                // Work step by step: 1st all floors, 2nd all things, 3rd all items, 4th all pawns
                for (int zn = 0; zn < blueprint.size.z; zn++)
                {
                    for (int x = 0; x < blueprint.size.x; x++)
                    {
                        // map can be clipped, don't work with the clipped parts
                        if (x > mapRect.Width - 1 || zn > mapRect.Height - 1)
                        {
                            continue;
                        }

                        if (blueprint.canHaveHoles && Rand.Value < 0.08f)
                        {
                            continue;
                        }

                        spawnCell = spawnBaseCell + new IntVec3(x, 0, -zn);

                        if (!TrySetCell_prepare_CheckCell(spawnCell, map))
                        {
                            continue;
                        }


                        int itemPos = x + blueprint.size.x * zn;

                        try
                        {
                            ThingDef    thingDef    = TryGetThingDefFromBuildingData(blueprint, itemPos);
                            Rot4        thingRot    = TryGetRotationFromBuildingData(blueprint, itemPos);
                            TerrainDef  terrainDef  = TryGetTerrainDefFromFloorData(blueprint, itemPos);
                            PawnKindDef pawnKindDef = TryGetPawnKindDefFromPawnData(blueprint, itemPos);
                            ThingDef    itemDef     = TryGetItemDefFromItemData(blueprint, itemPos);


                            //Only clear the space, if something will be made here
                            // Do only in step 1:
                            if (step == 1)
                            {
                                if (thingDef != null || terrainDef != null || pawnKindDef != null || itemDef != null)
                                {
                                    ClearCell(spawnCell, map);
                                }
                            }

                            switch (step)
                            {
                            case 1:     // Terrain
                                TrySetCell_1_SetFloor(spawnCell, map, terrainDef, thingDef, stuffDef);
                                break;

                            case 2:     // Building
                                TrySetCell_2_SetThing(spawnCell, map, thingDef, thingRot, stuffDef);
                                break;

                            case 3:     // Item
                                TrySetCell_4_SetItem(spawnCell, map, itemDef, blueprint);
                                break;

                            case 4:     // Pawn
                                TrySetCell_5_SetPawn(spawnCell, map, faction, pawnKindDef, blueprint);
                                break;

                            default:
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Warning("MapGeneratorFactionBase - Error while creating the blueprint (" + blueprint.defName + ")\n" + ex.Message + "\n" + ex.StackTrace);
                        }
                    }
                }
                step++;
            }

            // Update the powernets
            map.powerNetManager.UpdatePowerNetsAndConnections_First();

            // Enable automatic room updating and rebuild all rooms
            map.regionAndRoomUpdater.Enabled = true;
            map.regionAndRoomUpdater.RebuildAllRegionsAndRooms();

            LordJob lordJob;

            if (allSpawnedPawns != null && allSpawnedPawns.Count > 0)
            {
                if (blueprint.factionSelection == FactionSelection.friendly)
                {
                    lordJob = new LordJob_AssistColony(allSpawnedPawns[0].Faction, allSpawnedPawns[0].Position);
                }
                else
                {
                    if (Rand.Value < 0.5f)
                    {
                        lordJob = new LordJob_DefendPoint(allSpawnedPawns[0].Position);
                    }
                    else
                    {
                        lordJob = new LordJob_AssaultColony(allSpawnedPawns[0].Faction, false, false, false);
                    }
                }
                LordMaker.MakeNewLord(allSpawnedPawns[0].Faction, lordJob, map, allSpawnedPawns);

                // make the appropriate Lord
                pawnLord = LordMaker.MakeNewLord(faction, lordJob, map, null);

                // Get points used by current pawns
                float pointsUsed = 0f;
                if (allSpawnedPawns != null && allSpawnedPawns.Count > 0)
                {
                    foreach (Pawn pawnSpawned in allSpawnedPawns)
                    {
                        pointsUsed += pawnSpawned.kindDef.combatPower;
                    }
                }

                if (allSpawnedPawns != null)
                {
                    foreach (Pawn pawn in allSpawnedPawns)
                    {
                        pawnLord.AddPawn(pawn);
                    }
                }

                allSpawnedPawns = null;
            }
        }
Пример #30
0
        public void SingleSpawnLoop(SpawnThings spawnables, IntVec3 position, Map map)
        {
            bool flag = spawnables.def != null;

            if (flag)
            {
                Faction faction = this.sustainerPawn.Faction;
                bool    flag2   = spawnables.def.race != null;
                if (flag2)
                {
                    bool flag3 = spawnables.kindDef == null;
                    if (flag3)
                    {
                        Log.Error("Missing kinddef");
                    }
                    else
                    {
                        newPawn = (TMPawnSummoned)PawnGenerator.GeneratePawn(spawnables.kindDef, faction);
                        newPawn.validSummoning = true;
                        newPawn.Temporary      = false;
                        //if (newPawn.Faction != Faction.OfPlayerSilentFail)
                        //{
                        //    newPawn.SetFaction(this.Caster.Faction, null);
                        //}
                        try
                        {
                            GenSpawn.Spawn(newPawn, position, map, Rot4.North, WipeMode.Vanish, false);
                            //GenPlace.TryPlaceThing(newPawn, position, map, ThingPlaceMode.Near, null, null);
                            CompSentinel compSentinel = newPawn.TryGetComp <CompSentinel>();
                            compSentinel.target        = this.hostilePawn;
                            compSentinel.sentinelLoc   = position;
                            compSentinel.rotation      = this.Rotation;
                            compSentinel.sustainerPawn = this.sustainerPawn;
                        }
                        catch
                        {
                            Log.Message("TM_Exception".Translate(
                                            "sentinel building",
                                            this.def.defName
                                            ));
                            this.Destroy(DestroyMode.Vanish);
                        }

                        if (newPawn.Faction != null && newPawn.Faction != Faction.OfPlayer)
                        {
                            try
                            {
                                Lord lord = null;
                                if (newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction).Any((Pawn p) => p != newPawn))
                                {
                                    Predicate <Thing> validator = (Thing p) => p != newPawn && ((Pawn)p).GetLord() != null;
                                    Pawn p2 = (Pawn)GenClosest.ClosestThing_Global(newPawn.Position, newPawn.Map.mapPawns.SpawnedPawnsInFaction(faction), 99999f, validator, null);
                                    lord = p2.GetLord();
                                }
                                bool flag4 = lord == null;
                                if (flag4)
                                {
                                    LordJob_DefendPoint lordJob = new LordJob_DefendPoint(newPawn.Position);
                                    lord = LordMaker.MakeNewLord(faction, lordJob, map, null);
                                }
                                lord.AddPawn(newPawn);
                            }
                            catch (NullReferenceException ex)
                            {
                                //
                            }
                        }
                    }
                }
                else
                {
                    Log.Message("Missing race");
                }
            }
        }
        void LaunchSecurityDropPods(int dropPodsNumber, PawnKindDef securityForcesDef, bool assaultColony)
        {
            IntVec3 dropPodSpot;
            List<Pawn> securityForcesList = new List<Pawn>();

            if ((dropPodsNumber == 0) || (securityForcesDef == null))
            {
                return;
            }
            OG_Inhabitants.InitializeUniformColorAccordingToBiome(); // Necessary in case of small outpost (no inhabitants were generated).
            for (int soldierIndex = 0; soldierIndex < dropPodsNumber; soldierIndex++)
            {
                bool validDropPodCellIsFound = DropCellFinder.TryFindDropSpotNear(this.dropZoneCenter, out dropPodSpot, true, false);
                if (validDropPodCellIsFound)
                {
                    Pawn soldier = OG_Inhabitants.GeneratePawn(securityForcesDef);
                    securityForcesList.Add(soldier);
                    DropPodUtility.MakeDropPodAt(dropPodSpot, new DropPodInfo
                    {
                        SingleContainedThing = soldier,
                        openDelay = 240,
                        leaveSlag = false
                    });
                }
            }

            LordJob lordJob;
            if (assaultColony)
            {
                lordJob = new LordJob_AssaultColony(OG_Util.FactionOfMiningCo, true, true, false);
            }
            else
            {
                lordJob = new LordJob_DefendPoint(this.dropZoneCenter);
            }
            Lord lord = LordMaker.MakeNewLord(OG_Util.FactionOfMiningCo, lordJob, securityForcesList);
        }