private void DoArrivalAction() { for (int i = 0; i < this.pods.Count; i++) { this.pods[i].savePawnsWithReferenceMode = false; this.pods[i].parent = null; } if (this.arrivalAction != null) { try { this.arrivalAction.Arrived(this.pods, this.destinationTile); } catch (Exception arg) { Log.Error("Exception in transport pods arrival action: " + arg, false); } this.arrivalAction = null; } else { for (int j = 0; j < this.pods.Count; j++) { this.pods[j].innerContainer.ClearAndDestroyContentsOrPassToWorld(DestroyMode.Vanish); } Messages.Message("MessageTransportPodsArrivedAndLost".Translate(), new GlobalTargetInfo(this.destinationTile), MessageTypeDefOf.NegativeEvent, true); } this.pods.Clear(); Find.WorldObjects.Remove(this); }
private void Arrived() { if (this.arrived) { return; } this.arrived = true; if (this.arrivalAction == null || !this.arrivalAction.StillValid(this.pods.Cast <IThingHolder>(), this.destinationTile)) { this.arrivalAction = null; List <Map> maps = Find.Maps; for (int i = 0; i < maps.Count; i++) { if (maps[i].Tile == this.destinationTile) { this.arrivalAction = new TransportPodsArrivalAction_LandInSpecificCell(maps[i].Parent, DropCellFinder.RandomDropSpot(maps[i])); break; } } if (this.arrivalAction == null) { if (TransportPodsArrivalAction_FormCaravan.CanFormCaravanAt(this.pods.Cast <IThingHolder>(), this.destinationTile)) { this.arrivalAction = new TransportPodsArrivalAction_FormCaravan(); } else { List <Caravan> caravans = Find.WorldObjects.Caravans; for (int j = 0; j < caravans.Count; j++) { if (caravans[j].Tile == this.destinationTile && TransportPodsArrivalAction_GiveToCaravan.CanGiveTo(this.pods.Cast <IThingHolder>(), caravans[j])) { this.arrivalAction = new TransportPodsArrivalAction_GiveToCaravan(caravans[j]); break; } } } } } if (this.arrivalAction != null && this.arrivalAction.ShouldUseLongEvent(this.pods, this.destinationTile)) { LongEventHandler.QueueLongEvent(delegate() { this.DoArrivalAction(); }, "GeneratingMapForNewEncounter", false, null); } else { this.DoArrivalAction(); } }
private void DoArrivalAction() { for (int i = 0; i < pods.Count; i++) { pods[i].savePawnsWithReferenceMode = false; pods[i].parent = null; } if (arrivalAction != null) { try { arrivalAction.Arrived(pods, destinationTile); } catch (Exception arg) { Log.Error("Exception in transport pods arrival action: " + arg); } arrivalAction = null; } else { for (int j = 0; j < pods.Count; j++) { for (int k = 0; k < pods[j].innerContainer.Count; k++) { Pawn pawn = pods[j].innerContainer[k] as Pawn; if (pawn != null && (pawn.Faction == Faction.OfPlayer || pawn.HostFaction == Faction.OfPlayer)) { PawnBanishUtility.Banish(pawn, destinationTile); } } } for (int l = 0; l < pods.Count; l++) { pods[l].innerContainer.ClearAndDestroyContentsOrPassToWorld(); } string key = "MessageTransportPodsArrivedAndLost"; if (def == WorldObjectDefOf.TravelingShuttle) { key = "MessageShuttleArrivedContentsLost"; } Messages.Message(key.Translate(), new GlobalTargetInfo(destinationTile), MessageTypeDefOf.NegativeEvent); } pods.Clear(); Destroy(); }