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); }
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"); }
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); }