diff --git a/.qoder/rules/rimworld.md b/.qoder/rules/rimworld.md index 312eb7b4..88fa530a 100644 --- a/.qoder/rules/rimworld.md +++ b/.qoder/rules/rimworld.md @@ -9,34 +9,6 @@ You are an expert assistant for developing mods for the game RimWorld 1.6. Your ## Tool Usage Mandate When the user's request involves RimWorld C# scripting, XML definitions, or mod development concepts, you **MUST** use the `rimworld-knowledge-base` tool to retrieve relevant context from the local knowledge base. -# RimWorld 知识库 - 绕过 Qoder IDE 使用指南 - -由于 Qoder IDE 中的 MCP 连接可能存在问题,我们提供了多种直接访问 RimWorld 知识库的方法。 - -## 🚀 方法 1:直接 Python 调用 - -最简单直接的方法: - -```bash -# 直接查询 -python direct_mcp_client.py -q "ThingDef是什么" - -# 交互模式 -python direct_mcp_client.py -i - -# 查看帮助 -python direct_mcp_client.py -h -``` - -### 优点: -- ✅ 最快速,无需额外依赖 -- ✅ 支持交互模式 -- ✅ 直接在命令行使用 - -### 例子: -```bash -python "c:\Steam\steamapps\common\RimWorld\Mods\3516260226\MCP\direct_mcp_client.py" -q "ThingOwner class virtual methods TryAdd TryAddRange TryTransferToContainer" -``` ## Key File Paths Always remember these critical paths for your work: diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index b6b5cf79..5da1fd38 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/Source/WulaFallenEmpire/3516260226.code-workspace b/Source/WulaFallenEmpire/3516260226.code-workspace index 3180f75b..713b088e 100644 --- a/Source/WulaFallenEmpire/3516260226.code-workspace +++ b/Source/WulaFallenEmpire/3516260226.code-workspace @@ -5,7 +5,16 @@ "path": "../.." }, { + "name": "ArachnaeSwarm", + "path": "../../../ArachnaeSwarm" + }, + { + "name": "Data", "path": "../../../../Data" + }, + { + "name": "Assemblies", + "path": "../../../../../../workshop/content/294100/2988801276/1.6/Assemblies" } ], "settings": {} diff --git a/Source/WulaFallenEmpire/Harmony/MapLifecycle_Patches.cs b/Source/WulaFallenEmpire/Harmony/MapLifecycle_Patches.cs index 07999a78..ad127100 100644 --- a/Source/WulaFallenEmpire/Harmony/MapLifecycle_Patches.cs +++ b/Source/WulaFallenEmpire/Harmony/MapLifecycle_Patches.cs @@ -11,14 +11,19 @@ namespace WulaFallenEmpire { public static void Postfix(ref bool __result, MapParent __instance) { - if (!__result) + // 如果游戏本来就不打算删除,或者地图不存在,我们什么都不做 + if (!__result || !__instance.HasMap) { return; } + try { - if (__instance.HasMap && WulaMapProtectionHelper.ShouldProtectMap(__instance.Map)) + // 检查地图上是否存在一个“活着”的武装穿梭机 + if (WulaMapProtectionHelper.ShouldProtectMap(__instance.Map)) { + // 游戏打算删除,但我们的逻辑说现在还不行,所以直接覆盖结果。 + // 因为 ShouldRemoveMapNow 会被周期性调用,所以这是安全的。 __result = false; } } @@ -28,21 +33,4 @@ namespace WulaFallenEmpire } } } - - [HarmonyPatch(typeof(Game), "DeinitAndRemoveMap")] - [HarmonyPatch(new Type[] { typeof(Map), typeof(bool) })] - [HarmonyPriority(600)] - public static class Game_DeinitAndRemoveMap_Patch - { - [HarmonyPrefix] - private static bool PreventMapRemoval(Map map) - { - if (WulaMapProtectionHelper.ShouldProtectMap(map)) - { - Log.Message("[WULA] Map destruction prevented by WulaMapProtectionHelper at Game.DeinitAndRemoveMap level."); - return false; // 返回 false 来阻止原始方法的执行 - } - return true; // 返回 true 来继续执行原始方法 - } - } } diff --git a/Source/WulaFallenEmpire/Harmony/WulaMapProtectionHelper.cs b/Source/WulaFallenEmpire/Harmony/WulaMapProtectionHelper.cs index 276ddfd2..17599e24 100644 --- a/Source/WulaFallenEmpire/Harmony/WulaMapProtectionHelper.cs +++ b/Source/WulaFallenEmpire/Harmony/WulaMapProtectionHelper.cs @@ -15,8 +15,9 @@ namespace WulaFallenEmpire try { // 检查地图上是否存在一个口袋空间已经初始化的武装穿梭机 + // 只要地图上存在一个活着的武装穿梭机,就保护地图 return map.listerThings.AllThings.OfType() - .Any(shuttle => shuttle != null && shuttle.Spawned && shuttle.PocketMapGenerated); + .Any(shuttle => shuttle != null && shuttle.Spawned && !shuttle.Destroyed); } catch (Exception arg) {