diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index 63b05e6c..507a7cd6 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/1.6/Defs/MainButtonDefs/MainButtons_WULA.xml b/1.6/1.6/Defs/MainButtonDefs/MainButtons_WULA.xml new file mode 100644 index 00000000..df3d822d --- /dev/null +++ b/1.6/1.6/Defs/MainButtonDefs/MainButtons_WULA.xml @@ -0,0 +1,13 @@ + + + + + WULA_AutonomousMechs + + View and control your autonomous mechs. + WulaFallenEmpire.MainTabWindow_AutonomousMechs + 55 + true + + + \ No newline at end of file diff --git a/1.6/1.6/Defs/PawnTableDefs/PawnTables_WULA.xml b/1.6/1.6/Defs/PawnTableDefs/PawnTables_WULA.xml index f5d6cfd5..e72c4c66 100644 --- a/1.6/1.6/Defs/PawnTableDefs/PawnTables_WULA.xml +++ b/1.6/1.6/Defs/PawnTableDefs/PawnTables_WULA.xml @@ -1,7 +1,7 @@ - + WULA_DroneWorkMode diff --git a/Source/WulaFallenEmpire/HarmonyPatches/WULA_AutonomousMech/Patch_MainTabWindow_Mechs_Pawns.cs b/Source/WulaFallenEmpire/HarmonyPatches/WULA_AutonomousMech/Patch_MainTabWindow_Mechs_Pawns.cs new file mode 100644 index 00000000..dcaae258 --- /dev/null +++ b/Source/WulaFallenEmpire/HarmonyPatches/WULA_AutonomousMech/Patch_MainTabWindow_Mechs_Pawns.cs @@ -0,0 +1,23 @@ +using HarmonyLib; +using RimWorld; +using System.Collections.Generic; +using System.Linq; +using Verse; + +namespace WulaFallenEmpire +{ + [HarmonyPatch(typeof(MainTabWindow_Mechs), "Pawns", MethodType.Getter)] + public static class Patch_MainTabWindow_Mechs_Pawns + { + [HarmonyPostfix] + public static void Postfix(ref IEnumerable __result) + { + // 获取所有自主机械体 + var autonomousMechs = Find.CurrentMap.mapPawns.PawnsInFaction(Faction.OfPlayer) + .Where(p => p.RaceProps.IsMechanoid && p.GetComp()?.CanBeAutonomous == true); + + // 将自主机械体合并到结果中,并去重 + __result = __result.Concat(autonomousMechs).Distinct(); + } + } +} \ No newline at end of file diff --git a/Source/WulaFallenEmpire/WulaDefOf.cs b/Source/WulaFallenEmpire/WulaDefOf.cs index 453a156b..9f9adc77 100644 --- a/Source/WulaFallenEmpire/WulaDefOf.cs +++ b/Source/WulaFallenEmpire/WulaDefOf.cs @@ -84,7 +84,7 @@ namespace WulaFallenEmpire public static DroneWorkModeDef Recharge; public static DroneWorkModeDef Shutdown; public static DroneWorkModeDef AutoFight; - public static PawnTableDef WULA_AutonomousMechs; + // public static PawnTableDef WULA_AutonomousMechs; static WulaDefOf() { diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 77d7ae4f..61d88bb1 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -181,6 +181,7 @@ +