✅ WulaFallenEmpireSettings.cs - 添加了 public bool enableDebugLogs = false; 字段和保存配置
✅ WulaLog.cs - 修改了DebugEnabled属性,仅检查enableDebugLogs设置(不检查DevMode) ✅ WulaFallenEmpireMod.cs - 在DoSettingsWindowContents中添加了UI复选框,显示"Enable Debug Logs"选项 ✅ 替换了所有848个Log.Message/Error/Warning调用为WulaLog.Debug()
This commit is contained in:
@@ -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<bool>("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<bool>("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<bool>("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<bool>("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<bool>("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<bool>("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<bool>("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<bool>("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<bool>("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;
|
||||
|
||||
@@ -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<GlobalStorageWorldComponent>();
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
/// </summary>
|
||||
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<IntVec3> spawnedPositions = new List<IntVec3>();
|
||||
int successCount = 0;
|
||||
@@ -240,12 +240,12 @@ namespace WulaFallenEmpire
|
||||
// 生成一个所有可能位置的列表
|
||||
List<IntVec3> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<GlobalStorageWorldComponent>();
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user