diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll
index e5afa35..df3ad42 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/BodyAndPartDefs/ARA_Bodyparts.xml b/1.6/1.6/Defs/BodyAndPartDefs/ARA_Bodyparts.xml
index e439998..325657e 100644
--- a/1.6/1.6/Defs/BodyAndPartDefs/ARA_Bodyparts.xml
+++ b/1.6/1.6/Defs/BodyAndPartDefs/ARA_Bodyparts.xml
@@ -708,7 +708,6 @@
126
-
ArachnaeMyrmecocystus_Body
@@ -1053,6 +1052,7 @@
ARA_Chitin_Shell
+ 尾部甲片
0.01
Outside
@@ -1313,6 +1313,16 @@
+
+
+ ARA_Chitin_Shell
+ 肩部甲片
+ 0.02
+ Outside
+
+ Shoulders
+
+
Shoulder
左肩
@@ -1381,6 +1391,16 @@
Waist
+
+
+ ARA_Chitin_Shell
+ 下肢甲片
+ 0.02
+ Outside
+
+ Legs
+
+
Leg
左腿
@@ -1392,15 +1412,6 @@
LeftLeg
true
-
-
- ARA_Chitin_Shell
- 0.12
- Outside
-
- Legs
-
-
Foot
左足
@@ -1422,15 +1433,6 @@
RightLeg
-
-
- ARA_Chitin_Shell
- 0.12
- Outside
-
- Legs
-
-
Foot
右足
diff --git a/1.6/1.6/Defs/HediffDefs/ARA_Hediffs_HiveMind.xml b/1.6/1.6/Defs/HediffDefs/ARA_Hediffs_HiveMind.xml
index 0ecd05f..0f0052a 100644
--- a/1.6/1.6/Defs/HediffDefs/ARA_Hediffs_HiveMind.xml
+++ b/1.6/1.6/Defs/HediffDefs/ARA_Hediffs_HiveMind.xml
@@ -106,6 +106,30 @@
+
+ ARA_HiveStrength_Low
+
+ 阿拉克涅虫族的伤势修复能力相当强大,它们能从各种致命打击中快速恢复。
+ HediffWithComps
+ (0.6, 0.4, 0.8)
+ false
+ false
+
+
+
+
+ 0
+ 20
+
+
+
+
+
+ ARA_Cycle_Suppression_Hediff
+
+
+
+
ARA_TemperatureRegulation
diff --git a/1.6/1.6/Defs/RecipeDefs/ARA_Recipes.xml b/1.6/1.6/Defs/RecipeDefs/ARA_Recipes.xml
index 7793eae..75f25a8 100644
--- a/1.6/1.6/Defs/RecipeDefs/ARA_Recipes.xml
+++ b/1.6/1.6/Defs/RecipeDefs/ARA_Recipes.xml
@@ -14,7 +14,7 @@
5
-
+
Medicine
@@ -108,7 +108,7 @@
- stomach
+ Stomach
@@ -136,4 +136,45 @@
+
+
+ ARA_Surgery_Install_Cycle_Suppression
+
+ 诱发阿拉克涅虫族的定向变异,使其不再受到寿命的制约,得以存活更久。但是注入生命周期抑制素后,虫族将失去其自愈能力。
+
+ ARA_Cycle_Suppression_Hediff
+
+ 正在实施定向变异
+
+
+
+
+ ARA_Activated_Bacterium
+
+
+ 6
+
+
+
+ Brain
+
+
+
+ ARA_Activated_Bacterium
+
+
+ ARA_Cycle_Suppression_Hediff
+
+
+ ARA_Cycle_Suppression_Hediff
+
+ Hediff_Implant
+ 为阿拉克涅虫族的生命周期抑制素阻止了虫族自身的无序生长,以延长其寿命。
+
+ ARA_Surgery_Install_Cycle_Suppression
+
+
+ true
+
+
\ No newline at end of file
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 e61cbef..663b245 100644
--- a/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml
+++ b/1.6/1.6/Defs/ThingDef_Races/ARA_RaceNodeSwarm.xml
@@ -617,6 +617,7 @@
ARA_Surgery_Install_Plasteel
ARA_Surgery_Install_Huge_Stomach
+ ARA_Surgery_Install_Cycle_Suppression
@@ -781,8 +782,9 @@
CocoonDestroyed
-
- 14400000
+
+ ARA_Cycle_Suppression_Hediff
+ 120
寿命
阿拉克涅的督虫们生命如精密的发条般运转着。
true
@@ -917,8 +919,9 @@
CocoonDestroyed
-
- 7200000
+
+ ARA_Cycle_Suppression_Hediff
+ 60
寿命
阿拉克涅的督虫们生命如精密的发条般运转着。
true
@@ -1016,8 +1019,9 @@
CocoonDestroyed
-
- 7200000
+
+ ARA_Cycle_Suppression_Hediff
+ 60
寿命
阿拉克涅的督虫们生命如精密的发条般运转着。
true
@@ -1109,8 +1113,9 @@
-
- 7200000
+
+ ARA_Cycle_Suppression_Hediff
+ 60
寿命
阿拉克涅的督虫们生命如精密的发条般运转着。
true
@@ -1278,8 +1283,9 @@
CocoonDestroyed
-
- 14400000
+
+ ARA_Cycle_Suppression_Hediff
+ 120
寿命
阿拉克涅的督虫们生命如精密的发条般运转着。
true
@@ -1366,8 +1372,9 @@
ARA_FlyEast
ARA_FlySouth
-
- 7200000
+
+ ARA_Cycle_Suppression_Hediff
+ 60
寿命
阿拉克涅的督虫们生命如精密的发条般运转着。
true
diff --git a/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/.suo b/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/.suo
index 3d71dc9..8534389 100644
Binary files a/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/.suo and b/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/.suo differ
diff --git a/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/DocumentLayout.json b/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/DocumentLayout.json
index 505e3c1..28775af 100644
--- a/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/DocumentLayout.json
+++ b/Source/ArachnaeSwarm/.vs/ArachnaeSwarm/v17/DocumentLayout.json
@@ -1,7 +1,28 @@
{
"Version": 1,
- "WorkspaceRootPath": "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\",
- "Documents": [],
+ "WorkspaceRootPath": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\",
+ "Documents": [
+ {
+ "AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\pawn_comps\\ara_nodeswarmlifetime\\compnodeswarmlifetime.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
+ "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:pawn_comps\\ara_nodeswarmlifetime\\compnodeswarmlifetime.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
+ },
+ {
+ "AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\pawn_comps\\ara_nodeswarmlifetime\\compproperties_nodeswarmlifetime.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
+ "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:pawn_comps\\ara_nodeswarmlifetime\\compproperties_nodeswarmlifetime.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
+ },
+ {
+ "AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\pawn_comps\\ara_givehediffsinrangetorace\\hediffcomp_givehediffsinrangetorace.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
+ "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:pawn_comps\\ara_givehediffsinrangetorace\\hediffcomp_givehediffsinrangetorace.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
+ },
+ {
+ "AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\pawn_comps\\ara_fighter_invisible\\compfighterinvisible.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
+ "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:pawn_comps\\ara_fighter_invisible\\compfighterinvisible.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
+ },
+ {
+ "AbsoluteMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|d:\\steamlibrary\\steamapps\\common\\rimworld\\mods\\arachnaeswarm\\source\\arachnaeswarm\\pawn_comps\\ara_fighter_invisible\\compproperties_fighterinvisible.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
+ "RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:pawn_comps\\ara_fighter_invisible\\compproperties_fighterinvisible.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
+ }
+ ],
"DocumentGroupContainers": [
{
"Orientation": 0,
@@ -9,11 +30,76 @@
"DocumentGroups": [
{
"DockedWidth": 200,
- "SelectedChildIndex": -1,
+ "SelectedChildIndex": 5,
"Children": [
+ {
+ "$type": "Document",
+ "DocumentIndex": 2,
+ "Title": "HediffComp_GiveHediffsInRangeToRace.cs",
+ "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_GiveHediffsInRangeToRace\\HediffComp_GiveHediffsInRangeToRace.cs",
+ "RelativeDocumentMoniker": "Pawn_Comps\\ARA_GiveHediffsInRangeToRace\\HediffComp_GiveHediffsInRangeToRace.cs",
+ "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_GiveHediffsInRangeToRace\\HediffComp_GiveHediffsInRangeToRace.cs",
+ "RelativeToolTip": "Pawn_Comps\\ARA_GiveHediffsInRangeToRace\\HediffComp_GiveHediffsInRangeToRace.cs",
+ "ViewState": "AgIAAAAAAAAAAAAAAAAAABEAAAAXAAAAAAAAAA==",
+ "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
+ "WhenOpened": "2025-09-25T03:08:41.128Z",
+ "EditorCaption": ""
+ },
+ {
+ "$type": "Document",
+ "DocumentIndex": 3,
+ "Title": "CompFighterInvisible.cs",
+ "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_Fighter_Invisible\\CompFighterInvisible.cs",
+ "RelativeDocumentMoniker": "Pawn_Comps\\ARA_Fighter_Invisible\\CompFighterInvisible.cs",
+ "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_Fighter_Invisible\\CompFighterInvisible.cs",
+ "RelativeToolTip": "Pawn_Comps\\ARA_Fighter_Invisible\\CompFighterInvisible.cs",
+ "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
+ "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
+ "WhenOpened": "2025-09-25T03:08:39.152Z",
+ "EditorCaption": ""
+ },
+ {
+ "$type": "Document",
+ "DocumentIndex": 4,
+ "Title": "CompProperties_FighterInvisible.cs",
+ "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_Fighter_Invisible\\CompProperties_FighterInvisible.cs",
+ "RelativeDocumentMoniker": "Pawn_Comps\\ARA_Fighter_Invisible\\CompProperties_FighterInvisible.cs",
+ "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_Fighter_Invisible\\CompProperties_FighterInvisible.cs",
+ "RelativeToolTip": "Pawn_Comps\\ARA_Fighter_Invisible\\CompProperties_FighterInvisible.cs",
+ "ViewState": "AgIAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAA==",
+ "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
+ "WhenOpened": "2025-09-25T03:06:36.76Z",
+ "EditorCaption": ""
+ },
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
+ },
+ {
+ "$type": "Document",
+ "DocumentIndex": 1,
+ "Title": "CompProperties_NodeSwarmLifetime.cs",
+ "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_NodeSwarmLifetime\\CompProperties_NodeSwarmLifetime.cs",
+ "RelativeDocumentMoniker": "Pawn_Comps\\ARA_NodeSwarmLifetime\\CompProperties_NodeSwarmLifetime.cs",
+ "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_NodeSwarmLifetime\\CompProperties_NodeSwarmLifetime.cs",
+ "RelativeToolTip": "Pawn_Comps\\ARA_NodeSwarmLifetime\\CompProperties_NodeSwarmLifetime.cs",
+ "ViewState": "AgIAAAAAAAAAAAAAAAAAAB8AAAABAAAAAAAAAA==",
+ "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
+ "WhenOpened": "2025-09-25T02:13:12.615Z",
+ "EditorCaption": ""
+ },
+ {
+ "$type": "Document",
+ "DocumentIndex": 0,
+ "Title": "CompNodeSwarmLifetime.cs",
+ "DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_NodeSwarmLifetime\\CompNodeSwarmLifetime.cs",
+ "RelativeDocumentMoniker": "Pawn_Comps\\ARA_NodeSwarmLifetime\\CompNodeSwarmLifetime.cs",
+ "ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Pawn_Comps\\ARA_NodeSwarmLifetime\\CompNodeSwarmLifetime.cs",
+ "RelativeToolTip": "Pawn_Comps\\ARA_NodeSwarmLifetime\\CompNodeSwarmLifetime.cs",
+ "ViewState": "AgIAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAA==",
+ "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
+ "WhenOpened": "2025-09-25T02:13:09.974Z",
+ "EditorCaption": ""
}
]
}
diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
index ee6a3d3..be72e18 100644
--- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
+++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj
@@ -174,6 +174,8 @@
+
+
diff --git a/Source/ArachnaeSwarm/Pawn_Comps/ARA_NodeSwarmLifetime/CompNodeSwarmLifetime.cs b/Source/ArachnaeSwarm/Pawn_Comps/ARA_NodeSwarmLifetime/CompNodeSwarmLifetime.cs
new file mode 100644
index 0000000..d777355
--- /dev/null
+++ b/Source/ArachnaeSwarm/Pawn_Comps/ARA_NodeSwarmLifetime/CompNodeSwarmLifetime.cs
@@ -0,0 +1,244 @@
+// Assembly-CSharp, Version=1.6.9371.18214, Culture=neutral, PublicKeyToken=null
+// RimWorld.CompNodeSwarmLifetime
+using RimWorld;
+using System.Collections.Generic;
+using UnityEngine;
+using Verse;
+
+namespace ArachnaeSwarm
+{
+ public class CompNodeSwarmLifetime : ThingComp
+ {
+ private int powerTicksLeft;
+
+ public bool depleted;
+
+ private NodeSwarmLifetimeGizmo gizmo;
+
+ // 添加:检查是否有特定 Hediff 的缓存字段
+ private bool? hasShutdownHediffCached;
+ private int lastHediffCheckTick;
+
+ public CompProperties_NodeSwarmLifetime Props => (CompProperties_NodeSwarmLifetime)props;
+
+ // 修改:将 ticks 转换为天数计算
+ public float PercentFull => (float)powerTicksLeft / (float)(Props.lifetimeDays * 60000);
+
+ public int PowerTicksLeft => powerTicksLeft;
+
+ // 添加:获取剩余天数
+ public float DaysLeft => (float)powerTicksLeft / 60000f;
+
+ // 添加:获取总天数
+ public float TotalDays => Props.lifetimeDays;
+
+ // 添加:检查是否有关闭系统的 Hediff
+ public bool HasShutdownHediff
+ {
+ get
+ {
+ // 每 300 tick 检查一次,避免性能问题
+ if (hasShutdownHediffCached == null || Find.TickManager.TicksGame > lastHediffCheckTick + 300)
+ {
+ hasShutdownHediffCached = CheckForShutdownHediff();
+ lastHediffCheckTick = Find.TickManager.TicksGame;
+ }
+ return hasShutdownHediffCached.Value;
+ }
+ }
+
+ // 添加:实际的 Hediff 检查逻辑
+ private bool CheckForShutdownHediff()
+ {
+ Pawn pawn = parent as Pawn;
+ if (pawn == null) return false;
+
+ // 使用 Props 中定义的 immuteHediff
+ if (Props.immuteHediff == null) return false;
+
+ return pawn.health.hediffSet.HasHediff(Props.immuteHediff);
+ }
+
+ public override void PostSpawnSetup(bool respawningAfterLoad)
+ {
+ if (!ModLister.CheckBiotechOrAnomalyOrOdyssey("Node swarm lifetime"))
+ {
+ parent.Destroy();
+ return;
+ }
+ base.PostSpawnSetup(respawningAfterLoad);
+ if (!respawningAfterLoad && !parent.BeingTransportedOnGravship)
+ {
+ // 修改:使用天数转换为 ticks
+ powerTicksLeft = (int)(Props.lifetimeDays * 60000);
+ }
+
+ // 初始化 Hediff 检查缓存
+ hasShutdownHediffCached = null;
+ lastHediffCheckTick = Find.TickManager.TicksGame;
+ }
+
+ public override IEnumerable CompGetGizmosExtra()
+ {
+ // 添加:如果有关闭 Hediff,不显示任何 Gizmo
+ if (HasShutdownHediff)
+ {
+ yield break;
+ }
+
+ if (parent.Faction != Faction.OfPlayer && !Props.showGizmoOnNonPlayerControlled)
+ {
+ yield break;
+ }
+ if (Find.Selector.SingleSelectedThing == parent)
+ {
+ if (gizmo == null)
+ {
+ gizmo = new NodeSwarmLifetimeGizmo(this)
+ {
+ Order = -100f
+ };
+ }
+ yield return gizmo;
+ }
+ if (DebugSettings.ShowDevGizmos)
+ {
+ yield return new Command_Action
+ {
+ defaultLabel = "DEV: Power left 0%",
+ action = delegate
+ {
+ powerTicksLeft = 0;
+ }
+ };
+ yield return new Command_Action
+ {
+ defaultLabel = "DEV: Power left 100%",
+ action = delegate
+ {
+ powerTicksLeft = (int)(Props.lifetimeDays * 60000);
+ }
+ };
+ }
+ }
+
+ public override void CompTick()
+ {
+ base.CompTick();
+
+ // 添加:如果有关闭 Hediff,停止所有 Tick 逻辑
+ if (HasShutdownHediff)
+ {
+ return;
+ }
+
+ if (depleted)
+ {
+ return;
+ }
+ powerTicksLeft--;
+ if (powerTicksLeft <= 0)
+ {
+ if (Props.killWhenDepleted)
+ {
+ KillPowerProcessor();
+ return;
+ }
+ powerTicksLeft = 0;
+ depleted = true;
+ }
+ }
+
+ private void KillPowerProcessor()
+ {
+ Pawn pawn = (Pawn)parent;
+ List allParts = pawn.def.race.body.AllParts;
+ for (int i = 0; i < allParts.Count; i++)
+ {
+ BodyPartRecord bodyPartRecord = allParts[i];
+ if (bodyPartRecord.def.tags.Contains(BodyPartTagDefOf.BloodPumpingSource))
+ {
+ pawn.health.AddHediff(HediffDefOf.MissingBodyPart, bodyPartRecord);
+ }
+ }
+ if (!pawn.Dead)
+ {
+ pawn.Kill(null, null);
+ }
+ }
+
+ public override void PostExposeData()
+ {
+ base.PostExposeData();
+ Scribe_Values.Look(ref powerTicksLeft, "powerTicksLeft", 0);
+ Scribe_Values.Look(ref depleted, "depleted", defaultValue: false);
+
+ // 添加:保存时重置缓存
+ if (Scribe.mode == LoadSaveMode.PostLoadInit)
+ {
+ hasShutdownHediffCached = null;
+ lastHediffCheckTick = Find.TickManager.TicksGame;
+
+ // 添加:额外的安全检查
+ // 如果读档后 powerTicksLeft 异常,重置为满值
+ if (powerTicksLeft <= 0 && !depleted)
+ {
+ powerTicksLeft = (int)(Props.lifetimeDays * 60000);
+ }
+ }
+ }
+ }
+
+ [StaticConstructorOnStartup]
+ public class NodeSwarmLifetimeGizmo : Gizmo
+ {
+ private CompNodeSwarmLifetime powerCell;
+
+ private const float Width = 160f;
+
+ private static readonly Texture2D BarTex = SolidColorMaterials.NewSolidColorTexture(new Color32(12, 45, 45, byte.MaxValue));
+
+ private static readonly Texture2D EmptyBarTex = SolidColorMaterials.NewSolidColorTexture(GenUI.FillableBar_Empty);
+
+ public NodeSwarmLifetimeGizmo(CompNodeSwarmLifetime carrier)
+ {
+ powerCell = carrier;
+ }
+
+ public override float GetWidth(float maxWidth)
+ {
+ return 160f;
+ }
+
+ public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth, GizmoRenderParms parms)
+ {
+ Rect rect = new Rect(topLeft.x, topLeft.y, GetWidth(maxWidth), 75f);
+ Rect rect2 = rect.ContractedBy(10f);
+ Widgets.DrawWindowBackground(rect);
+ string text = (powerCell.Props.labelOverride.NullOrEmpty() ? ((string)"NodeSwarmLifetime".Translate()) : powerCell.Props.labelOverride);
+ Rect rect3 = new Rect(rect2.x, rect2.y, rect2.width, Text.CalcHeight(text, rect2.width) + 8f);
+ Text.Font = GameFont.Small;
+ Widgets.Label(rect3, text);
+ Rect barRect = new Rect(rect2.x, rect3.yMax, rect2.width, rect2.height - rect3.height);
+ Widgets.FillableBar(barRect, powerCell.PercentFull, BarTex, EmptyBarTex, doBorder: true);
+
+ // 移除了刻度线绘制代码
+
+ Text.Anchor = TextAnchor.MiddleCenter;
+ // 修改:显示天数而不是小时
+ Widgets.Label(barRect, powerCell.DaysLeft.ToString("F1") + "LetterDay".Translate());
+ Text.Anchor = TextAnchor.UpperLeft;
+ string tooltip;
+ if (!powerCell.Props.tooltipOverride.NullOrEmpty())
+ {
+ tooltip = powerCell.Props.tooltipOverride;
+ }
+ else
+ {
+ tooltip = "NodeSwarmLifetimeTip".Translate();
+ }
+ TooltipHandler.TipRegion(rect2, () => tooltip, Gen.HashCombineInt(powerCell.GetHashCode(), 34242369));
+ return new GizmoResult(GizmoState.Clear);
+ }
+ }
+}
diff --git a/Source/ArachnaeSwarm/Pawn_Comps/ARA_NodeSwarmLifetime/CompProperties_NodeSwarmLifetime.cs b/Source/ArachnaeSwarm/Pawn_Comps/ARA_NodeSwarmLifetime/CompProperties_NodeSwarmLifetime.cs
new file mode 100644
index 0000000..9660ae9
--- /dev/null
+++ b/Source/ArachnaeSwarm/Pawn_Comps/ARA_NodeSwarmLifetime/CompProperties_NodeSwarmLifetime.cs
@@ -0,0 +1,32 @@
+// Assembly-CSharp, Version=1.6.9371.18214, Culture=neutral, PublicKeyToken=null
+// RimWorld.CompProperties_NodeSwarmLifetime
+using ArachnaeSwarm;
+using RimWorld;
+using Verse;
+
+namespace ArachnaeSwarm
+{
+ public class CompProperties_NodeSwarmLifetime : CompProperties
+ {
+ // ģʹ ticks
+ public float lifetimeDays = 10f;
+
+ //ʱɱ
+ public bool killWhenDepleted = true;
+ //رϵͳhediff
+ public HediffDef immuteHediff;
+ //ǷڷҿƵpawnʾؿؼ
+ public bool showGizmoOnNonPlayerControlled;
+
+ [MustTranslate]
+ public string labelOverride;
+
+ [MustTranslate]
+ public string tooltipOverride;
+
+ public CompProperties_NodeSwarmLifetime()
+ {
+ compClass = typeof(CompNodeSwarmLifetime);
+ }
+ }
+}
\ No newline at end of file