牢砖的强制攻击

This commit is contained in:
2025-08-27 16:16:27 +08:00
parent 8d30daebe1
commit 5e4cbcedff
7 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
using HarmonyLib;
using Verse;
using RimWorld;
namespace WulaFallenEmpire
{
[HarmonyPatch(typeof(Building_ArmedShuttle), "get_CanSetForcedTarget")]
public static class Patch_Building_ArmedShuttle_CanSetForcedTarget
{
/// <summary>
/// Postfix patch to allow armed shuttles with CompForceTargetable to be manually targeted.
/// </summary>
public static void Postfix(Building_ArmedShuttle __instance, ref bool __result)
{
// If the result is already true, no need to do anything.
if (__result)
{
return;
}
// Check if the shuttle has our marker component and belongs to the player.
if (__instance.GetComp<CompForceTargetable>() != null && __instance.Faction == Faction.OfPlayer)
{
__result = true;
}
}
}
}