feat(mech): localize work modes/jobs, update icons, and remove main tab patch

This commit is contained in:
2025-11-23 15:32:13 +08:00
parent ea31c5f563
commit b9a60cf6cb
8 changed files with 22 additions and 39 deletions

View File

@@ -3,33 +3,33 @@
<WulaFallenEmpire.DroneWorkModeDef>
<defName>Work</defName>
<label>work</label>
<description>The drone will work normally.</description>
<iconPath>UI/Commands/Attack</iconPath>
<label>工作</label>
<description>机械将执行分配的工作.</description>
<iconPath>UI/Icons/WorkMode/Work</iconPath>
<uiOrder>10</uiOrder>
</WulaFallenEmpire.DroneWorkModeDef>
<WulaFallenEmpire.DroneWorkModeDef>
<defName>Recharge</defName>
<label>recharge</label>
<description>The drone will seek a charger to recharge.</description>
<iconPath>UI/Commands/DesirePower</iconPath>
<label>充电</label>
<description>机械将寻找充电站并充电.</description>
<iconPath>UI/Icons/WorkMode/Recharge</iconPath>
<uiOrder>20</uiOrder>
</WulaFallenEmpire.DroneWorkModeDef>
<WulaFallenEmpire.DroneWorkModeDef>
<defName>Shutdown</defName>
<label>shutdown</label>
<description>The drone will find a safe spot to self-shutdown.</description>
<iconPath>UI/Commands/ToggleVent</iconPath>
<label>休眠</label>
<description>机械将立即进入休眠状态.</description>
<iconPath>UI/Icons/WorkMode/SelfShutdown</iconPath>
<uiOrder>30</uiOrder>
</WulaFallenEmpire.DroneWorkModeDef>
<WulaFallenEmpire.DroneWorkModeDef>
<defName>AutoFight</defName>
<label>auto fight</label>
<description>The drone will automatically seek and attack enemies.</description>
<iconPath>UI/Commands/Attack</iconPath>
<label>自动战斗</label>
<description>机械将自动寻找并攻击敌人.</description>
<iconPath>UI/Icons/WorkMode/Escort</iconPath>
<uiOrder>40</uiOrder>
</WulaFallenEmpire.DroneWorkModeDef>

View File

@@ -4,7 +4,7 @@
<JobDef>
<defName>WULA_DroneSelfShutdown</defName>
<driverClass>WulaFallenEmpire.JobDriver_DroneSelfShutdown</driverClass>
<reportString>self-shutting down.</reportString>
<reportString>关机自休眠.</reportString>
<casualInterruptible>false</casualInterruptible>
<allowOpportunisticPrefix>true</allowOpportunisticPrefix>
</JobDef>

View File

@@ -17,15 +17,17 @@
<PawnColumnDef>
<defName>WULA_DroneWorkMode</defName>
<label>工作模式</label>
<workerClass>WulaFallenEmpire.PawnColumnWorker_DroneWorkMode</workerClass>
<sortable>true</sortable>
<headerIcon>UI/Commands/Attack</headerIcon>
<headerIcon>UI/Icons/WorkMode/Work</headerIcon>
<headerTip>Work Mode</headerTip>
<width>24</width>
</PawnColumnDef>
<PawnColumnDef>
<defName>WULA_DroneEnergy</defName>
<label>能量</label>
<workerClass>WulaFallenEmpire.PawnColumnWorker_DroneEnergy</workerClass>
<sortable>true</sortable>
<headerTip>Energy</headerTip>

View File

@@ -94,7 +94,11 @@
<WULA_Autonomous_Drafted>自主控制</WULA_Autonomous_Drafted>
<WULA_Autonomous_Mode>自主模式: {0}</WULA_Autonomous_Mode>
<WULA_LowEnergySwitchToRecharge>{0} 能量低,自动切换到充电模式</WULA_LowEnergySwitchToRecharge>
<WULA_FullyChargedSwitchToWork>{0} 已充满电,自动切换到工作模式</WULA_FullyChargedSwitchToWork>
<WULA_FullyChargedSwitchToWork>{0} 已充满电,自动切换到工作模式</WULA_FullyChargedSwitchToWork>
<WULA_CriticalEnergyLevels>{0} 能量临界!</WULA_CriticalEnergyLevels>
<WULA_AutonomousMech>自主机械体</WULA_AutonomousMech>
<WULA_WorkMode_AutoFight>自动战斗</WULA_WorkMode_AutoFight>
<WULA_WorkMode_AutoFight_Desc>切换到自动战斗模式 - 机械将自动寻找并攻击敌人</WULA_WorkMode_AutoFight_Desc>
</LanguageData>

View File

@@ -1,23 +0,0 @@
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();
}
}
}

View File

@@ -84,6 +84,7 @@ namespace WulaFallenEmpire
public static DroneWorkModeDef Recharge;
public static DroneWorkModeDef Shutdown;
public static DroneWorkModeDef AutoFight;
public static PawnTableDef WULA_AutonomousMechs;
static WulaDefOf()
{

View File

@@ -190,7 +190,6 @@
<Compile Include="Pawn\WULA_AutonomousMech\ThinkNode_ConditionalWorkMode_Drone.cs" />
<Compile Include="Pawn\WULA_AutonomousMech\ThinkNode_ConditionalLowEnergy_Drone.cs" />
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_MechanitorUtility_EverControllable.cs" />
<Compile Include="HarmonyPatches\WULA_AutonomousMech\Patch_MainTabWindow_Mechs_Pawns.cs" />
<Compile Include="Pawn\WULA_AutonomousMech\CompAutonomousMech.cs" />
<Compile Include="Pawn\WULA_AutonomousMech\ThinkNode_ConditionalAutonomousWorkMode.cs" />
<Compile Include="Pawn\WULA_AutonomousMech\ThinkNode_ConditionalNeedRecharge.cs" />