Files
WulaFallenEmpireRW/Source/WulaFallenEmpire/Work/ThinkNode_ConditionalMechHasPilot.cs
2026-02-25 17:30:59 +08:00

39 lines
1.4 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ThinkNode_ConditionalMechHasPilot.cs (修复版)
using RimWorld;
using Verse;
using Verse.AI;
namespace WulaFallenEmpire
{
public class ThinkNode_ConditionalMechHasPilot : ThinkNode_Conditional
{
// 可选的可以在XML中设置的参数
public int minPilotCount = 1; // 最少需要的驾驶员数量
protected override bool Satisfied(Pawn pawn)
{
if (pawn.Faction != Faction.OfPlayer)
return false; // 仅适用于玩家派系的机甲
var pilotComp = pawn.TryGetComp<CompMechPilotHolder>();
if (pilotComp == null)
return false; // 如果没有驾驶员组件,条件满足(允许执行)
int currentPilotCount = pilotComp.CurrentPilotCount;
// 检查是否满足最小驾驶员数量要求
bool hasEnoughPilots = currentPilotCount >= minPilotCount;
// 这意味着机甲可以正常工作
bool conditionSatisfied = hasEnoughPilots;
return !conditionSatisfied;
}
public override ThinkNode DeepCopy(bool resolve = true)
{
ThinkNode_ConditionalMechHasPilot thinkNode_ConditionalMechHasPilot = (ThinkNode_ConditionalMechHasPilot)base.DeepCopy(resolve);
thinkNode_ConditionalMechHasPilot.minPilotCount = minPilotCount;
return thinkNode_ConditionalMechHasPilot;
}
}
}