This commit is contained in:
2025-08-28 12:23:30 +08:00
parent d22a3c268a
commit c5201d26b7
8 changed files with 3150 additions and 73 deletions

View File

@@ -1,28 +0,0 @@
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;
}
}
}
}

View File

@@ -142,7 +142,7 @@ namespace WulaFallenEmpire
public virtual Verb AttackVerb => GunCompEq.PrimaryVerb;
public bool IsMannable => mannableComp != null;
private bool PlayerControlled => (base.Faction == Faction.OfPlayer || MannedByColonist) && !MannedByNonColonist && !IsActivable;
protected virtual bool CanSetForcedTarget => mannableComp != null && PlayerControlled;
protected virtual bool CanSetForcedTarget => (mannableComp != null || GetComp<CompForceTargetable>() != null) && PlayerControlled;
private bool CanToggleHoldFire => PlayerControlled;
private bool IsMortar => def.building.IsMortar;
private bool IsMortarOrProjectileFliesOverhead => AttackVerb.ProjectileFliesOverhead() || IsMortar;

View File

@@ -190,7 +190,6 @@
<Compile Include="HediffComp_GiveHediffsInRangeToRace.cs" />
<Compile Include="CompForceTargetable.cs" />
<Compile Include="Patch_ForceTargetable.cs" />
<Compile Include="Patch_ArmedShuttle_ForceTargetable.cs" />
<Compile Include="Verb\VerbProperties_Excalibur.cs" />
<Compile Include="Verb\Verb_Excalibur.cs" />
</ItemGroup>