新增天巫种对敌方空投袭击的自动拦截功能: - GameComponent_DropPodInterceptor: 全局拦截状态管理与核心逻辑 - Harmony Prefix 挂钩 EdgeDrop/CenterDrop Arrive(),拦截 1-3 个运输仓 - 被拦截 Pawn 击杀(Bite)后尸体以空投仓形式落地 - 拦截时生成天巫种 FlyOver 视觉飞越 + PositiveEvent 信件通知 - 引航种新增 ARA_ToggleDropPodIntercept 自释放能力切换开关 - 前置检查:开关启用 + 天巫升空 + 敌对派系,至少保留 1 名袭击者 新增文件: - Source/.../GameComponent_DropPodInterceptor.cs - Source/.../Patch_DropPodIntercept.cs - Source/.../CompAbilityEffect_ToggleDropPodIntercept.cs - Defs/AbilityDefs/Ability_DropPodIntercept.xml 修改文件: - ARA_PawnKinds.xml (Skyraider abilities) - AirStrike_Keys.xml (10 localization keys) - ArachnaeSwarm.csproj (3 Compile entries)
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using HarmonyLib;
|
|
using RimWorld;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Verse;
|
|
|
|
namespace ArachnaeSwarm
|
|
{
|
|
[HarmonyPatch(typeof(PawnsArrivalModeWorker_EdgeDrop), nameof(PawnsArrivalModeWorker_EdgeDrop.Arrive))]
|
|
public static class Patch_DropPodIntercept_EdgeDrop
|
|
{
|
|
[HarmonyPrefix]
|
|
public static bool Prefix(List<Pawn> pawns, IncidentParms parms)
|
|
{
|
|
return Patch_DropPodIntercept.InterceptPrefix(pawns, parms);
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(PawnsArrivalModeWorker_CenterDrop), nameof(PawnsArrivalModeWorker_CenterDrop.Arrive))]
|
|
public static class Patch_DropPodIntercept_CenterDrop
|
|
{
|
|
[HarmonyPrefix]
|
|
public static bool Prefix(List<Pawn> pawns, IncidentParms parms)
|
|
{
|
|
return Patch_DropPodIntercept.InterceptPrefix(pawns, parms);
|
|
}
|
|
}
|
|
|
|
public static class Patch_DropPodIntercept
|
|
{
|
|
public static bool InterceptPrefix(List<Pawn> pawns, IncidentParms parms)
|
|
{
|
|
try
|
|
{
|
|
GameComponent_DropPodInterceptor interceptor = Current.Game?.GetComponent<GameComponent_DropPodInterceptor>();
|
|
interceptor?.TryInterceptDropPods(pawns, parms, out _);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ArachnaeLog.Debug($"DropPodInterceptor prefix exception: {ex}");
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|