// Token: 0x06000E86 RID: 3718 RVA: 0x0006ACD4 File Offset: 0x000690D4 protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; int num = 0; int countToSpawn = this.CountToSpawn; List <TargetInfo> list = new List <TargetInfo>(); float shrapnelDirection = Rand.Range(0f, 360f); for (int i = 0; i < countToSpawn; i++) { IntVec3 intVec; if (!CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.CrashedShipPartIncoming, map, out intVec, 14, default(IntVec3), -1, false, true, true, true, true, false, null)) { break; } Building_Monolith building_Monolith = (Building_Monolith)ThingMaker.MakeThing(this.def.shipPart, null); building_Monolith.SetFaction(OGNFaction.OfNecrons, null); building_Monolith.GetComp <CompSpawnerNecronsOnDamaged>().pointsLeft = Mathf.Max(parms.points * 0.9f, 300f); Skyfaller skyfaller = SkyfallerMaker.MakeSkyfaller(ThingDefOf.CrashedShipPartIncoming, building_Monolith); skyfaller.shrapnelDirection = shrapnelDirection; GenSpawn.Spawn(skyfaller, intVec, map, WipeMode.Vanish); num++; list.Add(new TargetInfo(intVec, map, false)); } if (num > 0) { base.SendStandardLetter(list, null, new string[0]); } return(num > 0); }
protected override bool TryExecuteWorker(IncidentParms parms) { Faction faction = Find.FactionManager.FirstFactionOfDef(FactionDef.Named("PLAHF_faction")); Map map = (Map)parms.target; //List<TargetInfo> list = new List<TargetInfo>(); float shrapnelDirection = Rand.Range(0f, 360f); Thing lookhere; IntVec3 intVec; if (!CellFinderLoose.TryFindSkyfallerCell(RimWorld.ThingDefOf.DropPodIncoming, map, out intVec, 14, default(IntVec3), -1, false, true, true, true, true, false, null)) { return(false); } Building_TacticalManaBomb building_tacticalmanabomb = (Building_TacticalManaBomb)ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("Building_TacticalManaBomb", true)); building_tacticalmanabomb.SetFaction(faction, null); building_tacticalmanabomb.spawnpoints = (float)(parms.points * 0.8); lookhere = building_tacticalmanabomb; Skyfaller skyfaller = SkyfallerMaker.MakeSkyfaller(RimWorld.ThingDefOf.DropPodIncoming, building_tacticalmanabomb); skyfaller.shrapnelDirection = shrapnelDirection; GenSpawn.Spawn(skyfaller, intVec, map, WipeMode.Vanish); Find.LetterStack.ReceiveLetter("LetterLabelPLAHFTMBAttack".Translate(), "LetterPLAHFTMBAttack".Translate(), LetterDefOf.ThreatBig, lookhere, null, null); Find.TickManager.slower.SignalForceNormalSpeedShort(); Find.StoryWatcher.statsRecord.numRaidsEnemy++; return(true); }
// Token: 0x06000EA8 RID: 3752 RVA: 0x0006C254 File Offset: 0x0006A654 protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; int num = 0; int countToSpawn = this.CountToSpawn; List <TargetInfo> list = new List <TargetInfo>(); float shrapnelDirection = Rand.Range(0f, 360f); for (int i = 0; i < countToSpawn; i++) { IntVec3 intVec; if (!CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.CrashedShipPartIncoming, map, out intVec, 14, default(IntVec3), -1, false, true, true, true, true, false, null)) { break; } Building building_CrashedShipPart = (Building)ThingMaker.MakeThing(this.def.mechClusterBuilding, null); CompPawnSpawnerOnDamaged damaged = building_CrashedShipPart.TryGetComp <CompPawnSpawnerOnDamaged>(); Faction faction = damaged.faction ?? Faction.OfMechanoids; building_CrashedShipPart.SetFaction(faction, null); building_CrashedShipPart.GetComp <CompPawnSpawnerOnDamaged>().pointsLeft = Mathf.Max(parms.points * 0.9f, 300f); Skyfaller skyfaller = SkyfallerMaker.MakeSkyfaller(ThingDefOf.CrashedShipPartIncoming, building_CrashedShipPart); skyfaller.shrapnelDirection = shrapnelDirection; GenSpawn.Spawn(skyfaller, intVec, map, WipeMode.Vanish); num++; list.Add(new TargetInfo(intVec, map, false)); } if (num > 0) { base.SendStandardLetter(parms, list, Array.Empty <NamedArgument>()); } return(num > 0); }
protected override bool TryExecuteWorker(IncidentParms parms) { var map = (Map)parms.target; int num = 0; int countToSpawn = this.CountToSpawn; var list = new List <TargetInfo>(); var shrapnelDirection = Rand.Range(0f, 360f); for (int i = 0; i < countToSpawn; i++) { IntVec3 intVec = default(IntVec3); if (!CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.CrashedShipPartIncoming, map, out intVec, 14, default(IntVec3), -1, false, true, true, true, true, false, null)) { break; } var building_CrashedShipPart = (Building_CrashedShipPart)ThingMaker.MakeThing(def.shipPart, null); building_CrashedShipPart.SetFaction(Faction.OfMechanoids, null); building_CrashedShipPart.GetComp <CompSpawnerMechanoidsOnDamaged>().pointsLeft = Mathf.Max(parms.points * ShipPointsFactor, 300f); var skyfaller = SkyfallerMaker.MakeSkyfaller(ThingDefOf.CrashedShipPartIncoming, building_CrashedShipPart); skyfaller.shrapnelDirection = shrapnelDirection; GenSpawn.Spawn(skyfaller, intVec, map, WipeMode.Vanish); num++; list.Add(new TargetInfo(intVec, map, false)); } if (num > 0) { SendStandardLetter(list, null); } return(num > 0); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; int num = 0; int countToSpawn = this.CountToSpawn; IntVec3 cell = IntVec3.Invalid; float shrapnelDirection = Rand.Range(0f, 360f); for (int i = 0; i < countToSpawn; i++) { IntVec3 intVec; if (!CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.CrashedShipPartIncoming, map, out intVec, 14, default(IntVec3), -1, false, true, true, true, null)) { break; } Building_CrashedShipPart building_CrashedShipPart = (Building_CrashedShipPart)ThingMaker.MakeThing(this.def.shipPart, null); building_CrashedShipPart.SetFaction(Faction.OfMechanoids, null); building_CrashedShipPart.GetComp <CompSpawnerMechanoidsOnDamaged>().pointsLeft = Mathf.Max(parms.points * 0.9f, 300f); Skyfaller skyfaller = SkyfallerMaker.MakeSkyfaller(ThingDefOf.CrashedShipPartIncoming, building_CrashedShipPart); skyfaller.shrapnelDirection = shrapnelDirection; GenSpawn.Spawn(skyfaller, intVec, map); num++; cell = intVec; } if (num > 0) { base.SendStandardLetter(new TargetInfo(cell, map, false), new string[0]); } return(num > 0); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; int num = 0; int countToSpawn = this.CountToSpawn; IntVec3 cell = IntVec3.Invalid; float shrapnelDirection = Rand.Range(0f, 360f); int num2 = 0; IntVec3 intVec = default(IntVec3); while (num2 < countToSpawn && CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.CrashedShipPartIncoming, map, out intVec, 14, default(IntVec3), -1, false, true, true, true, (Predicate <IntVec3>)null)) { Building_CrashedShipPart building_CrashedShipPart = (Building_CrashedShipPart)ThingMaker.MakeThing(base.def.shipPart, null); building_CrashedShipPart.SetFaction(Faction.OfMechanoids, null); building_CrashedShipPart.GetComp <CompSpawnerMechanoidsOnDamaged>().pointsLeft = Mathf.Max((float)(parms.points * 0.89999997615814209), 300f); Skyfaller skyfaller = SkyfallerMaker.MakeSkyfaller(ThingDefOf.CrashedShipPartIncoming, building_CrashedShipPart); skyfaller.shrapnelDirection = shrapnelDirection; GenSpawn.Spawn(skyfaller, intVec, map); num++; cell = intVec; num2++; } if (num > 0) { base.SendStandardLetter(new TargetInfo(cell, map, false)); } return(num > 0); }
private bool TryFindShipChunkDropCell(IntVec3 nearLoc, Map map, int maxDist, out IntVec3 pos) { ThingDef shipChunkIncoming = ThingDefOf.ShipChunkIncoming; Map map1 = map; IntVec3 intVec3 = nearLoc; return(CellFinderLoose.TryFindSkyfallerCell(shipChunkIncoming, map1, out pos, 10, intVec3, maxDist, true, false, false, false, true, false, null)); }
// Token: 0x06000EA8 RID: 3752 RVA: 0x0006C2D0 File Offset: 0x0006A6D0 protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; int num = 0; int countToSpawn = this.CountToSpawn(parms); List <TargetInfo> list = new List <TargetInfo>(); Rand.PushState(); float shrapnelDirection = Rand.Range(0f, 360f); Rand.PopState(); Faction faction = null; CompProperties_SpawnerOnDamaged props = this.def.mechClusterBuilding?.GetCompProperties <CompProperties_SpawnerOnDamaged>(); if (props == null) { return(false); } /* * if (faction == null) * { * faction = onDamaged.OfFaction; * if (faction == null) * { * return false; * } * } */ for (int i = 0; i < countToSpawn; i++) { IntVec3 intVec; Building CrashedShipPart = (Building)ThingMaker.MakeThing(this.def.mechClusterBuilding, null); CompSpawnerOnDamaged onDamaged = CrashedShipPart.TryGetComp <CompSpawnerOnDamaged>(); ThingDef faller = onDamaged?.Props.skyFaller ?? ThingDefOf.CrashedShipPartIncoming; if (!CellFinderLoose.TryFindSkyfallerCell(faller, map, out intVec, 14, default(IntVec3), -1, false, true, true, true, true, false, null)) { break; } // CrashedShipPart.SetFaction(faction, null); if (onDamaged != null) { onDamaged.pointsLeft = Mathf.Max(parms.points * 0.9f, 300f); } Skyfaller skyfaller = SkyfallerMaker.MakeSkyfaller(faller, CrashedShipPart); skyfaller.shrapnelDirection = shrapnelDirection; Thing thing = GenSpawn.Spawn(skyfaller, intVec, map, WipeMode.Vanish); num++; list.Add(CrashedShipPart); } if (num > 0) { base.SendStandardLetter(parms, list, Array.Empty <NamedArgument>()); } return(num > 0); }
public override bool PreCalculateDroppingSpot() { Map map = parms.target as Map; IncidentInterceptorUtility.IsIntercepting_SkyfallerCell_Loose = GeneratorPatchFlag.Generate; if (!CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.CrashedShipPartIncoming, map, out DropSpot, 14, default, -1, false, true, true, true, true, false, null)) { return(false); } lookTargets = new TargetInfo(DropSpot, map, false); return(true); }
// Token: 0x06003C6B RID: 15467 RVA: 0x0013F458 File Offset: 0x0013D658 private bool TryFindCell(out IntVec3 cell, Map map) { int maxMineables = ThingSetMaker_Meteorite.MineablesCountRange.max; return(CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.InfestedMeteoriteIncoming_OgsOld_ExtraHives, map, out cell, 10, default(IntVec3), -1, true, false, false, false, true, true, delegate(IntVec3 x) { int num = Mathf.CeilToInt(Mathf.Sqrt((float)maxMineables)) + 2; CellRect cellRect = CellRect.CenteredOn(x, num, num); int num2 = 0; foreach (IntVec3 c in cellRect) { if (c.InBounds(map) && c.Standable(map)) { num2++; } } return num2 >= maxMineables; })); }
private bool TryFindCell(out IntVec3 cell, Map map) { int maxMineables = ThingSetMaker_Meteorite.MineablesCountRange.max; return(CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.MeteoriteIncoming, map, out cell, 10, default(IntVec3), -1, allowRoofedCells : true, allowCellsWithItems : false, allowCellsWithBuildings : false, colonyReachable : false, avoidColonistsIfExplosive : true, alwaysAvoidColonists : true, delegate(IntVec3 x) { int num = Mathf.CeilToInt(Mathf.Sqrt(maxMineables)) + 2; CellRect cellRect = CellRect.CenteredOn(x, num, num); int num2 = 0; foreach (IntVec3 item in cellRect) { if (item.InBounds(map) && item.Standable(map)) { num2++; } } return num2 >= maxMineables; })); }
private bool TryFindCell(out IntVec3 cell, Map map) //todo: новый алгоритм поиска цели. Этот из ванильного падения метеорита { int maxMineables = 1; //CellFinder.TryFindRandomCellInRegion(); return(CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.MeteoriteIncoming, map, out cell, 10, default(IntVec3), -1, allowRoofedCells : true, allowCellsWithItems : false, allowCellsWithBuildings : true, colonyReachable : true, avoidColonistsIfExplosive : false, alwaysAvoidColonists : false, delegate(IntVec3 x) { int num = Mathf.CeilToInt(Mathf.Sqrt(maxMineables)); CellRect cellRect = CellRect.CenteredOn(x, num, num); int num2 = 0; foreach (IntVec3 item in cellRect) { if (item.InBounds(map) && item.Standable(map)) { num2++; } } return num2 >= maxMineables; })); }
private bool TryFindCell(out IntVec3 cell, Map map) { int maxMineables = ThingSetMaker_Meteorite.MineablesCountRange.max; return(CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.MeteoriteIncoming, map, out cell, 10, default(IntVec3), -1, true, false, false, false, true, true, delegate(IntVec3 x) { int num = Mathf.CeilToInt(Mathf.Sqrt((float)maxMineables)) + 2; CellRect cellRect = CellRect.CenteredOn(x, num, num); int num2 = 0; CellRect.CellRectIterator iterator = cellRect.GetIterator(); while (!iterator.Done()) { if (iterator.Current.InBounds(map) && iterator.Current.Standable(map)) { num2++; } iterator.MoveNext(); } return num2 >= maxMineables; })); }
private bool TryFindCell(out IntVec3 cell, Map map) { int mineablesCountRange = ThingSetMaker_Meteorite.MineablesCountRange.max; ThingDef meteoriteIncoming = ThingDefOf.MeteoriteIncoming; Map map1 = map; IntVec3 intVec3 = new IntVec3(); return(CellFinderLoose.TryFindSkyfallerCell(meteoriteIncoming, map1, out cell, 10, intVec3, -1, true, false, false, false, true, true, (IntVec3 x) => { int num = Mathf.CeilToInt(Mathf.Sqrt((float)mineablesCountRange)) + 2; CellRect cellRect = CellRect.CenteredOn(x, num, num); int num1 = 0; foreach (IntVec3 current in cellRect) { if (current.InBounds(map) && current.Standable(map)) { num1++; } } return num1 >= mineablesCountRange; })); }
private bool TryFindCell(out IntVec3 cell, Map map) { return(CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.ShipChunkIncoming, map, out cell, 10, default(IntVec3), -1, true, true, true, true, false, false)); }
private bool TryFindShipChunkDropCell(IntVec3 nearLoc, Map map, int maxDist, out IntVec3 pos) { ThingDef shipChunkIncoming = ThingDefOf.ShipChunkIncoming; return(CellFinderLoose.TryFindSkyfallerCell(shipChunkIncoming, map, out pos, 10, nearLoc, maxDist)); }
// Token: 0x0600001D RID: 29 RVA: 0x00002A4C File Offset: 0x00000C4C private void TryFindPresentDropCell(IntVec3 nearLoc, Map map, int maxDist, out IntVec3 pos) { var presentIncoming = XDefOf.PresentIncoming; CellFinderLoose.TryFindSkyfallerCell(presentIncoming, map, out pos, 10, nearLoc, maxDist); }
public static bool GetRandomVec3(ThingDef thing, Map map, out IntVec3 vec, int contract = 0) { return(CellFinderLoose.TryFindSkyfallerCell(thing, map, out vec, contract, map.Center, 99999, true, false, false, true, true, false, null)); }