暂存
This commit is contained in:
Binary file not shown.
@@ -753,7 +753,7 @@
|
||||
<Beauty>-5</Beauty>
|
||||
</statBases>
|
||||
<size>(3,3)</size>
|
||||
<interactionCellOffset>(0,0,0)</interactionCellOffset>
|
||||
<interactionCellOffset>(0,0,-2)</interactionCellOffset>
|
||||
<hasInteractionCell>true</hasInteractionCell>
|
||||
<researchPrerequisites Inherit="False">
|
||||
<li>WULA_Base_Technology</li>
|
||||
|
||||
@@ -922,3 +922,123 @@ requests.exceptions.SSLError: HTTPSConnectionPool(host='dashscope.aliyuncs.com',
|
||||
2025-08-12 14:49:39,613 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-12 14:49:39,614 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-12 14:49:39,615 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-12 14:50:17,319 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-12 14:50:17,327 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-12 14:50:18,513 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-12 14:50:18,521 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-12 14:50:18,528 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-12 14:50:18,529 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-12 14:50:18,529 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 08:53:23,840 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 08:53:23,858 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 08:53:23,876 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 08:53:23,878 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 08:53:23,879 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 08:54:26,023 - INFO - Processing request of type CallToolRequest
|
||||
2025-08-14 08:54:26,023 - INFO - 收到问题: RimWorld Pawn transfer to container or map, TryAdd, Spawn, Despawn
|
||||
2025-08-14 08:54:26,024 - INFO - 找到的潜在关键词: ['Despawn', 'Pawn', 'RimWorld', 'TryAdd', 'Spawn']
|
||||
2025-08-14 08:54:26,024 - INFO - 提取到关键词: ['Despawn', 'Pawn', 'RimWorld', 'TryAdd', 'Spawn']
|
||||
2025-08-14 08:54:26,024 - INFO - 缓存未命中,开始实时搜索: Despawn-Pawn-RimWorld-Spawn-TryAdd
|
||||
2025-08-14 08:54:31,161 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 08:54:31,174 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 08:54:31,184 - WARNING - Failed to validate request: Received request before initialization was complete
|
||||
2025-08-14 08:54:31,586 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 08:54:31,595 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 08:54:31,604 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 08:54:31,605 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 08:54:31,606 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 08:54:31,615 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 08:54:34,783 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 08:54:34,796 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 08:54:34,806 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 08:54:34,809 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 08:54:34,810 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 08:54:43,348 - INFO - Processing request of type CallToolRequest
|
||||
2025-08-14 08:54:43,348 - INFO - 收到问题: RimWorld Pawn transfer to container or map, TryAdd, Spawn, Despawn
|
||||
2025-08-14 08:54:43,349 - INFO - 找到的潜在关键词: ['TryAdd', 'Pawn', 'Despawn', 'RimWorld', 'Spawn']
|
||||
2025-08-14 08:54:43,349 - INFO - 提取到关键词: ['TryAdd', 'Pawn', 'Despawn', 'RimWorld', 'Spawn']
|
||||
2025-08-14 08:54:43,349 - INFO - 缓存未命中,开始实时搜索: Despawn-Pawn-RimWorld-Spawn-TryAdd
|
||||
2025-08-14 08:54:45,870 - INFO - 找到 8026 个候选文件,开始向量化处理...
|
||||
2025-08-14 08:54:45,870 - INFO - 找到 8026 个候选文件,开始向量化处理...
|
||||
2025-08-14 08:54:45,880 - INFO - 文件名精确匹配: C:\Steam\steamapps\common\RimWorld\Data\dll1.6\Verse\Pawn.txt
|
||||
2025-08-14 08:54:45,891 - INFO - 文件名精确匹配: C:\Steam\steamapps\common\RimWorld\Data\dll1.6\Verse\Pawn.txt
|
||||
2025-08-14 08:54:45,898 - WARNING - 候选文件过多 (8025),仅处理前 25 个。
|
||||
2025-08-14 08:54:45,900 - WARNING - 候选文件过多 (8025),仅处理前 25 个。
|
||||
2025-08-14 08:54:50,649 - INFO - 向量搜索完成。找到了 5 个匹配项并成功提取了代码。
|
||||
2025-08-14 08:54:51,739 - INFO - 向量搜索完成。找到了 5 个匹配项并成功提取了代码。
|
||||
2025-08-14 08:54:51,743 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 08:56:29,210 - INFO - Processing request of type CallToolRequest
|
||||
2025-08-14 08:56:29,210 - INFO - 收到问题: 塑形仓 或 整形舱 的实现方法
|
||||
2025-08-14 08:56:29,210 - WARNING - 在 '塑形仓 或 整形舱 的实现方法' 中未找到合适的关键词。
|
||||
2025-08-14 08:56:29,210 - WARNING - 无法从问题中提取关键词。
|
||||
2025-08-14 08:56:35,044 - INFO - Processing request of type CallToolRequest
|
||||
2025-08-14 08:56:35,044 - INFO - 收到问题: 身体改造 基因 医疗舱 生物技术
|
||||
2025-08-14 08:56:35,044 - WARNING - 在 '身体改造 基因 医疗舱 生物技术' 中未找到合适的关键词。
|
||||
2025-08-14 08:56:35,044 - WARNING - 无法从问题中提取关键词。
|
||||
2025-08-14 09:13:39,283 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:13:39,291 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:13:39,299 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 09:13:39,301 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 09:13:39,301 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 09:14:30,821 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:14:30,830 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:14:30,838 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 09:14:30,839 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 09:14:30,840 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 09:14:37,726 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:14:37,735 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:14:37,744 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 09:14:37,746 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 09:14:37,747 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 09:17:32,227 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:17:32,235 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:17:33,447 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:17:33,455 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:17:33,466 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 09:17:33,468 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 09:17:33,468 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 09:20:01,335 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:20:01,344 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:20:02,521 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:20:02,529 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:20:02,536 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 09:20:02,537 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 09:20:02,538 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 09:20:34,066 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:20:34,075 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:20:35,690 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:20:35,698 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:20:35,706 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 09:20:35,707 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 09:20:35,708 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 09:23:35,896 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:23:35,904 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:23:37,132 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:23:37,140 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:23:37,147 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 09:23:37,148 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 09:23:37,149 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 09:28:01,382 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:28:01,390 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:28:01,399 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 09:28:01,400 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 09:28:01,400 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 09:29:40,543 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:29:40,551 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:29:41,785 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:29:41,793 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:29:41,800 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 09:29:41,802 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 09:29:41,803 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 09:31:18,486 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:31:18,494 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:31:18,502 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 09:31:18,503 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 09:31:18,504 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
2025-08-14 09:32:43,894 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:32:43,904 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:32:45,182 - INFO - 成功加载 DASHSCOPE_API_KEY。
|
||||
2025-08-14 09:32:45,190 - INFO - RimWorld 向量知识库 (FastMCP版, v2.1-v4-model) 正在启动...
|
||||
2025-08-14 09:32:45,198 - INFO - Processing request of type ListToolsRequest
|
||||
2025-08-14 09:32:45,199 - INFO - Processing request of type ListResourcesRequest
|
||||
2025-08-14 09:32:45,201 - INFO - Processing request of type ListResourceTemplatesRequest
|
||||
|
||||
@@ -10,7 +10,6 @@ using Verse.Sound;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
// Properties for our custom maintenance pod
|
||||
public class CompProperties_MaintenancePod : CompProperties
|
||||
{
|
||||
public SoundDef enterSound;
|
||||
@@ -21,9 +20,9 @@ namespace WulaFallenEmpire
|
||||
public float powerConsumptionRunning = 250f;
|
||||
public float powerConsumptionIdle = 50f;
|
||||
public HediffDef hediffToRemove;
|
||||
public float componentCostPerSeverity = 1f; // How many components per 1.0 severity
|
||||
public int baseComponentCost = 0; // A flat cost in addition to severity cost
|
||||
public float minSeverityToMaintain = 0.75f; // The hediff severity required to trigger maintenance
|
||||
public float componentCostPerSeverity = 1f;
|
||||
public int baseComponentCost = 0;
|
||||
public float minSeverityToMaintain = 0.75f;
|
||||
public float hediffSeverityAfterCycle = 0.01f;
|
||||
|
||||
public CompProperties_MaintenancePod()
|
||||
@@ -43,13 +42,14 @@ namespace WulaFallenEmpire
|
||||
private MaintenancePodState state = MaintenancePodState.Idle;
|
||||
|
||||
private static readonly Texture2D CancelIcon = ContentFinder<Texture2D>.Get("UI/Designators/Cancel");
|
||||
private static readonly Texture2D EnterIcon = ContentFinder<Texture2D>.Get("UI/Commands/PodEject"); // Re-using an icon
|
||||
private static readonly Texture2D EnterIcon = ContentFinder<Texture2D>.Get("UI/Commands/PodEject");
|
||||
|
||||
// ===================== Properties =====================
|
||||
public CompProperties_MaintenancePod Props => (CompProperties_MaintenancePod)props;
|
||||
public MaintenancePodState State => state;
|
||||
public Pawn Occupant => innerContainer.FirstOrDefault() as Pawn;
|
||||
public bool PowerOn => powerComp != null && powerComp.PowerOn;
|
||||
|
||||
public float RequiredComponents(Pawn pawn)
|
||||
{
|
||||
if (pawn == null || Props.hediffToRemove == null) return Props.baseComponentCost;
|
||||
@@ -72,12 +72,6 @@ namespace WulaFallenEmpire
|
||||
innerContainer = new ThingOwner<Thing>(this, false, LookMode.Deep);
|
||||
}
|
||||
|
||||
|
||||
public override void Initialize(CompProperties props)
|
||||
{
|
||||
base.Initialize(props);
|
||||
}
|
||||
|
||||
public override void PostSpawnSetup(bool respawningAfterLoad)
|
||||
{
|
||||
base.PostSpawnSetup(respawningAfterLoad);
|
||||
@@ -108,7 +102,6 @@ namespace WulaFallenEmpire
|
||||
public override void CompTick()
|
||||
{
|
||||
base.CompTick();
|
||||
|
||||
if (!parent.Spawned) return;
|
||||
|
||||
if (state == MaintenancePodState.Running)
|
||||
@@ -122,20 +115,20 @@ namespace WulaFallenEmpire
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update power consumption based on state
|
||||
|
||||
if (powerComp != null)
|
||||
{
|
||||
powerComp.PowerOutput = - (state == MaintenancePodState.Running ? Props.powerConsumptionRunning : Props.powerConsumptionIdle);
|
||||
powerComp.PowerOutput = -(state == MaintenancePodState.Running ? Props.powerConsumptionRunning : Props.powerConsumptionIdle);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartCycle(Pawn pawn)
|
||||
{
|
||||
Log.Warning($"[WulaPodDebug] StartCycle called for pawn: {pawn.LabelShortCap}");
|
||||
float required = RequiredComponents(pawn);
|
||||
if (refuelableComp.Fuel < required)
|
||||
{
|
||||
Log.Error($"[WulaFallenEmpire] Tried to start maintenance cycle for {pawn.LabelShort} without enough components. This should have been checked earlier.");
|
||||
Log.Error($"[WulaPodDebug] ERROR: Tried to start cycle for {pawn.LabelShort} without enough components.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -143,24 +136,35 @@ namespace WulaFallenEmpire
|
||||
{
|
||||
refuelableComp.ConsumeFuel(required);
|
||||
}
|
||||
|
||||
Log.Warning($"[WulaPodDebug] Pawn state before action: holdingOwner is {(pawn.holdingOwner == null ? "NULL" : "NOT NULL")}, Spawned is {pawn.Spawned}");
|
||||
|
||||
// THE ACTUAL FIX: A pawn, whether held or not, must be despawned before being put in a container.
|
||||
if (pawn.Spawned)
|
||||
{
|
||||
Log.Warning($"[WulaPodDebug] Pawn is spawned. Despawning...");
|
||||
pawn.DeSpawn(DestroyMode.Vanish);
|
||||
}
|
||||
Log.Warning($"[WulaPodDebug] Attempting to add/transfer pawn to container.");
|
||||
innerContainer.TryAddOrTransfer(pawn);
|
||||
|
||||
|
||||
state = MaintenancePodState.Running;
|
||||
ticksRemaining = RequiredDuration(pawn);
|
||||
|
||||
// Move pawn inside
|
||||
innerContainer.TryAddOrTransfer(pawn);
|
||||
Log.Warning($"[WulaPodDebug] Cycle started. Ticks remaining: {ticksRemaining}");
|
||||
}
|
||||
|
||||
private void CycleFinished()
|
||||
{
|
||||
Pawn occupant = Occupant;
|
||||
Log.Warning($"[WulaPodDebug] CycleFinished. Occupant: {(occupant == null ? "NULL" : occupant.LabelShortCap)}");
|
||||
if (occupant == null)
|
||||
{
|
||||
Log.Error("[WulaFallenEmpire] Maintenance cycle finished, but no one was inside.");
|
||||
Log.Error("[WulaPodDebug] ERROR: Maintenance cycle finished, but no one was inside.");
|
||||
state = MaintenancePodState.Idle;
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply effects
|
||||
if (Props.hediffToRemove != null)
|
||||
{
|
||||
Hediff hediff = occupant.health.hediffSet.GetFirstHediffOfDef(Props.hediffToRemove);
|
||||
@@ -170,13 +174,13 @@ namespace WulaFallenEmpire
|
||||
Messages.Message("WULA_MaintenanceComplete".Translate(occupant.Named("PAWN")), occupant, MessageTypeDefOf.PositiveEvent);
|
||||
}
|
||||
}
|
||||
|
||||
EjectPawn();
|
||||
}
|
||||
|
||||
public void EjectPawn()
|
||||
{
|
||||
Pawn occupant = Occupant;
|
||||
Log.Warning($"[WulaPodDebug] EjectPawn. Occupant: {(occupant == null ? "NULL" : occupant.LabelShortCap)}");
|
||||
if (occupant != null)
|
||||
{
|
||||
GenPlace.TryPlaceThing(occupant, parent.InteractionCell, parent.Map, ThingPlaceMode.Near);
|
||||
@@ -187,8 +191,8 @@ namespace WulaFallenEmpire
|
||||
}
|
||||
innerContainer.Clear();
|
||||
state = MaintenancePodState.Idle;
|
||||
Log.Warning($"[WulaPodDebug] EjectPawn finished. State set to Idle.");
|
||||
}
|
||||
|
||||
|
||||
// ===================== UI & Gizmos =====================
|
||||
public override string CompInspectStringExtra()
|
||||
@@ -215,13 +219,11 @@ namespace WulaFallenEmpire
|
||||
|
||||
public override IEnumerable<Gizmo> CompGetGizmosExtra()
|
||||
{
|
||||
// Base gizmos
|
||||
foreach (var gizmo in base.CompGetGizmosExtra())
|
||||
{
|
||||
yield return gizmo;
|
||||
}
|
||||
|
||||
// Gizmo to order a pawn to enter (Right-click menu style)
|
||||
if (state == MaintenancePodState.Idle && PowerOn)
|
||||
{
|
||||
var enterCommand = new Command_Action
|
||||
@@ -245,7 +247,6 @@ namespace WulaFallenEmpire
|
||||
yield return enterCommand;
|
||||
}
|
||||
|
||||
// Gizmo to cancel and eject
|
||||
if (state == MaintenancePodState.Running)
|
||||
{
|
||||
var cancelCommand = new Command_Action
|
||||
@@ -276,38 +277,38 @@ namespace WulaFallenEmpire
|
||||
}
|
||||
else if (p.Downed)
|
||||
{
|
||||
float required = RequiredComponents(p);
|
||||
if (refuelableComp.Fuel < required)
|
||||
{
|
||||
options.Add(new FloatMenuOption(p.LabelShortCap + " (" + "Incapacitated".Translate() + ", " + "WULA_MaintenancePod_NotEnoughComponents".Translate(required.ToString("F0")) + ")", null));
|
||||
}
|
||||
else
|
||||
{
|
||||
Action action = delegate
|
||||
{
|
||||
var potentialRescuers = parent.Map.mapPawns.FreeColonistsSpawned.Where(colonist =>
|
||||
!colonist.Downed && colonist.CanReserveAndReach(p, PathEndMode.OnCell, Danger.Deadly) && colonist.CanReserveAndReach(parent, PathEndMode.InteractionCell, Danger.Deadly));
|
||||
float required = RequiredComponents(p);
|
||||
if (refuelableComp.Fuel < required)
|
||||
{
|
||||
options.Add(new FloatMenuOption(p.LabelShortCap + " (" + "Incapacitated".Translate() + ", " + "WULA_MaintenancePod_NotEnoughComponents".Translate(required.ToString("F0")) + ")", null));
|
||||
}
|
||||
else
|
||||
{
|
||||
Action action = delegate
|
||||
{
|
||||
var potentialRescuers = parent.Map.mapPawns.FreeColonistsSpawned.Where(colonist =>
|
||||
!colonist.Downed && colonist.CanReserveAndReach(p, PathEndMode.OnCell, Danger.Deadly) && colonist.CanReserveAndReach(parent, PathEndMode.InteractionCell, Danger.Deadly));
|
||||
|
||||
if (!potentialRescuers.Any())
|
||||
{
|
||||
Messages.Message("WULA_MaintenancePod_NoRescuer".Translate(p.Named("PAWN")), MessageTypeDefOf.RejectInput);
|
||||
return;
|
||||
}
|
||||
if (!potentialRescuers.Any())
|
||||
{
|
||||
Messages.Message("WULA_MaintenancePod_NoRescuer".Translate(p.Named("PAWN")), MessageTypeDefOf.RejectInput);
|
||||
return;
|
||||
}
|
||||
|
||||
var rescuerOptions = new List<FloatMenuOption>();
|
||||
foreach (var rescuer in potentialRescuers)
|
||||
{
|
||||
rescuerOptions.Add(new FloatMenuOption(rescuer.LabelCap, delegate
|
||||
{
|
||||
var haulJob = JobMaker.MakeJob(JobDefOf_WULA.WULA_HaulToMaintenancePod, p, parent);
|
||||
haulJob.count = 1;
|
||||
rescuer.jobs.TryTakeOrderedJob(haulJob, JobTag.Misc);
|
||||
}));
|
||||
}
|
||||
Find.WindowStack.Add(new FloatMenu(rescuerOptions));
|
||||
};
|
||||
options.Add(new FloatMenuOption(p.LabelShortCap + " (" + "Incapacitated".Translate() + ")", action));
|
||||
}
|
||||
var rescuerOptions = new List<FloatMenuOption>();
|
||||
foreach (var rescuer in potentialRescuers)
|
||||
{
|
||||
rescuerOptions.Add(new FloatMenuOption(rescuer.LabelCap, delegate
|
||||
{
|
||||
var haulJob = JobMaker.MakeJob(JobDefOf_WULA.WULA_HaulToMaintenancePod, p, parent);
|
||||
haulJob.count = 1;
|
||||
rescuer.jobs.TryTakeOrderedJob(haulJob, JobTag.Misc);
|
||||
}));
|
||||
}
|
||||
Find.WindowStack.Add(new FloatMenu(rescuerOptions));
|
||||
};
|
||||
options.Add(new FloatMenuOption(p.LabelShortCap + " (" + "Incapacitated".Translate() + ")", action));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -333,7 +334,7 @@ namespace WulaFallenEmpire
|
||||
|
||||
public enum MaintenancePodState
|
||||
{
|
||||
Idle, // Waiting for a pawn or components
|
||||
Running, // Occupied and performing maintenance
|
||||
Idle,
|
||||
Running,
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ namespace WulaFallenEmpire
|
||||
|
||||
protected override IEnumerable<Toil> MakeNewToils()
|
||||
{
|
||||
Log.Warning($"[WulaPodDebug] JobDriver_EnterMaintenancePod started for pawn: {pawn.LabelShortCap}");
|
||||
this.FailOnDespawnedNullOrForbidden(PodIndex);
|
||||
this.FailOnBurningImmobile(PodIndex);
|
||||
|
||||
@@ -26,17 +27,21 @@ namespace WulaFallenEmpire
|
||||
this.FailOn(() => podComp == null || podComp.State != MaintenancePodState.Idle || !podComp.PowerOn);
|
||||
|
||||
// Go to the pod's interaction cell
|
||||
yield return Toils_Goto.GotoThing(PodIndex, PathEndMode.InteractionCell);
|
||||
Toil goToPod = Toils_Goto.GotoThing(PodIndex, PathEndMode.InteractionCell);
|
||||
goToPod.AddPreInitAction(() => Log.Warning($"[WulaPodDebug] EnterJob: Pawn {pawn.LabelShortCap} is going to the pod."));
|
||||
yield return goToPod;
|
||||
|
||||
// Enter the pod
|
||||
yield return new Toil
|
||||
Toil enterToil = new Toil
|
||||
{
|
||||
initAction = () =>
|
||||
{
|
||||
Log.Warning($"[WulaPodDebug] EnterJob: Pawn {pawn.LabelShortCap} has arrived and is entering the pod.");
|
||||
podComp.StartCycle(pawn);
|
||||
},
|
||||
defaultCompleteMode = ToilCompleteMode.Instant
|
||||
};
|
||||
yield return enterToil;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,31 +22,38 @@ namespace WulaFallenEmpire
|
||||
|
||||
protected override IEnumerable<Toil> MakeNewToils()
|
||||
{
|
||||
Log.Warning($"[WulaPodDebug] JobDriver_HaulToMaintenancePod started. Hauler: {pawn.LabelShortCap}, Takee: {Takee.LabelShortCap}");
|
||||
// Standard failure conditions
|
||||
this.FailOnDestroyedOrNull(TakeeIndex);
|
||||
this.FailOnDestroyedOrNull(PodIndex);
|
||||
this.FailOnAggroMentalStateAndHostile(TakeeIndex);
|
||||
this.FailOn(() => PodComp == null); // Fail if the pod doesn't have our component
|
||||
this.FailOn(() => PodComp == null);
|
||||
this.FailOn(() => !pawn.CanReach(Pod, PathEndMode.InteractionCell, Danger.Deadly));
|
||||
this.FailOn(() => !Takee.Downed); // Can only haul downed pawns
|
||||
this.FailOn(() => !Takee.Downed);
|
||||
|
||||
// Go to the pawn to be rescued
|
||||
yield return Toils_Goto.GotoThing(TakeeIndex, PathEndMode.ClosestTouch)
|
||||
Toil goToTakee = Toils_Goto.GotoThing(TakeeIndex, PathEndMode.ClosestTouch)
|
||||
.FailOnDespawnedNullOrForbidden(TakeeIndex)
|
||||
.FailOnDespawnedNullOrForbidden(PodIndex)
|
||||
.FailOnSomeonePhysicallyInteracting(TakeeIndex);
|
||||
goToTakee.AddPreInitAction(() => Log.Warning($"[WulaPodDebug] HaulJob: {pawn.LabelShortCap} is going to pick up {Takee.LabelShortCap}."));
|
||||
yield return goToTakee;
|
||||
|
||||
// Start carrying the pawn
|
||||
yield return Toils_Haul.StartCarryThing(TakeeIndex, false, true, false);
|
||||
Toil startCarrying = Toils_Haul.StartCarryThing(TakeeIndex, false, true, false);
|
||||
startCarrying.AddPreInitAction(() => Log.Warning($"[WulaPodDebug] HaulJob: {pawn.LabelShortCap} is now carrying {Takee.LabelShortCap}."));
|
||||
yield return startCarrying;
|
||||
|
||||
// Go to the maintenance pod
|
||||
yield return Toils_Goto.GotoThing(PodIndex, PathEndMode.InteractionCell);
|
||||
Toil goToPod = Toils_Goto.GotoThing(PodIndex, PathEndMode.InteractionCell);
|
||||
goToPod.AddPreInitAction(() => Log.Warning($"[WulaPodDebug] HaulJob: {pawn.LabelShortCap} is hauling {Takee.LabelShortCap} to the pod."));
|
||||
yield return goToPod;
|
||||
|
||||
// Place the pawn inside the pod
|
||||
Toil placeInPod = ToilMaker.MakeToil("PlaceInPod");
|
||||
placeInPod.initAction = delegate
|
||||
{
|
||||
// The Comp will handle despawning the pawn and starting the cycle
|
||||
Log.Warning($"[WulaPodDebug] HaulJob: {pawn.LabelShortCap} has arrived and is placing {Takee.LabelShortCap} in the pod.");
|
||||
PodComp.StartCycle(Takee);
|
||||
};
|
||||
placeInPod.defaultCompleteMode = ToilCompleteMode.Instant;
|
||||
|
||||
Reference in New Issue
Block a user