private void TryLaunch(GlobalTargetInfo target, PawnsArrivalModeDef arriveMode, bool attackOnArrival)
        {
            Cthulhu.Utility.DebugReport("TryLaunch Called");
            if (!this.parent.Spawned)
            {
                Log.Error("Tried to launch " + this.parent + ", but it's unspawned.");
                return;
            }
            List <CompTransporterPawn> transportersInGroup = this.TransportersInGroup;

            if (transportersInGroup == null)
            {
                Log.Error("Tried to launch " + this.parent + ", but it's not in any group.");
                return;
            }
            if (!this.LoadingInProgressOrReadyToLaunch)
            {
                Cthulhu.Utility.DebugReport("TryLaunch Failed");
                return;
            }
            Map map = this.parent.Map;
            int num = Find.WorldGrid.TraversalDistanceBetween(map.Tile, target.Tile);

            if (num > this.MaxLaunchDistance)
            {
                Cthulhu.Utility.DebugReport("TryLaunch Failed #2");
                return;
            }
            this.Transporter.TryRemoveLord(map);
            int groupID = this.Transporter.groupID;

            for (int i = 0; i < transportersInGroup.Count; i++)
            {
                Cthulhu.Utility.DebugReport("Transporter Outspawn Attempt");
                CompTransporterPawn compTransporter = transportersInGroup[i];
                Cthulhu.Utility.DebugReport("Transporter Outspawn " + compTransporter.parent.Label);
                PawnFlyersLeaving pawnFlyerLeaving = (PawnFlyersLeaving)ThingMaker.MakeThing(PawnFlyerDef.leavingDef, null);
                pawnFlyerLeaving.groupID         = groupID;
                pawnFlyerLeaving.pawnFlyer       = this.parent as PawnFlyer;
                pawnFlyerLeaving.destinationTile = target.Tile;
                pawnFlyerLeaving.destinationCell = target.Cell;
                pawnFlyerLeaving.arriveMode      = arriveMode;
                pawnFlyerLeaving.attackOnArrival = attackOnArrival;
                ThingOwner innerContainer = compTransporter.GetDirectlyHeldThings();
                pawnFlyerLeaving.Contents = new ActiveDropPodInfo();
                innerContainer.TryTransferAllToContainer(pawnFlyerLeaving.Contents.innerContainer);
                //pawnFlyerLeaving.Contents.innerContainer. //TryAddMany(innerContainer);
                innerContainer.Clear();
                compTransporter.CleanUpLoadingVars(map);
                compTransporter.parent.DeSpawn();
                pawnFlyerLeaving.Contents.innerContainer.TryAdd(compTransporter.parent);
                GenSpawn.Spawn(pawnFlyerLeaving, compTransporter.parent.Position, map);
            }
        }
예제 #2
0
        private void GiveRewardsAndSendLetter()
        {
            Map map = Find.AnyPlayerHomeMap ?? ((MapParent)parent).Map;

            tmpRewards.AddRange(rewards);
            rewards.Clear();
            IntVec3 intVec = DropCellFinder.TradeDropSpot(map);

            DropPodUtility.DropThingsNear(intVec, map, tmpRewards, 110, canInstaDropDuringInit: false, leaveSlag: false, canRoofPunch: false);
            tmpRewards.Clear();
            FactionRelationKind playerRelationKind = requestingFaction.PlayerRelationKind;
            string text = "LetterDefeatAllEnemiesQuestCompleted".Translate(requestingFaction.Name, relationsImprovement.ToString());

            requestingFaction.TryAffectGoodwillWith(Faction.OfPlayer, relationsImprovement, canSendMessage: false, canSendHostilityLetter: false);
            requestingFaction.TryAppendRelationKindChangedInfo(ref text, playerRelationKind, requestingFaction.PlayerRelationKind);
            Find.LetterStack.ReceiveLetter("LetterLabelDefeatAllEnemiesQuestCompleted".Translate(), text, LetterDefOf.PositiveEvent, new GlobalTargetInfo(intVec, map), requestingFaction);
        }
예제 #3
0
        public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
        {
            Actor actor = null;

            if (!Bugged)
            {
                actor = InnerActor;
                NotifyColonistBar();
                innerContainer.Clear();
            }
            base.Destroy(mode);
            if (actor == null)
            {
                return;
            }
            PostCorpseDestroy(actor);
        }
예제 #4
0
파일: Caravan.cs 프로젝트: potsh/RimWorld
 public void RemoveAllPawns()
 {
     pawns.Clear();
 }