This commit is contained in:
2026-03-27 17:27:59 +08:00
parent 0603c60bde
commit 3e161378c7
11 changed files with 142 additions and 70 deletions

View File

@@ -2,16 +2,24 @@
"Version": 1,
"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\\abilities\\ara_fanshapedstunknockback\\safer_pawnflyer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_fanshapedstunknockback\\safer_pawnflyer.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\\abilities\\ara_fanshapedstunknockback\\compproperties_abilityfanshapedstunknockback.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:abilities\\ara_fanshapedstunknockback\\compproperties_abilityfanshapedstunknockback.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\\hediffs\\ara_gestaltnode\\compgestalt.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:hediffs\\ara_gestaltnode\\compgestalt.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\\hediffs\\ara_hivemind\\hediff_hivemindmaster.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\\hediffs\\ara_hivemind\\hediff_hivemindmaster.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:hediffs\\ara_hivemind\\hediff_hivemindmaster.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\\arachnaelog.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\\arachnaelog.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{EAE0DB6B-E282-C812-7F5A-6D13E9D24581}|ArachnaeSwarm.csproj|solutionrelative:arachnaelog.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
@@ -22,28 +30,54 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "CompProperties_AbilityFanShapedStunKnockback.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_FanShapedStunKnockback\\CompProperties_AbilityFanShapedStunKnockback.cs",
"RelativeDocumentMoniker": "Abilities\\ARA_FanShapedStunKnockback\\CompProperties_AbilityFanShapedStunKnockback.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_FanShapedStunKnockback\\CompProperties_AbilityFanShapedStunKnockback.cs",
"RelativeToolTip": "Abilities\\ARA_FanShapedStunKnockback\\CompProperties_AbilityFanShapedStunKnockback.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAMAAAAXAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2026-03-27T07:30:03.977Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Safer_PawnFlyer.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_FanShapedStunKnockback\\Safer_PawnFlyer.cs",
"RelativeDocumentMoniker": "Abilities\\ARA_FanShapedStunKnockback\\Safer_PawnFlyer.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Abilities\\ARA_FanShapedStunKnockback\\Safer_PawnFlyer.cs",
"RelativeToolTip": "Abilities\\ARA_FanShapedStunKnockback\\Safer_PawnFlyer.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAAJAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2026-03-27T07:30:02.935Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "CompGestalt.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Hediffs\\ARA_GestaltNode\\CompGestalt.cs",
"RelativeDocumentMoniker": "Hediffs\\ARA_GestaltNode\\CompGestalt.cs",
"ToolTip": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Hediffs\\ARA_GestaltNode\\CompGestalt.cs",
"RelativeToolTip": "Hediffs\\ARA_GestaltNode\\CompGestalt.cs",
"ViewState": "AgIAAEQAAAAAAAAAAAAUwF0AAAAAAAAAAAAAAA==",
"ViewState": "AgIAAEIAAAAAAAAAAAAQwD0AAABCAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2026-03-27T03:57:27.664Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 3,
"Title": "Hediff_HiveMindMaster.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\Hediffs\\ARA_HiveMind\\Hediff_HiveMindMaster.cs",
"RelativeDocumentMoniker": "Hediffs\\ARA_HiveMind\\Hediff_HiveMindMaster.cs",
@@ -51,12 +85,11 @@
"RelativeToolTip": "Hediffs\\ARA_HiveMind\\Hediff_HiveMindMaster.cs",
"ViewState": "AgIAADQAAAAAAAAAAAAuwFkAAAAuAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2026-03-27T03:54:02.567Z",
"EditorCaption": ""
"WhenOpened": "2026-03-27T03:54:02.567Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"DocumentIndex": 4,
"Title": "ArachnaeLog.cs",
"DocumentMoniker": "D:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\ArachnaeSwarm\\Source\\ArachnaeSwarm\\ArachnaeLog.cs",
"RelativeDocumentMoniker": "ArachnaeLog.cs",
@@ -64,8 +97,7 @@
"RelativeToolTip": "ArachnaeLog.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABAAAAANAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2026-03-26T06:10:50.583Z",
"EditorCaption": ""
"WhenOpened": "2026-03-26T06:10:50.583Z"
}
]
}

View File

@@ -0,0 +1,39 @@
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
using Verse.AI;
using Verse.Sound;
namespace ArachnaeSwarm
{
public class SaferPawnFlyer : PawnFlyer
{
// 重写TickInterval增加空值检查
protected override void TickInterval(int delta)
{
// 如果FlyingThing为空直接销毁并返回
if (FlyingThing == null || FlyingThing.Destroyed)
{
Destroy();
return;
}
base.TickInterval(delta);
}
// 重写RespawnPawn增加空值检查
protected override void RespawnPawn()
{
// 如果FlyingThing为空直接销毁并返回
if (FlyingThing == null || FlyingThing.Destroyed)
{
Destroy();
return;
}
// 调用基类方法
base.RespawnPawn();
}
}
}

View File

@@ -36,6 +36,7 @@
<ItemGroup>
<Compile Include="Abilities\ARA_FanShapedStunKnockback\CompAbilityEffect_FanShapedStunKnockback.cs" />
<Compile Include="Abilities\ARA_FanShapedStunKnockback\CompProperties_AbilityFanShapedStunKnockback.cs" />
<Compile Include="Abilities\ARA_FanShapedStunKnockback\Safer_PawnFlyer.cs" />
<Compile Include="Abilities\ARA_HediffBlacklist\CompAbilityEffect_HediffBlacklist.cs" />
<Compile Include="Abilities\ARA_HediffBlacklist\CompProperties_AbilityHediffBlacklist.cs" />
<Compile Include="Abilities\ARA_HediffGacha\CompAbilityEffect_HediffGacha.cs" />

View File

@@ -59,6 +59,7 @@ namespace ArachnaeSwarm
Pawn hiveNode = relation.otherPawn;
if (hiveNode != null && hiveNode.IsGestaltNode(GestaltNodeType.HiveNode))
{
ForceMasterCultureToDrone(hiveNode, pawn);
if (tracker.GetControlGroup(hiveNode) == null)
{
@@ -98,13 +99,13 @@ namespace ArachnaeSwarm
/// <summary>
/// 强制将主节点的文化赋予无人机
/// </summary>
private void ForceMasterCultureToDrone(Pawn drone)
private void ForceMasterCultureToDrone(Pawn drone,Pawn master)
{
// 检查是否有意识形态系统Ideology DLC
if (ModsConfig.IdeologyActive)
{
// 获取主节点的意识形态
Ideo masterIdeo = this.pawn.Ideo;
Ideo masterIdeo = master.Ideo;
if (masterIdeo != null)
{
@@ -115,13 +116,6 @@ namespace ArachnaeSwarm
ArachnaeLog.Debug($"[ArachnaeSwarm] Set drone {drone.LabelShort} ideology to master's ideology: {masterIdeo.name}");
}
}
else
{
ArachnaeLog.Debug($"[ArachnaeSwarm] Master {this.pawn.LabelShort} has no ideology to assign to drone {drone.LabelShort}");
}
// 强制同步文化相关记忆和状态
SyncCulturalMemories(drone);
}
else
{
@@ -129,50 +123,6 @@ namespace ArachnaeSwarm
}
}
/// <summary>
/// 同步文化相关记忆和状态
/// </summary>
private void SyncCulturalMemories(Pawn drone)
{
try
{
// 清除可能存在的文化冲突记忆
if (drone.needs?.mood != null)
{
// 移除与文化转换相关的负面想法
var thoughtsToRemove = drone.needs.mood.thoughts.memories.Memories
.Where(thought => thought.def.defName.Contains("Cultural") ||
thought.def.defName.Contains("Ideo") ||
thought.def.defName.Contains("Convert"))
.ToList();
foreach (var thought in thoughtsToRemove)
{
drone.needs.mood.thoughts.memories.RemoveMemory(thought);
}
if (thoughtsToRemove.Count > 0)
{
ArachnaeLog.Debug($"[ArachnaeSwarm] Removed {thoughtsToRemove.Count} cultural conflict thoughts from drone {drone.LabelShort}");
}
// 添加蜂群文化适应的正面想法
ThoughtDef culturalHarmonyThought = DefDatabase<ThoughtDef>.GetNamedSilentFail("ARA_CulturalHarmony");
if (culturalHarmonyThought != null)
{
drone.needs.mood.thoughts.memories.TryGainMemory(culturalHarmonyThought);
}
}
// 同步服装和文化偏好
ArachnaeLog.Debug($"[ArachnaeSwarm] Successfully synchronized cultural memories for drone {drone.LabelShort}");
}
catch (System.Exception ex)
{
ArachnaeLog.Debug($"[ArachnaeSwarm] Error synchronizing cultural memories for drone {drone.LabelShort}: {ex.Message}");
}
}
public override void PostExposeData()
{
base.PostExposeData();