public override void Generate(Map map, GenStepParams parms)
        {
            MechClusterSketch sketch = MechClusterGenerator.GenerateClusterSketch(DefaultPointsRange.RandomInRange, map, startDormant: false);
            IntVec3           center = IntVec3.Invalid;

            if (MapGenerator.TryGetVar("RectOfInterest", out CellRect var))
            {
                center = var.ExpandedBy(20).MaxBy((IntVec3 x) => MechClusterUtility.GetClusterPositionScore(x, map, sketch));
            }
            if (!center.IsValid)
            {
                center = MechClusterUtility.FindClusterPosition(map, sketch);
            }
            List <Thing> list  = MechClusterUtility.SpawnCluster(center, map, sketch, dropInPods: false);
            List <Pawn>  list2 = new List <Pawn>();

            foreach (Thing item in list)
            {
                if (item is Pawn)
                {
                    list2.Add((Pawn)item);
                }
            }
            if (list2.Any())
            {
                GenStep_SleepingMechanoids.SendMechanoidsToSleepImmediately(list2);
            }
        }
Exemple #2
0
 protected override bool TryCastShot()
 {
     if (currentTarget.HasThing && currentTarget.Thing.Map != caster.Map)
     {
         return(false);
     }
     MechClusterUtility.SpawnCluster(currentTarget.Cell, caster.Map, MechClusterGenerator.GenerateClusterSketch_NewTemp(2500f, caster.Map, startDormant: true, forceNoConditionCauser: true));
     base.ReloadableCompSource?.UsedOnce();
     return(true);
 }
 public override void Notify_QuestSignalReceived(Signal signal)
 {
     base.Notify_QuestSignalReceived(signal);
     if (signal.tag == inSignal && mapParent != null && mapParent.HasMap)
     {
         spawnedClusterPos = MechClusterUtility.FindClusterPosition(mapParent.Map, sketch, 100, 0.5f);
         if (!(spawnedClusterPos == IntVec3.Invalid))
         {
             MechClusterUtility.SpawnCluster(spawnedClusterPos, mapParent.Map, sketch, dropInPods: true, canAssaultColony: false, tag);
             Find.LetterStack.ReceiveLetter("LetterLabelMechClusterArrived".Translate(), "LetterMechClusterArrived".Translate(), LetterDefOf.ThreatBig, new TargetInfo(spawnedClusterPos, mapParent.Map), null, quest);
         }
     }
 }
Exemple #4
0
 protected override bool TryCastShot()
 {
     if (currentTarget.HasThing && currentTarget.Thing.Map != caster.Map)
     {
         return(false);
     }
     MechClusterUtility.SpawnCluster(currentTarget.Cell, caster.Map, MechClusterGenerator.GenerateClusterSketch(2500f, caster.Map));
     if (base.EquipmentSource != null && !base.EquipmentSource.Destroyed)
     {
         base.EquipmentSource.Destroy();
     }
     return(true);
 }
 protected override bool TryExecuteWorker(IncidentParms parms)
 {
     Map map = (Map)parms.target;
     MechClusterSketch sketch = MechClusterGenerator.GenerateClusterSketch(parms.points, map);
     IntVec3 center = MechClusterUtility.FindClusterPosition(map, sketch, 100, 0.5f);
     if (!center.IsValid)
     {
         return false;
     }
     IEnumerable<Thing> targets = from t in MechClusterUtility.SpawnCluster(center, map, sketch, dropInPods: true, canAssaultColony: true, parms.questTag)
         where t.def != ThingDefOf.Wall && t.def != ThingDefOf.Barricade
         select t;
     SendStandardLetter(parms, new LookTargets(targets));
     return true;
 }
Exemple #6
0
 public override List <Pawn> SpawnThreats(IncidentParms parms)
 {
     return(MechClusterUtility.SpawnCluster(parms.spawnCenter, (Map)parms.target, parms.mechClusterSketch, dropInPods: true, canAssaultColony: true, parms.questTag).OfType <Pawn>().ToList());
 }