Change LowPowerSlowdown to LowPowerModifier

This commit is contained in:
Mustafa Alperen Seki
2018-09-29 16:36:21 +03:00
committed by Paul Chote
parent 831ec0aeda
commit 53304a0353
2 changed files with 11 additions and 10 deletions

View File

@@ -47,8 +47,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Maximum number of items that can be queued across all actor types (0 = infinite).")] [Desc("Maximum number of items that can be queued across all actor types (0 = infinite).")]
public readonly int QueueLimit = 0; public readonly int QueueLimit = 0;
[Desc("The build time is multiplied with this value on low power.")] [Desc("The build time is multiplied with this percentage on low power.")]
public readonly int LowPowerSlowdown = 3; public readonly int LowPowerModifier = 300;
[NotificationReference("Speech")] [NotificationReference("Speech")]
[Desc("Notification played when production is complete.", [Desc("Notification played when production is complete.",
@@ -86,8 +86,8 @@ namespace OpenRA.Mods.Common.Traits
public void RulesetLoaded(Ruleset rules, ActorInfo ai) public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{ {
if (LowPowerSlowdown <= 0) if (LowPowerModifier <= 0)
throw new YamlException("Production queue must have LowPowerSlowdown of at least 1."); throw new YamlException("Production queue must have LowPowerModifier of at least 1.");
} }
} }
@@ -541,7 +541,7 @@ namespace OpenRA.Mods.Common.Traits
get get
{ {
return (pm == null || pm.PowerState == PowerState.Normal) ? RemainingTime : return (pm == null || pm.PowerState == PowerState.Normal) ? RemainingTime :
RemainingTime * Queue.Info.LowPowerSlowdown; RemainingTime * Queue.Info.LowPowerModifier / 100;
} }
} }
@@ -590,8 +590,9 @@ namespace OpenRA.Mods.Common.Traits
if (pm != null && pm.PowerState != PowerState.Normal) if (pm != null && pm.PowerState != PowerState.Normal)
{ {
if (--Slowdown <= 0) Slowdown -= 100;
Slowdown = Queue.Info.LowPowerSlowdown; if (Slowdown < 0)
Slowdown = Queue.Info.LowPowerModifier + Slowdown;
else else
return; return;
} }

View File

@@ -106,10 +106,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
} }
var buildTime = tooltipIcon.ProductionQueue == null ? 0 : tooltipIcon.ProductionQueue.GetBuildTime(actor, buildable); var buildTime = tooltipIcon.ProductionQueue == null ? 0 : tooltipIcon.ProductionQueue.GetBuildTime(actor, buildable);
var timeMultiplier = pm != null && pm.PowerState != PowerState.Normal ? tooltipIcon.ProductionQueue.Info.LowPowerSlowdown : 1; var timeModifier = pm != null && pm.PowerState != PowerState.Normal ? tooltipIcon.ProductionQueue.Info.LowPowerModifier : 100;
timeLabel.Text = formatBuildTime.Update(buildTime * timeMultiplier); timeLabel.Text = formatBuildTime.Update((buildTime * timeModifier) / 100);
timeLabel.TextColor = (pm != null && pm.PowerState != PowerState.Normal && tooltipIcon.ProductionQueue.Info.LowPowerSlowdown > 1) ? Color.Red : Color.White; timeLabel.TextColor = (pm != null && pm.PowerState != PowerState.Normal && tooltipIcon.ProductionQueue.Info.LowPowerModifier > 100) ? Color.Red : Color.White;
var timeSize = font.Measure(timeLabel.Text); var timeSize = font.Measure(timeLabel.Text);
costLabel.Text = cost.ToString(); costLabel.Text = cost.ToString();