// 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 = 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); }
public static void MakeDropoffShuttle(Map map, List <Thing> contents, Faction faction = null) { if (!DropCellFinder.TryFindShipLandingArea(map, out IntVec3 result, out Thing firstBlockingThing)) { if (firstBlockingThing != null) { Messages.Message("ShuttleBlocked".Translate("BlockedBy".Translate(firstBlockingThing).CapitalizeFirst()), firstBlockingThing, MessageTypeDefOf.NeutralEvent); } result = DropCellFinder.TryFindSafeLandingSpotCloseToColony(map, ThingDefOf.Shuttle.Size); } Thing thing = ThingMaker.MakeThing(ThingDefOf.Shuttle); thing.TryGetComp <CompShuttle>().dropEverythingOnArrival = true; for (int i = 0; i < contents.Count; i++) { Pawn p; if ((p = (contents[i] as Pawn)) != null) { Find.WorldPawns.RemovePawn(p); } } thing.SetFaction(faction); thing.TryGetComp <CompTransporter>().innerContainer.TryAddRangeOrTransfer(contents); GenPlace.TryPlaceThing(SkyfallerMaker.MakeSkyfaller(ThingDefOf.ShuttleIncoming, Gen.YieldSingle(thing)), result, map, ThingPlaceMode.Near); }
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); }
public static void MakeDropPodAt(IntVec3 c, Map map, ActiveDropPodInfo info) { ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDefOf.ActiveDropPod, null); activeDropPod.Contents = info; SkyfallerMaker.SpawnSkyfaller(ThingDefOf.DropPodIncoming, activeDropPod, c, map); }
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); }
// 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; List <TargetInfo> list = new List <TargetInfo>(); ThingDef shipPartDef = def.mechClusterBuilding; IntVec3 intVec = FindDropPodLocation(map, (IntVec3 spot) => CanPlaceAt(spot)); if (intVec == IntVec3.Invalid) { return(false); } float points = Mathf.Max(parms.points * 0.9f, 300f); List <Pawn> list2 = PawnGroupMakerUtility.GeneratePawns(new PawnGroupMakerParms { groupKind = PawnGroupKindDefOf.Combat, tile = map.Tile, faction = Faction.OfMechanoids, points = points }).ToList(); Thing thing = ThingMaker.MakeThing(shipPartDef); thing.SetFaction(Faction.OfMechanoids); LordMaker.MakeNewLord(Faction.OfMechanoids, new LordJob_SleepThenMechanoidsDefend(new List <Thing> { thing }, Faction.OfMechanoids, 28f, intVec, canAssaultColony: false, isMechCluster: false), map, list2); DropPodUtility.DropThingsNear(intVec, map, list2.Cast <Thing>()); foreach (Pawn item in list2) { item.TryGetComp <CompCanBeDormant>()?.ToSleep(); } list.AddRange(list2.Select((Pawn p) => new TargetInfo(p))); GenSpawn.Spawn(SkyfallerMaker.MakeSkyfaller(ThingDefOf.CrashedShipPartIncoming, thing), intVec, map); list.Add(new TargetInfo(intVec, map)); SendStandardLetter(parms, list); return(true); bool CanPlaceAt(IntVec3 loc) { CellRect cellRect = GenAdj.OccupiedRect(loc, Rot4.North, shipPartDef.Size); if (loc.Fogged(map) || !cellRect.InBounds(map)) { return(false); } if (!DropCellFinder.SkyfallerCanLandAt(loc, map, shipPartDef.Size)) { return(false); } foreach (IntVec3 item2 in cellRect) { RoofDef roof = item2.GetRoof(map); if (roof != null && roof.isNatural) { return(false); } } return(GenConstruct.CanBuildOnTerrain(shipPartDef, loc, map, Rot4.North)); } }
public static void MakeDropPodAt(IntVec3 c, Map map, ActiveDropPodInfo info, bool explode = false) { ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDefOf.ActiveDropPod, null); activeDropPod.Contents = info; ThingDef skyfaller = (!explode) ? ThingDefOf.DropPodIncoming : ThingDefOf.ExplosiveDropPodIncoming; SkyfallerMaker.SpawnSkyfaller(skyfaller, activeDropPod, c, map); }
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); }
// Token: 0x060047C7 RID: 18375 RVA: 0x00180F4C File Offset: 0x0017F14C public override void GenerateIntoMap(Map map) { method = PlayerPawnsArriveMethod.DropShip; if (Find.GameInitData == null) { return; } List <List <Thing> > list = new List <List <Thing> >(); foreach (Pawn item in Find.GameInitData.startingAndOptionalPawns) { list.Add(new List <Thing> { item }); } List <Thing> list2 = new List <Thing>(); foreach (ScenPart scenPart in Find.Scenario.AllParts) { list2.AddRange(scenPart.PlayerStartingThings()); } int num = 0; foreach (Thing thing in list2) { if (thing.def.CanHaveFaction) { thing.SetFactionDirect(Faction.OfPlayer); } list[num].Add(thing); num++; if (num >= list.Count) { num = 0; } } if ((int)this.method == (int)PlayerPawnsArriveMethod.DropShip) { Thing thing = ThingMaker.MakeThing(USCMDefOf.RRY_USCM_DropshipUD4L, null); CompUSCMDropship dropship = thing.TryGetComp <CompUSCMDropship>(); foreach (List <Thing> item in list) { dropship.Transporter.innerContainer.TryAddRangeOrTransfer(item); } dropship.autodustoff = true; if (DropCellFinder.TryFindDropSpotNear(MapGenerator.PlayerStartSpot, map, out IntVec3 spot, false, false, false, USCMDefOf.RRY_USCM_DropshipUD4L.Size)) { GenPlace.TryPlaceThing(SkyfallerMaker.MakeSkyfaller(USCMDefOf.RRY_USCM_DropshipUD4LIncoming, thing), spot, map, ThingPlaceMode.Near, null, null, default(Rot4)); } else { GenPlace.TryPlaceThing(SkyfallerMaker.MakeSkyfaller(USCMDefOf.RRY_USCM_DropshipUD4LIncoming, thing), MapGenerator.PlayerStartSpot, map, ThingPlaceMode.Near, null, null, default(Rot4)); } }
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 override void AssignDebugData() { base.AssignDebugData(); inSignal = "DebugSignal" + Rand.Int; if (Find.AnyPlayerHomeMap != null) { Map randomPlayerHomeMap = Find.RandomPlayerHomeMap; IntVec3 center = DropCellFinder.RandomDropSpot(randomPlayerHomeMap); shuttle = ThingMaker.MakeThing(ThingDefOf.Shuttle); GenPlace.TryPlaceThing(SkyfallerMaker.MakeSkyfaller(ThingDefOf.ShuttleIncoming, shuttle), center, randomPlayerHomeMap, ThingPlaceMode.Near); } }
private void TryLaunch(GlobalTargetInfo target, PawnsArriveMode arriveMode, bool attackOnArrival) { if (!this.parent.Spawned) { Log.Error("Tried to launch " + this.parent + ", but it's unspawned."); return; } List <CompTransporter> transportersInGroup = this.TransportersInGroup; if (transportersInGroup == null) { Log.Error("Tried to launch " + this.parent + ", but it's not in any group."); return; } if (!this.LoadingInProgressOrReadyToLaunch || !this.AllInGroupConnectedToFuelingPort || !this.AllFuelingPortSourcesInGroupHaveAnyFuel) { return; } Map map = this.parent.Map; int num = Find.WorldGrid.TraversalDistanceBetween(map.Tile, target.Tile); if (num > this.MaxLaunchDistance) { return; } this.Transporter.TryRemoveLord(map); int groupID = this.Transporter.groupID; float amount = Mathf.Max(CompLaunchable.FuelNeededToLaunchAtDist((float)num), 1f); for (int i = 0; i < transportersInGroup.Count; i++) { CompTransporter compTransporter = transportersInGroup[i]; Building fuelingPortSource = compTransporter.Launchable.FuelingPortSource; if (fuelingPortSource != null) { fuelingPortSource.TryGetComp <CompRefuelable>().ConsumeFuel(amount); } ThingOwner directlyHeldThings = compTransporter.GetDirectlyHeldThings(); ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDefOf.ActiveDropPod, null); activeDropPod.Contents = new ActiveDropPodInfo(); activeDropPod.Contents.innerContainer.TryAddRangeOrTransfer(directlyHeldThings, true, true); DropPodLeaving dropPodLeaving = (DropPodLeaving)SkyfallerMaker.MakeSkyfaller(ThingDefOf.DropPodLeaving, activeDropPod); dropPodLeaving.groupID = groupID; dropPodLeaving.destinationTile = target.Tile; dropPodLeaving.destinationCell = target.Cell; dropPodLeaving.arriveMode = arriveMode; dropPodLeaving.attackOnArrival = attackOnArrival; compTransporter.CleanUpLoadingVars(map); compTransporter.parent.Destroy(DestroyMode.Vanish); GenSpawn.Spawn(dropPodLeaving, compTransporter.parent.Position, map); } }
public void TryLaunch(int destinationTile, TransportPodsArrivalAction arrivalAction) { if (!parent.Spawned) { Log.Error(string.Concat("Tried to launch ", parent, ", but it's unspawned.")); return; } List <CompTransporter> transportersInGroup = TransportersInGroup; if (transportersInGroup == null) { Log.Error(string.Concat("Tried to launch ", parent, ", but it's not in any group.")); } else { if (!LoadingInProgressOrReadyToLaunch || !AllInGroupConnectedToFuelingPort || !AllFuelingPortSourcesInGroupHaveAnyFuel) { return; } Map map = parent.Map; int num = Find.WorldGrid.TraversalDistanceBetween(map.Tile, destinationTile); CompShuttle compShuttle = parent.TryGetComp <CompShuttle>(); if (num <= MaxLaunchDistance || (compShuttle != null && compShuttle.IsMissionShuttle)) { Transporter.TryRemoveLord(map); int groupID = Transporter.groupID; float amount = Mathf.Max(FuelNeededToLaunchAtDist(num), 1f); compShuttle?.SendLaunchedSignals(transportersInGroup); for (int i = 0; i < transportersInGroup.Count; i++) { CompTransporter compTransporter = transportersInGroup[i]; compTransporter.Launchable.FuelingPortSource?.TryGetComp <CompRefuelable>().ConsumeFuel(amount); ThingOwner directlyHeldThings = compTransporter.GetDirectlyHeldThings(); ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDefOf.ActiveDropPod); activeDropPod.Contents = new ActiveDropPodInfo(); activeDropPod.Contents.innerContainer.TryAddRangeOrTransfer(directlyHeldThings, canMergeWithExistingStacks: true, destroyLeftover: true); DropPodLeaving obj = (DropPodLeaving)SkyfallerMaker.MakeSkyfaller(Props.skyfallerLeaving ?? ThingDefOf.DropPodLeaving, activeDropPod); obj.groupID = groupID; obj.destinationTile = destinationTile; obj.arrivalAction = arrivalAction; obj.worldObjectDef = ((compShuttle != null) ? WorldObjectDefOf.TravelingShuttle : WorldObjectDefOf.TravelingTransportPods); compTransporter.CleanUpLoadingVars(map); compTransporter.parent.Destroy(); GenSpawn.Spawn(obj, compTransporter.parent.Position, map); } CameraJumper.TryHideWorld(); } } }
/* * // 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; * List<TargetInfo> list = new List<TargetInfo>(); * float shrapnelDirection = Rand.Range(0f, 360f); * Faction faction = null; * Building building_CrashedShipPart = null; * building = (Building)ThingMaker.MakeThing(this.def.mechClusterBuilding, null); * if (faction == null) * { * faction = building_CrashedShipPart.GetComp<CompPawnSpawnerOnDamaged>().OfFaction; * } * 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_CrashedShipPart.SetFaction(faction, null); * building_CrashedShipPart.GetComp<CompPawnSpawnerOnDamaged>().pointsLeft = Mathf.Max(parms.points * 0.9f, 300f); * * ThingDef faller = building_CrashedShipPart.GetComp<CompPawnSpawnerOnDamaged>().Props.skyFaller != null ? building_CrashedShipPart.GetComp<CompPawnSpawnerOnDamaged>().Props.skyFaller : ThingDefOf.CrashedShipPartIncoming ; * Skyfaller skyfaller = SkyfallerMaker.MakeSkyfaller(faller, 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(list, null, new string[0]); * } * return num > 0; * * } */ // Token: 0x06003A73 RID: 14963 RVA: 0x001328DC File Offset: 0x00130ADC protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; List <TargetInfo> list = new List <TargetInfo>(); ThingDef shipPartDef = this.def.mechClusterBuilding; IntVec3 intVec = MechClusterUtility.FindDropPodLocation(map, (IntVec3 spot) => !spot.Fogged(map) && GenConstruct.CanBuildOnTerrain(shipPartDef, spot, map, Rot4.North, null, null) && GenConstruct.CanBuildOnTerrain(shipPartDef, new IntVec3(spot.x - Mathf.CeilToInt((float)shipPartDef.size.x / 2f), spot.y, spot.z), map, Rot4.North, null, null), 500, 0f); if (intVec == IntVec3.Invalid) { return(false); } float points = Mathf.Max(parms.points * 0.9f, 300f); Thing thing = ThingMaker.MakeThing(shipPartDef, null); Building building_CrashedShipPart = (Building)thing; CompPawnSpawnerOnDamaged damaged = building_CrashedShipPart.TryGetComp <CompPawnSpawnerOnDamaged>(); Faction faction = damaged.faction ?? Faction.OfMechanoids; thing.SetFaction(faction, null); /* * List<Pawn> list2 = PawnGroupMakerUtility.GeneratePawns(new PawnGroupMakerParms * { * groupKind = PawnGroupKindDefOf.Combat, * tile = map.Tile, * faction = faction, * points = points * }, true).ToList<Pawn>(); * LordMaker.MakeNewLord(faction, new LordJob_SleepThenMechanoidsDefend(new List<Thing> * { * thing * }, faction, 28f, intVec, false, false), map, list2); * DropPodUtility.DropThingsNear(intVec, map, list2.Cast<Thing>(), 110, false, false, true, true); * foreach (Pawn thing2 in list2) * { * CompCanBeDormant compCanBeDormant = thing2.TryGetComp<CompCanBeDormant>(); * if (compCanBeDormant != null) * { * compCanBeDormant.ToSleep(); * } * } * list.AddRange(from p in list2 * select new TargetInfo(p)); */ GenSpawn.Spawn(SkyfallerMaker.MakeSkyfaller(ThingDefOf.CrashedShipPartIncoming, thing), intVec, map, WipeMode.Vanish); list.Add(new TargetInfo(intVec, map, false)); base.SendStandardLetter(parms, list, Array.Empty <NamedArgument>()); return(true); }
public static void MakeDropPodAt(IntVec3 c, Map map, ActiveDropPodInfo info) { ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDefOf.ActiveDropPod); activeDropPod.Contents = info; SkyfallerMaker.SpawnSkyfaller(ThingDefOf.DropPodIncoming, activeDropPod, c, map); foreach (Thing item in (IEnumerable <Thing>)activeDropPod.Contents.innerContainer) { Pawn pawn; if ((pawn = (item as Pawn)) != null && pawn.IsWorldPawn()) { Find.WorldPawns.RemovePawn(pawn); pawn.psychicEntropy?.SetInitialPsyfocusLevel(); } } }
public void TryLaunch(int destinationTile, TransportPodsArrivalAction arrivalAction) { if (!this.parent.Spawned) { Log.Error("Tried to launch " + this.parent + ", but it's unspawned.", false); } else { List <CompTransporter> transportersInGroup = this.TransportersInGroup; if (transportersInGroup == null) { Log.Error("Tried to launch " + this.parent + ", but it's not in any group.", false); } else if (this.LoadingInProgressOrReadyToLaunch && this.AllInGroupConnectedToFuelingPort && this.AllFuelingPortSourcesInGroupHaveAnyFuel) { Map map = this.parent.Map; int num = Find.WorldGrid.TraversalDistanceBetween(map.Tile, destinationTile, true, int.MaxValue); if (num <= this.MaxLaunchDistance) { this.Transporter.TryRemoveLord(map); int groupID = this.Transporter.groupID; float amount = Mathf.Max(CompLaunchable.FuelNeededToLaunchAtDist((float)num), 1f); for (int i = 0; i < transportersInGroup.Count; i++) { CompTransporter compTransporter = transportersInGroup[i]; Building fuelingPortSource = compTransporter.Launchable.FuelingPortSource; if (fuelingPortSource != null) { fuelingPortSource.TryGetComp <CompRefuelable>().ConsumeFuel(amount); } ThingOwner directlyHeldThings = compTransporter.GetDirectlyHeldThings(); ActiveDropPod activeDropPod = (ActiveDropPod)ThingMaker.MakeThing(ThingDefOf.ActiveDropPod, null); activeDropPod.Contents = new ActiveDropPodInfo(); activeDropPod.Contents.innerContainer.TryAddRangeOrTransfer(directlyHeldThings, true, true); DropPodLeaving dropPodLeaving = (DropPodLeaving)SkyfallerMaker.MakeSkyfaller(ThingDefOf.DropPodLeaving, activeDropPod); dropPodLeaving.groupID = groupID; dropPodLeaving.destinationTile = destinationTile; dropPodLeaving.arrivalAction = arrivalAction; compTransporter.CleanUpLoadingVars(map); compTransporter.parent.Destroy(DestroyMode.Vanish); GenSpawn.Spawn(dropPodLeaving, compTransporter.parent.Position, map, WipeMode.Vanish); } CameraJumper.TryHideWorld(); } } } }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; if (!TryFindCell(out var cell, map)) { return(false); } List <Thing> list = ThingSetMakerDefOf.Meteorite.root.Generate(); SkyfallerMaker.SpawnSkyfaller(ThingDefOf.MeteoriteIncoming, list, cell, map); LetterDef baseLetterDef = (list[0].def.building.isResourceRock ? LetterDefOf.PositiveEvent : LetterDefOf.NeutralEvent); string str = string.Format(def.letterText, list[0].def.label).CapitalizeFirst(); SendStandardLetter(def.letterLabel + ": " + list[0].def.LabelCap, str, baseLetterDef, parms, new TargetInfo(cell, map)); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; if (!TryFindCell(out IntVec3 cell, map)) { return(false); } List <Thing> list = ThingSetMakerDefOf.Meteorite.root.Generate(); SkyfallerMaker.SpawnSkyfaller(ThingDefOf.MeteoriteIncoming, list, cell, map); LetterDef textLetterDef = (!list[0].def.building.isResourceRock) ? LetterDefOf.NeutralEvent : LetterDefOf.PositiveEvent; string text = string.Format(def.letterText, list[0].def.label).CapitalizeFirst(); Find.LetterStack.ReceiveLetter(def.letterLabel, text, textLetterDef, new TargetInfo(cell, map)); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; IntVec3 intVec = default(IntVec3); if (!this.TryFindCell(out intVec, map)) { return(false); } List <Thing> list = ItemCollectionGeneratorDefOf.Meteorite.Worker.Generate(default(ItemCollectionGeneratorParams)); SkyfallerMaker.SpawnSkyfaller(ThingDefOf.MeteoriteIncoming, list, intVec, map); LetterDef textLetterDef = (!list[0].def.building.isResourceRock) ? LetterDefOf.NeutralEvent : LetterDefOf.PositiveEvent; string text = string.Format(base.def.letterText, list[0].def.label).CapitalizeFirst(); Find.LetterStack.ReceiveLetter(base.def.letterLabel, text, textLetterDef, new TargetInfo(intVec, map, false), null); return(true); }
private void SpawnChunk(IntVec3 pos, Map map) { SkyfallerMaker.SpawnSkyfaller(ThingDefOf.ShipChunkIncoming, ThingDefOf.ShipChunk, pos, map); }
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, 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 MakeSkyfaller(ThingDef skyfaller, ThingDef innerThing) { Thing innerThing2 = ThingMaker.MakeThing(innerThing, null); return(SkyfallerMaker.MakeSkyfaller(skyfaller, innerThing2)); }