refactor(mech): replace DroneWorkModeDef with MechWorkModeDef and update logic
- Replace all references of `DroneWorkModeDef` with `MechWorkModeDef` in components and gizmos - Delete `DroneWorkModeDef.cs` and remove related fields from `WulaDefOf` - Update `WULA_AutonomousMech.xml` to use `JobGiver_DroneSelfShutdown` and correct mode names - Remove redundant safety checks in `ThinkNode_ConditionalAutonomousWorkMode` - Update WulaFallenEmpire assembly
This commit is contained in:
@@ -6,7 +6,7 @@ namespace WulaFallenEmpire
|
||||
{
|
||||
public class ThinkNode_ConditionalAutonomousWorkMode : ThinkNode_Conditional
|
||||
{
|
||||
public DroneWorkModeDef requiredMode;
|
||||
public MechWorkModeDef requiredMode;
|
||||
|
||||
protected override bool Satisfied(Pawn pawn)
|
||||
{
|
||||
@@ -24,40 +24,6 @@ namespace WulaFallenEmpire
|
||||
if (comp.CurrentWorkMode != requiredMode)
|
||||
return false;
|
||||
|
||||
// 额外的安全检查:确保pawn有工作设置
|
||||
if (pawn.workSettings == null)
|
||||
{
|
||||
Log.Warning($"[WULA] {pawn.LabelShort} has no workSettings in ThinkNode_ConditionalAutonomousWorkMode");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查是否启用了工作
|
||||
if (!pawn.workSettings.EverWork)
|
||||
{
|
||||
Log.Warning($"[WULA] {pawn.LabelShort} has EverWork=false in ThinkNode_ConditionalAutonomousWorkMode");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查是否有工作给予器
|
||||
var workGivers = pawn.workSettings.WorkGiversInOrderNormal;
|
||||
if (workGivers == null || workGivers.Count == 0)
|
||||
{
|
||||
Log.Warning($"[WULA] {pawn.LabelShort} has no work givers in ThinkNode_ConditionalAutonomousWorkMode");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查是否为机械体且具有机械体能力
|
||||
if (pawn.RaceProps.IsMechanoid)
|
||||
{
|
||||
// 检查是否有操纵能力
|
||||
var manipulation = pawn.health?.capacities?.GetLevel(PawnCapacityDefOf.Manipulation);
|
||||
if (manipulation < 0.1f)
|
||||
{
|
||||
Log.Warning($"[WULA] {pawn.LabelShort} has insufficient manipulation capacity: {manipulation}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user