public static Boolean ImpactPrefix(ref DropPodIncoming __instance)
        {
            //Log.Message("Impact");


            //This looks to include the Player Faction as Bring Friendly to Itself.
            bool _Hostile = __instance.Contents.innerContainer.Any(x => x.Faction.HostileTo(Faction.OfPlayer));

            if (__instance.Map.GetComponent <ShieldManagerMapComp>().WillDropPodBeIntercepted(__instance, _Hostile))
            {
                {
                    for (int i = 0; i < 6; i++)
                    {
                        Vector3 loc = __instance.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f);
                        MoteMaker.ThrowDustPuff(loc, __instance.Map, 1.2f);
                    }
                    MoteMaker.ThrowLightningGlow(__instance.Position.ToVector3Shifted(), __instance.Map, 2f);

                    GenExplosion.DoExplosion(__instance.Position, __instance.Map, 2, DamageDefOf.Burn, __instance);
                    __instance.Destroy();

                    //Retuen False so the origional method is not executed.
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
        // prefix
        // - wants instance, result and count
        // - wants to change count
        // - returns a boolean that controls if original is executed (true) or not (false)
        public static Boolean DropPodIncomingImpactPrefix(ref DropPodIncoming __instance)
        {
            Log.Message("Dp incoming called.");

            if (__instance.Map.GetComponent <ShieldManagerMapComp>().WillDropPodBeIntercepted(__instance)) // if the droppod is being intercepted, prevent it from spawning the contents.
            {
                __instance.innerContainer.ClearAndDestroyContents(DestroyMode.Vanish);
                SkyfallerShrapnelUtility.MakeShrapnel(__instance.Position, __instance.Map, __instance.shrapnelDirection, __instance.def.skyfaller.shrapnelDistanceFactor, 3, 0, true);
                Find.CameraDriver.shaker.DoShake(__instance.def.skyfaller.cameraShake);
                SoundStarter.PlayOneShot(DamageDefOf.Bomb.soundExplosion, SoundInfo.InMap(new TargetInfo(__instance.Position, __instance.Map)));
                __instance.Destroy(DestroyMode.Vanish);

                return(false);
            }

            //Retuen False so the origional method is not executed, overriting the false result.
            return(true);
        }
示例#3
0
 private static bool HandlePod(DropPodIncoming pod)
 {
     try
     {
         if (pod.Map.GetComponent <ShieldManager>().Block(PositionUtility.ToVector3WithY(pod.Position, 0), Mod.Settings.DropPodDamage))
         {
             // OfType<Pawn>() causes weirdness here
             foreach (var pawn in pod.Contents.innerContainer.Where(p => p is Pawn).Select(p => (Pawn)p))
             {
                 KillPawn(pawn, pod.Position, pod.Map);
             }
             pod.Destroy();
             Messages.Message("fd.shields.incident.droppod.blocked.body".Translate(), new GlobalTargetInfo(pod.Position, pod.Map), MessageTypeDefOf.NeutralEvent);
             return(false);
         }
     }
     catch (InvalidOperationException) {}
     return(true);
 }