コード例 #1
0
            private static bool?Allow_Friendly_SRTSIncoming(bool?result, Skyfaller skyfaller, IShieldQueryWithIntersects shields)
            {
                if (result == null)
                {
                    switch (skyfaller)
                    {
                    case SRTSIncoming incoming:
                        // as of this writing, ships are only controlled by the player and the ship has no faction assigned
                        // try to get the ship faction for future proofing but fallback to the player
                        var faction = incoming.Faction ?? Faction.OfPlayer;

                        var blocked = shields
                                      .FriendlyTo(faction, true)
                                      // TODO calculate damage based on mass and cargo
                                      .Block(Mod.Settings.SkyfallerDamage);
                        if (blocked)
                        {
                            Harmony_Skyfaller.KillPawns(
                                incoming.Contents.GetDirectlyHeldThings().OfType <Pawn>(),
                                incoming.Map,
                                incoming.Position);
                            Messages.Message("fd.shields.incident.ship.blocked.body".Translate(),
                                             new GlobalTargetInfo(incoming.Position, incoming.Map),
                                             MessageTypeDefOf.NeutralEvent);
                            incoming.Destroy();
                            return(false);
                        }
                        return(true);
                    }
                }
                return(result);
            }
コード例 #2
0
ファイル: Module.cs プロジェクト: Proxyer/Shields
        public Module(ModContentPack content) : base(content)
        {
            var harmony = new HarmonyLib.Harmony("FrontierDevelopments.Shields1.2");

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            Harmony_Verb.BlacklistType(typeof(Verb_Bombardment));

            // support for Cargo Pod transport
            Harmony_Skyfaller.WhitelistDef("HelicopterIncoming");
            Harmony_Skyfaller.WhitelistDef("HelicopterLeaving");
        }
コード例 #3
0
ファイル: Mod.cs プロジェクト: neoaisac/Shields
        public Mod(ModContentPack content) : base(content)
        {
            Settings = GetSettings <Settings>();
            ModName  = content.Name;

            var harmony = HarmonyInstance.Create("frontierdevelopment.shields");

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            Harmony_Verb.BlacklistType(typeof(Verb_Bombardment));

            // support for Cargo Pod transport
            Harmony_Skyfaller.WhitelistDef("HelicopterIncoming");
            Harmony_Skyfaller.WhitelistDef("HelicopterLeaving");

            LoadOneTemperatureMod(harmony);
            new CombatExtendedIntegration().TryEnable(harmony);
        }