Merge remote-tracking branch 'gitea/main'

This commit is contained in:
2025-09-05 14:08:31 +08:00
5 changed files with 18 additions and 48 deletions

View File

@@ -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:

View File

@@ -5,7 +5,16 @@
"path": "../.."
},
{
"name": "ArachnaeSwarm",
"path": "../../../ArachnaeSwarm"
},
{
"name": "Data",
"path": "../../../../Data"
},
{
"name": "Assemblies",
"path": "../../../../../../workshop/content/294100/2988801276/1.6/Assemblies"
}
],
"settings": {}

View File

@@ -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 来继续执行原始方法
}
}
}

View File

@@ -15,8 +15,9 @@ namespace WulaFallenEmpire
try
{
// 检查地图上是否存在一个口袋空间已经初始化的武装穿梭机
// 只要地图上存在一个活着的武装穿梭机,就保护地图
return map.listerThings.AllThings.OfType<Building_ArmedShuttleWithPocket>()
.Any(shuttle => shuttle != null && shuttle.Spawned && shuttle.PocketMapGenerated);
.Any(shuttle => shuttle != null && shuttle.Spawned && !shuttle.Destroyed);
}
catch (Exception arg)
{