暂存
This commit is contained in:
Binary file not shown.
13
1.6/1.6/Defs/MainButtonDefs/MainButtons_WULA.xml
Normal file
13
1.6/1.6/Defs/MainButtonDefs/MainButtons_WULA.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
|
||||
<MainButtonDef>
|
||||
<defName>WULA_AutonomousMechs</defName>
|
||||
<label>autonomous mechs</label>
|
||||
<description>View and control your autonomous mechs.</description>
|
||||
<tabWindowClass>WulaFallenEmpire.MainTabWindow_AutonomousMechs</tabWindowClass>
|
||||
<order>55</order>
|
||||
<closesWorldView>true</closesWorldView>
|
||||
</MainButtonDef>
|
||||
|
||||
</Defs>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
|
||||
<!-- 扩展原版机械体表格,添加我们的自定义列 -->
|
||||
<!--
|
||||
<PawnTableDef>
|
||||
<defName>Mechs</defName>
|
||||
<columns>
|
||||
@@ -14,6 +14,7 @@
|
||||
<li>WorkPriority</li>
|
||||
</columns>
|
||||
</PawnTableDef>
|
||||
-->
|
||||
|
||||
<PawnColumnDef>
|
||||
<defName>WULA_DroneWorkMode</defName>
|
||||
|
||||
@@ -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<Pawn> __result)
|
||||
{
|
||||
// 获取所有自主机械体
|
||||
var autonomousMechs = Find.CurrentMap.mapPawns.PawnsInFaction(Faction.OfPlayer)
|
||||
.Where(p => p.RaceProps.IsMechanoid && p.GetComp<CompAutonomousMech>()?.CanBeAutonomous == true);
|
||||
|
||||
// 将自主机械体合并到结果中,并去重
|
||||
__result = __result.Concat(autonomousMechs).Distinct();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -181,6 +181,7 @@
|
||||
<Compile Include="Pawn\Comp_PawnRenderExtra.cs" />
|
||||
<Compile Include="Pawn\WULA_AutoMechCarrier\CompAutoMechCarrier.cs" />
|
||||
<Compile Include="Pawn\WULA_AutoMechCarrier\CompProperties_AutoMechCarrier.cs" />
|
||||
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_MainTabWindow_Mechs_Pawns.cs" />
|
||||
<Compile Include="Pawn\WULA_AutoMechCarrier\PawnProductionEntry.cs" />
|
||||
<Compile Include="Pawn\WULA_AutonomousMech\DroneWorkModeDef.cs" />
|
||||
<Compile Include="Pawn\WULA_AutonomousMech\DroneGizmo.cs" />
|
||||
|
||||
Reference in New Issue
Block a user