This commit is contained in:
2025-12-28 15:31:14 +08:00
parent 180f678173
commit 0ce11a0d86
6 changed files with 90 additions and 28 deletions

View File

@@ -143,16 +143,18 @@
<cooldownTicksRange>1</cooldownTicksRange>
<hotKey>Misc12</hotKey>
<casterMustBeCapableOfViolence>false</casterMustBeCapableOfViolence>
<displayGizmoWhileUndrafted>true</displayGizmoWhileUndrafted>
<disableGizmoWhileUndrafted>false</disableGizmoWhileUndrafted>
<verbProperties>
<verbClass>Verb_CastAbility</verbClass>
<drawAimPie>false</drawAimPie>
<requireLineOfSight>false</requireLineOfSight>
<warmupTime>0</warmupTime>
<range>500</range>
<targetable>true</targetable>
<warmupTime>2</warmupTime>
<range>-1</range>
<targetable>false</targetable>
<targetParams>
<canTargetSelf>false</canTargetSelf>
<canTargetLocations>true</canTargetLocations>
<canTargetSelf>true</canTargetSelf>
<canTargetLocations>false</canTargetLocations>
</targetParams>
</verbProperties>
<comps>
@@ -161,23 +163,8 @@
<aircraftCooldownTicks>15000</aircraftCooldownTicks>
<aircraftsPerUse>1</aircraftsPerUse>
</li>
<li Class="WulaFallenEmpire.CompProperties_AbilitySpawnFlyOver">
<flyOverDef>WULA_MotherShip_Planet_Interdiction</flyOverDef>
<flyOverType>GroundStrafing</flyOverType>
<flightSpeed>0.02</flightSpeed>
<altitude>20</altitude>
<playFlyOverSound>true</playFlyOverSound>
<approachType>Perpendicular</approachType>
<!-- 只传递信号,不传递具体参数 -->
<enableSectorSurveillance>true</enableSectorSurveillance>
<!-- 可视化 -->
<showStrafePreview>false</showStrafePreview>
<!-- 预览配置 -->
<showSectorPreview>true</showSectorPreview>
<sectorPreviewColor>(0.3,0.7,1.0,0.3)</sectorPreviewColor>
<li Class="WulaFallenEmpire.CompProperties_AbilityEnableOverwatch">
<durationSeconds>180</durationSeconds>
</li>
<li Class="WulaFallenEmpire.CompProperties_AbilityRequiresNonHostility">
<factionDef>Wula_PIA_Legion_Faction</factionDef>

View File

@@ -170,8 +170,7 @@
<Wula_AI_Error_ConnectionLost>错误:连接丢失。“军团”保持沉默。</Wula_AI_Error_ConnectionLost>
<Wula_AI_Thinking_Status>思考中...{0}秒 阶段{1}/{2}{3}</Wula_AI_Thinking_Status>
<Wula_AI_Thinking_RetrySuffix> 重试中</Wula_AI_Thinking_RetrySuffix>
<Wula_ResourceDrop>{FACTION_name}已经在附近投下了一些资源。</Wula_ResourceDrop>
<Wula_ResourceDrop>{FACTION_name}已经在附近投下了一些资源。</Wula_ResourceDrop>
<!-- AI Overwatch -->
<WULA_AIOverwatch_Label>P.I.A 正在接管轨道防御!</WULA_AIOverwatch_Label>

View File

@@ -0,0 +1,76 @@
using System;
using RimWorld;
using Verse;
using WulaFallenEmpire.EventSystem.AI;
namespace WulaFallenEmpire
{
public class CompProperties_AbilityEnableOverwatch : CompProperties_AbilityEffect
{
public int durationSeconds = 180; // Default 3 minutes
public CompProperties_AbilityEnableOverwatch()
{
compClass = typeof(CompAbilityEffect_EnableOverwatch);
}
}
public class CompAbilityEffect_EnableOverwatch : CompAbilityEffect
{
public new CompProperties_AbilityEnableOverwatch Props => (CompProperties_AbilityEnableOverwatch)props;
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
{
base.Apply(target, dest);
Map map = parent.pawn?.Map ?? Find.CurrentMap;
if (map == null)
{
Messages.Message("Error: No active map.", MessageTypeDefOf.RejectInput);
return;
}
var overwatch = map.GetComponent<MapComponent_AIOverwatch>();
if (overwatch == null)
{
overwatch = new MapComponent_AIOverwatch(map);
map.components.Add(overwatch);
}
overwatch.EnableOverwatch(Props.durationSeconds);
}
public override bool CanApplyOn(LocalTargetInfo target, LocalTargetInfo dest)
{
if (!base.CanApplyOn(target, dest))
return false;
Map map = parent.pawn?.Map ?? Find.CurrentMap;
if (map == null)
return false;
var overwatch = map.GetComponent<MapComponent_AIOverwatch>();
if (overwatch != null && overwatch.IsEnabled)
{
// Already active, show remaining time
return false;
}
return true;
}
public override string ExtraLabelMouseAttachment(LocalTargetInfo target)
{
Map map = parent.pawn?.Map ?? Find.CurrentMap;
if (map != null)
{
var overwatch = map.GetComponent<MapComponent_AIOverwatch>();
if (overwatch != null && overwatch.IsEnabled)
{
return $"Already active ({overwatch.DurationTicks / 60}s remaining)";
}
}
return base.ExtraLabelMouseAttachment(target);
}
}
}

View File

@@ -63,10 +63,10 @@ namespace WulaFallenEmpire.EventSystem.AI
{
try
{
var flyOverDef = DefDatabase<ThingDef>.GetNamedSilentFail("WULA_AircraftCarrier");
var flyOverDef = DefDatabase<ThingDef>.GetNamedSilentFail("WULA_MotherShip_Planet_Interdiction");
if (flyOverDef == null)
{
WulaLog.Debug("[AI Overwatch] Could not find WULA_AircraftCarrier ThingDef.");
WulaLog.Debug("[AI Overwatch] Could not find WULA_MotherShip_Planet_Interdiction ThingDef.");
return;
}
@@ -80,14 +80,14 @@ namespace WulaFallenEmpire.EventSystem.AI
startPos,
endPos,
map,
speed: 0.03f,
speed: 0.02f, // Slower for mothership
height: 20f
);
if (flyOver != null)
{
Messages.Message("WULA_AIOverwatch_FleetCalled".Translate(), MessageTypeDefOf.PositiveEvent);
WulaLog.Debug($"[AI Overwatch] Called fleet: WULA_AircraftCarrier spawned from {startPos} to {endPos}.");
WulaLog.Debug($"[AI Overwatch] Called fleet: WULA_MotherShip_Planet_Interdiction spawned from {startPos} to {endPos}.");
}
}
catch (Exception ex)