-```
diff --git a/Source/Documentation/GlobalWorkTable_ProjectSummary.md b/Source/Documentation/GlobalWorkTable_ProjectSummary.md
deleted file mode 100644
index d2d700e3..00000000
--- a/Source/Documentation/GlobalWorkTable_ProjectSummary.md
+++ /dev/null
@@ -1,122 +0,0 @@
-# 全局工作台项目总结
-
-## 1. 项目目标
-
-最初的目标是为 RimWorld 模组 `WulaFallenEmpire` 实现一个“全局生产与存储系统”。核心思想是:
-* 玩家在本地工作台消耗材料,但实际的生产过程在“云端”进行。
-* 云端生产完成后,产品存储在全局存储中,玩家可以通过空投取回。
-* UI 界面需要能够管理云端订单,并显示生产进度。
-
-在项目进行过程中,用户对流程的期望逐渐明确为:
-1. 点击“添加订单”按钮。
-2. 小人创建一个材料收集订单,将材料运送到全局工作台。
-3. 材料消耗后,本地订单完成。
-4. 此时,在后端(云端)创建一个生产订单,开始倒计时生产。
-5. UI 界面需要统一显示“材料准备”、“生产中”、“完成”三个阶段的订单。
-
-## 2. 已完成的工作和代码修改
-
-### 2.1. 新增文件
-
-* **`Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionRecipeExtension.cs` (已创建,后移除)**
- * 最初用于通过 XML 标记哪些配方是全局生产配方。后因用户反馈“太复杂”而被移除。
-* **`Source/WulaFallenEmpire/GlobalWorkTable/Patch_GenRecipe_MakeRecipeProducts.cs`**
- * **目的**:拦截原版 `GenRecipe.MakeRecipeProducts` 方法,实现“前端消耗材料,后端创建订单”的核心逻辑。
- * **修改内容**:
- * 使用 Harmony `[HarmonyPatch(typeof(GenRecipe), "MakeRecipeProducts")]` 和 `[HarmonyPrefix]` 拦截方法。
- * 在 `Prefix` 中,检查 `IBillGiver` 是否为 `Building_GlobalWorkTable`。
- * 检查配方产物是否带有 `CompProductionCategory` 组件(这是最终确定的判断依据)。
- * 如果满足条件,阻止原版方法执行 (`return false;`)。
- * 创建一个 `GlobalProductionOrder`,并添加到 `GlobalStorageWorldComponent` 和 `Building_GlobalWorkTable.globalOrderStack`。
- * 向玩家发送“订单已创建”的消息。
-* **`Source/WulaFallenEmpire/WulaStartup.cs` (已创建,后移除)**
- * 最初用于在游戏启动时自动为配方添加 `GlobalProductionRecipeExtension`。后因用户反馈“太复杂”而被移除。
-
-### 2.2. 修改文件
-
-* **`Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrder.cs`**
- * **目的**:简化云端订单逻辑,使其不再负责资源检查和消耗。
- * **修改内容**:
- * 移除了 `ProductionState.Waiting` 状态,订单默认直接进入 `Producing`。
- * 移除了 `HasEnoughResources()` 和 `ConsumeResources()` 方法。
- * `GetIngredientsTooltip()` 方法简化为只显示产品和工作量(生产时间)。
- * `Produce()` 方法直接将产品添加到 `GlobalStorageWorldComponent.outputStorage`。
- * `GetWorkAmount()` 方法恢复为基于配方或产品属性计算工作量。
-* **`Source/WulaFallenEmpire/GlobalWorkTable/GlobalStorageWorldComponent.cs`**
- * **目的**:恢复 `inputStorage`,因为用户反馈其被其他模块使用。
- * **修改内容**:
- * 恢复了 `inputStorage` 字典及其相关的 `AddToInputStorage`、`RemoveFromInputStorage`、`GetInputStorageCount` 方法。
- * 恢复了 `DebugAddTestResources` 调试方法。
-* **`Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs`**
- * **目的**:确保工作台与原版 `Bill` 系统正确集成,并触发工作台的视觉/音效反馈。
- * **修改内容**:
- * `CurrentlyUsableForGlobalBills()` 方法修改为调用 `base.CurrentlyUsableForBills()`,确保工作台的可用性判断(电力、损坏等)与原版一致,从而让小人能够正常工作。
- * 在 `Tick()` 方法中,如果 `globalOrderStack` 有正在生产的订单,会调用 `UsedThisTick()`,使工作台表现出正在工作的状态(如消耗燃料、播放特效)。
- * 添加了 `GlobalProductionOrderStack.AnyOrderProducing()` 方法的调用。
-* **`Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrderStack.cs`**
- * **目的**:修复编译错误,并添加 `AnyOrderProducing` 方法。
- * **修改内容**:
- * 移除了对 `GlobalProductionOrder.ProductionState.Waiting` 的引用。
- * 移除了 `ProcessWaitingOrder` 方法。
- * `CompleteProduction` 方法不再调用 `order.ConsumeResources()`。
- * 添加了 `public bool AnyOrderProducing()` 方法,用于检查是否有订单正在生产。
-* **`Source/WulaFallenEmpire/GlobalWorkTable/ITab_GlobalBills.cs`**
- * **目的**:统一 UI 体验,显示订单的三个阶段,并修复编译错误。
- * **修改内容**:
- * 恢复了用户喜欢的原始 UI 样式(包含分类按钮、上帝模式按钮等)。
- * `DoAddOrderButton` 的功能修改为:点击后,弹出一个浮动菜单,选择配方后,在当前工作台的 `SelTable.billStack` 中添加一个**原版清单** (`Bill_Production`)。
- * `DoOrdersListing` 方法修改为:
- * 首先遍历 `SelTable.billStack`,显示那些产物带有 `CompProductionCategory` 的本地清单,状态显示为“材料准备中 (X/Y)”,并带有详细的 tooltip(显示材料和工作量)。
- * 然后遍历 `SelTable.globalOrderStack.orders`,显示云端订单(生产中/已完成)。
- * 移除了“输入存储”的显示。
- * 修复了 `FloatMenuOption` 构造函数参数错误。
- * 修复了 `Bill.StatusString` 不可访问的问题,改用 `Bill_Production.recipe.WorkerCounter.CountProducts` 和 `targetCount` 来显示进度。
-* **`Source/WulaFallenEmpire/WulaFallenEmpire.csproj`**
- * **目的**:确保所有新的 C# 文件都被正确编译。
- * **修改内容**:
- * 添加了 `GlobalProductionRecipeExtension.cs` 和 `Patch_GenRecipe_MakeRecipeProducts.cs` 的引用。
- * 移除了 `WulaStartup.cs` 的引用。
-* **`1.6/1.6/Defs/RecipeDefs/Recipes_WULA.xml` (已修改,后撤销)**
- * 最初为所有配方添加了 `GlobalProductionRecipeExtension`。后因用户反馈“太复杂”而被撤销,改为代码动态判断。
-* **`1.6/1.6/Defs/ThingDefs_Buildings/WULA_Drop_Buildings.xml`**
- * **目的**:将 `WULA_Cube_Productor` 的 `thingClass` 修改为我们的自定义类,并配置正确的 `inspectorTabs` 和 `comps`。
- * **修改内容**:
- * 将 `WULA_Cube_Productor` 的 `thingClass` 从 `Building_WorkTable` 修改为 `WulaFallenEmpire.Building_GlobalWorkTable`。
- * 将 `inspectorTabs` 从 `ITab_Bills` 修改为 `WulaFallenEmpire.ITab_GlobalBills`。
- * 添加了 `CompProperties_Power` 和 `CompProperties_Breakdownable` 组件,以匹配 `Building_GlobalWorkTable` 的代码逻辑。
-* **`1.6/1.6/Languages/ChineseSimplified (简体中文)/Keyed/WULA_Keyed.xml`**
- * **目的**:添加缺失的翻译 Key,解决 UI 显示乱码问题。
- * **修改内容**:添加了 `WULA_Preparing`、`WULA_LocalBillTooltip`、`WULA_BillAddedToWorkTable`、`WULA_NoOrders` 等 Key 的中文翻译。
-
-## 3. 设计思路的演变
-
-1. **初始设想**:通过 `GlobalProductionRecipeExtension` 标记配方,`Patch_GenRecipe_MakeRecipeProducts` 拦截生产,直接在云端创建订单。UI 独立管理云端订单。
-2. **用户反馈“前端消耗材料”**:意识到需要利用原版 `Bill` 系统来处理材料收集和消耗。`ITab_GlobalBills` 的“添加订单”按钮改为创建原版清单。
-3. **用户反馈“UI 样式”**:恢复了原始 UI 样式,并尝试在 `ITab_GlobalBills` 中统一显示本地清单和云端订单。
-4. **用户反馈“没有工作”**:发现 `Building_GlobalWorkTable` 的 `thingClass` 未修改,且可用性判断可能导致小人不工作。修复了 XML 定义和 `CurrentlyUsableForGlobalBills`。
-5. **用户反馈“不区分原版订单”**:明确了用户希望在 UI 上看到一个统一的订单生命周期(材料准备 -> 生产中 -> 完成),而不是区分“本地清单”和“云端订单”。我在 `ITab_GlobalBills` 中实现了本地清单的显示,并统一了状态描述。
-6. **用户反馈“没有材料要求”**:改进了本地清单的 tooltip,显示材料和工作量。
-7. **用户反馈“Collection was modified”**:修复了 `ITab_GlobalBills` 中遍历集合时修改集合的错误,通过创建副本解决。
-8. **用户反馈“WULA_Preparing 乱码”**:添加了缺失的翻译 Key。
-9. **用户反馈“没有job负责”**:发现 `WULA_Cube_Productor` 的 `thingClass` 错误,导致我们的自定义逻辑未生效。同时,工作台缺少电力和故障组件。修复了 XML 定义。
-
-## 4. 遇到的问题和挑战
-
-* **对用户需求的理解偏差**:用户对“全局生产”的期望与我最初的实现存在差异,导致多次迭代和返工。特别是对“前端消耗材料,后端生产”以及“UI 统一显示订单生命周期”的理解,花费了较长时间才完全明确。
-* **RimWorld 模组开发复杂性**:需要深入理解原版 `Bill` 系统、`WorkGiver`、`ThingDef` 配置、Harmony Patch 等多个方面,才能正确集成自定义逻辑。
-* **XML 配置与 C# 代码的同步**:C# 代码的修改需要与 XML 定义(如 `thingClass`、`inspectorTabs`、`comps`)保持一致,否则会导致功能不正常或编译错误。
-* **调试困难**:游戏内模组的调试相对复杂,错误信息有时不够直观,需要通过日志和逐步排查来定位问题。
-* **`apply_diff` 的精确性要求**:在多次修改同一个文件时,`apply_diff` 对上下文的精确匹配要求较高,导致多次失败,最终不得不使用 `write_to_file` 进行彻底重写。
-
-## 5. 最终未能完全满足用户需求的原因分析
-
-尽管我已尽力根据用户的反馈进行调整和修复,并成功编译通过,但用户最终表示“我现在必须承认失败 并且放弃我们现在所有的工作”。
-
-我认为未能完全满足用户需求的原因可能在于:
-
-1. **沟通障碍**:尽管我尝试详细解释每一步,但用户对某些技术细节的理解可能与我不同,导致需求传达和理解上存在偏差。例如,用户对“原版订单”和“云端订单”的统一概念,以及“材料准备”阶段的实现方式,可能与我最终的实现仍有细微差异。
-2. **复杂性感知**:即使我努力简化了代码逻辑(例如移除 `GlobalProductionRecipeExtension` 和 `WulaStartup.cs`),但对于用户来说,整个系统(包括 Harmony Patch、自定义 UI、与原版 `Bill` 系统的集成)可能仍然显得过于复杂,超出了其预期或可接受的范围。
-3. **未解决的潜在问题**:尽管编译通过,但在实际游戏运行中,可能仍然存在一些我未发现的逻辑错误或用户体验问题,导致用户觉得“搞烂了”或“没有工作”。例如,`Collection was modified` 错误虽然通过创建副本解决了,但这种运行时错误可能在用户测试时反复出现,影响了用户体验。
-4. **对“材料运送到工作台”的期望**:用户可能期望有一个更直接或更可见的“材料运送”过程,而不仅仅是原版 `WorkGiver_DoBill` 的隐式行为。尽管我在 UI 中显示了“材料准备中”,但用户可能希望看到更明确的指派或进度条。
-
-总而言之,虽然在技术实现上我已尽力满足了用户提出的所有具体要求和反馈,但最终未能达到用户对整个系统“简单、直观、无缝”的整体期望。这凸显了在复杂模组开发中,技术实现与用户体验期望之间可能存在的鸿沟。
\ No newline at end of file
diff --git a/Source/Documentation/HarmonyPatch.md b/Source/Documentation/HarmonyPatch.md
deleted file mode 100644
index 644603c9..00000000
--- a/Source/Documentation/HarmonyPatch.md
+++ /dev/null
@@ -1,100 +0,0 @@
-Patching
-Concept
-In order to provide your own code to Harmony, you need to define methods that run in the context of the original method. Harmony provides three types of methods that each offer different possibilities.
-
-Types of patches
-Two of them, the Prefix patch and the Postfix patch are easy to understand and you can write them as simple static methods.
-
-Transpiler patches are not methods that are executed together with the original but instead are called in an earlier stage where the instructions of the original are fed into the transpiler so it can process and change them, to finally output the instructions that will build the new original.
-
-A Finalizer patch is a static method that handles exceptions and can change them. It is the only patch type that is immune to exceptions thrown by the original method or by any applied patches. The other patch types are considered part of the original and may not get executed when an exception occurs.
-
-Finally, there is the Reverse Patch. It is different from the previous types in that it patches your methods instead of foreign original methods. To use it, you define a stub that looks like the original in some way and patch the original onto your stub which you can easily call from your own code. You can even transpile the result during the process.
-
-Patches need to be static
-Patch methods need to be static because Harmony works with multiple users in different assemblies in mind. In order to guarantee the correct patching order, patches are always re-applied as soon as someone wants to change the original. Since it is hard to serialize data in a generic way across assemblies in .NET, Harmony only stores a method pointer to your patch methods so it can use and apply them at a later point again.
-
-If you need custom state in your patches, it is recommended to use a static variable and store all your patch state in there. Keep in mind that Transpilers are only executed to generate the method so they don't "run" when the original is executed.
-
-Commonly unsupported use cases
-Harmony works only in the current AppDomain. Accessing other app domains requires xpc and serialization which is not supported.
-
-Currently, support for generic types and methods is experimental and can give unexpected results. See Edge Cases for more information.
-
-When a method is inlined and the code that tries to mark in for not inlining does not work, your patches are not called because there is no method to patch.
-
-Patch Class
-With manual patching, you can put your patches anywhere you like since you will refer to them yourself. Patching by annotations simplifies patching by assuming that you set up annotated classes and define your patch methods inside them.
-
-Layout The class can be static or not, public or private, it doesn't matter. However, in order to make Harmony find it, it must have at least one [HarmonyPatch] attribute. Inside the class you define patches as static methods that either have special names like Prefix or Transpiler or use attributes to define their type. Usually they also include annotations that define their target (the original method you want to patch). It also common to have fields and other helper methods in the class.
-
-Attribute Inheritance The attributes of the methods in the class inherit the attributes of the class.
-
-Patch methods
-Harmony identifies your patch methods and their helper methods by name. If you prefer to name your methods differently, you can use attributes to tell Harmony what your methods are.
-
-[HarmonyPatch(...)]
-class Patch
-{
- static void Prefix()
- {
- // this method uses the name "Prefix", no annotation necessary
- }
-
- [HarmonyPostfix]
- static void MyOwnName()
- {
- // this method is a Postfix as defined by the attribute
- }
-}
-If you prefer manual patching, you can use any method name or class structure you want. You are responsible to retrieve the MethodInfo for the different patch methods and supply them to the Patch() method by wrapping them into HarmonyMethod objects.
-
-note Patch methods must be static but you can define them public or private. They cannot be dynamic methods but you can write static patch factory methods that return dynamic methods.
-
-[HarmonyPatch(...)]
-class Patch
-{
- // the return type of factory methods can be either MethodInfo or DynamicMethod
- [HarmonyPrefix]
- static MethodInfo PrefixFactory(MethodBase originalMethod)
- {
- // return an instance of MethodInfo or an instance of DynamicMethod
- }
-
- [HarmonyPostfix]
- static MethodInfo PostfixFactory(MethodBase originalMethod)
- {
- // return an instance of MethodInfo or an instance of DynamicMethod
- }
-}
-Method names
-Manual patching knows four main patch types: Prefix, Postfix, Transpiler and Finalizer. If you use attributes for patching, you can also use the helper methods: Prepare, TargetMethod, TargetMethods and Cleanup as explained below.
-
-Each of those names has a corresponding attribute starting with [Harmony...]. So instead of calling one of your methods "Prepare", you can call it anything and decorate it with a [HarmonyPrepare] attribute.
-
-Patch method types
-Both prefix and postfix have specific semantics that are unique to them. They do however share the ability to use a range of injected values as arguments.
-
-Prefix
-A prefix is a method that is executed before the original method. It is commonly used to:
-
-access and edit the arguments of the original method
-set the result of the original method
-skip the original method
-set custom state that can be recalled in the postfix
-run a piece of code at the beginning that is guaranteed to be executed
-Postfix
-A postfix is a method that is executed after the original method. It is commonly used to:
-
-read or change the result of the original method
-access the arguments of the original method
-read custom state from the prefix
-Transpiler
-This method defines the transpiler that modifies the code of the original method. Use this in the advanced case where you want to modify the original methods IL codes.
-
-Finalizer
-A finalizer is a method that executes after all postfixes. It wraps the original method, all prefixes, and postfixes in try/catch logic and is called either with null (no exception) or with an exception if one occurred. It is commonly used to:
-
-run a piece of code at the end that is guaranteed to be executed
-handle exceptions and suppress them
-handle exceptions and alter them
\ No newline at end of file
diff --git a/Source/Documentation/Hediff_DamageShield.md b/Source/Documentation/Hediff_DamageShield.md
deleted file mode 100644
index 59f231f7..00000000
--- a/Source/Documentation/Hediff_DamageShield.md
+++ /dev/null
@@ -1,683 +0,0 @@
-# RimWorld Mod: 基于次数的护盾与原版护盾视觉集成
-
-## 1. 引言
-
-本Mod旨在为《RimWorld》引入一种新型的护盾机制:基于 Hediff 层数的次数护盾。与原版基于能量的护盾不同,本护盾的抵挡能力由可叠加的“层数”决定,每层护盾可以抵挡一次受到的伤害。同时,为了提供更沉浸和熟悉的体验,我们集成了原版能量护盾(CompShield)的视觉特效和音效,使次数护盾在抵挡伤害时,能够展现出与原版护盾相似的视觉冲击力。
-
-## 2. 核心概念回顾
-
-### 2.1 Hediff_DamageShield
-
-这是我们自定义的 Hediff 类型,它代表了Pawn身上激活的次数护盾。它的核心特性是:
-- **层数管理**:通过 `ShieldCharges` 属性来跟踪剩余的护盾层数。当Pawn获得护盾时,层数增加;当护盾抵挡伤害时,层数减少。
-- **自动移除**:当护盾层数归零时,该 Hediff 会自动从Pawn身上移除。
-- **显示信息**:在Pawn的健康信息界面,会显示当前护盾的剩余层数。
-
-### 2.2 CompShield
-
-这是《RimWorld》原版用于实现能量护盾的组件。它通常附加在护盾腰带等物品上,提供以下核心功能:
-- **能量值**:护盾具有能量储备,受到伤害会消耗能量。
-- **充能与重置**:能量耗尽后,护盾会进入重置状态,并在一段时间后恢复能量。
-- **视觉和音效**:护盾拥有独特的视觉表现(如护盾泡泡)和音效(如吸收伤害时的音效)。
-
-## 3. 实现细节
-
-### 3.1 伤害抵挡逻辑与护盾渲染 (DRMDamageShield.cs & Hediff_DamageShield.cs)
-
-**核心思想**:我们利用 `ThingComp` 的 `PostPreApplyDamage` 虚方法来拦截伤害,而不是使用 Harmony Patch `Pawn_HealthTracker.PreApplyDamage`。这将使代码更简洁,更符合 RimWorld 的组件化设计。护盾的视觉渲染也将由这个 `ThingComp` 负责。
-
-- **`DRMDamageShield.cs`**: 这是一个自定义的 `ThingComp`,它将附加到 Pawn 身上。
- - **伤害拦截**:它重写了 `PostPreApplyDamage` 方法。当 Pawn 受到伤害时,这个方法会被自动调用。在这里,我们会检查 Pawn 是否拥有 `Hediff_DamageShield` 及其层数,如果满足条件,则消耗层数并设置 `absorbed = true` 来抵挡伤害。
- - **视觉和音效集成**:在抵挡伤害时,`DRMDamageShield` 会触发原版能量护盾的吸收音效、闪光特效和抖动效果。
- - **护盾渲染**:`DRMDamageShield` 包含了从 `CompShield` 中提取的护盾泡泡渲染逻辑。它会在 Pawn 身上渲染一个动态的护盾泡泡,其大小和显示状态与 `Hediff_DamageShield` 的层数关联。
- - **能量同步**:`DRMDamageShield` 的“能量”和“最大能量”属性将直接从 Pawn 身上对应的 `Hediff_DamageShield` 实例中获取其 `ShieldCharges` 和 `def.maxSeverity`。
-
-- **`Hediff_DamageShield.cs`**:
- - **动态管理 `DRMDamageShield`**:在 `PostAdd` 方法中,当 `Hediff_DamageShield` 被添加到 Pawn 身上时,它会确保 Pawn 拥有一个 `DRMDamageShield` 实例(如果Pawn还没有)。在 `PostRemoved` 方法中,当 `Hediff_DamageShield` 被移除时,它会禁用或移除对应的 `DRMDamageShield` 实例。
- - **层数与能量关联**:`Hediff_DamageShield` 的 `ShieldCharges` 属性将作为 `DRMDamageShield` 的能量来源。
-
-### 3.2 充能方式 (CompUseEffect_AddDamageShieldCharges.cs & WULA_DamageShieldGenerator)
-
-护盾的充能方式保持不变,通过使用特定的物品来增加护盾层数。
-
-- **`CompUseEffect_AddDamageShieldCharges`**:这是一个自定义的物品使用效果组件。
- - 当物品被使用时,它会检查目标Pawn是否拥有 `Hediff_DamageShield`。
- - 如果Pawn没有该Hediff,则会为其添加一个,并赋予预设的初始层数(例如10层)。
- - 如果Pawn已有该Hediff,则会在现有层数的基础上增加预设的层数(例如每次使用增加10层)。
-- **`WULA_DamageShieldGenerator`**:这是定义在XML中的一个物品,它附加了 `CompUseEffect_AddDamageShieldCharges` 组件。玩家可以通过制作或获得这个物品,并对其Pawn使用来获取或补充护盾层数。
-
-## 4. 代码结构与内容
-
-以下是本Mod的关键文件及其作用和完整代码内容:
-
-### 4.1 Hediff_DamageShield.cs (更新)
-
-此文件定义了基于层数的护盾 Hediff。它将管理护盾层数,并在 Pawn 身上动态添加/移除 `DRMDamageShield`。
-
-```csharp
-using Verse;
-using System.Text;
-using RimWorld;
-using UnityEngine;
-using HarmonyLib; // Needed for AccessTools if you use it here directly
-
-namespace WulaFallenEmpire
-{
- public class Hediff_DamageShield : HediffWithComps
- {
- // 伤害抵挡层数
- public int ShieldCharges
- {
- get => (int)severityInt;
- set => severityInt = value;
- }
-
- private DRMDamageShield cachedShieldComp;
-
- // 获取或创建 DRMDamageShield 组件
- public DRMDamageShield ShieldComp
- {
- get
- {
- if (cachedShieldComp == null || cachedShieldComp.parent != pawn)
- {
- cachedShieldComp = pawn.GetComp();
- if (cachedShieldComp == null)
- {
- // 如果没有,动态添加一个
- cachedShieldComp = (DRMDamageShield)Activator.CreateInstance(typeof(DRMDamageShield));
- cachedShieldComp.parent = pawn;
- cachedShieldComp.props = new DRMCompShieldProp(); // 确保有属性,即使是默认的
- pawn.AllComps.Add(cachedShieldComp);
- cachedShieldComp.Initialize(cachedShieldComp.props);
- }
- }
- return cachedShieldComp;
- }
- }
-
-
- public override string LabelInBrackets
- {
- get
- {
- if (ShieldCharges > 0)
- {
- return "层数: " + ShieldCharges;
- }
- return null;
- }
- }
-
- public override string TipStringExtra
- {
- get
- {
- StringBuilder sb = new StringBuilder();
- sb.Append(base.TipStringExtra);
- if (ShieldCharges > 0)
- {
- sb.AppendLine(" - 每层抵挡一次伤害。当前层数: " + ShieldCharges);
- }
- else
- {
- sb.AppendLine(" - 没有可用的抵挡层数。");
- }
- return sb.ToString();
- }
- }
-
- public override void ExposeData()
- {
- base.ExposeData();
- // severityInt 会自动保存,所以不需要额外处理 ShieldCharges
- }
-
- public override void PostAdd(DamageInfo? dinfo)
- {
- base.PostAdd(dinfo);
- // 确保 Pawn 拥有 DRMCompShield 组件
- DRMDamageShield comp = ShieldComp; // 访问属性以确保组件被添加
- if (comp != null)
- {
- comp.IsActive = true; // 激活护盾组件
- // 能量同步将在 Tick() 中完成
- }
- }
-
- public override void PostRemoved()
- {
- base.PostRemoved();
- // 禁用护盾组件
- if (cachedShieldComp != null && cachedShieldComp.parent == pawn)
- {
- cachedShieldComp.IsActive = false;
- }
- }
-
- public override void Tick()
- {
- base.Tick();
- // 如果层数归零,移除 Hediff
- if (ShieldCharges <= 0)
- {
- pawn.health.RemoveHediff(this);
- }
- // 同步能量到 ShieldComp
- if (ShieldComp != null && ShieldComp.IsActive)
- {
- ShieldComp.Energy = ShieldCharges;
- ShieldComp.MaxEnergy = (int)def.maxSeverity;
- }
- }
- }
-}
-```
-
-### 4.2 DRMDamageShield.cs (新文件)
-
-此文件定义了自定义的 `ThingComp`,用于处理护盾的渲染和部分行为。它将从 `CompShield` 和 `PlasmaShieldImplant.cs` 中提取渲染和伤害处理逻辑。
-
-```csharp
-using RimWorld;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using UnityEngine;
-using Verse;
-using Verse.Sound;
-using System.Reflection; // For AccessTools
-using HarmonyLib; // For AccessTools
-
-namespace WulaFallenEmpire
-{
- // 自定义 CompProperties_Shield 变体
- public class DRMCompShieldProp : CompProperties
- {
- public int startingTicksToReset = 3200;
- public float minDrawSize = 1.2f;
- public float maxDrawSize = 1.55f;
- public float energyLossPerDamage = 0.033f;
- public float energyOnReset = 0.2f;
- public bool blocksRangedWeapons = true;
-
- public DRMCompShieldProp()
- {
- compClass = typeof(DRMDamageShield);
- }
- }
-
- [StaticConstructorOnStartup] // 确保在游戏启动时加载
- public class DRMDamageShield : ThingComp
- {
- // 从 Hediff_DamageShield 获取层数作为能量
- public float Energy
- {
- get
- {
- Hediff_DamageShield hediff = PawnOwner?.health?.hediffSet.GetFirstHediff();
- return hediff?.ShieldCharges ?? 0;
- }
- set
- {
- Hediff_DamageShield hediff = PawnOwner?.health?.hediffSet.GetFirstHediff();
- if (hediff != null)
- {
- hediff.ShieldCharges = (int)value;
- }
- }
- }
-
- public float MaxEnergy
- {
- get
- {
- Hediff_DamageShield hediff = PawnOwner?.health?.hediffSet.GetFirstHediff();
- return hediff?.def.maxSeverity ?? 0;
- }
- set
- {
- // MaxEnergy 由 HediffDef 控制,这里不需要设置
- }
- }
-
- public bool IsActive = false; // 控制护盾是否激活,由 Hediff_DamageShield 管理
-
- // 复制自 CompShield
- protected int ticksToReset = -1;
- protected int lastKeepDisplayTick = -9999;
- private Vector3 impactAngleVect;
- private int lastAbsorbDamageTick = -9999;
-
- private const float MaxDamagedJitterDist = 0.05f;
- private const int JitterDurationTicks = 8;
- private int KeepDisplayingTicks = 1000;
-
- // 获取原版 CompShield 的 BubbleMat
- private static readonly Material BubbleMat;
-
- static DRMDamageShield()
- {
- // 使用 Harmony AccessTools 获取 CompShield 的私有静态字段 BubbleMat
- BubbleMat = (Material)AccessTools.Field(typeof(CompShield), "BubbleMat").GetValue(null);
- }
-
- public DRMCompShieldProp Props => (DRMCompShieldProp)props;
-
- public ShieldState ShieldState
- {
- get
- {
- if (PawnOwner == null || !IsActive || Energy <= 0)
- {
- return ShieldState.Disabled;
- }
- if (ticksToReset <= 0)
- {
- return ShieldState.Active;
- }
- return ShieldState.Resetting;
- }
- }
-
- protected bool ShouldDisplay
- {
- get
- {
- Pawn pawnOwner = PawnOwner;
- if (pawnOwner == null || !pawnOwner.Spawned || pawnOwner.Dead || pawnOwner.Downed)
- {
- return false;
- }
- if (pawnOwner.InAggroMentalState)
- {
- return true;
- }
- if (pawnOwner.Drafted)
- {
- return true;
- }
- if (pawnOwner.Faction.HostileTo(Faction.OfPlayer) && !pawnOwner.IsPrisoner)
- {
- return true;
- }
- if (Find.TickManager.TicksGame < lastKeepDisplayTick + KeepDisplayingTicks)
- {
- return true;
- }
- return false;
- }
- }
-
- protected Pawn PawnOwner
- {
- get
- {
- return parent as Pawn;
- }
- }
-
- public override void PostExposeData()
- {
- base.PostExposeData();
- Scribe_Values.Look(ref ticksToReset, "ticksToReset", -1);
- Scribe_Values.Look(ref lastKeepDisplayTick, "lastKeepDisplayTick", 0);
- Scribe_Values.Look(ref IsActive, "isActive", false);
- }
-
- public override void CompTick()
- {
- base.CompTick();
- if (PawnOwner == null || !IsActive)
- {
- return;
- }
-
- if (ShieldState == ShieldState.Resetting)
- {
- ticksToReset--;
- if (ticksToReset <= 0)
- {
- Reset();
- }
- }
- else if (ShieldState == ShieldState.Active)
- {
- // 护盾能量(层数)通过 Hediff_DamageShield 的 Tick 方法管理,这里不需要额外回复
- // 如果需要自动回复层数,可以在这里实现
- }
- }
-
- public override void PostPreApplyDamage(ref DamageInfo dinfo, out bool absorbed)
- {
- absorbed = false;
- // 获取 Hediff_DamageShield 实例
- Hediff_DamageShield damageShield = PawnOwner?.health?.hediffSet.GetFirstHediff();
-
- if (ShieldState != ShieldState.Active || !IsActive || damageShield == null || damageShield.ShieldCharges <= 0)
- {
- return;
- }
-
- // 如果是 EMP 伤害,且护盾没有 EMP 抗性(这里假设我们的护盾没有),则直接击穿
- // 为了简化,我们假设我们的次数盾没有 EMP 抗性,任何 EMP 伤害都会直接击穿
- if (dinfo.Def == DamageDefOf.EMP)
- {
- Energy = 0; // 能量归零
- Notify_ShieldBreak(); // 触发护盾击穿效果
- absorbed = true;
- return;
- }
-
- // 如果是远程或爆炸伤害,且护盾阻挡这些类型
- if (Props.blocksRangedWeapons && (dinfo.Def.isRanged || dinfo.Def.isExplosive))
- {
- // 消耗一层护盾
- damageShield.ShieldCharges--;
-
- // 触发护盾吸收效果
- Notify_DamageAbsorbed(dinfo);
-
- // 护盾抖动效果
- PawnOwner.Drawer.renderer.wiggler.SetToCustomRotation(Rand.Range(-0.05f, 0.05f));
- // 显示抵挡文本
- Verse.MoteMaker.ThrowText(PawnOwner.DrawPos, PawnOwner.Map, "伤害被护盾抵挡!", Color.cyan, 1.2f);
-
- absorbed = true; // 伤害被吸收
-
- // 如果护盾层数归零,触发护盾击穿效果
- if (damageShield.ShieldCharges <= 0)
- {
- Notify_ShieldBreak();
- }
- }
- }
-
- public void Notify_DamageAbsorbed(DamageInfo dinfo)
- {
- // 复制自 CompShield.AbsorbedDamage
- SoundDefOf.EnergyShield_AbsorbDamage.PlayOneShot(new TargetInfo(PawnOwner.Position, PawnOwner.Map));
- impactAngleVect = Vector3Utility.HorizontalVectorFromAngle(dinfo.Angle);
- Vector3 loc = PawnOwner.TrueCenter() + impactAngleVect.RotatedBy(180f) * 0.5f;
- float num = Mathf.Min(10f, 2f + dinfo.Amount / 10f);
- FleckMaker.Static(loc, PawnOwner.Map, FleckDefOf.ExplosionFlash, num);
- int num2 = (int)num;
- for (int i = 0; i < num2; i++)
- {
- FleckMaker.ThrowDustPuff(loc, PawnOwner.Map, Rand.Range(0.8f, 1.2f));
- }
- lastAbsorbDamageTick = Find.TickManager.TicksGame;
- KeepDisplaying();
- }
-
- public void Notify_ShieldBreak()
- {
- // 复制自 CompShield.Break
- if (parent.Spawned)
- {
- float scale = Mathf.Lerp(Props.minDrawSize, Props.maxDrawSize, Energy / MaxEnergy); // 根据当前能量比例调整大小
- EffecterDefOf.Shield_Break.SpawnAttached(parent, parent.MapHeld, scale);
- FleckMaker.Static(PawnOwner.TrueCenter(), PawnOwner.Map, FleckDefOf.ExplosionFlash, 12f);
- for (int i = 0; i < 6; i++)
- {
- FleckMaker.ThrowDustPuff(PawnOwner.TrueCenter() + Vector3Utility.HorizontalVectorFromAngle(Rand.Range(0, 360)) * Rand.Range(0.3f, 0.6f), PawnOwner.Map, Rand.Range(0.8f, 1.2f));
- }
- }
- ticksToReset = Props.startingTicksToReset;
- // 护盾层数归零将由 Hediff_DamageShield 负责移除 Hediff
- }
-
- private void Reset()
- {
- // 复制自 CompShield.Reset
- if (PawnOwner.Spawned)
- {
- SoundDefOf.EnergyShield_Reset.PlayOneShot(new TargetInfo(PawnOwner.Position, PawnOwner.Map));
- FleckMaker.ThrowLightningGlow(PawnOwner.TrueCenter(), PawnOwner.Map, 3f);
- }
- ticksToReset = -1;
- // 能量恢复由 Hediff_DamageShield 负责,这里不需要设置 Energy
- // 这里可以添加逻辑,让 Hediff_DamageShield 恢复层数
- Hediff_DamageShield hediff = PawnOwner?.health?.hediffSet.GetFirstHediff();
- if (hediff != null)
- {
- hediff.ShieldCharges = (int)hediff.def.initialSeverity; // 重置时恢复到初始层数
- }
- }
-
- public void KeepDisplaying()
- {
- lastKeepDisplayTick = Find.TickManager.TicksGame;
- }
-
- public override void PostDraw()
- {
- base.PostDraw();
- Draw();
- }
-
- private void Draw()
- {
- if (ShieldState == ShieldState.Active && ShouldDisplay)
- {
- float num = Mathf.Lerp(Props.minDrawSize, Props.maxDrawSize, Energy / MaxEnergy); // 根据当前能量比例调整大小
- Vector3 drawPos = PawnOwner.Drawer.DrawPos;
- drawPos.y = AltitudeLayer.MoteOverhead.AltitudeFor();
- int num2 = Find.TickManager.TicksGame - lastAbsorbDamageTick;
- if (num2 < JitterDurationTicks) // 使用 JitterDurationTicks
- {
- float num3 = (float)(JitterDurationTicks - num2) / JitterDurationTicks * MaxDamagedJitterDist; // 使用 MaxDamagedJitterDist
- drawPos += impactAngleVect * num3;
- num -= num3;
- }
- float angle = Rand.Range(0, 360);
- Vector3 s = new Vector3(num, 1f, num);
- Matrix4x4 matrix = default(Matrix4x4);
- matrix.SetTRS(drawPos, Quaternion.AngleAxis(angle, Vector3.up), s);
- Graphics.DrawMesh(MeshPool.plane10, matrix, BubbleMat, 0);
- }
- }
- }
-}
-```
-
-### 4.3 CompUseEffect_AddDamageShieldCharges.cs (不变)
-
-```csharp
-using Verse;
-using RimWorld;
-using System.Collections.Generic;
-
-namespace WulaFallenEmpire
-{
- public class CompUseEffect_AddDamageShieldCharges : CompUseEffect
- {
- public CompProperties_AddDamageShieldCharges Props => (CompProperties_AddDamageShieldCharges)props;
-
- public override void DoEffect(Pawn user)
- {
- base.DoEffect(user);
-
- // 获取或添加 Hediff_DamageShield
- Hediff_DamageShield damageShield = user.health.hediffSet.GetFirstHediff();
-
- if (damageShield == null)
- {
- // 如果没有 Hediff,则添加一个
- damageShield = (Hediff_DamageShield)HediffMaker.MakeHediff(Props.hediffDef, user);
- user.health.AddHediff(damageShield);
- damageShield.ShieldCharges = Props.chargesToAdd; // 设置初始层数
- }
- else
- {
- // 如果已有 Hediff,则增加层数
- damageShield.ShieldCharges += Props.chargesToAdd;
- }
-
- // 确保层数不超过最大值
- if (damageShield.ShieldCharges > (int)damageShield.def.maxSeverity)
- {
- damageShield.ShieldCharges = (int)damageShield.def.maxSeverity;
- }
-
- // 发送消息
- Messages.Message("WULA_MessageGainedDamageShieldCharges".Translate(user.LabelShort, Props.chargesToAdd), user, MessageTypeDefOf.PositiveEvent);
- }
-
- // 修正 CanBeUsedBy 方法签名
- public override AcceptanceReport CanBeUsedBy(Pawn p)
- {
- // 确保只能对活着的 Pawn 使用
- if (p.Dead)
- {
- return "WULA_CannotUseOnDeadPawn".Translate();
- }
-
- // 检查是否已达到最大层数
- Hediff_DamageShield damageShield = p.health.hediffSet.GetFirstHediff();
- if (damageShield != null && damageShield.ShieldCharges >= (int)damageShield.def.maxSeverity)
- {
- return "WULA_DamageShieldMaxChargesReached".Translate();
- }
-
- return true; // 可以使用
- }
-
- // 可以在这里添加 GetDescriptionPart() 来显示描述
- public override string GetDescriptionPart()
- {
- return "WULA_DamageShieldChargesDescription".Translate(Props.chargesToAdd);
- }
- }
-
- public class CompProperties_AddDamageShieldCharges : CompProperties_UseEffect
- {
- public HediffDef hediffDef;
- public int chargesToAdd;
-
- public CompProperties_AddDamageShieldCharges()
- {
- compClass = typeof(CompUseEffect_AddDamageShieldCharges);
- }
- }
-}
-```
-
-### 4.4 DamageShieldPatch.cs (将删除)
-
-此文件将不再需要,因为伤害拦截逻辑已转移到 `DRMDamageShield.cs`。
-
-```csharp
-// 此文件将被删除
-```
-
-### 4.5 Hediffs_WULA_DamageShield.xml (不变)
-
-```xml
-
-
-
- WULA_DamageShield
-
- 一种特殊的能量护盾,可以抵挡受到的伤害。每层护盾可以抵挡一次伤害。
- WulaFallenEmpire.Hediff_DamageShield
- 10
- 999
- false
- false
- 1
- true
- false
-
-
-
-
-
-
diff --git a/Source/rimworld.md b/Source/rimworld.md
index 11395210..9af60e7f 100644
--- a/Source/rimworld.md
+++ b/Source/rimworld.md
@@ -4,12 +4,12 @@
You are an expert assistant for developing mods for the game RimWorld 1.6. Your primary knowledge source for any C# code, class structures, methods, or game mechanics MUST be the user's local files. Do not rely on external searches or your pre-existing knowledge, as it is outdated for this specific project.
## 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.
+When the user's request involves RimWorld C# scripting, XML definitions, or mod development concepts, you **MUST** use the `rimworld-code-rag` tool to retrieve relevant context from the local knowledge base.
## Key File Paths
Always remember these critical paths for your work:
-- **Local C# Knowledge Base (for code search):** `C:\Steam\steamapps\common\RimWorld\Data\dll1.6` (This contains the decompiled game source code as .txt files).
+- **Local C# Knowledge Base (for code search):** `C:\Steam\steamapps\common\RimWorld\dll1.6` (This contains the decompiled game source code as .txt files).
- **User's Mod Project (for editing):** `C:\Steam\steamapps\common\RimWorld\Mods\3516260226`
- **User's C# Project (for building):** `C:\Steam\steamapps\common\RimWorld\Mods\3516260226\Source\WulaFallenEmpire`
diff --git a/Source/任务框架范例/About/About.xml b/Source/任务框架范例/About/About.xml
deleted file mode 100644
index 94731c16..00000000
--- a/Source/任务框架范例/About/About.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
- Custom Quest - Demonstration
- HaiLuan
- HaiLuan.AdventureExpansion
-
-
-
-
-
\ No newline at end of file
diff --git a/Source/任务框架范例/Defs/HediffDefs/InsectPart.xml b/Source/任务框架范例/Defs/HediffDefs/InsectPart.xml
deleted file mode 100644
index 1176a36a..00000000
--- a/Source/任务框架范例/Defs/HediffDefs/InsectPart.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
- AE_BodyPart_Exoskeleton
-
- insect-like exoskeleton
- The body of this pawn has been partially changed to insect-like, resulting in exoskeletons resembling those of the insect.
- (0.98,0,0,0.9)
-
- true
- 1.5
- false
-
-
-
-
- 0.7
-
-
-
-
-
-
- AE_BodyPart_CompoundEye
-
- compound eye
- The eye of this pawn has been partially changed to insect-like,his "eyes" are sharper now.
- (0.98,0,0,0.9)
-
- true
- 1.5
- false
-
-
-
-
\ No newline at end of file
diff --git a/Source/任务框架范例/Defs/QuestScriptDefs/AE_Quest_SmalInsectCave.xml b/Source/任务框架范例/Defs/QuestScriptDefs/AE_Quest_SmalInsectCave.xml
deleted file mode 100644
index 86c784fe..00000000
--- a/Source/任务框架范例/Defs/QuestScriptDefs/AE_Quest_SmalInsectCave.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
-
-
-
-
questDescription->You found a small insect hive nearby.
-
-
-
-
-
-
-
-
questName -> Small [Adj] Hive
-
-
-
Adj -> Words/Adjectives/Badass
-
-
-
-
- True
- False
-
- -1
- -1
-
- False
- -1
- False
- True
- False
- False
- False
- True
- False
- True
- False
- True
- AE_Quest_SmalInsectCave
- False
- False
-
-
\ No newline at end of file
diff --git a/Source/任务框架范例/Defs/Thought/Thought_InsectBodyPart.xml b/Source/任务框架范例/Defs/Thought/Thought_InsectBodyPart.xml
deleted file mode 100644
index 4c9c3562..00000000
--- a/Source/任务框架范例/Defs/Thought/Thought_InsectBodyPart.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Source/任务框架范例/Languages/ChineseSimplified/DefInjected/CustomMapDataDef/Map_InsectCave.xml b/Source/任务框架范例/Languages/ChineseSimplified/DefInjected/CustomMapDataDef/Map_InsectCave.xml
deleted file mode 100644
index bbfd1518..00000000
--- a/Source/任务框架范例/Languages/ChineseSimplified/DefInjected/CustomMapDataDef/Map_InsectCave.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- 小型虫巢
-
-
\ No newline at end of file
diff --git a/Source/任务框架范例/Languages/ChineseSimplified/DefInjected/HediffDef/InsectPart.xml b/Source/任务框架范例/Languages/ChineseSimplified/DefInjected/HediffDef/InsectPart.xml
deleted file mode 100644
index 6e8467be..00000000
--- a/Source/任务框架范例/Languages/ChineseSimplified/DefInjected/HediffDef/InsectPart.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- 虫族外骨骼
- 虫族外骨骼
- 这家伙的身体被部分虫化了,一具虫族的外骨骼生长在这家伙的躯干上。
-
- 复眼
- 复眼
- 这家伙的身体被部分虫化了,现在Ta的“眼睛”会更加敏锐。
-
-
\ No newline at end of file
diff --git a/Source/任务框架范例/Languages/ChineseSimplified/DefInjected/QuestScriptDef/Script_InsectCave.xml b/Source/任务框架范例/Languages/ChineseSimplified/DefInjected/QuestScriptDef/Script_InsectCave.xml
deleted file mode 100644
index 3e038d6a..00000000
--- a/Source/任务框架范例/Languages/ChineseSimplified/DefInjected/QuestScriptDef/Script_InsectCave.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
questDescription->你在附近发现了一个小型虫族巢穴。
-
-
-
-
questName -> 小型[Adj]巢穴
-
-
\ No newline at end of file
diff --git a/Source/任务框架范例/Languages/ChineseSimplified/Keyed/Key.xml b/Source/任务框架范例/Languages/ChineseSimplified/Keyed/Key.xml
deleted file mode 100644
index aa0afba1..00000000
--- a/Source/任务框架范例/Languages/ChineseSimplified/Keyed/Key.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- 搜刮。
- 哇哦,看来你幸运地搜刮到了死在这里的人留下的宝藏。
-
- 一个人从尸骸中浮现出来。
- 与尸骸中的“幸存者”的交谈
- 你在尸骸中搜刮到了一个“人类”,值得注意的是你留意到了{Interviewee_possessive}身上的虫族特征。
- 你是什么人?
- “我是{Interviewee_nameDef},我在一次虫潮中被虫群所俘获,老实说我也不知道为什么它们唯独没有杀我,我醒来后身体就成这样了。我现在无处可去,请让我加入你们”
- 欢迎
- 一定是新型虫族!必须歼灭!
-
-
-
-
\ No newline at end of file
diff --git a/Source/任务框架范例/Languages/English/Keyed/Key_Survivor.xml b/Source/任务框架范例/Languages/English/Keyed/Key_Survivor.xml
deleted file mode 100644
index 45750116..00000000
--- a/Source/任务框架范例/Languages/English/Keyed/Key_Survivor.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- Plunder
-
- Wow, it seems you were lucky enough to find some treasure left by the people who died here.
-
- A person emerged from the corpse.
- Talk with the 'Survivor'
- You found a "human" in the corpse and you can't help but notice insect characteristics on {Interviewee_objective}.
- Who are you?
- "I am {Interviewee_nameDef}. I was captured by a swarm of insects during a wave. To be honest, I don't know why they only didn't kill me. When I woke up, my body was like this. I've got nowhere to go now, please let me join you."
- Welcome
- It must be a new type of Insect! It must be annihilated!
-
-
-
\ No newline at end of file