Exemple #1
0
        public override void LeaveMap()
        {
            if (this.groupID < 0 && this.destinationTile < 0)
            {
                this.Destroy(DestroyMode.Vanish);
                return;
            }
            if (this.alreadyLeft)
            {
                base.LeaveMap();
                return;
            }
            if (this.groupID < 0)
            {
                Log.Error("Drop pod left the map, but its group ID is " + this.groupID, false);
                this.Destroy(DestroyMode.Vanish);
                return;
            }
            if (this.destinationTile < 0)
            {
                Log.Error("Drop pod left the map, but its destination tile is " + this.destinationTile, false);
                this.Destroy(DestroyMode.Vanish);
                return;
            }
            Lord lord = TransporterUtility.FindLord(this.groupID, base.Map);

            if (lord != null)
            {
                base.Map.lordManager.RemoveLord(lord);
            }

            DropShipTraveling travelingTransportPods = (DropShipTraveling)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed(Regex.Replace(this.def.defName, "_Leaving", "_Traveling"), true));

            travelingTransportPods.Tile = base.Map.Tile;
            travelingTransportPods.SetFaction(Faction.OfPlayer);
            travelingTransportPods.destinationTile = this.destinationTile;
            travelingTransportPods.arrivalAction   = this.arrivalAction;
            Find.WorldObjects.Add(travelingTransportPods);
            DropShipLeaving.tmpActiveDropPods.Clear();
            DropShipLeaving.tmpActiveDropPods.AddRange(base.Map.listerThings.ThingsInGroup(ThingRequestGroup.ActiveDropPod));
            travelingTransportPods.flyingThing = DropShipLeaving.tmpActiveDropPods.Find(delegate(Thing x)
            {
                DropShipLeaving dropshipleaving2 = x as DropShipLeaving;
                int?num  = (dropshipleaving2 != null) ? new int?(dropshipleaving2.groupID) : null;
                int num2 = this.groupID;
                return(num.GetValueOrDefault() == num2 & num != null);
            });
            for (int i = 0; i < DropShipLeaving.tmpActiveDropPods.Count; i++)
            {
                DropShipLeaving DropshipLeaving = DropShipLeaving.tmpActiveDropPods[i] as DropShipLeaving;
                if (DropshipLeaving != null && DropshipLeaving.groupID == this.groupID)
                {
                    DropshipLeaving.alreadyLeft = true;
                    travelingTransportPods.AddPod(DropshipLeaving.Contents, true);
                    DropshipLeaving.Contents = null;
                    DropshipLeaving.Destroy(DestroyMode.Vanish);
                }
            }
        }
Exemple #2
0
        // Token: 0x0600271E RID: 10014 RVA: 0x00129D34 File Offset: 0x00128134
        protected override void LeaveMap()
        {
            if (this.groupID < 0 && this.destinationTile < 0)
            {
                this.Destroy(DestroyMode.Vanish);
                return;
            }
            if (this.alreadyLeft)
            {
                base.LeaveMap();
                return;
            }
            if (this.groupID < 0)
            {
                Log.Error("Drop pod left the map, but its group ID is " + this.groupID, false);
                this.Destroy(DestroyMode.Vanish);
                return;
            }
            if (this.destinationTile < 0)
            {
                Log.Error("Drop pod left the map, but its destination tile is " + this.destinationTile, false);
                this.Destroy(DestroyMode.Vanish);
                return;
            }
            Lord lord = TransporterUtility.FindLord(this.groupID, base.Map);

            if (lord != null)
            {
                base.Map.lordManager.RemoveLord(lord);
            }
            TravelingTransportPods travelingTransportPods = (TravelingTransportPods)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed("RRY_USCM_TravelingDropshipUD4L", true));

            travelingTransportPods.Tile = base.Map.Tile;
            travelingTransportPods.SetFaction(Faction.OfPlayer);
            travelingTransportPods.destinationTile = this.destinationTile;
            travelingTransportPods.arrivalAction   = this.arrivalAction;
            Find.WorldObjects.Add(travelingTransportPods);
            DropShipLeaving.tmpActiveDropPods.Clear();
            DropShipLeaving.tmpActiveDropPods.AddRange(base.Map.listerThings.ThingsInGroup(ThingRequestGroup.ActiveDropPod));
            for (int i = 0; i < DropShipLeaving.tmpActiveDropPods.Count; i++)
            {
                DropShipLeaving DropshipLeaving = DropShipLeaving.tmpActiveDropPods[i] as DropShipLeaving;
                if (DropshipLeaving != null && DropshipLeaving.groupID == this.groupID)
                {
                    DropshipLeaving.alreadyLeft = true;
                    travelingTransportPods.AddPod(DropshipLeaving.Contents, true);
                    DropshipLeaving.Contents = null;
                    DropshipLeaving.Destroy(DestroyMode.Vanish);
                }
            }
        }
 protected override void LeaveMap()
 {
     ModOptions.Constants.SetPawnInFlight(true);
     if (alreadyLeft)
     {
         base.LeaveMap();
     }
     else if (groupID < 0)
     {
         Log.Error("Drop pod left the map, but its group ID is " + groupID);
         Destroy();
     }
     else if (destinationTile < 0)
     {
         Log.Error("Drop pod left the map, but its destination tile is " + destinationTile);
         Destroy();
     }
     else
     {
         Lord lord = TransporterUtility.FindLord(groupID, base.Map);
         if (lord != null)
         {
             base.Map.lordManager.RemoveLord(lord);
         }
         WorldTransport.TM_TravelingTransportPods travelingTransportPods = (WorldTransport.TM_TravelingTransportPods)WorldObjectMaker.MakeWorldObject(TorannMagicDefOf.TM_TravelingTransportLightBeam);
         travelingTransportPods.Tile = base.Map.Tile;
         travelingTransportPods.SetFaction(Faction.OfPlayer);
         travelingTransportPods.destinationTile = destinationTile;
         travelingTransportPods.arrivalAction   = arrivalAction;
         travelingTransportPods.destinationCell = arrivalCell;
         if (this.def == TorannMagicDefOf.TM_LightPodLeaving)
         {
             travelingTransportPods.TravelSpeed = .025f;
             travelingTransportPods.draftFlag   = this.draftFlag;
         }
         Find.WorldObjects.Add(travelingTransportPods);
         tmpActiveDropPods.Clear();
         tmpActiveDropPods.AddRange(base.Map.listerThings.ThingsInGroup(ThingRequestGroup.ActiveDropPod));
         for (int i = 0; i < tmpActiveDropPods.Count; i++)
         {
             WorldTransport.TM_DropPodLeaving dropPodLeaving = tmpActiveDropPods[i] as WorldTransport.TM_DropPodLeaving;
             if (dropPodLeaving != null && dropPodLeaving.groupID == groupID)
             {
                 dropPodLeaving.alreadyLeft = true;
                 travelingTransportPods.AddPod(dropPodLeaving.Contents, justLeftTheMap: true);
                 dropPodLeaving.Contents = null;
                 dropPodLeaving.Destroy();
             }
         }
     }
 }
Exemple #4
0
        protected override void LeaveMap()
        {
            if (this.alreadyLeft)
            {
                base.LeaveMap();
            }
            else if (this.groupID < 0)
            {
                Log.Error("Drop pod left the map, but its group ID is " + (object)this.groupID);
                this.Destroy(DestroyMode.Vanish);
            }
            else if (this.destinationTile < 0)
            {
                Log.Error("Drop pod left the map, but its destination tile is " + (object)this.destinationTile);
                this.Destroy(DestroyMode.Vanish);
            }
            else
            {
                Lord lord = TransporterUtility.FindLord(this.groupID, this.Map);
                if (lord != null)
                {
                    this.Map.lordManager.RemoveLord(lord);
                }
                TravelingSRTS travelingTransportPods = (TravelingSRTS)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed("TravelingSRTS", true));
                travelingTransportPods.Tile = this.Map.Tile;
                travelingTransportPods.SetFaction(Faction.OfPlayer);
                travelingTransportPods.destinationTile = this.destinationTile;
                travelingTransportPods.arrivalAction   = this.arrivalAction;

                Find.WorldObjects.Add((WorldObject)travelingTransportPods);
                SRTSLeaving.tmpActiveDropPods.Clear();
                SRTSLeaving.tmpActiveDropPods.AddRange((IEnumerable <Thing>) this.Map.listerThings.ThingsInGroup(ThingRequestGroup.ActiveDropPod));
                travelingTransportPods.flyingThing = tmpActiveDropPods.Find(x => (x as SRTSLeaving)?.groupID == this.groupID);
                for (int index = 0; index < SRTSLeaving.tmpActiveDropPods.Count; ++index)
                {
                    SRTSLeaving tmpActiveDropPod = SRTSLeaving.tmpActiveDropPods[index] as SRTSLeaving;
                    if (tmpActiveDropPod != null && tmpActiveDropPod.groupID == this.groupID)
                    {
                        tmpActiveDropPod.alreadyLeft = true;
                        travelingTransportPods.AddPod(tmpActiveDropPod.Contents, true);
                        tmpActiveDropPod.Contents = (ActiveDropPodInfo)null;
                        tmpActiveDropPod.Destroy(DestroyMode.Vanish);
                    }
                }
            }
        }