diff --git a/1.6/1.6/Assemblies/ArachnaeSwarm.dll b/1.6/1.6/Assemblies/ArachnaeSwarm.dll index c2e64a9..9b6b9e8 100644 Binary files a/1.6/1.6/Assemblies/ArachnaeSwarm.dll and b/1.6/1.6/Assemblies/ArachnaeSwarm.dll differ diff --git a/Source/ArachnaeSwarm/ARA_CompInteractiveProducer/CompQueuedInteractiveProducer.cs b/Source/ArachnaeSwarm/ARA_CompInteractiveProducer/CompQueuedInteractiveProducer.cs index b754dbc..a3f5ae9 100644 --- a/Source/ArachnaeSwarm/ARA_CompInteractiveProducer/CompQueuedInteractiveProducer.cs +++ b/Source/ArachnaeSwarm/ARA_CompInteractiveProducer/CompQueuedInteractiveProducer.cs @@ -85,7 +85,7 @@ namespace ArachnaeSwarm } else { - yield return new FloatMenuOption("StartProduction".Translate(process.thingDef.label), () => + yield return new FloatMenuOption("StartProduction".Translate(process.thingDef.label), () => { this.selectedProcess = process; Job job = JobMaker.MakeJob(DefDatabase.GetNamed("ARA_AddProcessToQueueJob"), parent); @@ -170,18 +170,30 @@ namespace ArachnaeSwarm } } - private void FinishProduction(QueuedProcessOrder order) + private (QualityCategory quality, float baseScore, float penalty) GetEstimatedQualityDetails(QueuedProcessOrder order) { - float progress = (float)order.ticksUnderOptimalConditions / order.process.productionTicks; + if (order == null || Props.qualityThresholds.NullOrEmpty()) + { + return (QualityCategory.Normal, 0f, 0f); + } + float progress = (order.process.productionTicks > 0) ? (float)order.ticksUnderOptimalConditions / order.process.productionTicks : 1f; float finalQualityPercent = Mathf.Clamp01(progress - order.temperaturePenaltyPercent); QualityCategory finalQuality = QualityCategory.Awful; - if (!Props.qualityThresholds.NullOrEmpty()) + foreach (var threshold in Props.qualityThresholds.OrderByDescending(q => q.threshold)) { - foreach (var threshold in Props.qualityThresholds.OrderByDescending(q => q.threshold)) + if (finalQualityPercent >= threshold.threshold) { - if (finalQualityPercent >= threshold.threshold) { finalQuality = threshold.quality; break; } + finalQuality = threshold.quality; + break; } } + return (finalQuality, progress, order.temperaturePenaltyPercent); + } + + private void FinishProduction(QueuedProcessOrder order) + { + var qualityDetails = GetEstimatedQualityDetails(order); + QualityCategory finalQuality = qualityDetails.quality; for (int i = 0; i < Props.spawnCount.RandomInRange; i++) { @@ -214,10 +226,16 @@ namespace ArachnaeSwarm foreach (var order in producingNow) { int remainingTicks = order.productionUntilTick - Find.TickManager.TicksGame; - sb.AppendLine($" - {order.process.thingDef.LabelCap}: {remainingTicks.ToStringTicksToPeriod(true, false, true, true)}"); + var qualityDetails = GetEstimatedQualityDetails(order); + sb.AppendLine($" - {order.process.thingDef.LabelCap}: {remainingTicks.ToStringTicksToPeriod(true, false, true, true)} (品质: {qualityDetails.quality.GetLabel()})"); } } + // 添加温度信息 + string tempStr = "CurrentTemperature".Translate(parent.AmbientTemperature.ToStringTemperature("F0")); + tempStr += $" ({"SafeTemperatureRange".Translate()}: {Props.minSafeTemperature.ToStringTemperature("F0")} ~ {Props.maxSafeTemperature.ToStringTemperature("F0")})"; + sb.AppendLine(tempStr); + return sb.ToString().TrimEnd(); } diff --git a/Source/ArachnaeSwarm/ARA_CompInteractiveProducer/DataContracts.cs b/Source/ArachnaeSwarm/ARA_CompInteractiveProducer/DataContracts.cs index f85a990..45cc95d 100644 --- a/Source/ArachnaeSwarm/ARA_CompInteractiveProducer/DataContracts.cs +++ b/Source/ArachnaeSwarm/ARA_CompInteractiveProducer/DataContracts.cs @@ -10,12 +10,20 @@ namespace ArachnaeSwarm public List blacklist; } - public class ProcessDef + public class ProcessDef : IExposable { public ThingDef thingDef; public int productionTicks; public float totalNutritionNeeded; public ResearchProjectDef requiredResearch; + + public void ExposeData() + { + Scribe_Defs.Look(ref thingDef, "thingDef"); + Scribe_Values.Look(ref productionTicks, "productionTicks", 0); + Scribe_Values.Look(ref totalNutritionNeeded, "totalNutritionNeeded", 0f); + Scribe_Defs.Look(ref requiredResearch, "requiredResearch"); + } } public class QualityThreshold