// 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) { Map map = (Map)parms.target; int num = 0; int countToSpawn = CountToSpawn; List <TargetInfo> list = new List <TargetInfo>(); float shrapnelDirection = Rand.Range(0f, 360f); for (int i = 0; i < countToSpawn; i++) { IntVec3 cell = default(IntVec3); if (!CellFinderLoose.TryFindSkyfallerCell(ThingDefOf.CrashedShipPartIncoming, map, out cell, 14, default(IntVec3), -1, allowRoofedCells: false, allowCellsWithItems: true, allowCellsWithBuildings: true, colonyReachable: true)) { break; } Building_CrashedShipPart building_CrashedShipPart = (Building_CrashedShipPart)ThingMaker.MakeThing(def.shipPart); building_CrashedShipPart.SetFaction(Faction.OfMechanoids); 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, cell, map); num++; list.Add(new TargetInfo(cell, map)); } if (num > 0) { SendStandardLetter(list, null); } return(num > 0); }
// 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) { 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 void DrawDropSpotShadow() { Material shadowMaterial = this.ShadowMaterial; if (!(shadowMaterial == null)) { Skyfaller.DrawDropSpotShadow(base.DrawPos, base.Rotation, shadowMaterial, this.def.skyfaller.shadowSize, this.ticksToImpact); } }
public static Skyfaller MakeSkyfaller(ThingDef skyfaller, IEnumerable <Thing> things) { Skyfaller skyfaller2 = SkyfallerMaker.MakeSkyfaller(skyfaller); if (things != null) { skyfaller2.innerContainer.TryAddRangeOrTransfer(things, false, true); } return(skyfaller2); }
public static Skyfaller MakeSkyfaller(ThingDef skyfaller, IEnumerable <Thing> things) { Skyfaller skyfaller2 = MakeSkyfaller(skyfaller); if (things != null) { skyfaller2.innerContainer.TryAddRangeOrTransfer(things, canMergeWithExistingStacks: false, destroyLeftover: true); } return(skyfaller2); }
public static Skyfaller MakeSkyfaller(ThingDef skyfaller, Thing innerThing) { Skyfaller skyfaller2 = SkyfallerMaker.MakeSkyfaller(skyfaller); if (innerThing != null && !skyfaller2.innerContainer.TryAdd(innerThing, true)) { Log.Error("Could not add " + innerThing.ToStringSafe <Thing>() + " to a skyfaller.", false); innerThing.Destroy(DestroyMode.Vanish); } return(skyfaller2); }
public static Skyfaller MakeSkyfaller(ThingDef skyfaller, Thing innerThing) { Skyfaller skyfaller2 = MakeSkyfaller(skyfaller); if (innerThing != null && !skyfaller2.innerContainer.TryAdd(innerThing)) { Log.Error("Could not add " + innerThing.ToStringSafe() + " to a skyfaller."); innerThing.Destroy(); } return(skyfaller2); }
public override void Notify_QuestSignalReceived(Signal signal) { base.Notify_QuestSignalReceived(signal); if (!(signal.tag == inSignal) || !MapParent.HasMap) { return; } IntVec3 result = IntVec3.Invalid; if (cell.IsValid) { result = cell; } else { if (tryLandInShipLandingZone && !DropCellFinder.TryFindShipLandingArea(MapParent.Map, out result, out var firstBlockingThing)) { if (firstBlockingThing != null) { Messages.Message("ShuttleBlocked".Translate("BlockedBy".Translate(firstBlockingThing).CapitalizeFirst()), firstBlockingThing, MessageTypeDefOf.NeutralEvent); } result = DropCellFinder.TryFindSafeLandingSpotCloseToColony(MapParent.Map, thing.def.Size, factionForFindingSpot); } if (!result.IsValid && tryLandNearThing != null) { DropCellFinder.FindSafeLandingSpotNearAvoidingHostiles(tryLandNearThing, MapParent.Map, out result, 35, 15, 25, thing.def.size); } if (!result.IsValid && (!lookForSafeSpot || !DropCellFinder.FindSafeLandingSpot(out result, factionForFindingSpot, MapParent.Map, 35, 15, 25, thing.def.size))) { IntVec3 intVec = DropCellFinder.RandomDropSpot(MapParent.Map); if (!DropCellFinder.TryFindDropSpotNear(intVec, MapParent.Map, out result, allowFogged: false, canRoofPunch: false, allowIndoors: false, thing.def.size)) { result = intVec; } } } GenPlace.TryPlaceThing(thing, result, MapParent.Map, ThingPlaceMode.Near); spawned = true; Skyfaller skyfaller = thing as Skyfaller; if (skyfaller != null && skyfaller.innerContainer.Count == 1) { innerSkyfallerThing = skyfaller.innerContainer.First(); } else { innerSkyfallerThing = null; } }
public static Skyfaller SpawnSkyfaller(ThingDef skyfaller, IEnumerable <Thing> things, IntVec3 pos, Map map) { Skyfaller newThing = SkyfallerMaker.MakeSkyfaller(skyfaller, things); return((Skyfaller)GenSpawn.Spawn(newThing, pos, map, WipeMode.Vanish)); }
public static Skyfaller SpawnSkyfaller(ThingDef skyfaller, Thing innerThing, IntVec3 pos, Map map) { Skyfaller newThing = SkyfallerMaker.MakeSkyfaller(skyfaller, innerThing); return((Skyfaller)GenSpawn.Spawn(newThing, pos, map, WipeMode.Vanish)); }
public static Skyfaller SpawnSkyfaller(ThingDef skyfaller, IntVec3 pos, Map map) { Skyfaller newThing = SkyfallerMaker.MakeSkyfaller(skyfaller); return((Skyfaller)GenSpawn.Spawn(newThing, pos, map)); }
public static Skyfaller SpawnSkyfaller(ThingDef skyfaller, Thing innerThing, IntVec3 pos, Map map) { Skyfaller newThing = MakeSkyfaller(skyfaller, innerThing); return((Skyfaller)GenSpawn.Spawn(newThing, pos, map)); }