diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll
index 4d98b7f6..2c897c8f 100644
Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ
diff --git a/1.6/1.6/Defs/AbilityDefs/WULA_Flyover_Ability.xml b/1.6/1.6/Defs/AbilityDefs/WULA_Flyover_Ability.xml
index b786355c..ff67dd3e 100644
--- a/1.6/1.6/Defs/AbilityDefs/WULA_Flyover_Ability.xml
+++ b/1.6/1.6/Defs/AbilityDefs/WULA_Flyover_Ability.xml
@@ -38,6 +38,13 @@
OppositeMapEdge
true
+
+ 航道堵塞:已经有一艘大型舰船在殖民地上空
+
+
+
+
+
@@ -78,6 +85,13 @@
OppositeMapEdge
true
+
+ 航道堵塞:已经有一艘大型舰船在殖民地上空
+
+
+
+
+
@@ -118,6 +132,13 @@
OppositeMapEdge
true
+
+ 航道堵塞:已经有一艘大型舰船在殖民地上空
+
+
+
+
+
diff --git a/Source/WulaFallenEmpire/Flyover/WULA_BlockedByFlyOverFacility/CompAbilityEffect_BlockedByFlyOverFacility.cs b/Source/WulaFallenEmpire/Flyover/WULA_BlockedByFlyOverFacility/CompAbilityEffect_BlockedByFlyOverFacility.cs
new file mode 100644
index 00000000..7a66d458
--- /dev/null
+++ b/Source/WulaFallenEmpire/Flyover/WULA_BlockedByFlyOverFacility/CompAbilityEffect_BlockedByFlyOverFacility.cs
@@ -0,0 +1,164 @@
+using RimWorld;
+using Verse;
+using System.Collections.Generic;
+
+namespace WulaFallenEmpire
+{
+ public class CompAbilityEffect_BlockedByFlyOverFacility : CompAbilityEffect
+ {
+ public new CompProperties_BlockedByFlyOverFacility Props => (CompProperties_BlockedByFlyOverFacility)props;
+
+ public override bool CanApplyOn(LocalTargetInfo target, LocalTargetInfo dest)
+ {
+ if (!base.CanApplyOn(target, dest))
+ return false;
+
+ // 检查是否有FlyOver存在
+ if (HasFlyOverWithFacilities())
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
+ {
+ if (!base.Valid(target, throwMessages))
+ return false;
+
+ // 检查是否有FlyOver存在
+ if (HasFlyOverWithFacilities())
+ {
+ if (throwMessages)
+ {
+ Messages.Message(Props.blockedMessage, parent.pawn, MessageTypeDefOf.RejectInput);
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ public override bool GizmoDisabled(out string reason)
+ {
+ if (parent.pawn?.Map == null)
+ {
+ reason = "Cannot use outside of map";
+ return true;
+ }
+
+ // 检查是否有FlyOver存在
+ if (HasFlyOverWithFacilities())
+ {
+ reason = Props.blockedMessage;
+ return true;
+ }
+
+ return base.GizmoDisabled(out reason);
+ }
+
+ public override string ExtraLabelMouseAttachment(LocalTargetInfo target)
+ {
+ try
+ {
+ var flyOvers = GetFlyOversWithFacilities();
+
+ if (flyOvers.Count > 0)
+ {
+ return $"航道堵塞: {flyOvers.Count}个飞行器在场上";
+ }
+
+ return "航道畅通";
+ }
+ catch (System.Exception ex)
+ {
+ Log.Error($"[BlockedByFlyOverFacility] Error in ExtraLabelMouseAttachment: {ex}");
+ return "航道状态检查错误";
+ }
+ }
+
+ // 检查是否有任何FlyOver携带设施组件
+ private bool HasFlyOverWithFacilities()
+ {
+ return GetFlyOversWithFacilities().Count > 0;
+ }
+
+ // 获取所有携带设施组件的FlyOver
+ private List GetFlyOversWithFacilities()
+ {
+ var flyOversWithFacilities = new List();
+
+ if (parent.pawn?.Map == null)
+ return flyOversWithFacilities;
+
+ try
+ {
+ // 获取地图上所有FlyOver
+ var allFlyOvers = new List();
+ var dynamicObjects = parent.pawn.Map.dynamicDrawManager.DrawThings;
+
+ foreach (var thing in dynamicObjects)
+ {
+ if (thing is FlyOver flyOver && !flyOver.Destroyed)
+ {
+ allFlyOvers.Add(thing);
+ }
+ }
+
+ // 筛选携带设施组件的FlyOver
+ foreach (var thing in allFlyOvers)
+ {
+ if (thing is FlyOver flyOver)
+ {
+ var facilitiesComp = flyOver.GetComp();
+ if (facilitiesComp != null)
+ {
+ flyOversWithFacilities.Add(flyOver);
+ }
+ }
+ }
+
+ Log.Message($"[BlockedByFlyOverFacility] Found {flyOversWithFacilities.Count} FlyOvers with facilities");
+
+ return flyOversWithFacilities;
+ }
+ catch (System.Exception ex)
+ {
+ Log.Error($"[BlockedByFlyOverFacility] Error in GetFlyOversWithFacilities: {ex}");
+ return new List();
+ }
+ }
+
+ // 重写:应用时也进行检查
+ public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
+ {
+ // 在应用前再次检查,确保安全
+ if (HasFlyOverWithFacilities())
+ {
+ Log.Warning($"[BlockedByFlyOverFacility] Attempted to use ability while FlyOvers are present");
+ Messages.Message(Props.blockedMessage, parent.pawn, MessageTypeDefOf.RejectInput);
+ return;
+ }
+
+ base.Apply(target, dest);
+ }
+ }
+
+ public class CompProperties_BlockedByFlyOverFacility : CompProperties_AbilityEffect
+ {
+ // 堵塞时显示的消息
+ public string blockedMessage = "航道堵塞:场上有飞行器,无法释放技能";
+
+ // 可选:可以指定特定的FlyOver定义,如果为空则检查所有FlyOver
+ public ThingDef specificFlyOverDef;
+
+ // 可选:可以指定特定的设施名称,如果为空则检查任何设施
+ public string requiredFacility;
+
+ public CompProperties_BlockedByFlyOverFacility()
+ {
+ compClass = typeof(CompAbilityEffect_BlockedByFlyOverFacility);
+ }
+ }
+}
diff --git a/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompFlyOverFacilities.cs b/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompFlyOverFacilities.cs
index 8615ee26..ec956333 100644
--- a/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompFlyOverFacilities.cs
+++ b/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompFlyOverFacilities.cs
@@ -16,6 +16,65 @@ namespace WulaFallenEmpire
var cooldownComp = parent.GetComp();
return cooldownComp == null || !cooldownComp.IsOnCooldown;
}
+ // 在 CompFlyOverFacilities 类中添加以下静态方法
+ public static bool AnyFlyOverHasFacilities(Map map)
+ {
+ if (map == null)
+ return false;
+ try
+ {
+ var dynamicObjects = map.dynamicDrawManager.DrawThings;
+
+ foreach (var thing in dynamicObjects)
+ {
+ if (thing is FlyOver flyOver && !flyOver.Destroyed)
+ {
+ var facilitiesComp = flyOver.GetComp();
+ if (facilitiesComp != null)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+ catch (System.Exception ex)
+ {
+ Log.Error($"[FlyOverFacilities] Error in AnyFlyOverHasFacilities: {ex}");
+ return false;
+ }
+ }
+ public static List GetAllFlyOversWithFacilities(Map map)
+ {
+ var result = new List();
+
+ if (map == null)
+ return result;
+ try
+ {
+ var dynamicObjects = map.dynamicDrawManager.DrawThings;
+
+ foreach (var thing in dynamicObjects)
+ {
+ if (thing is FlyOver flyOver && !flyOver.Destroyed)
+ {
+ var facilitiesComp = flyOver.GetComp();
+ if (facilitiesComp != null)
+ {
+ result.Add(flyOver);
+ }
+ }
+ }
+
+ return result;
+ }
+ catch (System.Exception ex)
+ {
+ Log.Error($"[FlyOverFacilities] Error in GetAllFlyOversWithFacilities: {ex}");
+ return result;
+ }
+ }
public string GetFacilityStatus(string facilityName)
{
diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj
index 9a2ece80..6a5bbb29 100644
--- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj
+++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj
@@ -98,12 +98,12 @@
+
-