diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index addba1b1..bc924a42 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.pdb b/1.6/1.6/Assemblies/WulaFallenEmpire.pdb index f31330a9..899a481b 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.pdb and b/1.6/1.6/Assemblies/WulaFallenEmpire.pdb differ diff --git a/1.6/1.6/Languages/English/DefInjected/Defs/Recipes_WULA..xml b/1.6/1.6/Languages/English/DefInjected/Defs/Recipes_WULA..xml deleted file mode 100644 index c3e0b96e..00000000 --- a/1.6/1.6/Languages/English/DefInjected/Defs/Recipes_WULA..xml +++ /dev/null @@ -1,46 +0,0 @@ - - - Produce Wula Empire Alloy - A high-density alloy produced by processing steel, it is the raw material for many Wula Empire equipment. - Forging alloy - - Produce Wula Empire Alloy (10 pieces) - A high-density alloy produced by processing steel, it is the raw material for many Wula Empire equipment. - Forging alloy - - Manufacture Components - Manufacture components using Wula Empire fabricators. Takes longer than a precision assembly bench and consumes more resources. - Manufacturing components - - Manufacture Wula Empire Power Core - Manufacture a Wula Empire power core, including a rechargeable capacitor and energy to supply machinery. This is the only acceptable external energy source for mechanical Wulas and a precursor for many Wula Empire products. - Manufacturing Wula Empire power core - - Recharge Power Core - Use chemfuel to recharge depleted Wula Empire power cores that have lost their energy. - Recharging Wula Empire power core - - Recharge Power Cores (4) - Use chemfuel to recharge depleted Wula Empire power cores that have lost their energy. - Recharging Wula Empire power cores - - Manufacture Wula Empire Dark Matter - Manufacture 1 unit of encapsulated dark matter, consisting of a dark matter containment device and dark matter. It is a necessary energy source for Wula Empire large-scale facilities and armaments. - Manufacturing Wula Empire dark matter - - Compress Neutronium - Manufacture 1 unit of neutronium, a powerful material that can create the hardest armor or the strongest melee weapons. - Compressing neutronium - - Build URa-00 "Mechanical Wula" - Build a URa-00 "Mechanical Wula" synth, the main species of a Wula Empire synth colony. Possesses complex, realistic simulated emotions while being a mechanoid. - - Build CAt-11 "Cat" - Build a CAt-11 "Cat". - - Build CAt-86 "Cat Worker" - Build a CAt-86 "Cat Worker". - - Build CAt-46 "Cat Assault Force" - Build a CAt-46 "Cat Assault Force". - diff --git a/Source/WulaFallenEmpire/Ability/LightningBombardment.cs b/Source/WulaFallenEmpire/Ability/LightningBombardment.cs index c80ce943..384ecf50 100644 --- a/Source/WulaFallenEmpire/Ability/LightningBombardment.cs +++ b/Source/WulaFallenEmpire/Ability/LightningBombardment.cs @@ -111,7 +111,7 @@ namespace WulaFallenEmpire // 防止过多任务影响性能 if (activeCoroutines.Count >= MAX_CONCURRENT_BOMBARDMENTS) { - Log.Warning($"Too many concurrent bombardments on map {map}, max is {MAX_CONCURRENT_BOMBARDMENTS}"); + WulaLog.Debug($"Too many concurrent bombardments on map {map}, max is {MAX_CONCURRENT_BOMBARDMENTS}"); return; } @@ -146,7 +146,7 @@ namespace WulaFallenEmpire } catch (Exception ex) { - Log.Error($"Lightning bombardment error: {ex}"); + WulaLog.Debug($"Lightning bombardment error: {ex}"); activeCoroutines.Clear(); } } diff --git a/Source/WulaFallenEmpire/Ability/WULA_AbilityAreaDestruction/CompAbilityEffect_AreaDestruction.cs b/Source/WulaFallenEmpire/Ability/WULA_AbilityAreaDestruction/CompAbilityEffect_AreaDestruction.cs index a0ea0820..98ce00c4 100644 --- a/Source/WulaFallenEmpire/Ability/WULA_AbilityAreaDestruction/CompAbilityEffect_AreaDestruction.cs +++ b/Source/WulaFallenEmpire/Ability/WULA_AbilityAreaDestruction/CompAbilityEffect_AreaDestruction.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using UnityEngine; using Verse; @@ -99,14 +99,14 @@ namespace WulaFallenEmpire // 处理目标 ProcessTarget(thing); - Log.Message($"[AreaDestruction] Cleared overlapping object: {thing.Label} at {casterPos}"); + WulaLog.Debug($"[AreaDestruction] Cleared overlapping object: {thing.Label} at {casterPos}"); } } } } catch (System.Exception ex) { - Log.Warning($"[AreaDestruction] Error clearing overlapping objects: {ex.Message}"); + WulaLog.Debug($"[AreaDestruction] Error clearing overlapping objects: {ex.Message}"); } } @@ -135,7 +135,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"[AreaDestruction] Error playing clear effecter: {ex.Message}"); + WulaLog.Debug($"[AreaDestruction] Error playing clear effecter: {ex.Message}"); } } @@ -174,7 +174,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"[AreaDestruction] Error playing hit effecter on {target?.Label}: {ex.Message}"); + WulaLog.Debug($"[AreaDestruction] Error playing hit effecter on {target?.Label}: {ex.Message}"); } } @@ -243,11 +243,11 @@ namespace WulaFallenEmpire building.Destroy(DestroyMode.Vanish); // 可选:记录日志用于调试 - // Log.Message($"[AreaDestruction] Destroyed building: {buildingInfo}"); + // WulaLog.Debug($"[AreaDestruction] Destroyed building: {buildingInfo}"); } catch (System.Exception ex) { - Log.Warning($"[AreaDestruction] Error destroying building {building?.Label}: {ex.Message}"); + WulaLog.Debug($"[AreaDestruction] Error destroying building {building?.Label}: {ex.Message}"); } } @@ -287,7 +287,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"[AreaDestruction] Error destroying body parts on {targetPawn?.Label}: {ex.Message}"); + WulaLog.Debug($"[AreaDestruction] Error destroying body parts on {targetPawn?.Label}: {ex.Message}"); } } diff --git a/Source/WulaFallenEmpire/Ability/WULA_AbilityBombardment/CompAbilityEffect_Bombardment.cs b/Source/WulaFallenEmpire/Ability/WULA_AbilityBombardment/CompAbilityEffect_Bombardment.cs index ea9d84bf..42f77da0 100644 --- a/Source/WulaFallenEmpire/Ability/WULA_AbilityBombardment/CompAbilityEffect_Bombardment.cs +++ b/Source/WulaFallenEmpire/Ability/WULA_AbilityBombardment/CompAbilityEffect_Bombardment.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using UnityEngine; using System.Collections.Generic; @@ -36,7 +36,7 @@ namespace WulaFallenEmpire try { - Log.Message($"[Bombardment] Starting bombardment at {target.Cell} with direction to {dest.Cell}"); + WulaLog.Debug($"[Bombardment] Starting bombardment at {target.Cell} with direction to {dest.Cell}"); // 计算轰炸区域和方向(基于两个目标点) CalculateBombardmentArea(target.Cell, dest.Cell); @@ -50,11 +50,11 @@ namespace WulaFallenEmpire // 开始前摇 StartWarmup(); - Log.Message($"[Bombardment] Bombardment initialized: {targetCells.Count} targets in {bombardmentRows.Count} rows"); + WulaLog.Debug($"[Bombardment] Bombardment initialized: {targetCells.Count} targets in {bombardmentRows.Count} rows"); } catch (System.Exception ex) { - Log.Error($"[Bombardment] Error starting bombardment: {ex}"); + WulaLog.Debug($"[Bombardment] Error starting bombardment: {ex}"); } } @@ -253,7 +253,7 @@ namespace WulaFallenEmpire bombardmentDirection = direction; - Log.Message($"[Bombardment] Bombardment direction: {bombardmentDirection} (from {startCell} to {directionCell})"); + WulaLog.Debug($"[Bombardment] Bombardment direction: {bombardmentDirection} (from {startCell} to {directionCell})"); } private void SelectTargetCells() @@ -294,7 +294,7 @@ namespace WulaFallenEmpire } targetCells = selectedCells; - Log.Message($"[Bombardment] Selected {targetCells.Count} target cells from {areaCells.Count} area cells"); + WulaLog.Debug($"[Bombardment] Selected {targetCells.Count} target cells from {areaCells.Count} area cells"); } // 修复:重新组织目标格子成排,确保正确的渐进顺序 @@ -343,7 +343,7 @@ namespace WulaFallenEmpire }); } - Log.Message($"[Bombardment] Organized into {bombardmentRows.Count} rows in progressive order"); + WulaLog.Debug($"[Bombardment] Organized into {bombardmentRows.Count} rows in progressive order"); } private void StartWarmup() @@ -359,7 +359,7 @@ namespace WulaFallenEmpire CreateAreaEffecter(); } - Log.Message($"[Bombardment] Warmup started: {warmupTicksRemaining} ticks remaining"); + WulaLog.Debug($"[Bombardment] Warmup started: {warmupTicksRemaining} ticks remaining"); } private void UpdateWarmup() @@ -371,7 +371,7 @@ namespace WulaFallenEmpire // 前摇结束,开始轰炸 currentState = BombardmentState.Bombarding; nextBombardmentTick = Find.TickManager.TicksGame; - Log.Message($"[Bombardment] Warmup completed, starting progressive bombardment"); + WulaLog.Debug($"[Bombardment] Warmup completed, starting progressive bombardment"); } } @@ -384,7 +384,7 @@ namespace WulaFallenEmpire { // 所有排都轰炸完毕 currentState = BombardmentState.Completed; - Log.Message($"[Bombardment] Progressive bombardment completed"); + WulaLog.Debug($"[Bombardment] Progressive bombardment completed"); return; } @@ -396,7 +396,7 @@ namespace WulaFallenEmpire currentRowIndex++; currentCellIndex = 0; nextBombardmentTick = Find.TickManager.TicksGame + Props.rowDelayTicks; - Log.Message($"[Bombardment] Moving to next row {currentRowIndex + 1}/{bombardmentRows.Count}"); + WulaLog.Debug($"[Bombardment] Moving to next row {currentRowIndex + 1}/{bombardmentRows.Count}"); return; } @@ -408,7 +408,7 @@ namespace WulaFallenEmpire nextBombardmentTick = Find.TickManager.TicksGame + Props.impactDelayTicks; // 记录轰炸进度 - Log.Message($"[Bombardment] Bombarding cell {currentCellIndex}/{currentRow.cells.Count} in row {currentRowIndex + 1}/{bombardmentRows.Count}"); + WulaLog.Debug($"[Bombardment] Bombarding cell {currentCellIndex}/{currentRow.cells.Count} in row {currentRowIndex + 1}/{bombardmentRows.Count}"); } private void LaunchBombardment(IntVec3 targetCell) @@ -420,7 +420,7 @@ namespace WulaFallenEmpire // 使用 Skyfaller Skyfaller skyfaller = SkyfallerMaker.MakeSkyfaller(Props.skyfallerDef); GenSpawn.Spawn(skyfaller, targetCell, parent.pawn.Map); - Log.Message($"[Bombardment] Launched skyfaller at {targetCell}"); + WulaLog.Debug($"[Bombardment] Launched skyfaller at {targetCell}"); } else if (Props.projectileDef != null) { @@ -429,12 +429,12 @@ namespace WulaFallenEmpire } else { - Log.Error($"[Bombardment] No skyfaller or projectile defined for bombardment"); + WulaLog.Debug($"[Bombardment] No skyfaller or projectile defined for bombardment"); } } catch (System.Exception ex) { - Log.Error($"[Bombardment] Error launching bombardment at {targetCell}: {ex}"); + WulaLog.Debug($"[Bombardment] Error launching bombardment at {targetCell}: {ex}"); } } @@ -455,7 +455,7 @@ namespace WulaFallenEmpire ProjectileHitFlags.All, false ); - Log.Message($"[Bombardment] Launched projectile at {targetCell}"); + WulaLog.Debug($"[Bombardment] Launched projectile at {targetCell}"); } } @@ -482,7 +482,7 @@ namespace WulaFallenEmpire bombardmentRows.Clear(); currentPreviewCells.Clear(); - Log.Message($"[Bombardment] Cleanup completed"); + WulaLog.Debug($"[Bombardment] Cleanup completed"); } private IntVec3 GetSafeMapPosition(IntVec3 pos, Map map) diff --git a/Source/WulaFallenEmpire/Ability/WULA_AbilityCallSkyfaller/CompAbilityEffect_CallSkyfaller.cs b/Source/WulaFallenEmpire/Ability/WULA_AbilityCallSkyfaller/CompAbilityEffect_CallSkyfaller.cs index 887e9ba7..e60e0d7f 100644 --- a/Source/WulaFallenEmpire/Ability/WULA_AbilityCallSkyfaller/CompAbilityEffect_CallSkyfaller.cs +++ b/Source/WulaFallenEmpire/Ability/WULA_AbilityCallSkyfaller/CompAbilityEffect_CallSkyfaller.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using UnityEngine; using System.Collections.Generic; @@ -21,11 +21,11 @@ namespace WulaFallenEmpire // 创建延时召唤 CallSkyfallerDelayed(target.Cell); - Log.Message($"[CallSkyfaller] Scheduled skyfaller at {target.Cell} with {Props.delayTicks} ticks delay"); + WulaLog.Debug($"[CallSkyfaller] Scheduled skyfaller at {target.Cell} with {Props.delayTicks} ticks delay"); } catch (System.Exception ex) { - Log.Error($"[CallSkyfaller] Error calling skyfaller: {ex}"); + WulaLog.Debug($"[CallSkyfaller] Error calling skyfaller: {ex}"); } } diff --git a/Source/WulaFallenEmpire/Ability/WULA_AbilityCallSkyfaller/MapComponent_SkyfallerDelayed.cs b/Source/WulaFallenEmpire/Ability/WULA_AbilityCallSkyfaller/MapComponent_SkyfallerDelayed.cs index a71ea5a4..2e5cbb34 100644 --- a/Source/WulaFallenEmpire/Ability/WULA_AbilityCallSkyfaller/MapComponent_SkyfallerDelayed.cs +++ b/Source/WulaFallenEmpire/Ability/WULA_AbilityCallSkyfaller/MapComponent_SkyfallerDelayed.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using Verse; @@ -49,12 +49,12 @@ namespace WulaFallenEmpire if (Prefs.DevMode) { - Log.Message($"[DelayedSkyfaller] Spawned '{delayedSkyfaller.skyfallerDef.defName}' at {delayedSkyfaller.targetCell}"); + WulaLog.Debug($"[DelayedSkyfaller] Spawned '{delayedSkyfaller.skyfallerDef.defName}' at {delayedSkyfaller.targetCell}"); } } catch (System.Exception ex) { - Log.Error($"[DelayedSkyfaller] Error spawning skyfaller: {ex}"); + WulaLog.Debug($"[DelayedSkyfaller] Error spawning skyfaller: {ex}"); } } diff --git a/Source/WulaFallenEmpire/Ability/WULA_AbilityCircularBombardment/CompAbilityEffect_CircularBombardment.cs b/Source/WulaFallenEmpire/Ability/WULA_AbilityCircularBombardment/CompAbilityEffect_CircularBombardment.cs index e4af6f81..e8059419 100644 --- a/Source/WulaFallenEmpire/Ability/WULA_AbilityCircularBombardment/CompAbilityEffect_CircularBombardment.cs +++ b/Source/WulaFallenEmpire/Ability/WULA_AbilityCircularBombardment/CompAbilityEffect_CircularBombardment.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using UnityEngine; using System.Collections.Generic; @@ -38,7 +38,7 @@ namespace WulaFallenEmpire try { - Log.Message($"[CircularBombardment] Starting circular bombardment at {target.Cell}"); + WulaLog.Debug($"[CircularBombardment] Starting circular bombardment at {target.Cell}"); // 设置轰炸中心 bombardmentCenter = target.Cell; @@ -52,13 +52,13 @@ namespace WulaFallenEmpire // 开始前摇 StartWarmup(); - Log.Message($"[CircularBombardment] Bombardment initialized: {targetCells.Count} targets, " + + WulaLog.Debug($"[CircularBombardment] Bombardment initialized: {targetCells.Count} targets, " + $"{Props.simultaneousLaunches} simultaneous launches, " + $"independent intervals: {Props.useIndependentIntervals}"); } catch (System.Exception ex) { - Log.Error($"[CircularBombardment] Error starting bombardment: {ex}"); + WulaLog.Debug($"[CircularBombardment] Error starting bombardment: {ex}"); } } @@ -226,7 +226,7 @@ namespace WulaFallenEmpire } targetCells = selectedCells; - Log.Message($"[CircularBombardment] Selected {targetCells.Count} target cells from {areaCells.Count} area cells"); + WulaLog.Debug($"[CircularBombardment] Selected {targetCells.Count} target cells from {areaCells.Count} area cells"); } // 检查单元格是否有效 @@ -269,7 +269,7 @@ namespace WulaFallenEmpire launchesCompleted = 0; currentGroupIndex = 0; - Log.Message($"[CircularBombardment] Warmup started: {warmupTicksRemaining} ticks remaining"); + WulaLog.Debug($"[CircularBombardment] Warmup started: {warmupTicksRemaining} ticks remaining"); } private void UpdateWarmup() @@ -281,7 +281,7 @@ namespace WulaFallenEmpire // 前摇结束,开始发射 currentState = CircularBombardmentState.Launching; nextLaunchTick = Find.TickManager.TicksGame; - Log.Message($"[CircularBombardment] Warmup completed, starting launches"); + WulaLog.Debug($"[CircularBombardment] Warmup completed, starting launches"); } } @@ -291,7 +291,7 @@ namespace WulaFallenEmpire if (remainingTargets.Count == 0 || launchesCompleted >= Props.maxLaunches) { currentState = CircularBombardmentState.Completed; - Log.Message($"[CircularBombardment] All launches completed: {launchesCompleted}/{Props.maxLaunches}"); + WulaLog.Debug($"[CircularBombardment] All launches completed: {launchesCompleted}/{Props.maxLaunches}"); return; } @@ -307,7 +307,7 @@ namespace WulaFallenEmpire nextInnerLaunchTick = Find.TickManager.TicksGame; currentGroupIndex++; - Log.Message($"[CircularBombardment] Starting group {currentGroupIndex} with {currentGroupTargets.Count} targets, using independent intervals"); + WulaLog.Debug($"[CircularBombardment] Starting group {currentGroupIndex} with {currentGroupTargets.Count} targets, using independent intervals"); } else { @@ -323,7 +323,7 @@ namespace WulaFallenEmpire // 设置下一组发射时间 nextLaunchTick = Find.TickManager.TicksGame + Props.launchIntervalTicks; - Log.Message($"[CircularBombardment] Launched group {currentGroupIndex + 1} simultaneously: {currentGroupTargets.Count} targets"); + WulaLog.Debug($"[CircularBombardment] Launched group {currentGroupIndex + 1} simultaneously: {currentGroupTargets.Count} targets"); } } @@ -338,7 +338,7 @@ namespace WulaFallenEmpire // 当前组发射完毕 isInGroupLaunch = false; nextLaunchTick = Find.TickManager.TicksGame + Props.launchIntervalTicks; - Log.Message($"[CircularBombardment] Group {currentGroupIndex} completed"); + WulaLog.Debug($"[CircularBombardment] Group {currentGroupIndex} completed"); return; } @@ -361,7 +361,7 @@ namespace WulaFallenEmpire nextLaunchTick = Find.TickManager.TicksGame + Props.launchIntervalTicks; } - Log.Message($"[CircularBombardment] Launched target in group {currentGroupIndex} ({launchesCompleted}/{Props.maxLaunches})"); + WulaLog.Debug($"[CircularBombardment] Launched target in group {currentGroupIndex} ({launchesCompleted}/{Props.maxLaunches})"); } // 更新发射逻辑 @@ -384,7 +384,7 @@ namespace WulaFallenEmpire (remainingTargets.Count == 0 && !isInGroupLaunch)) { currentState = CircularBombardmentState.Completed; - Log.Message($"[CircularBombardment] Bombardment completed: {launchesCompleted} launches"); + WulaLog.Debug($"[CircularBombardment] Bombardment completed: {launchesCompleted} launches"); } } @@ -405,12 +405,12 @@ namespace WulaFallenEmpire } else { - Log.Error($"[CircularBombardment] No skyfaller or projectile defined"); + WulaLog.Debug($"[CircularBombardment] No skyfaller or projectile defined"); } } catch (System.Exception ex) { - Log.Error($"[CircularBombardment] Error launching at {targetCell}: {ex}"); + WulaLog.Debug($"[CircularBombardment] Error launching at {targetCell}: {ex}"); } } @@ -447,7 +447,7 @@ namespace WulaFallenEmpire isInGroupLaunch = false; launchesCompleted = 0; - Log.Message($"[CircularBombardment] Cleanup completed"); + WulaLog.Debug($"[CircularBombardment] Cleanup completed"); } public override void CompTick() diff --git a/Source/WulaFallenEmpire/Ability/WULA_AbilityDeleteTarget/CompAbilityEffect_DeleteTarget.cs b/Source/WulaFallenEmpire/Ability/WULA_AbilityDeleteTarget/CompAbilityEffect_DeleteTarget.cs index 2b16dabf..b2f8c4bc 100644 --- a/Source/WulaFallenEmpire/Ability/WULA_AbilityDeleteTarget/CompAbilityEffect_DeleteTarget.cs +++ b/Source/WulaFallenEmpire/Ability/WULA_AbilityDeleteTarget/CompAbilityEffect_DeleteTarget.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using UnityEngine; using System.Collections.Generic; @@ -64,11 +64,11 @@ namespace WulaFallenEmpire Props.soundEffect.PlayOneShot(new TargetInfo(cell, map)); } - Log.Message($"[DeleteTarget] Processed cell {cell}, deleted {deletionCount} objects"); + WulaLog.Debug($"[DeleteTarget] Processed cell {cell}, deleted {deletionCount} objects"); } catch (System.Exception ex) { - Log.Error($"[DeleteTarget] Error deleting objects at {cell}: {ex}"); + WulaLog.Debug($"[DeleteTarget] Error deleting objects at {cell}: {ex}"); } } @@ -123,13 +123,13 @@ namespace WulaFallenEmpire if (thing.Spawned) { thing.DeSpawn(DestroyMode.Vanish); - Log.Message($"[DeleteTarget] Method1 - DeSpawn: {thingInfo}"); + WulaLog.Debug($"[DeleteTarget] Method1 - DeSpawn: {thingInfo}"); return true; } } catch (System.Exception ex1) { - Log.Warning($"[DeleteTarget] Method1 failed for {thingInfo}: {ex1}"); + WulaLog.Debug($"[DeleteTarget] Method1 failed for {thingInfo}: {ex1}"); } try @@ -138,13 +138,13 @@ namespace WulaFallenEmpire if (thing.Spawned) { ForceRemoveFromThingGrid(thing, map); - Log.Message($"[DeleteTarget] Method2 - ForceRemoveFromThingGrid: {thingInfo}"); + WulaLog.Debug($"[DeleteTarget] Method2 - ForceRemoveFromThingGrid: {thingInfo}"); return true; } } catch (System.Exception ex2) { - Log.Warning($"[DeleteTarget] Method2 failed for {thingInfo}: {ex2}"); + WulaLog.Debug($"[DeleteTarget] Method2 failed for {thingInfo}: {ex2}"); } try @@ -153,13 +153,13 @@ namespace WulaFallenEmpire if (thing.Spawned) { ForceDespawnViaReflection(thing, map); - Log.Message($"[DeleteTarget] Method3 - ForceDespawnViaReflection: {thingInfo}"); + WulaLog.Debug($"[DeleteTarget] Method3 - ForceDespawnViaReflection: {thingInfo}"); return true; } } catch (System.Exception ex3) { - Log.Warning($"[DeleteTarget] Method3 failed for {thingInfo}: {ex3}"); + WulaLog.Debug($"[DeleteTarget] Method3 failed for {thingInfo}: {ex3}"); } try @@ -168,16 +168,16 @@ namespace WulaFallenEmpire if (thing.Spawned) { CallInternalCleanup(thing, map); - Log.Message($"[DeleteTarget] Method4 - CallInternalCleanup: {thingInfo}"); + WulaLog.Debug($"[DeleteTarget] Method4 - CallInternalCleanup: {thingInfo}"); return true; } } catch (System.Exception ex4) { - Log.Warning($"[DeleteTarget] Method4 failed for {thingInfo}: {ex4}"); + WulaLog.Debug($"[DeleteTarget] Method4 failed for {thingInfo}: {ex4}"); } - Log.Error($"[DeleteTarget] All methods failed for: {thingInfo}"); + WulaLog.Debug($"[DeleteTarget] All methods failed for: {thingInfo}"); return false; } @@ -199,7 +199,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"[DeleteTarget] ForceRemoveFromThingGrid failed: {ex}"); + WulaLog.Debug($"[DeleteTarget] ForceRemoveFromThingGrid failed: {ex}"); throw; } } @@ -242,7 +242,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"[DeleteTarget] RemoveThingFromCell failed: {ex}"); + WulaLog.Debug($"[DeleteTarget] RemoveThingFromCell failed: {ex}"); } } @@ -279,7 +279,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"[DeleteTarget] ForceDespawnViaReflection failed: {ex}"); + WulaLog.Debug($"[DeleteTarget] ForceDespawnViaReflection failed: {ex}"); throw; } } @@ -310,7 +310,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"[DeleteTarget] CallInternalCleanup failed: {ex}"); + WulaLog.Debug($"[DeleteTarget] CallInternalCleanup failed: {ex}"); throw; } } diff --git a/Source/WulaFallenEmpire/Ability/WULA_AbilityEnergyLance/CompAbilityEffect_EnergyLance.cs b/Source/WulaFallenEmpire/Ability/WULA_AbilityEnergyLance/CompAbilityEffect_EnergyLance.cs index 9398bad1..6679acf7 100644 --- a/Source/WulaFallenEmpire/Ability/WULA_AbilityEnergyLance/CompAbilityEffect_EnergyLance.cs +++ b/Source/WulaFallenEmpire/Ability/WULA_AbilityEnergyLance/CompAbilityEffect_EnergyLance.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using UnityEngine; @@ -32,11 +32,11 @@ namespace WulaFallenEmpire parent.pawn ); - Log.Message($"[EnergyLance] Started {lanceDef.defName} from {target.Cell} to {dest.Cell}"); + WulaLog.Debug($"[EnergyLance] Started {lanceDef.defName} from {target.Cell} to {dest.Cell}"); } catch (System.Exception ex) { - Log.Error($"[EnergyLance] Error starting EnergyLance: {ex}"); + WulaLog.Debug($"[EnergyLance] Error starting EnergyLance: {ex}"); } } diff --git a/Source/WulaFallenEmpire/Ability/WULA_AbilityEnergyLance/EnergyLance.cs b/Source/WulaFallenEmpire/Ability/WULA_AbilityEnergyLance/EnergyLance.cs index 41f54091..edf1d8f4 100644 --- a/Source/WulaFallenEmpire/Ability/WULA_AbilityEnergyLance/EnergyLance.cs +++ b/Source/WulaFallenEmpire/Ability/WULA_AbilityEnergyLance/EnergyLance.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using UnityEngine; using System.Collections.Generic; @@ -69,12 +69,12 @@ namespace WulaFallenEmpire hasStarted = true; } - Log.Message($"[EnergyLance] Target updated to: {targetPos}, current position: {base.Position}"); + WulaLog.Debug($"[EnergyLance] Target updated to: {targetPos}, current position: {base.Position}"); } else { hasValidTarget = false; - Log.Message("[EnergyLance] Target cleared"); + WulaLog.Debug("[EnergyLance] Target cleared"); } } @@ -107,7 +107,7 @@ namespace WulaFallenEmpire if (newCell != base.Position && newCell.InBounds(base.Map)) { base.Position = newCell; - Log.Message($"[EnergyLance] Moved to new cell: {newCell}"); + WulaLog.Debug($"[EnergyLance] Moved to new cell: {newCell}"); } // 检查是否接近目标 @@ -117,7 +117,7 @@ namespace WulaFallenEmpire // 非常接近目标,直接设置到目标位置 exactPosition = targetVector; base.Position = currentTargetPosition; - Log.Message($"[EnergyLance] Reached target position: {currentTargetPosition}"); + WulaLog.Debug($"[EnergyLance] Reached target position: {currentTargetPosition}"); } } else @@ -170,7 +170,7 @@ namespace WulaFallenEmpire // 检查是否长时间没有收到目标更新 if (hasValidTarget && Find.TickManager.TicksGame - lastTargetUpdateTick > maxIdleTicks) { - Log.Message("[EnergyLance] No target updates received, self-destructing"); + WulaLog.Debug("[EnergyLance] No target updates received, self-destructing"); CompleteEnergyLance(); return; } @@ -202,7 +202,7 @@ namespace WulaFallenEmpire sustainer?.End(); sustainer = null; - Log.Message($"[EnergyLance] 光束完成 at position {base.Position}, ticksPassed: {ticksPassed}, durationTicks: {durationTicks}"); + WulaLog.Debug($"[EnergyLance] 光束完成 at position {base.Position}, ticksPassed: {ticksPassed}, durationTicks: {durationTicks}"); // 销毁自身 Destroy(); @@ -307,7 +307,7 @@ namespace WulaFallenEmpire // 开始音效 StartSound(); - Log.Message($"[EnergyLance] Spawned at {base.Position}, target: {endPosition}, " + + WulaLog.Debug($"[EnergyLance] Spawned at {base.Position}, target: {endPosition}, " + $"exact position: {exactPosition}"); } } @@ -319,11 +319,11 @@ namespace WulaFallenEmpire if (startAnimationMethod != null) { startAnimationMethod.Invoke(orbitalBeamComp, new object[] { durationTicks, 10, 0f }); - Log.Message("[EnergyLance] Orbital beam animation started"); + WulaLog.Debug("[EnergyLance] Orbital beam animation started"); } else { - Log.Warning("[EnergyLance] Could not find StartAnimation method on CompOrbitalBeam"); + WulaLog.Debug("[EnergyLance] Could not find StartAnimation method on CompOrbitalBeam"); } } @@ -397,7 +397,7 @@ namespace WulaFallenEmpire IntVec3 spawnPosition = end.IsValid ? end : start; GenSpawn.Spawn(energyLance, spawnPosition, map); - Log.Message($"[EnergyLance] Created {energyLanceDef.defName} at {spawnPosition}, target: {end}"); + WulaLog.Debug($"[EnergyLance] Created {energyLanceDef.defName} at {spawnPosition}, target: {end}"); return energyLance; } } diff --git a/Source/WulaFallenEmpire/Ability/WULA_AbilityTeleportSelf/CompAbilityEffect_TeleportSelf.cs b/Source/WulaFallenEmpire/Ability/WULA_AbilityTeleportSelf/CompAbilityEffect_TeleportSelf.cs index d1aa2d63..855f7a1a 100644 --- a/Source/WulaFallenEmpire/Ability/WULA_AbilityTeleportSelf/CompAbilityEffect_TeleportSelf.cs +++ b/Source/WulaFallenEmpire/Ability/WULA_AbilityTeleportSelf/CompAbilityEffect_TeleportSelf.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; // 添加这个 using 指令 using RimWorld; using UnityEngine; @@ -141,7 +141,7 @@ namespace WulaFallenEmpire // 记录传送调整信息(调试用) if (finalTargetCell != target.Cell) { - Log.Message($"[TeleportSelf] AI传送位置从 {target.Cell} 调整到 {finalTargetCell}"); + WulaLog.Debug($"[TeleportSelf] AI传送位置从 {target.Cell} 调整到 {finalTargetCell}"); } } diff --git a/Source/WulaFallenEmpire/Ability/WULA_PullTarget/CompAbilityEffect_PullTarget.cs b/Source/WulaFallenEmpire/Ability/WULA_PullTarget/CompAbilityEffect_PullTarget.cs index 2b164c67..41d342ca 100644 --- a/Source/WulaFallenEmpire/Ability/WULA_PullTarget/CompAbilityEffect_PullTarget.cs +++ b/Source/WulaFallenEmpire/Ability/WULA_PullTarget/CompAbilityEffect_PullTarget.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using RimWorld; using UnityEngine; @@ -120,7 +120,7 @@ namespace WulaFallenEmpire // 记录拉取信息 if (Prefs.DevMode) { - Log.Message($"[PullTarget] {caster.Label} 将 {targetPawn.Label} 拉取到 {finalDestination}"); + WulaLog.Debug($"[PullTarget] {caster.Label} 将 {targetPawn.Label} 拉取到 {finalDestination}"); } } diff --git a/Source/WulaFallenEmpire/BuildingComp/Building_ExtraGraphics.cs b/Source/WulaFallenEmpire/BuildingComp/Building_ExtraGraphics.cs index 78421863..c939241c 100644 --- a/Source/WulaFallenEmpire/BuildingComp/Building_ExtraGraphics.cs +++ b/Source/WulaFallenEmpire/BuildingComp/Building_ExtraGraphics.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using RimWorld; using UnityEngine; @@ -30,7 +30,7 @@ namespace WulaFallenEmpire modExtension = def.GetModExtension(); if (modExtension == null) { - Log.Error($"Building_ExtraGraphics: No ExtraGraphicsExtension found for {def.defName}"); + WulaLog.Debug($"Building_ExtraGraphics: No ExtraGraphicsExtension found for {def.defName}"); // 创建默认配置避免空引用 modExtension = new ExtraGraphicsExtension(); } @@ -114,7 +114,7 @@ namespace WulaFallenEmpire case "metaoverlay": return ShaderDatabase.MetaOverlay; default: - Log.Warning($"Building_ExtraGraphics: Shader '{shaderName}' not found, using TransparentPostLight as fallback"); + WulaLog.Debug($"Building_ExtraGraphics: Shader '{shaderName}' not found, using TransparentPostLight as fallback"); return ShaderDatabase.TransparentPostLight; } } @@ -140,7 +140,7 @@ namespace WulaFallenEmpire { if (ModExtension.graphicLayers == null || ModExtension.graphicLayers.Count == 0) { - Log.Warning($"Building_ExtraGraphics: No graphic layers configured for {def.defName}"); + WulaLog.Debug($"Building_ExtraGraphics: No graphic layers configured for {def.defName}"); return; } @@ -158,7 +158,7 @@ namespace WulaFallenEmpire { if (string.IsNullOrEmpty(layer.texturePath)) { - Log.Warning($"Building_ExtraGraphics: Empty texture path in layer for {def.defName}"); + WulaLog.Debug($"Building_ExtraGraphics: Empty texture path in layer for {def.defName}"); return; } @@ -223,7 +223,7 @@ namespace WulaFallenEmpire if (mesh == null || mat == null) { - Log.Warning($"Building_ExtraGraphics: Unable to get mesh or material for rotating layer"); + WulaLog.Debug($"Building_ExtraGraphics: Unable to get mesh or material for rotating layer"); return; } @@ -273,7 +273,7 @@ namespace WulaFallenEmpire } catch (Exception ex) { - Log.Error($"Building_ExtraGraphics: Error drawing rotating layer: {ex}"); + WulaLog.Debug($"Building_ExtraGraphics: Error drawing rotating layer: {ex}"); } } @@ -347,7 +347,7 @@ namespace WulaFallenEmpire if (DebugSettings.godMode && i == 0 && Find.TickManager.TicksGame % 60 == 0) { // 只在开发模式下,每60帧输出一次第一条图层的旋转信息 - Log.Message($"{layer.animationType} 图层 {i}: 角度={rotationAngle:F1}°, 时间={layerAnimationTimes[i]:F2}s, 速度={rotateSpeed}°/s"); + WulaLog.Debug($"{layer.animationType} 图层 {i}: 角度={rotationAngle:F1}°, 时间={layerAnimationTimes[i]:F2}s, 速度={rotateSpeed}°/s"); } break; } diff --git a/Source/WulaFallenEmpire/BuildingComp/Building_MapObserver.cs b/Source/WulaFallenEmpire/BuildingComp/Building_MapObserver.cs index 63d3a62a..e75f0a0f 100644 --- a/Source/WulaFallenEmpire/BuildingComp/Building_MapObserver.cs +++ b/Source/WulaFallenEmpire/BuildingComp/Building_MapObserver.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using RimWorld.Planet; using UnityEngine; @@ -103,7 +103,7 @@ namespace WulaFallenEmpire map.fogGrid.ClearAllFog(); // 记录日志以便调试 - Log.Message($"[MapObserver] 开始监测地图: {mapParent.Label} at tile {target.Tile}"); + WulaLog.Debug($"[MapObserver] 开始监测地图: {mapParent.Label} at tile {target.Tile}"); } }, "GeneratingMap", doAsynchronously: false, null); @@ -128,12 +128,12 @@ namespace WulaFallenEmpire if (observedMap is Settlement settlement) { settlement.Name = $"监测点-{thingIDNumber}"; - Log.Message($"[MapObserver] 创建新监测点: {settlement.Name} at tile {target.Tile}"); + WulaLog.Debug($"[MapObserver] 创建新监测点: {settlement.Name} at tile {target.Tile}"); } else { // 如果observedMap不是Settlement,使用Label属性 - Log.Message($"[MapObserver] 创建新监测点: {observedMap.Label} at tile {target.Tile}"); + WulaLog.Debug($"[MapObserver] 创建新监测点: {observedMap.Label} at tile {target.Tile}"); } }, "GeneratingMap", doAsynchronously: false, null); @@ -165,7 +165,7 @@ namespace WulaFallenEmpire { Find.World.worldObjects.Remove(observedMap); } - Log.Message($"[MapObserver] 清理空置监测地图: {observedMap.Label}"); + WulaLog.Debug($"[MapObserver] 清理空置监测地图: {observedMap.Label}"); } } @@ -176,14 +176,14 @@ namespace WulaFallenEmpire // 断电或被关闭时停止监测 if (observedMap != null && (signal == "PowerTurnedOff" || signal == "FlickedOff")) { - Log.Message($"[MapObserver] 电力中断,停止监测: {observedMap.Label}"); + WulaLog.Debug($"[MapObserver] 电力中断,停止监测: {observedMap.Label}"); StopObserving(); } // 恢复电力时重新注册 else if (observedMap != null && (signal == "PowerTurnedOn" || signal == "FlickedOn")) { activeObservers.Add(this); - Log.Message($"[MapObserver] 电力恢复,继续监测: {observedMap.Label}"); + WulaLog.Debug($"[MapObserver] 电力恢复,继续监测: {observedMap.Label}"); } } diff --git a/Source/WulaFallenEmpire/BuildingComp/Building_TurretGunHasSpeed.cs b/Source/WulaFallenEmpire/BuildingComp/Building_TurretGunHasSpeed.cs index 355306a7..d7243fb0 100644 --- a/Source/WulaFallenEmpire/BuildingComp/Building_TurretGunHasSpeed.cs +++ b/Source/WulaFallenEmpire/BuildingComp/Building_TurretGunHasSpeed.cs @@ -324,7 +324,7 @@ namespace WulaFallenEmpire // 检查是否有攻击动词 if (currentEffectiveVerb == null) { - Log.Error("BestShootTargetFromCurrentPosition with " + searcher.ToStringSafe() + " who has no attack verb."); + WulaLog.Debug("BestShootTargetFromCurrentPosition with " + searcher.ToStringSafe() + " who has no attack verb."); return null; } @@ -376,7 +376,7 @@ namespace WulaFallenEmpire // 验证攻击动词是否存在 if (verb == null) { - Log.Error("BestAttackTarget with " + searcher.ToStringSafe() + " who has no attack verb."); + WulaLog.Debug("BestAttackTarget with " + searcher.ToStringSafe() + " who has no attack verb."); return null; } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingBombardment/CompBuildingBombardment.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingBombardment/CompBuildingBombardment.cs index 2717eba6..3028c63d 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingBombardment/CompBuildingBombardment.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingBombardment/CompBuildingBombardment.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using UnityEngine; using System.Collections.Generic; @@ -41,14 +41,14 @@ namespace WulaFallenEmpire { currentState = BuildingBombardmentState.Bursting; nextInnerBurstTick = Find.TickManager.TicksGame; - Log.Message($"[BuildingBombardment] Starting burst with {currentTargets.Count} targets"); + WulaLog.Debug($"[BuildingBombardment] Starting burst with {currentTargets.Count} targets"); } else { // 没有找到目标,等待下一轮 currentState = BuildingBombardmentState.Idle; nextBurstTick = Find.TickManager.TicksGame + Props.burstIntervalTicks; - Log.Message($"[BuildingBombardment] No targets found, waiting for next burst"); + WulaLog.Debug($"[BuildingBombardment] No targets found, waiting for next burst"); } } @@ -110,7 +110,7 @@ namespace WulaFallenEmpire // 当前组发射完毕 currentState = BuildingBombardmentState.Idle; nextBurstTick = Find.TickManager.TicksGame + Props.burstIntervalTicks; - Log.Message($"[BuildingBombardment] Burst completed, waiting for next burst"); + WulaLog.Debug($"[BuildingBombardment] Burst completed, waiting for next burst"); return; } @@ -125,7 +125,7 @@ namespace WulaFallenEmpire nextInnerBurstTick = Find.TickManager.TicksGame + Props.innerBurstIntervalTicks; } - Log.Message($"[BuildingBombardment] Launched bombardment {currentBurstCount}/{currentTargets.Count}"); + WulaLog.Debug($"[BuildingBombardment] Launched bombardment {currentBurstCount}/{currentTargets.Count}"); } private void LaunchBombardment(LocalTargetInfo target) @@ -149,7 +149,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[BuildingBombardment] Error launching bombardment: {ex}"); + WulaLog.Debug($"[BuildingBombardment] Error launching bombardment: {ex}"); } } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingSpawner/CompBuildingSpawner.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingSpawner/CompBuildingSpawner.cs index 8f4054e7..985d3278 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingSpawner/CompBuildingSpawner.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingSpawner/CompBuildingSpawner.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Text; using RimWorld; @@ -114,7 +114,7 @@ namespace WulaFallenEmpire var facilitiesComp = flyOver.GetComp(); if (facilitiesComp == null) { - Log.Warning($"[BuildingSpawner] FlyOver at {flyOver.Position} has no CompFlyOverFacilities"); + WulaLog.Debug($"[BuildingSpawner] FlyOver at {flyOver.Position} has no CompFlyOverFacilities"); continue; } @@ -129,7 +129,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[BuildingSpawner] Exception while checking for FlyOver: {ex}"); + WulaLog.Debug($"[BuildingSpawner] Exception while checking for FlyOver: {ex}"); return false; } } @@ -223,7 +223,7 @@ namespace WulaFallenEmpire { if (Props.buildingToSpawn == null) { - Log.Error("[BuildingSpawner] Building def is null!"); + WulaLog.Debug("[BuildingSpawner] Building def is null!"); ResetCall(); return; } @@ -237,7 +237,7 @@ namespace WulaFallenEmpire // 检查位置是否可用 if (!CanSpawnAtPosition(spawnPos)) { - Log.Error($"[BuildingSpawner] Cannot spawn building at {spawnPos}"); + WulaLog.Debug($"[BuildingSpawner] Cannot spawn building at {spawnPos}"); ResetCall(); return; } @@ -250,7 +250,7 @@ namespace WulaFallenEmpire if (newBuilding == null) { - Log.Error("[BuildingSpawner] Failed to create building!"); + WulaLog.Debug("[BuildingSpawner] Failed to create building!"); ResetCall(); return; } @@ -273,7 +273,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[BuildingSpawner] Error in ExecuteAutoBuildingSpawn: {ex}"); + WulaLog.Debug($"[BuildingSpawner] Error in ExecuteAutoBuildingSpawn: {ex}"); ResetCall(); } } @@ -348,7 +348,7 @@ namespace WulaFallenEmpire { if (Props.buildingToSpawn == null) { - Log.Error("[BuildingSpawner] Building def is null!"); + WulaLog.Debug("[BuildingSpawner] Building def is null!"); return; } @@ -371,7 +371,7 @@ namespace WulaFallenEmpire // 检查位置是否可用 if (!CanSpawnAtPosition(spawnPos)) { - Log.Error($"[BuildingSpawner] Cannot spawn building at {spawnPos}"); + WulaLog.Debug($"[BuildingSpawner] Cannot spawn building at {spawnPos}"); ResetCall(); return; } @@ -384,7 +384,7 @@ namespace WulaFallenEmpire if (newBuilding == null) { - Log.Error("[BuildingSpawner] Failed to create building!"); + WulaLog.Debug("[BuildingSpawner] Failed to create building!"); return; } @@ -409,14 +409,14 @@ namespace WulaFallenEmpire { if (parent?.Map == null) { - Log.Warning($"[BuildingSpawner] Parent map is null for {parent?.LabelShort}"); + WulaLog.Debug($"[BuildingSpawner] Parent map is null for {parent?.LabelShort}"); return false; } // 检查是否在地图范围内 if (!spawnPos.InBounds(parent.Map)) { - Log.Warning($"[BuildingSpawner] Spawn position {spawnPos} is out of bounds for {parent?.LabelShort}"); + WulaLog.Debug($"[BuildingSpawner] Spawn position {spawnPos} is out of bounds for {parent?.LabelShort}"); return false; } @@ -424,7 +424,7 @@ namespace WulaFallenEmpire ThingDef buildingDef = Props.buildingToSpawn; if (buildingDef == null) { - Log.Error($"[BuildingSpawner] buildingToSpawn is null for {parent?.LabelShort}"); + WulaLog.Debug($"[BuildingSpawner] buildingToSpawn is null for {parent?.LabelShort}"); return false; } @@ -437,7 +437,7 @@ namespace WulaFallenEmpire // 检查建筑是否完全在地图范围内 if (!rect.InBounds(parent.Map)) { - Log.Warning($"[BuildingSpawner] Building rect {rect} for {buildingDef.defName} is out of bounds. Size: {buildingSize}, Position: {spawnPos}"); + WulaLog.Debug($"[BuildingSpawner] Building rect {rect} for {buildingDef.defName} is out of bounds. Size: {buildingSize}, Position: {spawnPos}"); return false; } @@ -451,7 +451,7 @@ namespace WulaFallenEmpire if (rect.minX < safeMargin || rect.minZ < safeMargin || rect.maxX >= pocketMap.Size.x - safeMargin || rect.maxZ >= pocketMap.Size.z - safeMargin) { - Log.Warning($"[BuildingSpawner] Building {buildingDef.defName} too close to pocket map edge. Rect: {rect}, Map Size: {pocketMap.Size}"); + WulaLog.Debug($"[BuildingSpawner] Building {buildingDef.defName} too close to pocket map edge. Rect: {rect}, Map Size: {pocketMap.Size}"); return false; } } @@ -461,7 +461,7 @@ namespace WulaFallenEmpire { if (!cell.InBounds(parent.Map)) { - Log.Warning($"[BuildingSpawner] Cell {cell} is out of bounds for building {buildingDef.defName}"); + WulaLog.Debug($"[BuildingSpawner] Cell {cell} is out of bounds for building {buildingDef.defName}"); return false; } @@ -476,7 +476,7 @@ namespace WulaFallenEmpire // 跳过自己 if (thing != parent) { - Log.Warning($"[BuildingSpawner] Cell {cell} is blocked by {thing.def.defName} ({thing.LabelShort})"); + WulaLog.Debug($"[BuildingSpawner] Cell {cell} is blocked by {thing.def.defName} ({thing.LabelShort})"); return false; } } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingSpawner/CompProperties_BuildingSpawner.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingSpawner/CompProperties_BuildingSpawner.cs index 0890f91a..2f5ddd01 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingSpawner/CompProperties_BuildingSpawner.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_BuildingSpawner/CompProperties_BuildingSpawner.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using Verse; @@ -66,7 +66,7 @@ namespace WulaFallenEmpire // 验证buildingToSpawn if (buildingToSpawn != null && buildingToSpawn.category != ThingCategory.Building) { - Log.Error($"CompProperties_BuildingSpawner: buildingToSpawn must be a building, but got {buildingToSpawn.defName}"); + WulaLog.Debug($"CompProperties_BuildingSpawner: buildingToSpawn must be a building, but got {buildingToSpawn.defName}"); buildingToSpawn = null; } } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_EnergyLanceTurret/CompEnergyLanceTurret.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_EnergyLanceTurret/CompEnergyLanceTurret.cs index 695f6bd9..5da4f84e 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_EnergyLanceTurret/CompEnergyLanceTurret.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_EnergyLanceTurret/CompEnergyLanceTurret.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using UnityEngine; using System.Collections.Generic; @@ -54,7 +54,7 @@ namespace WulaFallenEmpire ResetState(); } - Log.Message($"[EnergyLanceTurret] 炮塔生成在 {parent.Position}, 检测范围: {Props.detectionRange}"); + WulaLog.Debug($"[EnergyLanceTurret] 炮塔生成在 {parent.Position}, 检测范围: {Props.detectionRange}"); } // 在 StartEnergyLance 方法中修复光束创建逻辑 @@ -63,7 +63,7 @@ namespace WulaFallenEmpire // 双重检查目标有效性 if (currentTarget == null || !IsTargetValid(currentTarget)) { - Log.Warning($"[EnergyLanceTurret] 尝试启动能量光束但目标无效: {(currentTarget == null ? "目标为null" : "目标无效")}"); + WulaLog.Debug($"[EnergyLanceTurret] 尝试启动能量光束但目标无效: {(currentTarget == null ? "目标为null" : "目标无效")}"); // 尝试重新寻找目标 var potentialTargets = FindPotentialTargets(); @@ -72,11 +72,11 @@ namespace WulaFallenEmpire currentTarget = potentialTargets .OrderBy(t => t.Position.DistanceTo(parent.Position)) .First(); - Log.Message($"[EnergyLanceTurret] 重新获取目标: {currentTarget.LabelCap}"); + WulaLog.Debug($"[EnergyLanceTurret] 重新获取目标: {currentTarget.LabelCap}"); } else { - Log.Message("[EnergyLanceTurret] 无法重新获取目标,进入冷却"); + WulaLog.Debug("[EnergyLanceTurret] 无法重新获取目标,进入冷却"); StartCooldown(); return; } @@ -88,12 +88,12 @@ namespace WulaFallenEmpire var lanceDef = Props.energyLanceDef ?? ThingDef.Named("EnergyLance"); if (lanceDef == null) { - Log.Error("[EnergyLanceTurret] 能量光束定义为空!"); + WulaLog.Debug("[EnergyLanceTurret] 能量光束定义为空!"); StartCooldown(); return; } - Log.Message($"[EnergyLanceTurret] 创建能量光束: {lanceDef.defName} 目标: {currentTarget.LabelCap} 在 {currentTarget.Position}"); + WulaLog.Debug($"[EnergyLanceTurret] 创建能量光束: {lanceDef.defName} 目标: {currentTarget.LabelCap} 在 {currentTarget.Position}"); // 关键修复:光束直接在目标位置生成,而不是建筑位置 activeLance = EnergyLance.MakeEnergyLance( @@ -109,7 +109,7 @@ namespace WulaFallenEmpire if (activeLance == null) { - Log.Error("[EnergyLanceTurret] 能量光束创建失败!"); + WulaLog.Debug("[EnergyLanceTurret] 能量光束创建失败!"); StartCooldown(); return; } @@ -131,11 +131,11 @@ namespace WulaFallenEmpire // 立即更新光束位置,确保光束在正确位置开始 UpdateEnergyLancePosition(); - Log.Message($"[EnergyLanceTurret] 能量光束启动成功,追踪目标: {currentTarget.LabelCap}"); + WulaLog.Debug($"[EnergyLanceTurret] 能量光束启动成功,追踪目标: {currentTarget.LabelCap}"); } catch (System.Exception ex) { - Log.Error($"[EnergyLanceTurret] 启动能量光束错误: {ex}"); + WulaLog.Debug($"[EnergyLanceTurret] 启动能量光束错误: {ex}"); StartCooldown(); } } @@ -154,7 +154,7 @@ namespace WulaFallenEmpire // 添加更多调试信息 if (debugTickCounter % 30 == 0) // 每0.5秒输出一次位置信息 { - Log.Message($"[EnergyLanceTurret] 更新光束位置: 目标在 {currentTarget.Position}, 光束在 {activeLance.Position}"); + WulaLog.Debug($"[EnergyLanceTurret] 更新光束位置: 目标在 {currentTarget.Position}, 光束在 {activeLance.Position}"); } } else if (lastTargetPosition.IsValid && Find.TickManager.TicksGame - lastPositionUpdateTick <= Props.targetUpdateInterval * 2) @@ -209,12 +209,12 @@ namespace WulaFallenEmpire if (debugTickCounter % 30 == 0) // 每0.5秒输出一次冷却信息 { - Log.Message($"[EnergyLanceTurret] 冷却中: {cooldownTicksRemaining} ticks 剩余"); + WulaLog.Debug($"[EnergyLanceTurret] 冷却中: {cooldownTicksRemaining} ticks 剩余"); } if (cooldownTicksRemaining <= 0) { - Log.Message("[EnergyLanceTurret] 冷却完成,返回待机状态"); + WulaLog.Debug("[EnergyLanceTurret] 冷却完成,返回待机状态"); currentState = TurretState.Idle; isActive = false; } @@ -226,7 +226,7 @@ namespace WulaFallenEmpire // 在预热过程中持续检查目标有效性 if (currentTarget == null || !IsTargetValid(currentTarget)) { - Log.Message($"[EnergyLanceTurret] 预热过程中目标失效,取消预热"); + WulaLog.Debug($"[EnergyLanceTurret] 预热过程中目标失效,取消预热"); ResetState(); return; } @@ -235,12 +235,12 @@ namespace WulaFallenEmpire if (debugTickCounter % 10 == 0) // 每0.17秒输出一次预热信息 { - Log.Message($"[EnergyLanceTurret] 预热中: {warmupTicksRemaining} ticks 剩余, 目标: {currentTarget?.LabelCap ?? "无"}"); + WulaLog.Debug($"[EnergyLanceTurret] 预热中: {warmupTicksRemaining} ticks 剩余, 目标: {currentTarget?.LabelCap ?? "无"}"); } if (warmupTicksRemaining <= 0) { - Log.Message("[EnergyLanceTurret] 预热完成,开始发射光束"); + WulaLog.Debug("[EnergyLanceTurret] 预热完成,开始发射光束"); StartEnergyLance(); } } @@ -280,23 +280,23 @@ namespace WulaFallenEmpire private void OutputDebugInfo() { var targets = FindPotentialTargets(); - Log.Message($"[EnergyLanceTurret] 调试信息:"); - Log.Message($" - 状态: {currentState}"); - Log.Message($" - 当前目标: {currentTarget?.LabelCap ?? "无"}"); - Log.Message($" - 目标位置: {currentTarget?.Position.ToString() ?? "无"}"); - Log.Message($" - 活跃光束: {(activeLance != null && !activeLance.Destroyed ? "是" : "否")}"); - Log.Message($" - 检测到目标数: {targets.Count}"); - Log.Message($" - 冷却剩余: {cooldownTicksRemaining}"); - Log.Message($" - 预热剩余: {warmupTicksRemaining}"); - Log.Message($" - 是否活跃: {isActive}"); - Log.Message($" - 目标丢失保护: {(targetLostTick >= 0 ? (Find.TickManager.TicksGame - targetLostTick) + " ticks前" : "无")}"); - Log.Message($" - 光束保护期: {(lanceCreationTick >= 0 ? (Find.TickManager.TicksGame - lanceCreationTick) + " ticks前创建" : "无")}"); + WulaLog.Debug($"[EnergyLanceTurret] 调试信息:"); + WulaLog.Debug($" - 状态: {currentState}"); + WulaLog.Debug($" - 当前目标: {currentTarget?.LabelCap ?? "无"}"); + WulaLog.Debug($" - 目标位置: {currentTarget?.Position.ToString() ?? "无"}"); + WulaLog.Debug($" - 活跃光束: {(activeLance != null && !activeLance.Destroyed ? "是" : "否")}"); + WulaLog.Debug($" - 检测到目标数: {targets.Count}"); + WulaLog.Debug($" - 冷却剩余: {cooldownTicksRemaining}"); + WulaLog.Debug($" - 预热剩余: {warmupTicksRemaining}"); + WulaLog.Debug($" - 是否活跃: {isActive}"); + WulaLog.Debug($" - 目标丢失保护: {(targetLostTick >= 0 ? (Find.TickManager.TicksGame - targetLostTick) + " ticks前" : "无")}"); + WulaLog.Debug($" - 光束保护期: {(lanceCreationTick >= 0 ? (Find.TickManager.TicksGame - lanceCreationTick) + " ticks前创建" : "无")}"); // 输出前3个检测到的目标 for (int i = 0; i < Mathf.Min(3, targets.Count); i++) { var target = targets[i]; - Log.Message($" - 目标{i+1}: {target.LabelCap} 在 {target.Position}, 距离: {target.Position.DistanceTo(parent.Position):F1}"); + WulaLog.Debug($" - 目标{i+1}: {target.LabelCap} 在 {target.Position}, 距离: {target.Position.DistanceTo(parent.Position):F1}"); } } @@ -317,7 +317,7 @@ namespace WulaFallenEmpire // 更新目标 private void UpdateTarget() { - Log.Message($"[EnergyLanceTurret] 更新目标检查 - 状态: {currentState}, 活跃光束: {(activeLance != null && !activeLance.Destroyed ? "是" : "否")}"); + WulaLog.Debug($"[EnergyLanceTurret] 更新目标检查 - 状态: {currentState}, 活跃光束: {(activeLance != null && !activeLance.Destroyed ? "是" : "否")}"); // 如果没有光束,寻找新目标 if (activeLance == null || activeLance.Destroyed) @@ -333,7 +333,7 @@ namespace WulaFallenEmpire lastTargetPosition = currentTarget.Position; lastPositionUpdateTick = Find.TickManager.TicksGame; targetLostTick = -1; // 重置目标丢失计时 - Log.Message($"[EnergyLanceTurret] 目标仍然有效: {currentTarget.LabelCap}"); + WulaLog.Debug($"[EnergyLanceTurret] 目标仍然有效: {currentTarget.LabelCap}"); return; } @@ -344,11 +344,11 @@ namespace WulaFallenEmpire // 寻找新目标(首次) private void FindNewTarget() { - Log.Message("[EnergyLanceTurret] 寻找新目标..."); + WulaLog.Debug("[EnergyLanceTurret] 寻找新目标..."); if (currentState != TurretState.Idle) { - Log.Message($"[EnergyLanceTurret] 无法寻找目标 - 当前状态: {currentState}"); + WulaLog.Debug($"[EnergyLanceTurret] 无法寻找目标 - 当前状态: {currentState}"); return; } @@ -361,14 +361,14 @@ namespace WulaFallenEmpire .OrderBy(t => t.Position.DistanceTo(parent.Position)) .First(); - Log.Message($"[EnergyLanceTurret] 发现新目标: {currentTarget.LabelCap} 在 {currentTarget.Position}"); + WulaLog.Debug($"[EnergyLanceTurret] 发现新目标: {currentTarget.LabelCap} 在 {currentTarget.Position}"); // 开始预热 StartWarmup(); } else { - Log.Message("[EnergyLanceTurret] 没有发现有效目标"); + WulaLog.Debug("[EnergyLanceTurret] 没有发现有效目标"); } } @@ -378,7 +378,7 @@ namespace WulaFallenEmpire if (activeLance == null || activeLance.Destroyed) return; - Log.Message("[EnergyLanceTurret] 为现有光束寻找新目标..."); + WulaLog.Debug("[EnergyLanceTurret] 为现有光束寻找新目标..."); var potentialTargets = FindPotentialTargets(); @@ -393,7 +393,7 @@ namespace WulaFallenEmpire lastPositionUpdateTick = Find.TickManager.TicksGame; targetLostTick = -1; // 重置目标丢失计时 - Log.Message($"[EnergyLanceTurret] 切换到新目标: {currentTarget.LabelCap} 在 {currentTarget.Position}"); + WulaLog.Debug($"[EnergyLanceTurret] 切换到新目标: {currentTarget.LabelCap} 在 {currentTarget.Position}"); } else { @@ -401,12 +401,12 @@ namespace WulaFallenEmpire if (targetLostTick < 0) { targetLostTick = Find.TickManager.TicksGame; - Log.Message($"[EnergyLanceTurret] 目标丢失,开始保护期: {TARGET_LOST_GRACE_PERIOD} ticks"); + WulaLog.Debug($"[EnergyLanceTurret] 目标丢失,开始保护期: {TARGET_LOST_GRACE_PERIOD} ticks"); } currentTarget = null; lastTargetPosition = IntVec3.Invalid; - Log.Message("[EnergyLanceTurret] 没有有效目标,发送空位置"); + WulaLog.Debug("[EnergyLanceTurret] 没有有效目标,发送空位置"); } } @@ -498,7 +498,7 @@ namespace WulaFallenEmpire { if (currentTarget == null) { - Log.Warning("[EnergyLanceTurret] 尝试开始预热但没有目标"); + WulaLog.Debug("[EnergyLanceTurret] 尝试开始预热但没有目标"); return; } @@ -506,7 +506,7 @@ namespace WulaFallenEmpire isActive = true; currentState = TurretState.WarmingUp; - Log.Message($"[EnergyLanceTurret] 开始预热: {warmupTicksRemaining} ticks, 目标: {currentTarget.LabelCap}"); + WulaLog.Debug($"[EnergyLanceTurret] 开始预热: {warmupTicksRemaining} ticks, 目标: {currentTarget.LabelCap}"); } // 更新光束目标位置 @@ -519,7 +519,7 @@ namespace WulaFallenEmpire if (activeLance is EnergyLance energyLance) { energyLance.UpdateTargetPosition(targetPos); - Log.Message($"[EnergyLanceTurret] 更新光束目标: {targetPos}"); + WulaLog.Debug($"[EnergyLanceTurret] 更新光束目标: {targetPos}"); } else { @@ -528,11 +528,11 @@ namespace WulaFallenEmpire if (moveMethod != null) { moveMethod.Invoke(activeLance, new object[] { targetPos }); - Log.Message($"[EnergyLanceTurret] 通过反射更新光束目标: {targetPos}"); + WulaLog.Debug($"[EnergyLanceTurret] 通过反射更新光束目标: {targetPos}"); } else { - Log.Warning("[EnergyLanceTurret] 无法更新光束目标位置"); + WulaLog.Debug("[EnergyLanceTurret] 无法更新光束目标位置"); } } } @@ -543,7 +543,7 @@ namespace WulaFallenEmpire if (activeLance == null || activeLance.Destroyed) { // 光束已销毁,进入冷却 - Log.Message("[EnergyLanceTurret] 光束已销毁,开始冷却"); + WulaLog.Debug("[EnergyLanceTurret] 光束已销毁,开始冷却"); StartCooldown(); return; } @@ -558,7 +558,7 @@ namespace WulaFallenEmpire // 检查目标丢失保护期 if (targetLostTick >= 0 && Find.TickManager.TicksGame - targetLostTick > TARGET_LOST_GRACE_PERIOD) { - Log.Message("[EnergyLanceTurret] 目标丢失保护期结束,销毁光束"); + WulaLog.Debug("[EnergyLanceTurret] 目标丢失保护期结束,销毁光束"); activeLance.Destroy(); StartCooldown(); return; @@ -567,7 +567,7 @@ namespace WulaFallenEmpire // 检查光束是否长时间没有收到位置更新 if (Find.TickManager.TicksGame - lastPositionUpdateTick > Props.targetUpdateInterval * 3) { - Log.Message("[EnergyLanceTurret] 光束长时间未收到位置更新,销毁"); + WulaLog.Debug("[EnergyLanceTurret] 光束长时间未收到位置更新,销毁"); activeLance.Destroy(); StartCooldown(); } @@ -584,7 +584,7 @@ namespace WulaFallenEmpire targetLostTick = -1; currentState = TurretState.CoolingDown; - Log.Message($"[EnergyLanceTurret] 开始冷却: {cooldownTicksRemaining} ticks"); + WulaLog.Debug($"[EnergyLanceTurret] 开始冷却: {cooldownTicksRemaining} ticks"); } // 绘制检测范围 diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_InitialFaction/CompProperties_InitialFaction.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_InitialFaction/CompProperties_InitialFaction.cs index 84a62023..18c72efc 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_InitialFaction/CompProperties_InitialFaction.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_InitialFaction/CompProperties_InitialFaction.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; namespace WulaFallenEmpire @@ -49,7 +49,7 @@ namespace WulaFallenEmpire if (faction != null && faction != parent.Faction) { parent.SetFaction(faction); - Log.Message($"Set faction for {parent.Label} to {faction.Name}"); + WulaLog.Debug($"Set faction for {parent.Label} to {faction.Name}"); } } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_MechanoidRecycler/JobDriver_RecycleMechanoid.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_MechanoidRecycler/JobDriver_RecycleMechanoid.cs index 9bc46b06..dadff0e4 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_MechanoidRecycler/JobDriver_RecycleMechanoid.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_MechanoidRecycler/JobDriver_RecycleMechanoid.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using Verse.AI; using System.Collections.Generic; @@ -45,14 +45,14 @@ namespace WulaFallenEmpire if (Prefs.DevMode) { - Log.Message($"[CompAutonomousMech] {pawn.LabelCap} equipped new weapon: {newWeaponDef.LabelCap}"); + WulaLog.Debug($"[CompAutonomousMech] {pawn.LabelCap} equipped new weapon: {newWeaponDef.LabelCap}"); } } } } catch (System.Exception ex) { - Log.Error($"[CompAutonomousMech] Error switching weapon for {pawn?.LabelCap}: {ex}"); + WulaLog.Debug($"[CompAutonomousMech] Error switching weapon for {pawn?.LabelCap}: {ex}"); } } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_PhaseCombatTower/CompPhaseCombatTower.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_PhaseCombatTower/CompPhaseCombatTower.cs index 2b4b72b7..05e3abfe 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_PhaseCombatTower/CompPhaseCombatTower.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_PhaseCombatTower/CompPhaseCombatTower.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using RimWorld; using UnityEngine; @@ -86,7 +86,7 @@ namespace WulaFallenEmpire } else { - Log.Error($"PhaseCombatTower: 找不到PawnKindDef '{pawnKindName}'"); + WulaLog.Debug($"PhaseCombatTower: 找不到PawnKindDef '{pawnKindName}'"); } } } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/ArmedShuttleIncoming.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/ArmedShuttleIncoming.cs index f67faf19..6368d283 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/ArmedShuttleIncoming.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/ArmedShuttleIncoming.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Linq; using UnityEngine; @@ -25,17 +25,17 @@ namespace WulaFallenEmpire protected override void Impact() { // Re-adding debug logs for stage 6 - Log.Message($"[WULA] Stage 6: Impact - ArmedShuttleIncoming Impact() called. InnerThing (via innerContainer) is: {innerContainer.FirstOrDefault()?.ToString() ?? "NULL"}"); + WulaLog.Debug($"[WULA] Stage 6: Impact - ArmedShuttleIncoming Impact() called. InnerThing (via innerContainer) is: {innerContainer.FirstOrDefault()?.ToString() ?? "NULL"}"); Thing innerThing = innerContainer.FirstOrDefault(); if (innerThing is Building_ArmedShuttle shuttle) { - Log.Message("[WULA] Stage 6: Impact - InnerThing is a Building_ArmedShuttle. Attempting to notify arrival."); + WulaLog.Debug("[WULA] Stage 6: Impact - InnerThing is a Building_ArmedShuttle. Attempting to notify arrival."); shuttle.TryGetComp()?.Notify_Arrived(); } else { - Log.Warning($"[WULA] Stage 6: Impact - InnerThing is NOT a Building_ArmedShuttle or is NULL. Type: {innerThing?.GetType().Name ?? "NULL"}. This is the cause of the issue."); + WulaLog.Debug($"[WULA] Stage 6: Impact - InnerThing is NOT a Building_ArmedShuttle or is NULL. Type: {innerThing?.GetType().Name ?? "NULL"}. This is the cause of the issue."); } // Calling base.Impact() will handle the actual spawning of the innerThing. @@ -47,7 +47,7 @@ namespace WulaFallenEmpire { base.SpawnSetup(map, respawningAfterLoad); // Re-adding debug logs for stage 5 - Log.Message($"[WULA] Stage 5: Landing Sequence - ArmedShuttleIncoming spawned. InnerThing (via innerContainer) is: {innerContainer.FirstOrDefault()?.ToString() ?? "NULL"}"); + WulaLog.Debug($"[WULA] Stage 5: Landing Sequence - ArmedShuttleIncoming spawned. InnerThing (via innerContainer) is: {innerContainer.FirstOrDefault()?.ToString() ?? "NULL"}"); if (!respawningAfterLoad && !base.BeingTransportedOnGravship) { angle = GetAngle(0f, base.Rotation); @@ -58,7 +58,7 @@ namespace WulaFallenEmpire { if (!hasImpacted) { - Log.Error("Destroying armed shuttle skyfaller without ever having impacted"); // Changed log message + WulaLog.Debug("Destroying armed shuttle skyfaller without ever having impacted"); // Changed log message } base.Destroy(mode); } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_ArmedShuttle.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_ArmedShuttle.cs index 66e41fb4..ae0a93cb 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_ArmedShuttle.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_ArmedShuttle.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Text; using RimWorld; @@ -212,7 +212,7 @@ namespace WulaFallenEmpire { if (gun == null) { - Log.Error("Turret had null gun after loading. Recreating."); + WulaLog.Debug("Turret had null gun after loading. Recreating."); MakeGun(); } else diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_ArmedShuttleWithPocket.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_ArmedShuttleWithPocket.cs index 99bead73..708f44a6 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_ArmedShuttleWithPocket.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_ArmedShuttleWithPocket.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -137,7 +137,7 @@ namespace WulaFallenEmpire public Building_ArmedShuttleWithPocket() { - Log.Message("[WULA-DEBUG] Building_ArmedShuttleWithPocket constructor called"); + WulaLog.Debug("[WULA-DEBUG] Building_ArmedShuttleWithPocket constructor called"); // 不再初始化innerContainer,只使用CompTransporter的容器 } @@ -149,14 +149,14 @@ namespace WulaFallenEmpire public override void PostMake() { - Log.Message("[WULA-DEBUG] PostMake called"); + WulaLog.Debug("[WULA-DEBUG] PostMake called"); base.PostMake(); // 不再初始化innerContainer,只使用CompTransporter的容器 } public override void ExposeData() { - Log.Message($"[WULA-DEBUG] ExposeData called, mode: {Scribe.mode}"); + WulaLog.Debug($"[WULA-DEBUG] ExposeData called, mode: {Scribe.mode}"); base.ExposeData(); Scribe_References.Look(ref pocketMap, "pocketMap"); @@ -171,24 +171,24 @@ namespace WulaFallenEmpire if (Scribe.mode == LoadSaveMode.PostLoadInit) { - Log.Message("[WULA-DEBUG] PostLoadInit: Validating components after load"); + WulaLog.Debug("[WULA-DEBUG] PostLoadInit: Validating components after load"); // 验证CompTransporter组件是否正常 CompTransporter transporter = this.GetComp(); if (transporter == null) { - Log.Error("[WULA-ERROR] CompTransporter is missing after load! This will cause item storage issues."); + WulaLog.Debug("[WULA-ERROR] CompTransporter is missing after load! This will cause item storage issues."); } else { - Log.Message($"[WULA-DEBUG] CompTransporter loaded successfully with {transporter.innerContainer?.Count ?? 0} items"); + WulaLog.Debug($"[WULA-DEBUG] CompTransporter loaded successfully with {transporter.innerContainer?.Count ?? 0} items"); } } } public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish) { - Log.Message($"[WULA-DEBUG] DeSpawn called with mode: {mode}"); + WulaLog.Debug($"[WULA-DEBUG] DeSpawn called with mode: {mode}"); // 只在真正销毁时清理口袋地图,发射时保留 if (ShouldDestroyPocketMapOnDeSpawn(mode)) @@ -197,7 +197,7 @@ namespace WulaFallenEmpire { try { - Log.Message("[WULA-DEBUG] Destroying pocket map due to shuttle destruction"); + WulaLog.Debug("[WULA-DEBUG] Destroying pocket map due to shuttle destruction"); // 将口袋空间中的物品和人员转移到主地图 TransferAllFromPocketToMainMap(); @@ -209,19 +209,19 @@ namespace WulaFallenEmpire } catch (Exception ex) { - Log.Error($"[WULA-ERROR] Error cleaning up pocket map: {ex}"); + WulaLog.Debug($"[WULA-ERROR] Error cleaning up pocket map: {ex}"); } } } else { - Log.Message("[WULA-DEBUG] Preserving pocket map during shuttle launch/transport"); + WulaLog.Debug("[WULA-DEBUG] Preserving pocket map during shuttle launch/transport"); // 发射时暂停传送功能,但保留口袋空间 transportDisabled = true; if (pocketMap != null && exit != null) { // 标记传送功能暂停 - Log.Message("[WULA-DEBUG] Transport functionality disabled during flight"); + WulaLog.Debug("[WULA-DEBUG] Transport functionality disabled during flight"); } } @@ -249,7 +249,7 @@ namespace WulaFallenEmpire case DestroyMode.FailConstruction: // 建造失败,删除口袋空间 return true; default: - Log.Warning($"[WULA-WARNING] Unknown DestroyMode: {mode}, defaulting to preserve pocket map"); + WulaLog.Debug($"[WULA-WARNING] Unknown DestroyMode: {mode}, defaulting to preserve pocket map"); return false; } } @@ -432,16 +432,16 @@ namespace WulaFallenEmpire // 在口袋地图中心放置退出点 CreateExitPoint(); - Log.Message($"[WULA] Successfully created pocket map of size {pocketMapSize} for armed shuttle"); + WulaLog.Debug($"[WULA] Successfully created pocket map of size {pocketMapSize} for armed shuttle"); } else { - Log.Error("[WULA] Failed to create pocket map"); + WulaLog.Debug("[WULA] Failed to create pocket map"); } } catch (Exception ex) { - Log.Error($"[WULA] Exception creating pocket map: {ex}"); + WulaLog.Debug($"[WULA] Exception creating pocket map: {ex}"); } } @@ -490,16 +490,16 @@ namespace WulaFallenEmpire } GenPlace.TryPlaceThing(exitBuilding, exitPos, pocketMap, ThingPlaceMode.Direct); - Log.Message($"[WULA] Created exit point at {exitPos} in pocket map"); + WulaLog.Debug($"[WULA] Created exit point at {exitPos} in pocket map"); } else { - Log.Warning("[WULA] Could not find valid position for exit point in pocket map"); + WulaLog.Debug("[WULA] Could not find valid position for exit point in pocket map"); } } catch (Exception ex) { - Log.Error($"[WULA] Error creating exit point: {ex}"); + WulaLog.Debug($"[WULA] Error creating exit point: {ex}"); } } @@ -525,7 +525,7 @@ namespace WulaFallenEmpire } catch (Exception ex) { - Log.Error($"[WULA] Error transferring pawn {pawn?.LabelShort} to pocket space: {ex}"); + WulaLog.Debug($"[WULA] Error transferring pawn {pawn?.LabelShort} to pocket space: {ex}"); } return false; @@ -536,17 +536,17 @@ namespace WulaFallenEmpire /// private void TransferAllFromPocketToMainMap() { - Log.Message("[WULA-DEBUG] TransferAllFromPocketToMainMap started"); + WulaLog.Debug("[WULA-DEBUG] TransferAllFromPocketToMainMap started"); if (pocketMap == null) { - Log.Warning("[WULA-DEBUG] TransferAllFromPocketToMainMap: pocketMap is null, nothing to transfer"); + WulaLog.Debug("[WULA-DEBUG] TransferAllFromPocketToMainMap: pocketMap is null, nothing to transfer"); return; } if (!Spawned) { - Log.Error("[WULA-ERROR] TransferAllFromPocketToMainMap: Shuttle not spawned, cannot transfer items"); + WulaLog.Debug("[WULA-ERROR] TransferAllFromPocketToMainMap: Shuttle not spawned, cannot transfer items"); return; } @@ -556,28 +556,28 @@ namespace WulaFallenEmpire CompTransporter transporter = this.GetComp(); if (transporter == null) { - Log.Error("[WULA-ERROR] CompTransporter not found on shuttle! Cannot transfer items."); + WulaLog.Debug("[WULA-ERROR] CompTransporter not found on shuttle! Cannot transfer items."); return; } - Log.Message($"[WULA-DEBUG] Found CompTransporter with {transporter.innerContainer.Count} existing items"); + WulaLog.Debug($"[WULA-DEBUG] Found CompTransporter with {transporter.innerContainer.Count} existing items"); // 转移所有殖民者 List pawnsToTransfer = pocketMap.mapPawns.AllPawnsSpawned.ToList(); - Log.Message($"[WULA-DEBUG] Found {pawnsToTransfer.Count} colonists to transfer"); + WulaLog.Debug($"[WULA-DEBUG] Found {pawnsToTransfer.Count} colonists to transfer"); foreach (Pawn pawn in pawnsToTransfer) { if (pawn.Spawned) { - Log.Message($"[WULA-DEBUG] Transferring pawn: {pawn.LabelShort}"); + WulaLog.Debug($"[WULA-DEBUG] Transferring pawn: {pawn.LabelShort}"); pawn.DeSpawn(); // 直接放入穿梭机的容器,如果失败就放到地面 if (!transporter.innerContainer.TryAdd(pawn)) { - Log.Warning($"[WULA-WARNING] Container full, placing pawn {pawn.LabelShort} near shuttle"); + WulaLog.Debug($"[WULA-WARNING] Container full, placing pawn {pawn.LabelShort} near shuttle"); // 如果容器满了,放到穿梭机附近 IntVec3 spawnPos = CellFinder.RandomClosewalkCellNear(this.Position, this.Map, 5, p => p.Standable(this.Map) && !p.GetThingList(this.Map).Any(t => t is Pawn)); @@ -585,16 +585,16 @@ namespace WulaFallenEmpire if (spawnPos.IsValid) { GenPlace.TryPlaceThing(pawn, spawnPos, this.Map, ThingPlaceMode.Near); - Log.Message($"[WULA-DEBUG] Placed pawn {pawn.LabelShort} at {spawnPos}"); + WulaLog.Debug($"[WULA-DEBUG] Placed pawn {pawn.LabelShort} at {spawnPos}"); } else { - Log.Error($"[WULA-ERROR] Could not find valid position for pawn {pawn.LabelShort}"); + WulaLog.Debug($"[WULA-ERROR] Could not find valid position for pawn {pawn.LabelShort}"); } } else { - Log.Message($"[WULA-DEBUG] Successfully added pawn {pawn.LabelShort} to container"); + WulaLog.Debug($"[WULA-DEBUG] Successfully added pawn {pawn.LabelShort} to container"); } } } @@ -603,46 +603,46 @@ namespace WulaFallenEmpire List itemsToTransfer = pocketMap.listerThings.AllThings .Where(t => t.def.category == ThingCategory.Item && t.def.EverHaulable).ToList(); - Log.Message($"[WULA-DEBUG] Found {itemsToTransfer.Count} items to transfer"); + WulaLog.Debug($"[WULA-DEBUG] Found {itemsToTransfer.Count} items to transfer"); foreach (Thing item in itemsToTransfer) { if (item.Spawned) { - Log.Message($"[WULA-DEBUG] Transferring item: {item.LabelShort} (stack: {item.stackCount})"); + WulaLog.Debug($"[WULA-DEBUG] Transferring item: {item.LabelShort} (stack: {item.stackCount})"); item.DeSpawn(); // 直接使用穿梭机的主容器 if (!transporter.innerContainer.TryAdd(item)) { - Log.Warning($"[WULA-WARNING] Container full, dropping item {item.LabelShort} near shuttle"); + WulaLog.Debug($"[WULA-WARNING] Container full, dropping item {item.LabelShort} near shuttle"); // 如果容器满了,丢到穿梭机附近(玩家可以手动重新装载) IntVec3 dropPos = CellFinder.RandomClosewalkCellNear(this.Position, this.Map, 3); if (dropPos.IsValid) { GenPlace.TryPlaceThing(item, dropPos, this.Map, ThingPlaceMode.Near); Messages.Message($"容器已满:{item.LabelShort} 被放置在穿梭机附近", this, MessageTypeDefOf.CautionInput); - Log.Message($"[WULA-DEBUG] Dropped item {item.LabelShort} at {dropPos}"); + WulaLog.Debug($"[WULA-DEBUG] Dropped item {item.LabelShort} at {dropPos}"); } else { - Log.Error($"[WULA-ERROR] Could not find valid drop position for item {item.LabelShort}"); + WulaLog.Debug($"[WULA-ERROR] Could not find valid drop position for item {item.LabelShort}"); } } else { - Log.Message($"[WULA-DEBUG] Successfully added item {item.LabelShort} to container"); + WulaLog.Debug($"[WULA-DEBUG] Successfully added item {item.LabelShort} to container"); } } } - Log.Message($"[WULA-DEBUG] Transfer complete. Container now has {transporter.innerContainer.Count} total items"); - Log.Message($"[WULA-SUCCESS] Transferred {pawnsToTransfer.Count} pawns and {itemsToTransfer.Count} items from pocket space"); + WulaLog.Debug($"[WULA-DEBUG] Transfer complete. Container now has {transporter.innerContainer.Count} total items"); + WulaLog.Debug($"[WULA-SUCCESS] Transferred {pawnsToTransfer.Count} pawns and {itemsToTransfer.Count} items from pocket space"); } catch (Exception ex) { - Log.Error($"[WULA-ERROR] Error transferring from pocket map: {ex}"); - Log.Error($"[WULA-ERROR] Stack trace: {ex.StackTrace}"); + WulaLog.Debug($"[WULA-ERROR] Error transferring from pocket map: {ex}"); + WulaLog.Debug($"[WULA-ERROR] Stack trace: {ex.StackTrace}"); } } @@ -927,19 +927,19 @@ namespace WulaFallenEmpire pocketExit.targetMap = this.Map; pocketExit.targetPos = this.Position; pocketExit.parentShuttle = this; - Log.Message($"[WULA] Updated pocket map exit target to shuttle location: {this.Map?.uniqueID} at {this.Position}"); + WulaLog.Debug($"[WULA] Updated pocket map exit target to shuttle location: {this.Map?.uniqueID} at {this.Position}"); } } else { // 穿梭机不在地图上(可能在飞行中),记录警告但保持原有目标 - Log.Warning($"[WULA] Shuttle not spawned, pocket map exit target may be outdated. Current target: {pocketExit.targetMap?.uniqueID} at {pocketExit.targetPos}"); + WulaLog.Debug($"[WULA] Shuttle not spawned, pocket map exit target may be outdated. Current target: {pocketExit.targetMap?.uniqueID} at {pocketExit.targetPos}"); } } } catch (Exception ex) { - Log.Error($"[WULA] Error updating exit point target: {ex}"); + WulaLog.Debug($"[WULA] Error updating exit point target: {ex}"); } } @@ -967,13 +967,13 @@ namespace WulaFallenEmpire { if (Prefs.DevMode) { - Log.Message($"[WULA] Auto-synced pocket items. Current status: {GetPocketSpaceDebugInfo()}"); + WulaLog.Debug($"[WULA] Auto-synced pocket items. Current status: {GetPocketSpaceDebugInfo()}"); } } } catch (Exception ex) { - Log.Error($"[WULA] Error during auto-sync: {ex}"); + WulaLog.Debug($"[WULA] Error during auto-sync: {ex}"); } } } @@ -983,7 +983,7 @@ namespace WulaFallenEmpire /// public override void SpawnSetup(Map map, bool respawningAfterLoad) { - Log.Message($"[WULA-DEBUG] SpawnSetup called: map={map?.uniqueID}, respawning={respawningAfterLoad}"); + WulaLog.Debug($"[WULA-DEBUG] SpawnSetup called: map={map?.uniqueID}, respawning={respawningAfterLoad}"); // 保存旧位置信息 Map oldMap = this.Map; @@ -997,19 +997,19 @@ namespace WulaFallenEmpire // 验证口袋地图的父级对象是否存在于世界列表中 if (pocketMap.Parent is PocketMapParent pocketParent && !Find.World.pocketMaps.Contains(pocketParent)) { - Log.Warning($"[WULA] Pocket map parent for map ID {pocketMap.uniqueID} was not found in the world list. Re-adding it to prevent data loss."); + WulaLog.Debug($"[WULA] Pocket map parent for map ID {pocketMap.uniqueID} was not found in the world list. Re-adding it to prevent data loss."); Find.World.pocketMaps.Add(pocketParent); } // 验证口袋地图本身是否存在于游戏地图列表中 if (!Find.Maps.Contains(pocketMap)) { - Log.Warning($"[WULA] Pocket map ID {pocketMap.uniqueID} was not found in the game's map list. Re-registering it."); + WulaLog.Debug($"[WULA] Pocket map ID {pocketMap.uniqueID} was not found in the game's map list. Re-registering it."); // 在重新添加前,进行安全检查,防止添加已损坏的地图 if (!Find.Maps.Contains(pocketMap) && (pocketMap.mapPawns == null || pocketMap.Tile < 0)) { - Log.Error("[WULA] Cannot re-register a corrupted pocket map. The contents of the pocket space are likely lost. This is a critical error."); + WulaLog.Debug("[WULA] Cannot re-register a corrupted pocket map. The contents of the pocket space are likely lost. This is a critical error."); Messages.Message("WULA.PocketSpace.MapInvalidAndRecovering".Translate(), this, MessageTypeDefOf.NegativeEvent); pocketMap = null; pocketMapGenerated = false; @@ -1018,7 +1018,7 @@ namespace WulaFallenEmpire { // 重新注册地图,使其再次“激活” Current.Game.AddMap(pocketMap); - Log.Message($"[WULA] Pocket map {pocketMap.uniqueID} successfully re-registered."); + WulaLog.Debug($"[WULA] Pocket map {pocketMap.uniqueID} successfully re-registered."); } } } @@ -1030,23 +1030,23 @@ namespace WulaFallenEmpire CompTransporter transporter = this.GetComp(); if (transporter == null) { - Log.Error("[WULA-ERROR] CompTransporter missing in SpawnSetup! This will cause serious issues."); + WulaLog.Debug("[WULA-ERROR] CompTransporter missing in SpawnSetup! This will cause serious issues."); } else { - Log.Message($"[WULA-DEBUG] CompTransporter found with {transporter.innerContainer?.Count ?? 0} items"); + WulaLog.Debug($"[WULA-DEBUG] CompTransporter found with {transporter.innerContainer?.Count ?? 0} items"); } // 如果是从飞行状态恢复,重新启用传送功能 if (transportDisabled) { - Log.Message("[WULA-DEBUG] Re-enabling transport functionality after landing"); + WulaLog.Debug("[WULA-DEBUG] Re-enabling transport functionality after landing"); transportDisabled = false; // 如果有口袋空间,确保退出点正确连接到新地图 if (pocketMapGenerated && pocketMap != null && exit != null) { - Log.Message($"[WULA-DEBUG] Reconnecting pocket space exit to new map: {map?.uniqueID} at {this.Position}"); + WulaLog.Debug($"[WULA-DEBUG] Reconnecting pocket space exit to new map: {map?.uniqueID} at {this.Position}"); // 退出点会在 UpdateExitPointTarget 中自动更新 } } @@ -1055,25 +1055,25 @@ namespace WulaFallenEmpire if (def.HasModExtension()) { var portalProps = def.GetModExtension(); - Log.Message($"[WULA-DEBUG] Loading portal properties from ThingDef"); + WulaLog.Debug($"[WULA-DEBUG] Loading portal properties from ThingDef"); if (portalProps.pocketMapGenerator != null) { mapGenerator = portalProps.pocketMapGenerator; - Log.Message($"[WULA-DEBUG] Set mapGenerator: {mapGenerator.defName}"); + WulaLog.Debug($"[WULA-DEBUG] Set mapGenerator: {mapGenerator.defName}"); } if (portalProps.exitDef != null) { exitDef = portalProps.exitDef; - Log.Message($"[WULA-DEBUG] Set exitDef: {exitDef.defName}"); + WulaLog.Debug($"[WULA-DEBUG] Set exitDef: {exitDef.defName}"); } if (portalProps.pocketMapSize != IntVec2.Zero) { pocketMapSize = portalProps.pocketMapSize; - Log.Message($"[WULA-DEBUG] Set pocketMapSize: {pocketMapSize}"); + WulaLog.Debug($"[WULA-DEBUG] Set pocketMapSize: {pocketMapSize}"); } allowDirectAccess = portalProps.allowDirectAccess; - Log.Message($"[WULA-DEBUG] Set allowDirectAccess: {allowDirectAccess}"); + WulaLog.Debug($"[WULA-DEBUG] Set allowDirectAccess: {allowDirectAccess}"); } // 初始化地图生成器和退出点定义(如果 XML 中没有配置) @@ -1082,23 +1082,23 @@ namespace WulaFallenEmpire mapGenerator = DefDatabase.GetNamed("AncientStockpile", false) ?? DefDatabase.GetNamed("Base_Player", false) ?? MapGeneratorDefOf.Base_Player; - Log.Message($"[WULA-DEBUG] Using fallback mapGenerator: {mapGenerator.defName}"); + WulaLog.Debug($"[WULA-DEBUG] Using fallback mapGenerator: {mapGenerator.defName}"); } if (exitDef == null) { exitDef = DefDatabase.GetNamed("WULA_PocketMapExit", false) ?? ThingDefOf.Door; - Log.Message($"[WULA-DEBUG] Using fallback exitDef: {exitDef.defName}"); + WulaLog.Debug($"[WULA-DEBUG] Using fallback exitDef: {exitDef.defName}"); } // 如果位置发生了变化,记录日志 if (oldMap != null && (oldMap != map || oldPos != this.Position)) { - Log.Message($"[WULA-DEBUG] Shuttle moved from {oldMap?.uniqueID}:{oldPos} to {map?.uniqueID}:{this.Position}, updating pocket map exit target"); + WulaLog.Debug($"[WULA-DEBUG] Shuttle moved from {oldMap?.uniqueID}:{oldPos} to {map?.uniqueID}:{this.Position}, updating pocket map exit target"); } - Log.Message($"[WULA-DEBUG] SpawnSetup completed successfully"); + WulaLog.Debug($"[WULA-DEBUG] SpawnSetup completed successfully"); } #endregion diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_PocketMapExit.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_PocketMapExit.cs index 3ca890fe..50c577d9 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_PocketMapExit.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Building_PocketMapExit.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using System.Linq; @@ -61,7 +61,7 @@ namespace WulaFallenEmpire { targetMap = parentShuttle.Map; targetPos = parentShuttle.Position; - Log.Message($"[WULA] Updated exit target to shuttle location: {targetMap?.uniqueID} at {targetPos}"); + WulaLog.Debug($"[WULA] Updated exit target to shuttle location: {targetMap?.uniqueID} at {targetPos}"); } } else if (parentShuttle != null && !parentShuttle.Spawned) @@ -70,7 +70,7 @@ namespace WulaFallenEmpire // 保持原有目标,但记录警告 if (this.IsHashIntervalTick(2500)) // 每隔一段时间检查一次 { - Log.Warning($"[WULA] Parent shuttle is not spawned, exit target may be outdated. Last known: {targetMap?.uniqueID} at {targetPos}"); + WulaLog.Debug($"[WULA] Parent shuttle is not spawned, exit target may be outdated. Last known: {targetMap?.uniqueID} at {targetPos}"); } } } @@ -160,7 +160,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[WULA] Error exiting pocket space: {ex}"); + WulaLog.Debug($"[WULA] Error exiting pocket space: {ex}"); } } } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Dialog_ArmedShuttleTransfer.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Dialog_ArmedShuttleTransfer.cs index 8041f4d9..352ebb82 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Dialog_ArmedShuttleTransfer.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/Dialog_ArmedShuttleTransfer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using RimWorld; @@ -146,7 +146,7 @@ namespace WulaFallenEmpire } else { - Log.Error($"[WULA-ERROR] Could not find valid drop position for item {item.LabelShort} in pocket map."); + WulaLog.Debug($"[WULA-ERROR] Could not find valid drop position for item {item.LabelShort} in pocket map."); item.Destroy(); // 实在没地方放,就销毁 } } @@ -212,7 +212,7 @@ namespace WulaFallenEmpire } if (transferableOneWay.things.Contains(t)) { - Log.Error("Tried to add the same thing twice to TransferableOneWay: " + t); + WulaLog.Debug("Tried to add the same thing twice to TransferableOneWay: " + t); } else { diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/GenStep_WulaPocketSpaceSmall.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/GenStep_WulaPocketSpaceSmall.cs index fe569049..782654b2 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/GenStep_WulaPocketSpaceSmall.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/GenStep_WulaPocketSpaceSmall.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using RimWorld; @@ -21,7 +21,7 @@ namespace WulaFallenEmpire { try { - Log.Message($"[WULA] Generating WULA pocket space, map size: {map.Size}"); + WulaLog.Debug($"[WULA] Generating WULA pocket space, map size: {map.Size}"); // 获取地图边界 IntVec3 mapSize = map.Size; @@ -32,7 +32,7 @@ namespace WulaFallenEmpire // 生成内部地板 GenerateFloor(map); - Log.Message("[WULA] WULA pocket space generation completed"); + WulaLog.Debug("[WULA] WULA pocket space generation completed"); // 添加预制件生成 // 如果指定了预制件Def名称,则加载并生成 @@ -42,17 +42,17 @@ namespace WulaFallenEmpire if (customPrefabDef != null) { GeneratePrefab(map, customPrefabDef); - Log.Message($"[WULA] Generated custom prefab: {customPrefabDef.defName}"); + WulaLog.Debug($"[WULA] Generated custom prefab: {customPrefabDef.defName}"); } else { - Log.Warning($"[WULA] Custom prefab '{prefabDefName}' not found. Skipping prefab generation."); + WulaLog.Debug($"[WULA] Custom prefab '{prefabDefName}' not found. Skipping prefab generation."); } } } catch (Exception ex) { - Log.Error($"[WULA] Error generating WULA pocket space: {ex}"); + WulaLog.Debug($"[WULA] Error generating WULA pocket space: {ex}"); } } @@ -103,7 +103,7 @@ namespace WulaFallenEmpire Thing wall = ThingMaker.MakeThing(rockWallDef); wall.SetFaction(null); GenPlace.TryPlaceThing(wall, pos, map, ThingPlaceMode.Direct); - Log.Warning("[WULA] WulaWall not found, using fallback wall"); + WulaLog.Debug("[WULA] WulaWall not found, using fallback wall"); } } } @@ -126,7 +126,7 @@ namespace WulaFallenEmpire if (floorDef == null) { - Log.Warning("[WULA] WulaFloor not found, using fallback floor"); + WulaLog.Debug("[WULA] WulaFloor not found, using fallback floor"); } // 清理内部区域并设置正确的地板 @@ -141,7 +141,7 @@ namespace WulaFallenEmpire } } - Log.Message($"[WULA] Set floor for internal area ({mapSize.x-2}x{mapSize.z-2}) to {(floorDef?.defName ?? fallbackFloor?.defName)}"); + WulaLog.Debug($"[WULA] Set floor for internal area ({mapSize.x-2}x{mapSize.z-2}) to {(floorDef?.defName ?? fallbackFloor?.defName)}"); } /// @@ -192,7 +192,7 @@ namespace WulaFallenEmpire { if (Prefs.DevMode) // 只在开发模式下输出详细日志 { - Log.Message($"[WULA] Removing {thing.def.defName} at {pos} to make space for floor"); + WulaLog.Debug($"[WULA] Removing {thing.def.defName} at {pos} to make space for floor"); } thing.Destroy(DestroyMode.Vanish); } @@ -204,7 +204,7 @@ namespace WulaFallenEmpire { if (thing.def.category == ThingCategory.Building && thing.def.Fillage == FillCategory.Full) { - Log.Warning($"[WULA] Force removing remaining building {thing.def.defName} at {pos}"); + WulaLog.Debug($"[WULA] Force removing remaining building {thing.def.defName} at {pos}"); thing.Destroy(DestroyMode.Vanish); } } @@ -215,13 +215,13 @@ namespace WulaFallenEmpire map.terrainGrid.SetTerrain(pos, floorDef); if (Prefs.DevMode) { - Log.Message($"[WULA] Set terrain at {pos} to {floorDef.defName}"); + WulaLog.Debug($"[WULA] Set terrain at {pos} to {floorDef.defName}"); } } } catch (Exception ex) { - Log.Error($"[WULA] Error clearing cell at {pos}: {ex}"); + WulaLog.Debug($"[WULA] Error clearing cell at {pos}: {ex}"); } } @@ -232,7 +232,7 @@ namespace WulaFallenEmpire { if (prefabDef == null) { - Log.Error("[WULA] PrefabDef is null, cannot generate prefab."); + WulaLog.Debug("[WULA] PrefabDef is null, cannot generate prefab."); return; } @@ -271,7 +271,7 @@ namespace WulaFallenEmpire { // 这里需要递归调用GeneratePrefab,但为了简化,暂时只处理顶层 // 实际项目中,可能需要更复杂的逻辑来处理子预制件的位置和旋转 - Log.Warning($"[WULA] Sub-prefabs are not fully supported in this simple generator: {subPrefabData.data.def.defName}"); + WulaLog.Debug($"[WULA] Sub-prefabs are not fully supported in this simple generator: {subPrefabData.data.def.defName}"); } } } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/PocketSpaceThingHolder.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/PocketSpaceThingHolder.cs index 291d1b22..5ac1ada8 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/PocketSpaceThingHolder.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_Shuttle/PocketSpaceThingHolder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Verse; @@ -50,7 +50,7 @@ namespace WulaFallenEmpire public void Notify_ThingAdded(Thing t) { // 这里可以添加逻辑来处理物品被添加到口袋空间的情况 - Log.Message($"[WULA] Item {t.LabelCap} added to pocket space container."); + WulaLog.Debug($"[WULA] Item {t.LabelCap} added to pocket space container."); } /// @@ -59,7 +59,7 @@ namespace WulaFallenEmpire public void Notify_ThingRemoved(Thing t) { // 这里可以添加逻辑来处理物品被从口袋空间移除的情况 - Log.Message($"[WULA] Item {t.LabelCap} removed from pocket space container."); + WulaLog.Debug($"[WULA] Item {t.LabelCap} removed from pocket space container."); } public void ExposeData() diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/CompPrefabSkyfallerCaller.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/CompPrefabSkyfallerCaller.cs index 235e6591..ac0d7ce7 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/CompPrefabSkyfallerCaller.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/CompPrefabSkyfallerCaller.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Linq; using Verse; @@ -37,7 +37,7 @@ namespace WulaFallenEmpire var prefab = DefDatabase.GetNamed(PropsPrefab.prefabDefName, false); if (prefab == null) { - Log.Error($"[PrefabSkyfallerCaller] Could not find PrefabDef named {PropsPrefab.prefabDefName}"); + WulaLog.Debug($"[PrefabSkyfallerCaller] Could not find PrefabDef named {PropsPrefab.prefabDefName}"); return new List(); // Return empty list to avoid null reference } @@ -69,7 +69,7 @@ namespace WulaFallenEmpire // Final material check before launching if (!HasEnoughMaterials()) { - Log.Warning($"[PrefabSkyfallerCaller] Aborting skyfaller call due to insufficient materials at the last moment."); + WulaLog.Debug($"[PrefabSkyfallerCaller] Aborting skyfaller call due to insufficient materials at the last moment."); ResetCall(); // Reset the calling state return; } @@ -114,7 +114,7 @@ namespace WulaFallenEmpire } else { - Log.Error($"[PrefabSkyfallerCaller] Failed to create Skyfaller_PrefabSpawner. Created thing is of type {thing.GetType().FullName}. Def: {Props.skyfallerDef.defName}, ThingClass: {Props.skyfallerDef.thingClass.FullName}"); + WulaLog.Debug($"[PrefabSkyfallerCaller] Failed to create Skyfaller_PrefabSpawner. Created thing is of type {thing.GetType().FullName}. Def: {Props.skyfallerDef.defName}, ThingClass: {Props.skyfallerDef.thingClass.FullName}"); // Fallback: spawn as normal skyfaller if possible, or just abort if (thing is Skyfaller normalSkyfaller) { @@ -138,7 +138,7 @@ namespace WulaFallenEmpire if (roof != null && !roof.isThickRoof && Props.allowThinRoof) { - Log.Message($"[PrefabSkyfallerCaller] Destroying thin roof at {targetPos}"); + WulaLog.Debug($"[PrefabSkyfallerCaller] Destroying thin roof at {targetPos}"); parent.Map.roofGrid.SetRoof(targetPos, null); // 生成屋顶破坏效果 diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/CompSkyfallerCaller.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/CompSkyfallerCaller.cs index 97387825..a7916e2e 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/CompSkyfallerCaller.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/CompSkyfallerCaller.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using RimWorld; using RimWorld.Planet; @@ -79,7 +79,7 @@ namespace WulaFallenEmpire } } - Log.Message($"[SkyfallerCaller] Found {allFlyOvers.Count} FlyOvers on map"); + WulaLog.Debug($"[SkyfallerCaller] Found {allFlyOvers.Count} FlyOvers on map"); foreach (var thing in allFlyOvers) { @@ -89,28 +89,28 @@ namespace WulaFallenEmpire var facilitiesComp = flyOver.GetComp(); if (facilitiesComp == null) { - Log.Warning($"[SkyfallerCaller] FlyOver at {flyOver.Position} has no CompFlyOverFacilities"); + WulaLog.Debug($"[SkyfallerCaller] FlyOver at {flyOver.Position} has no CompFlyOverFacilities"); continue; } if (facilitiesComp.HasFacility("BuildingdropperFacility")) { - Log.Message($"[SkyfallerCaller] Found valid FlyOver at {flyOver.Position} with BuildingdropperFacility"); + WulaLog.Debug($"[SkyfallerCaller] Found valid FlyOver at {flyOver.Position} with BuildingdropperFacility"); return true; } else { - Log.Message($"[SkyfallerCaller] FlyOver at {flyOver.Position} missing BuildingdropperFacility. Has: {string.Join(", ", facilitiesComp.GetActiveFacilities())}"); + WulaLog.Debug($"[SkyfallerCaller] FlyOver at {flyOver.Position} missing BuildingdropperFacility. Has: {string.Join(", ", facilitiesComp.GetActiveFacilities())}"); } } } - Log.Message("[SkyfallerCaller] No FlyOver with BuildingdropperFacility found"); + WulaLog.Debug("[SkyfallerCaller] No FlyOver with BuildingdropperFacility found"); return false; } catch (System.Exception ex) { - Log.Error($"[SkyfallerCaller] Exception while checking for FlyOver: {ex}"); + WulaLog.Debug($"[SkyfallerCaller] Exception while checking for FlyOver: {ex}"); return false; } } @@ -146,7 +146,7 @@ namespace WulaFallenEmpire callTick = Find.TickManager.TicksGame + Props.autoCallDelayTicks; calling = true; - Log.Message($"[SkyfallerCaller] Scheduled auto-call for non-player building {parent.Label} at tick {callTick}"); + WulaLog.Debug($"[SkyfallerCaller] Scheduled auto-call for non-player building {parent.Label} at tick {callTick}"); } } @@ -185,11 +185,11 @@ namespace WulaFallenEmpire { try { - Log.Message($"[SkyfallerCaller] Executing auto skyfaller call for non-player building at {parent.Position}"); + WulaLog.Debug($"[SkyfallerCaller] Executing auto skyfaller call for non-player building at {parent.Position}"); if (Props.skyfallerDef == null) { - Log.Error("[SkyfallerCaller] Skyfaller def is null!"); + WulaLog.Debug("[SkyfallerCaller] Skyfaller def is null!"); ResetCall(); return; } @@ -202,19 +202,19 @@ namespace WulaFallenEmpire Skyfaller skyfaller = SkyfallerMaker.MakeSkyfaller(Props.skyfallerDef); if (skyfaller == null) { - Log.Error("[SkyfallerCaller] Failed to create skyfaller!"); + WulaLog.Debug("[SkyfallerCaller] Failed to create skyfaller!"); ResetCall(); return; } IntVec3 spawnPos = parent.Position; - Log.Message($"[SkyfallerCaller] Spawning auto skyfaller at {spawnPos}"); + WulaLog.Debug($"[SkyfallerCaller] Spawning auto skyfaller at {spawnPos}"); GenSpawn.Spawn(skyfaller, spawnPos, parent.Map); if (Props.destroyBuilding) { - Log.Message($"[SkyfallerCaller] Destroying non-player building {parent.Label}"); + WulaLog.Debug($"[SkyfallerCaller] Destroying non-player building {parent.Label}"); parent.Destroy(DestroyMode.Vanish); } @@ -228,7 +228,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[SkyfallerCaller] Error in ExecuteAutoSkyfallerCall: {ex}"); + WulaLog.Debug($"[SkyfallerCaller] Error in ExecuteAutoSkyfallerCall: {ex}"); ResetCall(); } } @@ -263,7 +263,7 @@ namespace WulaFallenEmpire return; } - Log.Message($"[SkyfallerCaller] Starting skyfaller call from {parent.Label} at {parent.Position}"); + WulaLog.Debug($"[SkyfallerCaller] Starting skyfaller call from {parent.Label} at {parent.Position}"); calling = true; used = true; @@ -295,11 +295,11 @@ namespace WulaFallenEmpire protected virtual void ExecuteSkyfallerCall() { - Log.Message($"[SkyfallerCaller] Executing skyfaller call at {parent.Position}"); + WulaLog.Debug($"[SkyfallerCaller] Executing skyfaller call at {parent.Position}"); if (Props.skyfallerDef == null) { - Log.Error("[SkyfallerCaller] Skyfaller def is null!"); + WulaLog.Debug("[SkyfallerCaller] Skyfaller def is null!"); return; } @@ -307,7 +307,7 @@ namespace WulaFallenEmpire var resourceCheck = CheckAndConsumeMaterials(); if (!resourceCheck.HasEnoughMaterials) { - Log.Message($"[SkyfallerCaller] Aborting skyfaller call due to insufficient materials."); + WulaLog.Debug($"[SkyfallerCaller] Aborting skyfaller call due to insufficient materials."); ResetCall(); return; } @@ -322,18 +322,18 @@ namespace WulaFallenEmpire Skyfaller skyfaller = SkyfallerMaker.MakeSkyfaller(Props.skyfallerDef); if (skyfaller == null) { - Log.Error("[SkyfallerCaller] Failed to create skyfaller!"); + WulaLog.Debug("[SkyfallerCaller] Failed to create skyfaller!"); return; } IntVec3 spawnPos = parent.Position; - Log.Message($"[SkyfallerCaller] Spawning skyfaller at {spawnPos}"); + WulaLog.Debug($"[SkyfallerCaller] Spawning skyfaller at {spawnPos}"); GenSpawn.Spawn(skyfaller, spawnPos, parent.Map); if (Props.destroyBuilding) { - Log.Message($"[SkyfallerCaller] Destroying building {parent.Label}"); + WulaLog.Debug($"[SkyfallerCaller] Destroying building {parent.Label}"); parent.Destroy(DestroyMode.Vanish); } @@ -350,7 +350,7 @@ namespace WulaFallenEmpire if (roof != null && !roof.isThickRoof && Props.allowThinRoof) { - Log.Message($"[SkyfallerCaller] Destroying thin roof at {targetPos}"); + WulaLog.Debug($"[SkyfallerCaller] Destroying thin roof at {targetPos}"); parent.Map.roofGrid.SetRoof(targetPos, null); // 生成屋顶破坏效果 @@ -670,7 +670,7 @@ namespace WulaFallenEmpire // 在非 God Mode 下,这个方法不应该被调用 // 实际的消耗在 CheckAndConsumeMaterials 中处理 - Log.Warning("[SkyfallerCaller] ConsumeMaterials called in non-God mode, this shouldn't happen"); + WulaLog.Debug("[SkyfallerCaller] ConsumeMaterials called in non-God mode, this shouldn't happen"); } // 其余方法保持不变... diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/DebugActions_PrefabSkyfallerCaller.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/DebugActions_PrefabSkyfallerCaller.cs index 6d7fed40..7f5fc9cf 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/DebugActions_PrefabSkyfallerCaller.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/DebugActions_PrefabSkyfallerCaller.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using RimWorld; using UnityEngine; @@ -18,7 +18,7 @@ namespace WulaFallenEmpire if (!eligibleDefs.Any()) { - Log.Warning("[Debug] No ThingDefs found with CompProperties_PrefabSkyfallerCaller"); + WulaLog.Debug("[Debug] No ThingDefs found with CompProperties_PrefabSkyfallerCaller"); return; } @@ -43,7 +43,7 @@ namespace WulaFallenEmpire if (!eligibleDefs.Any()) { - Log.Warning("[Debug] No ThingDefs found with CompProperties_PrefabSkyfallerCaller"); + WulaLog.Debug("[Debug] No ThingDefs found with CompProperties_PrefabSkyfallerCaller"); return; } @@ -85,7 +85,7 @@ namespace WulaFallenEmpire var currentMap = Find.CurrentMap; if (currentMap == null) { - Log.Warning("[Debug] No current map found"); + WulaLog.Debug("[Debug] No current map found"); return; } @@ -97,11 +97,11 @@ namespace WulaFallenEmpire var compProps = thingDef.comps.OfType().FirstOrDefault(); if (compProps == null) { - Log.Warning($"[Debug] Could not find CompProperties_PrefabSkyfallerCaller for {thingDef.defName}"); + WulaLog.Debug($"[Debug] Could not find CompProperties_PrefabSkyfallerCaller for {thingDef.defName}"); return; } - Log.Message($"[Debug] Looking for spawn positions for {thingDef.defName} (Size: {thingDef.Size})"); + WulaLog.Debug($"[Debug] Looking for spawn positions for {thingDef.defName} (Size: {thingDef.Size})"); for (int i = 0; i < spawnCount && attempts < maxAttempts; i++) { @@ -120,11 +120,11 @@ namespace WulaFallenEmpire GenSpawn.Spawn(thing, spawnPos, currentMap); successCount++; - Log.Message($"[Debug] Successfully spawned {thingDef.defName} at {spawnPos} for faction {faction?.Name ?? "None"}"); + WulaLog.Debug($"[Debug] Successfully spawned {thingDef.defName} at {spawnPos} for faction {faction?.Name ?? "None"}"); } else { - Log.Warning($"[Debug] Failed to find valid spawn position for {thingDef.defName} (attempt {attempts})"); + WulaLog.Debug($"[Debug] Failed to find valid spawn position for {thingDef.defName} (attempt {attempts})"); } } @@ -144,7 +144,7 @@ namespace WulaFallenEmpire var potentialCells = new List(); // 策略1:首先尝试玩家基地附近的开放区域 - Log.Message($"[Debug] Searching near base area..."); + WulaLog.Debug($"[Debug] Searching near base area..."); var baseCells = GetOpenAreaCellsNearBase(map, thingDef.Size); foreach (var cell in baseCells) { @@ -157,12 +157,12 @@ namespace WulaFallenEmpire if (potentialCells.Count > 0) { - Log.Message($"[Debug] Found {potentialCells.Count} positions near base"); + WulaLog.Debug($"[Debug] Found {potentialCells.Count} positions near base"); return potentialCells.RandomElement(); } // 策略2:搜索整个地图的开阔区域 - Log.Message($"[Debug] Searching open areas..."); + WulaLog.Debug($"[Debug] Searching open areas..."); var openAreas = FindOpenAreas(map, thingDef.Size, 1000); foreach (var cell in openAreas) { @@ -175,12 +175,12 @@ namespace WulaFallenEmpire if (potentialCells.Count > 0) { - Log.Message($"[Debug] Found {potentialCells.Count} positions in open areas"); + WulaLog.Debug($"[Debug] Found {potentialCells.Count} positions in open areas"); return potentialCells.RandomElement(); } // 策略3:使用随机采样 - Log.Message($"[Debug] Trying random sampling..."); + WulaLog.Debug($"[Debug] Trying random sampling..."); for (int i = 0; i < 500; i++) { IntVec3 randomCell = new IntVec3( @@ -198,11 +198,11 @@ namespace WulaFallenEmpire if (potentialCells.Count > 0) { - Log.Message($"[Debug] Found {potentialCells.Count} positions via random sampling"); + WulaLog.Debug($"[Debug] Found {potentialCells.Count} positions via random sampling"); return potentialCells.RandomElement(); } - Log.Warning($"[Debug] No valid positions found for {thingDef.defName}"); + WulaLog.Debug($"[Debug] No valid positions found for {thingDef.defName}"); return IntVec3.Invalid; } @@ -415,12 +415,12 @@ namespace WulaFallenEmpire } } - Log.Message($"[Debug] Force cleared {clearedCount} objects for skyfaller drop"); + WulaLog.Debug($"[Debug] Force cleared {clearedCount} objects for skyfaller drop"); return clearedCount > 0; } catch (System.Exception ex) { - Log.Error($"[Debug] Error force clearing area: {ex}"); + WulaLog.Debug($"[Debug] Error force clearing area: {ex}"); return false; } } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/Skyfaller_PrefabSpawner.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/Skyfaller_PrefabSpawner.cs index 778c79b2..ba926121 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/Skyfaller_PrefabSpawner.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_SkyfallerCaller/Skyfaller_PrefabSpawner.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; namespace WulaFallenEmpire @@ -13,14 +13,14 @@ namespace WulaFallenEmpire // Don't spawn the innerThing, we are spawning a prefab instead. if (string.IsNullOrEmpty(prefabDefName)) { - Log.Error("[Skyfaller_PrefabSpawner] prefabDefName is null or empty. Cannot spawn prefab."); + WulaLog.Debug("[Skyfaller_PrefabSpawner] prefabDefName is null or empty. Cannot spawn prefab."); return; } PrefabDef prefabDef = DefDatabase.GetNamed(prefabDefName, false); if (prefabDef == null) { - Log.Error($"[Skyfaller_PrefabSpawner] Could not find PrefabDef named {prefabDefName}."); + WulaLog.Debug($"[Skyfaller_PrefabSpawner] Could not find PrefabDef named {prefabDefName}."); return; } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_StorageTurret/CompStorageTurret.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_StorageTurret/CompStorageTurret.cs index 604af7ba..1a67fdde 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_StorageTurret/CompStorageTurret.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_StorageTurret/CompStorageTurret.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using UnityEngine; using Verse; @@ -372,7 +372,7 @@ namespace WulaFallenEmpire // 确保 parent 不为 null if (_parent == null || _parent.parent == null) { - Log.Warning("[StorageTurret] Parent is null when updating gun verbs"); + WulaLog.Debug("[StorageTurret] Parent is null when updating gun verbs"); return; } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_Teleporter/CompMapTeleporter.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_Teleporter/CompMapTeleporter.cs index 779ee395..65fc6bba 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_Teleporter/CompMapTeleporter.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_Teleporter/CompMapTeleporter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using RimWorld; @@ -157,7 +157,7 @@ namespace WulaFallenEmpire warmupTicksLeft--; if (warmupTicksLeft % 60 == 0) { - Log.Message($"[WULA] Teleport warmup: {warmupTicksLeft} ticks left."); + WulaLog.Debug($"[WULA] Teleport warmup: {warmupTicksLeft} ticks left."); foreach (var member in GroupMembers) { Props.warmupEffecter?.Spawn(member.parent, member.parent.Map).Cleanup(); @@ -166,7 +166,7 @@ namespace WulaFallenEmpire if (warmupTicksLeft <= 0) { - Log.Message("[WULA] Warmup finished. Attempting teleport..."); + WulaLog.Debug("[WULA] Warmup finished. Attempting teleport..."); TryTeleport(); isWarmingUp = false; } @@ -335,7 +335,7 @@ namespace WulaFallenEmpire private void TryTeleport() { - Log.Message($"[WULA] TryTeleport called. Target valid: {target.IsValid}, Tile: {target.Tile}, Cell: {target.Cell}"); + WulaLog.Debug($"[WULA] TryTeleport called. Target valid: {target.IsValid}, Tile: {target.Tile}, Cell: {target.Cell}"); if (!target.IsValid) { @@ -349,7 +349,7 @@ namespace WulaFallenEmpire if (targetMap == null) { - Log.Message($"[WULA] Target map is null. Generating map for tile {target.Tile}..."); + WulaLog.Debug($"[WULA] Target map is null. Generating map for tile {target.Tile}..."); targetMap = GetOrGenerateTargetMap(target.Tile); if (targetMap == null) { @@ -360,7 +360,7 @@ namespace WulaFallenEmpire targetCell = targetMap.Center; } - Log.Message($"[WULA] Teleporting to map {targetMap.Index}, cell {targetCell}"); + WulaLog.Debug($"[WULA] Teleporting to map {targetMap.Index}, cell {targetCell}"); TeleportContents(targetMap, targetCell); } @@ -402,7 +402,7 @@ namespace WulaFallenEmpire List thingsToTeleport = new List(); List> terrainToTeleport = new List>(); - Log.Message($"[WULA] Collecting data from {cells.Count} cells in group"); + WulaLog.Debug($"[WULA] Collecting data from {cells.Count} cells in group"); // 1. 收集数据 HashSet collectedThings = new HashSet(); diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_TransformAtFullCapacity/CompTransformAtFullCapacity.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_TransformAtFullCapacity/CompTransformAtFullCapacity.cs index 1dbea549..93d7d529 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_TransformAtFullCapacity/CompTransformAtFullCapacity.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_TransformAtFullCapacity/CompTransformAtFullCapacity.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using UnityEngine; using Verse; @@ -164,7 +164,7 @@ namespace WulaFallenEmpire // 播放转换效果 PlayTransformEffects(position, map); - Log.Message($"[TransformSystem] Building -> Pawn transformation completed at {position}. Path grid updated."); + WulaLog.Debug($"[TransformSystem] Building -> Pawn transformation completed at {position}. Path grid updated."); } } } diff --git a/Source/WulaFallenEmpire/BuildingComp/WULA_TransformAtFullCapacity/CompTransformIntoBuilding.cs b/Source/WulaFallenEmpire/BuildingComp/WULA_TransformAtFullCapacity/CompTransformIntoBuilding.cs index 78516b20..b85f2908 100644 --- a/Source/WulaFallenEmpire/BuildingComp/WULA_TransformAtFullCapacity/CompTransformIntoBuilding.cs +++ b/Source/WulaFallenEmpire/BuildingComp/WULA_TransformAtFullCapacity/CompTransformIntoBuilding.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using UnityEngine; using Verse; @@ -288,7 +288,7 @@ namespace WulaFallenEmpire lastValidationResult = null; lastValidationReason = null; - Log.Message($"[TransformSystem] Pawn -> Building transformation completed at {desiredPosition}. Path grid updated."); + WulaLog.Debug($"[TransformSystem] Pawn -> Building transformation completed at {desiredPosition}. Path grid updated."); } } } diff --git a/Source/WulaFallenEmpire/Damage/DamageWorker_ExplosionWithTerrain.cs b/Source/WulaFallenEmpire/Damage/DamageWorker_ExplosionWithTerrain.cs index e7867667..279cb527 100644 --- a/Source/WulaFallenEmpire/Damage/DamageWorker_ExplosionWithTerrain.cs +++ b/Source/WulaFallenEmpire/Damage/DamageWorker_ExplosionWithTerrain.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using RimWorld; using UnityEngine; @@ -46,7 +46,7 @@ namespace WulaFallenEmpire // 检查单元格是否可影响 if (!terrainCover.CanAffectCell(cell, map, out string reason)) { - Log.Message($"Cannot affect cell {cell}: {reason}"); + WulaLog.Debug($"Cannot affect cell {cell}: {reason}"); return; } @@ -59,7 +59,7 @@ namespace WulaFallenEmpire Plant plant = cell.GetPlant(map); if (plant != null && plant.def.plant.treeCategory == TreeCategory.Super) { - Log.Message($"Large tree at {cell}, skipping"); + WulaLog.Debug($"Large tree at {cell}, skipping"); return; } @@ -78,11 +78,11 @@ namespace WulaFallenEmpire // 设置新地形 map.terrainGrid.SetTerrain(cell, terrainCover.terrainToSpawn); - Log.Message($"Applied terrain {terrainCover.terrainToSpawn.defName} to cell {cell}"); + WulaLog.Debug($"Applied terrain {terrainCover.terrainToSpawn.defName} to cell {cell}"); } else { - Log.Message($"Cannot build terrain {terrainCover.terrainToSpawn.defName} at cell {cell}"); + WulaLog.Debug($"Cannot build terrain {terrainCover.terrainToSpawn.defName} at cell {cell}"); } } } diff --git a/Source/WulaFallenEmpire/Damage/DamageWorker_ExtraDamage.cs b/Source/WulaFallenEmpire/Damage/DamageWorker_ExtraDamage.cs index d808e5e9..03d95e3d 100644 --- a/Source/WulaFallenEmpire/Damage/DamageWorker_ExtraDamage.cs +++ b/Source/WulaFallenEmpire/Damage/DamageWorker_ExtraDamage.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; @@ -36,7 +36,7 @@ namespace WulaFallenEmpire // 调试信息 if (Prefs.DevMode) { - Log.Message($"应用额外伤害: {extraDamage.damageDef.defName} 伤害值: {extraDamage.amount}"); + WulaLog.Debug($"应用额外伤害: {extraDamage.damageDef.defName} 伤害值: {extraDamage.amount}"); } } } diff --git a/Source/WulaFallenEmpire/EventSystem/AI/AIHistoryManager.cs b/Source/WulaFallenEmpire/EventSystem/AI/AIHistoryManager.cs index 13cdb02e..321ac1d0 100644 --- a/Source/WulaFallenEmpire/EventSystem/AI/AIHistoryManager.cs +++ b/Source/WulaFallenEmpire/EventSystem/AI/AIHistoryManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Text; @@ -57,7 +57,7 @@ namespace WulaFallenEmpire.EventSystem.AI } catch (Exception ex) { - Log.Error($"[WulaFallenEmpire] Failed to load AI history from {path}: {ex}"); + WulaLog.Debug($"[WulaFallenEmpire] Failed to load AI history from {path}: {ex}"); } } @@ -75,7 +75,7 @@ namespace WulaFallenEmpire.EventSystem.AI } catch (Exception ex) { - Log.Error($"[WulaFallenEmpire] Failed to save AI history to {path}: {ex}"); + WulaLog.Debug($"[WulaFallenEmpire] Failed to save AI history to {path}: {ex}"); } } @@ -92,7 +92,7 @@ namespace WulaFallenEmpire.EventSystem.AI } catch (Exception ex) { - Log.Error($"[WulaFallenEmpire] Failed to clear AI history at {path}: {ex}"); + WulaLog.Debug($"[WulaFallenEmpire] Failed to clear AI history at {path}: {ex}"); } } diff --git a/Source/WulaFallenEmpire/EventSystem/AI/SimpleAIClient.cs b/Source/WulaFallenEmpire/EventSystem/AI/SimpleAIClient.cs index 32604963..335afe24 100644 --- a/Source/WulaFallenEmpire/EventSystem/AI/SimpleAIClient.cs +++ b/Source/WulaFallenEmpire/EventSystem/AI/SimpleAIClient.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; @@ -25,7 +25,7 @@ namespace WulaFallenEmpire.EventSystem.AI { if (string.IsNullOrEmpty(_baseUrl)) { - Log.Error("[WulaAI] Base URL is missing."); + WulaLog.Debug("[WulaAI] Base URL is missing."); return null; } @@ -69,8 +69,8 @@ namespace WulaFallenEmpire.EventSystem.AI string jsonBody = jsonBuilder.ToString(); if (Prefs.DevMode) { - Log.Message($"[WulaAI] Sending request to {endpoint} (model={_model}, messages={messages?.Count ?? 0})"); - Log.Message($"[WulaAI] Request body (truncated):\n{TruncateForLog(jsonBody)}"); + WulaLog.Debug($"[WulaAI] Sending request to {endpoint} (model={_model}, messages={messages?.Count ?? 0})"); + WulaLog.Debug($"[WulaAI] Request body (truncated):\n{TruncateForLog(jsonBody)}"); } using (UnityWebRequest request = new UnityWebRequest(endpoint, "POST")) @@ -93,14 +93,14 @@ namespace WulaFallenEmpire.EventSystem.AI if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) { - Log.Error($"[WulaAI] API Error: {request.error}\nResponse (truncated): {TruncateForLog(request.downloadHandler.text)}"); + WulaLog.Debug($"[WulaAI] API Error: {request.error}\nResponse (truncated): {TruncateForLog(request.downloadHandler.text)}"); return null; } string responseText = request.downloadHandler.text; if (Prefs.DevMode) { - Log.Message($"[WulaAI] Raw Response (truncated): {TruncateForLog(responseText)}"); + WulaLog.Debug($"[WulaAI] Raw Response (truncated): {TruncateForLog(responseText)}"); } return ExtractContent(responseText); } @@ -181,7 +181,7 @@ namespace WulaFallenEmpire.EventSystem.AI } catch (Exception ex) { - Log.Error($"[WulaAI] Error parsing response: {ex}"); + WulaLog.Debug($"[WulaAI] Error parsing response: {ex}"); } return null; } diff --git a/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_SendReinforcement.cs b/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_SendReinforcement.cs index 61babbb7..63de8aee 100644 --- a/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_SendReinforcement.cs +++ b/Source/WulaFallenEmpire/EventSystem/AI/Tools/Tool_SendReinforcement.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -129,7 +129,7 @@ namespace WulaFallenEmpire.EventSystem.AI.Tools float baseMaxPoints = StorytellerUtility.DefaultThreatPointsNow(map); float adjustedMaxPoints = baseMaxPoints * goodwillFactor * 1.5f; - Log.Message($"[WulaAI] send_reinforcement: totalCost={totalCost}, adjustedMaxPoints={adjustedMaxPoints}"); + WulaLog.Debug($"[WulaAI] send_reinforcement: totalCost={totalCost}, adjustedMaxPoints={adjustedMaxPoints}"); if (totalCost > adjustedMaxPoints) { return $"Error: Total cost {totalCost} exceeds limit {adjustedMaxPoints:F0}. Reduce unit count."; diff --git a/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_AIConversation.cs b/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_AIConversation.cs index 196ec3c8..610b04c5 100644 --- a/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_AIConversation.cs +++ b/Source/WulaFallenEmpire/EventSystem/AI/UI/Dialog_AIConversation.cs @@ -127,7 +127,7 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori } catch (Exception ex) { - Log.Error($"[WulaAI] Failed to persist AI history: {ex}"); + WulaLog.Debug($"[WulaAI] Failed to persist AI history: {ex}"); } } @@ -143,7 +143,7 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori } else { - Log.Warning($"[WulaAI] Failed to load portrait: {path}"); + WulaLog.Debug($"[WulaAI] Failed to load portrait: {path}"); } } @@ -173,7 +173,7 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori } else { - Log.Warning($"[WulaAI] Portrait ID {id} not found."); + WulaLog.Debug($"[WulaAI] Portrait ID {id} not found."); } } @@ -578,7 +578,7 @@ Example (changing to a neutral expression): var phase = (RequestPhase)phaseIndex; if (Prefs.DevMode) { - Log.Message($"[WulaAI] ===== Turn {phaseIndex}/4 ({phase}) ====="); + WulaLog.Debug($"[WulaAI] ===== Turn {phaseIndex}/4 ({phase}) ====="); } bool toolsEnabled = phase != RequestPhase.Reply; @@ -592,7 +592,7 @@ Example (changing to a neutral expression): { if (Prefs.DevMode) { - Log.Message($"[WulaAI] Turn {phaseIndex}/4 reply request (attempt {attempts + 1})"); + WulaLog.Debug($"[WulaAI] Turn {phaseIndex}/4 reply request (attempt {attempts + 1})"); } string reply = await client.GetChatCompletionAsync(systemInstruction, _history); if (string.IsNullOrEmpty(reply)) @@ -622,7 +622,7 @@ Example (changing to a neutral expression): if (Prefs.DevMode) { - Log.Message($"[WulaAI] Turn {phaseIndex}/4 tool request"); + WulaLog.Debug($"[WulaAI] Turn {phaseIndex}/4 tool request"); } string response = await client.GetChatCompletionAsync(systemInstruction, _history); if (string.IsNullOrEmpty(response)) @@ -638,7 +638,7 @@ Example (changing to a neutral expression): PersistHistory(); if (Prefs.DevMode) { - Log.Message($"[WulaAI] Turn {phaseIndex}/4 missing XML; retrying once"); + WulaLog.Debug($"[WulaAI] Turn {phaseIndex}/4 missing XML; retrying once"); } response = await client.GetChatCompletionAsync(systemInstruction, _history); if (string.IsNullOrEmpty(response)) @@ -652,7 +652,7 @@ Example (changing to a neutral expression): { if (Prefs.DevMode) { - Log.Warning($"[WulaAI] Turn {phaseIndex}/4 still missing XML after retry; forcing "); + WulaLog.Debug($"[WulaAI] Turn {phaseIndex}/4 still missing XML after retry; forcing "); } response = phase == RequestPhase.Cosmetic ? "2" @@ -666,7 +666,7 @@ Example (changing to a neutral expression): PersistHistory(); if (Prefs.DevMode) { - Log.Message("[WulaAI] Turn 3/4 missing ; retrying once"); + WulaLog.Debug("[WulaAI] Turn 3/4 missing ; retrying once"); } string retry = await client.GetChatCompletionAsync(systemInstruction, _history); @@ -678,7 +678,7 @@ Example (changing to a neutral expression): { if (Prefs.DevMode) { - Log.Warning("[WulaAI] Turn 3/4 still missing after retry; forcing default expression_id=2"); + WulaLog.Debug("[WulaAI] Turn 3/4 still missing after retry; forcing default expression_id=2"); } response = "2"; } @@ -689,7 +689,7 @@ Example (changing to a neutral expression): } catch (Exception ex) { - Log.Error($"[WulaAI] Exception in RunPhasedRequestAsync: {ex}"); + WulaLog.Debug($"[WulaAI] Exception in RunPhasedRequestAsync: {ex}"); _currentResponse = "Wula_AI_Error_Internal".Translate(ex.Message); } finally @@ -792,7 +792,7 @@ Example (changing to a neutral expression): if (Prefs.DevMode) { - Log.Message($"[WulaAI] Executing tool (phase {phase}): {toolName} with args: {argsXml}"); + WulaLog.Debug($"[WulaAI] Executing tool (phase {phase}): {toolName} with args: {argsXml}"); } string signature = $"{toolName}:{Regex.Replace(argsXml ?? "", @"\s+", " ").Trim()}"; @@ -918,7 +918,7 @@ Example (changing to a neutral expression): } catch (Exception ex) { - Log.Error($"[WulaAI] Exception in GenerateResponse: {ex}"); + WulaLog.Debug($"[WulaAI] Exception in GenerateResponse: {ex}"); _currentResponse = "Wula_AI_Error_Internal".Translate(ex.Message); } finally @@ -1069,7 +1069,7 @@ Example (changing to a neutral expression): if (tool == null) { string errorMsg = $"Error: Tool '{toolName}' not found."; - Log.Error($"[WulaAI] {errorMsg}"); + WulaLog.Debug($"[WulaAI] {errorMsg}"); combinedResults.AppendLine(errorMsg); continue; } @@ -1084,7 +1084,7 @@ Example (changing to a neutral expression): if (Prefs.DevMode) { - Log.Message($"[WulaAI] Executing tool: {toolName} with args: {argsXml}"); + WulaLog.Debug($"[WulaAI] Executing tool: {toolName} with args: {argsXml}"); } // Record tool signature for loop detection (before execution, so errors also count) @@ -1096,7 +1096,7 @@ Example (changing to a neutral expression): if (Prefs.DevMode && !string.IsNullOrEmpty(result)) { string toLog = result.Length <= 2000 ? result : result.Substring(0, 2000) + $"... (truncated, total {result.Length} chars)"; - Log.Message($"[WulaAI] Tool '{toolName}' result: {toLog}"); + WulaLog.Debug($"[WulaAI] Tool '{toolName}' result: {toLog}"); } if (toolName == "modify_goodwill") @@ -1154,7 +1154,7 @@ Example (changing to a neutral expression): } catch (Exception ex) { - Log.Error($"[WulaAI] Exception in HandleXmlToolUsage: {ex}"); + WulaLog.Debug($"[WulaAI] Exception in HandleXmlToolUsage: {ex}"); _history.Add(("tool", $"Error processing tool call: {ex.Message}")); PersistHistory(); await GenerateResponse(isContinuation: true); @@ -1535,7 +1535,7 @@ Example (changing to a neutral expression): } catch (Exception ex) { - Log.Error($"[WulaAI] Failed to clear AI history: {ex}"); + WulaLog.Debug($"[WulaAI] Failed to clear AI history: {ex}"); } Messages.Message("已清除 AI 对话上下文历史。", MessageTypeDefOf.NeutralEvent); diff --git a/Source/WulaFallenEmpire/EventSystem/CompOpenCustomUI.cs b/Source/WulaFallenEmpire/EventSystem/CompOpenCustomUI.cs index 2281ab41..c365f69c 100644 --- a/Source/WulaFallenEmpire/EventSystem/CompOpenCustomUI.cs +++ b/Source/WulaFallenEmpire/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 WulaFallenEmpire } else { - Log.Error($"[CompOpenCustomUI] Could not find EventDef named '{Props.uiDefName}'."); + WulaLog.Debug($"[CompOpenCustomUI] Could not find EventDef named '{Props.uiDefName}'."); } }); diff --git a/Source/WulaFallenEmpire/EventSystem/Condition/ConditionBase.cs b/Source/WulaFallenEmpire/EventSystem/Condition/ConditionBase.cs index 4101f051..61ea7569 100644 --- a/Source/WulaFallenEmpire/EventSystem/Condition/ConditionBase.cs +++ b/Source/WulaFallenEmpire/EventSystem/Condition/ConditionBase.cs @@ -1,4 +1,4 @@ -using Verse; +using Verse; using RimWorld; namespace WulaFallenEmpire @@ -58,7 +58,7 @@ namespace WulaFallenEmpire } catch (System.Exception e) { - Log.Warning($"[EventSystem] Condition_VariableEquals: Could not compare '{variable}' and '{compareValueStr}'. Error: {e.Message}"); + WulaLog.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 WulaFallenEmpire var eventVarManager = Find.World.GetComponent(); if (!eventVarManager.HasVariable(name)) { - Log.Message($"[EventSystem] {GetType().Name}: Variable '{name}' not found, defaulting to 0f."); + WulaLog.Debug($"[EventSystem] {GetType().Name}: Variable '{name}' not found, defaulting to 0f."); eventVarManager.SetVariable(name, 0f); } @@ -102,13 +102,13 @@ namespace WulaFallenEmpire if (float.IsNaN(compareValue)) { reason = $"Comparison variable '{valueVariableName}' not set or not a number."; - Log.Warning($"[EventSystem] {GetType().Name} check for '{name}' failed: {reason}"); + WulaLog.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}"); + WulaLog.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 WulaFallenEmpire } catch (System.Exception e) { - Log.Warning($"[EventSystem] Condition_VariableNotEqual: Could not compare '{variable}' and '{compareValueStr}'. Error: {e.Message}"); + WulaLog.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}"); + WulaLog.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/WulaFallenEmpire/EventSystem/Condition/Condition_FlagExists.cs b/Source/WulaFallenEmpire/EventSystem/Condition/Condition_FlagExists.cs index 68bef5a7..0d4704fc 100644 --- a/Source/WulaFallenEmpire/EventSystem/Condition/Condition_FlagExists.cs +++ b/Source/WulaFallenEmpire/EventSystem/Condition/Condition_FlagExists.cs @@ -1,4 +1,4 @@ -using Verse; +using Verse; using RimWorld; namespace WulaFallenEmpire @@ -40,7 +40,7 @@ namespace WulaFallenEmpire } } - Log.Message($"[EventSystem] Condition_FlagExists check: Flag='{flagName}', Exists={flagExists}, Reason='{reason}'"); + WulaLog.Debug($"[EventSystem] Condition_FlagExists check: Flag='{flagName}', Exists={flagExists}, Reason='{reason}'"); return flagExists; } } diff --git a/Source/WulaFallenEmpire/EventSystem/DelayedActionManager.cs b/Source/WulaFallenEmpire/EventSystem/DelayedActionManager.cs index 1a91e009..be73fc1a 100644 --- a/Source/WulaFallenEmpire/EventSystem/DelayedActionManager.cs +++ b/Source/WulaFallenEmpire/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 WulaFallenEmpire } catch (Exception ex) { - Log.Error($"[WulaFallenEmpire] Error executing delayed action for event '{delayedAction.eventDefName}': {ex}"); + WulaLog.Debug($"[WulaFallenEmpire] Error executing delayed action for event '{delayedAction.eventDefName}': {ex}"); } actions.RemoveAt(i); } @@ -78,7 +78,7 @@ namespace WulaFallenEmpire } else { - Log.Error($"[WulaFallenEmpire] DelayedActionManager could not find EventDef named '{defName}'"); + WulaLog.Debug($"[WulaFallenEmpire] DelayedActionManager could not find EventDef named '{defName}'"); } } diff --git a/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs b/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs index a453f88f..884764a4 100644 --- a/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs +++ b/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs @@ -311,7 +311,7 @@ namespace WulaFallenEmpire catch (Exception ex) { // 错误处理:如果滚动视图出现问题,回退到简单标签 - Log.Warning($"[CustomDisplay] Error in description scroll view: {ex.Message}"); + WulaLog.Debug($"[CustomDisplay] Error in description scroll view: {ex.Message}"); Widgets.Label(outRect, text); } } diff --git a/Source/WulaFallenEmpire/EventSystem/Effect/EffectBase.cs b/Source/WulaFallenEmpire/EventSystem/Effect/EffectBase.cs index db193374..9f4787b5 100644 --- a/Source/WulaFallenEmpire/EventSystem/Effect/EffectBase.cs +++ b/Source/WulaFallenEmpire/EventSystem/Effect/EffectBase.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 WulaFallenEmpire } else { - Log.Error("[WulaFallenEmpire] DelayedActionManager not found. Cannot schedule delayed UI opening."); + WulaLog.Debug("[WulaFallenEmpire] DelayedActionManager not found. Cannot schedule delayed UI opening."); } } else @@ -64,7 +64,7 @@ namespace WulaFallenEmpire } else { - Log.Error($"[WulaFallenEmpire] Effect_OpenCustomUI could not find EventDef named '{defName}'"); + WulaLog.Debug($"[WulaFallenEmpire] Effect_OpenCustomUI could not find EventDef named '{defName}'"); } } @@ -119,7 +119,7 @@ namespace WulaFallenEmpire { if (incident == null) { - Log.Error("[WulaFallenEmpire] Effect_FireIncident has a null incident Def."); + WulaLog.Debug("[WulaFallenEmpire] Effect_FireIncident has a null incident Def."); return; } @@ -131,7 +131,7 @@ namespace WulaFallenEmpire if (!incident.Worker.TryExecute(parms)) { - Log.Error($"[WulaFallenEmpire] Could not fire incident {incident.defName}"); + WulaLog.Debug($"[WulaFallenEmpire] Could not fire incident {incident.defName}"); } } } @@ -145,14 +145,14 @@ namespace WulaFallenEmpire { if (faction == null) { - Log.Error("[WulaFallenEmpire] Effect_ChangeFactionRelation has a null faction Def."); + WulaLog.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}'."); + WulaLog.Debug($"[WulaFallenEmpire] Could not find an active faction for FactionDef '{faction.defName}'."); return; } @@ -204,14 +204,14 @@ namespace WulaFallenEmpire { if (faction == null) { - Log.Error("[WulaFallenEmpire] Effect_ChangeFactionRelation_FromVariable has a null faction Def."); + WulaLog.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}'."); + WulaLog.Debug($"[WulaFallenEmpire] Could not find an active faction for FactionDef '{faction.defName}'."); return; } @@ -230,12 +230,12 @@ namespace WulaFallenEmpire { if (kindDef == null) { - Log.Error("[WulaFallenEmpire] Effect_SpawnPawnAndStore has a null kindDef."); + WulaLog.Debug("[WulaFallenEmpire] Effect_SpawnPawnAndStore has a null kindDef."); return; } if (storeAs.NullOrEmpty()) { - Log.Error("[WulaFallenEmpire] Effect_SpawnPawnAndStore needs a 'storeAs' variable name."); + WulaLog.Debug("[WulaFallenEmpire] Effect_SpawnPawnAndStore needs a 'storeAs' variable name."); return; } @@ -269,14 +269,14 @@ namespace WulaFallenEmpire { if (thingDef == null) { - Log.Error("[WulaFallenEmpire] Effect_GiveThing has a null thingDef."); + WulaLog.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."); + WulaLog.Debug("[WulaFallenEmpire] Effect_GiveThing cannot execute without a current map."); return; } @@ -303,14 +303,14 @@ namespace WulaFallenEmpire { if (kindDef == null) { - Log.Error("[WulaFallenEmpire] Effect_SpawnPawn has a null kindDef."); + WulaLog.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."); + WulaLog.Debug("[WulaFallenEmpire] Effect_SpawnPawn cannot execute without a current map."); return; } @@ -361,7 +361,7 @@ namespace WulaFallenEmpire { if (string.IsNullOrEmpty(name)) { - Log.Error("[WulaFallenEmpire] Effect_ModifyVariable has a null or empty name."); + WulaLog.Debug("[WulaFallenEmpire] Effect_ModifyVariable has a null or empty name."); return; } @@ -374,7 +374,7 @@ namespace WulaFallenEmpire valueStr = eventVarManager.GetVariable(valueVariableName)?.ToString(); if (valueStr == null) { - Log.Error($"[WulaFallenEmpire] Effect_ModifyVariable: valueVariableName '{valueVariableName}' not found."); + WulaLog.Debug($"[WulaFallenEmpire] Effect_ModifyVariable: valueVariableName '{valueVariableName}' not found."); return; } } @@ -383,7 +383,7 @@ namespace WulaFallenEmpire object variable = eventVarManager.GetVariable(name); if (variable == null) { - Log.Message($"[EventSystem] Effect_ModifyVariable: Variable '{name}' not found, initializing to 0."); + WulaLog.Debug($"[EventSystem] Effect_ModifyVariable: Variable '{name}' not found, initializing to 0."); variable = 0; } @@ -406,12 +406,12 @@ namespace WulaFallenEmpire newValue = Modify(currentVal, modVal, operation); } - Log.Message($"[EventSystem] Modifying variable '{name}'. Operation: {operation}. Value: {valueStr}. From: {originalValue} To: {newValue}"); + WulaLog.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}"); + WulaLog.Debug($"[WulaFallenEmpire] Effect_ModifyVariable: Could not parse or operate on value '{valueStr}' for variable '{name}'. Error: {e.Message}"); } } @@ -424,7 +424,7 @@ namespace WulaFallenEmpire 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."); + WulaLog.Debug($"[WulaFallenEmpire] Effect_ModifyVariable tried to divide by zero."); return current; default: return current; } @@ -439,7 +439,7 @@ namespace WulaFallenEmpire { if (string.IsNullOrEmpty(name)) { - Log.Error("[WulaFallenEmpire] Effect_ClearVariable has a null or empty name."); + WulaLog.Debug("[WulaFallenEmpire] Effect_ClearVariable has a null or empty name."); return; } Find.World.GetComponent().ClearVariable(name); @@ -453,17 +453,17 @@ namespace WulaFallenEmpire { if (quest == null) { - Log.Error("[WulaFallenEmpire] Effect_AddQuest has a null quest Def."); + WulaLog.Debug("[WulaFallenEmpire] Effect_AddQuest has a null quest Def."); return; } - // ʹñ׼ɷǴraw quest + // ʹ�ñ�׼���������ɷ����������Ǵ���raw quest Quest newQuest = QuestUtility.GenerateQuestAndMakeAvailable(quest, 0); if (newQuest != null) { - Log.Message($"[WulaFallenEmpire] Successfully added quest: {quest.defName}"); + WulaLog.Debug($"[WulaFallenEmpire] Successfully added quest: {quest.defName}"); - // Զܵ񣬷Ϳż + // ��������Զ����ܵ����񣬷��Ϳ����ż� if (!newQuest.root.autoAccept) { QuestUtility.SendLetterQuestAvailable(newQuest); @@ -471,7 +471,7 @@ namespace WulaFallenEmpire } else { - Log.Error($"[WulaFallenEmpire] Failed to generate quest: {quest.defName}"); + WulaLog.Debug($"[WulaFallenEmpire] Failed to generate quest: {quest.defName}"); } } } @@ -484,7 +484,7 @@ namespace WulaFallenEmpire { if (research == null) { - Log.Error("[WulaFallenEmpire] Effect_FinishResearch has a null research Def."); + WulaLog.Debug("[WulaFallenEmpire] Effect_FinishResearch has a null research Def."); return; } @@ -507,14 +507,14 @@ namespace WulaFallenEmpire Map map = Find.CurrentMap; if (map == null) { - Log.Error("[WulaFallenEmpire] Effect_TriggerRaid cannot execute without a current map."); + WulaLog.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}'."); + WulaLog.Debug($"[WulaFallenEmpire] Effect_TriggerRaid could not find an active faction for FactionDef '{this.faction?.defName}'."); return; } @@ -531,7 +531,7 @@ namespace WulaFallenEmpire if (!RCellFinder.TryFindRandomPawnEntryCell(out parms.spawnCenter, map, CellFinder.EdgeRoadChance_Hostile)) { - Log.Error("[WulaFallenEmpire] Effect_TriggerRaid could not find a valid spawn center."); + WulaLog.Debug("[WulaFallenEmpire] Effect_TriggerRaid could not find a valid spawn center."); return; } @@ -579,7 +579,7 @@ namespace WulaFallenEmpire { if (factionDef == null || string.IsNullOrEmpty(variableName)) { - Log.Error("[WulaFallenEmpire] Effect_CheckFactionGoodwill is not configured correctly."); + WulaLog.Debug("[WulaFallenEmpire] Effect_CheckFactionGoodwill is not configured correctly."); return; } @@ -589,12 +589,12 @@ namespace WulaFallenEmpire if (faction != null) { int goodwill = faction.GoodwillWith(Faction.OfPlayer); - Log.Message($"[EventSystem] Storing goodwill for faction '{faction.Name}' ({goodwill}) into variable '{variableName}'."); + WulaLog.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}'."); + WulaLog.Debug($"[EventSystem] Effect_CheckFactionGoodwill: Faction '{factionDef.defName}' not found. Storing 0 in variable '{variableName}'."); eventVarManager.SetVariable(variableName, 0); } } @@ -608,13 +608,13 @@ namespace WulaFallenEmpire { if (string.IsNullOrEmpty(variableName)) { - Log.Error("[WulaFallenEmpire] Effect_StoreRealPlayTime is not configured correctly (missing variableName)."); + WulaLog.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}'."); + WulaLog.Debug($"[EventSystem] Storing real play time ({realPlayTime}s) into variable '{variableName}'."); eventVarManager.SetVariable(variableName, realPlayTime); } } @@ -627,13 +627,13 @@ namespace WulaFallenEmpire { if (string.IsNullOrEmpty(variableName)) { - Log.Error("[WulaFallenEmpire] Effect_StoreDaysPassed is not configured correctly (missing variableName)."); + WulaLog.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}'."); + WulaLog.Debug($"[EventSystem] Storing days passed ({daysPassed}) into variable '{variableName}'."); eventVarManager.SetVariable(variableName, daysPassed); } } @@ -646,20 +646,20 @@ namespace WulaFallenEmpire { if (string.IsNullOrEmpty(variableName)) { - Log.Error("[WulaFallenEmpire] Effect_StoreColonyWealth is not configured correctly (missing variableName)."); + WulaLog.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."); + WulaLog.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}'."); + WulaLog.Debug($"[EventSystem] Storing colony wealth ({wealth}) into variable '{variableName}'."); eventVarManager.SetVariable(variableName, wealth); } } diff --git a/Source/WulaFallenEmpire/EventSystem/Effect/Effect_CallSkyfaller.cs b/Source/WulaFallenEmpire/EventSystem/Effect/Effect_CallSkyfaller.cs index d09f35e2..a3ab1ba0 100644 --- a/Source/WulaFallenEmpire/EventSystem/Effect/Effect_CallSkyfaller.cs +++ b/Source/WulaFallenEmpire/EventSystem/Effect/Effect_CallSkyfaller.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Verse; using RimWorld; using UnityEngine; @@ -20,13 +20,13 @@ namespace WulaFallenEmpire Map currentMap = Find.CurrentMap; if (currentMap == null) { - Log.Error("[WulaFallenEmpire] Effect_CallSkyfaller cannot execute without a current map."); + WulaLog.Debug("[WulaFallenEmpire] Effect_CallSkyfaller cannot execute without a current map."); return; } if (skyfallerDef == null) { - Log.Error("[WulaFallenEmpire] Effect_CallSkyfaller has a null skyfallerDef."); + WulaLog.Debug("[WulaFallenEmpire] Effect_CallSkyfaller has a null skyfallerDef."); return; } @@ -43,7 +43,7 @@ namespace WulaFallenEmpire if (!dropCenter.IsValid) { - Log.Error("[WulaFallenEmpire] Effect_CallSkyfaller could not find a valid drop spot."); + WulaLog.Debug("[WulaFallenEmpire] Effect_CallSkyfaller could not find a valid drop spot."); return; } @@ -56,7 +56,7 @@ namespace WulaFallenEmpire Find.LetterStack.ReceiveLetter(letterLabel, letterText, letterDef ?? LetterDefOf.NeutralEvent); } - Log.Message($"[WulaFallenEmpire] Scheduled skyfaller '{skyfallerDef.defName}' at {dropCenter} with {delayTicks} ticks delay"); + WulaLog.Debug($"[WulaFallenEmpire] Scheduled skyfaller '{skyfallerDef.defName}' at {dropCenter} with {delayTicks} ticks delay"); } private IntVec3 FindDropSpotWithClearance(Map map, int radius) diff --git a/Source/WulaFallenEmpire/EventSystem/Effect/Effect_OpenAIConversation.cs b/Source/WulaFallenEmpire/EventSystem/Effect/Effect_OpenAIConversation.cs index 777c0916..c1abbf24 100644 --- a/Source/WulaFallenEmpire/EventSystem/Effect/Effect_OpenAIConversation.cs +++ b/Source/WulaFallenEmpire/EventSystem/Effect/Effect_OpenAIConversation.cs @@ -1,4 +1,4 @@ -using System; +using System; using RimWorld; using Verse; using WulaFallenEmpire.EventSystem.AI; @@ -26,7 +26,7 @@ namespace WulaFallenEmpire } else { - Log.Error($"[WulaFallenEmpire] Effect_OpenAIConversation could not find EventDef named '{defName}'"); + WulaLog.Debug($"[WulaFallenEmpire] Effect_OpenAIConversation could not find EventDef named '{defName}'"); } } } diff --git a/Source/WulaFallenEmpire/EventSystem/Effect/Effect_SetTimedFlag.cs b/Source/WulaFallenEmpire/EventSystem/Effect/Effect_SetTimedFlag.cs index 94bfe80f..f5eadba1 100644 --- a/Source/WulaFallenEmpire/EventSystem/Effect/Effect_SetTimedFlag.cs +++ b/Source/WulaFallenEmpire/EventSystem/Effect/Effect_SetTimedFlag.cs @@ -1,4 +1,4 @@ -// 在 EffectBase.cs 中添加以下类 +// 在 EffectBase.cs 中添加以下类 using Verse; using RimWorld; @@ -13,7 +13,7 @@ namespace WulaFallenEmpire { if (string.IsNullOrEmpty(flagName)) { - Log.Error("[WulaFallenEmpire] Effect_SetTimedFlag has a null or empty flagName."); + WulaLog.Debug("[WulaFallenEmpire] Effect_SetTimedFlag has a null or empty flagName."); return; } @@ -21,7 +21,7 @@ namespace WulaFallenEmpire eventVarManager.SetTimedFlag(flagName, durationTicks); string durationInfo = durationTicks < 0 ? "permanent" : $"{durationTicks} ticks"; - Log.Message($"[EventSystem] Set timed flag '{flagName}' with duration: {durationInfo}"); + WulaLog.Debug($"[EventSystem] Set timed flag '{flagName}' with duration: {durationInfo}"); } } } \ No newline at end of file diff --git a/Source/WulaFallenEmpire/EventSystem/EventVariableManager.cs b/Source/WulaFallenEmpire/EventSystem/EventVariableManager.cs index c64006e7..49fd57b8 100644 --- a/Source/WulaFallenEmpire/EventSystem/EventVariableManager.cs +++ b/Source/WulaFallenEmpire/EventSystem/EventVariableManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Verse; using RimWorld; using RimWorld.Planet; @@ -76,7 +76,7 @@ namespace WulaFallenEmpire if (kvp.Value >= 0 && currentTick >= kvp.Value) { flagsToRemove.Add(kvp.Key); - Log.Message($"[EventSystem] Flag '{kvp.Key}' expired and will be removed."); + WulaLog.Debug($"[EventSystem] Flag '{kvp.Key}' expired and will be removed."); } } @@ -92,7 +92,7 @@ namespace WulaFallenEmpire if (string.IsNullOrEmpty(name)) return; // Log the variable change - Log.Message($"[EventSystem] Setting variable '{name}' to value '{value}' of type {value?.GetType().Name ?? "null"}."); + WulaLog.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); @@ -120,7 +120,7 @@ namespace WulaFallenEmpire 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."); + WulaLog.Debug($"[WulaFallenEmpire] EventVariableManager: Variable '{name}' of type {value.GetType()} was converted to string for storage. This may lead to unexpected behavior."); } } @@ -138,13 +138,13 @@ namespace WulaFallenEmpire { // 负数表示永久flag expiryTick = -1; - Log.Message($"[EventSystem] Setting permanent flag '{flagName}'."); + WulaLog.Debug($"[EventSystem] Setting permanent flag '{flagName}'."); } else { // 正数表示有时间限制的flag expiryTick = Find.TickManager.TicksGame + durationTicks; - Log.Message($"[EventSystem] Setting timed flag '{flagName}' with duration {durationTicks} ticks (expires at tick {expiryTick})."); + WulaLog.Debug($"[EventSystem] Setting timed flag '{flagName}' with duration {durationTicks} ticks (expires at tick {expiryTick})."); } timedFlags[flagName] = expiryTick; @@ -172,7 +172,7 @@ namespace WulaFallenEmpire { // 如果过期了,移除它 timedFlags.Remove(flagName); - Log.Message($"[EventSystem] Flag '{flagName}' has expired and was removed."); + WulaLog.Debug($"[EventSystem] Flag '{flagName}' has expired and was removed."); } return isActive; } @@ -241,7 +241,7 @@ namespace WulaFallenEmpire } catch (System.Exception e) { - Log.Warning($"[WulaFallenEmpire] EventVariableManager: Variable '{name}' of type {value.GetType()} could not be converted to {typeof(T)}. Error: {e.Message}"); + WulaLog.Debug($"[WulaFallenEmpire] EventVariableManager: Variable '{name}' of type {value.GetType()} could not be converted to {typeof(T)}. Error: {e.Message}"); return defaultValue; } } @@ -263,7 +263,7 @@ namespace WulaFallenEmpire { if (HasVariable(name)) { - Log.Message($"[EventSystem] Clearing variable '{name}'."); + WulaLog.Debug($"[EventSystem] Clearing variable '{name}'."); } intVars.Remove(name); floatVars.Remove(name); diff --git a/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_EventLetter.cs b/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_EventLetter.cs index 17a0217d..e1212b59 100644 --- a/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_EventLetter.cs +++ b/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_EventLetter.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using RimWorld.QuestGen; using System; using Verse; @@ -25,7 +25,7 @@ namespace WulaFallenEmpire if (defName.NullOrEmpty()) { - Log.Error("[WulaFallenEmpire] QuestNode_EventLetter: eventDefName is not specified."); + WulaLog.Debug("[WulaFallenEmpire] QuestNode_EventLetter: eventDefName is not specified."); return; } @@ -49,11 +49,11 @@ namespace WulaFallenEmpire { base.Notify_QuestSignalReceived(signal); - Log.Message($"[WulaFallenEmpire] QuestPart_EventLetter received signal: '{signal.tag}', waiting for: '{inSignal}'"); + WulaLog.Debug($"[WulaFallenEmpire] QuestPart_EventLetter received signal: '{signal.tag}', waiting for: '{inSignal}'"); if (signal.tag == inSignal) { - Log.Message($"[WulaFallenEmpire] Signal matched! Opening EventDef: {eventDefName}"); + WulaLog.Debug($"[WulaFallenEmpire] Signal matched! Opening EventDef: {eventDefName}"); OpenEventDefWindow(eventDefName); } } @@ -65,26 +65,26 @@ namespace WulaFallenEmpire EventDef eventDef = DefDatabase.GetNamed(defName, false); if (eventDef == null) { - Log.Error($"[WulaFallenEmpire] EventDef '{defName}' not found in DefDatabase."); + WulaLog.Debug($"[WulaFallenEmpire] EventDef '{defName}' not found in DefDatabase."); return; } if (eventDef.windowType == null) { - Log.Error($"[WulaFallenEmpire] EventDef '{defName}' has null windowType."); + WulaLog.Debug($"[WulaFallenEmpire] EventDef '{defName}' has null windowType."); return; } - Log.Message($"[WulaFallenEmpire] Creating window instance for {defName} with type {eventDef.windowType}"); + WulaLog.Debug($"[WulaFallenEmpire] Creating window instance for {defName} with type {eventDef.windowType}"); Window window = (Window)Activator.CreateInstance(eventDef.windowType, eventDef); - Log.Message($"[WulaFallenEmpire] Adding window to WindowStack"); + WulaLog.Debug($"[WulaFallenEmpire] Adding window to WindowStack"); Find.WindowStack.Add(window); - Log.Message($"[WulaFallenEmpire] Successfully opened EventDef window: {defName}"); + WulaLog.Debug($"[WulaFallenEmpire] Successfully opened EventDef window: {defName}"); } catch (Exception ex) { - Log.Error($"[WulaFallenEmpire] Error opening EventDef window '{defName}': {ex}"); + WulaLog.Debug($"[WulaFallenEmpire] Error opening EventDef window '{defName}': {ex}"); } } diff --git a/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_Root_EventLetter.cs b/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_Root_EventLetter.cs index bfc4e177..dda59237 100644 --- a/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_Root_EventLetter.cs +++ b/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_Root_EventLetter.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using RimWorld.QuestGen; using System; using System.Collections.Generic; @@ -28,7 +28,7 @@ namespace WulaFallenEmpire } else { - Log.Error("[WulaFallenEmpire] QuestNode_Root_EventLetter: eventDefName is not specified."); + WulaLog.Debug("[WulaFallenEmpire] QuestNode_Root_EventLetter: eventDefName is not specified."); } } @@ -38,14 +38,14 @@ namespace WulaFallenEmpire if (defName.NullOrEmpty()) { - Log.Error("[WulaFallenEmpire] QuestNode_Root_EventLetter: eventDefName is not specified."); + WulaLog.Debug("[WulaFallenEmpire] QuestNode_Root_EventLetter: eventDefName is not specified."); return false; } EventDef eventDef = DefDatabase.GetNamed(defName, false); if (eventDef == null) { - Log.Error($"[WulaFallenEmpire] QuestNode_Root_EventLetter: EventDef '{defName}' not found."); + WulaLog.Debug($"[WulaFallenEmpire] QuestNode_Root_EventLetter: EventDef '{defName}' not found."); return false; } @@ -64,7 +64,7 @@ namespace WulaFallenEmpire } else { - Log.Error($"[WulaFallenEmpire] QuestNode_Root_EventLetter: Could not find EventDef '{defName}'"); + WulaLog.Debug($"[WulaFallenEmpire] QuestNode_Root_EventLetter: Could not find EventDef '{defName}'"); } } } diff --git a/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_WriteToEventVariablesWithAdd.cs b/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_WriteToEventVariablesWithAdd.cs index 10a21a9b..e60247aa 100644 --- a/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_WriteToEventVariablesWithAdd.cs +++ b/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_WriteToEventVariablesWithAdd.cs @@ -1,4 +1,4 @@ -using System; +using System; using RimWorld.QuestGen; using Verse; using System.Collections.Generic; @@ -97,7 +97,7 @@ namespace WulaFallenEmpire string targetName = targetVariableName.GetValue(slate); if (string.IsNullOrEmpty(targetName)) { - Log.Error("[QuestNode_WriteToEventVariablesWithAdd] targetVariableName is null or empty!"); + WulaLog.Debug("[QuestNode_WriteToEventVariablesWithAdd] targetVariableName is null or empty!"); return false; } @@ -107,7 +107,7 @@ namespace WulaFallenEmpire { if (logDebug.GetValue(slate)) { - Log.Warning($"[QuestNode_WriteToEventVariablesWithAdd] No value to operate for variable '{targetName}'."); + WulaLog.Debug($"[QuestNode_WriteToEventVariablesWithAdd] No value to operate for variable '{targetName}'."); } return false; } @@ -122,7 +122,7 @@ namespace WulaFallenEmpire var eventVarManager = Find.World.GetComponent(); if (eventVarManager == null) { - Log.Error("[QuestNode_WriteToEventVariablesWithAdd] EventVariableManager not found!"); + WulaLog.Debug("[QuestNode_WriteToEventVariablesWithAdd] EventVariableManager not found!"); return false; } @@ -132,10 +132,10 @@ namespace WulaFallenEmpire // 记录操作前的状态 if (logDebug.GetValue(slate)) { - Log.Message($"[QuestNode_WriteToEventVariablesWithAdd] Operation for variable '{targetName}':"); - Log.Message($" - Mode: {writeMode}"); - Log.Message($" - Current value: {currentValue ?? "[null]"} (Type: {currentValue?.GetType().Name ?? "null"})"); - Log.Message($" - Source value: {sourceValue ?? "[null]"} (Type: {sourceValue?.GetType().Name ?? "null"})"); + WulaLog.Debug($"[QuestNode_WriteToEventVariablesWithAdd] Operation for variable '{targetName}':"); + WulaLog.Debug($" - Mode: {writeMode}"); + WulaLog.Debug($" - Current value: {currentValue ?? "[null]"} (Type: {currentValue?.GetType().Name ?? "null"})"); + WulaLog.Debug($" - Source value: {sourceValue ?? "[null]"} (Type: {sourceValue?.GetType().Name ?? "null"})"); } // 根据写入模式计算新值 @@ -146,7 +146,7 @@ namespace WulaFallenEmpire { if (logDebug.GetValue(slate)) { - Log.Message($" - Operation skipped (new value is null)"); + WulaLog.Debug($" - Operation skipped (new value is null)"); } return false; } @@ -160,7 +160,7 @@ namespace WulaFallenEmpire slate.Remove(sourceVariableName.GetValue(slate)); if (logDebug.GetValue(slate)) { - Log.Message($" - Removed source variable '{sourceVariableName.GetValue(slate)}' from Slate"); + WulaLog.Debug($" - Removed source variable '{sourceVariableName.GetValue(slate)}' from Slate"); } } @@ -171,11 +171,11 @@ namespace WulaFallenEmpire bool writeVerified = (readBackValue == null && newValue == null) || (readBackValue != null && readBackValue.Equals(newValue)); - Log.Message($" - New value written: {newValue} (Type: {newValue.GetType().Name})"); - Log.Message($" - Write verified: {writeVerified}"); + WulaLog.Debug($" - New value written: {newValue} (Type: {newValue.GetType().Name})"); + WulaLog.Debug($" - Write verified: {writeVerified}"); if (!writeVerified) { - Log.Warning($" - Verification failed! Expected: {newValue}, Got: {readBackValue}"); + WulaLog.Debug($" - Verification failed! Expected: {newValue}, Got: {readBackValue}"); } } @@ -235,7 +235,7 @@ namespace WulaFallenEmpire { if (logDebug.GetValue(slate)) { - Log.Message($" - Variable exists and overwrite is false, keeping current value"); + WulaLog.Debug($" - Variable exists and overwrite is false, keeping current value"); } return currentValue; // 不覆盖,返回原值 } @@ -281,7 +281,7 @@ namespace WulaFallenEmpire case MathOperator.Divide: if (source == 0) { - Log.Error($"[QuestNode_WriteToEventVariablesWithAdd] Division by zero for variable operation"); + WulaLog.Debug($"[QuestNode_WriteToEventVariablesWithAdd] Division by zero for variable operation"); return currentValue; } result = current / source; @@ -307,7 +307,7 @@ namespace WulaFallenEmpire { if (logDebug.GetValue(slate)) { - Log.Error($"[QuestNode_WriteToEventVariablesWithAdd] Math operation failed: {ex.Message}"); + WulaLog.Debug($"[QuestNode_WriteToEventVariablesWithAdd] Math operation failed: {ex.Message}"); } return currentValue; } @@ -404,7 +404,7 @@ namespace WulaFallenEmpire { if (logDebug.GetValue(slate)) { - Log.Warning($"[QuestNode_WriteToEventVariablesWithAdd] Cannot increment non-numeric type: {currentValue.GetType().Name}"); + WulaLog.Debug($"[QuestNode_WriteToEventVariablesWithAdd] Cannot increment non-numeric type: {currentValue.GetType().Name}"); } return currentValue; } @@ -427,7 +427,7 @@ namespace WulaFallenEmpire { if (logDebug.GetValue(slate)) { - Log.Error($"[QuestNode_WriteToEventVariablesWithAdd] Increment operation failed: {ex.Message}"); + WulaLog.Debug($"[QuestNode_WriteToEventVariablesWithAdd] Increment operation failed: {ex.Message}"); } return currentValue; } @@ -437,7 +437,7 @@ namespace WulaFallenEmpire { if (logDebug.GetValue(slate)) { - Log.Warning($"[QuestNode_WriteToEventVariablesWithAdd] Type mismatch for operation: {mismatchReason}"); + WulaLog.Debug($"[QuestNode_WriteToEventVariablesWithAdd] Type mismatch for operation: {mismatchReason}"); } switch (onTypeMismatch) @@ -448,7 +448,7 @@ namespace WulaFallenEmpire case TypeMismatchBehavior.Skip: if (logDebug.GetValue(slate)) { - Log.Message($" - Skipping operation due to type mismatch"); + WulaLog.Debug($" - Skipping operation due to type mismatch"); } return currentValue; // 保持原值 diff --git a/Source/WulaFallenEmpire/Flyover/WULA_AircraftHangar/CompAbilityEffect_AircraftStrike.cs b/Source/WulaFallenEmpire/Flyover/WULA_AircraftHangar/CompAbilityEffect_AircraftStrike.cs index 3d82e907..64aa08a5 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_AircraftHangar/CompAbilityEffect_AircraftStrike.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_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 WulaFallenEmpire if (aircraftManager == null) { - Log.Error("WULA_AircraftManagerNotFound".Translate()); + WulaLog.Debug("WULA_AircraftManagerNotFound".Translate()); return; } @@ -40,12 +40,12 @@ namespace WulaFallenEmpire { // 成功消耗战机,发送消息 Messages.Message("WULA_AircraftStrikeInitiated".Translate(Props.requiredAircraftType.LabelCap), MessageTypeDefOf.PositiveEvent); - Log.Message("WULA_AircraftStrikeSuccess".Translate(Props.aircraftsPerUse, Props.requiredAircraftType.LabelCap)); + WulaLog.Debug("WULA_AircraftStrikeSuccess".Translate(Props.aircraftsPerUse, Props.requiredAircraftType.LabelCap)); } else { Messages.Message("WULA_NoAvailableAircraft".Translate(Props.requiredAircraftType.LabelCap), MessageTypeDefOf.NegativeEvent); - Log.Warning("WULA_AircraftStrikeFailed".Translate(Props.requiredAircraftType.LabelCap, parent.pawn.Faction?.Name ?? "WULA_UnknownFaction".Translate())); + WulaLog.Debug("WULA_AircraftStrikeFailed".Translate(Props.requiredAircraftType.LabelCap, parent.pawn.Faction?.Name ?? "WULA_UnknownFaction".Translate())); } } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_AircraftHangar/CompAircraftHangar.cs b/Source/WulaFallenEmpire/Flyover/WULA_AircraftHangar/CompAircraftHangar.cs index aa04c07d..60a3abea 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_AircraftHangar/CompAircraftHangar.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_AircraftHangar/CompAircraftHangar.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using RimWorld.Planet; @@ -163,7 +163,7 @@ namespace WulaFallenEmpire if (aircraftManager == null) { - Log.Error("AircraftManagerNotFound".Translate()); + WulaLog.Debug("AircraftManagerNotFound".Translate()); return; } @@ -205,21 +205,21 @@ namespace WulaFallenEmpire // 检查地图是否有效 if (parent.Map == null) { - Log.Error("TakeoffEffectMapNull".Translate()); + WulaLog.Debug("TakeoffEffectMapNull".Translate()); return; } // 生成 Skyfaller GenSpawn.Spawn(skyfaller, takeoffPos, parent.Map); - Log.Message("TakeoffSkyfallerCreated".Translate(takeoffPos)); + WulaLog.Debug("TakeoffSkyfallerCreated".Translate(takeoffPos)); // 销毁原建筑 parent.Destroy(DestroyMode.Vanish); } catch (System.Exception ex) { - Log.Error("TakeoffEffectError".Translate(ex.Message)); + WulaLog.Debug("TakeoffEffectError".Translate(ex.Message)); // 如果Skyfaller创建失败,直接销毁建筑 parent.Destroy(DestroyMode.Vanish); } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_AircraftHangar/WorldComponent_AircraftManager.cs b/Source/WulaFallenEmpire/Flyover/WULA_AircraftHangar/WorldComponent_AircraftManager.cs index 9f66bc26..18b151f8 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_AircraftHangar/WorldComponent_AircraftManager.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_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 WulaFallenEmpire // 调试日志 if (Scribe.mode == LoadSaveMode.Saving) { - Log.Message($"Saving aircraft data: {allFactionAircraftData.Count} faction entries, {cooldownEvents.Count} cooldown events"); + WulaLog.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"); + WulaLog.Debug($"Loaded aircraft data: {allFactionAircraftData.Count} faction entries, {cooldownEvents.Count} cooldown events"); } } @@ -120,7 +120,7 @@ namespace WulaFallenEmpire { if (faction == null) { - Log.Error("AddAircraftNullFaction".Translate()); + WulaLog.Debug("AddAircraftNullFaction".Translate()); return; } @@ -128,7 +128,7 @@ namespace WulaFallenEmpire data.totalCount += count; data.availableCount += count; - Log.Message($"Added {count} {aircraftDef.LabelCap} to {faction.Name}. Total: {data.totalCount}, Available: {data.availableCount}"); + WulaLog.Debug($"Added {count} {aircraftDef.LabelCap} to {faction.Name}. Total: {data.totalCount}, Available: {data.availableCount}"); } // 尝试使用战机 @@ -150,7 +150,7 @@ namespace WulaFallenEmpire cooldownEvents.Add(cooldownEvent); - Log.Message($"Used {count} {aircraftDef.LabelCap} from {faction.Name}. Available now: {data.availableCount}, Cooldown until: {cooldownEvent.endTick}"); + WulaLog.Debug($"Used {count} {aircraftDef.LabelCap} from {faction.Name}. Available now: {data.availableCount}, Cooldown until: {cooldownEvent.endTick}"); return true; } @@ -187,7 +187,7 @@ namespace WulaFallenEmpire 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}"); + WulaLog.Debug($"Cooldown ended for {cooldownEvent.aircraftCount} {cooldownEvent.aircraftDef.LabelCap}. Available now: {data.availableCount}"); } } } @@ -203,22 +203,22 @@ namespace WulaFallenEmpire // 调试方法:显示当前状态 public void DebugLogStatus() { - Log.Message("=== Aircraft Manager Status ==="); - Log.Message($"Total faction entries: {allFactionAircraftData.Count}"); + WulaLog.Debug("=== Aircraft Manager Status ==="); + WulaLog.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"}"); + WulaLog.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"); + WulaLog.Debug($" {data.aircraftDef.LabelCap}: {data.availableCount}/{data.totalCount} available"); } } - Log.Message($"Active cooldown events: {cooldownEvents.Count}"); - Log.Message("==============================="); + WulaLog.Debug($"Active cooldown events: {cooldownEvents.Count}"); + WulaLog.Debug("==============================="); } } } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_BlockedByFlyOverFacility/CompAbilityEffect_BlockedByFlyOverFacility.cs b/Source/WulaFallenEmpire/Flyover/WULA_BlockedByFlyOverFacility/CompAbilityEffect_BlockedByFlyOverFacility.cs index 7a66d458..bf9e7827 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_BlockedByFlyOverFacility/CompAbilityEffect_BlockedByFlyOverFacility.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_BlockedByFlyOverFacility/CompAbilityEffect_BlockedByFlyOverFacility.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; @@ -73,7 +73,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[BlockedByFlyOverFacility] Error in ExtraLabelMouseAttachment: {ex}"); + WulaLog.Debug($"[BlockedByFlyOverFacility] Error in ExtraLabelMouseAttachment: {ex}"); return "航道状态检查错误"; } } @@ -119,13 +119,13 @@ namespace WulaFallenEmpire } } - Log.Message($"[BlockedByFlyOverFacility] Found {flyOversWithFacilities.Count} FlyOvers with facilities"); + WulaLog.Debug($"[BlockedByFlyOverFacility] Found {flyOversWithFacilities.Count} FlyOvers with facilities"); return flyOversWithFacilities; } catch (System.Exception ex) { - Log.Error($"[BlockedByFlyOverFacility] Error in GetFlyOversWithFacilities: {ex}"); + WulaLog.Debug($"[BlockedByFlyOverFacility] Error in GetFlyOversWithFacilities: {ex}"); return new List(); } } @@ -136,7 +136,7 @@ namespace WulaFallenEmpire // 在应用前再次检查,确保安全 if (HasFlyOverWithFacilities()) { - Log.Warning($"[BlockedByFlyOverFacility] Attempted to use ability while FlyOvers are present"); + WulaLog.Debug($"[BlockedByFlyOverFacility] Attempted to use ability while FlyOvers are present"); Messages.Message(Props.blockedMessage, parent.pawn, MessageTypeDefOf.RejectInput); return; } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_DestroyFlyOverByFacilities/CompProperties_DestroyFlyOverByFacilities.cs b/Source/WulaFallenEmpire/Flyover/WULA_DestroyFlyOverByFacilities/CompProperties_DestroyFlyOverByFacilities.cs index 745a8c87..f1926743 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_DestroyFlyOverByFacilities/CompProperties_DestroyFlyOverByFacilities.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_DestroyFlyOverByFacilities/CompProperties_DestroyFlyOverByFacilities.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using Verse; @@ -51,7 +51,7 @@ namespace WulaFallenEmpire foreach (FlyOver flyOver in flyOversWithFacilities) { flyOver.EmergencyDestroy(); - Log.Message($"[DestroyFlyOverByFacilities] Destroyed FlyOver with facilities at {flyOver.Position}"); + WulaLog.Debug($"[DestroyFlyOverByFacilities] Destroyed FlyOver with facilities at {flyOver.Position}"); } if (flyOversWithFacilities.Count > 0) @@ -126,7 +126,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[DestroyFlyOverByFacilities] Error in ExtraLabelMouseAttachment: {ex}"); + WulaLog.Debug($"[DestroyFlyOverByFacilities] Error in ExtraLabelMouseAttachment: {ex}"); return "Error checking FlyOver status"; } } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_FlyOverDropPod/CompProperties_FlyOverDropPod.cs b/Source/WulaFallenEmpire/Flyover/WULA_FlyOverDropPod/CompProperties_FlyOverDropPod.cs index 7e50c8b9..4be42d1f 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_FlyOverDropPod/CompProperties_FlyOverDropPod.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_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 WulaFallenEmpire if (Props.useCyclicDrops) { ticksUntilNextDrop = (int)(Props.cyclicDropIntervalHours * 2500f); // 1小时 = 2500 ticks - Log.Message($"Cyclic drops initialized: {Props.cyclicDropIntervalHours} hours interval"); + WulaLog.Debug($"Cyclic drops initialized: {Props.cyclicDropIntervalHours} hours interval"); } // 初始化信号等待状态 if (Props.waitForExternalSignal) { waitingForSignal = true; - Log.Message($"Waiting for external signal: {Props.externalSignalTag}"); + WulaLog.Debug($"Waiting for external signal: {Props.externalSignalTag}"); } } @@ -151,7 +151,7 @@ namespace WulaFallenEmpire if (pawn != null) { pawns.Add(pawn); - Log.Message($"Generated pawn: {pawn.Label} ({pawnKindCount.pawnKindDef.defName})"); + WulaLog.Debug($"Generated pawn: {pawn.Label} ({pawnKindCount.pawnKindDef.defName})"); } } } @@ -162,7 +162,7 @@ namespace WulaFallenEmpire { if (pawnKindDef == null) { - Log.Error("Attempted to generate pawn with null PawnKindDef"); + WulaLog.Debug("Attempted to generate pawn with null PawnKindDef"); return null; } @@ -213,12 +213,12 @@ namespace WulaFallenEmpire pawn.mindState.SetupLastHumanMeatTick(); } - Log.Message($"Successfully generated pawn: {pawn.LabelCap} from {pawnKindDef.defName}"); + WulaLog.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}"); + WulaLog.Debug($"Failed to generate pawn from {pawnKindDef.defName}: {ex}"); return null; } } @@ -282,7 +282,7 @@ namespace WulaFallenEmpire // 重置计时器 ticksUntilNextDrop = (int)(Props.cyclicDropIntervalHours * 2500f); - Log.Message($"Cyclic drop completed, next drop in {Props.cyclicDropIntervalHours} hours"); + WulaLog.Debug($"Cyclic drop completed, next drop in {Props.cyclicDropIntervalHours} hours"); } } @@ -291,7 +291,7 @@ namespace WulaFallenEmpire { if (parent is FlyOver flyOver && waitingForSignal) { - Log.Message($"External signal received, triggering drop pods"); + WulaLog.Debug($"External signal received, triggering drop pods"); DropPods(flyOver); waitingForSignal = false; } @@ -313,12 +313,12 @@ namespace WulaFallenEmpire Map map = flyOver.Map; if (map == null) { - Log.Error("FlyOver DropPods: Map is null"); + WulaLog.Debug("FlyOver DropPods: Map is null"); return; } IntVec3 dropCenter = GetDropCenter(flyOver); - Log.Message($"DropPods triggered at progress {flyOver.currentProgress}, center: {dropCenter}"); + WulaLog.Debug($"DropPods triggered at progress {flyOver.currentProgress}, center: {dropCenter}"); // 如果在投掷时生成 Pawn,现在生成 if (Props.generatePawnsOnDrop && Props.pawnKinds != null) @@ -351,7 +351,7 @@ namespace WulaFallenEmpire if (!thingsToDrop.Any()) { - Log.Warning("No items to drop from FlyOver drop pods"); + WulaLog.Debug("No items to drop from FlyOver drop pods"); return; } @@ -377,7 +377,7 @@ namespace WulaFallenEmpire SendDropLetter(thingsToDrop, dropCenter, map); } - Log.Message($"Drop pods completed: {thingsToDrop.Count} items dropped, including {pawns.Count} pawns"); + WulaLog.Debug($"Drop pods completed: {thingsToDrop.Count} items dropped, including {pawns.Count} pawns"); // 清空已投掷的物品列表,避免重复投掷 items.Clear(); @@ -464,7 +464,7 @@ namespace WulaFallenEmpire // 创建 Lord Lord lord = LordMaker.MakeNewLord(faction, lordJob, Find.CurrentMap, factionPawns); - Log.Message($"Assigned assault lord job to {factionPawns.Count} pawns of faction {faction.Name}"); + WulaLog.Debug($"Assigned assault lord job to {factionPawns.Count} pawns of faction {faction.Name}"); } } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_FlyOverEscort/CompFlyOverEscort.cs b/Source/WulaFallenEmpire/Flyover/WULA_FlyOverEscort/CompFlyOverEscort.cs index 81e9a1bf..08bdd916 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_FlyOverEscort/CompFlyOverEscort.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_FlyOverEscort/CompFlyOverEscort.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using UnityEngine; using Verse; @@ -147,7 +147,7 @@ namespace WulaFallenEmpire if (successfulSpawns < escortsToSpawn) { - Log.Message($"Spawned {successfulSpawns}/{escortsToSpawn} escorts (some positions were too close to existing escorts)"); + WulaLog.Debug($"Spawned {successfulSpawns}/{escortsToSpawn} escorts (some positions were too close to existing escorts)"); } } @@ -210,7 +210,7 @@ namespace WulaFallenEmpire ThingDef escortDef = SelectEscortDef(); if (escortDef == null) { - Log.Error("FlyOver Escort: No valid escort def found"); + WulaLog.Debug("FlyOver Escort: No valid escort def found"); return null; } @@ -220,7 +220,7 @@ namespace WulaFallenEmpire if (!escortStart.InBounds(mainFlyOver.Map) || !escortEnd.InBounds(mainFlyOver.Map)) { - Log.Warning("FlyOver Escort: Escort start or end position out of bounds"); + WulaLog.Debug("FlyOver Escort: Escort start or end position out of bounds"); return null; } @@ -247,7 +247,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"Error creating FlyOver escort: {ex}"); + WulaLog.Debug($"Error creating FlyOver escort: {ex}"); return null; } } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompAbilityEffect_RequireFlyOverFacility.cs b/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompAbilityEffect_RequireFlyOverFacility.cs index 295040ee..a0866b77 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompAbilityEffect_RequireFlyOverFacility.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompAbilityEffect_RequireFlyOverFacility.cs @@ -1,4 +1,4 @@ -// CompAbilityEffect_RequireFlyOverFacility.cs +// CompAbilityEffect_RequireFlyOverFacility.cs using System.Collections.Generic; using System.Linq; using RimWorld; @@ -22,7 +22,7 @@ namespace WulaFallenEmpire if (availableFlyOvers.Count == 0) { - Log.Error($"[RequireFlyOverFacility] No valid FlyOver found with required facility: {Props.requiredFacility}"); + WulaLog.Debug($"[RequireFlyOverFacility] No valid FlyOver found with required facility: {Props.requiredFacility}"); return; } @@ -62,7 +62,7 @@ namespace WulaFallenEmpire catch (System.Exception ex) { // 捕获异常,避免UI崩溃 - Log.Error($"[RequireFlyOverFacility] Error in ExtraLabelMouseAttachment: {ex}"); + WulaLog.Debug($"[RequireFlyOverFacility] Error in ExtraLabelMouseAttachment: {ex}"); return "设施检查错误"; } } @@ -123,7 +123,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[RequireFlyOverFacility] Error in GetValidFlyOvers: {ex}"); + WulaLog.Debug($"[RequireFlyOverFacility] Error in GetValidFlyOvers: {ex}"); return new List(); } } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompFlyOverFacilities.cs b/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompFlyOverFacilities.cs index ec956333..c46bf4a9 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompFlyOverFacilities.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_FlyOverFacilities/CompFlyOverFacilities.cs @@ -1,4 +1,4 @@ -// CompFlyOverFacilities.cs +// CompFlyOverFacilities.cs using System.Collections.Generic; using RimWorld; using Verse; @@ -41,7 +41,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[FlyOverFacilities] Error in AnyFlyOverHasFacilities: {ex}"); + WulaLog.Debug($"[FlyOverFacilities] Error in AnyFlyOverHasFacilities: {ex}"); return false; } } @@ -71,7 +71,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[FlyOverFacilities] Error in GetAllFlyOversWithFacilities: {ex}"); + WulaLog.Debug($"[FlyOverFacilities] Error in GetAllFlyOversWithFacilities: {ex}"); return result; } } @@ -100,7 +100,7 @@ namespace WulaFallenEmpire { // 只在初次生成时激活所有定义的设施 activeFacilities.AddRange(Props.availableFacilities); - Log.Message($"[FlyOverFacilities] Initialized with {activeFacilities.Count} facilities: {string.Join(", ", activeFacilities)}"); + WulaLog.Debug($"[FlyOverFacilities] Initialized with {activeFacilities.Count} facilities: {string.Join(", ", activeFacilities)}"); } } @@ -127,7 +127,7 @@ namespace WulaFallenEmpire activeFacilities = new List(); // 在加载后重新添加默认设施 activeFacilities.AddRange(Props.availableFacilities); - Log.Message($"[FlyOverFacilities] Reinitialized after load with {activeFacilities.Count} facilities"); + WulaLog.Debug($"[FlyOverFacilities] Reinitialized after load with {activeFacilities.Count} facilities"); } } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_GlobalFlyOverCooldown/CompAbilityEffect_GlobalFlyOverCooldown.cs b/Source/WulaFallenEmpire/Flyover/WULA_GlobalFlyOverCooldown/CompAbilityEffect_GlobalFlyOverCooldown.cs index 1ef6a3fa..78f0b41f 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_GlobalFlyOverCooldown/CompAbilityEffect_GlobalFlyOverCooldown.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_GlobalFlyOverCooldown/CompAbilityEffect_GlobalFlyOverCooldown.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using System.Linq; @@ -21,7 +21,7 @@ namespace WulaFallenEmpire if (availableFlyOvers.Count == 0) { - Log.Error($"[GlobalFlyOverCooldown] No available FlyOver with BombardmentFacility found"); + WulaLog.Debug($"[GlobalFlyOverCooldown] No available FlyOver with BombardmentFacility found"); return; } @@ -31,14 +31,14 @@ namespace WulaFallenEmpire if (facilitiesComp == null) { - Log.Error($"[GlobalFlyOverCooldown] Selected FlyOver has no CompFlyOverFacilities"); + WulaLog.Debug($"[GlobalFlyOverCooldown] Selected FlyOver has no CompFlyOverFacilities"); return; } // 设置冷却时间 SetCooldown(selectedFlyOver, Props.globalCooldownTicks); - Log.Message($"[GlobalFlyOverCooldown] Set cooldown on FlyOver at {selectedFlyOver.Position} for {Props.globalCooldownTicks} ticks"); + WulaLog.Debug($"[GlobalFlyOverCooldown] Set cooldown on FlyOver at {selectedFlyOver.Position} for {Props.globalCooldownTicks} ticks"); } public override bool GizmoDisabled(out string reason) @@ -73,7 +73,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[GlobalFlyOverCooldown] Error in ExtraLabelMouseAttachment: {ex}"); + WulaLog.Debug($"[GlobalFlyOverCooldown] Error in ExtraLabelMouseAttachment: {ex}"); return "WULA_GlobalFlyOverCooldown.FacilityStatusError".Translate(); } } @@ -144,7 +144,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[GlobalFlyOverCooldown] Error in GetAvailableFlyOvers: {ex}"); + WulaLog.Debug($"[GlobalFlyOverCooldown] Error in GetAvailableFlyOvers: {ex}"); return new List(); } } @@ -188,7 +188,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[GlobalFlyOverCooldown] Error in GetTotalFlyOvers: {ex}"); + WulaLog.Debug($"[GlobalFlyOverCooldown] Error in GetTotalFlyOvers: {ex}"); return new List(); } } @@ -214,7 +214,7 @@ namespace WulaFallenEmpire var cooldownComp = flyOver.GetComp(); if (cooldownComp == null) { - Log.Error($"[GlobalFlyOverCooldown] FlyOver at {flyOver.Position} has no CompFlyOverCooldown"); + WulaLog.Debug($"[GlobalFlyOverCooldown] FlyOver at {flyOver.Position} has no CompFlyOverCooldown"); return; } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_GlobalFlyOverCooldown/CompFlyOverCooldown.cs b/Source/WulaFallenEmpire/Flyover/WULA_GlobalFlyOverCooldown/CompFlyOverCooldown.cs index 4f9a0b80..950a0d86 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_GlobalFlyOverCooldown/CompFlyOverCooldown.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_GlobalFlyOverCooldown/CompFlyOverCooldown.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; namespace WulaFallenEmpire @@ -39,7 +39,7 @@ namespace WulaFallenEmpire int actualCooldown = cooldownTicks > 0 ? cooldownTicks : Props.baseCooldownTicks; cooldownEndTick = Find.TickManager.TicksGame + actualCooldown; - Log.Message($"[FlyOverCooldown] Cooldown started for {actualCooldown} ticks, ends at tick {cooldownEndTick}"); + WulaLog.Debug($"[FlyOverCooldown] Cooldown started for {actualCooldown} ticks, ends at tick {cooldownEndTick}"); } // 强制结束冷却 diff --git a/Source/WulaFallenEmpire/Flyover/WULA_GroundStrafing/CompGroundStrafing.cs b/Source/WulaFallenEmpire/Flyover/WULA_GroundStrafing/CompGroundStrafing.cs index c20bcc60..014379a9 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_GroundStrafing/CompGroundStrafing.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_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 WulaFallenEmpire currentLongitudinalOffset = Props.longitudinalInitialOffset; } - Log.Message($"GroundStrafing: Initialized with {confirmedTargetCells.Count} targets, " + + WulaLog.Debug($"GroundStrafing: Initialized with {confirmedTargetCells.Count} targets, " + $"Lateral Offset: {currentLateralOffsetAngle:F1}°, " + $"Longitudinal Offset: {currentLongitudinalOffset:F1}"); } @@ -52,7 +52,7 @@ namespace WulaFallenEmpire // 定期状态输出 if (Find.TickManager.TicksGame % 120 == 0 && confirmedTargetCells.Count > 0) { - Log.Message($"GroundStrafing: {firedCells.Count}/{confirmedTargetCells.Count + firedCells.Count} targets fired, " + + WulaLog.Debug($"GroundStrafing: {firedCells.Count}/{confirmedTargetCells.Count + firedCells.Count} targets fired, " + $"Lateral: {currentLateralOffsetAngle:F1}°, Longitudinal: {currentLongitudinalOffset:F1}"); } } @@ -84,7 +84,7 @@ namespace WulaFallenEmpire if (firedCells.Count == 1) { - Log.Message($"First strafing shot at {targetCell}, " + + WulaLog.Debug($"First strafing shot at {targetCell}, " + $"Lateral offset: {currentLateralOffsetAngle:F1}°, " + $"Longitudinal offset: {currentLongitudinalOffset:F1}"); } @@ -235,7 +235,7 @@ namespace WulaFallenEmpire { if (Props.projectileDef == null) { - Log.Error("No projectile defined for ground strafing"); + WulaLog.Debug("No projectile defined for ground strafing"); return false; } @@ -279,7 +279,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"Error launching ground strafing projectile: {ex}"); + WulaLog.Debug($"Error launching ground strafing projectile: {ex}"); } return false; @@ -320,13 +320,13 @@ namespace WulaFallenEmpire confirmedTargetCells.AddRange(targets); - Log.Message($"GroundStrafing: Set {confirmedTargetCells.Count} targets, " + + WulaLog.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]}"); + WulaLog.Debug($"First target: {confirmedTargetCells[0]}, Last target: {confirmedTargetCells[confirmedTargetCells.Count - 1]}"); } } @@ -345,10 +345,10 @@ namespace WulaFallenEmpire // 修改:调试方法 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}"); + WulaLog.Debug($"GroundStrafing Offset Status:"); + WulaLog.Debug($" Lateral - Angle: {currentLateralOffsetAngle:F1}°, Mode: {Props.lateralOffsetMode}"); + WulaLog.Debug($" Longitudinal - Offset: {currentLongitudinalOffset:F1}, Mode: {Props.longitudinalOffsetMode}"); + WulaLog.Debug($" Shots Fired: {shotsFired}, Forward Phase: {isForwardPhase}"); } } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_SectorSurveillance/CompSectorSurveillance.cs b/Source/WulaFallenEmpire/Flyover/WULA_SectorSurveillance/CompSectorSurveillance.cs index 76322c75..758a500e 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_SectorSurveillance/CompSectorSurveillance.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_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 WulaFallenEmpire 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}"); + WulaLog.Debug($"SectorSurveillance: Initialized - Angle: {Props.sectorAngle}°, Range: {Props.sectorRange}, Shots: {Props.shotCount}, Interval: {Props.shotInterval}s"); + WulaLog.Debug($"SectorSurveillance: ProjectileDef = {Props.projectileDef?.defName ?? "NULL"}"); + WulaLog.Debug($"SectorSurveillance: Parent = {parent?.def?.defName ?? "NULL"} at {parent?.Position.ToString() ?? "NULL"}"); + WulaLog.Debug($"SectorSurveillance: Max Projectiles = {Props.maxProjectiles}, Remaining = {remainingProjectiles}"); + WulaLog.Debug($"SectorSurveillance: Lateral Mode: {Props.lateralOffsetMode}, Longitudinal Mode: {Props.longitudinalOffsetMode}"); InitializeFactionCache(); } private void InitializeFactionCache() { - Log.Message($"SectorSurveillance: Initializing faction cache..."); + WulaLog.Debug($"SectorSurveillance: Initializing faction cache..."); if (parent.Faction != null) { cachedFaction = parent.Faction; - Log.Message($"SectorSurveillance: Using parent.Faction: {cachedFaction?.Name ?? "NULL"}"); + WulaLog.Debug($"SectorSurveillance: Using parent.Faction: {cachedFaction?.Name ?? "NULL"}"); } else { @@ -76,21 +76,21 @@ namespace WulaFallenEmpire if (flyOver?.caster != null && flyOver.caster.Faction != null) { cachedFaction = flyOver.caster.Faction; - Log.Message($"SectorSurveillance: Using caster.Faction: {cachedFaction?.Name ?? "NULL"}"); + WulaLog.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"}"); + WulaLog.Debug($"SectorSurveillance: Using flyOver.faction: {cachedFaction?.Name ?? "NULL"}"); } else { - Log.Error($"SectorSurveillance: CRITICAL - No faction found!"); + WulaLog.Debug($"SectorSurveillance: CRITICAL - No faction found!"); } } factionInitialized = true; - Log.Message($"SectorSurveillance: Faction cache initialized: {cachedFaction?.Name ?? "NULL"}"); + WulaLog.Debug($"SectorSurveillance: Faction cache initialized: {cachedFaction?.Name ?? "NULL"}"); } private Faction GetEffectiveFaction() @@ -102,7 +102,7 @@ namespace WulaFallenEmpire if (cachedFaction == null) { - Log.Warning("SectorSurveillance: Cached faction is null, reinitializing..."); + WulaLog.Debug("SectorSurveillance: Cached faction is null, reinitializing..."); InitializeFactionCache(); } @@ -118,8 +118,8 @@ namespace WulaFallenEmpire 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}"); + WulaLog.Debug($"SectorSurveillance Status: Frames={totalFramesProcessed}, TargetsFound={totalTargetsFound}, ShotsFired={totalShotsFired}, ActiveTargets={activeTargets.Count}, Cooldowns={shotCooldowns.Count}, Faction={currentFaction?.Name ?? "NULL"}, RemainingProjectiles={remainingProjectiles}, AmmoExhausted={ammoExhausted}"); + WulaLog.Debug($"SectorSurveillance Offsets: Lateral={currentLateralOffsetAngle:F1}°, Longitudinal={currentLongitudinalOffset:F1}, TotalShots={shotsFired}"); } UpdateShotCooldowns(); @@ -165,7 +165,7 @@ namespace WulaFallenEmpire foreach (Pawn pawn in toRemove) { shotCooldowns.Remove(pawn); - Log.Message($"SectorSurveillance: Cooldown finished for {pawn?.Label ?? "NULL"}"); + WulaLog.Debug($"SectorSurveillance: Cooldown finished for {pawn?.Label ?? "NULL"}"); } } @@ -178,11 +178,11 @@ namespace WulaFallenEmpire } List enemiesInSector = GetEnemiesInSector(); - Log.Message($"SectorSurveillance: Found {enemiesInSector.Count} enemies in sector"); + WulaLog.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))}"); + WulaLog.Debug($"SectorSurveillance: Enemies in sector: {string.Join(", ", enemiesInSector.ConvertAll(p => p.Label))}"); } foreach (Pawn enemy in enemiesInSector) @@ -194,7 +194,7 @@ namespace WulaFallenEmpire !shotCooldowns.ContainsKey(enemy)) { activeTargets[enemy] = Props.shotCount; - Log.Message($"SectorSurveillance: Starting attack sequence on {enemy.Label} at {enemy.Position} - {Props.shotCount} shots"); + WulaLog.Debug($"SectorSurveillance: Starting attack sequence on {enemy.Label} at {enemy.Position} - {Props.shotCount} shots"); } } } @@ -231,26 +231,26 @@ namespace WulaFallenEmpire if (!IsInSector(enemy.Position)) { - Log.Message($"SectorSurveillance: Target {enemy.Label} left sector, cancelling attack"); + WulaLog.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"); + WulaLog.Debug($"SectorSurveillance: Target {enemy.Label} in cooldown, skipping this frame"); continue; } // 检查剩余射弹数量 if (remainingProjectiles == 0) { - Log.Message($"SectorSurveillance: Ammo exhausted, cannot fire at {enemy.Label}"); + WulaLog.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}"); + WulaLog.Debug($"SectorSurveillance: Attempting to fire at {enemy.Label}, remaining shots: {remainingShots}, remaining projectiles: {remainingProjectiles}"); if (LaunchProjectileAt(enemy)) { totalShotsFired++; @@ -261,13 +261,13 @@ namespace WulaFallenEmpire if (remainingProjectiles > 0) { remainingProjectiles--; - Log.Message($"SectorSurveillance: Remaining projectiles: {remainingProjectiles}"); + WulaLog.Debug($"SectorSurveillance: Remaining projectiles: {remainingProjectiles}"); // 检查是否耗尽弹药 if (remainingProjectiles == 0) { ammoExhausted = true; - Log.Message($"SectorSurveillance: AMMO EXHAUSTED - No more projectiles available"); + WulaLog.Debug($"SectorSurveillance: AMMO EXHAUSTED - No more projectiles available"); } } @@ -277,18 +277,18 @@ namespace WulaFallenEmpire int cooldownTicks = Mathf.RoundToInt(Props.shotInterval * 60f); shotCooldowns[enemy] = cooldownTicks; - Log.Message($"SectorSurveillance: Successfully fired at {enemy.Label}, {remainingShots} shots remaining, cooldown: {cooldownTicks} ticks"); + WulaLog.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}"); + WulaLog.Debug($"SectorSurveillance: Completed attack sequence on {enemy.Label}"); } } else { - Log.Error($"SectorSurveillance: Failed to fire projectile at {enemy.Label}"); + WulaLog.Debug($"SectorSurveillance: Failed to fire projectile at {enemy.Label}"); } } @@ -299,13 +299,13 @@ namespace WulaFallenEmpire if (enemy != null) { activeTargets.Remove(enemy); - Log.Message($"SectorSurveillance: Removed {enemy.Label} from active targets"); + WulaLog.Debug($"SectorSurveillance: Removed {enemy.Label} from active targets"); } else { // 如果目标已不存在,直接从字典中移除对应的键 activeTargets.Remove(enemy); - Log.Message($"SectorSurveillance: Removed null target from active targets"); + WulaLog.Debug($"SectorSurveillance: Removed null target from active targets"); } } } @@ -448,14 +448,14 @@ namespace WulaFallenEmpire if (map == null) { - Log.Error("SectorSurveillance: Map is null!"); + WulaLog.Debug("SectorSurveillance: Map is null!"); return enemies; } FlyOver flyOver = parent as FlyOver; if (flyOver == null) { - Log.Error("SectorSurveillance: Parent is not a FlyOver!"); + WulaLog.Debug("SectorSurveillance: Parent is not a FlyOver!"); return enemies; } @@ -464,7 +464,7 @@ namespace WulaFallenEmpire float range = Props.sectorRange; float halfAngle = Props.sectorAngle * 0.5f; - Log.Message($"SectorSurveillance: Checking sector - Center: {center}, Direction: {flightDirection}, Range: {range}, HalfAngle: {halfAngle}"); + WulaLog.Debug($"SectorSurveillance: Checking sector - Center: {center}, Direction: {flightDirection}, Range: {range}, HalfAngle: {halfAngle}"); int totalEnemiesChecked = 0; @@ -480,12 +480,12 @@ namespace WulaFallenEmpire if (inSector) { enemies.Add(pawn); - Log.Message($"SectorSurveillance: Valid target found - {pawn.Label} at {pawn.Position}, in sector: {inSector}"); + WulaLog.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"); + WulaLog.Debug($"SectorSurveillance: Checked {totalEnemiesChecked} pawns, found {enemies.Count} valid targets in sector"); return enemies; } @@ -493,32 +493,32 @@ namespace WulaFallenEmpire { if (pawn == null) { - Log.Message("SectorSurveillance: IsValidTarget - pawn is null"); + WulaLog.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"); + WulaLog.Debug($"SectorSurveillance: IsValidTarget - {pawn.Label} is destroyed/dead/unspawned"); return false; } if (pawn.Downed) { - Log.Message($"SectorSurveillance: IsValidTarget - {pawn.Label} is downed"); + WulaLog.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}"); + WulaLog.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}"); + WulaLog.Debug($"SectorSurveillance: IsValidTarget - {pawn.Label} from {pawn.Faction?.Name ?? "NULL"} is hostile to {effectiveFaction.Name}: {hostile}"); return hostile; } @@ -528,7 +528,7 @@ namespace WulaFallenEmpire FlyOver flyOver = parent as FlyOver; if (flyOver == null) { - Log.Error("SectorSurveillance: IsInSector - Parent is not a FlyOver!"); + WulaLog.Debug("SectorSurveillance: IsInSector - Parent is not a FlyOver!"); return false; } @@ -539,7 +539,7 @@ namespace WulaFallenEmpire float distance = targetVector.magnitude; if (distance > Props.sectorRange) { - Log.Message($"SectorSurveillance: IsInSector - Target at {targetPos} is out of range: {distance:F1} > {Props.sectorRange}"); + WulaLog.Debug($"SectorSurveillance: IsInSector - Target at {targetPos} is out of range: {distance:F1} > {Props.sectorRange}"); return false; } @@ -548,7 +548,7 @@ namespace WulaFallenEmpire bool inAngle = angle <= Props.sectorAngle * 0.5f; - Log.Message($"SectorSurveillance: IsInSector - Target at {targetPos}, distance: {distance:F1}, angle: {angle:F1}°, inAngle: {inAngle}"); + WulaLog.Debug($"SectorSurveillance: IsInSector - Target at {targetPos}, distance: {distance:F1}, angle: {angle:F1}°, inAngle: {inAngle}"); return inAngle; } @@ -557,11 +557,11 @@ namespace WulaFallenEmpire { if (Props.projectileDef == null) { - Log.Error("SectorSurveillance: No projectile defined for sector surveillance"); + WulaLog.Debug("SectorSurveillance: No projectile defined for sector surveillance"); return false; } - Log.Message($"SectorSurveillance: LaunchProjectileAt - Starting launch for target {target?.Label ?? "NULL"}"); + WulaLog.Debug($"SectorSurveillance: LaunchProjectileAt - Starting launch for target {target?.Label ?? "NULL"}"); try { @@ -574,33 +574,33 @@ namespace WulaFallenEmpire IntVec3 spawnCell = offsetSpawnPos.ToIntVec3(); - Log.Message($"SectorSurveillance: Spawn position - World: {offsetSpawnPos}, Cell: {spawnCell}, Lateral Offset: {currentLateralOffsetAngle:F1}°, Longitudinal Offset: {currentLongitudinalOffset:F1}"); + WulaLog.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"); + WulaLog.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"); + WulaLog.Debug($"SectorSurveillance: Spawn cell {spawnCell} is out of bounds"); return false; } - Log.Message($"SectorSurveillance: Attempting to spawn projectile: {Props.projectileDef.defName}"); + WulaLog.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}"); + WulaLog.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}"); + WulaLog.Debug($"SectorSurveillance: Launching projectile - Launcher: {launcher?.def?.defName ?? "NULL"}, LaunchPos: {launchPos}, Target: {targetInfo.Cell}"); projectile.Launch( launcher, @@ -617,19 +617,19 @@ namespace WulaFallenEmpire CreateOffsetEffect(offsetSpawnPos, directionToTarget); } - Log.Message($"SectorSurveillance: Projectile launched successfully"); + WulaLog.Debug($"SectorSurveillance: Projectile launched successfully"); return true; } else { - Log.Error("SectorSurveillance: Failed to spawn projectile - GenSpawn.Spawn returned null"); + WulaLog.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}"); + WulaLog.Debug($"SectorSurveillance: Exception launching projectile: {ex}"); + WulaLog.Debug($"SectorSurveillance: Stack trace: {ex.StackTrace}"); return false; } } @@ -653,11 +653,11 @@ namespace WulaFallenEmpire FlyOver flyOver = parent as FlyOver; //if (flyOver != null && flyOver.caster != null) //{ - // Log.Message($"SectorSurveillance: Using caster as launcher: {flyOver.caster.Label}"); + // WulaLog.Debug($"SectorSurveillance: Using caster as launcher: {flyOver.caster.Label}"); // return flyOver.caster; //} - Log.Message($"SectorSurveillance: Using parent as launcher: {parent.Label}"); + WulaLog.Debug($"SectorSurveillance: Using parent as launcher: {parent.Label}"); return parent; } @@ -732,10 +732,10 @@ namespace WulaFallenEmpire // 新增:调试方法 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}"); + WulaLog.Debug($"SectorSurveillance Offset Status:"); + WulaLog.Debug($" Lateral - Angle: {currentLateralOffsetAngle:F1}°, Mode: {Props.lateralOffsetMode}"); + WulaLog.Debug($" Longitudinal - Offset: {currentLongitudinalOffset:F1}, Mode: {Props.longitudinalOffsetMode}"); + WulaLog.Debug($" Shots Fired: {shotsFired}, Forward Phase: {isForwardPhase}"); } } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_SendLetterAfterTicks/CompSendLetterAfterTicks.cs b/Source/WulaFallenEmpire/Flyover/WULA_SendLetterAfterTicks/CompSendLetterAfterTicks.cs index ecbe3e21..8a05b841 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_SendLetterAfterTicks/CompSendLetterAfterTicks.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_SendLetterAfterTicks/CompSendLetterAfterTicks.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; namespace WulaFallenEmpire @@ -43,7 +43,7 @@ namespace WulaFallenEmpire // 检查是否有有效的信件内容 if (Props.letterLabel.NullOrEmpty() && Props.letterText.NullOrEmpty()) { - Log.Warning($"CompSendLetterAfterTicks: No letter content defined for {parent.def.defName}"); + WulaLog.Debug($"CompSendLetterAfterTicks: No letter content defined for {parent.def.defName}"); return; } @@ -63,11 +63,11 @@ namespace WulaFallenEmpire letterSent = true; - Log.Message($"Letter sent from {parent.def.defName} after {ticksPassed} ticks"); + WulaLog.Debug($"Letter sent from {parent.def.defName} after {ticksPassed} ticks"); } catch (System.Exception ex) { - Log.Error($"Error sending letter from {parent.def.defName}: {ex}"); + WulaLog.Debug($"Error sending letter from {parent.def.defName}: {ex}"); } } diff --git a/Source/WulaFallenEmpire/Flyover/WULA_ShipArtillery/CompShipArtillery.cs b/Source/WulaFallenEmpire/Flyover/WULA_ShipArtillery/CompShipArtillery.cs index 0fe13585..bf15616f 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_ShipArtillery/CompShipArtillery.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_ShipArtillery/CompShipArtillery.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -47,8 +47,8 @@ namespace WulaFallenEmpire base.Initialize(props); ticksUntilNextAttack = Props.ticksBetweenAttacks; - Log.Message($"Ship Artillery initialized: {Props.ticksBetweenAttacks} ticks between attacks, {Props.attackRadius} radius"); - Log.Message($"Faction Discrimination: {Props.useFactionDiscrimination}, Target Faction: {Props.targetFaction?.defName ?? "None"}, Micro Tracking: {Props.useMicroTracking}"); + WulaLog.Debug($"Ship Artillery initialized: {Props.ticksBetweenAttacks} ticks between attacks, {Props.attackRadius} radius"); + WulaLog.Debug($"Faction Discrimination: {Props.useFactionDiscrimination}, Target Faction: {Props.targetFaction?.defName ?? "None"}, Micro Tracking: {Props.useMicroTracking}"); } public override void CompTick() @@ -117,9 +117,9 @@ namespace WulaFallenEmpire if (DebugSettings.godMode && cachedTargets.Count > 0) { - Log.Message($"Target Cache Updated: Found {cachedTargets.Count} targets"); + WulaLog.Debug($"Target Cache Updated: Found {cachedTargets.Count} targets"); var stats = GetTargetStatistics(); - Log.Message($"Target Statistics - Pawns: {stats.pawnCount}, Owned Buildings: {stats.ownedBuildingCount}, Unowned Buildings: {stats.unownedBuildingCount}, Walls: {stats.wallCount}, Others: {stats.otherCount}"); + WulaLog.Debug($"Target Statistics - Pawns: {stats.pawnCount}, Owned Buildings: {stats.ownedBuildingCount}, Unowned Buildings: {stats.unownedBuildingCount}, Walls: {stats.wallCount}, Others: {stats.otherCount}"); } } @@ -240,12 +240,12 @@ namespace WulaFallenEmpire if (!currentTarget.IsValid || !currentTarget.InBounds(flyOver.Map)) { - Log.Warning("Ship Artillery: Invalid target selected, skipping attack"); + WulaLog.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})"); + WulaLog.Debug($"Ship Artillery starting attack on target area: {currentTarget} (attack radius: {Props.attackRadius})"); // 修复3:在一轮炮击中,只进行一次目标选择 currentVolleyCenter = currentTarget; @@ -297,7 +297,7 @@ namespace WulaFallenEmpire attackEffecter = Props.attackEffect.Spawn(); } - Log.Message($"Ship Artillery started firing at area {currentTarget}"); + WulaLog.Debug($"Ship Artillery started firing at area {currentTarget}"); // 发送攻击通知 if (Props.sendAttackLetter) @@ -390,7 +390,7 @@ namespace WulaFallenEmpire if (DebugSettings.godMode) { - Log.Message($"Generated {currentVolleyTargets.Count} targets for volley around {currentVolleyCenter}"); + WulaLog.Debug($"Generated {currentVolleyTargets.Count} targets for volley around {currentVolleyCenter}"); } } @@ -401,7 +401,7 @@ namespace WulaFallenEmpire ThingDef shellDef = SelectShellDef(); if (shellDef == null) { - Log.Error("Ship Artillery: No valid shell def found"); + WulaLog.Debug("Ship Artillery: No valid shell def found"); return; } @@ -410,7 +410,7 @@ namespace WulaFallenEmpire float distanceFromCenter = shellTarget.DistanceTo(currentVolleyCenter); if (DebugSettings.godMode) { - Log.Message($"Ship Artillery fired shell at {shellTarget} (distance from center: {distanceFromCenter:F1})"); + WulaLog.Debug($"Ship Artillery fired shell at {shellTarget} (distance from center: {distanceFromCenter:F1})"); } if (Props.attackSound != null) @@ -420,7 +420,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"Error firing ship artillery shell: {ex}"); + WulaLog.Debug($"Error firing ship artillery shell: {ex}"); } } @@ -429,7 +429,7 @@ namespace WulaFallenEmpire { if (cachedTargets.Count == 0) { - Log.Warning("MicroTracking: No targets available, falling back to random target"); + WulaLog.Debug("MicroTracking: No targets available, falling back to random target"); return SelectRandomTargetInRadius(currentVolleyCenter, flyOver.Map, Props.attackRadius); } @@ -456,7 +456,7 @@ namespace WulaFallenEmpire selectedThing is Building building ? (building.Faction == null ? "Unowned Building" : "Owned Building") : "Other"; - Log.Message($"MicroTracking: Targeting {selectedThing?.Label ?? "unknown"} ({targetType}) at {targetCell}, final target: {offsetTarget}"); + WulaLog.Debug($"MicroTracking: Targeting {selectedThing?.Label ?? "unknown"} ({targetType}) at {targetCell}, final target: {offsetTarget}"); } return offsetTarget; @@ -586,11 +586,11 @@ namespace WulaFallenEmpire if (DebugSettings.godMode) { float actualDistance = potentialTarget.DistanceTo(center); - Log.Message($"Found valid target at {potentialTarget} (distance from center: {actualDistance:F1})"); + WulaLog.Debug($"Found valid target at {potentialTarget} (distance from center: {actualDistance:F1})"); if (ignoreProtectionForThisTarget) { - Log.Warning($"Protection ignored for target selection! May target player assets."); + WulaLog.Debug($"Protection ignored for target selection! May target player assets."); } } @@ -600,7 +600,7 @@ namespace WulaFallenEmpire } // 回退:使用地图随机位置 - Log.Warning("Could not find valid target in radius, using fallback"); + WulaLog.Debug("Could not find valid target in radius, using fallback"); CellRect mapRect = CellRect.WholeMap(map); for (int i = 0; i < 5; i++) { @@ -749,7 +749,7 @@ namespace WulaFallenEmpire ticksUntilNextAttack = Props.ticksBetweenAttacks; } - Log.Message($"Ship Artillery attack ended"); + WulaLog.Debug($"Ship Artillery attack ended"); } private void SendAttackLetter(FlyOver flyOver) @@ -768,7 +768,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"Error sending ship artillery letter: {ex}"); + WulaLog.Debug($"Error sending ship artillery letter: {ex}"); } } @@ -827,20 +827,20 @@ namespace WulaFallenEmpire 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}"); + WulaLog.Debug($"FlyOver - DrawPos: {flyOver.DrawPos}, Position: {flyOver.Position}, Calculated: {flyOverPos}"); + WulaLog.Debug($"Current Target: {currentTarget}, Distance: {flyOverPos.DistanceTo(currentTarget):F1}"); // 显示派系甄别信息 Faction targetFaction = GetTargetFaction(flyOver); - Log.Message($"Faction Discrimination: {Props.useFactionDiscrimination}, Target Faction: {targetFaction?.def.defName ?? "None"}"); - Log.Message($"Micro Tracking: {Props.useMicroTracking}, Targets Found: {cachedTargets.Count}"); + WulaLog.Debug($"Faction Discrimination: {Props.useFactionDiscrimination}, Target Faction: {targetFaction?.def.defName ?? "None"}"); + WulaLog.Debug($"Micro Tracking: {Props.useMicroTracking}, Targets Found: {cachedTargets.Count}"); // 显示目标统计 var stats = GetTargetStatistics(); - Log.Message($"Target Stats - Pawns: {stats.pawnCount}, Owned Buildings: {stats.ownedBuildingCount}, Unowned Buildings: {stats.unownedBuildingCount}, Walls: {stats.wallCount}, Others: {stats.otherCount}"); + WulaLog.Debug($"Target Stats - Pawns: {stats.pawnCount}, Owned Buildings: {stats.ownedBuildingCount}, Unowned Buildings: {stats.unownedBuildingCount}, Walls: {stats.wallCount}, Others: {stats.otherCount}"); // 显示炮击信息 - Log.Message($"Volley - Center: {currentVolleyCenter}, Targets: {currentVolleyTargets.Count}, Index: {currentVolleyIndex}"); + WulaLog.Debug($"Volley - Center: {currentVolleyCenter}, Targets: {currentVolleyTargets.Count}, Index: {currentVolleyIndex}"); } } }; @@ -864,7 +864,7 @@ namespace WulaFallenEmpire thing is Building building ? (building.Faction == null ? "Unowned Building" : "Owned Building") : "Other"; - Log.Message($"Cached Target: {thing?.Label ?? "Unknown"} ({type}) at {target.Cell}, Weight: {weight:F2}"); + WulaLog.Debug($"Cached Target: {thing?.Label ?? "Unknown"} ({type}) at {target.Cell}, Weight: {weight:F2}"); } } } @@ -881,7 +881,7 @@ namespace WulaFallenEmpire { for (int i = 0; i < currentVolleyTargets.Count; i++) { - Log.Message($"Volley Target {i}: {currentVolleyTargets[i]} ({(i == currentVolleyIndex ? "NEXT" : "queued")})"); + WulaLog.Debug($"Volley Target {i}: {currentVolleyTargets[i]} ({(i == currentVolleyIndex ? "NEXT" : "queued")})"); } } }; @@ -896,7 +896,7 @@ namespace WulaFallenEmpire if (parent is FlyOver flyOver) { UpdateTargetCache(flyOver); - Log.Message($"Force updated target cache: {cachedTargets.Count} targets found"); + WulaLog.Debug($"Force updated target cache: {cachedTargets.Count} targets found"); } } }; diff --git a/Source/WulaFallenEmpire/Flyover/WULA_SpawnFlyOver/CompAbilityEffect_SpawnFlyOver.cs b/Source/WulaFallenEmpire/Flyover/WULA_SpawnFlyOver/CompAbilityEffect_SpawnFlyOver.cs index d3f7c098..734e233e 100644 --- a/Source/WulaFallenEmpire/Flyover/WULA_SpawnFlyOver/CompAbilityEffect_SpawnFlyOver.cs +++ b/Source/WulaFallenEmpire/Flyover/WULA_SpawnFlyOver/CompAbilityEffect_SpawnFlyOver.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -64,7 +64,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"Error spawning fly over: {ex}"); + WulaLog.Debug($"Error spawning fly over: {ex}"); } } @@ -84,7 +84,7 @@ namespace WulaFallenEmpire ThingDef flyOverDef = Props.flyOverDef ?? DefDatabase.GetNamedSilentFail("ARA_HiveShip"); if (flyOverDef == null) { - Log.Warning("No fly over def specified for standard fly over"); + WulaLog.Debug("No fly over def specified for standard fly over"); return; } @@ -105,7 +105,7 @@ namespace WulaFallenEmpire ThingDef flyOverDef = Props.flyOverDef ?? DefDatabase.GetNamedSilentFail("ARA_HiveCorvette"); if (flyOverDef == null) { - Log.Warning("No fly over def specified for ground strafing fly over"); + WulaLog.Debug("No fly over def specified for ground strafing fly over"); return; } @@ -146,7 +146,7 @@ namespace WulaFallenEmpire ThingDef flyOverDef = Props.flyOverDef ?? DefDatabase.GetNamedSilentFail("ARA_HiveCorvette"); if (flyOverDef == null) { - Log.Warning("No fly over def specified for sector surveillance fly over"); + WulaLog.Debug("No fly over def specified for sector surveillance fly over"); return; } diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs b/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs index b4678b79..47987e67 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs @@ -1,4 +1,4 @@ -// Building_GlobalWorkTable.cs (修改版本) +// Building_GlobalWorkTable.cs (修改版本) using RimWorld; using System.Collections.Generic; using System.Linq; @@ -322,18 +322,18 @@ namespace WulaFallenEmpire // 显示成功消息 Messages.Message("WULA_SilverTransferred".Translate(silverAmount), MessageTypeDefOf.PositiveEvent); - Log.Message($"[WULA] Transferred {silverAmount} silver from input to output storage"); + WulaLog.Debug($"[WULA] Transferred {silverAmount} silver from input to output storage"); } else { Messages.Message("WULA_TransferFailed".Translate(), MessageTypeDefOf.RejectInput); - Log.Error("[WULA] Failed to remove silver from input storage during transfer"); + WulaLog.Debug("[WULA] Failed to remove silver from input storage during transfer"); } } catch (System.Exception ex) { Messages.Message("WULA_TransferError".Translate(), MessageTypeDefOf.RejectInput); - Log.Error($"[WULA] Error during silver transfer: {ex}"); + WulaLog.Debug($"[WULA] Error during silver transfer: {ex}"); } } @@ -402,7 +402,7 @@ namespace WulaFallenEmpire //} //catch (System.Exception ex) //{ - // Log.Error($"[FactoryFacility Check] Error in HasFactoryFacilityFlyOver: {ex}"); + // WulaLog.Debug($"[FactoryFacility Check] Error in HasFactoryFacilityFlyOver: {ex}"); // return false; //} } @@ -593,7 +593,7 @@ namespace WulaFallenEmpire // 记录分配结果 for (int i = 0; i < podContents.Count; i++) { - Log.Message($"[Airdrop] Pod {i} contains {podContents[i].Count} items"); + WulaLog.Debug($"[Airdrop] Pod {i} contains {podContents[i].Count} items"); } return podContents; } @@ -652,14 +652,14 @@ namespace WulaFallenEmpire { if (pawnType.race == null) { - Log.Error($"[Airdrop] GetRandomPawnKindForType: {pawnType.defName} is not a pawn type"); + WulaLog.Debug($"[Airdrop] GetRandomPawnKindForType: {pawnType.defName} is not a pawn type"); return null; } // 获取工作台的派系 Faction workTableFaction = this.Faction; if (workTableFaction == null) { - Log.Error($"[Airdrop] Work table has no faction"); + WulaLog.Debug($"[Airdrop] Work table has no faction"); return null; } // 获取该种族的所有PawnKindDef @@ -668,7 +668,7 @@ namespace WulaFallenEmpire .ToList(); if (availableKinds.Count == 0) { - Log.Error($"[Airdrop] No PawnKindDef found for race: {pawnType.defName}"); + WulaLog.Debug($"[Airdrop] No PawnKindDef found for race: {pawnType.defName}"); return null; } // 最高优先级:与工作台派系完全相同的PawnKind @@ -702,12 +702,12 @@ namespace WulaFallenEmpire if (noFactionKinds.Count > 0) { var selected = noFactionKinds.RandomElement(); - Log.Message($"[Airdrop] Selected no-faction PawnKind: {selected.defName}"); + WulaLog.Debug($"[Airdrop] Selected no-faction PawnKind: {selected.defName}"); return selected; } // 最后选择任何可用的PawnKind var selectedKind = availableKinds.RandomElement(); - Log.Message($"[Airdrop] Selected fallback PawnKind: {selectedKind.defName}"); + WulaLog.Debug($"[Airdrop] Selected fallback PawnKind: {selectedKind.defName}"); return selectedKind; } @@ -729,14 +729,14 @@ namespace WulaFallenEmpire { if (contents == null || contents.Count == 0) { - Log.Warning("[Airdrop] CreateDropPod: contents is null or empty"); + WulaLog.Debug("[Airdrop] CreateDropPod: contents is null or empty"); return false; } - Log.Message($"[Airdrop] Creating drop pod at {dropCell} with {contents.Count} items"); + WulaLog.Debug($"[Airdrop] Creating drop pod at {dropCell} with {contents.Count} items"); // 检查目标单元格是否有效 if (!dropCell.IsValid || !dropCell.InBounds(Map)) { - Log.Error($"[Airdrop] Invalid drop cell: {dropCell}"); + WulaLog.Debug($"[Airdrop] Invalid drop cell: {dropCell}"); return false; } // 创建空投舱信息 - 使用 DropPodInfo 而不是 ActiveTransporterInfo @@ -752,29 +752,29 @@ namespace WulaFallenEmpire { if (!container.TryAdd(thing, true)) { - Log.Error($"[Airdrop] Failed to add {thing.Label} to drop pod"); + WulaLog.Debug($"[Airdrop] Failed to add {thing.Label} to drop pod"); } else { - Log.Message($"[Airdrop] Added {thing.Label} to drop pod"); + WulaLog.Debug($"[Airdrop] Added {thing.Label} to drop pod"); } } } if (container.Count == 0) { - Log.Warning("[Airdrop] No items were successfully added to drop pod"); + WulaLog.Debug("[Airdrop] No items were successfully added to drop pod"); return false; } dropPodInfo.innerContainer = container; // 生成空投舱 DropPodUtility.MakeDropPodAt(dropCell, Map, dropPodInfo, Faction.OfPlayer); - Log.Message($"[Airdrop] Successfully created drop pod at {dropCell}"); + WulaLog.Debug($"[Airdrop] Successfully created drop pod at {dropCell}"); return true; } catch (System.Exception ex) { - Log.Error($"[Airdrop] Failed to create drop pod at {dropCell}: {ex}"); + WulaLog.Debug($"[Airdrop] Failed to create drop pod at {dropCell}: {ex}"); return false; } } diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrder.cs b/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrder.cs index 9c32cd2d..fcfc24ed 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrder.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrder.cs @@ -1,4 +1,4 @@ -// GlobalProductionOrder.cs (修复成本计算,使用产物的costList) +// GlobalProductionOrder.cs (修复成本计算,使用产物的costList) using RimWorld; using System.Collections.Generic; using System.Linq; @@ -37,7 +37,7 @@ namespace WulaFallenEmpire _progress = Mathf.Clamp01(value); if (value < 0f || value > 1f) { - Log.Warning($"Progress clamped from {value} to {_progress} for {recipe?.defName ?? "unknown"}"); + WulaLog.Debug($"Progress clamped from {value} to {_progress} for {recipe?.defName ?? "unknown"}"); } } } diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrderStack.cs b/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrderStack.cs index 20dc05e1..4e468348 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrderStack.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/GlobalProductionOrderStack.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using Verse; using UnityEngine; @@ -94,7 +94,7 @@ namespace WulaFallenEmpire // 防止除零错误 if (workAmount <= 0) { - Log.Error($"Invalid workAmount ({workAmount}) for recipe {order.recipe.defName}"); + WulaLog.Debug($"Invalid workAmount ({workAmount}) for recipe {order.recipe.defName}"); order.state = GlobalProductionOrder.ProductionState.Gathering; order.progress = 0f; return; @@ -110,7 +110,7 @@ namespace WulaFallenEmpire // 调试信息 if (Find.TickManager.TicksGame % 300 == 0) // 每5秒输出一次 { - Log.Message($"[DEBUG] Order {order.recipe.defName}: " + + WulaLog.Debug($"[DEBUG] Order {order.recipe.defName}: " + $"progress={order.progress:P2}, " + $"workAmount={workAmount}, " + $"increment={progressIncrement:E4}, " + @@ -153,7 +153,7 @@ namespace WulaFallenEmpire } // 最后的回退方案 - Log.Warning($"Could not determine work amount for recipe {order.recipe.defName}, using default value"); + WulaLog.Debug($"Could not determine work amount for recipe {order.recipe.defName}, using default value"); return 1000f; // 默认工作量 } @@ -169,17 +169,17 @@ namespace WulaFallenEmpire if (Find.TickManager.TicksGame % 600 == 0) // 每10秒记录一次 { - Log.Message($"[INFO] Order {order.recipe.defName} started producing"); + WulaLog.Debug($"[INFO] Order {order.recipe.defName} started producing"); } } else { - Log.Warning($"[WULA] Order {order.recipe.defName} had enough resources but failed to deduct them; staying in Gathering."); + WulaLog.Debug($"[WULA] Order {order.recipe.defName} had enough resources but failed to deduct them; staying in Gathering."); } } else if (Find.TickManager.TicksGame % 1200 == 0) // 每20秒检查一次 { - Log.Message($"[DEBUG] Order {order.recipe.defName} is waiting. " + + WulaLog.Debug($"[DEBUG] Order {order.recipe.defName} is waiting. " + $"HasEnoughResources: {order.HasEnoughResources()}"); } } @@ -189,7 +189,7 @@ namespace WulaFallenEmpire // 生产完成(资源已经在开始生产时扣除) order.Produce(); - Log.Message($"[SUCCESS] Produced {order.recipe.products[0].thingDef.defName}, " + + WulaLog.Debug($"[SUCCESS] Produced {order.recipe.products[0].thingDef.defName}, " + $"count: {order.currentCount}/{order.targetCount}"); // 重置进度 @@ -200,7 +200,7 @@ namespace WulaFallenEmpire { order.state = GlobalProductionOrder.ProductionState.Completed; Delete(order); // 同步 GlobalStorageWorldComponent.productionOrders - Log.Message($"[COMPLETE] Order {order.recipe.defName} completed and removed"); + WulaLog.Debug($"[COMPLETE] Order {order.recipe.defName} completed and removed"); } else { @@ -222,23 +222,23 @@ namespace WulaFallenEmpire if (float.IsNaN(order.progress) || float.IsInfinity(order.progress)) { order.progress = 0f; - Log.Warning($"Fixed invalid progress for {order.recipe?.defName ?? "unknown"}"); + WulaLog.Debug($"Fixed invalid progress for {order.recipe?.defName ?? "unknown"}"); } else if (order.progress < 0f) { order.progress = 0f; - Log.Warning($"Fixed negative progress for {order.recipe?.defName ?? "unknown"}"); + WulaLog.Debug($"Fixed negative progress for {order.recipe?.defName ?? "unknown"}"); } else if (order.progress > 1f) { order.progress = 1f; - Log.Warning($"Fixed excessive progress for {order.recipe?.defName ?? "unknown"}"); + WulaLog.Debug($"Fixed excessive progress for {order.recipe?.defName ?? "unknown"}"); } // 修复状态 if (order.recipe == null) { - Log.Warning($"Removing order with null recipe"); + WulaLog.Debug($"Removing order with null recipe"); Delete(order); // 同步 GlobalStorageWorldComponent.productionOrders continue; } diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/GlobalStorageWorldComponent.cs b/Source/WulaFallenEmpire/GlobalWorkTable/GlobalStorageWorldComponent.cs index 83513962..407cfc23 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/GlobalStorageWorldComponent.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/GlobalStorageWorldComponent.cs @@ -1,4 +1,4 @@ -// GlobalStorageWorldComponent.cs (移除材质相关存储) +// GlobalStorageWorldComponent.cs (移除材质相关存储) using LudeonTK; using RimWorld; using RimWorld.Planet; @@ -247,7 +247,7 @@ namespace WulaFallenEmpire { globalStorage.AddToInputStorage(ThingDefOf.Steel, 200); globalStorage.AddToInputStorage(ThingDefOf.ComponentIndustrial, 100); - Log.Message("Added test resources to global storage"); + WulaLog.Debug("Added test resources to global storage"); } } @@ -271,7 +271,7 @@ namespace WulaFallenEmpire globalStorage.outputContainer.Remove(thing); GenPlace.TryPlaceThing(thing, workTable.Position, workTable.Map, ThingPlaceMode.Near); } - Log.Message("Spawned all output products"); + WulaLog.Debug("Spawned all output products"); } } } diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/ITab_GlobalBills.cs b/Source/WulaFallenEmpire/GlobalWorkTable/ITab_GlobalBills.cs index 89c8309e..7825d276 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/ITab_GlobalBills.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/ITab_GlobalBills.cs @@ -1,4 +1,4 @@ -// ITab_GlobalBills.cs (移除材质选择功能) +// ITab_GlobalBills.cs (移除材质选择功能) using System.Collections.Generic; using System.Linq; using System.Text; @@ -622,7 +622,7 @@ namespace WulaFallenEmpire if (!resourcesConsumed) { - Log.Message($"[GOD MODE] Could not consume resources for {order.recipe.defName}, completing without resource consumption"); + WulaLog.Debug($"[GOD MODE] Could not consume resources for {order.recipe.defName}, completing without resource consumption"); } // 添加产品到输出存储 diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/WULA_Launchable_ToGlobalStorage/CompLaunchable_ToGlobalStorage.cs b/Source/WulaFallenEmpire/GlobalWorkTable/WULA_Launchable_ToGlobalStorage/CompLaunchable_ToGlobalStorage.cs index 1bbff329..6b51a96b 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/WULA_Launchable_ToGlobalStorage/CompLaunchable_ToGlobalStorage.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/WULA_Launchable_ToGlobalStorage/CompLaunchable_ToGlobalStorage.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using UnityEngine; using Verse; @@ -45,14 +45,14 @@ namespace WulaFallenEmpire { if (!this.parent.Spawned) { - Log.Error("Tried to launch " + this.parent + " but it's not spawned."); + WulaLog.Debug("Tried to launch " + this.parent + " but it's not spawned."); return; } var globalStorage = Find.World.GetComponent(); if (globalStorage == null) { - Log.Error("Could not find GlobalStorageWorldComponent."); + WulaLog.Debug("Could not find GlobalStorageWorldComponent."); return; } diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/WULA_Launchable_ToGlobalStorage/CompProperties_GarbageShield.cs b/Source/WulaFallenEmpire/GlobalWorkTable/WULA_Launchable_ToGlobalStorage/CompProperties_GarbageShield.cs index c3adc386..30a17f3a 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/WULA_Launchable_ToGlobalStorage/CompProperties_GarbageShield.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/WULA_Launchable_ToGlobalStorage/CompProperties_GarbageShield.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Text; using UnityEngine; @@ -96,7 +96,7 @@ namespace WulaFallenEmpire } else { - Log.Error($"[CompGarbageShield] Could not find EventDef named '{Props.garbageShieldUIEventDefName}'."); + WulaLog.Debug($"[CompGarbageShield] Could not find EventDef named '{Props.garbageShieldUIEventDefName}'."); } } } diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/WULA_ValueConverter/CompValueConverter.cs b/Source/WulaFallenEmpire/GlobalWorkTable/WULA_ValueConverter/CompValueConverter.cs index 24f6edab..7d2ec727 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/WULA_ValueConverter/CompValueConverter.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/WULA_ValueConverter/CompValueConverter.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Text; using UnityEngine; @@ -158,7 +158,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[WULA ValueConverter] Error in GetConversionDescription: {ex}"); + WulaLog.Debug($"[WULA ValueConverter] Error in GetConversionDescription: {ex}"); return "WULA_ConversionDescriptionError".Translate(); } } @@ -225,7 +225,7 @@ namespace WulaFallenEmpire if (!this.parent.Spawned) { - Log.Error("Tried to convert " + this.parent + " but it's not spawned."); + WulaLog.Debug("Tried to convert " + this.parent + " but it's not spawned."); return; } @@ -253,7 +253,7 @@ namespace WulaFallenEmpire } else { - Log.Error("Could not find GlobalStorageWorldComponent."); + WulaLog.Debug("Could not find GlobalStorageWorldComponent."); return; } @@ -307,7 +307,7 @@ namespace WulaFallenEmpire } else { - Log.Error($"[CompValueConverter] Could not find EventDef named '{uiEventDefName}'."); + WulaLog.Debug($"[CompValueConverter] Could not find EventDef named '{uiEventDefName}'."); } } } @@ -378,7 +378,7 @@ namespace WulaFallenEmpire public new void TryLaunch(PlanetTile destinationTile, TransportersArrivalAction arrivalAction) { // 这个方法不应该被直接调用,应该使用ConvertToCurrency - Log.Warning("CompValueConverter.TryLaunch should not be called directly. Use ConvertToCurrency instead."); + WulaLog.Debug("CompValueConverter.TryLaunch should not be called directly. Use ConvertToCurrency instead."); ConvertToCurrency(); } } diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/WorkGiver_GlobalWorkTable.cs b/Source/WulaFallenEmpire/GlobalWorkTable/WorkGiver_GlobalWorkTable.cs index 3a8b4d84..6291e0d9 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/WorkGiver_GlobalWorkTable.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/WorkGiver_GlobalWorkTable.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Linq; using Verse; @@ -15,13 +15,13 @@ namespace WulaFallenEmpire { if (!(t is Building_GlobalWorkTable table) || !table.Spawned || table.IsForbidden(pawn)) { - if (forced) Log.Message($"[WULA_DEBUG] HasJobOnThing: Target invalid or forbidden. {t}"); + if (forced) WulaLog.Debug($"[WULA_DEBUG] HasJobOnThing: Target invalid or forbidden. {t}"); return false; } if (!pawn.CanReserve(table, 1, -1, null, forced)) { - if (forced) Log.Message($"[WULA_DEBUG] HasJobOnThing: Cannot reserve table."); + if (forced) WulaLog.Debug($"[WULA_DEBUG] HasJobOnThing: Cannot reserve table."); return false; } @@ -31,10 +31,10 @@ namespace WulaFallenEmpire { if (forced) { - Log.Message($"[WULA_DEBUG] HasJobOnThing: No gathering order found. Total orders: {table.globalOrderStack.orders.Count}"); + WulaLog.Debug($"[WULA_DEBUG] HasJobOnThing: No gathering order found. Total orders: {table.globalOrderStack.orders.Count}"); foreach (var o in table.globalOrderStack.orders) { - Log.Message($" - Order: {o.Label}, State: {o.state}, Paused: {o.paused}"); + WulaLog.Debug($" - Order: {o.Label}, State: {o.state}, Paused: {o.paused}"); } } return false; @@ -45,7 +45,7 @@ namespace WulaFallenEmpire var neededMaterials = GetNeededMaterials(order, table, globalStorage); if (neededMaterials.Count == 0) { - if (forced) Log.Message($"[WULA_DEBUG] HasJobOnThing: Order has enough resources."); + if (forced) WulaLog.Debug($"[WULA_DEBUG] HasJobOnThing: Order has enough resources."); return false; } @@ -53,7 +53,7 @@ namespace WulaFallenEmpire var ingredients = FindBestIngredients(pawn, table, neededMaterials); if (ingredients == null) { - if (forced) Log.Message($"[WULA_DEBUG] HasJobOnThing: Could not find ingredients for {order.Label}."); + if (forced) WulaLog.Debug($"[WULA_DEBUG] HasJobOnThing: Could not find ingredients for {order.Label}."); return false; } @@ -87,7 +87,7 @@ namespace WulaFallenEmpire { var result = new List>(); - Log.Message($"[WULA_DEBUG] Needed materials: {string.Join(", ", neededMaterials.Select(k => $"{k.Key.defName} x{k.Value}"))}"); + WulaLog.Debug($"[WULA_DEBUG] Needed materials: {string.Join(", ", neededMaterials.Select(k => $"{k.Key.defName} x{k.Value}"))}"); foreach (var kvp in neededMaterials) { @@ -114,7 +114,7 @@ namespace WulaFallenEmpire } } - Log.Message($"[WULA_DEBUG] Found {currentCount}/{countNeeded} of {def.defName}"); + WulaLog.Debug($"[WULA_DEBUG] Found {currentCount}/{countNeeded} of {def.defName}"); } return result.Count > 0 ? result : null; diff --git a/Source/WulaFallenEmpire/HarmonyPatches/MapParent_ShouldRemoveMapNow_Patch.cs b/Source/WulaFallenEmpire/HarmonyPatches/MapParent_ShouldRemoveMapNow_Patch.cs index f6adba9b..1575bbd8 100644 --- a/Source/WulaFallenEmpire/HarmonyPatches/MapParent_ShouldRemoveMapNow_Patch.cs +++ b/Source/WulaFallenEmpire/HarmonyPatches/MapParent_ShouldRemoveMapNow_Patch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld.Planet; using System.Linq; using Verse; @@ -27,7 +27,7 @@ namespace WulaFallenEmpire if (isBeingObserved) { // 如果地图正在被监测,阻止地图被移除 - Log.Message($"[MapObserver] 阻止地图移除: {__instance.Label} 正在被监测"); + WulaLog.Debug($"[MapObserver] 阻止地图移除: {__instance.Label} 正在被监测"); return false; } @@ -36,14 +36,14 @@ namespace WulaFallenEmpire { if (shuttle != null && shuttle.PocketMapGenerated && shuttle.PocketMap != null && shuttle.PocketMap.mapPawns.AnyPawnBlockingMapRemoval) { - Log.Message($"[WULA] 阻止地图移除: 穿梭机 '{shuttle.Label}' 的口袋维度中仍有生物"); + WulaLog.Debug($"[WULA] 阻止地图移除: 穿梭机 '{shuttle.Label}' 的口袋维度中仍有生物"); return false; } } } catch (System.Exception ex) { - Log.Error($"[MapObserver] MapParent_CheckRemoveMapNow_Patch 错误: {ex}"); + WulaLog.Debug($"[MapObserver] MapParent_CheckRemoveMapNow_Patch 错误: {ex}"); } // 如果没有找到需要保护的情况,允许原方法继续执行 diff --git a/Source/WulaFallenEmpire/HarmonyPatches/Patch_CaravanInventoryUtility_FindShuttle.cs b/Source/WulaFallenEmpire/HarmonyPatches/Patch_CaravanInventoryUtility_FindShuttle.cs index 7109ff1a..5b933425 100644 --- a/Source/WulaFallenEmpire/HarmonyPatches/Patch_CaravanInventoryUtility_FindShuttle.cs +++ b/Source/WulaFallenEmpire/HarmonyPatches/Patch_CaravanInventoryUtility_FindShuttle.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld; using RimWorld.Planet; using Verse; @@ -25,7 +25,7 @@ namespace WulaFallenEmpire.HarmonyPatches { if (item is Building_ArmedShuttle armedShuttle) { - Log.Message($"[WULA] Harmony Patch: Found Building_ArmedShuttle ({armedShuttle.Label}) in caravan inventory. Setting as __result."); + WulaLog.Debug($"[WULA] Harmony Patch: Found Building_ArmedShuttle ({armedShuttle.Label}) in caravan inventory. Setting as __result."); // We need to cast our Building_ArmedShuttle to Building_PassengerShuttle // This is safe because Building_ArmedShuttle is designed to be compatible with Building_PassengerShuttle's interface for caravan purposes. __result = (Building_PassengerShuttle)armedShuttle; diff --git a/Source/WulaFallenEmpire/HarmonyPatches/Patch_CaravanUIUtility_AddPawnsSections_Postfix.cs b/Source/WulaFallenEmpire/HarmonyPatches/Patch_CaravanUIUtility_AddPawnsSections_Postfix.cs index e12a04e5..064e2542 100644 --- a/Source/WulaFallenEmpire/HarmonyPatches/Patch_CaravanUIUtility_AddPawnsSections_Postfix.cs +++ b/Source/WulaFallenEmpire/HarmonyPatches/Patch_CaravanUIUtility_AddPawnsSections_Postfix.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld; using RimWorld.Planet; using System.Collections.Generic; @@ -26,7 +26,7 @@ namespace WulaFallenEmpire if (autonomousMechs.Any()) { widget.AddSection("WULA_AutonomousMechsSection".Translate(), autonomousMechs); - Log.Message($"[WULA] Postfix: Added 'Autonomous Mechs' section with {autonomousMechs.Count} mechs."); + WulaLog.Debug($"[WULA] Postfix: Added 'Autonomous Mechs' section with {autonomousMechs.Count} mechs."); } } } diff --git a/Source/WulaFallenEmpire/HarmonyPatches/Patch_DropCellFinder_SkyfallerCanLandAt.cs b/Source/WulaFallenEmpire/HarmonyPatches/Patch_DropCellFinder_SkyfallerCanLandAt.cs index e80079a2..d76a5805 100644 --- a/Source/WulaFallenEmpire/HarmonyPatches/Patch_DropCellFinder_SkyfallerCanLandAt.cs +++ b/Source/WulaFallenEmpire/HarmonyPatches/Patch_DropCellFinder_SkyfallerCanLandAt.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld; using System; using System.Collections.Generic; @@ -46,7 +46,7 @@ namespace WulaFallenEmpire.HarmonyPatches { if (!occupiedCell.InBounds(map)) { - Log.Warning($"[WULA] Harmony Patch: SkyfallerCanLandAt - Occupied cell {occupiedCell} for WULA_ArmedShuttle (size: {size}) is out of map bounds. Preventing landing."); + WulaLog.Debug($"[WULA] Harmony Patch: SkyfallerCanLandAt - Occupied cell {occupiedCell} for WULA_ArmedShuttle (size: {size}) is out of map bounds. Preventing landing."); __result = false; return false; // 阻止原方法执行,并返回 false } diff --git a/Source/WulaFallenEmpire/HarmonyPatches/Patch_Pawn_PreApplyDamage.cs b/Source/WulaFallenEmpire/HarmonyPatches/Patch_Pawn_PreApplyDamage.cs index 1c55747e..056b92ea 100644 --- a/Source/WulaFallenEmpire/HarmonyPatches/Patch_Pawn_PreApplyDamage.cs +++ b/Source/WulaFallenEmpire/HarmonyPatches/Patch_Pawn_PreApplyDamage.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld; using Verse; @@ -14,7 +14,7 @@ namespace WulaFallenEmpire var interceptorComp = __instance.TryGetComp(); if (interceptorComp != null) { - Log.Message($"[DamageInterceptor] {__instance.LabelShort} 即将受到 {dinfo.Amount} 点伤害,拦截组件激活"); + WulaLog.Debug($"[DamageInterceptor] {__instance.LabelShort} 即将受到 {dinfo.Amount} 点伤害,拦截组件激活"); // 让拦截组件处理伤害 return interceptorComp.PreApplyDamage(ref dinfo); @@ -34,7 +34,7 @@ namespace WulaFallenEmpire var interceptorComp = __instance.TryGetComp(); if (interceptorComp != null && totalDamageDealt == 0f) { - Log.Message($"[DamageInterceptor] {__instance.LabelShort} 成功拦截所有伤害,实际承受0点伤害"); + WulaLog.Debug($"[DamageInterceptor] {__instance.LabelShort} 成功拦截所有伤害,实际承受0点伤害"); } } } diff --git a/Source/WulaFallenEmpire/HarmonyPatches/Projectile_Launch_Patch.cs b/Source/WulaFallenEmpire/HarmonyPatches/Projectile_Launch_Patch.cs index 8830ca7f..fac9a1c2 100644 --- a/Source/WulaFallenEmpire/HarmonyPatches/Projectile_Launch_Patch.cs +++ b/Source/WulaFallenEmpire/HarmonyPatches/Projectile_Launch_Patch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld; using System; using System.Collections.Generic; @@ -51,7 +51,7 @@ namespace WulaFallenEmpire.HarmonyPatches } catch (Exception ex) { - Log.Error($"Error in Projectile_Impact_Patch: {ex}"); + WulaLog.Debug($"Error in Projectile_Impact_Patch: {ex}"); return true; } } @@ -76,7 +76,7 @@ namespace WulaFallenEmpire.HarmonyPatches } catch (Exception ex) { - Log.Error($"Error in GetInterceptorsOnPawn: {ex}"); + WulaLog.Debug($"Error in GetInterceptorsOnPawn: {ex}"); } return result; diff --git a/Source/WulaFallenEmpire/HarmonyPatches/ScenPart_PlayerPawnsArriveMethod_Patch.cs b/Source/WulaFallenEmpire/HarmonyPatches/ScenPart_PlayerPawnsArriveMethod_Patch.cs index 52ead4c5..7017e775 100644 --- a/Source/WulaFallenEmpire/HarmonyPatches/ScenPart_PlayerPawnsArriveMethod_Patch.cs +++ b/Source/WulaFallenEmpire/HarmonyPatches/ScenPart_PlayerPawnsArriveMethod_Patch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld; using System.Collections.Generic; using System.Reflection; @@ -74,18 +74,18 @@ namespace WulaFallenEmpire false, // canTransfer Faction.OfPlayer // faction }); - Log.Message("[WULA] Successfully called DropThingGroupsNear with faction parameter via reflection"); + WulaLog.Debug("[WULA] Successfully called DropThingGroupsNear with faction parameter via reflection"); } else { - Log.Error("[WULA] Could not find 11-parameter DropThingGroupsNear method"); + WulaLog.Debug("[WULA] Could not find 11-parameter DropThingGroupsNear method"); } // 返回 false 来跳过原方法的执行 return false; } catch (System.Exception ex) { - Log.Error($"[WULA] Error in DoDropPods prefix: {ex}"); + WulaLog.Debug($"[WULA] Error in DoDropPods prefix: {ex}"); // 如果出错,让原方法继续执行 return true; } diff --git a/Source/WulaFallenEmpire/HarmonyPatches/WULA_AutonomousMech/Patch_CaravanFormingUtility_AllSendablePawns.cs b/Source/WulaFallenEmpire/HarmonyPatches/WULA_AutonomousMech/Patch_CaravanFormingUtility_AllSendablePawns.cs index 58d3cee1..6765fad7 100644 --- a/Source/WulaFallenEmpire/HarmonyPatches/WULA_AutonomousMech/Patch_CaravanFormingUtility_AllSendablePawns.cs +++ b/Source/WulaFallenEmpire/HarmonyPatches/WULA_AutonomousMech/Patch_CaravanFormingUtility_AllSendablePawns.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld; using RimWorld.Planet; // 关键修复 using System.Collections.Generic; @@ -17,7 +17,7 @@ namespace WulaFallenEmpire return; } - Log.Message("[WULA] Patch_CaravanFormingUtility_AllSendablePawns Postfix - Start checking for autonomous mechs..."); + WulaLog.Debug("[WULA] Patch_CaravanFormingUtility_AllSendablePawns Postfix - Start checking for autonomous mechs..."); // 遍历地图上所有的Pawn foreach (Pawn pawn in map.mapPawns.AllPawns) @@ -29,17 +29,17 @@ namespace WulaFallenEmpire var comp = pawn.GetComp(); bool canBeAutonomous = comp != null && comp.CanBeAutonomous; - Log.Message($"[WULA] Checking Mech: {pawn.LabelCap}, Already in list: {alreadyInList}, Has CompAutonomousMech: {comp != null}, CanBeAutonomous: {canBeAutonomous}"); + WulaLog.Debug($"[WULA] Checking Mech: {pawn.LabelCap}, Already in list: {alreadyInList}, Has CompAutonomousMech: {comp != null}, CanBeAutonomous: {canBeAutonomous}"); // 如果它是一个可以自主行动的机械体,但没有被原版方法包含,我们就添加它 if (!alreadyInList && canBeAutonomous) { __result.Add(pawn); - Log.Message($"[WULA] -> Added {pawn.LabelCap} to the list."); + WulaLog.Debug($"[WULA] -> Added {pawn.LabelCap} to the list."); } } } - Log.Message("[WULA] Patch_CaravanFormingUtility_AllSendablePawns Postfix - Finished."); + WulaLog.Debug("[WULA] Patch_CaravanFormingUtility_AllSendablePawns Postfix - Finished."); } } } \ No newline at end of file diff --git a/Source/WulaFallenEmpire/HarmonyPatches/WulaSpeciesCorpsePatch.cs b/Source/WulaFallenEmpire/HarmonyPatches/WulaSpeciesCorpsePatch.cs index 7d0de62f..5c600360 100644 --- a/Source/WulaFallenEmpire/HarmonyPatches/WulaSpeciesCorpsePatch.cs +++ b/Source/WulaFallenEmpire/HarmonyPatches/WulaSpeciesCorpsePatch.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld; using System.Collections.Generic; using System.Linq; @@ -30,7 +30,7 @@ namespace WulaFallenEmpire { if (corpseDef == null) return; - Log.Message($"[WulaSpecies] Starting corpse modification for WulaSpecies"); + WulaLog.Debug($"[WulaSpecies] Starting corpse modification for WulaSpecies"); // 1. 移除腐烂组件(如果存在) RemoveCompProperties(corpseDef, typeof(CompProperties_Rottable)); @@ -42,13 +42,13 @@ namespace WulaFallenEmpire if (corpseDef.ingestible != null) { corpseDef.ingestible.preferability = FoodPreferability.NeverForNutrition; - Log.Message($"[WulaSpecies] Set ingestible preferability to NeverForNutrition"); + WulaLog.Debug($"[WulaSpecies] Set ingestible preferability to NeverForNutrition"); } // 4. 移除 HarbingerTreeConsumable 组件(如果存在) RemoveCompProperties(corpseDef, typeof(CompProperties), "CompHarbingerTreeConsumable"); - Log.Message($"[WulaSpecies] Completed corpse modification for WulaSpecies"); + WulaLog.Debug($"[WulaSpecies] Completed corpse modification for WulaSpecies"); } /// @@ -65,19 +65,19 @@ namespace WulaFallenEmpire if (comp.GetType() == compType) { compsToRemove.Add(comp); - Log.Message($"[WulaSpecies] Found and will remove component: {comp.GetType().Name}"); + WulaLog.Debug($"[WulaSpecies] Found and will remove component: {comp.GetType().Name}"); } else if (!string.IsNullOrEmpty(compClassName) && comp.compClass?.Name == compClassName) { compsToRemove.Add(comp); - Log.Message($"[WulaSpecies] Found and will remove component by class name: {compClassName}"); + WulaLog.Debug($"[WulaSpecies] Found and will remove component by class name: {compClassName}"); } } foreach (var comp in compsToRemove) { thingDef.comps.Remove(comp); - Log.Message($"[WulaSpecies] Removed component: {comp.GetType().Name}"); + WulaLog.Debug($"[WulaSpecies] Removed component: {comp.GetType().Name}"); } } } diff --git a/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_DisappearWithEffect.cs b/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_DisappearWithEffect.cs index 6bdad267..9517df2f 100644 --- a/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_DisappearWithEffect.cs +++ b/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_DisappearWithEffect.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using Verse.Sound; @@ -85,11 +85,11 @@ namespace WulaFallenEmpire // 5. 暴力删除 pawn DestroyPawn(); - Log.Message($"[DisappearWithEffect] Pawn {Pawn.LabelCap} destroyed at {position}"); + WulaLog.Debug($"[DisappearWithEffect] Pawn {Pawn.LabelCap} destroyed at {position}"); } catch (System.Exception ex) { - Log.Error($"[DisappearWithEffect] Error in TriggerDisappearEffect: {ex}"); + WulaLog.Debug($"[DisappearWithEffect] Error in TriggerDisappearEffect: {ex}"); } } @@ -211,11 +211,11 @@ namespace WulaFallenEmpire // 直接调用 Destroy,绕过所有死亡逻辑 Pawn.Destroy(DestroyMode.Vanish); - Log.Message($"[DisappearWithEffect] Pawn {Pawn.LabelCap} destroyed"); + WulaLog.Debug($"[DisappearWithEffect] Pawn {Pawn.LabelCap} destroyed"); } catch (System.Exception ex) { - Log.Error($"[DisappearWithEffect] Error destroying pawn: {ex}"); + WulaLog.Debug($"[DisappearWithEffect] Error destroying pawn: {ex}"); } } diff --git a/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_NanoRepair.cs b/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_NanoRepair.cs index 85a6e988..4a6a622c 100644 --- a/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_NanoRepair.cs +++ b/Source/WulaFallenEmpire/HediffComp/HediffCompProperties_NanoRepair.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using UnityEngine; @@ -400,7 +400,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[NanoRepair] 修复部位 {part.def.defName} 时出错: {ex}"); + WulaLog.Debug($"[NanoRepair] 修复部位 {part.def.defName} 时出错: {ex}"); return false; } } @@ -470,7 +470,7 @@ namespace WulaFallenEmpire HediffDef injuryDef = DefDatabase.GetNamedSilentFail("Crush"); if (injuryDef == null) { - Log.Error($"[NanoRepair] 找不到指定的hediff定义: Crush"); + WulaLog.Debug($"[NanoRepair] 找不到指定的hediff定义: Crush"); return false; } @@ -484,7 +484,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[NanoRepair] 转换缺失部件 {missingPart.Part.def.defName} 时出错: {ex}"); + WulaLog.Debug($"[NanoRepair] 转换缺失部件 {missingPart.Part.def.defName} 时出错: {ex}"); return false; } } diff --git a/Source/WulaFallenEmpire/HediffComp/HediffComp_GiveHediffsInRangeToRace.cs b/Source/WulaFallenEmpire/HediffComp/HediffComp_GiveHediffsInRangeToRace.cs index 54190a79..0246b892 100644 --- a/Source/WulaFallenEmpire/HediffComp/HediffComp_GiveHediffsInRangeToRace.cs +++ b/Source/WulaFallenEmpire/HediffComp/HediffComp_GiveHediffsInRangeToRace.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using UnityEngine; using Verse; @@ -51,7 +51,7 @@ namespace WulaFallenEmpire 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"); + WulaLog.Debug("HediffComp_GiveHediffsInRangeToRace has a hediff in props which does not have a HediffComp_Disappears"); } else { diff --git a/Source/WulaFallenEmpire/HediffComp/HediffComp_RegenerateBackstory.cs b/Source/WulaFallenEmpire/HediffComp/HediffComp_RegenerateBackstory.cs index 177e9332..5fa570fc 100644 --- a/Source/WulaFallenEmpire/HediffComp/HediffComp_RegenerateBackstory.cs +++ b/Source/WulaFallenEmpire/HediffComp/HediffComp_RegenerateBackstory.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Verse; using RimWorld; @@ -36,7 +36,7 @@ namespace WulaFallenEmpire Pawn pawn = this.parent.pawn; if (pawn == null || pawn.story == null) { - Log.Warning($"[WulaFallenEmpire] HediffComp_RegenerateBackstory: Pawn or Pawn.story is null for hediff {this.parent.def.defName}. Cannot regenerate backstory."); + WulaLog.Debug($"[WulaFallenEmpire] HediffComp_RegenerateBackstory: Pawn or Pawn.story is null for hediff {this.parent.def.defName}. Cannot regenerate backstory."); return; } @@ -48,7 +48,7 @@ namespace WulaFallenEmpire } else { - Log.Warning($"[WulaFallenEmpire] HediffComp_RegenerateBackstory: No spawnCategories specified for hediff {this.parent.def.defName}. Using all available categories."); + WulaLog.Debug($"[WulaFallenEmpire] HediffComp_RegenerateBackstory: No spawnCategories specified for hediff {this.parent.def.defName}. Using all available categories."); categories = DefDatabase.AllDefs.SelectMany(bs => bs.spawnCategories).Distinct().ToList(); // 如果没有指定类别,则使用所有类别 } @@ -71,7 +71,7 @@ namespace WulaFallenEmpire } else { - Log.Warning($"[WulaFallenEmpire] HediffComp_RegenerateBackstory: No childhood backstories found for categories: {string.Join(", ", Props.spawnCategories ?? new List())}."); + WulaLog.Debug($"[WulaFallenEmpire] HediffComp_RegenerateBackstory: No childhood backstories found for categories: {string.Join(", ", Props.spawnCategories ?? new List())}."); } } else { @@ -92,7 +92,7 @@ namespace WulaFallenEmpire } else { - Log.Warning($"[WulaFallenEmpire] HediffComp_RegenerateBackstory: No adulthood backstories found for categories: {string.Join(", ", Props.spawnCategories ?? new List())}."); + WulaLog.Debug($"[WulaFallenEmpire] HediffComp_RegenerateBackstory: No adulthood backstories found for categories: {string.Join(", ", Props.spawnCategories ?? new List())}."); } // 应用新的背景故事 @@ -100,16 +100,16 @@ namespace WulaFallenEmpire { pawn.story.Childhood = newChildhood; pawn.story.Adulthood = newAdulthood; - Log.Message($"[WulaFallenEmpire] Regenerated backstory for {pawn.NameShortColored}: Childhood='{newChildhood?.title ?? "None"}', Adulthood='{newAdulthood?.title ?? "None"}'."); + WulaLog.Debug($"[WulaFallenEmpire] Regenerated backstory for {pawn.NameShortColored}: Childhood='{newChildhood?.title ?? "None"}', Adulthood='{newAdulthood?.title ?? "None"}'."); } else { - Log.Warning($"[WulaFallenEmpire] HediffComp_RegenerateBackstory: Failed to find any suitable backstories for {pawn.NameShortColored} with categories: {string.Join(", ", Props.spawnCategories ?? new List())}."); + WulaLog.Debug($"[WulaFallenEmpire] HediffComp_RegenerateBackstory: Failed to find any suitable backstories for {pawn.NameShortColored} with categories: {string.Join(", ", Props.spawnCategories ?? new List())}."); } // 删除当前的Hediff pawn.health.RemoveHediff(this.parent); - Log.Message($"[WulaFallenEmpire] Removed hediff {this.parent.def.defName} from {pawn.NameShortColored} after backstory regeneration."); + WulaLog.Debug($"[WulaFallenEmpire] Removed hediff {this.parent.def.defName} from {pawn.NameShortColored} after backstory regeneration."); } } } \ No newline at end of file diff --git a/Source/WulaFallenEmpire/HediffComp/WULA_HediffComp_TopTurret/HediffComp_TopTurret.cs b/Source/WulaFallenEmpire/HediffComp/WULA_HediffComp_TopTurret/HediffComp_TopTurret.cs index 9660b1bd..7c18e414 100644 --- a/Source/WulaFallenEmpire/HediffComp/WULA_HediffComp_TopTurret/HediffComp_TopTurret.cs +++ b/Source/WulaFallenEmpire/HediffComp/WULA_HediffComp_TopTurret/HediffComp_TopTurret.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using UnityEngine; using Verse; @@ -315,7 +315,7 @@ namespace WulaFallenEmpire { if (this.gun == null) { - Log.Error("CompTurrentGun had null gun after loading. Recreating."); + WulaLog.Debug("CompTurrentGun had null gun after loading. Recreating."); this.MakeGun(); return; } diff --git a/Source/WulaFallenEmpire/HediffComp/WULA_HediffSpawner/Tools.cs b/Source/WulaFallenEmpire/HediffComp/WULA_HediffSpawner/Tools.cs index 7f6e9b8e..1f64d2de 100644 --- a/Source/WulaFallenEmpire/HediffComp/WULA_HediffSpawner/Tools.cs +++ b/Source/WulaFallenEmpire/HediffComp/WULA_HediffSpawner/Tools.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using RimWorld; using UnityEngine; @@ -12,7 +12,7 @@ namespace WulaFallenEmpire { if (parentHediff.pawn != null && parentHediff.def.defName != null && debug) { - Log.Warning(parentHediff.pawn.Label + "'s Hediff: " + parentHediff.def.defName + " says goodbye."); + WulaLog.Debug(parentHediff.pawn.Label + "'s Hediff: " + parentHediff.def.defName + " says goodbye."); } parentHediff.Severity = 0f; } @@ -24,14 +24,14 @@ namespace WulaFallenEmpire { if (debug) { - Log.Warning("GetPawnAgeOverlifeExpectancyRatio pawn NOT OK"); + WulaLog.Debug("GetPawnAgeOverlifeExpectancyRatio pawn NOT OK"); } return result; } result = pawn.ageTracker.AgeBiologicalYearsFloat / pawn.RaceProps.lifeExpectancy; if (debug) { - Log.Warning(string.Concat(new string[] + WulaLog.Debug(string.Concat(new string[] { pawn.Label, " Age: ", @@ -51,7 +51,7 @@ namespace WulaFallenEmpire { if (debug) { - Log.Warning("pawn is null - wounded "); + WulaLog.Debug("pawn is null - wounded "); } return false; } @@ -66,7 +66,7 @@ namespace WulaFallenEmpire } if (debug && num > 0f) { - Log.Warning(pawn.Label + " is wounded "); + WulaLog.Debug(pawn.Label + " is wounded "); } return num > 0f; } @@ -77,14 +77,14 @@ namespace WulaFallenEmpire { if (debug) { - Log.Warning("pawn is null - IsHungry "); + WulaLog.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 "); + WulaLog.Debug(pawn.Label + " is hungry "); } return flag; } @@ -98,7 +98,7 @@ namespace WulaFallenEmpire { if (debug) { - Log.Warning(warning); + WulaLog.Debug(warning); } } diff --git a/Source/WulaFallenEmpire/Job/JobDriver_InspectBuilding.cs b/Source/WulaFallenEmpire/Job/JobDriver_InspectBuilding.cs index e239c6ff..7ea9ff13 100644 --- a/Source/WulaFallenEmpire/Job/JobDriver_InspectBuilding.cs +++ b/Source/WulaFallenEmpire/Job/JobDriver_InspectBuilding.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using Verse; using Verse.AI; @@ -51,7 +51,7 @@ namespace WulaFallenEmpire // 记录日志 if (Prefs.DevMode) { - Log.Message($"[JobDriver_InspectBuilding] {pawn.Name} started inspecting {TargetThingA.Label} for {ticksLeft} ticks"); + WulaLog.Debug($"[JobDriver_InspectBuilding] {pawn.Name} started inspecting {TargetThingA.Label} for {ticksLeft} ticks"); } }; @@ -99,7 +99,7 @@ namespace WulaFallenEmpire if (Prefs.DevMode) { - Log.Message($"[JobDriver_InspectBuilding] {pawn.Name} completed inspection of {TargetThingA.Label}"); + WulaLog.Debug($"[JobDriver_InspectBuilding] {pawn.Name} completed inspection of {TargetThingA.Label}"); } } diff --git a/Source/WulaFallenEmpire/Job/JobGiver_InspectBuilding.cs b/Source/WulaFallenEmpire/Job/JobGiver_InspectBuilding.cs index 30513f24..8d83ddc1 100644 --- a/Source/WulaFallenEmpire/Job/JobGiver_InspectBuilding.cs +++ b/Source/WulaFallenEmpire/Job/JobGiver_InspectBuilding.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using RimWorld.Planet; using System.Collections.Generic; using System.Linq; @@ -63,7 +63,7 @@ namespace WulaFallenEmpire // 记录调试信息 if (Prefs.DevMode) { - Log.Message($"[JobGiver_InspectBuilding] Assigned inspection job to {pawn.Name} at {inspectionTarget.Label}"); + WulaLog.Debug($"[JobGiver_InspectBuilding] Assigned inspection job to {pawn.Name} at {inspectionTarget.Label}"); } return job; @@ -107,7 +107,7 @@ namespace WulaFallenEmpire { int remainingTicks = minIntervalTicks - elapsedTicks; float remainingSeconds = remainingTicks / 60f; - Log.Message($"[JobGiver_InspectBuilding] {pawn.Name} must wait {remainingSeconds:F1} seconds before next inspection"); + WulaLog.Debug($"[JobGiver_InspectBuilding] {pawn.Name} must wait {remainingSeconds:F1} seconds before next inspection"); } return canInspect; @@ -122,7 +122,7 @@ namespace WulaFallenEmpire if (Prefs.DevMode) { - Log.Message($"[JobGiver_InspectBuilding] Recorded inspection start for {pawn.Name} at tick {lastInspectionTicks[pawn]}"); + WulaLog.Debug($"[JobGiver_InspectBuilding] Recorded inspection start for {pawn.Name} at tick {lastInspectionTicks[pawn]}"); } } @@ -158,7 +158,7 @@ namespace WulaFallenEmpire { if (Prefs.DevMode) { - Log.Message($"[JobGiver_InspectBuilding] No valid inspection targets found for {pawn.Name}"); + WulaLog.Debug($"[JobGiver_InspectBuilding] No valid inspection targets found for {pawn.Name}"); } return null; } @@ -168,7 +168,7 @@ namespace WulaFallenEmpire if (Prefs.DevMode) { - Log.Message($"[JobGiver_InspectBuilding] Randomly selected {selectedBuilding.Label} from {validBuildings.Count} valid targets"); + WulaLog.Debug($"[JobGiver_InspectBuilding] Randomly selected {selectedBuilding.Label} from {validBuildings.Count} valid targets"); } return selectedBuilding; @@ -228,7 +228,7 @@ namespace WulaFallenEmpire { if (Prefs.DevMode) { - Log.Message($"[JobGiver_InspectBuilding] Excluding wall: {thing.Label}"); + WulaLog.Debug($"[JobGiver_InspectBuilding] Excluding wall: {thing.Label}"); } return true; } @@ -283,7 +283,7 @@ namespace WulaFallenEmpire if (Prefs.DevMode && toRemove.Count > 0) { - Log.Message($"[JobGiver_InspectBuilding] Cleaned up {toRemove.Count} inspection records"); + WulaLog.Debug($"[JobGiver_InspectBuilding] Cleaned up {toRemove.Count} inspection records"); } } diff --git a/Source/WulaFallenEmpire/Pawn/Comp_MultiTurretGun.cs b/Source/WulaFallenEmpire/Pawn/Comp_MultiTurretGun.cs index 2ad4d4bf..24911777 100644 --- a/Source/WulaFallenEmpire/Pawn/Comp_MultiTurretGun.cs +++ b/Source/WulaFallenEmpire/Pawn/Comp_MultiTurretGun.cs @@ -57,7 +57,7 @@ namespace WulaFallenEmpire { if (gun == null) { - Log.Error("CompTurrentGun had null gun after loading. Recreating."); + WulaLog.Debug("CompTurrentGun had null gun after loading. Recreating."); MakeGun(); } else diff --git a/Source/WulaFallenEmpire/Pawn/WULA_AutonomousMech/CompAutonomousMech.cs b/Source/WulaFallenEmpire/Pawn/WULA_AutonomousMech/CompAutonomousMech.cs index ef406cf1..e6542913 100644 --- a/Source/WulaFallenEmpire/Pawn/WULA_AutonomousMech/CompAutonomousMech.cs +++ b/Source/WulaFallenEmpire/Pawn/WULA_AutonomousMech/CompAutonomousMech.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using UnityEngine; using Verse; @@ -251,14 +251,14 @@ namespace WulaFallenEmpire // 确保Command不为null if (switchWeaponCommand == null) { - Log.Error($"Failed to create weapon switch gizmo for {MechPawn?.LabelCap}"); + WulaLog.Debug($"Failed to create weapon switch gizmo for {MechPawn?.LabelCap}"); return null; } return switchWeaponCommand; } catch (System.Exception ex) { - Log.Error($"Error creating weapon switch gizmo: {ex}"); + WulaLog.Debug($"Error creating weapon switch gizmo: {ex}"); return null; } } @@ -282,7 +282,7 @@ namespace WulaFallenEmpire if (Prefs.DevMode) { - Log.Message($"[CompAutonomousMech] {MechPawn.LabelCap} dropped weapon: {currentWeapon.LabelCap}"); + WulaLog.Debug($"[CompAutonomousMech] {MechPawn.LabelCap} dropped weapon: {currentWeapon.LabelCap}"); } } @@ -302,7 +302,7 @@ namespace WulaFallenEmpire if (Prefs.DevMode) { - Log.Message($"[CompAutonomousMech] {MechPawn.LabelCap} equipped new weapon: {newWeaponDef.LabelCap}"); + WulaLog.Debug($"[CompAutonomousMech] {MechPawn.LabelCap} equipped new weapon: {newWeaponDef.LabelCap}"); } } } @@ -314,7 +314,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[CompAutonomousMech] Error switching weapon for {MechPawn?.LabelCap}: {ex}"); + WulaLog.Debug($"[CompAutonomousMech] Error switching weapon for {MechPawn?.LabelCap}: {ex}"); } } diff --git a/Source/WulaFallenEmpire/Pawn/WULA_AutonomousMech/ThinkNode_ConditionalAutonomousWorkMode.cs b/Source/WulaFallenEmpire/Pawn/WULA_AutonomousMech/ThinkNode_ConditionalAutonomousWorkMode.cs index 9c2fe585..c1760f30 100644 --- a/Source/WulaFallenEmpire/Pawn/WULA_AutonomousMech/ThinkNode_ConditionalAutonomousWorkMode.cs +++ b/Source/WulaFallenEmpire/Pawn/WULA_AutonomousMech/ThinkNode_ConditionalAutonomousWorkMode.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using Verse.AI; @@ -28,7 +28,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"[WULA] Exception in ThinkNode_ConditionalAutonomousWorkMode.Satisfied for pawn {pawn?.LabelShort}: {ex}"); + WulaLog.Debug($"[WULA] Exception in ThinkNode_ConditionalAutonomousWorkMode.Satisfied for pawn {pawn?.LabelShort}: {ex}"); return false; } } diff --git a/Source/WulaFallenEmpire/Pawn/WULA_Cat_Invisible/CompFighterInvisible.cs b/Source/WulaFallenEmpire/Pawn/WULA_Cat_Invisible/CompFighterInvisible.cs index 52239782..37c9610f 100644 --- a/Source/WulaFallenEmpire/Pawn/WULA_Cat_Invisible/CompFighterInvisible.cs +++ b/Source/WulaFallenEmpire/Pawn/WULA_Cat_Invisible/CompFighterInvisible.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using UnityEngine; using Verse; @@ -255,7 +255,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Error($"CompFighterInvisible: Error sending letter for {Sightstealer?.LabelCap}: {ex}"); + WulaLog.Debug($"CompFighterInvisible: Error sending letter for {Sightstealer?.LabelCap}: {ex}"); } } diff --git a/Source/WulaFallenEmpire/Pawn/WULA_CompHediffGiver/CompHediffGiver.cs b/Source/WulaFallenEmpire/Pawn/WULA_CompHediffGiver/CompHediffGiver.cs index e82124fb..600698bc 100644 --- a/Source/WulaFallenEmpire/Pawn/WULA_CompHediffGiver/CompHediffGiver.cs +++ b/Source/WulaFallenEmpire/Pawn/WULA_CompHediffGiver/CompHediffGiver.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Verse; using RimWorld; @@ -63,7 +63,7 @@ namespace WulaFallenEmpire { AddHediffsToPawn(pawn); hediffsApplied = true; - Log.Message($"Debug: Applied hediffs to {pawn.Label}"); + WulaLog.Debug($"Debug: Applied hediffs to {pawn.Label}"); } } } diff --git a/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/JobDriver_HaulToMaintenancePod.cs b/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/JobDriver_HaulToMaintenancePod.cs index f836377b..0852831f 100644 --- a/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/JobDriver_HaulToMaintenancePod.cs +++ b/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/JobDriver_HaulToMaintenancePod.cs @@ -1,4 +1,4 @@ -// JobDriver_HaulToMaintenancePod.cs (修复版) +// JobDriver_HaulToMaintenancePod.cs (修复版) using System.Collections.Generic; using RimWorld; using Verse; @@ -41,14 +41,14 @@ namespace WulaFallenEmpire { if (Takee == null || Takee.Destroyed) { - Log.Error("试图搬运不存在的Pawn"); + WulaLog.Debug("试图搬运不存在的Pawn"); return; } // 使用TryStartCarryThing并明确指定数量 if (pawn.carryTracker.TryStartCarry(Takee, 1) <= 0) { - Log.Error($"无法搬运Pawn: {Takee.Label}"); + WulaLog.Debug($"无法搬运Pawn: {Takee.Label}"); EndJobWith(JobCondition.Incompletable); } } diff --git a/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/Need_Maintenance.cs b/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/Need_Maintenance.cs index a621feba..3849a7dd 100644 --- a/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/Need_Maintenance.cs +++ b/Source/WulaFallenEmpire/Pawn/WULA_Maintenance/Need_Maintenance.cs @@ -1,4 +1,4 @@ -// Need_Maintenance.cs +// Need_Maintenance.cs using RimWorld; using Verse; using System.Linq; @@ -120,7 +120,7 @@ namespace WulaFallenEmpire // 情况1:没有 Hediff,但应该有 if (expectedStatus != MaintenanceStatus.Operational && actualHediffs.Count == 0) { - Log.Warning($"[Maintenance] Validation: {pawn.Label} should have {expectedStatus} hediff but has none. Reapplying."); + WulaLog.Debug($"[Maintenance] Validation: {pawn.Label} should have {expectedStatus} hediff but has none. Reapplying."); UpdateHediffForStatus(expectedStatus); return; } @@ -128,7 +128,7 @@ namespace WulaFallenEmpire // 情况2:有 Hediff,但不应该有 if (expectedStatus == MaintenanceStatus.Operational && actualHediffs.Count > 0) { - Log.Warning($"[Maintenance] Validation: {pawn.Label} is operational but has maintenance hediffs. Removing all."); + WulaLog.Debug($"[Maintenance] Validation: {pawn.Label} is operational but has maintenance hediffs. Removing all."); RemoveAllMaintenanceHediffs(); currentAppliedStatus = MaintenanceStatus.Operational; currentAppliedHediff = null; @@ -138,7 +138,7 @@ namespace WulaFallenEmpire // 情况3:有多个 Hediff if (actualHediffs.Count > 1) { - Log.Warning($"[Maintenance] Validation: {pawn.Label} has multiple maintenance hediffs ({actualHediffs.Count}). Cleaning up."); + WulaLog.Debug($"[Maintenance] Validation: {pawn.Label} has multiple maintenance hediffs ({actualHediffs.Count}). Cleaning up."); CleanupMultipleHediffs(expectedStatus); return; } @@ -151,7 +151,7 @@ namespace WulaFallenEmpire if (currentHediff.def != expectedHediffDef) { - Log.Warning($"[Maintenance] Validation: {pawn.Label} has wrong hediff type. Expected {expectedHediffDef?.defName}, got {currentHediff.def.defName}. Correcting."); + WulaLog.Debug($"[Maintenance] Validation: {pawn.Label} has wrong hediff type. Expected {expectedHediffDef?.defName}, got {currentHediff.def.defName}. Correcting."); UpdateHediffForStatus(expectedStatus); return; } @@ -160,14 +160,14 @@ namespace WulaFallenEmpire if (currentAppliedHediff != currentHediff) { currentAppliedHediff = currentHediff; - Log.Message($"[Maintenance] Validation: Updated currentAppliedHediff reference for {pawn.Label}"); + WulaLog.Debug($"[Maintenance] Validation: Updated currentAppliedHediff reference for {pawn.Label}"); } } // 情况5:状态记录不一致 if (currentAppliedStatus != expectedStatus) { - Log.Warning($"[Maintenance] Validation: {pawn.Label} status mismatch. Recorded: {currentAppliedStatus}, Actual: {expectedStatus}. Synchronizing."); + WulaLog.Debug($"[Maintenance] Validation: {pawn.Label} status mismatch. Recorded: {currentAppliedStatus}, Actual: {expectedStatus}. Synchronizing."); currentAppliedStatus = expectedStatus; } } @@ -248,7 +248,7 @@ namespace WulaFallenEmpire { if (Prefs.DevMode) { - Log.Message($"[Maintenance] Status changed for {pawn.Label}: {currentAppliedStatus} -> {newStatus}"); + WulaLog.Debug($"[Maintenance] Status changed for {pawn.Label}: {currentAppliedStatus} -> {newStatus}"); } UpdateHediffForStatus(newStatus); @@ -273,7 +273,7 @@ namespace WulaFallenEmpire // 调试日志 if (Prefs.DevMode) { - Log.Message($"[Maintenance] Applied {hediffDefToAdd.defName} for status {status} to {pawn.Label}"); + WulaLog.Debug($"[Maintenance] Applied {hediffDefToAdd.defName} for status {status} to {pawn.Label}"); } } else if (status == MaintenanceStatus.Operational) @@ -281,7 +281,7 @@ namespace WulaFallenEmpire // 操作状态,不需要 Hediff if (Prefs.DevMode) { - Log.Message($"[Maintenance] {pawn.Label} is operational, no hediff needed"); + WulaLog.Debug($"[Maintenance] {pawn.Label} is operational, no hediff needed"); } } } diff --git a/Source/WulaFallenEmpire/PawnsArrivalMode/PawnsArrivalModeWorker_EdgeTeleport.cs b/Source/WulaFallenEmpire/PawnsArrivalMode/PawnsArrivalModeWorker_EdgeTeleport.cs index 3dcb17b6..66033c8d 100644 --- a/Source/WulaFallenEmpire/PawnsArrivalMode/PawnsArrivalModeWorker_EdgeTeleport.cs +++ b/Source/WulaFallenEmpire/PawnsArrivalMode/PawnsArrivalModeWorker_EdgeTeleport.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using RimWorld; using Verse; using Verse.AI; @@ -133,7 +133,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"Failed to play teleport effect for {pawn?.LabelCap}: {ex}"); + WulaLog.Debug($"Failed to play teleport effect for {pawn?.LabelCap}: {ex}"); } } diff --git a/Source/WulaFallenEmpire/Placeworker/CompProperties_CustomRadius.cs b/Source/WulaFallenEmpire/Placeworker/CompProperties_CustomRadius.cs index 64f454cc..ca3f8375 100644 --- a/Source/WulaFallenEmpire/Placeworker/CompProperties_CustomRadius.cs +++ b/Source/WulaFallenEmpire/Placeworker/CompProperties_CustomRadius.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using UnityEngine; using Verse; using System.Collections.Generic; @@ -188,12 +188,12 @@ namespace WulaFallenEmpire } else { - Log.Warning("[CustomRadius] Could not find MapInterface.MapInterfaceUpdate method"); + WulaLog.Debug("[CustomRadius] Could not find MapInterface.MapInterfaceUpdate method"); } } catch (System.Exception ex) { - Log.Error($"[CustomRadius] Error in static constructor: {ex}"); + WulaLog.Debug($"[CustomRadius] Error in static constructor: {ex}"); } } @@ -252,12 +252,12 @@ namespace WulaFallenEmpire } else { - Log.Warning("[CustomRadius] Could not find SelectionDrawer.DrawSelectionOverlays method"); + WulaLog.Debug("[CustomRadius] Could not find SelectionDrawer.DrawSelectionOverlays method"); } } catch (System.Exception ex) { - Log.Error($"[CustomRadius] Error in static constructor: {ex}"); + WulaLog.Debug($"[CustomRadius] Error in static constructor: {ex}"); } } diff --git a/Source/WulaFallenEmpire/Projectiles/Projectile_WulaPenetratingBeam.cs b/Source/WulaFallenEmpire/Projectiles/Projectile_WulaPenetratingBeam.cs index ed7d4802..40464e92 100644 --- a/Source/WulaFallenEmpire/Projectiles/Projectile_WulaPenetratingBeam.cs +++ b/Source/WulaFallenEmpire/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 WulaFallenEmpire Wula_BeamPierce_Extension props = Props; if (props == null) { - Log.Error("Projectile_WulaBeam requires a Wula_BeamPierce_Extension in its def."); + WulaLog.Debug("Projectile_WulaBeam requires a Wula_BeamPierce_Extension in its def."); Destroy(DestroyMode.Vanish); return; } diff --git a/Source/WulaFallenEmpire/QuestNodes/QuestNode_AddInspectionJob.cs b/Source/WulaFallenEmpire/QuestNodes/QuestNode_AddInspectionJob.cs index 2c5fffe2..562cb8d3 100644 --- a/Source/WulaFallenEmpire/QuestNodes/QuestNode_AddInspectionJob.cs +++ b/Source/WulaFallenEmpire/QuestNodes/QuestNode_AddInspectionJob.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using RimWorld.QuestGen; using Verse; using Verse.AI; @@ -18,7 +18,7 @@ namespace WulaFallenEmpire { if (inspectionJobDef.GetValue(slate) == null) { - Log.Error("[QuestNode_AddInspectionJob] inspectionJobDef is null"); + WulaLog.Debug("[QuestNode_AddInspectionJob] inspectionJobDef is null"); return false; } @@ -33,7 +33,7 @@ namespace WulaFallenEmpire Pawn pawnValue = pawn.GetValue(slate); if (pawnValue == null) { - Log.Error("[QuestNode_AddInspectionJob] pawn is null"); + WulaLog.Debug("[QuestNode_AddInspectionJob] pawn is null"); return; } @@ -43,7 +43,7 @@ namespace WulaFallenEmpire // 如果 Pawn 无效或未生成,记录调试信息但不报错 if (QuestGen.slate.Get("debugLogging", false)) { - Log.Message($"[QuestNode_AddInspectionJob] Pawn {pawnValue.Name} is not ready for job assignment (Destroyed: {pawnValue.Destroyed}, Spawned: {pawnValue.Spawned}, Map: {pawnValue.Map?.Index ?? -1})"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] Pawn {pawnValue.Name} is not ready for job assignment (Destroyed: {pawnValue.Destroyed}, Spawned: {pawnValue.Spawned}, Map: {pawnValue.Map?.Index ?? -1})"); } return; } @@ -59,14 +59,14 @@ namespace WulaFallenEmpire if (QuestGen.slate.Get("debugLogging", false)) { - Log.Message($"[QuestNode_AddInspectionJob] Assigned inspection job to {pawnValue.Name} at position {pawnValue.Position}"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] Assigned inspection job to {pawnValue.Name} at position {pawnValue.Position}"); } } else { if (QuestGen.slate.Get("debugLogging", false)) { - Log.Message($"[QuestNode_AddInspectionJob] Failed to create inspection job for {pawnValue.Name}"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] Failed to create inspection job for {pawnValue.Name}"); } } } @@ -99,7 +99,7 @@ namespace WulaFallenEmpire { if (QuestGen.slate.Get("debugLogging", false)) { - Log.Message($"[QuestNode_AddInspectionJob] No valid inspection target found for {pawn.Name} on map {pawn.Map}"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] No valid inspection target found for {pawn.Name} on map {pawn.Map}"); } return null; } @@ -123,7 +123,7 @@ namespace WulaFallenEmpire if (QuestGen.slate.Get("debugLogging", false)) { - Log.Message($"[QuestNode_AddInspectionJob] Created inspection job for {pawn.Name} at {inspectionTarget.Label} (Position: {inspectionTarget.Position})"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] Created inspection job for {pawn.Name} at {inspectionTarget.Label} (Position: {inspectionTarget.Position})"); } return job; @@ -139,8 +139,8 @@ namespace WulaFallenEmpire if (QuestGen.slate.Get("debugLogging", false)) { - Log.Message($"[QuestNode_AddInspectionJob] Searching for inspection target for {pawn.Name}"); - Log.Message($"[QuestNode_AddInspectionJob] Require player owned: {requirePlayerOwnedValue}, Require accessible: {requireAccessibleValue}"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] Searching for inspection target for {pawn.Name}"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] Require player owned: {requirePlayerOwnedValue}, Require accessible: {requireAccessibleValue}"); } // 寻找玩家拥有的建筑 @@ -158,11 +158,11 @@ namespace WulaFallenEmpire { if (target != null) { - Log.Message($"[QuestNode_AddInspectionJob] Found target: {target.Label} at {target.Position}"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] Found target: {target.Label} at {target.Position}"); } else { - Log.Message($"[QuestNode_AddInspectionJob] No target found within range"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] No target found within range"); } } @@ -183,7 +183,7 @@ namespace WulaFallenEmpire { if (QuestGen.slate.Get("debugLogging", false) && thing.Faction != null) { - Log.Message($"[QuestNode_AddInspectionJob] Target {thing.Label} faction: {thing.Faction.Name}, required: Player"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] Target {thing.Label} faction: {thing.Faction.Name}, required: Player"); } return false; } @@ -193,7 +193,7 @@ namespace WulaFallenEmpire { if (QuestGen.slate.Get("debugLogging", false)) { - Log.Message($"[QuestNode_AddInspectionJob] Target {thing.Label} at {thing.Position} is not reachable by {pawn.Name}"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] Target {thing.Label} at {thing.Position} is not reachable by {pawn.Name}"); } return false; } @@ -212,7 +212,7 @@ namespace WulaFallenEmpire if (QuestGen.slate.Get("debugLogging", false)) { - Log.Message($"[QuestNode_AddInspectionJob] Target {thing.Label} at {thing.Position} is valid"); + WulaLog.Debug($"[QuestNode_AddInspectionJob] Target {thing.Label} at {thing.Position} is valid"); } return true; diff --git a/Source/WulaFallenEmpire/QuestNodes/QuestNode_CheckGlobalResource.cs b/Source/WulaFallenEmpire/QuestNodes/QuestNode_CheckGlobalResource.cs index 919fa320..0ee2db4a 100644 --- a/Source/WulaFallenEmpire/QuestNodes/QuestNode_CheckGlobalResource.cs +++ b/Source/WulaFallenEmpire/QuestNodes/QuestNode_CheckGlobalResource.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using RimWorld.Planet; using System.Collections.Generic; using Verse; @@ -26,20 +26,20 @@ namespace WulaFallenEmpire { if (resourceDef == null || resourceDef.GetValue(slate) == null) { - Log.Error("QuestNode_CheckGlobalResource: resourceDef is null"); + WulaLog.Debug("QuestNode_CheckGlobalResource: resourceDef is null"); return false; } if (requiredCount.GetValue(slate) <= 0) { - Log.Error("QuestNode_CheckGlobalResource: requiredCount must be positive"); + WulaLog.Debug("QuestNode_CheckGlobalResource: requiredCount must be positive"); return false; } var globalStorage = Find.World.GetComponent(); if (globalStorage == null) { - Log.Error("QuestNode_CheckGlobalResource: GlobalStorageWorldComponent not found"); + WulaLog.Debug("QuestNode_CheckGlobalResource: GlobalStorageWorldComponent not found"); return false; } @@ -79,7 +79,7 @@ namespace WulaFallenEmpire quest.AddPart(part); - Log.Message($"QuestNode_CheckGlobalResource: Added resource check for {actualRequiredCount} {actualResourceDef.defName} in {(actualUseInputStorage ? "Input" : "Output")} Storage"); + WulaLog.Debug($"QuestNode_CheckGlobalResource: Added resource check for {actualRequiredCount} {actualResourceDef.defName} in {(actualUseInputStorage ? "Input" : "Output")} Storage"); } } } diff --git a/Source/WulaFallenEmpire/QuestNodes/QuestNode_Hyperlinks.cs b/Source/WulaFallenEmpire/QuestNodes/QuestNode_Hyperlinks.cs index 7a6280c7..f669766b 100644 --- a/Source/WulaFallenEmpire/QuestNodes/QuestNode_Hyperlinks.cs +++ b/Source/WulaFallenEmpire/QuestNodes/QuestNode_Hyperlinks.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using RimWorld.QuestGen; using System.Collections.Generic; using Verse; @@ -56,7 +56,7 @@ namespace WulaFallenEmpire } else { - Log.Warning($"QuestNode_Hyperlinks: Could not find faction for def {factionDef.defName}"); + WulaLog.Debug($"QuestNode_Hyperlinks: Could not find faction for def {factionDef.defName}"); } } } @@ -69,7 +69,7 @@ namespace WulaFallenEmpire // 添加到任务 quest.AddPart(hyperlinksPart); - Log.Message($"QuestNode_Hyperlinks: Added hyperlinks - Things: {actualThingDefs?.Count ?? 0}, Pawns: {actualPawns?.Count ?? 0}, Factions: {actualFactionDefs?.Count ?? 0}, Research: {actualResearchProjects?.Count ?? 0}"); + WulaLog.Debug($"QuestNode_Hyperlinks: Added hyperlinks - Things: {actualThingDefs?.Count ?? 0}, Pawns: {actualPawns?.Count ?? 0}, Factions: {actualFactionDefs?.Count ?? 0}, Research: {actualResearchProjects?.Count ?? 0}"); } } } diff --git a/Source/WulaFallenEmpire/QuestNodes/QuestNode_SpawnPrefabSkyfallerCaller.cs b/Source/WulaFallenEmpire/QuestNodes/QuestNode_SpawnPrefabSkyfallerCaller.cs index c46a2cb4..66323021 100644 --- a/Source/WulaFallenEmpire/QuestNodes/QuestNode_SpawnPrefabSkyfallerCaller.cs +++ b/Source/WulaFallenEmpire/QuestNodes/QuestNode_SpawnPrefabSkyfallerCaller.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using RimWorld; using RimWorld.Planet; @@ -38,14 +38,14 @@ namespace WulaFallenEmpire // 在测试运行中只检查基本条件 if (thingDef.GetValue(slate) == null) { - Log.Warning("[QuestNode] ThingDef is null in TestRun"); + WulaLog.Debug("[QuestNode] ThingDef is null in TestRun"); return false; } var mapValue = map.GetValue(slate) ?? Find.CurrentMap; if (mapValue == null) { - Log.Warning("[QuestNode] Map is null in TestRun"); + WulaLog.Debug("[QuestNode] Map is null in TestRun"); return false; } @@ -72,13 +72,13 @@ namespace WulaFallenEmpire if (targetThingDef == null) { - Log.Error("[QuestNode] ThingDef is null in RunInt"); + WulaLog.Debug("[QuestNode] ThingDef is null in RunInt"); return; } if (targetMap == null) { - Log.Error("[QuestNode] Map is null in RunInt"); + WulaLog.Debug("[QuestNode] Map is null in RunInt"); return; } @@ -162,17 +162,17 @@ namespace WulaFallenEmpire if (thingDef == null) { - Log.Error("[QuestPart] ThingDef is null"); + WulaLog.Debug("[QuestPart] ThingDef is null"); return; } if (map == null) { - Log.Error("[QuestPart] Map is null"); + WulaLog.Debug("[QuestPart] Map is null"); return; } - Log.Message($"[QuestPart] Received signal {inSignal}, spawning {spawnCount} {thingDef.defName} on map {map}"); + WulaLog.Debug($"[QuestPart] Received signal {inSignal}, spawning {spawnCount} {thingDef.defName} on map {map}"); // 执行生成逻辑 successCount = ExecuteSpawnLogic(); @@ -184,7 +184,7 @@ namespace WulaFallenEmpire { Messages.Message($"[Quest] Successfully spawned {successCount} {thingDef.label}", MessageTypeDefOf.PositiveEvent); } - Log.Message($"[QuestPart] Successfully spawned {successCount}/{spawnCount} {thingDef.defName}"); + WulaLog.Debug($"[QuestPart] Successfully spawned {successCount}/{spawnCount} {thingDef.defName}"); } else { @@ -192,7 +192,7 @@ namespace WulaFallenEmpire { Messages.Message($"[Quest] Failed to spawn any {thingDef.label}", MessageTypeDefOf.NegativeEvent); } - Log.Warning($"[QuestPart] Failed to spawn any {thingDef.defName}"); + WulaLog.Debug($"[QuestPart] Failed to spawn any {thingDef.defName}"); } } @@ -209,7 +209,7 @@ namespace WulaFallenEmpire if (spreadOut && !isSmallTarget) { - Log.Message($"[QuestPart] Target {thingDef.defName} is not considered small (size {thingDef.Size.x}x{thingDef.Size.z}), not using spread-out algorithm"); + WulaLog.Debug($"[QuestPart] Target {thingDef.defName} is not considered small (size {thingDef.Size.x}x{thingDef.Size.z}), not using spread-out algorithm"); } } @@ -229,7 +229,7 @@ namespace WulaFallenEmpire /// private int SpawnThingsWithSpacing(ThingDef thingDef, Faction faction, int spawnCount, Map targetMap, bool allowThickRoof, bool allowThinRoof, int minSpacing) { - Log.Message($"[QuestPart] Using spread-out algorithm with min spacing {minSpacing} cells"); + WulaLog.Debug($"[QuestPart] Using spread-out algorithm with min spacing {minSpacing} cells"); List spawnedPositions = new List(); int successCount = 0; @@ -240,12 +240,12 @@ namespace WulaFallenEmpire // 生成一个所有可能位置的列表 List allPossibleCells = GeneratePossibleCells(targetMap, thingDef, allowThickRoof, allowThinRoof, 1000); - Log.Message($"[QuestPart] Found {allPossibleCells.Count} possible cells for {thingDef.defName}"); + WulaLog.Debug($"[QuestPart] Found {allPossibleCells.Count} possible cells for {thingDef.defName}"); // 如果没有足够的可能位置,直接使用原算法 if (allPossibleCells.Count < spawnCount) { - Log.Warning($"[QuestPart] Not enough possible cells ({allPossibleCells.Count}) for {spawnCount} spawns, falling back to normal algorithm"); + WulaLog.Debug($"[QuestPart] Not enough possible cells ({allPossibleCells.Count}) for {spawnCount} spawns, falling back to normal algorithm"); return SpawnThingsAtValidLocations(thingDef, faction, spawnCount, targetMap, allowThickRoof, allowThinRoof); } @@ -293,7 +293,7 @@ namespace WulaFallenEmpire // 从可能位置列表中移除这个位置及其周围的位置(避免重复选择) allPossibleCells.RemoveAll(cell => cell.DistanceTo(candidatePos) < minSpacing / 2); - Log.Message($"[QuestPart] Successfully spawned {thingDef.defName} at {candidatePos} (distance to nearest: {GetMinDistanceToOthers(candidatePos, spawnedPositions)})"); + WulaLog.Debug($"[QuestPart] Successfully spawned {thingDef.defName} at {candidatePos} (distance to nearest: {GetMinDistanceToOthers(candidatePos, spawnedPositions)})"); break; } } @@ -301,7 +301,7 @@ namespace WulaFallenEmpire // 如果找不到满足间距条件的位置,放宽条件 if (!foundPosition) { - Log.Warning($"[QuestPart] Could not find position with required spacing for {thingDef.defName}, trying with reduced spacing"); + WulaLog.Debug($"[QuestPart] Could not find position with required spacing for {thingDef.defName}, trying with reduced spacing"); // 尝试使用减半的间距 bool foundWithReducedSpacing = TrySpawnWithReducedSpacing(thingDef, faction, targetMap, spawnedPositions, allPossibleCells, minSpacing / 2, ref successCount, ref attempts); @@ -309,18 +309,18 @@ namespace WulaFallenEmpire if (!foundWithReducedSpacing) { // 如果还找不到,尝试不使用间距条件 - Log.Warning($"[QuestPart] Still couldn't find position, falling back to no spacing requirement"); + WulaLog.Debug($"[QuestPart] Still couldn't find position, falling back to no spacing requirement"); foundWithReducedSpacing = TrySpawnWithReducedSpacing(thingDef, faction, targetMap, spawnedPositions, allPossibleCells, 0, ref successCount, ref attempts); } if (!foundWithReducedSpacing) { - Log.Warning($"[QuestPart] Failed to spawn {thingDef.defName} after multiple attempts"); + WulaLog.Debug($"[QuestPart] Failed to spawn {thingDef.defName} after multiple attempts"); } } } - Log.Message($"[QuestPart] Spread-out algorithm completed: {successCount}/{spawnCount} spawned"); + WulaLog.Debug($"[QuestPart] Spread-out algorithm completed: {successCount}/{spawnCount} spawned"); return successCount; } @@ -367,7 +367,7 @@ namespace WulaFallenEmpire // 从可能位置列表中移除这个位置及其周围的位置 allPossibleCells.RemoveAll(cell => cell.DistanceTo(candidatePos) < reducedSpacing / 2); - Log.Message($"[QuestPart] Successfully spawned {thingDef.defName} at {candidatePos} with reduced spacing {reducedSpacing}"); + WulaLog.Debug($"[QuestPart] Successfully spawned {thingDef.defName} at {candidatePos} with reduced spacing {reducedSpacing}"); return true; } } @@ -439,7 +439,7 @@ namespace WulaFallenEmpire } } - Log.Message($"[QuestPart] Generated {possibleCells.Count} possible cells after checking {cellsChecked} cells"); + WulaLog.Debug($"[QuestPart] Generated {possibleCells.Count} possible cells after checking {cellsChecked} cells"); return possibleCells; } @@ -469,11 +469,11 @@ namespace WulaFallenEmpire GenSpawn.Spawn(thing, spawnPos, targetMap); successCount++; - Log.Message($"[QuestPart] Successfully spawned {thingDef.defName} at {spawnPos} for faction {faction?.Name ?? "None"}"); + WulaLog.Debug($"[QuestPart] Successfully spawned {thingDef.defName} at {spawnPos} for faction {faction?.Name ?? "None"}"); } else { - Log.Warning($"[QuestPart] Failed to find valid spawn position for {thingDef.defName} (attempt {attempts})"); + WulaLog.Debug($"[QuestPart] Failed to find valid spawn position for {thingDef.defName} (attempt {attempts})"); } } @@ -540,7 +540,7 @@ namespace WulaFallenEmpire return potentialCells.RandomElement(); } - Log.Warning($"[QuestPart] No valid positions found for {thingDef.defName} after exhaustive search"); + WulaLog.Debug($"[QuestPart] No valid positions found for {thingDef.defName} after exhaustive search"); return IntVec3.Invalid; } diff --git a/Source/WulaFallenEmpire/QuestNodes/QuestPart_GlobalResourceCheck.cs b/Source/WulaFallenEmpire/QuestNodes/QuestPart_GlobalResourceCheck.cs index d395a319..ba69eb33 100644 --- a/Source/WulaFallenEmpire/QuestNodes/QuestPart_GlobalResourceCheck.cs +++ b/Source/WulaFallenEmpire/QuestNodes/QuestPart_GlobalResourceCheck.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using RimWorld.Planet; using System; using System.Collections.Generic; @@ -51,7 +51,7 @@ namespace WulaFallenEmpire // 激活时立即开始第一次检查 nextRetryTick = Find.TickManager.TicksGame; - Log.Message($"QuestPart_GlobalResourceCheck Enabled: Will check for {requiredCount} {resourceDef?.defName} in {(useInputStorage ? "Input" : "Output")} Storage"); + WulaLog.Debug($"QuestPart_GlobalResourceCheck Enabled: Will check for {requiredCount} {resourceDef?.defName} in {(useInputStorage ? "Input" : "Output")} Storage"); } public override void QuestPartTick() @@ -93,14 +93,14 @@ namespace WulaFallenEmpire GlobalStorageWorldComponent globalStorage = Find.World.GetComponent(); if (globalStorage == null) { - Log.Error("QuestPart_GlobalResourceCheck: GlobalStorageWorldComponent not found"); + WulaLog.Debug("QuestPart_GlobalResourceCheck: GlobalStorageWorldComponent not found"); HandleFailure("Global storage component missing"); return; } if (resourceDef == null) { - Log.Error("QuestPart_GlobalResourceCheck: resourceDef is null"); + WulaLog.Debug("QuestPart_GlobalResourceCheck: resourceDef is null"); HandleFailure("Resource definition is null"); return; } @@ -112,7 +112,7 @@ namespace WulaFallenEmpire bool hasEnough = currentAmount >= requiredCount; - Log.Message($"GlobalResourceCheck [{retryCount}]: {currentAmount}/{requiredCount} {resourceDef.defName} in {(useInputStorage ? "Input" : "Output")} Storage - Enough: {hasEnough}"); + WulaLog.Debug($"GlobalResourceCheck [{retryCount}]: {currentAmount}/{requiredCount} {resourceDef.defName} in {(useInputStorage ? "Input" : "Output")} Storage - Enough: {hasEnough}"); if (hasEnough) { @@ -127,7 +127,7 @@ namespace WulaFallenEmpire } catch (Exception ex) { - Log.Error($"GlobalResourceCheck: Exception during check - {ex}"); + WulaLog.Debug($"GlobalResourceCheck: Exception during check - {ex}"); HandleFailure($"Exception: {ex.Message}"); } } @@ -145,17 +145,17 @@ namespace WulaFallenEmpire if (!deducted) { - Log.Error($"QuestPart_GlobalResourceCheck: Failed to deduct {requiredCount} {resourceDef.defName} from {(useInputStorage ? "Input" : "Output")} Storage"); + WulaLog.Debug($"QuestPart_GlobalResourceCheck: Failed to deduct {requiredCount} {resourceDef.defName} from {(useInputStorage ? "Input" : "Output")} Storage"); } } - Log.Message($"GlobalResourceCheck: SUCCESS - {(deductOnSuccess ? "Deducted" : "Found")} {requiredCount} {resourceDef.defName} from {(useInputStorage ? "Input" : "Output")} Storage"); + WulaLog.Debug($"GlobalResourceCheck: SUCCESS - {(deductOnSuccess ? "Deducted" : "Found")} {requiredCount} {resourceDef.defName} from {(useInputStorage ? "Input" : "Output")} Storage"); // 发送成功信号 if (!successSignal.NullOrEmpty()) { Find.SignalManager.SendSignal(new Signal(successSignal)); - Log.Message($"GlobalResourceCheck: Sent success signal '{successSignal}'"); + WulaLog.Debug($"GlobalResourceCheck: Sent success signal '{successSignal}'"); } // 完成这个任务部分 @@ -167,14 +167,14 @@ namespace WulaFallenEmpire // 检查是否超过最大重试次数 if (retryCount >= MAX_RETRY_COUNT) { - Log.Warning($"GlobalResourceCheck: Max retry count ({MAX_RETRY_COUNT}) reached for {resourceDef.defName}. Reason: {reason}"); + WulaLog.Debug($"GlobalResourceCheck: Max retry count ({MAX_RETRY_COUNT}) reached for {resourceDef.defName}. Reason: {reason}"); hasFailed = true; // 发送失败信号 if (!failSignal.NullOrEmpty()) { Find.SignalManager.SendSignal(new Signal(failSignal)); - Log.Message($"GlobalResourceCheck: Sent fail signal '{failSignal}' after max retries"); + WulaLog.Debug($"GlobalResourceCheck: Sent fail signal '{failSignal}' after max retries"); } Complete(); @@ -190,7 +190,7 @@ namespace WulaFallenEmpire nextRetryTick = Find.TickManager.TicksGame + retryDelayTicks; // 记录重试信息 - Log.Message($"GlobalResourceCheck: Scheduled retry #{retryCount + 1} in {retryDelayTicks} ticks for {requiredCount} {resourceDef.defName}. Reason: {reason}"); + WulaLog.Debug($"GlobalResourceCheck: Scheduled retry #{retryCount + 1} in {retryDelayTicks} ticks for {requiredCount} {resourceDef.defName}. Reason: {reason}"); } public override void ExposeData() diff --git a/Source/WulaFallenEmpire/Storyteller/WULA_SimpleTechnologyTrigger/StorytellerComp_SimpleTechnologyTrigger.cs b/Source/WulaFallenEmpire/Storyteller/WULA_SimpleTechnologyTrigger/StorytellerComp_SimpleTechnologyTrigger.cs index 839fbf53..70cf1a66 100644 --- a/Source/WulaFallenEmpire/Storyteller/WULA_SimpleTechnologyTrigger/StorytellerComp_SimpleTechnologyTrigger.cs +++ b/Source/WulaFallenEmpire/Storyteller/WULA_SimpleTechnologyTrigger/StorytellerComp_SimpleTechnologyTrigger.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using Verse; using System.Linq; @@ -50,8 +50,8 @@ namespace WulaFallenEmpire { if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] Triggering incident {incidentToTrigger.defName} for technology {SimpleProps.technology.defName}"); - Log.Message($"[SimpleTechnologyTrigger] Faction relation status: {factionCheckResult}"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Triggering incident {incidentToTrigger.defName} for technology {SimpleProps.technology.defName}"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Faction relation status: {factionCheckResult}"); } yield return new FiringIncident(incidentToTrigger, this, GenerateParms(incidentToTrigger.category, target)); @@ -74,7 +74,7 @@ namespace WulaFallenEmpire { if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] Using hostile alternative incident: {SimpleProps.incidentIfHostile.defName}"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Using hostile alternative incident: {SimpleProps.incidentIfHostile.defName}"); } return SimpleProps.incidentIfHostile; } @@ -106,7 +106,7 @@ namespace WulaFallenEmpire { if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] Required faction {SimpleProps.requiredFaction.defName} does not exist or is defeated"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Required faction {SimpleProps.requiredFaction.defName} does not exist or is defeated"); } return FactionRelationResult.Invalid("Faction does not exist or is defeated"); } @@ -124,7 +124,7 @@ namespace WulaFallenEmpire { if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] Required faction {SimpleProps.requiredFaction.defName} is hostile to player and requireNonHostileRelation is true"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Required faction {SimpleProps.requiredFaction.defName} is hostile to player and requireNonHostileRelation is true"); } return FactionRelationResult.Invalid("Faction is hostile and requireNonHostileRelation is true"); } @@ -133,7 +133,7 @@ namespace WulaFallenEmpire // 不要求非敌对关系,但派系是敌对的 - 这是一个特殊状态 if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] Required faction {SimpleProps.requiredFaction.defName} is hostile but requireNonHostileRelation is false - allowing with possible alternative"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Required faction {SimpleProps.requiredFaction.defName} is hostile but requireNonHostileRelation is false - allowing with possible alternative"); } return FactionRelationResult.HostileButAllowed(); } @@ -142,7 +142,7 @@ namespace WulaFallenEmpire if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] Required faction {SimpleProps.requiredFaction.defName} check passed"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Required faction {SimpleProps.requiredFaction.defName} check passed"); } return FactionRelationResult.Valid(); @@ -169,7 +169,7 @@ namespace WulaFallenEmpire { if (SimpleProps.technology == null) { - Log.Error("[SimpleTechnologyTrigger] No technology specified in props"); + WulaLog.Debug("[SimpleTechnologyTrigger] No technology specified in props"); return false; } @@ -177,7 +177,7 @@ namespace WulaFallenEmpire if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] Technology {SimpleProps.technology.defName} research status: {hasTechnology}"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Technology {SimpleProps.technology.defName} research status: {hasTechnology}"); } return hasTechnology; @@ -200,7 +200,7 @@ namespace WulaFallenEmpire { if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] Faction {faction.def.defName} is in blacklist"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Faction {faction.def.defName} is in blacklist"); } return false; } @@ -219,7 +219,7 @@ namespace WulaFallenEmpire { if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] Faction {faction.def.defName} is in whitelist"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Faction {faction.def.defName} is in whitelist"); } return true; } @@ -227,7 +227,7 @@ namespace WulaFallenEmpire { if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] Faction {faction.def.defName} not in whitelist and default behavior is Deny"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Faction {faction.def.defName} not in whitelist and default behavior is Deny"); } return false; } @@ -239,13 +239,13 @@ namespace WulaFallenEmpire case FactionFilterDefaultBehavior.Allow: if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] No whitelist, default behavior is Allow"); + WulaLog.Debug($"[SimpleTechnologyTrigger] No whitelist, default behavior is Allow"); } return true; case FactionFilterDefaultBehavior.Deny: if (SimpleProps.debugLogging) { - Log.Message($"[SimpleTechnologyTrigger] No whitelist, default behavior is Deny"); + WulaLog.Debug($"[SimpleTechnologyTrigger] No whitelist, default behavior is Deny"); } return false; default: @@ -287,7 +287,7 @@ namespace WulaFallenEmpire if (SimpleProps.debugLogging && hasActiveQuest) { - Log.Message($"[SimpleTechnologyTrigger] Active quest {SimpleProps.questDef.defName} found, skipping trigger"); + WulaLog.Debug($"[SimpleTechnologyTrigger] Active quest {SimpleProps.questDef.defName} found, skipping trigger"); } return hasActiveQuest; diff --git a/Source/WulaFallenEmpire/ThingComp/CompApparelInterceptor.cs b/Source/WulaFallenEmpire/ThingComp/CompApparelInterceptor.cs index eef15cdc..33743069 100644 --- a/Source/WulaFallenEmpire/ThingComp/CompApparelInterceptor.cs +++ b/Source/WulaFallenEmpire/ThingComp/CompApparelInterceptor.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld; using System; using System.Collections.Generic; @@ -107,11 +107,11 @@ namespace WulaFallenEmpire originalProjectile.Destroy(DestroyMode.Vanish); // 播放反弹效果 PlayBounceEffect(originalProjectile); - Log.Message($"[Interceptor] Projectile bounced forward to {targetCell}"); + WulaLog.Debug($"[Interceptor] Projectile bounced forward to {targetCell}"); } catch (Exception ex) { - Log.Error($"Error in BounceProjectileNew: {ex}"); + WulaLog.Debug($"Error in BounceProjectileNew: {ex}"); } } // 使用 Traverse 复制字段 @@ -137,7 +137,7 @@ namespace WulaFallenEmpire } catch (Exception ex) { - Log.Warning($"Error copying projectile fields with Traverse: {ex}"); + WulaLog.Debug($"Error copying projectile fields with Traverse: {ex}"); } } // 使用 Traverse 调用 Launch 方法 @@ -165,12 +165,12 @@ namespace WulaFallenEmpire } else { - Log.Error("Launch method not found using Traverse"); + WulaLog.Debug("Launch method not found using Traverse"); } } catch (Exception ex) { - Log.Error($"Error launching projectile with Traverse: {ex}"); + WulaLog.Debug($"Error launching projectile with Traverse: {ex}"); } } // 使用反射设置抛射体字段 @@ -215,7 +215,7 @@ namespace WulaFallenEmpire } catch (Exception ex) { - Log.Warning($"Error setting projectile fields: {ex}"); + WulaLog.Debug($"Error setting projectile fields: {ex}"); } } // 使用反射调用 Launch 方法 @@ -260,12 +260,12 @@ namespace WulaFallenEmpire } else { - Log.Error("Could not find Launch method on Projectile"); + WulaLog.Debug("Could not find Launch method on Projectile"); } } catch (Exception ex) { - Log.Error($"Error launching projectile: {ex}"); + WulaLog.Debug($"Error launching projectile: {ex}"); } } // 使用反射获取私有字段值 @@ -382,7 +382,7 @@ namespace WulaFallenEmpire } catch (Exception ex) { - Log.Warning($"[CompApparelInterceptor] Error in TryInterceptProjectile: {ex.Message}"); + WulaLog.Debug($"[CompApparelInterceptor] Error in TryInterceptProjectile: {ex.Message}"); return false; } } @@ -424,7 +424,7 @@ namespace WulaFallenEmpire } catch (Exception ex) { - Log.Warning($"[CompApparelInterceptor] Error during interception effects: {ex.Message}"); + WulaLog.Debug($"[CompApparelInterceptor] Error during interception effects: {ex.Message}"); } } @@ -559,7 +559,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"[CompApparelInterceptor] Error in CompTick: {ex.Message}"); + WulaLog.Debug($"[CompApparelInterceptor] Error in CompTick: {ex.Message}"); } } @@ -656,7 +656,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"[CompApparelInterceptor] Error in CompDrawWornExtras: {ex.Message}"); + WulaLog.Debug($"[CompApparelInterceptor] Error in CompDrawWornExtras: {ex.Message}"); } } diff --git a/Source/WulaFallenEmpire/ThingComp/CompProperties_DelayedDamageIfNotPlayer.cs b/Source/WulaFallenEmpire/ThingComp/CompProperties_DelayedDamageIfNotPlayer.cs index 6c342e55..75fccbc3 100644 --- a/Source/WulaFallenEmpire/ThingComp/CompProperties_DelayedDamageIfNotPlayer.cs +++ b/Source/WulaFallenEmpire/ThingComp/CompProperties_DelayedDamageIfNotPlayer.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using UnityEngine; using Verse; @@ -82,17 +82,17 @@ namespace WulaFallenEmpire damageApplied = true; // 记录日志以便调试 - Log.Message($"[CompDelayedDamage] Applied {Props.damageAmount} {Props.damageDef.defName} damage to {parent.Label} (Faction: {parent.Faction?.Name ?? "None"})"); + WulaLog.Debug($"[CompDelayedDamage] Applied {Props.damageAmount} {Props.damageDef.defName} damage to {parent.Label} (Faction: {parent.Faction?.Name ?? "None"})"); // 检查是否被杀死 if (Props.destroyIfKilled && (parent.Destroyed || (parent is Pawn pawn && pawn.Dead))) { - Log.Message($"[CompDelayedDamage] {parent.Label} was destroyed by delayed damage"); + WulaLog.Debug($"[CompDelayedDamage] {parent.Label} was destroyed by delayed damage"); } } catch (System.Exception ex) { - Log.Error($"[CompDelayedDamage] Error applying delayed damage: {ex}"); + WulaLog.Debug($"[CompDelayedDamage] Error applying delayed damage: {ex}"); } } diff --git a/Source/WulaFallenEmpire/ThingComp/CompUseEffect_OpenCustomUI.cs b/Source/WulaFallenEmpire/ThingComp/CompUseEffect_OpenCustomUI.cs index f4754cb0..126f2f52 100644 --- a/Source/WulaFallenEmpire/ThingComp/CompUseEffect_OpenCustomUI.cs +++ b/Source/WulaFallenEmpire/ThingComp/CompUseEffect_OpenCustomUI.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System; using Verse; @@ -33,17 +33,17 @@ namespace WulaFallenEmpire Window window = (Window)Activator.CreateInstance(uiDef.windowType, uiDef); Find.WindowStack.Add(window); - Log.Message($"[CompUseEffect] Opened custom UI: {Props.uiDefName}"); + WulaLog.Debug($"[CompUseEffect] Opened custom UI: {Props.uiDefName}"); } else { - Log.Error($"[CompUseEffect] Could not find EventDef named '{Props.uiDefName}'"); + WulaLog.Debug($"[CompUseEffect] Could not find EventDef named '{Props.uiDefName}'"); Messages.Message($"Error: Could not find UI definition '{Props.uiDefName}'", MessageTypeDefOf.RejectInput); } } catch (Exception ex) { - Log.Error($"[CompUseEffect] Error opening custom UI '{Props.uiDefName}': {ex}"); + WulaLog.Debug($"[CompUseEffect] Error opening custom UI '{Props.uiDefName}': {ex}"); Messages.Message($"Error opening UI: {ex.Message}", MessageTypeDefOf.RejectInput); } } diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_AreaShield/Harmony_AreaShieldInterceptor.cs b/Source/WulaFallenEmpire/ThingComp/WULA_AreaShield/Harmony_AreaShieldInterceptor.cs index 8a835832..b937cbaf 100644 --- a/Source/WulaFallenEmpire/ThingComp/WULA_AreaShield/Harmony_AreaShieldInterceptor.cs +++ b/Source/WulaFallenEmpire/ThingComp/WULA_AreaShield/Harmony_AreaShieldInterceptor.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using RimWorld; using Verse; using UnityEngine; @@ -101,7 +101,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"AreaShield interception error: {ex}"); + WulaLog.Debug($"AreaShield interception error: {ex}"); return true; // 出错时继续执行原方法 } } diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_AreaShield/ThingComp_AreaShield.cs b/Source/WulaFallenEmpire/ThingComp/WULA_AreaShield/ThingComp_AreaShield.cs index acb3cc43..c73cc423 100644 --- a/Source/WulaFallenEmpire/ThingComp/WULA_AreaShield/ThingComp_AreaShield.cs +++ b/Source/WulaFallenEmpire/ThingComp/WULA_AreaShield/ThingComp_AreaShield.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using UnityEngine; using Verse.Sound; @@ -397,7 +397,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"Error in TryIntercept: {ex}"); + WulaLog.Debug($"Error in TryIntercept: {ex}"); return false; } } @@ -445,7 +445,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"Error reflecting projectile: {ex}"); + WulaLog.Debug($"Error reflecting projectile: {ex}"); } return false; @@ -479,7 +479,7 @@ namespace WulaFallenEmpire Projectile newProjectile = (Projectile)GenSpawn.Spawn(originalProjectile.def, spawnCell, Holder.Map); if (newProjectile == null) { - Log.Warning("Failed to spawn reflected projectile"); + WulaLog.Debug("Failed to spawn reflected projectile"); return false; } @@ -502,12 +502,12 @@ namespace WulaFallenEmpire // 使用延迟销毁而不是立即销毁 ReflectedProjectileManager.MarkForDelayedDestroy(originalProjectile); - Log.Message($"反射抛射体: 由 {Holder?.LabelShort} 从 {spawnCell} 向 {targetCell} 发射"); + WulaLog.Debug($"反射抛射体: 由 {Holder?.LabelShort} 从 {spawnCell} 向 {targetCell} 发射"); return true; } catch (System.Exception ex) { - Log.Warning($"Error creating reflected projectile: {ex}"); + WulaLog.Debug($"Error creating reflected projectile: {ex}"); return false; } } @@ -554,7 +554,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"Error copying projectile properties: {ex}"); + WulaLog.Debug($"Error copying projectile properties: {ex}"); } } diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/ThingComp_AreaTeleporter.cs b/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/ThingComp_AreaTeleporter.cs index 06ffdfbd..fe20babe 100644 --- a/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/ThingComp_AreaTeleporter.cs +++ b/Source/WulaFallenEmpire/ThingComp/WULA_AreaTeleporter/ThingComp_AreaTeleporter.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using UnityEngine; @@ -391,11 +391,11 @@ namespace WulaFallenEmpire PerformTeleport(pawn, safeTarget); // 记录日志 - Log.Message($"[AreaTeleporter] 传送 {pawn.LabelShort} 从 {pawn.Position} 到 {safeTarget} (网络传送)"); + WulaLog.Debug($"[AreaTeleporter] 传送 {pawn.LabelShort} 从 {pawn.Position} 到 {safeTarget} (网络传送)"); } catch (System.Exception ex) { - Log.Warning($"传送Pawn时出错: {ex.Message}"); + WulaLog.Debug($"传送Pawn时出错: {ex.Message}"); } } @@ -620,7 +620,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"绘制传送范围环时出错: {ex.Message}"); + WulaLog.Debug($"绘制传送范围环时出错: {ex.Message}"); } } } diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_DamageTransaction/CompDamageInterceptor.cs b/Source/WulaFallenEmpire/ThingComp/WULA_DamageTransaction/CompDamageInterceptor.cs index 15a3a6f1..8611bd21 100644 --- a/Source/WulaFallenEmpire/ThingComp/WULA_DamageTransaction/CompDamageInterceptor.cs +++ b/Source/WulaFallenEmpire/ThingComp/WULA_DamageTransaction/CompDamageInterceptor.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using Verse.Sound; @@ -31,7 +31,7 @@ namespace WulaFallenEmpire // 完全拦截伤害 - 将伤害设置为0 dinfo.SetAmount(0f); - Log.Message($"[DamageInterceptor] {Pawn.LabelShort} 完全拦截 {transferDamage} 点伤害并转移至 {targetBuilding.Label},自身承受0伤害"); + WulaLog.Debug($"[DamageInterceptor] {Pawn.LabelShort} 完全拦截 {transferDamage} 点伤害并转移至 {targetBuilding.Label},自身承受0伤害"); return true; // 继续应用修改后的伤害(0伤害) } @@ -108,7 +108,7 @@ namespace WulaFallenEmpire // 对建筑造成伤害 building.TakeDamage(buildingDamage); - Log.Message($"[DamageInterceptor] 对建筑 {building.Label} 造成 {damageAmount} 点伤害,剩余生命值: {building.HitPoints}/{building.MaxHitPoints}"); + WulaLog.Debug($"[DamageInterceptor] 对建筑 {building.Label} 造成 {damageAmount} 点伤害,剩余生命值: {building.HitPoints}/{building.MaxHitPoints}"); } private void OnDamageIntercepted(DamageInfo dinfo, float interceptDamage, Building targetBuilding) diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_DamageTransaction/CompDamageRelay.cs b/Source/WulaFallenEmpire/ThingComp/WULA_DamageTransaction/CompDamageRelay.cs index 86442ecd..7501665b 100644 --- a/Source/WulaFallenEmpire/ThingComp/WULA_DamageTransaction/CompDamageRelay.cs +++ b/Source/WulaFallenEmpire/ThingComp/WULA_DamageTransaction/CompDamageRelay.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using Verse.Sound; @@ -48,7 +48,7 @@ namespace WulaFallenEmpire OnDamageRelayed(dinfo, relayDamage, targetBuilding); // 记录日志 - Log.Message($"[DamageRelay] {Building.Label} 将 {relayDamage} 点伤害传递给 {targetBuilding.Label}"); + WulaLog.Debug($"[DamageRelay] {Building.Label} 将 {relayDamage} 点伤害传递给 {targetBuilding.Label}"); } } @@ -104,7 +104,7 @@ namespace WulaFallenEmpire // 对建筑造成伤害 building.TakeDamage(buildingDamage); - Log.Message($"[DamageRelay] 对建筑 {building.Label} 造成 {damageAmount} 点伤害,剩余生命值: {building.HitPoints}/{building.MaxHitPoints}"); + WulaLog.Debug($"[DamageRelay] 对建筑 {building.Label} 造成 {damageAmount} 点伤害,剩余生命值: {building.HitPoints}/{building.MaxHitPoints}"); } private void OnDamageRelayed(DamageInfo dinfo, float relayDamage, Building targetBuilding) diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_GiveHediffsInRange/CompGiveHediffsInRange.cs b/Source/WulaFallenEmpire/ThingComp/WULA_GiveHediffsInRange/CompGiveHediffsInRange.cs index 6a6b4e93..b5899d05 100644 --- a/Source/WulaFallenEmpire/ThingComp/WULA_GiveHediffsInRange/CompGiveHediffsInRange.cs +++ b/Source/WulaFallenEmpire/ThingComp/WULA_GiveHediffsInRange/CompGiveHediffsInRange.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; using UnityEngine; @@ -147,7 +147,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"检查派系关系时出错: {ex.Message}"); + WulaLog.Debug($"检查派系关系时出错: {ex.Message}"); // 出错时保守处理,不施加效果 return false; } @@ -215,11 +215,11 @@ namespace WulaFallenEmpire CreateEffectForPawn(pawn); // 记录日志(可选,调试时使用) - // Log.Message($"给予 {pawn.LabelShort} ({pawn.def.defName}) Hediff: {Props.hediff.defName}"); + // WulaLog.Debug($"给予 {pawn.LabelShort} ({pawn.def.defName}) Hediff: {Props.hediff.defName}"); } catch (System.Exception ex) { - Log.Warning($"无法给 {pawn.LabelShort} 添加Hediff: {ex.Message}"); + WulaLog.Debug($"无法给 {pawn.LabelShort} 添加Hediff: {ex.Message}"); } } @@ -237,7 +237,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"移除 {pawn.LabelShort} 的Hediff时出错: {ex.Message}"); + WulaLog.Debug($"移除 {pawn.LabelShort} 的Hediff时出错: {ex.Message}"); } affectedPawns.Remove(pawn); @@ -281,7 +281,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"创建视觉效果时出错: {ex.Message}"); + WulaLog.Debug($"创建视觉效果时出错: {ex.Message}"); } } } @@ -296,7 +296,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"清理视觉效果时出错: {ex.Message}"); + WulaLog.Debug($"清理视觉效果时出错: {ex.Message}"); } effecters.Remove(pawn); } @@ -318,7 +318,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"更新视觉效果时出错: {ex.Message}"); + WulaLog.Debug($"更新视觉效果时出错: {ex.Message}"); effectersToRemove.Add(kvp.Key); } } @@ -384,7 +384,7 @@ namespace WulaFallenEmpire } catch (System.Exception ex) { - Log.Warning($"绘制范围环时出错: {ex.Message}"); + WulaLog.Debug($"绘制范围环时出错: {ex.Message}"); } } } diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_PersonaCore/CompExperienceCore.cs b/Source/WulaFallenEmpire/ThingComp/WULA_PersonaCore/CompExperienceCore.cs index 8197f635..6b895db4 100644 --- a/Source/WulaFallenEmpire/ThingComp/WULA_PersonaCore/CompExperienceCore.cs +++ b/Source/WulaFallenEmpire/ThingComp/WULA_PersonaCore/CompExperienceCore.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using System.Collections.Generic; using System.Text; using UnityEngine; @@ -310,7 +310,7 @@ namespace WulaFallenEmpire GenPlace.TryPlaceThing(overflowDataPack, parent.Position, parent.Map, ThingPlaceMode.Near); - Log.Message($"[ExperienceCore] Created overflow data pack with {overflowAmount} experience"); + WulaLog.Debug($"[ExperienceCore] Created overflow data pack with {overflowAmount} experience"); } } @@ -478,7 +478,7 @@ namespace WulaFallenEmpire } else { - Log.Error($"[ExperienceCore] ERROR: {parent.Label} has no CompQuality component!"); + WulaLog.Debug($"[ExperienceCore] ERROR: {parent.Label} has no CompQuality component!"); return; } diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_PlaySoundOnSpawn/CompPlaySoundOnSpawn.cs b/Source/WulaFallenEmpire/ThingComp/WULA_PlaySoundOnSpawn/CompPlaySoundOnSpawn.cs index 85f641e9..92e31362 100644 --- a/Source/WulaFallenEmpire/ThingComp/WULA_PlaySoundOnSpawn/CompPlaySoundOnSpawn.cs +++ b/Source/WulaFallenEmpire/ThingComp/WULA_PlaySoundOnSpawn/CompPlaySoundOnSpawn.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using Verse.Sound; using System.Collections.Generic; @@ -131,12 +131,12 @@ namespace WulaFallenEmpire // 调试日志 if (Prefs.DevMode) { - Log.Message($"Played spawn sound: {Props.sound.defName} for {parent.Label} at {parent.Position}"); + WulaLog.Debug($"Played spawn sound: {Props.sound.defName} for {parent.Label} at {parent.Position}"); } } catch (System.Exception ex) { - Log.Error($"Error playing spawn sound for {parent.Label}: {ex}"); + WulaLog.Debug($"Error playing spawn sound for {parent.Label}: {ex}"); } } @@ -164,7 +164,7 @@ namespace WulaFallenEmpire } else { - Log.Warning("No sound defined for CompPlaySoundOnSpawn"); + WulaLog.Debug("No sound defined for CompPlaySoundOnSpawn"); } } }; diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_PsychicRitual/PsychicRitual_TechOffering.cs b/Source/WulaFallenEmpire/ThingComp/WULA_PsychicRitual/PsychicRitual_TechOffering.cs index 9a9f6458..e2bd6b31 100644 --- a/Source/WulaFallenEmpire/ThingComp/WULA_PsychicRitual/PsychicRitual_TechOffering.cs +++ b/Source/WulaFallenEmpire/ThingComp/WULA_PsychicRitual/PsychicRitual_TechOffering.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using RimWorld; using Verse; @@ -159,13 +159,13 @@ namespace WulaFallenEmpire // 从奖励池中随机选择一个武器 if (ritualDef.rewardWeaponPool.NullOrEmpty()) { - Log.Error($"[WulaFallenEmpire] Reward weapon pool is empty for {ritualDef.defName}"); + WulaLog.Debug($"[WulaFallenEmpire] Reward weapon pool is empty for {ritualDef.defName}"); return; } ThingDef weaponDef = ritualDef.rewardWeaponPool.RandomElement(); if (weaponDef == null) { - Log.Error($"[WulaFallenEmpire] Could not find weapon Def in reward pool for {ritualDef.defName}"); + WulaLog.Debug($"[WulaFallenEmpire] Could not find weapon Def in reward pool for {ritualDef.defName}"); return; } diff --git a/Source/WulaFallenEmpire/ThingComp/WULA_SkyfallerPawnSpawner/CompProperties_SkyfallerPawnSpawner.cs b/Source/WulaFallenEmpire/ThingComp/WULA_SkyfallerPawnSpawner/CompProperties_SkyfallerPawnSpawner.cs index 5c367dae..ac6a631f 100644 --- a/Source/WulaFallenEmpire/ThingComp/WULA_SkyfallerPawnSpawner/CompProperties_SkyfallerPawnSpawner.cs +++ b/Source/WulaFallenEmpire/ThingComp/WULA_SkyfallerPawnSpawner/CompProperties_SkyfallerPawnSpawner.cs @@ -1,4 +1,4 @@ -using Verse; +using Verse; using RimWorld; namespace WulaFallenEmpire @@ -24,7 +24,7 @@ namespace WulaFallenEmpire { if (Props.pawnKind == null) { - Log.Error("CompSkyfallerPawnSpawner: pawnKind is null"); + WulaLog.Debug("CompSkyfallerPawnSpawner: pawnKind is null"); return; } diff --git a/Source/WulaFallenEmpire/ThingComp/Wula_MechRepairKit/Recipe_AdministerWulaMechRepairKit.cs b/Source/WulaFallenEmpire/ThingComp/Wula_MechRepairKit/Recipe_AdministerWulaMechRepairKit.cs index ff002335..e8938a28 100644 --- a/Source/WulaFallenEmpire/ThingComp/Wula_MechRepairKit/Recipe_AdministerWulaMechRepairKit.cs +++ b/Source/WulaFallenEmpire/ThingComp/Wula_MechRepairKit/Recipe_AdministerWulaMechRepairKit.cs @@ -1,4 +1,4 @@ -using RimWorld; +using RimWorld; using Verse; using System.Collections.Generic; @@ -33,14 +33,14 @@ namespace WulaFallenEmpire } else { - Log.Error($"WULA_MechRepairKit is missing CompUseEffect_FixAllHealthConditions. This should not happen."); + WulaLog.Debug($"WULA_MechRepairKit is missing CompUseEffect_FixAllHealthConditions. This should not happen."); } // 物品将由 CompProperties_UseEffectDestroySelf 销毁,因此此处无需手动销毁。 } else { - Log.Error($"Recipe_AdministerWulaMechRepairKit could not find WULA_MechRepairKit in ingredients for pawn {pawn.LabelShort}."); + WulaLog.Debug($"Recipe_AdministerWulaMechRepairKit could not find WULA_MechRepairKit in ingredients for pawn {pawn.LabelShort}."); } } } diff --git a/Source/WulaFallenEmpire/Verb/Verb_ShootArc.cs b/Source/WulaFallenEmpire/Verb/Verb_ShootArc.cs index b08c6d44..fa740a88 100644 --- a/Source/WulaFallenEmpire/Verb/Verb_ShootArc.cs +++ b/Source/WulaFallenEmpire/Verb/Verb_ShootArc.cs @@ -333,7 +333,7 @@ namespace WulaFallenEmpire bool flag2 = flag; if (flag2) { - Log.Error("TargetTakeDamage has null caster or target"); + WulaLog.Debug("TargetTakeDamage has null caster or target"); } else { diff --git a/Source/WulaFallenEmpire/WulaFallenEmpireMod.cs b/Source/WulaFallenEmpire/WulaFallenEmpireMod.cs index f0cd6a9d..95d028fd 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpireMod.cs +++ b/Source/WulaFallenEmpire/WulaFallenEmpireMod.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using HarmonyLib; using UnityEngine; @@ -20,7 +20,7 @@ namespace WulaFallenEmpire var harmony = new Harmony("tourswen.wulafallenempire"); // 替换为您的唯一Mod ID harmony.PatchAll(Assembly.GetExecutingAssembly()); - Log.Message("[WulaFallenEmpire] Harmony patches applied."); + WulaLog.Debug("[WulaFallenEmpire] Harmony patches applied."); } public override void DoSettingsWindowContents(Rect inRect) @@ -45,6 +45,9 @@ namespace WulaFallenEmpire Rect tokensRect = listingStandard.GetRect(Text.LineHeight); Widgets.TextFieldNumeric(tokensRect, ref settings.maxContextTokens, ref _maxContextTokensBuffer, 1000, 200000); + listingStandard.GapLine(); + listingStandard.CheckboxLabeled("Enable Debug Logs".Translate(), ref settings.enableDebugLogs, "Enable detailed debug logging (independent of DevMode)".Translate()); + listingStandard.End(); base.DoSettingsWindowContents(inRect); } @@ -60,7 +63,7 @@ namespace WulaFallenEmpire { static StartupLogger() { - Log.Message("WulaFallenEmpire Mod DLL, version 1.0.2, has been loaded."); + WulaLog.Debug("WulaFallenEmpire Mod DLL, version 1.0.2, has been loaded."); } } } diff --git a/Source/WulaFallenEmpire/WulaFallenEmpireSettings.cs b/Source/WulaFallenEmpire/WulaFallenEmpireSettings.cs index 04a0e90b..52195218 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpireSettings.cs +++ b/Source/WulaFallenEmpire/WulaFallenEmpireSettings.cs @@ -8,6 +8,7 @@ namespace WulaFallenEmpire public string baseUrl = "https://api.deepseek.com"; public string model = "deepseek-chat"; public int maxContextTokens = 100000; + public bool enableDebugLogs = false; public override void ExposeData() { @@ -15,6 +16,7 @@ namespace WulaFallenEmpire Scribe_Values.Look(ref baseUrl, "baseUrl", "https://api.deepseek.com"); Scribe_Values.Look(ref model, "model", "deepseek-chat"); Scribe_Values.Look(ref maxContextTokens, "maxContextTokens", 100000); + Scribe_Values.Look(ref enableDebugLogs, "enableDebugLogs", false); base.ExposeData(); } } diff --git a/Source/WulaFallenEmpire/WulaLog.cs b/Source/WulaFallenEmpire/WulaLog.cs new file mode 100644 index 00000000..3c7d48ea --- /dev/null +++ b/Source/WulaFallenEmpire/WulaLog.cs @@ -0,0 +1,22 @@ +using Verse; + +namespace WulaFallenEmpire +{ + /// + /// Centralized debug logging controlled by mod settings. + /// Only shows when mod option is enabled, independent of DevMode. + /// + public static class WulaLog + { + private static bool DebugEnabled => + WulaFallenEmpireMod.settings?.enableDebugLogs ?? false; + + public static void Debug(string message) + { + if (DebugEnabled) + { + Log.Message(message); + } + } + } +}