diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index 2b7aef0..b4ef638 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/Assemblies/ArachnaeSwarm.pdb b/1.6/1.6/Assemblies/ArachnaeSwarm.pdb index f9c8775..39f8378 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.pdb and b/1.6/1.6/Assemblies/ArachnaeSwarm.pdb differ diff --git a/Source/ArachnaeSwarm/Flyover/ARA_FlyOverDropPod/CompProperties_FlyOverDropPod.cs b/Source/ArachnaeSwarm/Flyover/ARA_FlyOverDropPod/CompProperties_FlyOverDropPod.cs index 9a03c51..282e36f 100644 --- a/Source/ArachnaeSwarm/Flyover/ARA_FlyOverDropPod/CompProperties_FlyOverDropPod.cs +++ b/Source/ArachnaeSwarm/Flyover/ARA_FlyOverDropPod/CompProperties_FlyOverDropPod.cs @@ -231,12 +231,14 @@ namespace ArachnaeSwarm { Faction faction = Find.FactionManager.FirstFactionOfDef(Props.pawnFactionDef); if (faction != null) return faction; + ArachnaeLog.Debug($"[WARN] FactionDef '{Props.pawnFactionDef.defName}' not found in current world, trying fallback"); } // 使用 Comp 的派系 if (Props.faction != null) return Props.faction; - // 使用默认中立派系 + // 使用默认中立派系(记录警告以便排查配置问题) + ArachnaeLog.Debug("[WARN] No valid faction resolved for pawn generation, falling back to Faction.OfAncients"); return Faction.OfAncients; } @@ -521,8 +523,11 @@ namespace ArachnaeSwarm if (Props.dropAllInSamePod) { - // 所有物品在一个空投仓中,但生成多个相同的空投仓 - for (int i = 0; i < Props.dropCount; i++) + // 第一个空投仓使用原始物品(包含 Pawn) + podGroups.Add(new List(thingsToDrop)); + + // 后续空投仓仅复制非 Pawn 物品,避免 Pawn 重复生成 + for (int i = 1; i < Props.dropCount; i++) { List podItems = CreatePodItemsCopy(thingsToDrop); podGroups.Add(podItems); @@ -570,36 +575,30 @@ namespace ArachnaeSwarm } } - // 创建物品的深拷贝 + // 创建非 Pawn 物品的深拷贝(Pawn 是唯一实体,不可复制) private List CreatePodItemsCopy(List originalItems) { List copies = new List(); foreach (Thing original in originalItems) { - if (original is Pawn originalPawn) + // Pawn 是唯一实体,不能复制;Pawn 只在第一个空投仓中投掷 + if (original is Pawn) { - // 对于 Pawn,重新生成 - Pawn newPawn = GeneratePawn(originalPawn.kindDef); - if (newPawn != null) - { - copies.Add(newPawn); - } + continue; } - else + + // 对于物品,创建副本 + Thing copy = ThingMaker.MakeThing(original.def, original.Stuff); + copy.stackCount = original.stackCount; + + // 复制其他重要属性 + if (original.def.useHitPoints) { - // 对于物品,创建副本 - Thing copy = ThingMaker.MakeThing(original.def, original.Stuff); - copy.stackCount = original.stackCount; - - // 复制其他重要属性 - if (original.def.useHitPoints) - { - copy.HitPoints = original.HitPoints; - } - - copies.Add(copy); + copy.HitPoints = original.HitPoints; } + + copies.Add(copy); } return copies; @@ -607,6 +606,12 @@ namespace ArachnaeSwarm private IntVec3 GetDropCenter(FlyOver flyOver) { + // 如果使用贸易空投点,直接使用原版方法(已包含位置验证) + if (Props.useTradeDropSpot) + { + return DropCellFinder.TradeDropSpot(flyOver.Map); + } + // 计算投掷中心位置(基于当前飞行位置 + 偏移) Vector3 currentPos = Vector3.Lerp( flyOver.startPosition.ToVector3(), @@ -615,11 +620,17 @@ namespace ArachnaeSwarm ); IntVec3 dropCenter = currentPos.ToIntVec3() + Props.dropOffset; + Map map = flyOver.Map; - // 如果使用贸易空投点,找到贸易空投点 - if (Props.useTradeDropSpot) + // 边界验证:确保投掷中心在地图范围内 + if (!dropCenter.InBounds(map)) { - dropCenter = DropCellFinder.TradeDropSpot(flyOver.Map); + dropCenter = new IntVec3( + Mathf.Clamp(dropCenter.x, 0, map.Size.x - 1), + 0, + Mathf.Clamp(dropCenter.z, 0, map.Size.z - 1) + ); + ArachnaeLog.Debug($"Drop center out of bounds, clamped to {dropCenter}"); } return dropCenter;