diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index cb33305..1126929 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ diff --git a/Source/ArachnaeSwarm/Abilities/ARA_Genestealer/CompAbilityEffect_InjectGenes.cs b/Source/ArachnaeSwarm/Abilities/ARA_Genestealer/CompAbilityEffect_InjectGenes.cs index 3933bc6..77dc399 100644 --- a/Source/ArachnaeSwarm/Abilities/ARA_Genestealer/CompAbilityEffect_InjectGenes.cs +++ b/Source/ArachnaeSwarm/Abilities/ARA_Genestealer/CompAbilityEffect_InjectGenes.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using System.Linq; @@ -133,7 +133,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"Error transferring gene {geneDef.defName}: {ex}"); + ArachnaeLog.Debug($"Error transferring gene {geneDef.defName}: {ex}"); } } } @@ -152,7 +152,7 @@ namespace ArachnaeSwarm if (Prefs.DevMode) { - Log.Message($"Gene injection: {caster.Label} transferred {transferredGenes.Count} genes to {target.Label}"); + ArachnaeLog.Debug($"Gene injection: {caster.Label} transferred {transferredGenes.Count} genes to {target.Label}"); } } else diff --git a/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/CompAbilityEffect_Possess.cs b/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/CompAbilityEffect_Possess.cs index fdbfbb1..054f289 100644 --- a/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/CompAbilityEffect_Possess.cs +++ b/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/CompAbilityEffect_Possess.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using RimWorld.Planet; using Verse; using UnityEngine; @@ -44,12 +44,12 @@ namespace ArachnaeSwarm // 新增:检查目标是否无法行动(倒地) if (target.Pawn != null && IsTargetImmobilized(target.Pawn)) { - Log.Message($"[夺舍] 目标 {target.Pawn.LabelShort} 无法行动,直接执行夺舍"); + ArachnaeLog.Debug($"[夺舍] 目标 {target.Pawn.LabelShort} 无法行动,直接执行夺舍"); DoPossession(this.parent.pawn, target.Pawn); } else { - Log.Message($"[夺舍] 目标可以行动,执行标准夺舍流程"); + ArachnaeLog.Debug($"[夺舍] 目标可以行动,执行标准夺舍流程"); DoPossession(this.parent.pawn, target.Pawn); } } @@ -62,14 +62,14 @@ namespace ArachnaeSwarm // 检查是否倒地 if (target.Downed) { - Log.Message($"[夺舍] 目标 {target.LabelShort} 处于倒地状态"); + ArachnaeLog.Debug($"[夺舍] 目标 {target.LabelShort} 处于倒地状态"); return true; } // 检查是否无法移动 if (!target.health.capacities.CapableOf(PawnCapacityDefOf.Moving)) { - Log.Message($"[夺舍] 目标 {target.LabelShort} 无法移动"); + ArachnaeLog.Debug($"[夺舍] 目标 {target.LabelShort} 无法移动"); return true; } @@ -78,14 +78,14 @@ namespace ArachnaeSwarm target.health.hediffSet.HasHediff(HediffDefOf.CryptosleepSickness) || target.health.hediffSet.HasHediff(HediffDefOf.FoodPoisoning)) { - Log.Message($"[夺舍] 目标 {target.LabelShort} 有严重的移动障碍"); + ArachnaeLog.Debug($"[夺舍] 目标 {target.LabelShort} 有严重的移动障碍"); return true; } // 检查是否被束缚或囚禁 if (target.IsPrisoner || target.HostFaction != null) { - Log.Message($"[夺舍] 目标 {target.LabelShort} 被囚禁或束缚"); + ArachnaeLog.Debug($"[夺舍] 目标 {target.LabelShort} 被囚禁或束缚"); return true; } @@ -98,7 +98,7 @@ namespace ArachnaeSwarm // 如果目标无法行动,100%成功率 if (IsTargetImmobilized(targetPawn)) { - Log.Message($"[夺舍] 目标 {targetPawn.LabelShort} 无法行动,寄生成功率: 100%"); + ArachnaeLog.Debug($"[夺舍] 目标 {targetPawn.LabelShort} 无法行动,寄生成功率: 100%"); return 1f; } @@ -107,7 +107,7 @@ namespace ArachnaeSwarm float bonusFromDamage = damageDealt * Props.successChanceBonusPerDamage; float finalChance = Mathf.Clamp01(baseChance + bonusFromDamage); - Log.Message($"[夺舍] 目标 {targetPawn.LabelShort} 可以行动,寄生成功率: {finalChance:P0} (基础: {baseChance:P0}, 伤害加成: {bonusFromDamage:P0})"); + ArachnaeLog.Debug($"[夺舍] 目标 {targetPawn.LabelShort} 可以行动,寄生成功率: {finalChance:P0} (基础: {baseChance:P0}, 伤害加成: {bonusFromDamage:P0})"); return finalChance; } @@ -115,12 +115,12 @@ namespace ArachnaeSwarm { if (targetPawn == null || caster == null) return; - Log.Message($"[夺舍] 开始执行。施法者: {caster.LabelShort}, 目标: {targetPawn.LabelShort}"); + ArachnaeLog.Debug($"[夺舍] 开始执行。施法者: {caster.LabelShort}, 目标: {targetPawn.LabelShort}"); // 1. 捕获原宿主的完整数据,用于死亡后恢复尸体 OriginalPawnData originalHostData = new OriginalPawnData(); originalHostData.CaptureData(targetPawn); - Log.Message($"[夺舍] 已捕获原始宿主 {targetPawn.LabelShort} 的完整数据。"); + ArachnaeLog.Debug($"[夺舍] 已捕获原始宿主 {targetPawn.LabelShort} 的完整数据。"); // 2. 备份原宿主的技能,用于后续合并 var originalTargetSkills = new Dictionary(); @@ -141,7 +141,7 @@ namespace ArachnaeSwarm // 4. 将抱脸虫存入Hediff if (hediff.casterContainer.TryAdd(originalCaster, true)) { - Log.Message($"[夺舍] 成功将 {caster.LabelShort} 的原始副本存入Hediff。"); + ArachnaeLog.Debug($"[夺舍] 成功将 {caster.LabelShort} 的原始副本存入Hediff。"); // 5. 灵魂转移,此时 targetPawn 的技能被 caster 的技能覆盖 PawnDataUtility.TransferSoul(caster, targetPawn); @@ -155,7 +155,7 @@ namespace ArachnaeSwarm // 6. 技能合并:在灵魂转移后,直接在最终的身体 (targetPawn) 上进行合并 if (targetPawn.skills != null) { - Log.Message("[夺舍] 开始合并技能..."); + ArachnaeLog.Debug("[夺舍] 开始合并技能..."); foreach (var skillRecord in targetPawn.skills.skills) { if (originalTargetSkills.TryGetValue(skillRecord.def, out var originalSkill)) @@ -172,7 +172,7 @@ namespace ArachnaeSwarm } } } - Log.Message("[夺舍] 技能合并完成。"); + ArachnaeLog.Debug("[夺舍] 技能合并完成。"); } // 7. 将Hediff添加到最终身体上 @@ -181,13 +181,13 @@ namespace ArachnaeSwarm if (Props.hediffToApplyOnSuccess != null) { targetPawn.health.AddHediff(Props.hediffToApplyOnSuccess, null, null); - Log.Message($"[夺舍] 成功为 {targetPawn.LabelShort} 添加额外Hediff: {Props.hediffToApplyOnSuccess.defName}"); + ArachnaeLog.Debug($"[夺舍] 成功为 {targetPawn.LabelShort} 添加额外Hediff: {Props.hediffToApplyOnSuccess.defName}"); } - Log.Message($"[夺舍] {targetPawn.LabelShort} (原 {caster.LabelShort}) 夺舍完成。"); + ArachnaeLog.Debug($"[夺舍] {targetPawn.LabelShort} (原 {caster.LabelShort}) 夺舍完成。"); } else { - Log.Error($"[夺舍] 无法将 {caster.LabelShort} 的副本存入Hediff。中止操作。"); + ArachnaeLog.Debug($"[夺舍] 无法将 {caster.LabelShort} 的副本存入Hediff。中止操作。"); if(originalCaster != null && !originalCaster.Destroyed) originalCaster.Destroy(); } } @@ -200,7 +200,7 @@ namespace ArachnaeSwarm Verb bestMeleeVerb = caster.meleeVerbs.TryGetMeleeVerb(targetPawn); if (bestMeleeVerb == null) { - Log.Warning($"[Possess] Caster {caster.LabelShort} has no melee verb."); + ArachnaeLog.Debug($"[Possess] Caster {caster.LabelShort} has no melee verb."); return; } @@ -210,23 +210,23 @@ namespace ArachnaeSwarm var dinfo = new DamageInfo(damageDef, damageAmount, armorPenetration, -1, caster); DamageWorker.DamageResult damageResult = targetPawn.TakeDamage(dinfo); - Log.Message($"[Possess] Dealt {damageResult.totalDamageDealt} damage to {targetPawn.LabelShort} using {damageDef.defName}."); + ArachnaeLog.Debug($"[Possess] Dealt {damageResult.totalDamageDealt} damage to {targetPawn.LabelShort} using {damageDef.defName}."); if (damageResult.totalDamageDealt > 0) { // 修改:使用新的成功率计算方法 float finalChance = CalculateSuccessChance(targetPawn, damageResult.totalDamageDealt); - Log.Message($"[Possess] Final chance: {finalChance:P0}"); + ArachnaeLog.Debug($"[Possess] Final chance: {finalChance:P0}"); if (Rand.Chance(finalChance)) { - Log.Message($"[Possess] Success! Applying possession effect."); + ArachnaeLog.Debug($"[Possess] Success! Applying possession effect."); DoPossession(caster, targetPawn); } else { - Log.Message($"[Possess] Failed possession check."); + ArachnaeLog.Debug($"[Possess] Failed possession check."); } } } diff --git a/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/Hediff_Possession.cs b/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/Hediff_Possession.cs index 77c84d3..9211f4c 100644 --- a/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/Hediff_Possession.cs +++ b/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/Hediff_Possession.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using Verse; @@ -40,7 +40,7 @@ namespace ArachnaeSwarm if (originalHostData != null) { - Log.Message($"[夺舍结束] 正在将 {deadBody.LabelShort}'s 的灵魂恢复为原始宿主数据。"); + ArachnaeLog.Debug($"[夺舍结束] 正在将 {deadBody.LabelShort}'s 的灵魂恢复为原始宿主数据。"); originalHostData.RestoreData(deadBody); // 恢复数据后,移除可能存在的无人机Hediff @@ -48,12 +48,12 @@ namespace ArachnaeSwarm if (droneHediff != null) { deadBody.health.RemoveHediff(droneHediff); - Log.Message($"[夺舍结束] 已从 {deadBody.LabelShort} 的尸体上移除 ARA_HiveMindDrone Hediff。"); + ArachnaeLog.Debug($"[夺舍结束] 已从 {deadBody.LabelShort} 的尸体上移除 ARA_HiveMindDrone Hediff。"); } } else { - Log.Error("Possessed pawn died, but no original host data was found to restore."); + ArachnaeLog.Debug("Possessed pawn died, but no original host data was found to restore."); } if (storedCaster != null) @@ -62,7 +62,7 @@ namespace ArachnaeSwarm } else { - Log.Error("Possessed pawn died, but no caster soul was found inside."); + ArachnaeLog.Debug("Possessed pawn died, but no caster soul was found inside."); } } @@ -75,7 +75,7 @@ namespace ArachnaeSwarm Map map = this.pawn.MapHeld ?? Find.AnyPlayerHomeMap; if (map == null) { - Log.Error("[夺舍] 无法找到一个有效的地图来重生抱脸虫。"); + ArachnaeLog.Debug("[夺舍] 无法找到一个有效的地图来重生抱脸虫。"); return; } @@ -85,7 +85,7 @@ namespace ArachnaeSwarm cell = map.Center; } - Log.Message($"[夺舍] 准备在地图 {map.ToString()} 的位置 {cell.ToString()} 处重生 {StoredCasterPawn.LabelShort}。"); + ArachnaeLog.Debug($"[夺舍] 准备在地图 {map.ToString()} 的位置 {cell.ToString()} 处重生 {StoredCasterPawn.LabelShort}。"); this.casterContainer.TryDropAll(cell, map, ThingPlaceMode.Near); } diff --git a/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/PawnDataUtility.cs b/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/PawnDataUtility.cs index 5af51f0..0296d25 100644 --- a/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/PawnDataUtility.cs +++ b/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/PawnDataUtility.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using RimWorld; using Verse; @@ -11,14 +11,14 @@ namespace ArachnaeSwarm { if (soulSource == null || bodyTarget == null) { - Log.Error("Cannot transfer soul: source or target is null."); + ArachnaeLog.Debug("Cannot transfer soul: source or target is null."); return; } - Log.Message($"Beginning soul transfer from {soulSource.LabelShort} to {bodyTarget.LabelShort}."); + ArachnaeLog.Debug($"Beginning soul transfer from {soulSource.LabelShort} to {bodyTarget.LabelShort}."); bool isPossessing = soulSource.def.defName == "ARA_HuggingFace"; - Log.Message(isPossessing ? "[夺舍] 模式:抱脸虫 -> 宿主" : "[回归] 模式:宿主 -> 抱脸虫"); + ArachnaeLog.Debug(isPossessing ? "[夺舍] 模式:抱脸虫 -> 宿主" : "[回归] 模式:宿主 -> 抱脸虫"); // --- 1. Core Identity --- bodyTarget.Name = soulSource.Name; @@ -160,7 +160,7 @@ namespace ArachnaeSwarm // --- 5. Finalization --- bodyTarget.Drawer.renderer.SetAllGraphicsDirty(); - Log.Message("Soul transfer complete."); + ArachnaeLog.Debug("Soul transfer complete."); } } } \ No newline at end of file diff --git a/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/Verb_JumpAndCastOnLanding.cs b/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/Verb_JumpAndCastOnLanding.cs index 9ad7792..10bd05c 100644 --- a/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/Verb_JumpAndCastOnLanding.cs +++ b/Source/ArachnaeSwarm/Abilities/ARA_HuggingFace/Verb_JumpAndCastOnLanding.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using RimWorld.Utility; using UnityEngine; using Verse; @@ -14,7 +14,7 @@ namespace ArachnaeSwarm // 2. Capture the reliable target information early. public override bool TryStartCastOn(LocalTargetInfo castTarg, LocalTargetInfo destTarg, bool surpriseAttack = false, bool canHitNonTargetPawns = true, bool preventFriendlyFire = false, bool nonInterruptingSelfCast = false) { - Log.Message($"[Verb_JumpAndCastOnLanding] TryStartCastOn: Capturing our dedicated target: {castTarg.Thing?.LabelShort ?? "null"}."); + ArachnaeLog.Debug($"[Verb_JumpAndCastOnLanding] TryStartCastOn: Capturing our dedicated target: {castTarg.Thing?.LabelShort ?? "null"}."); this.capturedTarget = castTarg; return base.TryStartCastOn(castTarg, destTarg, surpriseAttack, canHitNonTargetPawns, preventFriendlyFire, nonInterruptingSelfCast); } @@ -50,11 +50,11 @@ namespace ArachnaeSwarm if (logicalTargetForUs == null || !logicalTargetForUs.HasThing) { - Log.Error($"[Verb_JumpAndCastOnLanding] TryCastShot: Our captured target is invalid!"); + ArachnaeLog.Debug($"[Verb_JumpAndCastOnLanding] TryCastShot: Our captured target is invalid!"); return false; } - Log.Message($"[Verb_JumpAndCastOnLanding] TryCastShot: Using our captured target '{logicalTargetForUs.Thing.LabelShort}' for logic, and letting game use '{physicalTarget.Cell}' for jump physics."); + ArachnaeLog.Debug($"[Verb_JumpAndCastOnLanding] TryCastShot: Using our captured target '{logicalTargetForUs.Thing.LabelShort}' for logic, and letting game use '{physicalTarget.Cell}' for jump physics."); bool jumpStarted = JumpUtility.DoJump( CasterPawn, diff --git a/Source/ArachnaeSwarm/Abilities/ARA_ShowInteractiveThing/CompAbilityEffect_ShowInteractiveThing.cs b/Source/ArachnaeSwarm/Abilities/ARA_ShowInteractiveThing/CompAbilityEffect_ShowInteractiveThing.cs index 6789039..d953112 100644 --- a/Source/ArachnaeSwarm/Abilities/ARA_ShowInteractiveThing/CompAbilityEffect_ShowInteractiveThing.cs +++ b/Source/ArachnaeSwarm/Abilities/ARA_ShowInteractiveThing/CompAbilityEffect_ShowInteractiveThing.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Text; using System.Collections.Generic; @@ -76,7 +76,7 @@ namespace ArachnaeSwarm if (Props.cocoonBuildingDef == null) { - Log.Error("CompAbilityEffect_ShowInteractiveThing: cocoonBuildingDef is null"); + ArachnaeLog.Debug("CompAbilityEffect_ShowInteractiveThing: cocoonBuildingDef is null"); return result; } diff --git a/Source/ArachnaeSwarm/Abilities/ARA_ShowSpawnablePawnsList/CompAbilityEffect_AbilityShowSpawnablePawns.cs b/Source/ArachnaeSwarm/Abilities/ARA_ShowSpawnablePawnsList/CompAbilityEffect_AbilityShowSpawnablePawns.cs index 7faa535..b875afc 100644 --- a/Source/ArachnaeSwarm/Abilities/ARA_ShowSpawnablePawnsList/CompAbilityEffect_AbilityShowSpawnablePawns.cs +++ b/Source/ArachnaeSwarm/Abilities/ARA_ShowSpawnablePawnsList/CompAbilityEffect_AbilityShowSpawnablePawns.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Text; using System.Collections.Generic; @@ -67,7 +67,7 @@ namespace ArachnaeSwarm { if (Props.spawnBuildingDef == null) { - Log.Error("CompProperties_AbilityShowSpawnablePawns: spawnBuildingDef is null"); + ArachnaeLog.Debug("CompProperties_AbilityShowSpawnablePawns: spawnBuildingDef is null"); return null; } @@ -80,7 +80,7 @@ namespace ArachnaeSwarm } } - Log.Warning($"CompProperties_AbilityShowSpawnablePawns: No spawn comp found on building {Props.spawnBuildingDef.defName}"); + ArachnaeLog.Debug($"CompProperties_AbilityShowSpawnablePawns: No spawn comp found on building {Props.spawnBuildingDef.defName}"); return null; } diff --git a/Source/ArachnaeSwarm/Abilities/ARA_ShowTemperatureRange/CompAbilityEffect_AbilityShowTemperatureRange.cs b/Source/ArachnaeSwarm/Abilities/ARA_ShowTemperatureRange/CompAbilityEffect_AbilityShowTemperatureRange.cs index e7c7bd0..0aa1338 100644 --- a/Source/ArachnaeSwarm/Abilities/ARA_ShowTemperatureRange/CompAbilityEffect_AbilityShowTemperatureRange.cs +++ b/Source/ArachnaeSwarm/Abilities/ARA_ShowTemperatureRange/CompAbilityEffect_AbilityShowTemperatureRange.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Text; using System.Collections.Generic; @@ -137,7 +137,7 @@ namespace ArachnaeSwarm { if (Props.temperatureCheckBuilding == null) { - Log.Error("CompProperties_AbilityShowTemperatureRange: temperatureCheckBuilding is null"); + ArachnaeLog.Debug("CompProperties_AbilityShowTemperatureRange: temperatureCheckBuilding is null"); return null; } @@ -150,7 +150,7 @@ namespace ArachnaeSwarm } } - Log.Warning($"CompProperties_AbilityShowTemperatureRange: No temperature comp found on building {Props.temperatureCheckBuilding.defName}"); + ArachnaeLog.Debug($"CompProperties_AbilityShowTemperatureRange: No temperature comp found on building {Props.temperatureCheckBuilding.defName}"); return null; } diff --git a/Source/ArachnaeSwarm/Abilities/TrackingCharge/PawnFlyer_TrackingCharge.cs b/Source/ArachnaeSwarm/Abilities/TrackingCharge/PawnFlyer_TrackingCharge.cs index e1767a8..d7bd908 100644 --- a/Source/ArachnaeSwarm/Abilities/TrackingCharge/PawnFlyer_TrackingCharge.cs +++ b/Source/ArachnaeSwarm/Abilities/TrackingCharge/PawnFlyer_TrackingCharge.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using UnityEngine; using Verse; using System.Reflection; @@ -65,7 +65,7 @@ namespace ArachnaeSwarm if (pawn.Spawned) pawn.DeSpawn(DestroyMode.WillReplace); if (!innerContainer.TryAdd(pawn)) { - Log.Error("Could not add pawn to tracking flyer."); + ArachnaeLog.Debug("Could not add pawn to tracking flyer."); pawn.Destroy(); } } diff --git a/Source/ArachnaeSwarm/Abilities/TrackingCharge/Verb_CastAbilityTrackingCharge.cs b/Source/ArachnaeSwarm/Abilities/TrackingCharge/Verb_CastAbilityTrackingCharge.cs index d4225f1..27af777 100644 --- a/Source/ArachnaeSwarm/Abilities/TrackingCharge/Verb_CastAbilityTrackingCharge.cs +++ b/Source/ArachnaeSwarm/Abilities/TrackingCharge/Verb_CastAbilityTrackingCharge.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Linq; @@ -11,13 +11,13 @@ namespace ArachnaeSwarm var props = this.ability.def.comps?.OfType().FirstOrDefault(); if (props == null) { - Log.Error("Verb_CastAbilityTrackingCharge requires CompProperties_TrackingCharge on the ability def."); + ArachnaeLog.Debug("Verb_CastAbilityTrackingCharge requires CompProperties_TrackingCharge on the ability def."); return false; } if (props.flyerDef == null) { - Log.Error("CompProperties_TrackingCharge requires a flyerDef."); + ArachnaeLog.Debug("CompProperties_TrackingCharge requires a flyerDef."); return false; } @@ -27,7 +27,7 @@ namespace ArachnaeSwarm Map map = this.Caster.Map; if (map == null) { - Log.Error($"Verb_CastAbilityTrackingCharge: Caster {this.Caster.LabelCap} has a null map. Cannot cast."); + ArachnaeLog.Debug($"Verb_CastAbilityTrackingCharge: Caster {this.Caster.LabelCap} has a null map. Cannot cast."); return false; } diff --git a/Source/ArachnaeSwarm/ArachnaeLog.cs b/Source/ArachnaeSwarm/ArachnaeLog.cs new file mode 100644 index 0000000..a6ef93e --- /dev/null +++ b/Source/ArachnaeSwarm/ArachnaeLog.cs @@ -0,0 +1,22 @@ +using Verse; + +namespace ArachnaeSwarm +{ + /// + /// Centralized debug logging controlled by mod settings. + /// Only shows when mod option is enabled, independent of DevMode. + /// + public static class ArachnaeLog + { + private static bool DebugEnabled => + ArachnaeSwarmMod.settings?.enableDebugLogs ?? false; + + public static void Debug(string message) + { + if (DebugEnabled) + { + Log.Message(message); + } + } + } +} diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj index 3d6fc9f..946bce8 100644 --- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj +++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj @@ -259,7 +259,9 @@ - + + + diff --git a/Source/ArachnaeSwarm/ArachnaeSwarmMod.cs b/Source/ArachnaeSwarm/ArachnaeSwarmMod.cs new file mode 100644 index 0000000..1e1380a --- /dev/null +++ b/Source/ArachnaeSwarm/ArachnaeSwarmMod.cs @@ -0,0 +1,40 @@ +using HarmonyLib; +using System.Reflection; +using UnityEngine; +using Verse; + +namespace ArachnaeSwarm +{ + [StaticConstructorOnStartup] + public class ArachnaeSwarmMod : Mod + { + public static ArachnaeSwarmSettings settings; + + public ArachnaeSwarmMod(ModContentPack content) : base(content) + { + settings = GetSettings(); + + // 初始化Harmony + var harmony = new Harmony("com.kalospacer.arachnaeswarm"); + harmony.PatchAll(Assembly.GetExecutingAssembly()); + + ArachnaeLog.Debug("[ArachnaeSwarm] Harmony patches applied."); + } + + public override void DoSettingsWindowContents(Rect inRect) + { + Listing_Standard listingStandard = new Listing_Standard(); + listingStandard.Begin(inRect); + + listingStandard.CheckboxLabeled("Enable Debug Logs".Translate(), ref settings.enableDebugLogs, "Enable detailed debug logging (independent of DevMode)".Translate()); + + listingStandard.End(); + base.DoSettingsWindowContents(inRect); + } + + public override string SettingsCategory() + { + return "Arachnae Swarm"; + } + } +} diff --git a/Source/ArachnaeSwarm/ArachnaeSwarmSettings.cs b/Source/ArachnaeSwarm/ArachnaeSwarmSettings.cs new file mode 100644 index 0000000..d0f7b4e --- /dev/null +++ b/Source/ArachnaeSwarm/ArachnaeSwarmSettings.cs @@ -0,0 +1,15 @@ +using Verse; + +namespace ArachnaeSwarm +{ + public class ArachnaeSwarmSettings : ModSettings + { + public bool enableDebugLogs = false; + + public override void ExposeData() + { + Scribe_Values.Look(ref enableDebugLogs, "enableDebugLogs", false); + base.ExposeData(); + } + } +} diff --git a/Source/ArachnaeSwarm/Building_Comps/ARA_Building_RefuelingVat/Building_RefuelingVat.cs b/Source/ArachnaeSwarm/Building_Comps/ARA_Building_RefuelingVat/Building_RefuelingVat.cs index 02b608c..80a4309 100644 --- a/Source/ArachnaeSwarm/Building_Comps/ARA_Building_RefuelingVat/Building_RefuelingVat.cs +++ b/Source/ArachnaeSwarm/Building_Comps/ARA_Building_RefuelingVat/Building_RefuelingVat.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System; using System.Collections.Generic; using System.Linq; @@ -163,7 +163,7 @@ namespace ArachnaeSwarm { if (selectedPawn != null && innerContainer.Contains(selectedPawn)) { - Log.Warning($"RefuelingVat despawned with pawn inside, forcing ejection."); + ArachnaeLog.Debug($"RefuelingVat despawned with pawn inside, forcing ejection."); Finish(); // 使用修改后的Finish方法 } } @@ -207,7 +207,7 @@ namespace ArachnaeSwarm } catch (Exception ex) { - Log.Error($"Error applying acid damage to {pawn}: {ex.Message}"); + ArachnaeLog.Debug($"Error applying acid damage to {pawn}: {ex.Message}"); } } @@ -222,7 +222,7 @@ namespace ArachnaeSwarm // 检查是否是被建筑杀死的 if (pawnsKilledByVat.Contains(pawn)) { - Log.Message($"Pawn {pawn.Label} killed by RefuelingVat, destroying corpse."); + ArachnaeLog.Debug($"Pawn {pawn.Label} killed by RefuelingVat, destroying corpse."); // 从容器中移除pawn if (innerContainer.Contains(pawn)) @@ -251,7 +251,7 @@ namespace ArachnaeSwarm } catch (Exception ex) { - Log.Error($"Error handling pawn death for {pawn}: {ex}"); + ArachnaeLog.Debug($"Error handling pawn death for {pawn}: {ex}"); } } @@ -426,7 +426,7 @@ namespace ArachnaeSwarm // 方法3:强制移除(仅对活着的pawn) if (!ejected && innerContainer.Contains(selectedPawn) && !selectedPawn.Dead) { - Log.Warning($"Forcing removal of pawn {selectedPawn} from RefuelingVat"); + ArachnaeLog.Debug($"Forcing removal of pawn {selectedPawn} from RefuelingVat"); innerContainer.Remove(selectedPawn); GenPlace.TryPlaceThing(selectedPawn, this.Position, base.Map, ThingPlaceMode.Near); ejected = true; @@ -435,16 +435,16 @@ namespace ArachnaeSwarm if (ejected) { - Log.Message($"Successfully ejected {selectedPawn} using method: {ejectionMethod}"); + ArachnaeLog.Debug($"Successfully ejected {selectedPawn} using method: {ejectionMethod}"); } else if (!selectedPawn.Dead) // 只有活着的pawn弹出失败才报错 { - Log.Error($"Failed to eject {selectedPawn} from RefuelingVat"); + ArachnaeLog.Debug($"Failed to eject {selectedPawn} from RefuelingVat"); } } catch (Exception ex) { - Log.Error($"Error during Finish() for {selectedPawn}: {ex}"); + ArachnaeLog.Debug($"Error during Finish() for {selectedPawn}: {ex}"); } finally { @@ -463,7 +463,7 @@ namespace ArachnaeSwarm // 确保pawn不在容器中(除非是被建筑杀死的) if (innerContainer.Contains(selectedPawn) && !(selectedPawn.Dead && pawnsKilledByVat.Contains(selectedPawn))) { - Log.Warning($"Pawn {selectedPawn} still in container during OnStop, forcing removal."); + ArachnaeLog.Debug($"Pawn {selectedPawn} still in container during OnStop, forcing removal."); innerContainer.Remove(selectedPawn); } } @@ -668,7 +668,7 @@ namespace ArachnaeSwarm JobDef carryJobDef = DefDatabase.GetNamed("ARA_CarryPrisonerToRefuelingVat"); if (carryJobDef == null) { - Log.Error("ARA_CarryPrisonerToRefuelingVat JobDef not found!"); + ArachnaeLog.Debug("ARA_CarryPrisonerToRefuelingVat JobDef not found!"); return null; } Job job = JobMaker.MakeJob(carryJobDef, prisoner, this); diff --git a/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompInteractiveProducer.cs b/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompInteractiveProducer.cs index 454d90c..c4719bf 100644 --- a/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompInteractiveProducer.cs +++ b/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompInteractiveProducer.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Text; using RimWorld; @@ -110,7 +110,7 @@ namespace ArachnaeSwarm { if (!InProduction || _selectedProcess == null) { - Log.Warning($"Attempted to fix negative time but no process is selected. Resetting production."); + ArachnaeLog.Debug($"Attempted to fix negative time but no process is selected. Resetting production."); ResetProduction(); return; } @@ -118,7 +118,7 @@ namespace ArachnaeSwarm int currentTicks = Find.TickManager.TicksGame; int remainingTicks = productionUntilTick - currentTicks; - Log.Warning($"Detected negative production time for {parent.Label}. " + + ArachnaeLog.Debug($"Detected negative production time for {parent.Label}. " + $"Current: {currentTicks}, Target: {productionUntilTick}, Remaining: {remainingTicks}. " + $"Process: {_selectedProcess.thingDef?.defName ?? "Unknown"}, Expected Duration: {_selectedProcess.productionTicks}"); @@ -128,7 +128,7 @@ namespace ArachnaeSwarm // 如果偏差太大,直接完成生产 if (remainingTicks < -_selectedProcess.productionTicks) { - Log.Warning($"Negative time too large ({remainingTicks} ticks). Forcing production completion."); + ArachnaeLog.Debug($"Negative time too large ({remainingTicks} ticks). Forcing production completion."); FinishProduction(); return; } @@ -137,7 +137,7 @@ namespace ArachnaeSwarm productionUntilTick = correctEndTick; hasFixedNegativeTime = true; - Log.Message($"Fixed negative production time for {parent.Label}. " + + ArachnaeLog.Debug($"Fixed negative production time for {parent.Label}. " + $"New target: {productionUntilTick}, New remaining: {_selectedProcess.productionTicks} ticks"); // 发送消息通知(开发模式) @@ -180,7 +180,7 @@ namespace ArachnaeSwarm // 新增:立即检查一次负时间问题 if (InProduction && HasNegativeTimeProblem) { - Log.Warning($"Detected negative production time on spawn for {parent.Label}"); + ArachnaeLog.Debug($"Detected negative production time on spawn for {parent.Label}"); FixNegativeTimeProblem(); } } @@ -215,7 +215,7 @@ namespace ArachnaeSwarm // 如果找不到对应的 ProcessDef,重置生产状态 if (_selectedProcess == null) { - Log.Warning($"Could not find ProcessDef for {selectedProcessThingDef.defName} after loading. Resetting production."); + ArachnaeLog.Debug($"Could not find ProcessDef for {selectedProcessThingDef.defName} after loading. Resetting production."); ResetProduction(); } // 关键修复:检查时间戳是否有效 @@ -224,19 +224,19 @@ namespace ArachnaeSwarm // 如果生产结束时间已经过去,立即完成生产 if (Find.TickManager.TicksGame >= productionUntilTick) { - Log.Warning($"Production time already passed for {selectedProcessThingDef.defName}. Finishing immediately."); + ArachnaeLog.Debug($"Production time already passed for {selectedProcessThingDef.defName}. Finishing immediately."); FinishProduction(); } // 如果时间戳异常(比如超过游戏当前时间太多),重新计算 else if (productionUntilTick - Find.TickManager.TicksGame > _selectedProcess.productionTicks * 10) { - Log.Warning($"Abnormal production time detected for {selectedProcessThingDef.defName}. Recalculating."); + ArachnaeLog.Debug($"Abnormal production time detected for {selectedProcessThingDef.defName}. Recalculating."); productionUntilTick = Find.TickManager.TicksGame + _selectedProcess.productionTicks; } // 新增:检查负时间问题 else if (HasNegativeTimeProblem) { - Log.Warning($"Negative production time detected on load for {selectedProcessThingDef.defName}. Fixing."); + ArachnaeLog.Debug($"Negative production time detected on load for {selectedProcessThingDef.defName}. Fixing."); FixNegativeTimeProblem(); } } @@ -351,7 +351,7 @@ namespace ArachnaeSwarm // 关键修复:添加时间戳有效性检查 if (productionUntilTick <= 0) { - Log.Error($"Invalid productionUntilTick: {productionUntilTick}. Resetting production."); + ArachnaeLog.Debug($"Invalid productionUntilTick: {productionUntilTick}. Resetting production."); ResetProduction(); return; } @@ -443,7 +443,7 @@ namespace ArachnaeSwarm // 新增:冷却期内不允许开始生产 if (InCooldown) { - Log.Warning("Attempted to start production during cooldown period."); + ArachnaeLog.Debug("Attempted to start production during cooldown period."); return; } @@ -489,7 +489,7 @@ namespace ArachnaeSwarm { if (_selectedProcess == null) { - Log.Warning("FinishProduction called but _selectedProcess is null. Resetting."); + ArachnaeLog.Debug("FinishProduction called but _selectedProcess is null. Resetting."); ResetProduction(); return; } @@ -520,7 +520,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"Error in FinishProduction: {ex.Message}"); + ArachnaeLog.Debug($"Error in FinishProduction: {ex.Message}"); } finally { @@ -557,7 +557,7 @@ namespace ArachnaeSwarm ThingDef fuelDef = FuelComp.Props.fuelFilter.AnyAllowedDef; if (fuelDef == null) { - Log.Warning("No fuel definition found for ejecting remaining fuel."); + ArachnaeLog.Debug("No fuel definition found for ejecting remaining fuel."); return; } // 计算可以生成的物品数量(1:1比例) diff --git a/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompQueuedInteractiveProducer.cs b/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompQueuedInteractiveProducer.cs index 021e7b5..3f266cd 100644 --- a/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompQueuedInteractiveProducer.cs +++ b/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompQueuedInteractiveProducer.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Linq; using System.Text; @@ -229,7 +229,7 @@ namespace ArachnaeSwarm { if (order.process == null) { - Log.Warning("FinishProduction called but order.process is null. Skipping."); + ArachnaeLog.Debug("FinishProduction called but order.process is null. Skipping."); return; } @@ -247,7 +247,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"Error in FinishProduction for {order.process.thingDef.defName}: {ex.Message}"); + ArachnaeLog.Debug($"Error in FinishProduction for {order.process.thingDef.defName}: {ex.Message}"); } } @@ -330,7 +330,7 @@ namespace ArachnaeSwarm { if (string.IsNullOrEmpty(order.tempThingDefName)) { - Log.Warning($"CompQueuedInteractiveProducer: Found a queued order with no thingDefName after loading. Removing it."); + ArachnaeLog.Debug($"CompQueuedInteractiveProducer: Found a queued order with no thingDefName after loading. Removing it."); return true; } @@ -338,7 +338,7 @@ namespace ArachnaeSwarm if (order.process == null) { - Log.Warning($"CompQueuedInteractiveProducer: Could not find a matching ProcessDef for '{order.tempThingDefName}' after loading. The item may have been removed. Removing order."); + ArachnaeLog.Debug($"CompQueuedInteractiveProducer: Could not find a matching ProcessDef for '{order.tempThingDefName}' after loading. The item may have been removed. Removing order."); return true; } diff --git a/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompResearchProducer.cs b/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompResearchProducer.cs index 2927af6..dd9cb58 100644 --- a/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompResearchProducer.cs +++ b/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/CompResearchProducer.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Text; using RimWorld; @@ -108,7 +108,7 @@ namespace ArachnaeSwarm { if (!InProduction || _selectedProcess == null) { - Log.Warning($"Attempted to fix negative time but no process is selected. Resetting production."); + ArachnaeLog.Debug($"Attempted to fix negative time but no process is selected. Resetting production."); ResetProduction(); return; } @@ -116,7 +116,7 @@ namespace ArachnaeSwarm int currentTicks = Find.TickManager.TicksGame; int remainingTicks = productionUntilTick - currentTicks; - Log.Warning($"Detected negative research production time for {parent.Label}. " + + ArachnaeLog.Debug($"Detected negative research production time for {parent.Label}. " + $"Current: {currentTicks}, Target: {productionUntilTick}, Remaining: {remainingTicks}. " + $"Research: {_selectedProcess.researchDef?.defName ?? "Unknown"}, Expected Duration: {_selectedProcess.productionTicks}"); @@ -126,7 +126,7 @@ namespace ArachnaeSwarm // 如果偏差太大,直接完成生产 if (remainingTicks < -_selectedProcess.productionTicks) { - Log.Warning($"Negative time too large ({remainingTicks} ticks). Forcing production completion."); + ArachnaeLog.Debug($"Negative time too large ({remainingTicks} ticks). Forcing production completion."); FinishProduction(); return; } @@ -135,7 +135,7 @@ namespace ArachnaeSwarm productionUntilTick = correctEndTick; hasFixedNegativeTime = true; - Log.Message($"Fixed negative research production time for {parent.Label}. " + + ArachnaeLog.Debug($"Fixed negative research production time for {parent.Label}. " + $"New target: {productionUntilTick}, New remaining: {_selectedProcess.productionTicks} ticks"); // 发送消息通知(开发模式) @@ -177,7 +177,7 @@ namespace ArachnaeSwarm // 新增:立即检查一次负时间问题 if (InProduction && HasNegativeTimeProblem) { - Log.Warning($"Detected negative research production time on spawn for {parent.Label}"); + ArachnaeLog.Debug($"Detected negative research production time on spawn for {parent.Label}"); FixNegativeTimeProblem(); } } @@ -207,25 +207,25 @@ namespace ArachnaeSwarm if (_selectedProcess == null) { - Log.Warning($"Could not find ResearchProcessDef for {selectedProcessResearchDef.defName} after loading. Resetting production."); + ArachnaeLog.Debug($"Could not find ResearchProcessDef for {selectedProcessResearchDef.defName} after loading. Resetting production."); ResetProduction(); } else if (productionUntilTick > 0) { if (Find.TickManager.TicksGame >= productionUntilTick) { - Log.Warning($"Production time already passed for {selectedProcessResearchDef.defName}. Finishing immediately."); + ArachnaeLog.Debug($"Production time already passed for {selectedProcessResearchDef.defName}. Finishing immediately."); FinishProduction(); } else if (productionUntilTick - Find.TickManager.TicksGame > _selectedProcess.productionTicks * 10) { - Log.Warning($"Abnormal production time detected for {selectedProcessResearchDef.defName}. Recalculating."); + ArachnaeLog.Debug($"Abnormal production time detected for {selectedProcessResearchDef.defName}. Recalculating."); productionUntilTick = Find.TickManager.TicksGame + _selectedProcess.productionTicks; } // 新增:检查负时间问题 else if (HasNegativeTimeProblem) { - Log.Warning($"Negative production time detected on load for {selectedProcessResearchDef.defName}. Fixing."); + ArachnaeLog.Debug($"Negative production time detected on load for {selectedProcessResearchDef.defName}. Fixing."); FixNegativeTimeProblem(); } } @@ -240,7 +240,7 @@ namespace ArachnaeSwarm ResearchTabDef araResearchTab = DefDatabase.GetNamedSilentFail("ARA_ResearchTab"); if (araResearchTab == null) { - Log.Warning("ARA_ResearchTab not found. No research processes will be available."); + ArachnaeLog.Debug("ARA_ResearchTab not found. No research processes will be available."); return; } int totalScanned = 0; @@ -286,7 +286,7 @@ namespace ArachnaeSwarm } else { - Log.Warning($"Techprint ThingDef not found for research project {researchDef.defName}. Expected defName: {techprintDefName}"); + ArachnaeLog.Debug($"Techprint ThingDef not found for research project {researchDef.defName}. Expected defName: {techprintDefName}"); } } } @@ -294,7 +294,7 @@ namespace ArachnaeSwarm // 按研究项目名称排序 _cachedProcesses.SortBy(p => p.researchDef.label); // 记录详细的扫描结果 - Log.Message($"Research production scanner: Scanned {totalScanned} research projects, " + + ArachnaeLog.Debug($"Research production scanner: Scanned {totalScanned} research projects, " + $"{araTabCount} in ARA_ResearchTab, " + $"{techprintCount} require techprints, " + $"{prerequisitesMetCount} have prerequisites met, " + @@ -339,7 +339,7 @@ namespace ArachnaeSwarm { if (productionUntilTick <= 0) { - Log.Error($"Invalid productionUntilTick: {productionUntilTick}. Resetting production."); + ArachnaeLog.Debug($"Invalid productionUntilTick: {productionUntilTick}. Resetting production."); ResetProduction(); return; } @@ -417,7 +417,7 @@ namespace ArachnaeSwarm { if (InCooldown) { - Log.Warning("Attempted to start production during cooldown period."); + ArachnaeLog.Debug("Attempted to start production during cooldown period."); return; } @@ -435,7 +435,7 @@ namespace ArachnaeSwarm { if (_selectedProcess == null) { - Log.Warning("FinishProduction called but _selectedProcess is null. Resetting."); + ArachnaeLog.Debug("FinishProduction called but _selectedProcess is null. Resetting."); ResetProduction(); return; } @@ -469,7 +469,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"Error in FinishProduction: {ex.Message}"); + ArachnaeLog.Debug($"Error in FinishProduction: {ex.Message}"); } finally { @@ -493,7 +493,7 @@ namespace ArachnaeSwarm ThingDef fuelDef = FuelComp.Props.fuelFilter.AnyAllowedDef; if (fuelDef == null) { - Log.Warning("No fuel definition found for ejecting remaining fuel."); + ArachnaeLog.Debug("No fuel definition found for ejecting remaining fuel."); return; } diff --git a/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/JobDriver_StartResearchProduction.cs b/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/JobDriver_StartResearchProduction.cs index 8f23870..c88d726 100644 --- a/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/JobDriver_StartResearchProduction.cs +++ b/Source/ArachnaeSwarm/Building_Comps/ARA_CompInteractiveProducer/JobDriver_StartResearchProduction.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using Verse; using Verse.AI; @@ -36,7 +36,7 @@ namespace ArachnaeSwarm } else { - Log.Error($"CompResearchProducer not found on {Building.Label}"); + ArachnaeLog.Debug($"CompResearchProducer not found on {Building.Label}"); } }; work.defaultCompleteMode = ToilCompleteMode.Instant; diff --git a/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientVat/Building_NutrientVat.cs b/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientVat/Building_NutrientVat.cs index 0b47e52..e1b6796 100644 --- a/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientVat/Building_NutrientVat.cs +++ b/Source/ArachnaeSwarm/Building_Comps/ARA_NutrientVat/Building_NutrientVat.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System; using System.Collections.Generic; using System.Linq; @@ -107,7 +107,7 @@ namespace ArachnaeSwarm { if (selectedPawn != null && innerContainer.Contains(selectedPawn)) { - Log.Warning($"NutrientVat despawned with pawn inside, forcing ejection."); + ArachnaeLog.Debug($"NutrientVat despawned with pawn inside, forcing ejection."); Finish(); // 使用修改后的Finish方法 } } @@ -145,7 +145,7 @@ namespace ArachnaeSwarm } catch (Exception ex) { - Log.Error($"Error applying acid damage to {pawn}: {ex.Message}"); + ArachnaeLog.Debug($"Error applying acid damage to {pawn}: {ex.Message}"); } } @@ -157,7 +157,7 @@ namespace ArachnaeSwarm // 检查是否是被建筑杀死的 if (pawnsKilledByVat.Contains(pawn)) { - Log.Message($"Pawn {pawn.Label} killed by NutrientVat, destroying corpse."); + ArachnaeLog.Debug($"Pawn {pawn.Label} killed by NutrientVat, destroying corpse."); // 从容器中移除pawn if (innerContainer.Contains(pawn)) @@ -187,7 +187,7 @@ namespace ArachnaeSwarm } catch (Exception ex) { - Log.Error($"Error handling pawn death for {pawn}: {ex}"); + ArachnaeLog.Debug($"Error handling pawn death for {pawn}: {ex}"); } } @@ -382,7 +382,7 @@ namespace ArachnaeSwarm // 方法3:强制移除(仅对活着的pawn) if (!ejected && innerContainer.Contains(selectedPawn) && !selectedPawn.Dead) { - Log.Warning($"Forcing removal of pawn {selectedPawn} from NutrientVat"); + ArachnaeLog.Debug($"Forcing removal of pawn {selectedPawn} from NutrientVat"); innerContainer.Remove(selectedPawn); GenPlace.TryPlaceThing(selectedPawn, this.Position, base.Map, ThingPlaceMode.Near); ejected = true; @@ -391,16 +391,16 @@ namespace ArachnaeSwarm if (ejected) { - Log.Message($"Successfully ejected {selectedPawn} using method: {ejectionMethod}"); + ArachnaeLog.Debug($"Successfully ejected {selectedPawn} using method: {ejectionMethod}"); } else if (!selectedPawn.Dead) // 只有活着的pawn弹出失败才报错 { - Log.Error($"Failed to eject {selectedPawn} from NutrientVat"); + ArachnaeLog.Debug($"Failed to eject {selectedPawn} from NutrientVat"); } } catch (Exception ex) { - Log.Error($"Error during Finish() for {selectedPawn}: {ex}"); + ArachnaeLog.Debug($"Error during Finish() for {selectedPawn}: {ex}"); } finally { @@ -449,7 +449,7 @@ namespace ArachnaeSwarm // 方法3:强制移除(仅对活着的pawn) if (!ejected && innerContainer.Contains(selectedPawn) && !selectedPawn.Dead) { - Log.Warning($"Forcing removal of failed pawn {selectedPawn} from NutrientVat"); + ArachnaeLog.Debug($"Forcing removal of failed pawn {selectedPawn} from NutrientVat"); innerContainer.Remove(selectedPawn); GenPlace.TryPlaceThing(selectedPawn, this.Position, base.Map, ThingPlaceMode.Near); ejected = true; @@ -458,14 +458,14 @@ namespace ArachnaeSwarm if (ejected) { - Log.Message($"Successfully ejected failed pawn {selectedPawn} using method: {ejectionMethod}"); + ArachnaeLog.Debug($"Successfully ejected failed pawn {selectedPawn} using method: {ejectionMethod}"); // 在成功弹出后杀死俘虏 Hediff firstHediffOfDef = selectedPawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.BioStarvation); selectedPawn.Kill(null, firstHediffOfDef); } else if (!selectedPawn.Dead) // 只有活着的pawn弹出失败才报错 { - Log.Error($"Failed to eject failed pawn {selectedPawn} from NutrientVat"); + ArachnaeLog.Debug($"Failed to eject failed pawn {selectedPawn} from NutrientVat"); // 即使弹出失败也要杀死俘虏 Hediff firstHediffOfDef = selectedPawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.BioStarvation); selectedPawn.Kill(null, firstHediffOfDef); @@ -473,7 +473,7 @@ namespace ArachnaeSwarm } catch (Exception ex) { - Log.Error($"Error during Fail() for {selectedPawn}: {ex}"); + ArachnaeLog.Debug($"Error during Fail() for {selectedPawn}: {ex}"); } finally { @@ -493,7 +493,7 @@ namespace ArachnaeSwarm // 确保pawn不在容器中(除非是被建筑杀死的) if (innerContainer.Contains(selectedPawn) && !(selectedPawn.Dead && pawnsKilledByVat.Contains(selectedPawn))) { - Log.Warning($"Pawn {selectedPawn} still in container during OnStop, forcing removal."); + ArachnaeLog.Debug($"Pawn {selectedPawn} still in container during OnStop, forcing removal."); innerContainer.Remove(selectedPawn); } } diff --git a/Source/ArachnaeSwarm/Building_Comps/ARA_SpawnPawnFromList/CompQueuedPawnSpawner.cs b/Source/ArachnaeSwarm/Building_Comps/ARA_SpawnPawnFromList/CompQueuedPawnSpawner.cs index ddd0d22..87d90b8 100644 --- a/Source/ArachnaeSwarm/Building_Comps/ARA_SpawnPawnFromList/CompQueuedPawnSpawner.cs +++ b/Source/ArachnaeSwarm/Building_Comps/ARA_SpawnPawnFromList/CompQueuedPawnSpawner.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Linq; using System.Text; @@ -73,7 +73,7 @@ namespace ArachnaeSwarm { if (selectedEntry == null) { - Log.Error("Tried to add to queue but selectedEntry was null."); + ArachnaeLog.Debug("Tried to add to queue but selectedEntry was null."); return; } productionOrders.Add(new QueuedProductionOrder { entry = selectedEntry }); diff --git a/Source/ArachnaeSwarm/Building_Comps/ARA_SpawnPawnFromList/CompSpawnPawnFromList.cs b/Source/ArachnaeSwarm/Building_Comps/ARA_SpawnPawnFromList/CompSpawnPawnFromList.cs index c6eec65..ab3d7d0 100644 --- a/Source/ArachnaeSwarm/Building_Comps/ARA_SpawnPawnFromList/CompSpawnPawnFromList.cs +++ b/Source/ArachnaeSwarm/Building_Comps/ARA_SpawnPawnFromList/CompSpawnPawnFromList.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Verse; using RimWorld; @@ -24,7 +24,7 @@ namespace ArachnaeSwarm { yield break; } - // ޸ֻе whitelist Ϊʱż + // �޸����ֻ�е� whitelist ��Ϊ��ʱ�ż������� if (Props.whitelist != null && Props.whitelist.Count > 0 && !Props.whitelist.Contains(selPawn.kindDef)) { yield break; @@ -75,13 +75,13 @@ namespace ArachnaeSwarm { if (pawnKind == null) { - Log.Warning("CompSpawnPawnFromList: Tried to spawn pawn but pawnKind is null."); + ArachnaeLog.Debug("CompSpawnPawnFromList: Tried to spawn pawn but pawnKind is null."); return; } if (!parent.Spawned || parent.Map == null) { - Log.Error($"CompSpawnPawnFromList: Cannot spawn pawn. Parent {parent} is not spawned or map is null."); + ArachnaeLog.Debug($"CompSpawnPawnFromList: Cannot spawn pawn. Parent {parent} is not spawned or map is null."); return; } @@ -91,13 +91,13 @@ namespace ArachnaeSwarm Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(pawnKind, parent.Faction)); if (pawn == null) { - Log.Error($"CompSpawnPawnFromList: Failed to generate pawn of kind {pawnKind.defName} for faction {parent.Faction?.Name ?? "null"}."); + ArachnaeLog.Debug($"CompSpawnPawnFromList: Failed to generate pawn of kind {pawnKind.defName} for faction {parent.Faction?.Name ?? "null"}."); continue; } if (GenSpawn.Spawn(pawn, parent.Position, parent.Map) == null) { - Log.Error($"CompSpawnPawnFromList: Failed to spawn pawn {pawn} at {parent.Position}."); + ArachnaeLog.Debug($"CompSpawnPawnFromList: Failed to spawn pawn {pawn} at {parent.Position}."); if (!pawn.Destroyed) { pawn.Destroy(); @@ -115,7 +115,7 @@ namespace ArachnaeSwarm } catch (System.Exception e) { - Log.Error($"CompSpawnPawnFromList: Error creating LordJob {Props.lordJob?.Name ?? "null"} or assigning pawn {pawn}. Exception: {e}"); + ArachnaeLog.Debug($"CompSpawnPawnFromList: Error creating LordJob {Props.lordJob?.Name ?? "null"} or assigning pawn {pawn}. Exception: {e}"); } } } diff --git a/Source/ArachnaeSwarm/Building_Comps/CompAutoEjector.cs b/Source/ArachnaeSwarm/Building_Comps/CompAutoEjector.cs index 8902e3f..e38b477 100644 --- a/Source/ArachnaeSwarm/Building_Comps/CompAutoEjector.cs +++ b/Source/ArachnaeSwarm/Building_Comps/CompAutoEjector.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using RimWorld; using Verse; @@ -38,7 +38,7 @@ namespace ArachnaeSwarm if (productStorageComp != null) { isMonitoringProductStorage = true; - Log.Message($"[ArachnaeSwarm] CompAutoEjector on {parent.def.defName} is monitoring CompProductStorage."); + ArachnaeLog.Debug($"[ArachnaeSwarm] CompAutoEjector on {parent.def.defName} is monitoring CompProductStorage."); return; } } @@ -49,12 +49,12 @@ namespace ArachnaeSwarm if (refuelableComp != null) { isMonitoringProductStorage = false; - Log.Message($"[ArachnaeSwarm] CompAutoEjector on {parent.def.defName} is monitoring CompRefuelable."); + ArachnaeLog.Debug($"[ArachnaeSwarm] CompAutoEjector on {parent.def.defName} is monitoring CompRefuelable."); return; } } - Log.Warning($"[ArachnaeSwarm] CompAutoEjector on {parent.def.defName} could not find any compatible storage component to monitor."); + ArachnaeLog.Debug($"[ArachnaeSwarm] CompAutoEjector on {parent.def.defName} could not find any compatible storage component to monitor."); } public override void CompTick() @@ -95,7 +95,7 @@ namespace ArachnaeSwarm if (thingDef == null) { - Log.Warning($"[ArachnaeSwarm] No allowed thing def found in fuel filter for {parent.def.defName}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] No allowed thing def found in fuel filter for {parent.def.defName}"); return; } @@ -125,7 +125,7 @@ namespace ArachnaeSwarm } } - Log.Message($"[ArachnaeSwarm] Ejected {actualAmount} {thingDef.label} from CompProductStorage."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Ejected {actualAmount} {thingDef.label} from CompProductStorage."); } } @@ -139,7 +139,7 @@ namespace ArachnaeSwarm if (thingDef == null) { - Log.Warning($"[ArachnaeSwarm] No allowed thing def found in fuel filter for {parent.def.defName}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] No allowed thing def found in fuel filter for {parent.def.defName}"); return; } @@ -174,7 +174,7 @@ namespace ArachnaeSwarm // 发送信号 parent.BroadcastCompSignal("RanOutOfFuel"); - Log.Message($"[ArachnaeSwarm] Ejected {currentFuel} {thingDef.label} from CompRefuelable."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Ejected {currentFuel} {thingDef.label} from CompRefuelable."); } } diff --git a/Source/ArachnaeSwarm/Building_Comps/CompBreakdownDisabler.cs b/Source/ArachnaeSwarm/Building_Comps/CompBreakdownDisabler.cs index eded3b1..87c9a39 100644 --- a/Source/ArachnaeSwarm/Building_Comps/CompBreakdownDisabler.cs +++ b/Source/ArachnaeSwarm/Building_Comps/CompBreakdownDisabler.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using Verse; @@ -102,7 +102,7 @@ namespace ArachnaeSwarm // 记录日志(可选) if (Props.logRepairs) { - Log.Message($"[BreakdownDisabler] Automatically repaired {parent.Label} at {parent.Position}"); + ArachnaeLog.Debug($"[BreakdownDisabler] Automatically repaired {parent.Label} at {parent.Position}"); } } diff --git a/Source/ArachnaeSwarm/Building_Comps/CompNutritionToFuelConverter.cs b/Source/ArachnaeSwarm/Building_Comps/CompNutritionToFuelConverter.cs index 0f30246..1818df6 100644 --- a/Source/ArachnaeSwarm/Building_Comps/CompNutritionToFuelConverter.cs +++ b/Source/ArachnaeSwarm/Building_Comps/CompNutritionToFuelConverter.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using Verse; @@ -35,11 +35,11 @@ namespace ArachnaeSwarm if (nutritionComp == null) { - Log.Error($"[ArachnaeSwarm] {parent.def.defName} has CompNutritionToFuelConverter but no CompRefuelableNutrition."); + ArachnaeLog.Debug($"[ArachnaeSwarm] {parent.def.defName} has CompNutritionToFuelConverter but no CompRefuelableNutrition."); } if (productStorageComp == null) { - Log.Error($"[ArachnaeSwarm] {parent.def.defName} has CompNutritionToFuelConverter but no CompProductStorage."); + ArachnaeLog.Debug($"[ArachnaeSwarm] {parent.def.defName} has CompNutritionToFuelConverter but no CompProductStorage."); } } @@ -104,11 +104,11 @@ namespace ArachnaeSwarm workProgress -= unitsToCraft * Props.workAmount; // 记录日志用于调试 - Log.Message($"[NutritionToFuel] Added {fuelToAdd} fuel to storage. Remaining space: {productStorageComp.StorageSpaceRemaining}"); + ArachnaeLog.Debug($"[NutritionToFuel] Added {fuelToAdd} fuel to storage. Remaining space: {productStorageComp.StorageSpaceRemaining}"); } else { - Log.Warning($"[NutritionToFuel] Failed to add fuel to storage. Requested: {fuelToAdd}, Space: {spaceInStorage}"); + ArachnaeLog.Debug($"[NutritionToFuel] Failed to add fuel to storage. Requested: {fuelToAdd}, Space: {spaceInStorage}"); } } // If spaceInStorage is 0, do nothing and let progress build up. @@ -155,7 +155,7 @@ namespace ArachnaeSwarm $"Nutrition Comp: {(nutritionComp != null ? "Found" : "Missing")}\n" + $"Product Storage Comp: {(productStorageComp != null ? "Found" : "Missing")}"; Messages.Message(status, MessageTypeDefOf.SilentInput); - Log.Message(status); + ArachnaeLog.Debug(status); } }; diff --git a/Source/ArachnaeSwarm/Buildings/Building_ARANutrientDispenser/Patch_DispenserFoodSearch.cs b/Source/ArachnaeSwarm/Buildings/Building_ARANutrientDispenser/Patch_DispenserFoodSearch.cs index 0ef9da6..8c7671e 100644 --- a/Source/ArachnaeSwarm/Buildings/Building_ARANutrientDispenser/Patch_DispenserFoodSearch.cs +++ b/Source/ArachnaeSwarm/Buildings/Building_ARANutrientDispenser/Patch_DispenserFoodSearch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld; using Verse; using System.Linq; @@ -47,7 +47,7 @@ namespace ArachnaeSwarm { // We found one! Store it for the Postfix. foundCustomDispenser = bestDispenser; - Log.Message($"[ArachnaeSwarm Prefix] Found a potential custom dispenser for {eater.LabelShort}: {bestDispenser.Label}"); + ArachnaeLog.Debug($"[ArachnaeSwarm Prefix] Found a potential custom dispenser for {eater.LabelShort}: {bestDispenser.Label}"); } // ALWAYS let the original method run. @@ -71,14 +71,14 @@ namespace ArachnaeSwarm var customDispenserMealDef = foundCustomDispenser.DispensableDef; if (customDispenserMealDef == null) { - Log.Warning($"[ArachnaeSwarm Postfix] Custom dispenser {foundCustomDispenser.Label} has a null DispensableDef."); + ArachnaeLog.Debug($"[ArachnaeSwarm Postfix] Custom dispenser {foundCustomDispenser.Label} has a null DispensableDef."); return; } // If the original method found NO food, then our dispenser is the best (and only) choice. if (__result == null) { - Log.Message($"[ArachnaeSwarm Postfix] Original method found no food. Using our custom dispenser: {foundCustomDispenser.Label}"); + ArachnaeLog.Debug($"[ArachnaeSwarm Postfix] Original method found no food. Using our custom dispenser: {foundCustomDispenser.Label}"); __result = foundCustomDispenser; foodDef = customDispenserMealDef; return; @@ -89,18 +89,18 @@ namespace ArachnaeSwarm float ourScore = FoodUtility.FoodOptimality(eater, foundCustomDispenser, customDispenserMealDef, (getter.Position - foundCustomDispenser.Position).LengthManhattan); float theirScore = FoodUtility.FoodOptimality(eater, __result, foodDef, (getter.Position - __result.Position).LengthManhattan); - Log.Message($"[ArachnaeSwarm Postfix] Comparing food sources: Our Dispenser (Score: {ourScore:F2}) vs Original Result '{__result.Label}' (Score: {theirScore:F2})."); + ArachnaeLog.Debug($"[ArachnaeSwarm Postfix] Comparing food sources: Our Dispenser (Score: {ourScore:F2}) vs Original Result '{__result.Label}' (Score: {theirScore:F2})."); // If our dispenser is a better choice, override the result. if (ourScore > theirScore) { - Log.Message($"[ArachnaeSwarm Postfix] Our dispenser is better. Overriding result."); + ArachnaeLog.Debug($"[ArachnaeSwarm Postfix] Our dispenser is better. Overriding result."); __result = foundCustomDispenser; foodDef = customDispenserMealDef; } else { - Log.Message($"[ArachnaeSwarm Postfix] Original result is better or equal. Keeping it."); + ArachnaeLog.Debug($"[ArachnaeSwarm Postfix] Original result is better or equal. Keeping it."); } } diff --git a/Source/ArachnaeSwarm/Buildings/Building_CatastropheMissileSilo/WorldObject_CatastropheMissile.cs b/Source/ArachnaeSwarm/Buildings/Building_CatastropheMissileSilo/WorldObject_CatastropheMissile.cs index 194a07c..e44f876 100644 --- a/Source/ArachnaeSwarm/Buildings/Building_CatastropheMissileSilo/WorldObject_CatastropheMissile.cs +++ b/Source/ArachnaeSwarm/Buildings/Building_CatastropheMissileSilo/WorldObject_CatastropheMissile.cs @@ -1,4 +1,4 @@ -using RimWorld.Planet; +using RimWorld.Planet; using UnityEngine; using Verse; using RimWorld; @@ -45,7 +45,7 @@ namespace ArachnaeSwarm // Safety check: if the destination is invalid, log an error and remove the missile. if (this.destinationTile < 0) { - Log.Error("CatastropheMissile spawned with an invalid destination tile. Removing."); + ArachnaeLog.Debug("CatastropheMissile spawned with an invalid destination tile. Removing."); Find.WorldObjects.Remove(this); return; } diff --git a/Source/ArachnaeSwarm/Buildings/Building_Ootheca/Building_Ootheca.cs b/Source/ArachnaeSwarm/Buildings/Building_Ootheca/Building_Ootheca.cs index ee53ef0..f449fc3 100644 --- a/Source/ArachnaeSwarm/Buildings/Building_Ootheca/Building_Ootheca.cs +++ b/Source/ArachnaeSwarm/Buildings/Building_Ootheca/Building_Ootheca.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Text; using UnityEngine; @@ -180,7 +180,7 @@ namespace ArachnaeSwarm // 验证幼虫种族 if (larva.def.defName != "ArachnaeBase_Race_Larva") { - Log.Warning($"Invalid larva arrived: {larva.def.defName}"); + ArachnaeLog.Debug($"Invalid larva arrived: {larva.def.defName}"); return; } @@ -198,14 +198,14 @@ namespace ArachnaeSwarm // 验证是当前分配的幼虫 if (larva != assignedLarva) { - Log.Warning("Larva operation complete called with wrong larva."); + ArachnaeLog.Debug("Larva operation complete called with wrong larva."); return; } var config = IncubatorData?.SelectedConfig; if (config == null) { - Log.Error("No incubation config selected when larva completed operation."); + ArachnaeLog.Debug("No incubation config selected when larva completed operation."); return; } diff --git a/Source/ArachnaeSwarm/Buildings/Building_TurretGunHasSpeed.cs b/Source/ArachnaeSwarm/Buildings/Building_TurretGunHasSpeed.cs index 65a6197..498094d 100644 --- a/Source/ArachnaeSwarm/Buildings/Building_TurretGunHasSpeed.cs +++ b/Source/ArachnaeSwarm/Buildings/Building_TurretGunHasSpeed.cs @@ -324,7 +324,7 @@ namespace ArachnaeSwarm // 检查是否有攻击动词 if (currentEffectiveVerb == null) { - Log.Error("BestShootTargetFromCurrentPosition with " + searcher.ToStringSafe() + " who has no attack verb."); + ArachnaeLog.Debug("BestShootTargetFromCurrentPosition with " + searcher.ToStringSafe() + " who has no attack verb."); return null; } @@ -376,7 +376,7 @@ namespace ArachnaeSwarm // 验证攻击动词是否存在 if (verb == null) { - Log.Error("BestAttackTarget with " + searcher.ToStringSafe() + " who has no attack verb."); + ArachnaeLog.Debug("BestAttackTarget with " + searcher.ToStringSafe() + " who has no attack verb."); return null; } diff --git a/Source/ArachnaeSwarm/Buildings/Wormhole/Building_WormholePortal_A.cs b/Source/ArachnaeSwarm/Buildings/Wormhole/Building_WormholePortal_A.cs index f3c9f63..bd7f3cd 100644 --- a/Source/ArachnaeSwarm/Buildings/Wormhole/Building_WormholePortal_A.cs +++ b/Source/ArachnaeSwarm/Buildings/Wormhole/Building_WormholePortal_A.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using RimWorld.Planet; using System.Collections.Generic; using Verse; @@ -99,7 +99,7 @@ namespace ArachnaeSwarm public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish) { - Log.Message($"[ArachnaeSwarm] Portal A ({this.GetUniqueLoadID()}) is despawning. Notifying and destroying Portal B ({linkedPortalB?.GetUniqueLoadID() ?? "null"})."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Portal A ({this.GetUniqueLoadID()}) is despawning. Notifying and destroying Portal B ({linkedPortalB?.GetUniqueLoadID() ?? "null"})."); if (linkedPortalB != null && !linkedPortalB.Destroyed) { linkedPortalB.Notify_A_Destroyed(); @@ -115,7 +115,7 @@ namespace ArachnaeSwarm Notify_B_Destroyed(); return; } - Log.Message($"[ArachnaeSwarm] Portal A ({this.GetUniqueLoadID()}) is linking to Portal B ({portalB?.GetUniqueLoadID() ?? "null"})."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Portal A ({this.GetUniqueLoadID()}) is linking to Portal B ({portalB?.GetUniqueLoadID() ?? "null"})."); linkedPortalB = portalB; status = WormholePortalStatus.Linked; Messages.Message("WormholePortalLinked".Translate(this.Label, portalB.Map.Parent.LabelCap), this, MessageTypeDefOf.PositiveEvent); @@ -123,7 +123,7 @@ namespace ArachnaeSwarm public void Notify_B_Destroyed() { - Log.Warning($"[ArachnaeSwarm] Portal A ({this.GetUniqueLoadID()}) received notification that Portal B was destroyed. Resetting status to Idle."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Portal A ({this.GetUniqueLoadID()}) received notification that Portal B was destroyed. Resetting status to Idle."); linkedPortalB = null; status = WormholePortalStatus.Idle; Messages.Message("WormholePortalB_Destroyed".Translate(this.Label), this, MessageTypeDefOf.NegativeEvent); diff --git a/Source/ArachnaeSwarm/Buildings/Wormhole/Building_WormholePortal_B.cs b/Source/ArachnaeSwarm/Buildings/Wormhole/Building_WormholePortal_B.cs index 0c25494..52e61b1 100644 --- a/Source/ArachnaeSwarm/Buildings/Wormhole/Building_WormholePortal_B.cs +++ b/Source/ArachnaeSwarm/Buildings/Wormhole/Building_WormholePortal_B.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using RimWorld.Planet; using System.Collections.Generic; using Verse; @@ -20,7 +20,7 @@ namespace ArachnaeSwarm public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish) { // 如果B被摧毁,通知A - Log.Warning($"[ArachnaeSwarm] Portal B ({this.GetUniqueLoadID()}) is despawning. Notifying Portal A ({linkedPortalA?.GetUniqueLoadID() ?? "null"})."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Portal B ({this.GetUniqueLoadID()}) is despawning. Notifying Portal A ({linkedPortalA?.GetUniqueLoadID() ?? "null"})."); if (linkedPortalA != null && !linkedPortalA.Destroyed) { linkedPortalA.Notify_B_Destroyed(); @@ -36,7 +36,7 @@ namespace ArachnaeSwarm public void SetLinkedPortal(Building_WormholePortal_A portalA) { - Log.Message($"[ArachnaeSwarm] Portal B ({this.GetUniqueLoadID()}) is linking to Portal A ({portalA?.GetUniqueLoadID() ?? "null"})."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Portal B ({this.GetUniqueLoadID()}) is linking to Portal A ({portalA?.GetUniqueLoadID() ?? "null"})."); linkedPortalA = portalA; } diff --git a/Source/ArachnaeSwarm/EventSystem/CompOpenCustomUI.cs b/Source/ArachnaeSwarm/EventSystem/CompOpenCustomUI.cs index e61cdc6..305ed1e 100644 --- a/Source/ArachnaeSwarm/EventSystem/CompOpenCustomUI.cs +++ b/Source/ArachnaeSwarm/EventSystem/CompOpenCustomUI.cs @@ -1,4 +1,4 @@ -using System; // Required for Activator +using System; // Required for Activator using RimWorld; using Verse; using System.Collections.Generic; @@ -51,7 +51,7 @@ namespace ArachnaeSwarm } else { - Log.Error($"[CompOpenCustomUI] Could not find EventDef named '{Props.uiDefName}'."); + ArachnaeLog.Debug($"[CompOpenCustomUI] Could not find EventDef named '{Props.uiDefName}'."); } }); diff --git a/Source/ArachnaeSwarm/EventSystem/Condition.cs b/Source/ArachnaeSwarm/EventSystem/Condition.cs index 3f72bc0..c8e8cc6 100644 --- a/Source/ArachnaeSwarm/EventSystem/Condition.cs +++ b/Source/ArachnaeSwarm/EventSystem/Condition.cs @@ -1,4 +1,4 @@ -using Verse; +using Verse; using RimWorld; namespace ArachnaeSwarm @@ -58,7 +58,7 @@ namespace ArachnaeSwarm } catch (System.Exception e) { - Log.Warning($"[EventSystem] Condition_VariableEquals: Could not compare '{variable}' and '{compareValueStr}'. Error: {e.Message}"); + ArachnaeLog.Debug($"[EventSystem] Condition_VariableEquals: Could not compare '{variable}' and '{compareValueStr}'. Error: {e.Message}"); reason = "Type mismatch or parsing error during comparison."; return false; } @@ -89,7 +89,7 @@ namespace ArachnaeSwarm var eventVarManager = Find.World.GetComponent(); if (!eventVarManager.HasVariable(name)) { - Log.Message($"[EventSystem] {GetType().Name}: Variable '{name}' not found, defaulting to 0f."); + ArachnaeLog.Debug($"[EventSystem] {GetType().Name}: Variable '{name}' not found, defaulting to 0f."); eventVarManager.SetVariable(name, 0f); } @@ -102,13 +102,13 @@ namespace ArachnaeSwarm if (float.IsNaN(compareValue)) { reason = $"Comparison variable '{valueVariableName}' not set or not a number."; - Log.Warning($"[EventSystem] {GetType().Name} check for '{name}' failed: {reason}"); + ArachnaeLog.Debug($"[EventSystem] {GetType().Name} check for '{name}' failed: {reason}"); return false; } } bool met = Compare(variable, compareValue); - Log.Message($"[EventSystem] {GetType().Name} check: Name='{name}', CurrentValue='{variable}', CompareValue='{compareValue}', Met={met}"); + ArachnaeLog.Debug($"[EventSystem] {GetType().Name} check: Name='{name}', CurrentValue='{variable}', CompareValue='{compareValue}', Met={met}"); if (!met) { reason = $"Requires {name} {GetOperatorString()} {compareValue} (Current: {variable})"; @@ -195,12 +195,12 @@ namespace ArachnaeSwarm } catch (System.Exception e) { - Log.Warning($"[EventSystem] Condition_VariableNotEqual: Could not compare '{variable}' and '{compareValueStr}'. Error: {e.Message}"); + ArachnaeLog.Debug($"[EventSystem] Condition_VariableNotEqual: Could not compare '{variable}' and '{compareValueStr}'. Error: {e.Message}"); reason = "Type mismatch or parsing error during comparison."; return false; } - Log.Message($"[EventSystem] Condition_VariableNotEqual check: Name='{name}', Type='{variable?.GetType().Name ?? "null"}', CurrentValue='{variable}', CompareValue='{compareValueStr}', Met={met}"); + ArachnaeLog.Debug($"[EventSystem] Condition_VariableNotEqual check: Name='{name}', Type='{variable?.GetType().Name ?? "null"}', CurrentValue='{variable}', CompareValue='{compareValueStr}', Met={met}"); if (!met) { reason = $"Requires {name} != {compareValueStr} (Current: {variable})"; diff --git a/Source/ArachnaeSwarm/EventSystem/DelayedActionManager.cs b/Source/ArachnaeSwarm/EventSystem/DelayedActionManager.cs index a07863d..588ad8c 100644 --- a/Source/ArachnaeSwarm/EventSystem/DelayedActionManager.cs +++ b/Source/ArachnaeSwarm/EventSystem/DelayedActionManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using RimWorld; using RimWorld.Planet; @@ -60,7 +60,7 @@ namespace ArachnaeSwarm } catch (Exception ex) { - Log.Error($"[WulaFallenEmpire] Error executing delayed action for event '{delayedAction.eventDefName}': {ex}"); + ArachnaeLog.Debug($"[WulaFallenEmpire] Error executing delayed action for event '{delayedAction.eventDefName}': {ex}"); } actions.RemoveAt(i); } @@ -78,7 +78,7 @@ namespace ArachnaeSwarm } else { - Log.Error($"[WulaFallenEmpire] DelayedActionManager could not find EventDef named '{defName}'"); + ArachnaeLog.Debug($"[WulaFallenEmpire] DelayedActionManager could not find EventDef named '{defName}'"); } } diff --git a/Source/ArachnaeSwarm/EventSystem/Effect.cs b/Source/ArachnaeSwarm/EventSystem/Effect.cs index 6194a75..9647cb2 100644 --- a/Source/ArachnaeSwarm/EventSystem/Effect.cs +++ b/Source/ArachnaeSwarm/EventSystem/Effect.cs @@ -1,4 +1,4 @@ -using System; // Required for Activator +using System; // Required for Activator using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -29,7 +29,7 @@ namespace ArachnaeSwarm } else { - Log.Error("[WulaFallenEmpire] DelayedActionManager not found. Cannot schedule delayed UI opening."); + ArachnaeLog.Debug("[WulaFallenEmpire] DelayedActionManager not found. Cannot schedule delayed UI opening."); } } else @@ -64,7 +64,7 @@ namespace ArachnaeSwarm } else { - Log.Error($"[WulaFallenEmpire] Effect_OpenCustomUI could not find EventDef named '{defName}'"); + ArachnaeLog.Debug($"[WulaFallenEmpire] Effect_OpenCustomUI could not find EventDef named '{defName}'"); } } @@ -119,7 +119,7 @@ namespace ArachnaeSwarm { if (incident == null) { - Log.Error("[WulaFallenEmpire] Effect_FireIncident has a null incident Def."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_FireIncident has a null incident Def."); return; } @@ -131,7 +131,7 @@ namespace ArachnaeSwarm if (!incident.Worker.TryExecute(parms)) { - Log.Error($"[WulaFallenEmpire] Could not fire incident {incident.defName}"); + ArachnaeLog.Debug($"[WulaFallenEmpire] Could not fire incident {incident.defName}"); } } } @@ -145,14 +145,14 @@ namespace ArachnaeSwarm { if (faction == null) { - Log.Error("[WulaFallenEmpire] Effect_ChangeFactionRelation has a null faction Def."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_ChangeFactionRelation has a null faction Def."); return; } Faction targetFaction = Find.FactionManager.FirstFactionOfDef(faction); if (targetFaction == null) { - Log.Warning($"[WulaFallenEmpire] Could not find an active faction for FactionDef '{faction.defName}'."); + ArachnaeLog.Debug($"[WulaFallenEmpire] Could not find an active faction for FactionDef '{faction.defName}'."); return; } @@ -204,14 +204,14 @@ namespace ArachnaeSwarm { if (faction == null) { - Log.Error("[WulaFallenEmpire] Effect_ChangeFactionRelation_FromVariable has a null faction Def."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_ChangeFactionRelation_FromVariable has a null faction Def."); return; } Faction targetFaction = Find.FactionManager.FirstFactionOfDef(faction); if (targetFaction == null) { - Log.Warning($"[WulaFallenEmpire] Could not find an active faction for FactionDef '{faction.defName}'."); + ArachnaeLog.Debug($"[WulaFallenEmpire] Could not find an active faction for FactionDef '{faction.defName}'."); return; } @@ -230,12 +230,12 @@ namespace ArachnaeSwarm { if (kindDef == null) { - Log.Error("[WulaFallenEmpire] Effect_SpawnPawnAndStore has a null kindDef."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_SpawnPawnAndStore has a null kindDef."); return; } if (storeAs.NullOrEmpty()) { - Log.Error("[WulaFallenEmpire] Effect_SpawnPawnAndStore needs a 'storeAs' variable name."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_SpawnPawnAndStore needs a 'storeAs' variable name."); return; } @@ -269,14 +269,14 @@ namespace ArachnaeSwarm { if (thingDef == null) { - Log.Error("[WulaFallenEmpire] Effect_GiveThing has a null thingDef."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_GiveThing has a null thingDef."); return; } Map currentMap = Find.CurrentMap; if (currentMap == null) { - Log.Error("[WulaFallenEmpire] Effect_GiveThing cannot execute without a current map."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_GiveThing cannot execute without a current map."); return; } @@ -303,14 +303,14 @@ namespace ArachnaeSwarm { if (kindDef == null) { - Log.Error("[WulaFallenEmpire] Effect_SpawnPawn has a null kindDef."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_SpawnPawn has a null kindDef."); return; } Map map = Find.CurrentMap; if (map == null) { - Log.Error("[WulaFallenEmpire] Effect_SpawnPawn cannot execute without a current map."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_SpawnPawn cannot execute without a current map."); return; } @@ -361,7 +361,7 @@ namespace ArachnaeSwarm { if (string.IsNullOrEmpty(name)) { - Log.Error("[WulaFallenEmpire] Effect_ModifyVariable has a null or empty name."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_ModifyVariable has a null or empty name."); return; } @@ -374,7 +374,7 @@ namespace ArachnaeSwarm valueStr = eventVarManager.GetVariable(valueVariableName)?.ToString(); if (valueStr == null) { - Log.Error($"[WulaFallenEmpire] Effect_ModifyVariable: valueVariableName '{valueVariableName}' not found."); + ArachnaeLog.Debug($"[WulaFallenEmpire] Effect_ModifyVariable: valueVariableName '{valueVariableName}' not found."); return; } } @@ -383,7 +383,7 @@ namespace ArachnaeSwarm object variable = eventVarManager.GetVariable(name); if (variable == null) { - Log.Message($"[EventSystem] Effect_ModifyVariable: Variable '{name}' not found, initializing to 0."); + ArachnaeLog.Debug($"[EventSystem] Effect_ModifyVariable: Variable '{name}' not found, initializing to 0."); variable = 0; } @@ -406,12 +406,12 @@ namespace ArachnaeSwarm newValue = Modify(currentVal, modVal, operation); } - Log.Message($"[EventSystem] Modifying variable '{name}'. Operation: {operation}. Value: {valueStr}. From: {originalValue} To: {newValue}"); + ArachnaeLog.Debug($"[EventSystem] Modifying variable '{name}'. Operation: {operation}. Value: {valueStr}. From: {originalValue} To: {newValue}"); eventVarManager.SetVariable(name, newValue); } catch (System.Exception e) { - Log.Error($"[WulaFallenEmpire] Effect_ModifyVariable: Could not parse or operate on value '{valueStr}' for variable '{name}'. Error: {e.Message}"); + ArachnaeLog.Debug($"[WulaFallenEmpire] Effect_ModifyVariable: Could not parse or operate on value '{valueStr}' for variable '{name}'. Error: {e.Message}"); } } @@ -424,7 +424,7 @@ namespace ArachnaeSwarm case VariableOperation.Multiply: return current * modifier; case VariableOperation.Divide: if (modifier != 0) return current / modifier; - Log.Error($"[WulaFallenEmpire] Effect_ModifyVariable tried to divide by zero."); + ArachnaeLog.Debug($"[WulaFallenEmpire] Effect_ModifyVariable tried to divide by zero."); return current; default: return current; } @@ -439,7 +439,7 @@ namespace ArachnaeSwarm { if (string.IsNullOrEmpty(name)) { - Log.Error("[WulaFallenEmpire] Effect_ClearVariable has a null or empty name."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_ClearVariable has a null or empty name."); return; } Find.World.GetComponent().ClearVariable(name); @@ -454,7 +454,7 @@ namespace ArachnaeSwarm { if (quest == null) { - Log.Error("[WulaFallenEmpire] Effect_AddQuest has a null quest Def."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_AddQuest has a null quest Def."); return; } @@ -473,7 +473,7 @@ namespace ArachnaeSwarm { if (research == null) { - Log.Error("[WulaFallenEmpire] Effect_FinishResearch has a null research Def."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_FinishResearch has a null research Def."); return; } @@ -496,14 +496,14 @@ namespace ArachnaeSwarm Map map = Find.CurrentMap; if (map == null) { - Log.Error("[WulaFallenEmpire] Effect_TriggerRaid cannot execute without a current map."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_TriggerRaid cannot execute without a current map."); return; } Faction factionInst = Find.FactionManager.FirstFactionOfDef(this.faction); if (factionInst == null) { - Log.Error($"[WulaFallenEmpire] Effect_TriggerRaid could not find an active faction for FactionDef '{this.faction?.defName}'."); + ArachnaeLog.Debug($"[WulaFallenEmpire] Effect_TriggerRaid could not find an active faction for FactionDef '{this.faction?.defName}'."); return; } @@ -520,7 +520,7 @@ namespace ArachnaeSwarm if (!RCellFinder.TryFindRandomPawnEntryCell(out parms.spawnCenter, map, CellFinder.EdgeRoadChance_Hostile)) { - Log.Error("[WulaFallenEmpire] Effect_TriggerRaid could not find a valid spawn center."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_TriggerRaid could not find a valid spawn center."); return; } @@ -568,7 +568,7 @@ namespace ArachnaeSwarm { if (factionDef == null || string.IsNullOrEmpty(variableName)) { - Log.Error("[WulaFallenEmpire] Effect_CheckFactionGoodwill is not configured correctly."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_CheckFactionGoodwill is not configured correctly."); return; } @@ -578,12 +578,12 @@ namespace ArachnaeSwarm if (faction != null) { int goodwill = faction.GoodwillWith(Faction.OfPlayer); - Log.Message($"[EventSystem] Storing goodwill for faction '{faction.Name}' ({goodwill}) into variable '{variableName}'."); + ArachnaeLog.Debug($"[EventSystem] Storing goodwill for faction '{faction.Name}' ({goodwill}) into variable '{variableName}'."); eventVarManager.SetVariable(variableName, goodwill); } else { - Log.Warning($"[EventSystem] Effect_CheckFactionGoodwill: Faction '{factionDef.defName}' not found. Storing 0 in variable '{variableName}'."); + ArachnaeLog.Debug($"[EventSystem] Effect_CheckFactionGoodwill: Faction '{factionDef.defName}' not found. Storing 0 in variable '{variableName}'."); eventVarManager.SetVariable(variableName, 0); } } @@ -597,13 +597,13 @@ namespace ArachnaeSwarm { if (string.IsNullOrEmpty(variableName)) { - Log.Error("[WulaFallenEmpire] Effect_StoreRealPlayTime is not configured correctly (missing variableName)."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_StoreRealPlayTime is not configured correctly (missing variableName)."); return; } var eventVarManager = Find.World.GetComponent(); float realPlayTime = Find.GameInfo.RealPlayTimeInteracting; - Log.Message($"[EventSystem] Storing real play time ({realPlayTime}s) into variable '{variableName}'."); + ArachnaeLog.Debug($"[EventSystem] Storing real play time ({realPlayTime}s) into variable '{variableName}'."); eventVarManager.SetVariable(variableName, realPlayTime); } } @@ -616,13 +616,13 @@ namespace ArachnaeSwarm { if (string.IsNullOrEmpty(variableName)) { - Log.Error("[WulaFallenEmpire] Effect_StoreDaysPassed is not configured correctly (missing variableName)."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_StoreDaysPassed is not configured correctly (missing variableName)."); return; } var eventVarManager = Find.World.GetComponent(); int daysPassed = GenDate.DaysPassed; - Log.Message($"[EventSystem] Storing days passed ({daysPassed}) into variable '{variableName}'."); + ArachnaeLog.Debug($"[EventSystem] Storing days passed ({daysPassed}) into variable '{variableName}'."); eventVarManager.SetVariable(variableName, daysPassed); } } @@ -635,20 +635,20 @@ namespace ArachnaeSwarm { if (string.IsNullOrEmpty(variableName)) { - Log.Error("[WulaFallenEmpire] Effect_StoreColonyWealth is not configured correctly (missing variableName)."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_StoreColonyWealth is not configured correctly (missing variableName)."); return; } Map currentMap = Find.CurrentMap; if (currentMap == null) { - Log.Error("[WulaFallenEmpire] Effect_StoreColonyWealth cannot execute without a current map."); + ArachnaeLog.Debug("[WulaFallenEmpire] Effect_StoreColonyWealth cannot execute without a current map."); return; } var eventVarManager = Find.World.GetComponent(); float wealth = currentMap.wealthWatcher.WealthTotal; - Log.Message($"[EventSystem] Storing colony wealth ({wealth}) into variable '{variableName}'."); + ArachnaeLog.Debug($"[EventSystem] Storing colony wealth ({wealth}) into variable '{variableName}'."); eventVarManager.SetVariable(variableName, wealth); } } diff --git a/Source/ArachnaeSwarm/EventSystem/EventVariableManager.cs b/Source/ArachnaeSwarm/EventSystem/EventVariableManager.cs index 1e8f705..b6073f1 100644 --- a/Source/ArachnaeSwarm/EventSystem/EventVariableManager.cs +++ b/Source/ArachnaeSwarm/EventSystem/EventVariableManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Verse; using RimWorld; using RimWorld.Planet; @@ -49,7 +49,7 @@ namespace ArachnaeSwarm if (string.IsNullOrEmpty(name)) return; // Log the variable change - Log.Message($"[EventSystem] Setting variable '{name}' to value '{value}' of type {value?.GetType().Name ?? "null"}."); + ArachnaeLog.Debug($"[EventSystem] Setting variable '{name}' to value '{value}' of type {value?.GetType().Name ?? "null"}."); // Clear any existing variable with the same name to prevent type confusion ClearVariable(name); @@ -77,7 +77,7 @@ namespace ArachnaeSwarm else if (value != null) { stringVars[name] = value.ToString(); - Log.Warning($"[WulaFallenEmpire] EventVariableManager: Variable '{name}' of type {value.GetType()} was converted to string for storage. This may lead to unexpected behavior."); + ArachnaeLog.Debug($"[WulaFallenEmpire] EventVariableManager: Variable '{name}' of type {value.GetType()} was converted to string for storage. This may lead to unexpected behavior."); } } @@ -124,7 +124,7 @@ namespace ArachnaeSwarm } catch (System.Exception e) { - Log.Warning($"[WulaFallenEmpire] EventVariableManager: Variable '{name}' of type {value.GetType()} could not be converted to {typeof(T)}. Error: {e.Message}"); + ArachnaeLog.Debug($"[WulaFallenEmpire] EventVariableManager: Variable '{name}' of type {value.GetType()} could not be converted to {typeof(T)}. Error: {e.Message}"); return defaultValue; } } @@ -145,7 +145,7 @@ namespace ArachnaeSwarm { if (HasVariable(name)) { - Log.Message($"[EventSystem] Clearing variable '{name}'."); + ArachnaeLog.Debug($"[EventSystem] Clearing variable '{name}'."); } intVars.Remove(name); floatVars.Remove(name); diff --git a/Source/ArachnaeSwarm/FacialAnimation/FaceAnimationStaticGenerator.cs b/Source/ArachnaeSwarm/FacialAnimation/FaceAnimationStaticGenerator.cs index 3ab33ae..14e9c22 100644 --- a/Source/ArachnaeSwarm/FacialAnimation/FaceAnimationStaticGenerator.cs +++ b/Source/ArachnaeSwarm/FacialAnimation/FaceAnimationStaticGenerator.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System; using System.Collections.Generic; using System.IO; @@ -19,7 +19,7 @@ namespace ArachnaeSwarm // 检查 Nals.FacialAnimation 是否被加载 if (!LoadedModManager.RunningMods.Any(m => m.PackageId == "Nals.FacialAnimation")) { - Log.Message("[Arachnae Swarm] Facial Animation mod not found. Skipping animation file generation."); + ArachnaeLog.Debug("[Arachnae Swarm] Facial Animation mod not found. Skipping animation file generation."); return; // 如果未加载,则直接退出,不执行任何操作 } @@ -34,7 +34,7 @@ namespace ArachnaeSwarm string modRootDir = GetModRootDirectory(); if (string.IsNullOrEmpty(modRootDir)) { - Log.Error("Cannot find mod root directory"); + ArachnaeLog.Debug("Cannot find mod root directory"); return; } @@ -93,7 +93,7 @@ namespace ArachnaeSwarm // 检查种族是否存在 if (DefDatabase.GetNamedSilentFail(raceDefName) == null) { - Log.Warning($"Race {raceDefName} not found, skipping face animation generation"); + ArachnaeLog.Debug($"Race {raceDefName} not found, skipping face animation generation"); continue; } @@ -104,11 +104,11 @@ namespace ArachnaeSwarm } } - Log.Message($"Generated {totalFilesGenerated} face animation files in {fullOutputDir}"); + ArachnaeLog.Debug($"Generated {totalFilesGenerated} face animation files in {fullOutputDir}"); } catch (Exception ex) { - Log.Error($"Error in FaceAnimationFileGenerator: {ex}"); + ArachnaeLog.Debug($"Error in FaceAnimationFileGenerator: {ex}"); } } @@ -146,12 +146,12 @@ namespace ArachnaeSwarm } } - Log.Error("Cannot determine mod root directory"); + ArachnaeLog.Debug("Cannot determine mod root directory"); return null; } catch (Exception ex) { - Log.Error($"Error getting mod root directory: {ex}"); + ArachnaeLog.Debug($"Error getting mod root directory: {ex}"); return null; } } @@ -165,7 +165,7 @@ namespace ArachnaeSwarm // 检查源文件是否存在 if (!File.Exists(sourcePath)) { - Log.Warning($"Source animation file not found: {sourcePath}"); + ArachnaeLog.Debug($"Source animation file not found: {sourcePath}"); return 0; } @@ -176,7 +176,7 @@ namespace ArachnaeSwarm if (abstractDefNodes == null || abstractDefNodes.Count == 0) { - Log.Message($"No abstract FaceAnimationDef found in: {sourcePath}"); + ArachnaeLog.Debug($"No abstract FaceAnimationDef found in: {sourcePath}"); return 0; } @@ -201,11 +201,11 @@ namespace ArachnaeSwarm writer.WriteLine(""); } - Log.Message($"Generated {filesGenerated} animations for {raceDefName} in {outputFile}"); + ArachnaeLog.Debug($"Generated {filesGenerated} animations for {raceDefName} in {outputFile}"); } catch (Exception ex) { - Log.Error($"Error generating animation files for race {raceDefName}: {ex}"); + ArachnaeLog.Debug($"Error generating animation files for race {raceDefName}: {ex}"); } return filesGenerated; @@ -218,7 +218,7 @@ namespace ArachnaeSwarm string abstractName = abstractNode.Attributes?["Name"]?.Value; if (string.IsNullOrEmpty(abstractName)) { - Log.Warning("Abstract FaceAnimationDef has no Name attribute"); + ArachnaeLog.Debug("Abstract FaceAnimationDef has no Name attribute"); return null; } @@ -236,7 +236,7 @@ namespace ArachnaeSwarm } catch (Exception ex) { - Log.Error($"Error generating XML for {raceDefName}: {ex}"); + ArachnaeLog.Debug($"Error generating XML for {raceDefName}: {ex}"); return null; } } diff --git a/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/CompAbilityEffect_AircraftStrike.cs b/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/CompAbilityEffect_AircraftStrike.cs index cd058a9..739c4d3 100644 --- a/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/CompAbilityEffect_AircraftStrike.cs +++ b/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/CompAbilityEffect_AircraftStrike.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using RimWorld.Planet; using System.Collections.Generic; @@ -31,7 +31,7 @@ namespace ArachnaeSwarm if (aircraftManager == null) { - Log.Error("AircraftManagerNotFound".Translate()); + ArachnaeLog.Debug("AircraftManagerNotFound".Translate()); return; } @@ -40,12 +40,12 @@ namespace ArachnaeSwarm { // 成功消耗战机,发送消息 Messages.Message("AircraftStrikeInitiated".Translate(Props.requiredAircraftType.LabelCap), MessageTypeDefOf.PositiveEvent); - Log.Message("AircraftStrikeSuccess".Translate(Props.aircraftsPerUse, Props.requiredAircraftType.LabelCap)); + ArachnaeLog.Debug("AircraftStrikeSuccess".Translate(Props.aircraftsPerUse, Props.requiredAircraftType.LabelCap)); } else { Messages.Message("NoAvailableAircraft".Translate(Props.requiredAircraftType.LabelCap), MessageTypeDefOf.NegativeEvent); - Log.Warning("AircraftStrikeFailed".Translate(Props.requiredAircraftType.LabelCap, parent.pawn.Faction?.Name ?? "UnknownFaction".Translate())); + ArachnaeLog.Debug("AircraftStrikeFailed".Translate(Props.requiredAircraftType.LabelCap, parent.pawn.Faction?.Name ?? "UnknownFaction".Translate())); } } diff --git a/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/CompAircraftHangar.cs b/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/CompAircraftHangar.cs index beef9c1..6d5ae50 100644 --- a/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/CompAircraftHangar.cs +++ b/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/CompAircraftHangar.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using RimWorld.Planet; @@ -53,7 +53,7 @@ namespace ArachnaeSwarm if (aircraftManager == null) { - Log.Error("AircraftManagerNotFound".Translate()); + ArachnaeLog.Debug("AircraftManagerNotFound".Translate()); return; } @@ -92,21 +92,21 @@ namespace ArachnaeSwarm // 检查地图是否有效 if (parent.Map == null) { - Log.Error("TakeoffEffectMapNull".Translate()); + ArachnaeLog.Debug("TakeoffEffectMapNull".Translate()); return; } // 生成 Skyfaller GenSpawn.Spawn(skyfaller, takeoffPos, parent.Map); - Log.Message("TakeoffSkyfallerCreated".Translate(takeoffPos)); + ArachnaeLog.Debug("TakeoffSkyfallerCreated".Translate(takeoffPos)); // 销毁原建筑 parent.Destroy(DestroyMode.Vanish); } catch (System.Exception ex) { - Log.Error("TakeoffEffectError".Translate(ex.Message)); + ArachnaeLog.Debug("TakeoffEffectError".Translate(ex.Message)); // 如果Skyfaller创建失败,直接销毁建筑 parent.Destroy(DestroyMode.Vanish); } diff --git a/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/WorldComponent_AircraftManager.cs b/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/WorldComponent_AircraftManager.cs index e198d34..00847b2 100644 --- a/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/WorldComponent_AircraftManager.cs +++ b/Source/ArachnaeSwarm/Flyover/ARA_AircraftHangar/WorldComponent_AircraftManager.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using RimWorld.Planet; @@ -65,11 +65,11 @@ namespace ArachnaeSwarm // 调试日志 if (Scribe.mode == LoadSaveMode.Saving) { - Log.Message($"Saving aircraft data: {allFactionAircraftData.Count} faction entries, {cooldownEvents.Count} cooldown events"); + ArachnaeLog.Debug($"Saving aircraft data: {allFactionAircraftData.Count} faction entries, {cooldownEvents.Count} cooldown events"); } else if (Scribe.mode == LoadSaveMode.PostLoadInit) { - Log.Message($"Loaded aircraft data: {allFactionAircraftData.Count} faction entries, {cooldownEvents.Count} cooldown events"); + ArachnaeLog.Debug($"Loaded aircraft data: {allFactionAircraftData.Count} faction entries, {cooldownEvents.Count} cooldown events"); } } @@ -120,7 +120,7 @@ namespace ArachnaeSwarm { if (faction == null) { - Log.Error("AddAircraftNullFaction".Translate()); + ArachnaeLog.Debug("AddAircraftNullFaction".Translate()); return; } @@ -128,7 +128,7 @@ namespace ArachnaeSwarm data.totalCount += count; data.availableCount += count; - Log.Message($"Added {count} {aircraftDef.LabelCap} to {faction.Name}. Total: {data.totalCount}, Available: {data.availableCount}"); + ArachnaeLog.Debug($"Added {count} {aircraftDef.LabelCap} to {faction.Name}. Total: {data.totalCount}, Available: {data.availableCount}"); } // 尝试使用战机 @@ -150,7 +150,7 @@ namespace ArachnaeSwarm cooldownEvents.Add(cooldownEvent); - Log.Message($"Used {count} {aircraftDef.LabelCap} from {faction.Name}. Available now: {data.availableCount}, Cooldown until: {cooldownEvent.endTick}"); + ArachnaeLog.Debug($"Used {count} {aircraftDef.LabelCap} from {faction.Name}. Available now: {data.availableCount}, Cooldown until: {cooldownEvent.endTick}"); return true; } @@ -187,7 +187,7 @@ namespace ArachnaeSwarm if (cooldownEvent.aircraftDef != null) { Messages.Message("AircraftCooldownEnded".Translate(cooldownEvent.aircraftDef.LabelCap), MessageTypeDefOf.PositiveEvent); - Log.Message($"Cooldown ended for {cooldownEvent.aircraftCount} {cooldownEvent.aircraftDef.LabelCap}. Available now: {data.availableCount}"); + ArachnaeLog.Debug($"Cooldown ended for {cooldownEvent.aircraftCount} {cooldownEvent.aircraftDef.LabelCap}. Available now: {data.availableCount}"); } } } @@ -203,22 +203,22 @@ namespace ArachnaeSwarm // 调试方法:显示当前状态 public void DebugLogStatus() { - Log.Message("=== Aircraft Manager Status ==="); - Log.Message($"Total faction entries: {allFactionAircraftData.Count}"); + ArachnaeLog.Debug("=== Aircraft Manager Status ==="); + ArachnaeLog.Debug($"Total faction entries: {allFactionAircraftData.Count}"); var factions = allFactionAircraftData.Select(x => x.faction).Distinct(); foreach (var faction in factions) { - Log.Message($"Faction: {faction?.Name ?? "Unknown"}"); + ArachnaeLog.Debug($"Faction: {faction?.Name ?? "Unknown"}"); var factionData = allFactionAircraftData.Where(x => x.faction == faction); foreach (var data in factionData) { - Log.Message($" {data.aircraftDef.LabelCap}: {data.availableCount}/{data.totalCount} available"); + ArachnaeLog.Debug($" {data.aircraftDef.LabelCap}: {data.availableCount}/{data.totalCount} available"); } } - Log.Message($"Active cooldown events: {cooldownEvents.Count}"); - Log.Message("==============================="); + ArachnaeLog.Debug($"Active cooldown events: {cooldownEvents.Count}"); + ArachnaeLog.Debug("==============================="); } } } diff --git a/Source/ArachnaeSwarm/Flyover/ARA_FlyOverDropPod/CompProperties_FlyOverDropPod.cs b/Source/ArachnaeSwarm/Flyover/ARA_FlyOverDropPod/CompProperties_FlyOverDropPod.cs index 85f10a2..9a03c51 100644 --- a/Source/ArachnaeSwarm/Flyover/ARA_FlyOverDropPod/CompProperties_FlyOverDropPod.cs +++ b/Source/ArachnaeSwarm/Flyover/ARA_FlyOverDropPod/CompProperties_FlyOverDropPod.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using Verse; using Verse.AI; @@ -127,14 +127,14 @@ namespace ArachnaeSwarm if (Props.useCyclicDrops) { ticksUntilNextDrop = (int)(Props.cyclicDropIntervalHours * 2500f); // 1小时 = 2500 ticks - Log.Message($"Cyclic drops initialized: {Props.cyclicDropIntervalHours} hours interval"); + ArachnaeLog.Debug($"Cyclic drops initialized: {Props.cyclicDropIntervalHours} hours interval"); } // 初始化信号等待状态 if (Props.waitForExternalSignal) { waitingForSignal = true; - Log.Message($"Waiting for external signal: {Props.externalSignalTag}"); + ArachnaeLog.Debug($"Waiting for external signal: {Props.externalSignalTag}"); } } @@ -151,7 +151,7 @@ namespace ArachnaeSwarm if (pawn != null) { pawns.Add(pawn); - Log.Message($"Generated pawn: {pawn.Label} ({pawnKindCount.pawnKindDef.defName})"); + ArachnaeLog.Debug($"Generated pawn: {pawn.Label} ({pawnKindCount.pawnKindDef.defName})"); } } } @@ -162,7 +162,7 @@ namespace ArachnaeSwarm { if (pawnKindDef == null) { - Log.Error("Attempted to generate pawn with null PawnKindDef"); + ArachnaeLog.Debug("Attempted to generate pawn with null PawnKindDef"); return null; } @@ -213,12 +213,12 @@ namespace ArachnaeSwarm pawn.mindState.SetupLastHumanMeatTick(); } - Log.Message($"Successfully generated pawn: {pawn.LabelCap} from {pawnKindDef.defName}"); + ArachnaeLog.Debug($"Successfully generated pawn: {pawn.LabelCap} from {pawnKindDef.defName}"); return pawn; } catch (System.Exception ex) { - Log.Error($"Failed to generate pawn from {pawnKindDef.defName}: {ex}"); + ArachnaeLog.Debug($"Failed to generate pawn from {pawnKindDef.defName}: {ex}"); return null; } } @@ -282,7 +282,7 @@ namespace ArachnaeSwarm // 重置计时器 ticksUntilNextDrop = (int)(Props.cyclicDropIntervalHours * 2500f); - Log.Message($"Cyclic drop completed, next drop in {Props.cyclicDropIntervalHours} hours"); + ArachnaeLog.Debug($"Cyclic drop completed, next drop in {Props.cyclicDropIntervalHours} hours"); } } @@ -291,7 +291,7 @@ namespace ArachnaeSwarm { if (parent is FlyOver flyOver && waitingForSignal) { - Log.Message($"External signal received, triggering drop pods"); + ArachnaeLog.Debug($"External signal received, triggering drop pods"); DropPods(flyOver); waitingForSignal = false; } @@ -313,12 +313,12 @@ namespace ArachnaeSwarm Map map = flyOver.Map; if (map == null) { - Log.Error("FlyOver DropPods: Map is null"); + ArachnaeLog.Debug("FlyOver DropPods: Map is null"); return; } IntVec3 dropCenter = GetDropCenter(flyOver); - Log.Message($"DropPods triggered at progress {flyOver.currentProgress}, center: {dropCenter}"); + ArachnaeLog.Debug($"DropPods triggered at progress {flyOver.currentProgress}, center: {dropCenter}"); // 如果在投掷时生成 Pawn,现在生成 if (Props.generatePawnsOnDrop && Props.pawnKinds != null) @@ -351,7 +351,7 @@ namespace ArachnaeSwarm if (!thingsToDrop.Any()) { - Log.Warning("No items to drop from FlyOver drop pods"); + ArachnaeLog.Debug("No items to drop from FlyOver drop pods"); return; } @@ -377,7 +377,7 @@ namespace ArachnaeSwarm SendDropLetter(thingsToDrop, dropCenter, map); } - Log.Message($"Drop pods completed: {thingsToDrop.Count} items dropped, including {pawns.Count} pawns"); + ArachnaeLog.Debug($"Drop pods completed: {thingsToDrop.Count} items dropped, including {pawns.Count} pawns"); // 清空已投掷的物品列表,避免重复投掷 items.Clear(); @@ -464,7 +464,7 @@ namespace ArachnaeSwarm // 创建 Lord Lord lord = LordMaker.MakeNewLord(faction, lordJob, Find.CurrentMap, factionPawns); - Log.Message($"Assigned assault lord job to {factionPawns.Count} pawns of faction {faction.Name}"); + ArachnaeLog.Debug($"Assigned assault lord job to {factionPawns.Count} pawns of faction {faction.Name}"); } } diff --git a/Source/ArachnaeSwarm/Flyover/ARA_FlyOverEscort/CompFlyOverEscort.cs b/Source/ArachnaeSwarm/Flyover/ARA_FlyOverEscort/CompFlyOverEscort.cs index a3d0886..f5888f8 100644 --- a/Source/ArachnaeSwarm/Flyover/ARA_FlyOverEscort/CompFlyOverEscort.cs +++ b/Source/ArachnaeSwarm/Flyover/ARA_FlyOverEscort/CompFlyOverEscort.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using UnityEngine; using Verse; @@ -30,8 +30,8 @@ namespace ArachnaeSwarm ticksUntilNextSpawn = Props.spawnIntervalTicks; } - Log.Message($"FlyOver Escort initialized: {Props.spawnIntervalTicks} ticks interval, max {Props.maxEscorts} escorts"); - Log.Message($"Safe distances - From Main: {Props.minSafeDistanceFromMain}, Between Escorts: {Props.minSafeDistanceBetweenEscorts}"); + ArachnaeLog.Debug($"FlyOver Escort initialized: {Props.spawnIntervalTicks} ticks interval, max {Props.maxEscorts} escorts"); + ArachnaeLog.Debug($"Safe distances - From Main: {Props.minSafeDistanceFromMain}, Between Escorts: {Props.minSafeDistanceBetweenEscorts}"); } public override void CompTick() @@ -45,7 +45,7 @@ namespace ArachnaeSwarm if (!hasInitialized && mainFlyOver.hasStarted) { hasInitialized = true; - Log.Message($"FlyOver Escort: Main FlyOver started at {mainFlyOver.startPosition}"); + ArachnaeLog.Debug($"FlyOver Escort: Main FlyOver started at {mainFlyOver.startPosition}"); } // 清理已销毁的伴飞 @@ -116,13 +116,13 @@ namespace ArachnaeSwarm escortVisualData[escort] = visualData; successfulSpawns++; - Log.Message($"Spawned escort #{successfulSpawns} for FlyOver at {mainFlyOver.DrawPos}, scale: {visualData.scale:F2}, maskAlpha: {visualData.heightMaskAlpha:F2}"); + ArachnaeLog.Debug($"Spawned escort #{successfulSpawns} for FlyOver at {mainFlyOver.DrawPos}, scale: {visualData.scale:F2}, maskAlpha: {visualData.heightMaskAlpha:F2}"); } else { // 不安全,销毁这个伴飞 escort.Destroy(); - Log.Message($"Escort spawn attempt {attempt + 1}: Position too close to existing escort, trying again"); + ArachnaeLog.Debug($"Escort spawn attempt {attempt + 1}: Position too close to existing escort, trying again"); } } @@ -133,7 +133,7 @@ namespace ArachnaeSwarm if (successfulSpawns < escortsToSpawn) { - Log.Message($"Spawned {successfulSpawns}/{escortsToSpawn} escorts (some positions were too close to existing escorts)"); + ArachnaeLog.Debug($"Spawned {successfulSpawns}/{escortsToSpawn} escorts (some positions were too close to existing escorts)"); } } @@ -148,7 +148,7 @@ namespace ArachnaeSwarm float distToMain = Vector3.Distance(newPos, mainFlyOver.DrawPos); if (distToMain < Props.minSafeDistanceFromMain) { - Log.Message($"Escort too close to main FlyOver: {distToMain:F1} < {Props.minSafeDistanceFromMain}"); + ArachnaeLog.Debug($"Escort too close to main FlyOver: {distToMain:F1} < {Props.minSafeDistanceFromMain}"); return false; } } @@ -164,7 +164,7 @@ namespace ArachnaeSwarm float distToEscort = Vector3.Distance(newPos, existingEscort.DrawPos); if (distToEscort < Props.minSafeDistanceBetweenEscorts) { - Log.Message($"Escort too close to existing escort: {distToEscort:F1} < {Props.minSafeDistanceBetweenEscorts}"); + ArachnaeLog.Debug($"Escort too close to existing escort: {distToEscort:F1} < {Props.minSafeDistanceBetweenEscorts}"); return false; } } @@ -198,7 +198,7 @@ namespace ArachnaeSwarm ThingDef escortDef = SelectEscortDef(); if (escortDef == null) { - Log.Error("FlyOver Escort: No valid escort def found"); + ArachnaeLog.Debug("FlyOver Escort: No valid escort def found"); return null; } @@ -208,7 +208,7 @@ namespace ArachnaeSwarm if (!escortStart.InBounds(mainFlyOver.Map) || !escortEnd.InBounds(mainFlyOver.Map)) { - Log.Warning("FlyOver Escort: Escort start or end position out of bounds"); + ArachnaeLog.Debug("FlyOver Escort: Escort start or end position out of bounds"); return null; } @@ -231,13 +231,13 @@ namespace ArachnaeSwarm // 设置伴飞属性 - 现在传入 visualData SetupEscortProperties(escort, mainFlyOver, visualData); - Log.Message($"Created escort: {escortStart} -> {escortEnd}, speed: {escortSpeed}, altitude: {escortAltitude}"); + ArachnaeLog.Debug($"Created escort: {escortStart} -> {escortEnd}, speed: {escortSpeed}, altitude: {escortAltitude}"); return escort; } catch (System.Exception ex) { - Log.Error($"Error creating FlyOver escort: {ex}"); + ArachnaeLog.Debug($"Error creating FlyOver escort: {ex}"); return null; } } @@ -351,7 +351,7 @@ namespace ArachnaeSwarm escort.playFlyOverSound = false; } - Log.Message($"Set escort properties: scale={visualData.scale:F2}, isEscort={escort.isEscort}"); + ArachnaeLog.Debug($"Set escort properties: scale={visualData.scale:F2}, isEscort={escort.isEscort}"); } private void UpdateEscortPositions(FlyOver mainFlyOver) diff --git a/Source/ArachnaeSwarm/Flyover/ARA_GroundStrafing/CompGroundStrafing.cs b/Source/ArachnaeSwarm/Flyover/ARA_GroundStrafing/CompGroundStrafing.cs index 08067ef..5308187 100644 --- a/Source/ArachnaeSwarm/Flyover/ARA_GroundStrafing/CompGroundStrafing.cs +++ b/Source/ArachnaeSwarm/Flyover/ARA_GroundStrafing/CompGroundStrafing.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using UnityEngine; using Verse; @@ -33,7 +33,7 @@ namespace ArachnaeSwarm currentLongitudinalOffset = Props.longitudinalInitialOffset; } - Log.Message($"GroundStrafing: Initialized with {confirmedTargetCells.Count} targets, " + + ArachnaeLog.Debug($"GroundStrafing: Initialized with {confirmedTargetCells.Count} targets, " + $"Lateral Offset: {currentLateralOffsetAngle:F1}°, " + $"Longitudinal Offset: {currentLongitudinalOffset:F1}"); } @@ -52,7 +52,7 @@ namespace ArachnaeSwarm // 定期状态输出 if (Find.TickManager.TicksGame % 120 == 0 && confirmedTargetCells.Count > 0) { - Log.Message($"GroundStrafing: {firedCells.Count}/{confirmedTargetCells.Count + firedCells.Count} targets fired, " + + ArachnaeLog.Debug($"GroundStrafing: {firedCells.Count}/{confirmedTargetCells.Count + firedCells.Count} targets fired, " + $"Lateral: {currentLateralOffsetAngle:F1}°, Longitudinal: {currentLongitudinalOffset:F1}"); } } @@ -84,7 +84,7 @@ namespace ArachnaeSwarm if (firedCells.Count == 1) { - Log.Message($"First strafing shot at {targetCell}, " + + ArachnaeLog.Debug($"First strafing shot at {targetCell}, " + $"Lateral offset: {currentLateralOffsetAngle:F1}°, " + $"Longitudinal offset: {currentLongitudinalOffset:F1}"); } @@ -235,7 +235,7 @@ namespace ArachnaeSwarm { if (Props.projectileDef == null) { - Log.Error("No projectile defined for ground strafing"); + ArachnaeLog.Debug("No projectile defined for ground strafing"); return false; } @@ -279,7 +279,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"Error launching ground strafing projectile: {ex}"); + ArachnaeLog.Debug($"Error launching ground strafing projectile: {ex}"); } return false; @@ -320,13 +320,13 @@ namespace ArachnaeSwarm confirmedTargetCells.AddRange(targets); - Log.Message($"GroundStrafing: Set {confirmedTargetCells.Count} targets, " + + ArachnaeLog.Debug($"GroundStrafing: Set {confirmedTargetCells.Count} targets, " + $"Lateral Mode: {Props.lateralOffsetMode}, " + $"Longitudinal Mode: {Props.longitudinalOffsetMode}"); if (confirmedTargetCells.Count > 0) { - Log.Message($"First target: {confirmedTargetCells[0]}, Last target: {confirmedTargetCells[confirmedTargetCells.Count - 1]}"); + ArachnaeLog.Debug($"First target: {confirmedTargetCells[0]}, Last target: {confirmedTargetCells[confirmedTargetCells.Count - 1]}"); } } @@ -345,10 +345,10 @@ namespace ArachnaeSwarm // 修改:调试方法 public void DebugOffsetStatus() { - Log.Message($"GroundStrafing Offset Status:"); - Log.Message($" Lateral - Angle: {currentLateralOffsetAngle:F1}°, Mode: {Props.lateralOffsetMode}"); - Log.Message($" Longitudinal - Offset: {currentLongitudinalOffset:F1}, Mode: {Props.longitudinalOffsetMode}"); - Log.Message($" Shots Fired: {shotsFired}, Forward Phase: {isForwardPhase}"); + ArachnaeLog.Debug($"GroundStrafing Offset Status:"); + ArachnaeLog.Debug($" Lateral - Angle: {currentLateralOffsetAngle:F1}°, Mode: {Props.lateralOffsetMode}"); + ArachnaeLog.Debug($" Longitudinal - Offset: {currentLongitudinalOffset:F1}, Mode: {Props.longitudinalOffsetMode}"); + ArachnaeLog.Debug($" Shots Fired: {shotsFired}, Forward Phase: {isForwardPhase}"); } } diff --git a/Source/ArachnaeSwarm/Flyover/ARA_SectorSurveillance/CompSectorSurveillance.cs b/Source/ArachnaeSwarm/Flyover/ARA_SectorSurveillance/CompSectorSurveillance.cs index 18e3663..6dbb1c6 100644 --- a/Source/ArachnaeSwarm/Flyover/ARA_SectorSurveillance/CompSectorSurveillance.cs +++ b/Source/ArachnaeSwarm/Flyover/ARA_SectorSurveillance/CompSectorSurveillance.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using UnityEngine; using Verse; @@ -52,23 +52,23 @@ namespace ArachnaeSwarm currentLongitudinalOffset = Props.longitudinalInitialOffset; } - Log.Message($"SectorSurveillance: Initialized - Angle: {Props.sectorAngle}°, Range: {Props.sectorRange}, Shots: {Props.shotCount}, Interval: {Props.shotInterval}s"); - Log.Message($"SectorSurveillance: ProjectileDef = {Props.projectileDef?.defName ?? "NULL"}"); - Log.Message($"SectorSurveillance: Parent = {parent?.def?.defName ?? "NULL"} at {parent?.Position.ToString() ?? "NULL"}"); - Log.Message($"SectorSurveillance: Max Projectiles = {Props.maxProjectiles}, Remaining = {remainingProjectiles}"); - Log.Message($"SectorSurveillance: Lateral Mode: {Props.lateralOffsetMode}, Longitudinal Mode: {Props.longitudinalOffsetMode}"); + ArachnaeLog.Debug($"SectorSurveillance: Initialized - Angle: {Props.sectorAngle}°, Range: {Props.sectorRange}, Shots: {Props.shotCount}, Interval: {Props.shotInterval}s"); + ArachnaeLog.Debug($"SectorSurveillance: ProjectileDef = {Props.projectileDef?.defName ?? "NULL"}"); + ArachnaeLog.Debug($"SectorSurveillance: Parent = {parent?.def?.defName ?? "NULL"} at {parent?.Position.ToString() ?? "NULL"}"); + ArachnaeLog.Debug($"SectorSurveillance: Max Projectiles = {Props.maxProjectiles}, Remaining = {remainingProjectiles}"); + ArachnaeLog.Debug($"SectorSurveillance: Lateral Mode: {Props.lateralOffsetMode}, Longitudinal Mode: {Props.longitudinalOffsetMode}"); InitializeFactionCache(); } private void InitializeFactionCache() { - Log.Message($"SectorSurveillance: Initializing faction cache..."); + ArachnaeLog.Debug($"SectorSurveillance: Initializing faction cache..."); if (parent.Faction != null) { cachedFaction = parent.Faction; - Log.Message($"SectorSurveillance: Using parent.Faction: {cachedFaction?.Name ?? "NULL"}"); + ArachnaeLog.Debug($"SectorSurveillance: Using parent.Faction: {cachedFaction?.Name ?? "NULL"}"); } else { @@ -76,21 +76,21 @@ namespace ArachnaeSwarm if (flyOver?.caster != null && flyOver.caster.Faction != null) { cachedFaction = flyOver.caster.Faction; - Log.Message($"SectorSurveillance: Using caster.Faction: {cachedFaction?.Name ?? "NULL"}"); + ArachnaeLog.Debug($"SectorSurveillance: Using caster.Faction: {cachedFaction?.Name ?? "NULL"}"); } else if (flyOver?.faction != null) { cachedFaction = flyOver.faction; - Log.Message($"SectorSurveillance: Using flyOver.faction: {cachedFaction?.Name ?? "NULL"}"); + ArachnaeLog.Debug($"SectorSurveillance: Using flyOver.faction: {cachedFaction?.Name ?? "NULL"}"); } else { - Log.Error($"SectorSurveillance: CRITICAL - No faction found!"); + ArachnaeLog.Debug($"SectorSurveillance: CRITICAL - No faction found!"); } } factionInitialized = true; - Log.Message($"SectorSurveillance: Faction cache initialized: {cachedFaction?.Name ?? "NULL"}"); + ArachnaeLog.Debug($"SectorSurveillance: Faction cache initialized: {cachedFaction?.Name ?? "NULL"}"); } private Faction GetEffectiveFaction() @@ -102,7 +102,7 @@ namespace ArachnaeSwarm if (cachedFaction == null) { - Log.Warning("SectorSurveillance: Cached faction is null, reinitializing..."); + ArachnaeLog.Debug("SectorSurveillance: Cached faction is null, reinitializing..."); InitializeFactionCache(); } @@ -118,8 +118,8 @@ namespace ArachnaeSwarm if (Find.TickManager.TicksGame % 60 == 0) { Faction currentFaction = GetEffectiveFaction(); - Log.Message($"SectorSurveillance Status: Frames={totalFramesProcessed}, TargetsFound={totalTargetsFound}, ShotsFired={totalShotsFired}, ActiveTargets={activeTargets.Count}, Cooldowns={shotCooldowns.Count}, Faction={currentFaction?.Name ?? "NULL"}, RemainingProjectiles={remainingProjectiles}, AmmoExhausted={ammoExhausted}"); - Log.Message($"SectorSurveillance Offsets: Lateral={currentLateralOffsetAngle:F1}°, Longitudinal={currentLongitudinalOffset:F1}, TotalShots={shotsFired}"); + ArachnaeLog.Debug($"SectorSurveillance Status: Frames={totalFramesProcessed}, TargetsFound={totalTargetsFound}, ShotsFired={totalShotsFired}, ActiveTargets={activeTargets.Count}, Cooldowns={shotCooldowns.Count}, Faction={currentFaction?.Name ?? "NULL"}, RemainingProjectiles={remainingProjectiles}, AmmoExhausted={ammoExhausted}"); + ArachnaeLog.Debug($"SectorSurveillance Offsets: Lateral={currentLateralOffsetAngle:F1}°, Longitudinal={currentLongitudinalOffset:F1}, TotalShots={shotsFired}"); } UpdateShotCooldowns(); @@ -165,7 +165,7 @@ namespace ArachnaeSwarm foreach (Pawn pawn in toRemove) { shotCooldowns.Remove(pawn); - Log.Message($"SectorSurveillance: Cooldown finished for {pawn?.Label ?? "NULL"}"); + ArachnaeLog.Debug($"SectorSurveillance: Cooldown finished for {pawn?.Label ?? "NULL"}"); } } @@ -178,11 +178,11 @@ namespace ArachnaeSwarm } List enemiesInSector = GetEnemiesInSector(); - Log.Message($"SectorSurveillance: Found {enemiesInSector.Count} enemies in sector"); + ArachnaeLog.Debug($"SectorSurveillance: Found {enemiesInSector.Count} enemies in sector"); if (enemiesInSector.Count > 0) { - Log.Message($"SectorSurveillance: Enemies in sector: {string.Join(", ", enemiesInSector.ConvertAll(p => p.Label))}"); + ArachnaeLog.Debug($"SectorSurveillance: Enemies in sector: {string.Join(", ", enemiesInSector.ConvertAll(p => p.Label))}"); } foreach (Pawn enemy in enemiesInSector) @@ -194,7 +194,7 @@ namespace ArachnaeSwarm !shotCooldowns.ContainsKey(enemy)) { activeTargets[enemy] = Props.shotCount; - Log.Message($"SectorSurveillance: Starting attack sequence on {enemy.Label} at {enemy.Position} - {Props.shotCount} shots"); + ArachnaeLog.Debug($"SectorSurveillance: Starting attack sequence on {enemy.Label} at {enemy.Position} - {Props.shotCount} shots"); } } } @@ -231,26 +231,26 @@ namespace ArachnaeSwarm if (!IsInSector(enemy.Position)) { - Log.Message($"SectorSurveillance: Target {enemy.Label} left sector, cancelling attack"); + ArachnaeLog.Debug($"SectorSurveillance: Target {enemy.Label} left sector, cancelling attack"); completedTargets.Add(enemy); continue; } if (shotCooldowns.ContainsKey(enemy)) { - Log.Message($"SectorSurveillance: Target {enemy.Label} in cooldown, skipping this frame"); + ArachnaeLog.Debug($"SectorSurveillance: Target {enemy.Label} in cooldown, skipping this frame"); continue; } // 检查剩余射弹数量 if (remainingProjectiles == 0) { - Log.Message($"SectorSurveillance: Ammo exhausted, cannot fire at {enemy.Label}"); + ArachnaeLog.Debug($"SectorSurveillance: Ammo exhausted, cannot fire at {enemy.Label}"); ammoExhausted = true; break; // 跳出循环,不再发射任何射弹 } - Log.Message($"SectorSurveillance: Attempting to fire at {enemy.Label}, remaining shots: {remainingShots}, remaining projectiles: {remainingProjectiles}"); + ArachnaeLog.Debug($"SectorSurveillance: Attempting to fire at {enemy.Label}, remaining shots: {remainingShots}, remaining projectiles: {remainingProjectiles}"); if (LaunchProjectileAt(enemy)) { totalShotsFired++; @@ -261,13 +261,13 @@ namespace ArachnaeSwarm if (remainingProjectiles > 0) { remainingProjectiles--; - Log.Message($"SectorSurveillance: Remaining projectiles: {remainingProjectiles}"); + ArachnaeLog.Debug($"SectorSurveillance: Remaining projectiles: {remainingProjectiles}"); // 检查是否耗尽弹药 if (remainingProjectiles == 0) { ammoExhausted = true; - Log.Message($"SectorSurveillance: AMMO EXHAUSTED - No more projectiles available"); + ArachnaeLog.Debug($"SectorSurveillance: AMMO EXHAUSTED - No more projectiles available"); } } @@ -277,18 +277,18 @@ namespace ArachnaeSwarm int cooldownTicks = Mathf.RoundToInt(Props.shotInterval * 60f); shotCooldowns[enemy] = cooldownTicks; - Log.Message($"SectorSurveillance: Successfully fired at {enemy.Label}, {remainingShots} shots remaining, cooldown: {cooldownTicks} ticks"); + ArachnaeLog.Debug($"SectorSurveillance: Successfully fired at {enemy.Label}, {remainingShots} shots remaining, cooldown: {cooldownTicks} ticks"); if (remainingShots <= 0) { attackedPawns.Add(enemy); completedTargets.Add(enemy); - Log.Message($"SectorSurveillance: Completed attack sequence on {enemy.Label}"); + ArachnaeLog.Debug($"SectorSurveillance: Completed attack sequence on {enemy.Label}"); } } else { - Log.Error($"SectorSurveillance: Failed to fire projectile at {enemy.Label}"); + ArachnaeLog.Debug($"SectorSurveillance: Failed to fire projectile at {enemy.Label}"); } } @@ -299,13 +299,13 @@ namespace ArachnaeSwarm if (enemy != null) { activeTargets.Remove(enemy); - Log.Message($"SectorSurveillance: Removed {enemy.Label} from active targets"); + ArachnaeLog.Debug($"SectorSurveillance: Removed {enemy.Label} from active targets"); } else { // 如果目标已不存在,直接从字典中移除对应的键 activeTargets.Remove(enemy); - Log.Message($"SectorSurveillance: Removed null target from active targets"); + ArachnaeLog.Debug($"SectorSurveillance: Removed null target from active targets"); } } } @@ -448,14 +448,14 @@ namespace ArachnaeSwarm if (map == null) { - Log.Error("SectorSurveillance: Map is null!"); + ArachnaeLog.Debug("SectorSurveillance: Map is null!"); return enemies; } FlyOver flyOver = parent as FlyOver; if (flyOver == null) { - Log.Error("SectorSurveillance: Parent is not a FlyOver!"); + ArachnaeLog.Debug("SectorSurveillance: Parent is not a FlyOver!"); return enemies; } @@ -464,7 +464,7 @@ namespace ArachnaeSwarm float range = Props.sectorRange; float halfAngle = Props.sectorAngle * 0.5f; - Log.Message($"SectorSurveillance: Checking sector - Center: {center}, Direction: {flightDirection}, Range: {range}, HalfAngle: {halfAngle}"); + ArachnaeLog.Debug($"SectorSurveillance: Checking sector - Center: {center}, Direction: {flightDirection}, Range: {range}, HalfAngle: {halfAngle}"); int totalEnemiesChecked = 0; @@ -480,12 +480,12 @@ namespace ArachnaeSwarm if (inSector) { enemies.Add(pawn); - Log.Message($"SectorSurveillance: Valid target found - {pawn.Label} at {pawn.Position}, in sector: {inSector}"); + ArachnaeLog.Debug($"SectorSurveillance: Valid target found - {pawn.Label} at {pawn.Position}, in sector: {inSector}"); } } } - Log.Message($"SectorSurveillance: Checked {totalEnemiesChecked} pawns, found {enemies.Count} valid targets in sector"); + ArachnaeLog.Debug($"SectorSurveillance: Checked {totalEnemiesChecked} pawns, found {enemies.Count} valid targets in sector"); return enemies; } @@ -493,32 +493,32 @@ namespace ArachnaeSwarm { if (pawn == null) { - Log.Message("SectorSurveillance: IsValidTarget - pawn is null"); + ArachnaeLog.Debug("SectorSurveillance: IsValidTarget - pawn is null"); return false; } // 关键修复:检查pawn是否已被销毁或死亡 if (pawn.Destroyed || pawn.Dead || !pawn.Spawned) { - Log.Message($"SectorSurveillance: IsValidTarget - {pawn.Label} is destroyed/dead/unspawned"); + ArachnaeLog.Debug($"SectorSurveillance: IsValidTarget - {pawn.Label} is destroyed/dead/unspawned"); return false; } if (pawn.Downed) { - Log.Message($"SectorSurveillance: IsValidTarget - {pawn.Label} is downed"); + ArachnaeLog.Debug($"SectorSurveillance: IsValidTarget - {pawn.Label} is downed"); return false; } Faction effectiveFaction = GetEffectiveFaction(); if (effectiveFaction == null) { - Log.Error($"SectorSurveillance: IsValidTarget - No effective faction found for {pawn.Label}"); + ArachnaeLog.Debug($"SectorSurveillance: IsValidTarget - No effective faction found for {pawn.Label}"); return false; } bool hostile = pawn.HostileTo(effectiveFaction); - Log.Message($"SectorSurveillance: IsValidTarget - {pawn.Label} from {pawn.Faction?.Name ?? "NULL"} is hostile to {effectiveFaction.Name}: {hostile}"); + ArachnaeLog.Debug($"SectorSurveillance: IsValidTarget - {pawn.Label} from {pawn.Faction?.Name ?? "NULL"} is hostile to {effectiveFaction.Name}: {hostile}"); return hostile; } @@ -528,7 +528,7 @@ namespace ArachnaeSwarm FlyOver flyOver = parent as FlyOver; if (flyOver == null) { - Log.Error("SectorSurveillance: IsInSector - Parent is not a FlyOver!"); + ArachnaeLog.Debug("SectorSurveillance: IsInSector - Parent is not a FlyOver!"); return false; } @@ -539,7 +539,7 @@ namespace ArachnaeSwarm float distance = targetVector.magnitude; if (distance > Props.sectorRange) { - Log.Message($"SectorSurveillance: IsInSector - Target at {targetPos} is out of range: {distance:F1} > {Props.sectorRange}"); + ArachnaeLog.Debug($"SectorSurveillance: IsInSector - Target at {targetPos} is out of range: {distance:F1} > {Props.sectorRange}"); return false; } @@ -548,7 +548,7 @@ namespace ArachnaeSwarm bool inAngle = angle <= Props.sectorAngle * 0.5f; - Log.Message($"SectorSurveillance: IsInSector - Target at {targetPos}, distance: {distance:F1}, angle: {angle:F1}°, inAngle: {inAngle}"); + ArachnaeLog.Debug($"SectorSurveillance: IsInSector - Target at {targetPos}, distance: {distance:F1}, angle: {angle:F1}°, inAngle: {inAngle}"); return inAngle; } @@ -557,11 +557,11 @@ namespace ArachnaeSwarm { if (Props.projectileDef == null) { - Log.Error("SectorSurveillance: No projectile defined for sector surveillance"); + ArachnaeLog.Debug("SectorSurveillance: No projectile defined for sector surveillance"); return false; } - Log.Message($"SectorSurveillance: LaunchProjectileAt - Starting launch for target {target?.Label ?? "NULL"}"); + ArachnaeLog.Debug($"SectorSurveillance: LaunchProjectileAt - Starting launch for target {target?.Label ?? "NULL"}"); try { @@ -574,33 +574,33 @@ namespace ArachnaeSwarm IntVec3 spawnCell = offsetSpawnPos.ToIntVec3(); - Log.Message($"SectorSurveillance: Spawn position - World: {offsetSpawnPos}, Cell: {spawnCell}, Lateral Offset: {currentLateralOffsetAngle:F1}°, Longitudinal Offset: {currentLongitudinalOffset:F1}"); + ArachnaeLog.Debug($"SectorSurveillance: Spawn position - World: {offsetSpawnPos}, Cell: {spawnCell}, Lateral Offset: {currentLateralOffsetAngle:F1}°, Longitudinal Offset: {currentLongitudinalOffset:F1}"); if (parent.Map == null) { - Log.Error("SectorSurveillance: Map is null during projectile launch"); + ArachnaeLog.Debug("SectorSurveillance: Map is null during projectile launch"); return false; } if (!spawnCell.InBounds(parent.Map)) { - Log.Error($"SectorSurveillance: Spawn cell {spawnCell} is out of bounds"); + ArachnaeLog.Debug($"SectorSurveillance: Spawn cell {spawnCell} is out of bounds"); return false; } - Log.Message($"SectorSurveillance: Attempting to spawn projectile: {Props.projectileDef.defName}"); + ArachnaeLog.Debug($"SectorSurveillance: Attempting to spawn projectile: {Props.projectileDef.defName}"); Projectile projectile = (Projectile)GenSpawn.Spawn(Props.projectileDef, spawnCell, parent.Map); if (projectile != null) { - Log.Message($"SectorSurveillance: Projectile spawned successfully: {projectile}"); + ArachnaeLog.Debug($"SectorSurveillance: Projectile spawned successfully: {projectile}"); Thing launcher = GetLauncher(); Vector3 launchPos = offsetSpawnPos; LocalTargetInfo targetInfo = new LocalTargetInfo(target); - Log.Message($"SectorSurveillance: Launching projectile - Launcher: {launcher?.def?.defName ?? "NULL"}, LaunchPos: {launchPos}, Target: {targetInfo.Cell}"); + ArachnaeLog.Debug($"SectorSurveillance: Launching projectile - Launcher: {launcher?.def?.defName ?? "NULL"}, LaunchPos: {launchPos}, Target: {targetInfo.Cell}"); projectile.Launch( launcher, @@ -617,19 +617,19 @@ namespace ArachnaeSwarm CreateOffsetEffect(offsetSpawnPos, directionToTarget); } - Log.Message($"SectorSurveillance: Projectile launched successfully"); + ArachnaeLog.Debug($"SectorSurveillance: Projectile launched successfully"); return true; } else { - Log.Error("SectorSurveillance: Failed to spawn projectile - GenSpawn.Spawn returned null"); + ArachnaeLog.Debug("SectorSurveillance: Failed to spawn projectile - GenSpawn.Spawn returned null"); return false; } } catch (System.Exception ex) { - Log.Error($"SectorSurveillance: Exception launching projectile: {ex}"); - Log.Error($"SectorSurveillance: Stack trace: {ex.StackTrace}"); + ArachnaeLog.Debug($"SectorSurveillance: Exception launching projectile: {ex}"); + ArachnaeLog.Debug($"SectorSurveillance: Stack trace: {ex.StackTrace}"); return false; } } @@ -653,11 +653,11 @@ namespace ArachnaeSwarm FlyOver flyOver = parent as FlyOver; if (flyOver != null && flyOver.caster != null) { - Log.Message($"SectorSurveillance: Using caster as launcher: {flyOver.caster.Label}"); + ArachnaeLog.Debug($"SectorSurveillance: Using caster as launcher: {flyOver.caster.Label}"); return flyOver.caster; } - Log.Message($"SectorSurveillance: Using parent as launcher: {parent.Label}"); + ArachnaeLog.Debug($"SectorSurveillance: Using parent as launcher: {parent.Label}"); return parent; } @@ -732,10 +732,10 @@ namespace ArachnaeSwarm // 新增:调试方法 public void DebugOffsetStatus() { - Log.Message($"SectorSurveillance Offset Status:"); - Log.Message($" Lateral - Angle: {currentLateralOffsetAngle:F1}°, Mode: {Props.lateralOffsetMode}"); - Log.Message($" Longitudinal - Offset: {currentLongitudinalOffset:F1}, Mode: {Props.longitudinalOffsetMode}"); - Log.Message($" Shots Fired: {shotsFired}, Forward Phase: {isForwardPhase}"); + ArachnaeLog.Debug($"SectorSurveillance Offset Status:"); + ArachnaeLog.Debug($" Lateral - Angle: {currentLateralOffsetAngle:F1}°, Mode: {Props.lateralOffsetMode}"); + ArachnaeLog.Debug($" Longitudinal - Offset: {currentLongitudinalOffset:F1}, Mode: {Props.longitudinalOffsetMode}"); + ArachnaeLog.Debug($" Shots Fired: {shotsFired}, Forward Phase: {isForwardPhase}"); } } diff --git a/Source/ArachnaeSwarm/Flyover/ARA_SendLetterAfterTicks/CompSendLetterAfterTicks.cs b/Source/ArachnaeSwarm/Flyover/ARA_SendLetterAfterTicks/CompSendLetterAfterTicks.cs index d184b66..921964a 100644 --- a/Source/ArachnaeSwarm/Flyover/ARA_SendLetterAfterTicks/CompSendLetterAfterTicks.cs +++ b/Source/ArachnaeSwarm/Flyover/ARA_SendLetterAfterTicks/CompSendLetterAfterTicks.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; namespace ArachnaeSwarm @@ -43,7 +43,7 @@ namespace ArachnaeSwarm // 检查是否有有效的信件内容 if (Props.letterLabel.NullOrEmpty() && Props.letterText.NullOrEmpty()) { - Log.Warning($"CompSendLetterAfterTicks: No letter content defined for {parent.def.defName}"); + ArachnaeLog.Debug($"CompSendLetterAfterTicks: No letter content defined for {parent.def.defName}"); return; } @@ -63,11 +63,11 @@ namespace ArachnaeSwarm letterSent = true; - Log.Message($"Letter sent from {parent.def.defName} after {ticksPassed} ticks"); + ArachnaeLog.Debug($"Letter sent from {parent.def.defName} after {ticksPassed} ticks"); } catch (System.Exception ex) { - Log.Error($"Error sending letter from {parent.def.defName}: {ex}"); + ArachnaeLog.Debug($"Error sending letter from {parent.def.defName}: {ex}"); } } diff --git a/Source/ArachnaeSwarm/Flyover/ARA_ShipArtillery/CompShipArtillery.cs b/Source/ArachnaeSwarm/Flyover/ARA_ShipArtillery/CompShipArtillery.cs index 8d1fe22..6f788cd 100644 --- a/Source/ArachnaeSwarm/Flyover/ARA_ShipArtillery/CompShipArtillery.cs +++ b/Source/ArachnaeSwarm/Flyover/ARA_ShipArtillery/CompShipArtillery.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -30,7 +30,7 @@ namespace ArachnaeSwarm ticksUntilNextAttack = Props.ticksBetweenAttacks; - Log.Message($"Ship Artillery initialized: {Props.ticksBetweenAttacks} ticks between attacks, {Props.attackRadius} radius"); + ArachnaeLog.Debug($"Ship Artillery initialized: {Props.ticksBetweenAttacks} ticks between attacks, {Props.attackRadius} radius"); } public override void CompTick() @@ -75,12 +75,12 @@ namespace ArachnaeSwarm if (!currentTarget.IsValid || !currentTarget.InBounds(flyOver.Map)) { - Log.Warning("Ship Artillery: Invalid target selected, skipping attack"); + ArachnaeLog.Debug("Ship Artillery: Invalid target selected, skipping attack"); ticksUntilNextAttack = Props.ticksBetweenAttacks; return; } - Log.Message($"Ship Artillery starting attack on target area: {currentTarget} (attack radius: {Props.attackRadius})"); + ArachnaeLog.Debug($"Ship Artillery starting attack on target area: {currentTarget} (attack radius: {Props.attackRadius})"); // 开始预热 isWarmingUp = true; @@ -133,7 +133,7 @@ namespace ArachnaeSwarm attackEffecter = Props.attackEffect.Spawn(); } - Log.Message($"Ship Artillery started firing at area {currentTarget}"); + ArachnaeLog.Debug($"Ship Artillery started firing at area {currentTarget}"); // 发送攻击通知 if (Props.sendAttackLetter) @@ -191,7 +191,7 @@ namespace ArachnaeSwarm ThingDef shellDef = SelectShellDef(); if (shellDef == null) { - Log.Error("Ship Artillery: No valid shell def found"); + ArachnaeLog.Debug("Ship Artillery: No valid shell def found"); return; } @@ -202,7 +202,7 @@ namespace ArachnaeSwarm SkyfallerMaker.SpawnSkyfaller(shellDef, shellTarget, flyOver.Map); float distanceFromCenter = shellTarget.DistanceTo(currentTarget); - Log.Message($"Ship Artillery fired shell at {shellTarget} (distance from center: {distanceFromCenter:F1})"); + ArachnaeLog.Debug($"Ship Artillery fired shell at {shellTarget} (distance from center: {distanceFromCenter:F1})"); // 播放音效 if (Props.attackSound != null) @@ -212,7 +212,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"Error firing ship artillery shell: {ex}"); + ArachnaeLog.Debug($"Error firing ship artillery shell: {ex}"); } } @@ -260,7 +260,7 @@ namespace ArachnaeSwarm IntVec3 flyOverPos = GetFlyOverPosition(flyOver); IntVec3 center = flyOverPos + Props.targetOffset; - Log.Message($"FlyOver position: {flyOverPos}, Center for targeting: {center}"); + ArachnaeLog.Debug($"FlyOver position: {flyOverPos}, Center for targeting: {center}"); // 在攻击半径内选择随机目标 return FindRandomTargetInRadius(center, flyOver.Map, Props.attackRadius); @@ -289,7 +289,7 @@ namespace ArachnaeSwarm // 目标查找逻辑 - 基于攻击半径 private IntVec3 FindRandomTargetInRadius(IntVec3 center, Map map, float radius) { - Log.Message($"Finding target around {center} with radius {radius}"); + ArachnaeLog.Debug($"Finding target around {center} with radius {radius}"); // 如果半径为0,直接返回中心 if (radius <= 0) @@ -318,11 +318,11 @@ namespace ArachnaeSwarm previousTargets.Add(potentialTarget); float actualDistance = potentialTarget.DistanceTo(center); - Log.Message($"Found valid target at {potentialTarget} (distance from center: {actualDistance:F1})"); + ArachnaeLog.Debug($"Found valid target at {potentialTarget} (distance from center: {actualDistance:F1})"); if (ignoreProtectionForThisTarget) { - Log.Warning($"Protection ignored for target selection! May target player assets."); + ArachnaeLog.Debug($"Protection ignored for target selection! May target player assets."); } return potentialTarget; @@ -331,7 +331,7 @@ namespace ArachnaeSwarm } // 回退:使用地图随机位置 - Log.Warning("Could not find valid target in radius, using fallback"); + ArachnaeLog.Debug("Could not find valid target in radius, using fallback"); CellRect mapRect = CellRect.WholeMap(map); for (int i = 0; i < 10; i++) { @@ -437,7 +437,7 @@ namespace ArachnaeSwarm ticksUntilNextAttack = Props.ticksBetweenAttacks; } - Log.Message($"Ship Artillery attack ended"); + ArachnaeLog.Debug($"Ship Artillery attack ended"); } private void SendAttackLetter(FlyOver flyOver) @@ -456,7 +456,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"Error sending ship artillery letter: {ex}"); + ArachnaeLog.Debug($"Error sending ship artillery letter: {ex}"); } } @@ -502,8 +502,8 @@ namespace ArachnaeSwarm if (parent is FlyOver flyOver) { IntVec3 flyOverPos = GetFlyOverPosition(flyOver); - Log.Message($"FlyOver - DrawPos: {flyOver.DrawPos}, Position: {flyOver.Position}, Calculated: {flyOverPos}"); - Log.Message($"Current Target: {currentTarget}, Distance: {flyOverPos.DistanceTo(currentTarget):F1}"); + ArachnaeLog.Debug($"FlyOver - DrawPos: {flyOver.DrawPos}, Position: {flyOver.Position}, Calculated: {flyOverPos}"); + ArachnaeLog.Debug($"Current Target: {currentTarget}, Distance: {flyOverPos.DistanceTo(currentTarget):F1}"); } } }; diff --git a/Source/ArachnaeSwarm/Flyover/ARA_SpawnFlyOver/CompAbilityEffect_SpawnFlyOver.cs b/Source/ArachnaeSwarm/Flyover/ARA_SpawnFlyOver/CompAbilityEffect_SpawnFlyOver.cs index 2ab3f55..1b1c6cb 100644 --- a/Source/ArachnaeSwarm/Flyover/ARA_SpawnFlyOver/CompAbilityEffect_SpawnFlyOver.cs +++ b/Source/ArachnaeSwarm/Flyover/ARA_SpawnFlyOver/CompAbilityEffect_SpawnFlyOver.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -19,8 +19,8 @@ namespace ArachnaeSwarm try { - Log.Message($"FlyOver skill activated by {parent.pawn.Label} at position {parent.pawn.Position}"); - Log.Message($"Target cell: {target.Cell}, Dest: {dest.Cell}"); + ArachnaeLog.Debug($"FlyOver skill activated by {parent.pawn.Label} at position {parent.pawn.Position}"); + ArachnaeLog.Debug($"Target cell: {target.Cell}, Dest: {dest.Cell}"); // 计算起始和结束位置 IntVec3 startPos, endPos; @@ -40,25 +40,25 @@ namespace ArachnaeSwarm startPos = GetSafeMapPosition(startPos, parent.pawn.Map); endPos = GetSafeMapPosition(endPos, parent.pawn.Map); - Log.Message($"Final positions - Start: {startPos}, End: {endPos}"); + ArachnaeLog.Debug($"Final positions - Start: {startPos}, End: {endPos}"); // 验证位置是否有效 if (!startPos.InBounds(parent.pawn.Map)) { - Log.Warning($"Start position {startPos} is out of bounds, adjusting to map center"); + ArachnaeLog.Debug($"Start position {startPos} is out of bounds, adjusting to map center"); startPos = parent.pawn.Map.Center; } if (!endPos.InBounds(parent.pawn.Map)) { - Log.Warning($"End position {endPos} is out of bounds, adjusting to map center"); + ArachnaeLog.Debug($"End position {endPos} is out of bounds, adjusting to map center"); endPos = parent.pawn.Map.Center; } // 确保起点和终点不同 if (startPos == endPos) { - Log.Warning($"FlyOver start and end positions are the same: {startPos}. Adjusting end position."); + ArachnaeLog.Debug($"FlyOver start and end positions are the same: {startPos}. Adjusting end position."); IntVec3 randomOffset = new IntVec3(Rand.Range(-10, 11), 0, Rand.Range(-10, 11)); endPos += randomOffset; endPos = GetSafeMapPosition(endPos, parent.pawn.Map); @@ -81,7 +81,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"Error spawning fly over: {ex}"); + ArachnaeLog.Debug($"Error spawning fly over: {ex}"); } } @@ -240,7 +240,7 @@ namespace ArachnaeSwarm } } - Log.Message($"Strafing Area: Calculated {cells.Count} impact cells centered at {targetCell}"); + ArachnaeLog.Debug($"Strafing Area: Calculated {cells.Count} impact cells centered at {targetCell}"); return cells; } @@ -422,7 +422,7 @@ namespace ArachnaeSwarm } } - Log.Message($"Strafing Preprocess: {confirmedTargets.Count}/{potentialTargets.Count} cells confirmed after min/max adjustment."); + ArachnaeLog.Debug($"Strafing Preprocess: {confirmedTargets.Count}/{potentialTargets.Count} cells confirmed after min/max adjustment."); return confirmedTargets; } @@ -432,7 +432,7 @@ namespace ArachnaeSwarm ThingDef flyOverDef = Props.flyOverDef ?? DefDatabase.GetNamedSilentFail("ARA_HiveCorvette"); if (flyOverDef == null) { - Log.Warning("No fly over def specified for ground strafing fly over"); + ArachnaeLog.Debug("No fly over def specified for ground strafing fly over"); return; } @@ -472,17 +472,17 @@ namespace ArachnaeSwarm } else { - Log.Warning("No confirmed target cells after preprocessing!"); + ArachnaeLog.Debug("No confirmed target cells after preprocessing!"); } } else { - Log.Error("No potential target cells calculated for ground strafing!"); + ArachnaeLog.Debug("No potential target cells calculated for ground strafing!"); } } else { - Log.Error("FlyOver def does not have CompGroundStrafing component!"); + ArachnaeLog.Debug("FlyOver def does not have CompGroundStrafing component!"); } } @@ -492,7 +492,7 @@ namespace ArachnaeSwarm ThingDef flyOverDef = Props.flyOverDef ?? DefDatabase.GetNamedSilentFail("ARA_HiveCorvette"); if (flyOverDef == null) { - Log.Warning("No fly over def specified for sector surveillance fly over"); + ArachnaeLog.Debug("No fly over def specified for sector surveillance fly over"); return; } @@ -510,7 +510,7 @@ namespace ArachnaeSwarm flyOver.spawnContentsOnImpact = Props.dropContentsOnImpact; flyOver.playFlyOverSound = Props.playFlyOverSound; - Log.Message($"SectorSurveillance FlyOver created: {flyOver} from {startPos} to {endPos}"); + ArachnaeLog.Debug($"SectorSurveillance FlyOver created: {flyOver} from {startPos} to {endPos}"); } // 计算垂直线进场路径 @@ -520,7 +520,7 @@ namespace ArachnaeSwarm IntVec3 casterPos = parent.pawn.Position; IntVec3 targetPos = target.Cell; - Log.Message($"Calculating perpendicular path: Caster={casterPos}, Target={targetPos}"); + ArachnaeLog.Debug($"Calculating perpendicular path: Caster={casterPos}, Target={targetPos}"); // 计算施法者到目标的方向向量 Vector3 directionToTarget = (targetPos.ToVector3() - casterPos.ToVector3()).normalized; @@ -529,13 +529,13 @@ namespace ArachnaeSwarm if (directionToTarget == Vector3.zero) { directionToTarget = new Vector3(Rand.Range(-1f, 1f), 0, Rand.Range(-1f, 1f)).normalized; - Log.Message($"Using random direction: {directionToTarget}"); + ArachnaeLog.Debug($"Using random direction: {directionToTarget}"); } // 计算垂直于施法者-目标连线的方向(旋转90度) Vector3 perpendicularDirection = new Vector3(-directionToTarget.z, 0, directionToTarget.x).normalized; - Log.Message($"Perpendicular direction: {perpendicularDirection}"); + ArachnaeLog.Debug($"Perpendicular direction: {perpendicularDirection}"); // 从目标点出发,向垂直方向的两侧延伸找到地图边缘 IntVec3 edge1 = FindMapEdgeInDirection(map, targetPos, perpendicularDirection); @@ -553,7 +553,7 @@ namespace ArachnaeSwarm endPos = edge1; } - Log.Message($"Perpendicular path: {startPos} -> {targetPos} -> {endPos}"); + ArachnaeLog.Debug($"Perpendicular path: {startPos} -> {targetPos} -> {endPos}"); } // 在指定方向上找到地图边缘 @@ -660,7 +660,7 @@ namespace ArachnaeSwarm } // 如果没找到合适的边界点,使用随机边缘位置 - Log.Warning($"Could not find map edge in direction {direction}, using random edge"); + ArachnaeLog.Debug($"Could not find map edge in direction {direction}, using random edge"); return GetRandomMapEdgePosition(map); } @@ -713,7 +713,7 @@ namespace ArachnaeSwarm case EndPosition.RandomMapEdge: endPos = GetRandomMapEdgePosition(map); - Log.Message($"Random map edge selected as end position: {endPos}"); + ArachnaeLog.Debug($"Random map edge selected as end position: {endPos}"); break; default: @@ -733,13 +733,13 @@ namespace ArachnaeSwarm if (toCenter == Vector3.zero) { toCenter = new Vector3(Rand.Range(-1f, 1f), 0, Rand.Range(-1f, 1f)).normalized; - Log.Message($"Using random direction to center: {toCenter}"); + ArachnaeLog.Debug($"Using random direction to center: {toCenter}"); } Vector3 fromCenter = toCenter; IntVec3 oppositeEdge = GetMapEdgePositionFromCenter(map, fromCenter); - Log.Message($"Found opposite edge through center: {oppositeEdge}"); + ArachnaeLog.Debug($"Found opposite edge through center: {oppositeEdge}"); return oppositeEdge; } @@ -758,12 +758,12 @@ namespace ArachnaeSwarm if (!testPos.InBounds(map)) { IntVec3 edgePos = FindClosestValidPosition(testPos, map); - Log.Message($"Found map edge from center: {edgePos} (direction: {direction}, distance: {i})"); + ArachnaeLog.Debug($"Found map edge from center: {edgePos} (direction: {direction}, distance: {i})"); return edgePos; } } - Log.Warning("Could not find map edge from center, using random edge"); + ArachnaeLog.Debug("Could not find map edge from center, using random edge"); return GetRandomMapEdgePosition(map); } @@ -772,7 +772,7 @@ namespace ArachnaeSwarm if (direction == Vector3.zero) { direction = new Vector3(Rand.Range(-1f, 1f), 0, Rand.Range(-1f, 1f)).normalized; - Log.Message($"Using random direction: {direction}"); + ArachnaeLog.Debug($"Using random direction: {direction}"); } IntVec3 center = map.Center; @@ -788,12 +788,12 @@ namespace ArachnaeSwarm if (!testPos.InBounds(map)) { IntVec3 edgePos = FindClosestValidPosition(testPos, map); - Log.Message($"Found map edge position: {edgePos} (direction: {direction}, distance: {i})"); + ArachnaeLog.Debug($"Found map edge position: {edgePos} (direction: {direction}, distance: {i})"); return edgePos; } } - Log.Warning("Could not find map edge in direction, using random edge"); + ArachnaeLog.Debug("Could not find map edge in direction, using random edge"); return GetRandomMapEdgePosition(map); } @@ -841,7 +841,7 @@ namespace ArachnaeSwarm } IntVec3 edgePos = new IntVec3(x, 0, z); - Log.Message($"Random map edge position: {edgePos}"); + ArachnaeLog.Debug($"Random map edge position: {edgePos}"); return edgePos; } @@ -853,7 +853,7 @@ namespace ArachnaeSwarm 0, (int)(direction.z * Props.flyOverDistance)); - Log.Message($"Fixed distance position: {endPos} (from {startPos}, distance: {Props.flyOverDistance})"); + ArachnaeLog.Debug($"Fixed distance position: {endPos} (from {startPos}, distance: {Props.flyOverDistance})"); return endPos; } @@ -864,7 +864,7 @@ namespace ArachnaeSwarm if (direction == Vector3.zero) { direction = new Vector3(Rand.Range(-1f, 1f), 0, Rand.Range(-1f, 1f)).normalized; - Log.Message($"Using random direction: {direction}"); + ArachnaeLog.Debug($"Using random direction: {direction}"); } return direction; @@ -875,7 +875,7 @@ namespace ArachnaeSwarm ThingDef flyOverDef = Props.flyOverDef ?? DefDatabase.GetNamedSilentFail("ARA_HiveShip"); if (flyOverDef == null) { - Log.Warning("No fly over def specified for standard fly over"); + ArachnaeLog.Debug("No fly over def specified for standard fly over"); return; } @@ -896,7 +896,7 @@ namespace ArachnaeSwarm // 自定义音效逻辑 } - Log.Message($"Standard FlyOver created: {flyOver} from {startPos} to {endPos}"); + ArachnaeLog.Debug($"Standard FlyOver created: {flyOver} from {startPos} to {endPos}"); } // 更新技能提示信息 diff --git a/Source/ArachnaeSwarm/Flyover/ThingclassFlyOver.cs b/Source/ArachnaeSwarm/Flyover/ThingclassFlyOver.cs index f181d55..240c682 100644 --- a/Source/ArachnaeSwarm/Flyover/ThingclassFlyOver.cs +++ b/Source/ArachnaeSwarm/Flyover/ThingclassFlyOver.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using UnityEngine; using Verse; @@ -286,10 +286,10 @@ namespace ArachnaeSwarm { base.SpawnSetup(map, respawningAfterLoad); - Log.Message($"FlyOver Spawned - Start: {startPosition}, End: {endPosition}, Speed: {flightSpeed}, Altitude: {altitude}"); + ArachnaeLog.Debug($"FlyOver Spawned - Start: {startPosition}, End: {endPosition}, Speed: {flightSpeed}, Altitude: {altitude}"); if (!respawningAfterLoad) { - Log.Message($"FlyOver Direction - Vector: {MovementDirection}, Rotation: {ExactRotation.eulerAngles}"); + ArachnaeLog.Debug($"FlyOver Direction - Vector: {MovementDirection}, Rotation: {ExactRotation.eulerAngles}"); // 设置初始位置 base.Position = startPosition; @@ -318,14 +318,14 @@ namespace ArachnaeSwarm approachOffsetDistance = extension.approachOffsetDistance; } - Log.Message($"FlyOver approach animation: {useApproachAnimation}, duration: {approachDuration}s, offset: {approachOffsetDistance}"); + ArachnaeLog.Debug($"FlyOver approach animation: {useApproachAnimation}, duration: {approachDuration}s, offset: {approachOffsetDistance}"); // 开始飞行音效 if (playFlyOverSound && def.skyfaller?.floatingSound != null) { flightSoundPlaying = def.skyfaller.floatingSound.TrySpawnSustainer( SoundInfo.InMap(new TargetInfo(startPosition, map), MaintenanceType.PerTick)); - Log.Message("FlyOver sound started"); + ArachnaeLog.Debug("FlyOver sound started"); } } } @@ -345,7 +345,7 @@ namespace ArachnaeSwarm { approachCompleted = true; currentApproachTime = approachDuration; - Log.Message("FlyOver approach animation completed"); + ArachnaeLog.Debug("FlyOver approach animation completed"); } } @@ -377,7 +377,7 @@ namespace ArachnaeSwarm { fadeOutCompleted = true; currentFadeOutTime = fadeOutDuration; - Log.Message("FlyOver fade out completed"); + ArachnaeLog.Debug("FlyOver fade out completed"); } } @@ -405,7 +405,7 @@ namespace ArachnaeSwarm // 基于剩余距离动态计算淡出持续时间 fadeOutDuration = CalculateDynamicFadeOutDuration(); - Log.Message($"FlyOver started fade out at progress {currentProgress:F2}, duration: {fadeOutDuration:F2}s, remaining time: {RemainingFlightTime:F2}s"); + ArachnaeLog.Debug($"FlyOver started fade out at progress {currentProgress:F2}, duration: {fadeOutDuration:F2}s, remaining time: {RemainingFlightTime:F2}s"); } private void UpdatePosition() @@ -450,7 +450,7 @@ namespace ArachnaeSwarm SoundInfo.InMap(new TargetInfo(endPosition, base.Map))); } - Log.Message($"FlyOver completed at {endPosition}"); + ArachnaeLog.Debug($"FlyOver completed at {endPosition}"); // 销毁自身 Destroy(); @@ -464,7 +464,7 @@ namespace ArachnaeSwarm // 如果还没有开始淡出,使用默认淡出时间 fadeOutStarted = true; fadeOutDuration = defaultFadeOutDuration; - Log.Message($"FlyOver emergency destroy with default fade out: {defaultFadeOutDuration}s"); + ArachnaeLog.Debug($"FlyOver emergency destroy with default fade out: {defaultFadeOutDuration}s"); } // 设置标记,下一帧会处理淡出 @@ -652,11 +652,11 @@ namespace ArachnaeSwarm if (casterPawn != null && casterPawn.Faction != null) { flyOver.faction = casterPawn.Faction; - Log.Message($"FlyOver faction set to: {casterPawn.Faction.Name}"); + ArachnaeLog.Debug($"FlyOver faction set to: {casterPawn.Faction.Name}"); } else { - Log.Warning($"FlyOver: Cannot set faction - casterPawn: {casterPawn?.Label ?? "NULL"}, casterFaction: {casterPawn?.Faction?.Name ?? "NULL"}"); + ArachnaeLog.Debug($"FlyOver: Cannot set faction - casterPawn: {casterPawn?.Label ?? "NULL"}, casterFaction: {casterPawn?.Faction?.Name ?? "NULL"}"); } if (contents != null) @@ -666,7 +666,7 @@ namespace ArachnaeSwarm GenSpawn.Spawn(flyOver, start, map); - Log.Message($"FlyOver created: {flyOver} from {start} to {end} at altitude {height}, Faction: {flyOver.faction?.Name ?? "NULL"}"); + ArachnaeLog.Debug($"FlyOver created: {flyOver} from {start} to {end} at altitude {height}, Faction: {flyOver.faction?.Name ?? "NULL"}"); return flyOver; } } diff --git a/Source/ArachnaeSwarm/Hediffs/ARA_ConfigurableMutant/Hediff_ConfigurableMutant.cs b/Source/ArachnaeSwarm/Hediffs/ARA_ConfigurableMutant/Hediff_ConfigurableMutant.cs index 5cb0165..0b9d6ae 100644 --- a/Source/ArachnaeSwarm/Hediffs/ARA_ConfigurableMutant/Hediff_ConfigurableMutant.cs +++ b/Source/ArachnaeSwarm/Hediffs/ARA_ConfigurableMutant/Hediff_ConfigurableMutant.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using UnityEngine; using Verse; @@ -171,13 +171,13 @@ namespace ArachnaeSwarm var compProps = PropsComp?.Props; if (compProps?.risingHediff == null) { - Log.Error($"[ConfigurableMutant] risingHediff is not defined in XML for {this.def.defName}"); + ArachnaeLog.Debug($"[ConfigurableMutant] risingHediff is not defined in XML for {this.def.defName}"); return; } if (!pawn.Dead && !pawn.Downed) { - Log.Error("Tried to raise non dead/downed pawn as shambler"); + ArachnaeLog.Debug("Tried to raise non dead/downed pawn as shambler"); if(pawn.mutant != null) pawn.mutant.Turn(clearLord: true); return; } diff --git a/Source/ArachnaeSwarm/Hediffs/ARA_ConfigurableMutant/Hediff_NecroticVirus_Configurable.cs b/Source/ArachnaeSwarm/Hediffs/ARA_ConfigurableMutant/Hediff_NecroticVirus_Configurable.cs index f622e97..9e61685 100644 --- a/Source/ArachnaeSwarm/Hediffs/ARA_ConfigurableMutant/Hediff_NecroticVirus_Configurable.cs +++ b/Source/ArachnaeSwarm/Hediffs/ARA_ConfigurableMutant/Hediff_NecroticVirus_Configurable.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using UnityEngine; using System.Linq; @@ -44,7 +44,7 @@ namespace ArachnaeSwarm var comp = PropsComp; if (comp == null || comp.Props.mutantDef == null) { - Log.Error($"[NecroticVirus] HediffComp_NecroticTransformation or its mutantDef is not configured in XML for {this.def.defName}."); + ArachnaeLog.Debug($"[NecroticVirus] HediffComp_NecroticTransformation or its mutantDef is not configured in XML for {this.def.defName}."); return; } @@ -67,7 +67,7 @@ namespace ArachnaeSwarm // 使用我们自己的、更安全的检查方法 if (!NecroticTransformationUtility.CanResurrect(pawn.Corpse)) { - Log.Warning($"[NecroticVirus] Pawn {pawn.LabelShort} does not meet conditions for resurrection."); + ArachnaeLog.Debug($"[NecroticVirus] Pawn {pawn.LabelShort} does not meet conditions for resurrection."); return; } @@ -96,7 +96,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"[NecroticVirus] Error during transformation: {ex}"); + ArachnaeLog.Debug($"[NecroticVirus] Error during transformation: {ex}"); } } diff --git a/Source/ArachnaeSwarm/Hediffs/ARA_HediffComp_TopTurret/HediffComp_TopTurret.cs b/Source/ArachnaeSwarm/Hediffs/ARA_HediffComp_TopTurret/HediffComp_TopTurret.cs index 81f4f10..83c2ef0 100644 --- a/Source/ArachnaeSwarm/Hediffs/ARA_HediffComp_TopTurret/HediffComp_TopTurret.cs +++ b/Source/ArachnaeSwarm/Hediffs/ARA_HediffComp_TopTurret/HediffComp_TopTurret.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using UnityEngine; using Verse; @@ -31,7 +31,7 @@ namespace ArachnaeSwarm { if (this.props == null) { - Log.Error("HediffComp_TopTurret: props is null"); + ArachnaeLog.Debug("HediffComp_TopTurret: props is null"); return null; } return this.props as HediffCompProperties_TopTurret; @@ -76,7 +76,7 @@ namespace ArachnaeSwarm { if (this.gun == null) { - Log.Warning("HediffComp_TopTurret: gun is null"); + ArachnaeLog.Debug("HediffComp_TopTurret: gun is null"); return null; } return this.gun.TryGetComp(); @@ -90,7 +90,7 @@ namespace ArachnaeSwarm var comp = this.GunCompEq; if (comp == null) { - Log.Warning("HediffComp_TopTurret: GunCompEq is null"); + ArachnaeLog.Debug("HediffComp_TopTurret: GunCompEq is null"); return null; } return comp.PrimaryVerb; @@ -170,7 +170,7 @@ namespace ArachnaeSwarm // 添加 null 检查 if (this.Props == null) { - Log.Error("HediffComp_TopTurret: Props is null in CompPostMake"); + ArachnaeLog.Debug("HediffComp_TopTurret: Props is null in CompPostMake"); return; } @@ -182,13 +182,13 @@ namespace ArachnaeSwarm // 添加详细的 null 检查 if (this.Props == null) { - Log.Error("HediffComp_TopTurret: Props is null in MakeGun"); + ArachnaeLog.Debug("HediffComp_TopTurret: Props is null in MakeGun"); return; } if (this.Props.turretDef == null) { - Log.Error("HediffComp_TopTurret: Props.turretDef is null"); + ArachnaeLog.Debug("HediffComp_TopTurret: Props.turretDef is null"); return; } @@ -197,14 +197,14 @@ namespace ArachnaeSwarm this.gun = ThingMaker.MakeThing(this.Props.turretDef, null); if (this.gun == null) { - Log.Error($"HediffComp_TopTurret: Failed to create gun from turretDef '{this.Props.turretDef.defName}'"); + ArachnaeLog.Debug($"HediffComp_TopTurret: Failed to create gun from turretDef '{this.Props.turretDef.defName}'"); return; } this.UpdateGunVerbs(); } catch (Exception ex) { - Log.Error($"HediffComp_TopTurret: Exception in MakeGun: {ex}"); + ArachnaeLog.Debug($"HediffComp_TopTurret: Exception in MakeGun: {ex}"); } } @@ -212,14 +212,14 @@ namespace ArachnaeSwarm { if (this.gun == null) { - Log.Warning("HediffComp_TopTurret: gun is null in UpdateGunVerbs"); + ArachnaeLog.Debug("HediffComp_TopTurret: gun is null in UpdateGunVerbs"); return; } var comp = this.gun.TryGetComp(); if (comp == null) { - Log.Warning("HediffComp_TopTurret: CompEquippable is null"); + ArachnaeLog.Debug("HediffComp_TopTurret: CompEquippable is null"); return; } @@ -305,7 +305,7 @@ namespace ArachnaeSwarm { if (this.gun == null) { - Log.Error("CompTurrentGun had null gun after loading. Recreating."); + ArachnaeLog.Debug("CompTurrentGun had null gun after loading. Recreating."); this.MakeGun(); return; } diff --git a/Source/ArachnaeSwarm/Hediffs/ARA_HediffTerrainSpawn/CompHediffTerrainSpawn.cs b/Source/ArachnaeSwarm/Hediffs/ARA_HediffTerrainSpawn/CompHediffTerrainSpawn.cs index 378e57f..4c88f03 100644 --- a/Source/ArachnaeSwarm/Hediffs/ARA_HediffTerrainSpawn/CompHediffTerrainSpawn.cs +++ b/Source/ArachnaeSwarm/Hediffs/ARA_HediffTerrainSpawn/CompHediffTerrainSpawn.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; namespace ArachnaeSwarm @@ -90,7 +90,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"Error in CompHediffTerrainSpawn.DoTerrainSpawn: {ex}"); + ArachnaeLog.Debug($"Error in CompHediffTerrainSpawn.DoTerrainSpawn: {ex}"); } } diff --git a/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/CompAbilityEffect_BindDrone.cs b/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/CompAbilityEffect_BindDrone.cs index 2d39566..b3a3c50 100644 --- a/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/CompAbilityEffect_BindDrone.cs +++ b/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/CompAbilityEffect_BindDrone.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Linq; // For LINQ operations @@ -40,7 +40,7 @@ namespace ArachnaeSwarm } else { - Log.Error($"[ArachnaeSwarm] Master {masterPawn.LabelShort} tried to bind a drone but does not have Hediff_HiveMindMaster."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Master {masterPawn.LabelShort} tried to bind a drone but does not have Hediff_HiveMindMaster."); } } } @@ -54,7 +54,7 @@ namespace ArachnaeSwarm if (dronePawn.Faction != masterPawn.Faction) { dronePawn.SetFaction(masterPawn.Faction, masterPawn); - Log.Message($"Converted {dronePawn.LabelShort} from {dronePawn.Faction?.Name ?? "null"} to {masterPawn.Faction?.Name}"); + ArachnaeLog.Debug($"Converted {dronePawn.LabelShort} from {dronePawn.Faction?.Name ?? "null"} to {masterPawn.Faction?.Name}"); } // 2. 移除 ARA_NonPlayer_HiveMindDroneHediff @@ -62,7 +62,7 @@ namespace ArachnaeSwarm if (nonPlayerHediff != null) { dronePawn.health.RemoveHediff(nonPlayerHediff); - Log.Message($"Removed ARA_NonPlayer_HiveMindDroneHediff from {dronePawn.LabelShort}"); + ArachnaeLog.Debug($"Removed ARA_NonPlayer_HiveMindDroneHediff from {dronePawn.LabelShort}"); } // 3. 添加 ARA_HiveMindDrone @@ -70,7 +70,7 @@ namespace ArachnaeSwarm if (hiveMindDroneDef != null && !dronePawn.health.hediffSet.HasHediff(hiveMindDroneDef)) { dronePawn.health.AddHediff(hiveMindDroneDef); - Log.Message($"Added ARA_HiveMindDrone to {dronePawn.LabelShort}"); + ArachnaeLog.Debug($"Added ARA_HiveMindDrone to {dronePawn.LabelShort}"); } // 4. 尝试绑定到主节点 @@ -80,18 +80,18 @@ namespace ArachnaeSwarm if (masterHediff.TryBindDrone(dronePawn)) { Messages.Message("ARA_BindDrone_ConversionSuccess".Translate(dronePawn.LabelShort, masterPawn.LabelShort), MessageTypeDefOf.PositiveEvent, historical: false); - Log.Message($"Successfully bound converted drone {dronePawn.LabelShort} to master {masterPawn.LabelShort}"); + ArachnaeLog.Debug($"Successfully bound converted drone {dronePawn.LabelShort} to master {masterPawn.LabelShort}"); } else { Messages.Message("ARA_BindDrone_ConversionFailure".Translate(dronePawn.LabelShort, masterPawn.LabelShort), MessageTypeDefOf.NegativeEvent, historical: false); - Log.Warning($"Failed to bind converted drone {dronePawn.LabelShort} to master {masterPawn.LabelShort}"); + ArachnaeLog.Debug($"Failed to bind converted drone {dronePawn.LabelShort} to master {masterPawn.LabelShort}"); } } else { Messages.Message("ARA_BindDrone_NoMasterForConversion".Translate(masterPawn.LabelShort), MessageTypeDefOf.NegativeEvent, historical: false); - Log.Error($"[ArachnaeSwarm] Master {masterPawn.LabelShort} tried to convert a non-player drone but does not have Hediff_HiveMindMaster."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Master {masterPawn.LabelShort} tried to convert a non-player drone but does not have Hediff_HiveMindMaster."); } } diff --git a/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/HediffComp_HiveMindDrone.cs b/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/HediffComp_HiveMindDrone.cs index 23117e7..afdf14e 100644 --- a/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/HediffComp_HiveMindDrone.cs +++ b/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/HediffComp_HiveMindDrone.cs @@ -1,4 +1,4 @@ -using Verse; +using Verse; using RimWorld; namespace ArachnaeSwarm @@ -42,7 +42,7 @@ namespace ArachnaeSwarm if (ticksUnlinked >= Props.unlinkedDieDelayTicks) { - Log.Message($"[ArachnaeSwarm] Drone {parent.pawn.LabelShort} was unlinked from master for too long and will die. Forcing death."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Drone {parent.pawn.LabelShort} was unlinked from master for too long and will die. Forcing death."); // Ensure the pawn is killed only once and prevent further ticks if (!parent.pawn.Dead && !parent.pawn.Destroyed) { diff --git a/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/Hediff_HiveMindMaster.cs b/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/Hediff_HiveMindMaster.cs index 580b94b..81f9ec1 100644 --- a/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/Hediff_HiveMindMaster.cs +++ b/Source/ArachnaeSwarm/Hediffs/ARA_HiveMind/Hediff_HiveMindMaster.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using RimWorld; using Verse; @@ -51,26 +51,26 @@ namespace ArachnaeSwarm { if (drone == null || drone.Dead || !drone.Spawned || drone.Map != this.pawn.Map) { - Log.Message($"[ArachnaeSwarm] Cannot bind drone {drone?.LabelShort ?? "null"}: Invalid pawn state."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Cannot bind drone {drone?.LabelShort ?? "null"}: Invalid pawn state."); return false; } Hediff_HiveMindDrone droneHediff = drone.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("ARA_HiveMindDrone")) as Hediff_HiveMindDrone; if (droneHediff == null) { - Log.Message($"[ArachnaeSwarm] Cannot bind drone {drone.LabelShort}: Does not have ARA_HiveMindDrone hediff."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Cannot bind drone {drone.LabelShort}: Does not have ARA_HiveMindDrone hediff."); return false; } if (droneHediff.target != null && droneHediff.target != this.pawn) { - Log.Message($"[ArachnaeSwarm] Cannot bind drone {drone.LabelShort}: Already bound to another master ({droneHediff.target.LabelShort})."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Cannot bind drone {drone.LabelShort}: Already bound to another master ({droneHediff.target.LabelShort})."); return false; } if (drones.Contains(drone)) { - Log.Message($"[ArachnaeSwarm] Drone {drone.LabelShort} is already bound to this master."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Drone {drone.LabelShort} is already bound to this master."); return false; } @@ -80,7 +80,7 @@ namespace ArachnaeSwarm droneHediff.target = this.pawn; // Set the drone's target to this master drones.Add(drone); UpdateSeverity(); - Log.Message($"[ArachnaeSwarm] Master {this.pawn.LabelShort} successfully bound drone {drone.LabelShort}."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Master {this.pawn.LabelShort} successfully bound drone {drone.LabelShort}."); return true; } @@ -101,12 +101,12 @@ namespace ArachnaeSwarm if (drone.Ideo != masterIdeo) { drone.ideo.SetIdeo(masterIdeo); - Log.Message($"[ArachnaeSwarm] Set drone {drone.LabelShort} ideology to master's ideology: {masterIdeo.name}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Set drone {drone.LabelShort} ideology to master's ideology: {masterIdeo.name}"); } } else { - Log.Warning($"[ArachnaeSwarm] Master {this.pawn.LabelShort} has no ideology to assign to drone {drone.LabelShort}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Master {this.pawn.LabelShort} has no ideology to assign to drone {drone.LabelShort}"); } // 强制同步文化相关记忆和状态 @@ -114,7 +114,7 @@ namespace ArachnaeSwarm } else { - Log.Message($"[ArachnaeSwarm] Ideology DLC not active, skipping cultural assignment for drone {drone.LabelShort}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Ideology DLC not active, skipping cultural assignment for drone {drone.LabelShort}"); } } @@ -142,7 +142,7 @@ namespace ArachnaeSwarm if (thoughtsToRemove.Count > 0) { - Log.Message($"[ArachnaeSwarm] Removed {thoughtsToRemove.Count} cultural conflict thoughts from drone {drone.LabelShort}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Removed {thoughtsToRemove.Count} cultural conflict thoughts from drone {drone.LabelShort}"); } // 添加蜂群文化适应的正面想法 @@ -154,11 +154,11 @@ namespace ArachnaeSwarm } // 同步服装和文化偏好 - Log.Message($"[ArachnaeSwarm] Successfully synchronized cultural memories for drone {drone.LabelShort}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Successfully synchronized cultural memories for drone {drone.LabelShort}"); } catch (System.Exception ex) { - Log.Error($"[ArachnaeSwarm] Error synchronizing cultural memories for drone {drone.LabelShort}: {ex.Message}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Error synchronizing cultural memories for drone {drone.LabelShort}: {ex.Message}"); } } @@ -188,7 +188,7 @@ namespace ArachnaeSwarm droneHediff.target = this.pawn; // Set the drone's target to this master drones.Add(drone); - Log.Message($"[ArachnaeSwarm] Master {this.pawn.LabelShort} automatically bound drone {drone.LabelShort}."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Master {this.pawn.LabelShort} automatically bound drone {drone.LabelShort}."); boundCount++; } } @@ -222,7 +222,7 @@ namespace ArachnaeSwarm { if (drone != null && !drone.Dead) { - Log.Message($"[ArachnaeSwarm] Master {pawn.LabelShort} died, killing drone {drone.LabelShort}."); + ArachnaeLog.Debug($"[ArachnaeSwarm] Master {pawn.LabelShort} died, killing drone {drone.LabelShort}."); drone.Kill(null, this); } } diff --git a/Source/ArachnaeSwarm/Hediffs/DRM_HediffCurseFlame/Hediff_CurseFlame.cs b/Source/ArachnaeSwarm/Hediffs/DRM_HediffCurseFlame/Hediff_CurseFlame.cs index 90baad3..e49a615 100644 --- a/Source/ArachnaeSwarm/Hediffs/DRM_HediffCurseFlame/Hediff_CurseFlame.cs +++ b/Source/ArachnaeSwarm/Hediffs/DRM_HediffCurseFlame/Hediff_CurseFlame.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System; using System.Collections.Generic; using System.Linq; @@ -30,7 +30,7 @@ namespace ArachnaeSwarm // 回退逻辑:如果配置的 DefName 无效,使用 AcidBurn if (_resolvedDamageDef == null) { - Log.Error($"[DragonianMix] 未找到 DamageDef: {damageDefName}, 已回退到 AcidBurn"); + ArachnaeLog.Debug($"[DragonianMix] 未找到 DamageDef: {damageDefName}, 已回退到 AcidBurn"); _resolvedDamageDef = DamageDefOf.AcidBurn; } } diff --git a/Source/ArachnaeSwarm/Hediffs/HediffComp_SpawnPawnOnRemoved.cs b/Source/ArachnaeSwarm/Hediffs/HediffComp_SpawnPawnOnRemoved.cs index 525595c..17de95a 100644 --- a/Source/ArachnaeSwarm/Hediffs/HediffComp_SpawnPawnOnRemoved.cs +++ b/Source/ArachnaeSwarm/Hediffs/HediffComp_SpawnPawnOnRemoved.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using System.Linq; @@ -54,7 +54,7 @@ namespace ArachnaeSwarm if (this.Pawn == null || this.Pawn.Map == null || Props.pawnKindDefs.NullOrEmpty()) { - Log.Warning("ArachnaeSwarm: HediffComp_SpawnPawnOnRemoved tried to spawn a pawn but required data was missing (Pawn, Map, or pawnKindDefs)."); + ArachnaeLog.Debug("ArachnaeSwarm: HediffComp_SpawnPawnOnRemoved tried to spawn a pawn but required data was missing (Pawn, Map, or pawnKindDefs)."); return; } @@ -87,7 +87,7 @@ namespace ArachnaeSwarm } else { - Log.Error($"ArachnaeSwarm: Failed to generate pawn of kind {selectedPawnKindDef.defName}."); + ArachnaeLog.Debug($"ArachnaeSwarm: Failed to generate pawn of kind {selectedPawnKindDef.defName}."); } } } diff --git a/Source/ArachnaeSwarm/Hediffs/MoharHediffs/Tools.cs b/Source/ArachnaeSwarm/Hediffs/MoharHediffs/Tools.cs index c066574..21a78e7 100644 --- a/Source/ArachnaeSwarm/Hediffs/MoharHediffs/Tools.cs +++ b/Source/ArachnaeSwarm/Hediffs/MoharHediffs/Tools.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using RimWorld; using UnityEngine; @@ -12,7 +12,7 @@ namespace ArachnaeSwarm.MoharHediffs { if (parentHediff.pawn != null && parentHediff.def.defName != null && debug) { - Log.Warning(parentHediff.pawn.Label + "'s Hediff: " + parentHediff.def.defName + " says goodbye."); + ArachnaeLog.Debug(parentHediff.pawn.Label + "'s Hediff: " + parentHediff.def.defName + " says goodbye."); } parentHediff.Severity = 0f; } @@ -24,14 +24,14 @@ namespace ArachnaeSwarm.MoharHediffs { if (debug) { - Log.Warning("GetPawnAgeOverlifeExpectancyRatio pawn NOT OK"); + ArachnaeLog.Debug("GetPawnAgeOverlifeExpectancyRatio pawn NOT OK"); } return result; } result = pawn.ageTracker.AgeBiologicalYearsFloat / pawn.RaceProps.lifeExpectancy; if (debug) { - Log.Warning(string.Concat(new string[] + ArachnaeLog.Debug(string.Concat(new string[] { pawn.Label, " Age: ", @@ -51,7 +51,7 @@ namespace ArachnaeSwarm.MoharHediffs { if (debug) { - Log.Warning("pawn is null - wounded "); + ArachnaeLog.Debug("pawn is null - wounded "); } return false; } @@ -66,7 +66,7 @@ namespace ArachnaeSwarm.MoharHediffs } if (debug && num > 0f) { - Log.Warning(pawn.Label + " is wounded "); + ArachnaeLog.Debug(pawn.Label + " is wounded "); } return num > 0f; } @@ -77,14 +77,14 @@ namespace ArachnaeSwarm.MoharHediffs { if (debug) { - Log.Warning("pawn is null - IsHungry "); + ArachnaeLog.Debug("pawn is null - IsHungry "); } return false; } bool flag = pawn.needs.food != null && pawn.needs.food.CurCategory == HungerCategory.Starving; if (debug && flag) { - Log.Warning(pawn.Label + " is hungry "); + ArachnaeLog.Debug(pawn.Label + " is hungry "); } return flag; } @@ -98,7 +98,7 @@ namespace ArachnaeSwarm.MoharHediffs { if (debug) { - Log.Warning(warning); + ArachnaeLog.Debug(warning); } } diff --git a/Source/ArachnaeSwarm/Hediffs/ProphecyGearEffect.cs b/Source/ArachnaeSwarm/Hediffs/ProphecyGearEffect.cs index 470c82b..2b3c82e 100644 --- a/Source/ArachnaeSwarm/Hediffs/ProphecyGearEffect.cs +++ b/Source/ArachnaeSwarm/Hediffs/ProphecyGearEffect.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Reflection; using HarmonyLib; @@ -88,7 +88,7 @@ namespace ArachnaeSwarm catch (Exception ex) { isApplyingExtraDamage = false; - Log.Error($"[ArachnaeSwarm] Error in PostApplyDamage patch: {ex}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Error in PostApplyDamage patch: {ex}"); } } @@ -152,7 +152,7 @@ namespace ArachnaeSwarm } catch (Exception ex) { - Log.Error($"[ArachnaeSwarm] Error in ApplyHediffEffect: {ex}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Error in ApplyHediffEffect: {ex}"); } } @@ -204,7 +204,7 @@ namespace ArachnaeSwarm } catch (Exception ex) { - Log.Error($"[ArachnaeSwarm] Error in ApplyExtraDamage: {ex}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Error in ApplyExtraDamage: {ex}"); } } } diff --git a/Source/ArachnaeSwarm/Jobs/JobDriver_Refuel_Nutrition.cs b/Source/ArachnaeSwarm/Jobs/JobDriver_Refuel_Nutrition.cs index f048094..2c7228d 100644 --- a/Source/ArachnaeSwarm/Jobs/JobDriver_Refuel_Nutrition.cs +++ b/Source/ArachnaeSwarm/Jobs/JobDriver_Refuel_Nutrition.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using Verse; using Verse.AI; @@ -72,7 +72,7 @@ namespace ArachnaeSwarm if (actor.carryTracker.CarriedThing == null) { - Log.Error(actor + " is not carrying anything to refuel with."); + ArachnaeLog.Debug(actor + " is not carrying anything to refuel with."); // The correct way to end the job from within a Toil's action. actor.jobs.EndCurrentJob(JobCondition.Incompletable); return; diff --git a/Source/ArachnaeSwarm/MainHarmony.cs b/Source/ArachnaeSwarm/MainHarmony.cs deleted file mode 100644 index 8d6fe4d..0000000 --- a/Source/ArachnaeSwarm/MainHarmony.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Verse; -using HarmonyLib; -using System.Reflection; - -namespace ArachnaeSwarm -{ - // [StaticConstructorOnStartup] 属性确保这个类的静态构造函数在游戏启动时被调用 - [StaticConstructorOnStartup] - public static class MainHarmony - { - static MainHarmony() - { - // 创建一个 Harmony 实例。ID 应该是唯一的,通常使用 "作者.Mod名称" 的格式。 - var harmony = new Harmony("com.kalospacer.arachnaeswarm"); - - // Harmony 会自动扫描当前整个程序集(我们的 .dll 文件), - // 寻找所有带有 [HarmonyPatch] 属性的类,并应用它们。 - harmony.PatchAll(Assembly.GetExecutingAssembly()); - } - } -} \ No newline at end of file diff --git a/Source/ArachnaeSwarm/MentalState/MentalState_HiveMindCascade.cs b/Source/ArachnaeSwarm/MentalState/MentalState_HiveMindCascade.cs index 6f0dab2..993e515 100644 --- a/Source/ArachnaeSwarm/MentalState/MentalState_HiveMindCascade.cs +++ b/Source/ArachnaeSwarm/MentalState/MentalState_HiveMindCascade.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Linq; using Verse; @@ -61,7 +61,7 @@ namespace ArachnaeSwarm var extension = def.GetModExtension(); if (extension?.mentalStatesToSpread == null || extension.mentalStatesToSpread.Count == 0) { - Log.Error($"[ArachnaeSwarm] MentalState_HiveMindCascade: No mentalStatesToSpread defined for {def.defName}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] MentalState_HiveMindCascade: No mentalStatesToSpread defined for {def.defName}"); hasCascaded = true; return; } @@ -70,7 +70,7 @@ namespace ArachnaeSwarm var masterHediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("ARA_HiveMindMaster")) as Hediff_HiveMindMaster; if (masterHediff == null) { - Log.Warning($"[ArachnaeSwarm] MentalState_HiveMindCascade: Pawn {pawn.LabelShort} does not have ARA_HiveMindMaster hediff"); + ArachnaeLog.Debug($"[ArachnaeSwarm] MentalState_HiveMindCascade: Pawn {pawn.LabelShort} does not have ARA_HiveMindMaster hediff"); hasCascaded = true; return; } @@ -79,7 +79,7 @@ namespace ArachnaeSwarm var drones = GetDronesFromMaster(masterHediff); if (drones == null || drones.Count == 0) { - Log.Message($"[ArachnaeSwarm] MentalState_HiveMindCascade: No drones found for master {pawn.LabelShort}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] MentalState_HiveMindCascade: No drones found for master {pawn.LabelShort}"); hasCascaded = true; return; } @@ -99,15 +99,15 @@ namespace ArachnaeSwarm if (drone.mindState.mentalStateHandler.TryStartMentalState(randomMentalState, "HiveMindCascade", forced: true)) { spreadCount++; - Log.Message($"[ArachnaeSwarm] Cascaded {randomMentalState.defName} to drone {drone.LabelShort}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Cascaded {randomMentalState.defName} to drone {drone.LabelShort}"); } else { - Log.Warning($"[ArachnaeSwarm] Failed to cascade {randomMentalState.defName} to drone {drone.LabelShort}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Failed to cascade {randomMentalState.defName} to drone {drone.LabelShort}"); } } - Log.Message($"[ArachnaeSwarm] HiveMindCascade: Successfully spread {spreadCount} mental breaks to drones"); + ArachnaeLog.Debug($"[ArachnaeSwarm] HiveMindCascade: Successfully spread {spreadCount} mental breaks to drones"); hasCascaded = true; // 显示级联完成的消息 @@ -138,11 +138,11 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"[ArachnaeSwarm] Failed to access drones field via reflection: {ex.Message}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Failed to access drones field via reflection: {ex.Message}"); } // 方法3: 如果以上都失败,尝试通过其他方式 - Log.Error($"[ArachnaeSwarm] Could not access drones list from HiveMindMaster"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Could not access drones list from HiveMindMaster"); return new List(); } @@ -197,14 +197,14 @@ namespace ArachnaeSwarm if (!hasHiveMindMaster) { - Log.Message($"[ArachnaeSwarm] MentalBreakWorker_HiveMindCascade: Pawn {pawn.LabelShort} does not have ARA_HiveMindMaster, cannot start cascade"); + ArachnaeLog.Debug($"[ArachnaeSwarm] MentalBreakWorker_HiveMindCascade: Pawn {pawn.LabelShort} does not have ARA_HiveMindMaster, cannot start cascade"); return false; } // 调用基类方法启动精神状态 if (base.TryStart(pawn, reason, causedByMood)) { - Log.Message($"[ArachnaeSwarm] Started HiveMindCascade mental state on {pawn.LabelShort}"); + ArachnaeLog.Debug($"[ArachnaeSwarm] Started HiveMindCascade mental state on {pawn.LabelShort}"); return true; } diff --git a/Source/ArachnaeSwarm/Pawn_Comps/ARA_CompHediffGiver/CompHediffGiver.cs b/Source/ArachnaeSwarm/Pawn_Comps/ARA_CompHediffGiver/CompHediffGiver.cs index 541cdc5..35f36aa 100644 --- a/Source/ArachnaeSwarm/Pawn_Comps/ARA_CompHediffGiver/CompHediffGiver.cs +++ b/Source/ArachnaeSwarm/Pawn_Comps/ARA_CompHediffGiver/CompHediffGiver.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Verse; using RimWorld; @@ -63,7 +63,7 @@ namespace ArachnaeSwarm { AddHediffsToPawn(pawn); hediffsApplied = true; - Log.Message($"Debug: Applied hediffs to {pawn.Label}"); + ArachnaeLog.Debug($"Debug: Applied hediffs to {pawn.Label}"); } } } diff --git a/Source/ArachnaeSwarm/Pawn_Comps/ARA_CompSkillExperienceGiver/CompSkillExperienceGiver.cs b/Source/ArachnaeSwarm/Pawn_Comps/ARA_CompSkillExperienceGiver/CompSkillExperienceGiver.cs index 4d5cfa2..d4a2578 100644 --- a/Source/ArachnaeSwarm/Pawn_Comps/ARA_CompSkillExperienceGiver/CompSkillExperienceGiver.cs +++ b/Source/ArachnaeSwarm/Pawn_Comps/ARA_CompSkillExperienceGiver/CompSkillExperienceGiver.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Verse; using RimWorld; @@ -112,11 +112,11 @@ namespace ArachnaeSwarm { if (skillRecord.Level > originalLevel) { - Log.Message($"{pawn.LabelShort} gained {experienceToGive} experience in {skillExp.skillDef.label} (Level up: {originalLevel} -> {skillRecord.Level})"); + ArachnaeLog.Debug($"{pawn.LabelShort} gained {experienceToGive} experience in {skillExp.skillDef.label} (Level up: {originalLevel} -> {skillRecord.Level})"); } else { - Log.Message($"{pawn.LabelShort} gained {experienceToGive} experience in {skillExp.skillDef.label} (Current level: {skillRecord.Level}, Progress: {skillRecord.xpSinceLastLevel}/{skillRecord.XpRequiredForLevelUp})"); + ArachnaeLog.Debug($"{pawn.LabelShort} gained {experienceToGive} experience in {skillExp.skillDef.label} (Current level: {skillRecord.Level}, Progress: {skillRecord.xpSinceLastLevel}/{skillRecord.XpRequiredForLevelUp})"); } } } @@ -124,7 +124,7 @@ namespace ArachnaeSwarm catch (Exception ex) { // 记录错误但继续处理其他技能 - Log.Warning($"Error giving experience to {pawn.LabelShort} for skill {skillExp.skillDef?.defName}: {ex.Message}"); + ArachnaeLog.Debug($"Error giving experience to {pawn.LabelShort} for skill {skillExp.skillDef?.defName}: {ex.Message}"); } } } diff --git a/Source/ArachnaeSwarm/Pawn_Comps/ARA_GiveHediffsInRangeToRace/HediffComp_GiveHediffsInRangeToRace.cs b/Source/ArachnaeSwarm/Pawn_Comps/ARA_GiveHediffsInRangeToRace/HediffComp_GiveHediffsInRangeToRace.cs index 1164cdb..9ae5e0e 100644 --- a/Source/ArachnaeSwarm/Pawn_Comps/ARA_GiveHediffsInRangeToRace/HediffComp_GiveHediffsInRangeToRace.cs +++ b/Source/ArachnaeSwarm/Pawn_Comps/ARA_GiveHediffsInRangeToRace/HediffComp_GiveHediffsInRangeToRace.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using UnityEngine; using Verse; @@ -62,7 +62,7 @@ namespace ArachnaeSwarm HediffComp_Disappears hediffComp_Disappears = hediff.TryGetComp(); if (hediffComp_Disappears == null) { - Log.Error("HediffComp_GiveHediffsInRangeToRace has a hediff in props which does not have a HediffComp_Disappears"); + ArachnaeLog.Debug("HediffComp_GiveHediffsInRangeToRace has a hediff in props which does not have a HediffComp_Disappears"); } else { diff --git a/Source/ArachnaeSwarm/Pawn_Comps/ARA_NodeSwarmLifetime/CompNodeSwarmLifetime.cs b/Source/ArachnaeSwarm/Pawn_Comps/ARA_NodeSwarmLifetime/CompNodeSwarmLifetime.cs index b6890a3..3776cd7 100644 --- a/Source/ArachnaeSwarm/Pawn_Comps/ARA_NodeSwarmLifetime/CompNodeSwarmLifetime.cs +++ b/Source/ArachnaeSwarm/Pawn_Comps/ARA_NodeSwarmLifetime/CompNodeSwarmLifetime.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using UnityEngine; using Verse; @@ -99,11 +99,11 @@ namespace ArachnaeSwarm // 添加:如果有关闭 Hediff,不处理缺失的寿命 Hediff if (HasShutdownHediff) { - Log.Message($"Lifespan hediff missing for {pawn.Label}, but shutdown hediff is present. This is expected behavior."); + ArachnaeLog.Debug($"Lifespan hediff missing for {pawn.Label}, but shutdown hediff is present. This is expected behavior."); return; } - Log.Warning($"Lifespan hediff missing for {pawn.Label}. This should not happen. Forcing death."); + ArachnaeLog.Debug($"Lifespan hediff missing for {pawn.Label}. This should not happen. Forcing death."); // 立即处死pawn if (!pawn.Dead) @@ -138,7 +138,7 @@ namespace ArachnaeSwarm var existingHediff = pawn.health.hediffSet.GetFirstHediffOfDef(Props.lifespanHediff); if (existingHediff != null) { - Log.Message($"Shutdown hediff present for {pawn.Label}. Removing lifespan hediff."); + ArachnaeLog.Debug($"Shutdown hediff present for {pawn.Label}. Removing lifespan hediff."); pawn.health.RemoveHediff(existingHediff); lifespanHediff = null; } @@ -159,7 +159,7 @@ namespace ArachnaeSwarm { // 初始化Hediff的严重程度为当前剩余寿命比例 lifespanHediff.Severity = PercentFull; - Log.Message($"Created lifespan hediff for {pawn.Label} with severity {lifespanHediff.Severity:P2}"); + ArachnaeLog.Debug($"Created lifespan hediff for {pawn.Label} with severity {lifespanHediff.Severity:P2}"); } } @@ -191,7 +191,7 @@ namespace ArachnaeSwarm var hediff = GetOrCreateLifespanHediff(); if (hediff == null) { - Log.Warning($"Failed to get or create lifespan hediff for {pawn.Label}"); + ArachnaeLog.Debug($"Failed to get or create lifespan hediff for {pawn.Label}"); return; } @@ -205,7 +205,7 @@ namespace ArachnaeSwarm // 以Hediff的数据为准 if (Mathf.Abs(hediffTicksLeft - powerTicksLeft) > 1000) // 只在校正值较大时记录 { - Log.Message($"Lifespan sync: Component had {powerTicksLeft}, Hediff had {hediffTicksLeft}. Using Hediff value."); + ArachnaeLog.Debug($"Lifespan sync: Component had {powerTicksLeft}, Hediff had {hediffTicksLeft}. Using Hediff value."); } powerTicksLeft = hediffTicksLeft; } @@ -229,20 +229,20 @@ namespace ArachnaeSwarm // 添加:如果有关闭 Hediff,不写入数据 if (HasShutdownHediff) { - Log.Message($"Cannot write comp data to hediff: Shutdown hediff is present for {pawn.Label}"); + ArachnaeLog.Debug($"Cannot write comp data to hediff: Shutdown hediff is present for {pawn.Label}"); return; } var hediff = GetOrCreateLifespanHediff(); if (hediff == null) { - Log.Warning($"Failed to get or create lifespan hediff for {pawn.Label}"); + ArachnaeLog.Debug($"Failed to get or create lifespan hediff for {pawn.Label}"); return; } // 直接将Comp的数据写入Hediff hediff.Severity = PercentFull; - Log.Message($"Debug: Wrote comp data to hediff - Severity: {hediff.Severity:P4}, TicksLeft: {powerTicksLeft}"); + ArachnaeLog.Debug($"Debug: Wrote comp data to hediff - Severity: {hediff.Severity:P4}, TicksLeft: {powerTicksLeft}"); } // 新增:定期校验Hediff状态 @@ -263,7 +263,7 @@ namespace ArachnaeSwarm { pawn.health.RemoveHediff(existingHediff); lifespanHediff = null; - Log.Message($"Removed lifespan hediff for {pawn.Label} due to shutdown hediff presence"); + ArachnaeLog.Debug($"Removed lifespan hediff for {pawn.Label} due to shutdown hediff presence"); } return; } @@ -335,7 +335,7 @@ namespace ArachnaeSwarm } else { - Log.Message($"Skipping lifespan hediff creation for {parent.Label} due to shutdown hediff"); + ArachnaeLog.Debug($"Skipping lifespan hediff creation for {parent.Label} due to shutdown hediff"); } } } @@ -382,7 +382,7 @@ namespace ArachnaeSwarm $"Shutdown Hediff Def: {Props.immuteHediff?.defName ?? "None"}\n" + $"实际存在: {(Props.immuteHediff != null ? pawn.health.hediffSet.HasHediff(Props.immuteHediff).ToString() : "N/A")}"; Messages.Message(message, MessageTypeDefOf.SilentInput); - Log.Message(message); + ArachnaeLog.Debug(message); } } }; @@ -402,7 +402,7 @@ namespace ArachnaeSwarm powerTicksLeft = (int)(Props.lifetimeDays * 60000); WriteCompDataToHediff(); // 使用新的写入方法 - Log.Message($"已补满寿命: {parent.Label} 剩余 {DaysLeft:F1} 天"); + ArachnaeLog.Debug($"已补满寿命: {parent.Label} 剩余 {DaysLeft:F1} 天"); Messages.Message($"已补满寿命: {Props.lifetimeDays} 天", MessageTypeDefOf.SilentInput); } }; @@ -424,7 +424,7 @@ namespace ArachnaeSwarm powerTicksLeft = (int)(totalTicks * 0.0001f); // 0.01% WriteCompDataToHediff(); // 使用新的写入方法 float daysLeft = (float)powerTicksLeft / 60000f; - Log.Message($"已设置剩余0.01%寿命: {parent.Label} 剩余 {daysLeft:F4} 天 ({PercentFull:P2})"); + ArachnaeLog.Debug($"已设置剩余0.01%寿命: {parent.Label} 剩余 {daysLeft:F4} 天 ({PercentFull:P2})"); Messages.Message($"设置剩余寿命为0.01%: {daysLeft:F4} 天", MessageTypeDefOf.SilentInput); } }; @@ -444,7 +444,7 @@ namespace ArachnaeSwarm powerTicksLeft = 0; WriteCompDataToHediff(); // 使用新的写入方法 - Log.Message($"已归零寿命: {parent.Label} 将立即死亡"); + ArachnaeLog.Debug($"已归零寿命: {parent.Label} 将立即死亡"); Messages.Message("寿命已归零,即将死亡", MessageTypeDefOf.SilentInput); // 立即触发死亡逻辑 @@ -478,7 +478,7 @@ namespace ArachnaeSwarm $"已耗尽: {depleted}\n" + $"关闭Hediff存在: {HasShutdownHediff}"; Messages.Message(message, MessageTypeDefOf.SilentInput); - Log.Message(message); + ArachnaeLog.Debug(message); } else { @@ -504,7 +504,7 @@ namespace ArachnaeSwarm { pawn.health.RemoveHediff(hediff); lifespanHediff = null; - Log.Message($"已手动移除 {pawn.Label} 的寿命Hediff"); + ArachnaeLog.Debug($"已手动移除 {pawn.Label} 的寿命Hediff"); Messages.Message("已手动移除寿命hediff,pawn将立即死亡", MessageTypeDefOf.SilentInput); } else @@ -601,7 +601,7 @@ namespace ArachnaeSwarm Pawn pawn = (Pawn)parent; // 记录日志 - Log.Message($"Killing pawn {pawn.Label} due to lifespan depletion"); + ArachnaeLog.Debug($"Killing pawn {pawn.Label} due to lifespan depletion"); // 原有的处死逻辑 List allParts = pawn.def.race.body.AllParts; @@ -663,7 +663,7 @@ namespace ArachnaeSwarm } else { - Log.Message($"Skipping lifespan hediff creation for {parent.Label} after load due to shutdown hediff"); + ArachnaeLog.Debug($"Skipping lifespan hediff creation for {parent.Label} after load due to shutdown hediff"); } } } diff --git a/Source/ArachnaeSwarm/Pawn_Comps/ARA_UniquePawn/CompUniquePawn.cs b/Source/ArachnaeSwarm/Pawn_Comps/ARA_UniquePawn/CompUniquePawn.cs index fa5f62c..1f273bf 100644 --- a/Source/ArachnaeSwarm/Pawn_Comps/ARA_UniquePawn/CompUniquePawn.cs +++ b/Source/ArachnaeSwarm/Pawn_Comps/ARA_UniquePawn/CompUniquePawn.cs @@ -1,4 +1,4 @@ -using System; +using System; using RimWorld; using Verse; @@ -45,14 +45,14 @@ namespace ArachnaeSwarm } catch (Exception ex) { - Log.Error($"Error in delayed unique pawn check: {ex}"); + ArachnaeLog.Debug($"Error in delayed unique pawn check: {ex}"); _scheduledForCheck = false; } }, "ArachnaeSwarm_UniquePawnCheck", false, null); } catch (Exception ex) { - Log.Error($"Error in CompUniquePawn.PostSpawnSetup: {ex}"); + ArachnaeLog.Debug($"Error in CompUniquePawn.PostSpawnSetup: {ex}"); _scheduledForCheck = false; } } @@ -65,7 +65,7 @@ namespace ArachnaeSwarm if (string.IsNullOrEmpty(variable)) { - Log.Error("CompUniquePawn: globalVariable is null or empty"); + ArachnaeLog.Debug("CompUniquePawn: globalVariable is null or empty"); return; } @@ -82,13 +82,13 @@ namespace ArachnaeSwarm if (Prefs.DevMode) { - Log.Message($"Added global variable '{variable}' for pawn {pawn.Label}"); + ArachnaeLog.Debug($"Added global variable '{variable}' for pawn {pawn.Label}"); } } } catch (Exception ex) { - Log.Error($"Error in CheckAndHandleUniquePawn: {ex}"); + ArachnaeLog.Debug($"Error in CheckAndHandleUniquePawn: {ex}"); } } @@ -108,7 +108,7 @@ namespace ArachnaeSwarm if (Prefs.DevMode) { - Log.Message($"Killing pawn {pawn.Label} because global variable '{variable}' already exists"); + ArachnaeLog.Debug($"Killing pawn {pawn.Label} because global variable '{variable}' already exists"); } // 使用更安全的延迟执行 @@ -131,13 +131,13 @@ namespace ArachnaeSwarm } catch (Exception ex) { - Log.Error($"Error in delayed pawn kill: {ex}"); + ArachnaeLog.Debug($"Error in delayed pawn kill: {ex}"); } }, "ArachnaeSwarm_KillDuplicatePawn", false, null); } catch (Exception ex) { - Log.Error($"Error in KillPawn: {ex}"); + ArachnaeLog.Debug($"Error in KillPawn: {ex}"); } } diff --git a/Source/ArachnaeSwarm/Pawn_Comps/ARA_UniquePawn/Patch_UniquePawn.cs b/Source/ArachnaeSwarm/Pawn_Comps/ARA_UniquePawn/Patch_UniquePawn.cs index dace18f..61a6fd8 100644 --- a/Source/ArachnaeSwarm/Pawn_Comps/ARA_UniquePawn/Patch_UniquePawn.cs +++ b/Source/ArachnaeSwarm/Pawn_Comps/ARA_UniquePawn/Patch_UniquePawn.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Reflection; using HarmonyLib; using RimWorld; @@ -38,7 +38,7 @@ namespace ArachnaeSwarm GlobalVariableManager.ClearAllVariables(); if (Prefs.DevMode) { - Log.Message("GlobalVariableManager: Cleared all variables for new game"); + ArachnaeLog.Debug("GlobalVariableManager: Cleared all variables for new game"); } } } @@ -53,7 +53,7 @@ namespace ArachnaeSwarm GlobalVariableManager.Initialize(); if (Prefs.DevMode) { - Log.Message("GlobalVariableManager: Initialized for loaded game"); + ArachnaeLog.Debug("GlobalVariableManager: Initialized for loaded game"); } } } @@ -107,7 +107,7 @@ namespace ArachnaeSwarm if (Prefs.DevMode) { - Log.Message($"阻止复活 {pawn.Label},因为全局变量 '{variable}' 已存在"); + ArachnaeLog.Debug($"阻止复活 {pawn.Label},因为全局变量 '{variable}' 已存在"); } __result = false; // 返回 false 表示复活失败 @@ -117,7 +117,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"Error in resurrection prevention: {ex}"); + ArachnaeLog.Debug($"Error in resurrection prevention: {ex}"); } return true; // 继续执行原始方法 @@ -162,7 +162,7 @@ namespace ArachnaeSwarm if (Prefs.DevMode) { - Log.Message($"阻止复活 {pawn.Label},因为全局变量 '{variable}' 已存在"); + ArachnaeLog.Debug($"阻止复活 {pawn.Label},因为全局变量 '{variable}' 已存在"); } __result = false; // 返回 false 表示复活失败 @@ -172,7 +172,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Error($"Error in resurrection prevention: {ex}"); + ArachnaeLog.Debug($"Error in resurrection prevention: {ex}"); } return true; // 继续执行原始方法 @@ -193,7 +193,7 @@ namespace ArachnaeSwarm if (Prefs.DevMode) { - Log.Message("GlobalVariableManager: Initialized"); + ArachnaeLog.Debug("GlobalVariableManager: Initialized"); } } } @@ -214,7 +214,7 @@ namespace ArachnaeSwarm if (Prefs.DevMode) { - Log.Message($"GlobalVariableManager: Saved {_globalVariables.Count} variables"); + ArachnaeLog.Debug($"GlobalVariableManager: Saved {_globalVariables.Count} variables"); } } } @@ -228,7 +228,7 @@ namespace ArachnaeSwarm _globalVariables = new HashSet(variablesList); if (Prefs.DevMode) { - Log.Message($"GlobalVariableManager: Loaded {_globalVariables.Count} variables"); + ArachnaeLog.Debug($"GlobalVariableManager: Loaded {_globalVariables.Count} variables"); } } else @@ -236,14 +236,14 @@ namespace ArachnaeSwarm _globalVariables = new HashSet(); if (Prefs.DevMode) { - Log.Message("GlobalVariableManager: No variables found in save, initializing empty set"); + ArachnaeLog.Debug("GlobalVariableManager: No variables found in save, initializing empty set"); } } } } catch (System.Exception ex) { - Log.Error($"Error in GlobalVariableManager.ExposeData: {ex}"); + ArachnaeLog.Debug($"Error in GlobalVariableManager.ExposeData: {ex}"); } } @@ -260,7 +260,7 @@ namespace ArachnaeSwarm if (Prefs.DevMode) { - Log.Message($"GlobalVariableManager: Added variable '{variable}'"); + ArachnaeLog.Debug($"GlobalVariableManager: Added variable '{variable}'"); } } @@ -271,7 +271,7 @@ namespace ArachnaeSwarm if (removed && Prefs.DevMode) { - Log.Message($"GlobalVariableManager: Removed variable '{variable}'"); + ArachnaeLog.Debug($"GlobalVariableManager: Removed variable '{variable}'"); } return removed; @@ -291,7 +291,7 @@ namespace ArachnaeSwarm if (Prefs.DevMode) { - Log.Message($"GlobalVariableManager: Cleared {count} variables"); + ArachnaeLog.Debug($"GlobalVariableManager: Cleared {count} variables"); } } } diff --git a/Source/ArachnaeSwarm/PowerArmor/ARA_PowerArmor.cs b/Source/ArachnaeSwarm/PowerArmor/ARA_PowerArmor.cs index cf4b539..2e8328c 100644 --- a/Source/ArachnaeSwarm/PowerArmor/ARA_PowerArmor.cs +++ b/Source/ArachnaeSwarm/PowerArmor/ARA_PowerArmor.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using UnityEngine; using Verse; using System.Collections.Generic; @@ -124,7 +124,7 @@ namespace ArachnaeSwarm // 应用初始武装方案 ApplyWeaponSet(pawn, CurrentWeaponSet); - Log.Message($"[PA_Debug] 装备动力装甲,应用武装方案: {CurrentWeaponSet?.label ?? "无方案"}"); + ArachnaeLog.Debug($"[PA_Debug] 装备动力装甲,应用武装方案: {CurrentWeaponSet?.label ?? "无方案"}"); } public override void Notify_Unequipped(Pawn pawn) @@ -161,7 +161,7 @@ namespace ArachnaeSwarm } string destroyedWeaponLabel = currentPowerArmorWeapon.Label; currentPowerArmorWeapon.Destroy(); - Log.Message($"[PA_Debug] Notify_Unequipped: 销毁动力装甲武器 {destroyedWeaponLabel}."); + ArachnaeLog.Debug($"[PA_Debug] Notify_Unequipped: 销毁动力装甲武器 {destroyedWeaponLabel}."); currentPowerArmorWeapon = null; } @@ -171,7 +171,7 @@ namespace ArachnaeSwarm string originalWeaponLabel = originalWeapon.Label; pawn.equipment.MakeRoomFor(originalWeapon); pawn.equipment.AddEquipment(originalWeapon); - Log.Message($"[PA_Debug] Notify_Unequipped: 恢复原始武器 {originalWeaponLabel}."); + ArachnaeLog.Debug($"[PA_Debug] Notify_Unequipped: 恢复原始武器 {originalWeaponLabel}."); originalWeapon = null; } } @@ -184,7 +184,7 @@ namespace ArachnaeSwarm ThingDef buildingDef = Ext?.buildingDef; if (buildingDef == null) { - Log.Error($"[ArachnaeSwarm] 动力装甲 {this.def.defName} 卸下,但在其PowerArmorExtension中未定义buildingDef且源建筑引用丢失。"); + ArachnaeLog.Debug($"[ArachnaeSwarm] 动力装甲 {this.def.defName} 卸下,但在其PowerArmorExtension中未定义buildingDef且源建筑引用丢失。"); this.Destroy(DestroyMode.Vanish); return; } @@ -209,13 +209,13 @@ namespace ArachnaeSwarm buildingQuality.SetQuality(apparelQuality.Quality, ArtGenerationContext.Colony); } - Log.Message($"[PA_Debug] Notify_Unequipped: 生成建筑前 (ID: {building.thingIDNumber}) - HitPoints: {building.HitPoints}, StackCount: {building.stackCount}"); + ArachnaeLog.Debug($"[PA_Debug] Notify_Unequipped: 生成建筑前 (ID: {building.thingIDNumber}) - HitPoints: {building.HitPoints}, StackCount: {building.stackCount}"); // 确保建筑堆叠数至少为1 if (building.stackCount <= 0) { building.stackCount = 1; - Log.Warning($"[PA_Debug] Notify_Unequipped: 修正建筑 (ID: {building.thingIDNumber}) 堆叠数为1,因为原为0。"); + ArachnaeLog.Debug($"[PA_Debug] Notify_Unequipped: 修正建筑 (ID: {building.thingIDNumber}) 堆叠数为1,因为原为0。"); } // 设置派系 @@ -223,7 +223,7 @@ namespace ArachnaeSwarm // 重新生成原始建筑实例 GenPlace.TryPlaceThing(building, pawn.Position, pawn.Map, ThingPlaceMode.Near); - Log.Message($"[PA_Debug] Notify_Unequipped: 生成建筑后 (ID: {building.thingIDNumber}) - HitPoints: {building.HitPoints}, StackCount: {building.stackCount}"); + ArachnaeLog.Debug($"[PA_Debug] Notify_Unequipped: 生成建筑后 (ID: {building.thingIDNumber}) - HitPoints: {building.HitPoints}, StackCount: {building.stackCount}"); } #endregion @@ -239,7 +239,7 @@ namespace ArachnaeSwarm currentWeaponSetIndex = (currentWeaponSetIndex + 1) % WeaponSetCount; var newSet = CurrentWeaponSet; - Log.Message($"[PA_Debug] 切换武装方案: {oldSet?.label ?? "无"} -> {newSet?.label ?? "无"}"); + ArachnaeLog.Debug($"[PA_Debug] 切换武装方案: {oldSet?.label ?? "无"} -> {newSet?.label ?? "无"}"); ApplyWeaponSet(Wearer, newSet, oldSet); } @@ -255,7 +255,7 @@ namespace ArachnaeSwarm currentWeaponSetIndex = index; var newSet = CurrentWeaponSet; - Log.Message($"[PA_Debug] 切换到武装方案: {oldSet?.label ?? "无"} -> {newSet?.label ?? "无"}"); + ArachnaeLog.Debug($"[PA_Debug] 切换到武装方案: {oldSet?.label ?? "无"} -> {newSet?.label ?? "无"}"); ApplyWeaponSet(Wearer, newSet, oldSet); } @@ -297,7 +297,7 @@ namespace ArachnaeSwarm { var hediff = pawn.health.GetOrAddHediff(hediffDef); activeHediffs.Add(hediff); - Log.Message($"[PA_Debug] 添加Hediff: {hediffDef.defName}"); + ArachnaeLog.Debug($"[PA_Debug] 添加Hediff: {hediffDef.defName}"); } } @@ -327,7 +327,7 @@ namespace ArachnaeSwarm } currentPowerArmorWeapon.Destroy(); currentPowerArmorWeapon = null; - Log.Message($"[PA_Debug] 销毁当前动力装甲武器"); + ArachnaeLog.Debug($"[PA_Debug] 销毁当前动力装甲武器"); } // 如果新方案有武器,装备新武器 @@ -346,14 +346,14 @@ namespace ArachnaeSwarm pawn.equipment.AddEquipment(weapon); SetCurrentPowerArmorWeapon(weapon); - Log.Message($"[PA_Debug] 装备新武器: {weapon.Label}"); + ArachnaeLog.Debug($"[PA_Debug] 装备新武器: {weapon.Label}"); } // 如果没有武器,恢复原始武器 else if (originalWeapon != null) { pawn.equipment.MakeRoomFor(originalWeapon); pawn.equipment.AddEquipment(originalWeapon); - Log.Message($"[PA_Debug] 恢复原始武器: {originalWeapon.Label}"); + ArachnaeLog.Debug($"[PA_Debug] 恢复原始武器: {originalWeapon.Label}"); } } diff --git a/Source/ArachnaeSwarm/PowerArmor/JobDriver_EnterPowerArmor.cs b/Source/ArachnaeSwarm/PowerArmor/JobDriver_EnterPowerArmor.cs index 35b2787..884e0a6 100644 --- a/Source/ArachnaeSwarm/PowerArmor/JobDriver_EnterPowerArmor.cs +++ b/Source/ArachnaeSwarm/PowerArmor/JobDriver_EnterPowerArmor.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using Verse; using Verse.AI; @@ -54,7 +54,7 @@ namespace ArachnaeSwarm // 重置装备燃料并同步建筑燃料 apparelFuelComp.ConsumeFuel(apparelFuelComp.Fuel); // 先清空 apparelFuelComp.ReceiveFuel(buildingFuelComp.Fuel); - Log.Message($"[PA_Debug] 同步燃料: 建筑 {buildingFuelComp.Fuel} -> 装备 {apparelFuelComp.Fuel}"); + ArachnaeLog.Debug($"[PA_Debug] 同步燃料: 建筑 {buildingFuelComp.Fuel} -> 装备 {apparelFuelComp.Fuel}"); } // 同步质量 @@ -62,7 +62,7 @@ namespace ArachnaeSwarm apparel.TryGetComp() is CompQuality apparelQuality) { apparelQuality.SetQuality(buildingQuality.Quality, ArtGenerationContext.Colony); - Log.Message($"[PA_Debug] 同步质量: {buildingQuality.Quality}"); + ArachnaeLog.Debug($"[PA_Debug] 同步质量: {buildingQuality.Quality}"); } // 保存原始武器(如果有) @@ -70,7 +70,7 @@ namespace ArachnaeSwarm if (originalWeapon != null) { apparel.SetOriginalWeapon(originalWeapon); - Log.Message($"[PA_Debug] 保存原始武器: {originalWeapon.Label}"); + ArachnaeLog.Debug($"[PA_Debug] 保存原始武器: {originalWeapon.Label}"); } // 获取动力装甲扩展和默认武装方案 @@ -88,7 +88,7 @@ namespace ArachnaeSwarm } defaultSet = powerArmorExt.weaponSets[defaultIndex]; - Log.Message($"[PA_Debug] 使用武装方案: {defaultSet?.label ?? "无方案"} (索引: {defaultIndex})"); + ArachnaeLog.Debug($"[PA_Debug] 使用武装方案: {defaultSet?.label ?? "无方案"} (索引: {defaultIndex})"); // 如果默认方案有武器,需要卸下原始武器 if (defaultSet?.weapon != null && originalWeapon != null) @@ -97,7 +97,7 @@ namespace ArachnaeSwarm if (actor.equipment.Contains(originalWeapon)) { actor.equipment.Remove(originalWeapon); - Log.Message($"[PA_Debug] 卸下原始武器: {originalWeapon.Label}"); + ArachnaeLog.Debug($"[PA_Debug] 卸下原始武器: {originalWeapon.Label}"); } // 创建并装备动力装甲武器 @@ -115,27 +115,27 @@ namespace ArachnaeSwarm actor.equipment.AddEquipment(powerArmorWeapon); apparel.SetCurrentPowerArmorWeapon(powerArmorWeapon); - Log.Message($"[PA_Debug] 装备动力装甲武器: {powerArmorWeapon.Label}"); + ArachnaeLog.Debug($"[PA_Debug] 装备动力装甲武器: {powerArmorWeapon.Label}"); } // 如果默认方案没有武器,但原始武器存在,保留原始武器 else if (originalWeapon != null) { - Log.Message($"[PA_Debug] 默认方案无武器,保留原始武器: {originalWeapon.Label}"); + ArachnaeLog.Debug($"[PA_Debug] 默认方案无武器,保留原始武器: {originalWeapon.Label}"); } } else { - Log.Message($"[PA_Debug] 无武装方案配置,使用原有逻辑"); + ArachnaeLog.Debug($"[PA_Debug] 无武装方案配置,使用原有逻辑"); // 如果没有武装方案配置,就不进行武器切换 // 保留殖民者的原始武器 if (originalWeapon != null) { - Log.Message($"[PA_Debug] 无武装方案,保留原始武器: {originalWeapon.Label}"); + ArachnaeLog.Debug($"[PA_Debug] 无武装方案,保留原始武器: {originalWeapon.Label}"); } else { - Log.Message($"[PA_Debug] 无武装方案,且无原始武器"); + ArachnaeLog.Debug($"[PA_Debug] 无武装方案,且无原始武器"); } } @@ -143,18 +143,18 @@ namespace ArachnaeSwarm // 第三个参数 'false' 是 playerForced,这很关键 // 如果 playerForced 为 true,游戏会自动锁定装备 actor.apparel.Wear(apparel, false, false); - Log.Message($"[PA_Debug] 成功穿戴动力装甲: {apparel.Label}"); + ArachnaeLog.Debug($"[PA_Debug] 成功穿戴动力装甲: {apparel.Label}"); // 销毁建筑 building.DeSpawn(); - Log.Message($"[PA_Debug] 销毁动力装甲站建筑"); + ArachnaeLog.Debug($"[PA_Debug] 销毁动力装甲站建筑"); // 显示成功消息 Messages.Message($"{actor.LabelShort} 已装备{apparel.Label}", actor, MessageTypeDefOf.PositiveEvent); } else { - Log.Error($"[ArachnaeSwarm] 动力装甲建筑 {building.def.defName} 缺少 CompProperties_PowerArmorStation 或 apparelDef。"); + ArachnaeLog.Debug($"[ArachnaeSwarm] 动力装甲建筑 {building.def.defName} 缺少 CompProperties_PowerArmorStation 或 apparelDef。"); // 显示错误消息 Messages.Message("装备动力装甲失败:配置错误", actor, MessageTypeDefOf.NegativeEvent); diff --git a/Source/ArachnaeSwarm/Stat/StatWorker_IncubationInfo.cs b/Source/ArachnaeSwarm/Stat/StatWorker_IncubationInfo.cs index a7ac19d..5009525 100644 --- a/Source/ArachnaeSwarm/Stat/StatWorker_IncubationInfo.cs +++ b/Source/ArachnaeSwarm/Stat/StatWorker_IncubationInfo.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Linq; @@ -19,7 +19,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Warning($"Error in StatWorker_IncubationCost.ShouldShowFor for {req.Def?.defName}: {ex.Message}"); + ArachnaeLog.Debug($"Error in StatWorker_IncubationCost.ShouldShowFor for {req.Def?.defName}: {ex.Message}"); return false; } } @@ -42,7 +42,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Warning($"Error in StatWorker_IncubationCost.GetValueUnfinalized for {req.Def?.defName}: {ex.Message}"); + ArachnaeLog.Debug($"Error in StatWorker_IncubationCost.GetValueUnfinalized for {req.Def?.defName}: {ex.Message}"); return 0f; } } @@ -59,7 +59,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Warning($"Error in StatWorker_IncubationCost.GetExplanationUnfinalized for {req.Def?.defName}: {ex.Message}"); + ArachnaeLog.Debug($"Error in StatWorker_IncubationCost.GetExplanationUnfinalized for {req.Def?.defName}: {ex.Message}"); return string.Empty; } } @@ -73,7 +73,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Warning($"Error in StatWorker_IncubationCost.HasIncubationComp for {req.Def?.defName}: {ex.Message}"); + ArachnaeLog.Debug($"Error in StatWorker_IncubationCost.HasIncubationComp for {req.Def?.defName}: {ex.Message}"); return false; } } @@ -94,7 +94,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Warning($"Error in StatWorker_IncubationTime.ShouldShowFor for {req.Def?.defName}: {ex.Message}"); + ArachnaeLog.Debug($"Error in StatWorker_IncubationTime.ShouldShowFor for {req.Def?.defName}: {ex.Message}"); return false; } } @@ -117,7 +117,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Warning($"Error in StatWorker_IncubationTime.GetValueUnfinalized for {req.Def?.defName}: {ex.Message}"); + ArachnaeLog.Debug($"Error in StatWorker_IncubationTime.GetValueUnfinalized for {req.Def?.defName}: {ex.Message}"); return 0f; } } @@ -134,7 +134,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Warning($"Error in StatWorker_IncubationTime.GetExplanationUnfinalized for {req.Def?.defName}: {ex.Message}"); + ArachnaeLog.Debug($"Error in StatWorker_IncubationTime.GetExplanationUnfinalized for {req.Def?.defName}: {ex.Message}"); return string.Empty; } } @@ -150,7 +150,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Warning($"Error in StatWorker_IncubationTime.GetStatDrawEntryLabel for {req.Def?.defName}: {ex.Message}"); + ArachnaeLog.Debug($"Error in StatWorker_IncubationTime.GetStatDrawEntryLabel for {req.Def?.defName}: {ex.Message}"); return value.ToString(); } } @@ -164,7 +164,7 @@ namespace ArachnaeSwarm } catch (System.Exception ex) { - Log.Warning($"Error in StatWorker_IncubationTime.HasIncubationComp for {req.Def?.defName}: {ex.Message}"); + ArachnaeLog.Debug($"Error in StatWorker_IncubationTime.HasIncubationComp for {req.Def?.defName}: {ex.Message}"); return false; } } diff --git a/Source/ArachnaeSwarm/Storyteller/CustomRaidTracker.cs b/Source/ArachnaeSwarm/Storyteller/CustomRaidTracker.cs index 8f3bb18..25b9b1d 100644 --- a/Source/ArachnaeSwarm/Storyteller/CustomRaidTracker.cs +++ b/Source/ArachnaeSwarm/Storyteller/CustomRaidTracker.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Verse; namespace ArachnaeSwarm @@ -28,7 +28,7 @@ namespace ArachnaeSwarm { if (raidDef == null) { - Log.Warning("GetCurrentWave called with null raidDef"); + ArachnaeLog.Debug("GetCurrentWave called with null raidDef"); return 0; } @@ -49,11 +49,11 @@ namespace ArachnaeSwarm int currentWave = GetCurrentWave(raidDef); waveCounters[key] = currentWave + 1; - Log.Message($"CustomRaidTracker: Incremented wave for {raidDef.defName} to {waveCounters[key]}"); + ArachnaeLog.Debug($"CustomRaidTracker: Incremented wave for {raidDef.defName} to {waveCounters[key]}"); } else { - Log.Warning("IncrementWave called with null raidDef"); + ArachnaeLog.Debug("IncrementWave called with null raidDef"); } } diff --git a/Source/ArachnaeSwarm/Storyteller/IncidentWorker_CustomRaid.cs b/Source/ArachnaeSwarm/Storyteller/IncidentWorker_CustomRaid.cs index affe99c..9a58e26 100644 --- a/Source/ArachnaeSwarm/Storyteller/IncidentWorker_CustomRaid.cs +++ b/Source/ArachnaeSwarm/Storyteller/IncidentWorker_CustomRaid.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using RimWorld; using Verse; @@ -29,21 +29,21 @@ namespace ArachnaeSwarm CustomRaidDef raidDef = GetCustomRaidDef(); if (raidDef == null) { - Log.Warning("CustomRaidDef not found in CanFireNowSub"); + ArachnaeLog.Debug("CustomRaidDef not found in CanFireNowSub"); return false; } // 检查最小天数 if (GenDate.DaysPassedSinceSettle < 15f) // 可以配置化 { - Log.Message($"Custom raid cannot fire: only {GenDate.DaysPassedSinceSettle} days passed, need 15"); + ArachnaeLog.Debug($"Custom raid cannot fire: only {GenDate.DaysPassedSinceSettle} days passed, need 15"); return false; } // 检查目标是否有效 if (parms.target == null) { - Log.Warning("Custom raid target is null"); + ArachnaeLog.Debug("Custom raid target is null"); return false; } @@ -51,7 +51,7 @@ namespace ArachnaeSwarm Map map = parms.target as Map; if (map == null) { - Log.Warning("Custom raid target is not a Map or map is null"); + ArachnaeLog.Debug("Custom raid target is not a Map or map is null"); return false; } @@ -59,7 +59,7 @@ namespace ArachnaeSwarm Faction faction = Find.FactionManager.FirstFactionOfDef(raidDef.factionDef); if (faction == null) { - Log.Warning($"Faction {raidDef.factionDef?.defName} not found for custom raid"); + ArachnaeLog.Debug($"Faction {raidDef.factionDef?.defName} not found for custom raid"); return false; } @@ -68,58 +68,58 @@ namespace ArachnaeSwarm protected override bool TryExecuteWorker(IncidentParms parms) { - Log.Message("=== Custom Raid Incident Started ==="); + ArachnaeLog.Debug("=== Custom Raid Incident Started ==="); // 检查目标地图 Map map = parms.target as Map; if (map == null) { - Log.Error("Custom raid target is not a valid Map"); + ArachnaeLog.Debug("Custom raid target is not a valid Map"); return false; } CustomRaidDef raidDef = GetCustomRaidDef(); if (raidDef == null) { - Log.Error("CustomRaidDef not found"); + ArachnaeLog.Debug("CustomRaidDef not found"); return false; } CustomRaidTracker tracker = GetTracker(); if (tracker == null) { - Log.Error("CustomRaidTracker not found"); + ArachnaeLog.Debug("CustomRaidTracker not found"); return false; } // 获取当前波次 int currentWave = tracker.GetCurrentWave(raidDef); - Log.Message($"Current wave: {currentWave}"); + ArachnaeLog.Debug($"Current wave: {currentWave}"); // 计算袭击规模 int raidSize = CalculateRaidSize(currentWave, raidDef); - Log.Message($"Calculated raid size: {raidSize}"); + ArachnaeLog.Debug($"Calculated raid size: {raidSize}"); // 选择波次定义 RaidWaveDef waveDef = SelectWaveForSize(raidSize, raidDef); if (waveDef == null) { - Log.Error($"No wave found for raid size {raidSize}"); + ArachnaeLog.Debug($"No wave found for raid size {raidSize}"); return false; } - Log.Message($"Selected wave: {waveDef.defName}"); + ArachnaeLog.Debug($"Selected wave: {waveDef.defName}"); // 设置派系 parms.faction = Find.FactionManager.FirstFactionOfDef(raidDef.factionDef); if (parms.faction == null) { - Log.Error($"Faction {raidDef.factionDef.defName} not found"); + ArachnaeLog.Debug($"Faction {raidDef.factionDef.defName} not found"); return false; } // 设置点数 parms.points = CalculateThreatPoints(raidSize); - Log.Message($"Threat points: {parms.points}"); + ArachnaeLog.Debug($"Threat points: {parms.points}"); // 设置袭击策略 parms.raidStrategy = RaidStrategyDefOf.ImmediateAttack; @@ -130,7 +130,7 @@ namespace ArachnaeSwarm parms.SetCustomRaidDef(raidDef); parms.SetCustomRaidWaveNumber(currentWave); - Log.Message($"Custom raid parameters set: wave={waveDef.defName}, size={raidSize}, waveNum={currentWave}"); + ArachnaeLog.Debug($"Custom raid parameters set: wave={waveDef.defName}, size={raidSize}, waveNum={currentWave}"); // 执行袭击 bool success = base.TryExecuteWorker(parms); @@ -139,14 +139,14 @@ namespace ArachnaeSwarm { // 成功执行后增加波次 tracker.IncrementWave(raidDef); - Log.Message($"Custom raid wave {currentWave + 1} executed successfully. Next wave will be {currentWave + 2}"); + ArachnaeLog.Debug($"Custom raid wave {currentWave + 1} executed successfully. Next wave will be {currentWave + 2}"); } else { - Log.Error("Custom raid execution failed"); + ArachnaeLog.Debug("Custom raid execution failed"); } - Log.Message("=== Custom Raid Incident Finished ==="); + ArachnaeLog.Debug("=== Custom Raid Incident Finished ==="); return success; } @@ -155,7 +155,7 @@ namespace ArachnaeSwarm // 对于自定义袭击,我们已经通过扩展设置了派系 if (parms.faction != null) { - Log.Message($"Raid faction resolved: {parms.faction.Name}"); + ArachnaeLog.Debug($"Raid faction resolved: {parms.faction.Name}"); return true; } @@ -165,11 +165,11 @@ namespace ArachnaeSwarm { parms.faction = Find.FactionManager.FirstFactionOfDef(raidDef.factionDef); bool success = parms.faction != null; - Log.Message($"Resolved faction from raidDef: {raidDef.factionDef.defName}, success: {success}"); + ArachnaeLog.Debug($"Resolved faction from raidDef: {raidDef.factionDef.defName}, success: {success}"); return success; } - Log.Warning("Could not resolve raid faction"); + ArachnaeLog.Debug("Could not resolve raid faction"); return false; } @@ -178,7 +178,7 @@ namespace ArachnaeSwarm // 如果已经设置了袭击策略,直接使用 if (parms.raidStrategy != null) { - Log.Message($"Raid strategy already set: {parms.raidStrategy.defName}"); + ArachnaeLog.Debug($"Raid strategy already set: {parms.raidStrategy.defName}"); return; } @@ -189,13 +189,13 @@ namespace ArachnaeSwarm // 这里可以根据 waveDef 的内容设置不同的策略 // 例如,如果有特定标签就使用特定策略 parms.raidStrategy = RaidStrategyDefOf.ImmediateAttack; - Log.Message($"Set raid strategy from waveDef: {parms.raidStrategy.defName}"); + ArachnaeLog.Debug($"Set raid strategy from waveDef: {parms.raidStrategy.defName}"); return; } // 默认策略 parms.raidStrategy = RaidStrategyDefOf.ImmediateAttack; - Log.Message($"Set default raid strategy: {parms.raidStrategy.defName}"); + ArachnaeLog.Debug($"Set default raid strategy: {parms.raidStrategy.defName}"); } protected override void ResolveRaidPoints(IncidentParms parms) @@ -203,7 +203,7 @@ namespace ArachnaeSwarm // 如果已经设置了点数,直接使用 if (parms.points > 0) { - Log.Message($"Raid points already set: {parms.points}"); + ArachnaeLog.Debug($"Raid points already set: {parms.points}"); return; } @@ -212,13 +212,13 @@ namespace ArachnaeSwarm if (raidSize > 0) { parms.points = CalculateThreatPoints(raidSize); - Log.Message($"Set raid points from custom size: {raidSize} -> {parms.points}"); + ArachnaeLog.Debug($"Set raid points from custom size: {raidSize} -> {parms.points}"); return; } // 回退到原版点数计算 parms.points = StorytellerUtility.DefaultThreatPointsNow(parms.target); - Log.Message($"Set raid points from default calculation: {parms.points}"); + ArachnaeLog.Debug($"Set raid points from default calculation: {parms.points}"); } protected override string GetLetterLabel(IncidentParms parms) @@ -279,42 +279,42 @@ namespace ArachnaeSwarm int baseSize = raidDef.baseRaidNembers; var growthConfig = raidDef.pointsGrowthPerWave; - Log.Message($"Calculating raid size: base={baseSize}, wave={currentWave}, growthType={growthConfig.growthType}"); + ArachnaeLog.Debug($"Calculating raid size: base={baseSize}, wave={currentWave}, growthType={growthConfig.growthType}"); if (growthConfig.growthType == "Linear") { int result = baseSize + (int)(currentWave * growthConfig.linearGrowth); - Log.Message($"Linear growth: {baseSize} + ({currentWave} * {growthConfig.linearGrowth}) = {result}"); + ArachnaeLog.Debug($"Linear growth: {baseSize} + ({currentWave} * {growthConfig.linearGrowth}) = {result}"); return result; } else if (growthConfig.growthType == "Exponential") { int result = (int)(baseSize * System.Math.Pow(growthConfig.exponentialBase, currentWave)); - Log.Message($"Exponential growth: {baseSize} * {growthConfig.exponentialBase}^{currentWave} = {result}"); + ArachnaeLog.Debug($"Exponential growth: {baseSize} * {growthConfig.exponentialBase}^{currentWave} = {result}"); return result; } // 默认线性增长 int defaultResult = baseSize + currentWave; - Log.Message($"Default growth: {baseSize} + {currentWave} = {defaultResult}"); + ArachnaeLog.Debug($"Default growth: {baseSize} + {currentWave} = {defaultResult}"); return defaultResult; } private RaidWaveDef SelectWaveForSize(int raidSize, CustomRaidDef raidDef) { - Log.Message($"Selecting wave for size: {raidSize}"); + ArachnaeLog.Debug($"Selecting wave for size: {raidSize}"); foreach (var poolRange in raidDef.pointWavePools) { bool minCondition = raidSize >= poolRange.minPoints; bool maxCondition = poolRange.maxPoints >= 99999f || raidSize < poolRange.maxPoints; - Log.Message($"Checking pool range: min={poolRange.minPoints}, max={poolRange.maxPoints}, matches={minCondition && maxCondition}"); + ArachnaeLog.Debug($"Checking pool range: min={poolRange.minPoints}, max={poolRange.maxPoints}, matches={minCondition && maxCondition}"); if (minCondition && maxCondition) { var selectedWave = SelectWaveFromPool(poolRange.wavePool); - Log.Message($"Selected wave from pool {poolRange.wavePool.defName}: {selectedWave?.defName}"); + ArachnaeLog.Debug($"Selected wave from pool {poolRange.wavePool.defName}: {selectedWave?.defName}"); return selectedWave; } } @@ -324,11 +324,11 @@ namespace ArachnaeSwarm { var lastPool = raidDef.pointWavePools[raidDef.pointWavePools.Count - 1]; var selectedWave = SelectWaveFromPool(lastPool.wavePool); - Log.Message($"Selected wave from last pool {lastPool.wavePool.defName}: {selectedWave?.defName}"); + ArachnaeLog.Debug($"Selected wave from last pool {lastPool.wavePool.defName}: {selectedWave?.defName}"); return selectedWave; } - Log.Error("No wave pools found in CustomRaidDef"); + ArachnaeLog.Debug("No wave pools found in CustomRaidDef"); return null; } @@ -336,13 +336,13 @@ namespace ArachnaeSwarm { if (wavePool == null) { - Log.Error("WavePool is null"); + ArachnaeLog.Debug("WavePool is null"); return null; } if (wavePool.waves.NullOrEmpty()) { - Log.Error($"WavePool {wavePool.defName} has no waves"); + ArachnaeLog.Debug($"WavePool {wavePool.defName} has no waves"); return null; } @@ -353,14 +353,14 @@ namespace ArachnaeSwarm if (weightedWaves.Any()) { var selected = weightedWaves.RandomElementByWeight(waveDef => wavePool.selectionWeights[waveDef.defName]); - Log.Message($"Selected weighted wave: {selected.defName}"); + ArachnaeLog.Debug($"Selected weighted wave: {selected.defName}"); return selected; } } // 否则均匀随机 var randomWave = wavePool.waves.RandomElement(); - Log.Message($"Selected random wave: {randomWave.defName}"); + ArachnaeLog.Debug($"Selected random wave: {randomWave.defName}"); return randomWave; } @@ -369,7 +369,7 @@ namespace ArachnaeSwarm // 根据袭击规模计算威胁点数 // 这里可以基于原版的威胁点数计算逻辑进行调整 float points = raidSize * 100f; - Log.Message($"Calculated threat points: {raidSize} * 100 = {points}"); + ArachnaeLog.Debug($"Calculated threat points: {raidSize} * 100 = {points}"); return points; } @@ -378,7 +378,7 @@ namespace ArachnaeSwarm { if (parms.raidArrivalMode != null) { - Log.Message($"Raid arrival mode already set: {parms.raidArrivalMode.defName}"); + ArachnaeLog.Debug($"Raid arrival mode already set: {parms.raidArrivalMode.defName}"); return; } // 从自定义波次定义中获取进场方式 @@ -392,7 +392,7 @@ namespace ArachnaeSwarm selectedMode = waveDef.possibleArrivalModes.RandomElement(); parms.raidArrivalMode = selectedMode; - Log.Message($"Set random raid arrival mode from waveDef: {parms.raidArrivalMode.defName}"); + ArachnaeLog.Debug($"Set random raid arrival mode from waveDef: {parms.raidArrivalMode.defName}"); return; } } @@ -402,13 +402,13 @@ namespace ArachnaeSwarm { // 阿拉克涅虫群默认使用空投 parms.raidArrivalMode = PawnsArrivalModeDefOf.CenterDrop; - Log.Message($"Set ARA_Hostile_Hive default raid arrival mode: {parms.raidArrivalMode.defName}"); + ArachnaeLog.Debug($"Set ARA_Hostile_Hive default raid arrival mode: {parms.raidArrivalMode.defName}"); } else { // 默认使用边缘进入 parms.raidArrivalMode = PawnsArrivalModeDefOf.EdgeWalkIn; - Log.Message($"Set default raid arrival mode: {parms.raidArrivalMode.defName}"); + ArachnaeLog.Debug($"Set default raid arrival mode: {parms.raidArrivalMode.defName}"); } } @@ -423,7 +423,7 @@ namespace ArachnaeSwarm Map map = Find.CurrentMap; if (map == null) { - Log.Error("No current map found"); + ArachnaeLog.Debug("No current map found"); return; } @@ -437,7 +437,7 @@ namespace ArachnaeSwarm } else { - Log.Error("CustomRaidIncident not found"); + ArachnaeLog.Debug("CustomRaidIncident not found"); } } } diff --git a/Source/ArachnaeSwarm/Thing_Comps/ARA_ThingComp_GuardianPsyField/Hediff_DynamicInterceptor.cs b/Source/ArachnaeSwarm/Thing_Comps/ARA_ThingComp_GuardianPsyField/Hediff_DynamicInterceptor.cs index 3c939c3..64abb07 100644 --- a/Source/ArachnaeSwarm/Thing_Comps/ARA_ThingComp_GuardianPsyField/Hediff_DynamicInterceptor.cs +++ b/Source/ArachnaeSwarm/Thing_Comps/ARA_ThingComp_GuardianPsyField/Hediff_DynamicInterceptor.cs @@ -1,4 +1,4 @@ -using Verse; +using Verse; using RimWorld; using System.Linq; using System; // For Activator @@ -24,7 +24,7 @@ namespace ArachnaeSwarm { if (pawn.GetComp() == null) { - Log.Message($"[DynamicInterceptor] Adding ThingComp_GuardianPsyField to {pawn.LabelShort}."); + ArachnaeLog.Debug($"[DynamicInterceptor] Adding ThingComp_GuardianPsyField to {pawn.LabelShort}."); var newComp = (ThingComp_GuardianPsyField)Activator.CreateInstance(typeof(ThingComp_GuardianPsyField)); newComp.parent = pawn; // Initialize with the actual properties from the HediffDef @@ -42,7 +42,7 @@ namespace ArachnaeSwarm var comp = pawn.GetComp(); if (comp != null) { - Log.Message($"[DynamicInterceptor] Removing ThingComp_GuardianPsyField from {pawn.LabelShort}."); + ArachnaeLog.Debug($"[DynamicInterceptor] Removing ThingComp_GuardianPsyField from {pawn.LabelShort}."); pawn.AllComps.Remove(comp); } } diff --git a/Source/ArachnaeSwarm/Verbs/Projectiles/Projectile_WulaPenetratingBeam.cs b/Source/ArachnaeSwarm/Verbs/Projectiles/Projectile_WulaPenetratingBeam.cs index 2fd1d98..b1fc038 100644 --- a/Source/ArachnaeSwarm/Verbs/Projectiles/Projectile_WulaPenetratingBeam.cs +++ b/Source/ArachnaeSwarm/Verbs/Projectiles/Projectile_WulaPenetratingBeam.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using UnityEngine; using Verse; @@ -33,7 +33,7 @@ namespace ArachnaeSwarm Wula_BeamPierce_Extension props = Props; if (props == null) { - Log.Error("Projectile_WulaBeam requires a Wula_BeamPierce_Extension in its def."); + ArachnaeLog.Debug("Projectile_WulaBeam requires a Wula_BeamPierce_Extension in its def."); Destroy(DestroyMode.Vanish); return; } diff --git a/Source/ArachnaeSwarm/Verbs/Verb_ShootArc.cs b/Source/ArachnaeSwarm/Verbs/Verb_ShootArc.cs index cc3d2bb..4853e83 100644 --- a/Source/ArachnaeSwarm/Verbs/Verb_ShootArc.cs +++ b/Source/ArachnaeSwarm/Verbs/Verb_ShootArc.cs @@ -333,7 +333,7 @@ namespace ArachnaeSwarm bool flag2 = flag; if (flag2) { - Log.Error("TargetTakeDamage has null caster or target"); + ArachnaeLog.Debug("TargetTakeDamage has null caster or target"); } else {