1
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
[HarmonyPatch(typeof(FloatMenuOptionProvider), "SelectedPawnValid")]
|
||||
public static class Patch_FloatMenuOptionProvider_SelectedPawnValid
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
public static void Postfix(Pawn pawn, FloatMenuContext context, ref bool __result)
|
||||
{
|
||||
// 如果已经有效,不需要修改
|
||||
if (__result)
|
||||
return;
|
||||
|
||||
// 检查是否是机械族且被原版逻辑拒绝
|
||||
if (!pawn.RaceProps.IsMechanoid)
|
||||
return;
|
||||
|
||||
// 检查是否有自主机械组件
|
||||
var comp = pawn.GetComp<CompAutonomousMech>();
|
||||
if (comp == null || !comp.CanWorkAutonomously)
|
||||
return;
|
||||
|
||||
// 对于自主机械族,直接返回true,跳过机械族限制
|
||||
// 其他条件已经在原版方法中检查过了
|
||||
__result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
[HarmonyPatch(typeof(Pawn), "get_IsColonyMechPlayerControlled")]
|
||||
public static class Patch_IsColonyMechPlayerControlled
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
public static void Postfix(Pawn __instance, ref bool __result)
|
||||
{
|
||||
// 如果原版已经返回true,不需要修改
|
||||
if (__result)
|
||||
return;
|
||||
|
||||
// 检查是否是殖民地机械
|
||||
if (!__instance.IsColonyMech)
|
||||
return;
|
||||
|
||||
// 检查是否有自主机械组件
|
||||
var comp = __instance.GetComp<CompAutonomousMech>();
|
||||
if (comp == null)
|
||||
return;
|
||||
|
||||
// 如果机械族处于自主战斗模式,则视为玩家控制
|
||||
if (comp.CanFightAutonomously)
|
||||
{
|
||||
__result = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果机械族处于自主工作模式,也视为玩家控制(用于工作相关判定)
|
||||
if (comp.CanWorkAutonomously)
|
||||
{
|
||||
__result = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
[HarmonyPatch(typeof(Pawn_DraftController), "get_ShowDraftGizmo")]
|
||||
public static class Patch_Pawn_DraftController_ShowDraftGizmo
|
||||
{
|
||||
public static void Postfix(Pawn_DraftController __instance, ref bool __result)
|
||||
{
|
||||
Pawn pawn = __instance.pawn;
|
||||
|
||||
if (!__result && pawn != null && pawn.IsColonyMech)
|
||||
{
|
||||
var comp = pawn.GetComp<CompAutonomousMech>();
|
||||
if (comp != null && comp.CanBeAutonomous)
|
||||
{
|
||||
__result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(MechanitorUtility), "CanDraftMech")]
|
||||
public static class Patch_MechanitorUtility_CanDraftMech
|
||||
{
|
||||
public static void Postfix(Pawn mech, ref AcceptanceReport __result)
|
||||
{
|
||||
if (!__result && mech != null && mech.IsColonyMech)
|
||||
{
|
||||
var comp = mech.GetComp<CompAutonomousMech>();
|
||||
if (comp != null && comp.CanBeAutonomous)
|
||||
{
|
||||
__result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(CompOverseerSubject), "CompInspectStringExtra")]
|
||||
public static class Patch_CompOverseerSubject_CompInspectStringExtra
|
||||
{
|
||||
public static void Postfix(CompOverseerSubject __instance, ref string __result)
|
||||
{
|
||||
Pawn mech = __instance.parent as Pawn;
|
||||
if (mech != null && mech.IsColonyMech)
|
||||
{
|
||||
var comp = mech.GetComp<CompAutonomousMech>();
|
||||
if (comp != null && comp.ShouldSuppressUncontrolledWarning)
|
||||
{
|
||||
string autonomousStatus = comp.GetAutonomousStatusString();
|
||||
if (!string.IsNullOrEmpty(autonomousStatus))
|
||||
{
|
||||
__result = autonomousStatus;
|
||||
}
|
||||
else
|
||||
{
|
||||
__result = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
// 修复红色名字问题 - 直接修补 PawnNameColorUtility.PawnNameColorOf 方法
|
||||
[HarmonyPatch(typeof(PawnNameColorUtility), "PawnNameColorOf")]
|
||||
public static class Patch_PawnNameColorUtility_PawnNameColorOf
|
||||
{
|
||||
public static void Postfix(Pawn pawn, ref Color __result)
|
||||
{
|
||||
if (pawn != null && pawn.IsColonyMech)
|
||||
{
|
||||
var comp = pawn.GetComp<CompAutonomousMech>();
|
||||
if (comp != null && comp.ShouldSuppressUncontrolledWarning)
|
||||
{
|
||||
// 使用正常的白色名字
|
||||
__result = Color.white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user