public static bool Prefix(TransportPodsArrivalAction_LandInSpecificCell __instance, List <ActiveDropPodInfo> pods, int tile, IntVec3 ___cell, MapParent ___mapParent)
 {
     //    Log.Message(string.Format("pods: {0}", pods.Count));
     foreach (ActiveDropPodInfo info in pods)
     {
         for (int i = 0; i < info.innerContainer.Count; i++)
         {
             Thing        dropship = info.innerContainer[i];
             CompDropship comp     = dropship.TryGetCompFast <CompDropship>();
             if (comp != null)
             {
                 //    Log.Message(string.Format("pods: {0}", info.innerContainer.ContentsString));
                 Thing    lookTarget = TransportPodsArrivalActionUtility.GetLookTarget(pods);
                 Traverse tv         = Traverse.Create(__instance);
                 IntVec3  c          = ___cell;
                 Map      map        = ___mapParent.Map;
                 TransportPodsArrivalActionUtility.RemovePawnsFromWorldPawns(pods);
                 for (int ii = 0; ii < pods.Count; ii++)
                 {
                     DropPodUtility.MakeDropPodAt(c, map, pods[ii]);
                 }
                 Messages.Message("AvP_USCM_Dropship_MessageArrived".Translate(), lookTarget, MessageTypeDefOf.TaskCompletion, true);
                 return(false);
             }
         }
     }
     return(true);
 }
Esempio n. 2
0
        public static bool Prefix(
            TransportPodsArrivalAction_LandInSpecificCell __instance,
            List <ActiveDropPodInfo> pods,
            int tile)
        {
            foreach (ActiveDropPodInfo pod in pods)
            {
                for (int index = 0; index < pod.innerContainer.Count; index++)
                {
                    if (pod.innerContainer[index].TryGetComp <CompLaunchableSRTS>() != null)
                    {
                        Thing    lookTarget = TransportPodsArrivalActionUtility.GetLookTarget(pods);
                        Traverse traverse   = Traverse.Create((object)__instance);
                        IntVec3  c          = traverse.Field("cell").GetValue <IntVec3>();
                        Map      map        = traverse.Field("mapParent").GetValue <MapParent>().Map;
                        TransportPodsArrivalActionUtility.RemovePawnsFromWorldPawns(pods);

                        for (int i = 0; i < pods.Count; ++i)
                        {
                            pods[i].openDelay = 0;
                            DropPodUtility.MakeDropPodAt(c, map, pods[i]);
                        }
                        Messages.Message("MessageTransportPodsArrived".Translate(), (LookTargets)lookTarget, MessageTypeDefOf.TaskCompletion, true);
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 3
0
        public override void Arrived(List <ActiveDropPodInfo> pods, int tile)
        {
            Thing      lookTarget    = TransportPodsArrivalActionUtility.GetLookTarget(pods);
            bool       flag          = !mapParent.HasMap;
            Map        orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(tile, null);
            Settlement settlement;

            if ((settlement = orGenerateMap.Parent as Settlement) != null && settlement.Faction != Faction.OfPlayer)
            {
                TaggedString letterLabel = "LetterLabelCaravanEnteredEnemyBase".Translate();
                TaggedString letterText  = "LetterShuttleLandedInEnemyBase".Translate(settlement.Label).CapitalizeFirst();
                SettlementUtility.AffectRelationsOnAttacked_NewTmp(settlement, ref letterText);
                if (flag)
                {
                    Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                    PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(orGenerateMap.mapPawns.AllPawns, ref letterLabel, ref letterText, "LetterRelatedPawnsInMapWherePlayerLanded".Translate(Faction.OfPlayer.def.pawnsPlural), informEvenIfSeenBefore: true);
                }
                Find.LetterStack.ReceiveLetter(letterLabel, letterText, LetterDefOf.NeutralEvent, lookTarget, settlement.Faction);
            }
            foreach (ActiveDropPodInfo pod in pods)
            {
                pod.missionShuttleHome      = missionShuttleHome;
                pod.missionShuttleTarget    = missionShuttleTarget;
                pod.sendAwayIfQuestFinished = sendAwayIfQuestFinished;
                pod.questTags = questTags;
            }
            PawnsArrivalModeDefOf.Shuttle.Worker.TravelingTransportPodsArrived(pods, orGenerateMap);
            Messages.Message("MessageShuttleArrived".Translate(), lookTarget, MessageTypeDefOf.TaskCompletion);
        }
Esempio n. 4
0
        private static bool Prefix(Site ___site, PawnsArrivalModeDef ___arrivalMode, List <ActiveDropPodInfo> pods)
        {
            if (___site.parts == null)
            {
                return(true);
            }

            foreach (var part in ___site.parts)
            {
                if (part.def != MFI_DefOf.MFI_HuntersLodgePart)
                {
                    continue;
                }

                var lookTarget    = TransportPodsArrivalActionUtility.GetLookTarget(pods);
                var num           = !___site.HasMap;
                var orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(___site.Tile,
                                                                             ___site.PreferredMapSize, null);
                if (num)
                {
                    Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                    PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns,
                                                                             "LetterRelatedPawnsInMapWherePlayerLanded".Translate(Faction.OfPlayer.def.pawnsPlural),
                                                                             LetterDefOf.NeutralEvent, true);
                }

                Messages.Message("MessageTransportPodsArrived".Translate(), lookTarget,
                                 MessageTypeDefOf.TaskCompletion);
                ___arrivalMode.Worker.TravelingTransportPodsArrived(pods, orGenerateMap);
                return(false);
            }

            return(true);
        }
Esempio n. 5
0
        public override void Arrived(List <ActiveDropPodInfo> pods, int tile)
        {
            Thing lookTarget = TransportPodsArrivalActionUtility.GetLookTarget(pods);

            BombRunArrivalUtility.BombWithSRTS(pods, this.targetCellA, this.targetCellB, this.bombCells, this.bombType, this.mapParent.Map, originalMap, originalLandingSpot);
            Messages.Message("BombRunStarted".Translate(), lookTarget, MessageTypeDefOf.CautionInput, true);
        }
        public override void Arrived(List <ActiveDropPodInfo> pods, int tile)
        {
            Thing lookTarget    = TransportPodsArrivalActionUtility.GetLookTarget(pods);
            bool  flag          = !this.site.HasMap;
            Map   orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(this.site.Tile, this.site.PreferredMapSize, null);

            if (flag)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns, "LetterRelatedPawnsInMapWherePlayerLanded".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, true, true);
            }
            if (this.site.Faction != null && this.site.Faction != Faction.OfPlayer)
            {
                Faction.OfPlayer.TryAffectGoodwillWith(this.site.Faction, Faction.OfPlayer.GoodwillToMakeHostile(this.site.Faction), true, true, HistoryEventDefOf.AttackedSettlement, null);
            }
            Messages.Message("MessageTransportPodsArrived".Translate(), lookTarget, MessageTypeDefOf.TaskCompletion, true);
            this.arrivalMode.Worker.TravelingTransportPodsArrived(pods, orGenerateMap);
        }
        public override void Arrived(List <ActiveDropPodInfo> pods, int tile)
        {
            Debug.Log("Overridden arrive pods");
            Thing lookTarget    = TransportPodsArrivalActionUtility.GetLookTarget(pods);
            bool  flag          = !site.HasMap;
            Map   orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(site.Tile, RuinedBaseWorker.MapSize, null);

            if (flag)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns, "LetterRelatedPawnsInMapWherePlayerLanded".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, informEvenIfSeenBefore: true);

                Find.LetterStack.ReceiveLetter("LetterLabelTransportPodsArrivedAtRuins".Translate(), "LetterTransportPodsArrivedAtRuins".Translate().CapitalizeFirst(), LetterDefOf.ThreatBig, lookTarget, null, null);
            }
            else
            {
                Messages.Message("MessageTransportPodsArrived".Translate(), lookTarget, MessageTypeDefOf.TaskCompletion);
            }
            arrivalMode.Worker.TravelingTransportPodsArrived(pods, orGenerateMap);
        }
Esempio n. 8
0
 public static bool Prefix(TransportPodsArrivalAction_LandInSpecificCell __instance, List <ActiveDropPodInfo> pods, int tile)
 {
     foreach (ActiveDropPodInfo info in pods)
     {
         if (info.innerContainer.Contains(ThingDef.Named("Building_Helicopter")))
         {
             Thing    lookTarget = TransportPodsArrivalActionUtility.GetLookTarget(pods);
             Traverse tv         = Traverse.Create(__instance);
             IntVec3  c          = tv.Field("cell").GetValue <IntVec3>();
             Map      map        = tv.Field("mapParent").GetValue <MapParent>().Map;
             TransportPodsArrivalActionUtility.RemovePawnsFromWorldPawns(pods);
             for (int i = 0; i < pods.Count; i++)
             {
                 DropPodUtility.MakeDropPodAt(c, map, pods[i]);
             }
             Messages.Message("MessageTransportPodsArrived".Translate(), lookTarget, MessageTypeDefOf.TaskCompletion, true);
             return(false);
         }
     }
     return(true);
 }
Esempio n. 9
0
        public override void Arrived(List <ActiveDropPodInfo> pods, int tile)
        {
            Debug.Log("Overridden arrive pods - visit POI");
            Thing lookTarget = TransportPodsArrivalActionUtility.GetLookTarget(pods);
            bool  flag       = !site.HasMap;

            TaggedString letterText    = null;
            TaggedString letterCaption = null;
            LetterDef    letterDef     = LetterDefOf.NeutralEvent;

            if (flag)
            {
                if (site.Faction == null)
                {
                    letterCaption = "LetterLabelCaravanEnteredUnownedPOI".Translate();
                    letterText    = "LetterTransportPodsArrivedInUnownedPOI".Translate().CapitalizeFirst();
                    letterDef     = LetterDefOf.NeutralEvent;
                }
                else
                {
                    letterCaption = "LetterLabelTransportPodsAttackedPOI".Translate();
                    letterText    = "LetterTransportPodsAttackedPOI".Translate().CapitalizeFirst();
                    letterDef     = LetterDefOf.ThreatBig;
                }
            }

            AffectRelationsIfNeeded(ref letterText);
            Find.LetterStack.ReceiveLetter(letterCaption, letterText, letterDef, lookTarget, null, null);


            Map orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(site.Tile, new IntVec3(250, 0, 250), null);

            if (flag)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns, "LetterRelatedPawnsInMapWherePlayerLanded".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, informEvenIfSeenBefore: true);
            }
            arrivalMode.Worker.TravelingTransportPodsArrived(pods, orGenerateMap);
        }
 public static bool Prefix(TransportPodsArrivalAction_LandInSpecificCell __instance, List <ActiveDropPodInfo> pods, int tile)
 {
     //    Log.Message(string.Format("pods: {0}", pods.Count));
     foreach (ActiveDropPodInfo info in pods)
     {
         if (info.innerContainer.Contains(USCMDefOf.RRY_USCM_DropshipUD4L))
         {
             //    Log.Message(string.Format("pods: {0}", info.innerContainer.ContentsString));
             Thing    lookTarget = TransportPodsArrivalActionUtility.GetLookTarget(pods);
             Traverse tv         = Traverse.Create(__instance);
             IntVec3  c          = tv.Field("cell").GetValue <IntVec3>();
             Map      map        = tv.Field("mapParent").GetValue <MapParent>().Map;
             TransportPodsArrivalActionUtility.RemovePawnsFromWorldPawns(pods);
             for (int i = 0; i < pods.Count; i++)
             {
                 DropPodUtility.MakeDropPodAt(c, map, pods[i]);
             }
             Messages.Message("USCM_Dropship_MessageArrived".Translate(), lookTarget, MessageTypeDefOf.TaskCompletion, true);
             return(false);
         }
     }
     return(true);
 }