diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll
index 3559f7a..9aac5af 100644
Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ
diff --git a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceBaseSwarm.xml b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceBaseSwarm.xml
index a958794..1859908 100644
--- a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceBaseSwarm.xml
+++ b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceBaseSwarm.xml
@@ -21,6 +21,19 @@
ARA_PlantCutting
+
+
+
+ ARA_Sowing
+ Growing
+
+
+ ARA_PlantCutting
+ PlantCutting
+
+
+
+
diff --git a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml
index 26169ce..803da3a 100644
--- a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml
+++ b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml
@@ -508,7 +508,7 @@
9999
- Spelopede
+ ArachnaeBase_Race_Scavenger
3
6000
diff --git a/1.6/1.6/Defs/ThinkTreeDefs/ARA_ThinkTrees.xml b/1.6/1.6/Defs/ThinkTreeDefs/ARA_ThinkTrees.xml
index 8523c7a..8f310ad 100644
--- a/1.6/1.6/Defs/ThinkTreeDefs/ARA_ThinkTrees.xml
+++ b/1.6/1.6/Defs/ThinkTreeDefs/ARA_ThinkTrees.xml
@@ -5,9 +5,10 @@
ARA_Insect_WithPlanting
-
+
+
true
@@ -101,34 +102,6 @@
Insect_PreMain
-
-
-
-
- TrainedAnimalBehavior
-
-
- Growing
-
-
-
-
-
-
-
-
-
-
- TrainedAnimalBehavior
-
-
- PlantCutting
-
-
-
-
-
-
true
@@ -230,7 +203,7 @@
RestingForMedicalReasons
-
+
@@ -258,8 +231,10 @@
SatisfyBasicNeeds
+
+
@@ -360,6 +335,31 @@
Insect_PreWander
+
+
+
+
+ TrainedAnimalBehavior
+
+
+
+
+
+
+
+
+
+
+
+
+ TrainedAnimalBehavior
+
+
+
+
+
+
+
@@ -388,7 +388,7 @@
0.1
-
+
None
120~240
500
@@ -568,4 +568,394 @@
- HighPriority
\ No newline at end of file
+ HighPriority
+
+
+ LordDuty
+
+
+
+
+
+
+ Humanlike_PostDuty
+
+
+
+
+ 2.5
+
+
+
+ ARA_InteractiveEggSac
+
+
+
+
+
+
+ ARA_InteractiveEggSac
+
+ true
+
+
+
+
+
+ true
+
+
+
+ true
+
+
+
+ Idle
+
+
+ Deadly
+
+
+
+
+
+
+ Escaping
+
+
+
+
+
+
+
+
+
+
+
+ Misc
+
+
+ Walk
+
+
+
+
+
+
+
+ RestingForMedicalReasons
+
+
+
+
+
+
+ ChangingApparel
+
+
+
+
+
+
+ SatisfyingNeeds
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ Escaping
+
+
+
+
+
+
+
+
+ Idle
+
+
+ Deadly
+
+
+
+
+
+
+
+ Idle
+
+
+ Deadly
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+ SatisfyingNeeds
+
+
+ true
+
+
+
+
+
+
+
+
+ Misc
+
+
+
+
+
+
+
+ MediumPriority
+
+
+ LordDuty
+
+
+
+
+
+
+ true
+
+
+
+
+ ChangingApparel
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TakeForInventoryStock
+
+
+ true
+
+
+
+
+
+
+ UnloadingOwnInventory
+
+
+
+
+
+
+
+ Food
+ 0.6
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+ Humanlike_PreMain
+
+
+
+
+
+
+ MainColonistBehaviorCore
+ true
+
+
+
+
+
+ WildMan
+
+
+ MainWildManBehaviorCore
+ true
+
+
+
+
+
+
+ Humanlike_PostMain
+
+
+
+
+
+
+ Idle
+
+
+
+ Joy
+ 0.9
+ true
+
+
+
+
+
+
+
+ None
+
+
+
+
+
+
+
+
+ WildMan
+
+
+ Idle
+
+
+
+ Deadly
+ 120~240
+
+
+
+
+
+
+
+
+
+
+
+
+ RestingForMedicalReasons
+
+
+
+
+
+
+ Misc
+
+
+ Walk
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ Misc
+
+
+ Walk
+
+
+
+
+
+
+
+
+ Idle
+
+
+ Deadly
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
index 3cbdda3..7fc9efb 100644
--- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
+++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
@@ -96,6 +96,8 @@
+
+
diff --git a/Source/ArachnaeSwarm/CompAnimalWorkSettings.cs b/Source/ArachnaeSwarm/CompAnimalWorkSettings.cs
new file mode 100644
index 0000000..758e74c
--- /dev/null
+++ b/Source/ArachnaeSwarm/CompAnimalWorkSettings.cs
@@ -0,0 +1,49 @@
+using System.Collections.Generic;
+using Verse;
+using RimWorld;
+
+namespace ArachnaeSwarm
+{
+ public class CompAnimalWorkSettings : ThingComp
+ {
+ public CompProperties_AnimalWorkSettings Props => (CompProperties_AnimalWorkSettings)this.props;
+
+ public override void PostSpawnSetup(bool respawningAfterLoad)
+ {
+ base.PostSpawnSetup(respawningAfterLoad);
+
+ Pawn pawn = this.parent as Pawn;
+ if (pawn == null) return;
+
+ // 关键:如果 pawn 没有 workSettings,则为其创建一个
+ if (pawn.workSettings == null)
+ {
+ // Log.Message($"Initializing Pawn_WorkSettings for animal: {pawn.LabelShort}");
+ pawn.workSettings = new Pawn_WorkSettings(pawn);
+ pawn.workSettings.EnableAndInitializeIfNotAlreadyInitialized();
+
+ // 注意:Pawn_WorkSettings 的构造函数和 EnableAndInitializeIfNotAlreadyInitialized()
+ // 通常会处理所有可用的 WorkTypeDef,并将它们的优先级初始化为 0。
+ // 这正是我们想要的初始状态。具体的优先级将由其他逻辑(如你的 CompInstantTrain 或 ThinkNode)来设置。
+ }
+
+ // 设置工作优先级
+ if (pawn.workSettings != null)
+ {
+ foreach (var entry in Props.workTypeMap)
+ {
+ TrainableDef trainable = entry.trainable;
+ WorkTypeDef workType = entry.workType;
+
+ // 检查动物是否学会了对应的 Trainable
+ if (pawn.training != null && pawn.training.HasLearned(trainable))
+ {
+ // 设置一个默认的非零优先级,例如 3 (Medium)
+ // 真正的"开关"由 ThinkNode_Conditional 的 GetWanted 控制
+ pawn.workSettings.SetPriority(workType, 3);
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/ArachnaeSwarm/CompInstantTrain.cs b/Source/ArachnaeSwarm/CompInstantTrain.cs
index cec6bde..c7c95e8 100644
--- a/Source/ArachnaeSwarm/CompInstantTrain.cs
+++ b/Source/ArachnaeSwarm/CompInstantTrain.cs
@@ -4,7 +4,6 @@ using RimWorld;
namespace ArachnaeSwarm
{
- // 定义在 XML 中使用的属性
public class CompProperties_InstantTrain : CompProperties
{
public List trainables = new List();
@@ -15,19 +14,15 @@ namespace ArachnaeSwarm
}
}
- // 实现组件的逻辑
public class CompInstantTrain : ThingComp
{
- // 方便地访问属性
public CompProperties_InstantTrain Props => (CompProperties_InstantTrain)this.props;
- // 在 Pawn 生成到地图上后被调用
public override void PostSpawnSetup(bool respawningAfterLoad)
{
base.PostSpawnSetup(respawningAfterLoad);
- // 如果不是在加载存档时重生,则执行训练逻辑
- if (!respawningAfterLoad)
+ if (!respawningAfterLoad) // 只在初次生成时执行
{
Pawn pawn = this.parent as Pawn;
if (pawn == null || pawn.training == null)
@@ -35,13 +30,11 @@ namespace ArachnaeSwarm
return;
}
- // 遍历在 XML 中定义的需要训练的技能列表
+ // 瞬间训练技能
foreach (TrainableDef trainableDef in Props.trainables)
{
- // 检查 Pawn 是否还未学会此技能
if (!pawn.training.HasLearned(trainableDef))
{
- // 调用原版方法,瞬间完成训练
pawn.training.Train(trainableDef, null, true);
}
}
diff --git a/Source/ArachnaeSwarm/CompProperties_AnimalWorkSettings.cs b/Source/ArachnaeSwarm/CompProperties_AnimalWorkSettings.cs
new file mode 100644
index 0000000..a53c0ea
--- /dev/null
+++ b/Source/ArachnaeSwarm/CompProperties_AnimalWorkSettings.cs
@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+using Verse;
+using RimWorld;
+
+namespace ArachnaeSwarm
+{
+ public class CompProperties_AnimalWorkSettings : CompProperties
+ {
+ // 使用列表存储键值对,因为RimWorld的XML解析器对字典有特殊要求
+ public List workTypeMap = new List();
+
+ // 可以在这里添加一些配置选项,比如默认优先级等,但现在简单起见,可以留空或只做基本初始化
+ public CompProperties_AnimalWorkSettings()
+ {
+ this.compClass = typeof(CompAnimalWorkSettings);
+ }
+ }
+
+ // 定义键值对的结构
+ public class WorkTypeMapEntry
+ {
+ public TrainableDef trainable;
+ public WorkTypeDef workType;
+ }
+}
\ No newline at end of file