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); } }
public override bool TryResolveRaidSpawnCenter(IncidentParms parms) { Map map = (Map)parms.target; if (!parms.spawnCenter.IsValid) { parms.spawnCenter = MechClusterUtility.FindClusterPosition(map, parms.mechClusterSketch, 100, 0.5f); } parms.spawnRotation = Rot4.Random; 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); } } }
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; }