Skip to content

Commit

Permalink
Change LowPowerSlowdown to LowPowerModifier
Browse files Browse the repository at this point in the history
  • Loading branch information
MustaphaTR committed Jan 14, 2018
1 parent 157a783 commit 8666bcf
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 39 deletions.
14 changes: 7 additions & 7 deletions OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs
Expand Up @@ -38,8 +38,8 @@ public class ProductionQueueInfo : ITraitInfo
[Desc("This percentage value is multiplied with actor cost to translate into build time (lower means faster).")]
public readonly int BuildDurationModifier = 100;

[Desc("The build time is multiplied with this value on low power.")]
public readonly int LowPowerSlowdown = 3;
[Desc("The build time is multiplied with this percentage on low power.")]
public readonly int LowPowerModifier = 300;

[Desc("Notification played when production is complete.",
"The filename of the audio is defined per faction in notifications.yaml.")]
Expand All @@ -65,8 +65,8 @@ public class ProductionQueueInfo : ITraitInfo
public virtual object Create(ActorInitializer init) { return new ProductionQueue(init, init.Self.Owner.PlayerActor, this); }

public void RulesetLoaded(Ruleset rules, ActorInfo ai) {
if (LowPowerSlowdown <= 0)
throw new YamlException("Production queue must have LowPowerSlowdown of at least 1.");
if (LowPowerModifier < 100)
throw new YamlException("Production queue must have LowPowerModifier of at least 100.");
}
}

Expand Down Expand Up @@ -458,7 +458,7 @@ public int RemainingTimeActual
get
{
return (pm.PowerState == PowerState.Normal) ? RemainingTime :
RemainingTime * Queue.Info.LowPowerSlowdown;
(RemainingTime * Queue.Info.LowPowerModifier) / 100;
}
}

Expand Down Expand Up @@ -507,8 +507,8 @@ public void Tick(PlayerResources pr)

if (pm.PowerState != PowerState.Normal)
{
if (--Slowdown <= 0)
Slowdown = Queue.Info.LowPowerSlowdown;
if ((Slowdown -= 100) <= 0)
Slowdown = (Queue.Info.LowPowerModifier + Slowdown);
else
return;
}
Expand Down
Expand Up @@ -100,10 +100,10 @@ public ProductionTooltipLogic(Widget widget, TooltipContainerWidget tooltipConta
var powerSize = font.Measure(powerLabel.Text);
var buildTime = tooltipIcon.ProductionQueue == null ? 0 : tooltipIcon.ProductionQueue.GetBuildTime(actor, buildable);
var timeMultiplier = pm.PowerState != PowerState.Normal ? tooltipIcon.ProductionQueue.Info.LowPowerSlowdown : 1;
var timeModifier = pm.PowerState != PowerState.Normal ? tooltipIcon.ProductionQueue.Info.LowPowerModifier : 100;
timeLabel.Text = formatBuildTime.Update(buildTime * timeMultiplier);
timeLabel.TextColor = (pm.PowerState != PowerState.Normal && tooltipIcon.ProductionQueue.Info.LowPowerSlowdown > 1) ? Color.Red : Color.White;
timeLabel.Text = formatBuildTime.Update((buildTime * timeModifier) / 100);
timeLabel.TextColor = (pm.PowerState != PowerState.Normal && tooltipIcon.ProductionQueue.Info.LowPowerModifier > 100) ? Color.Red : Color.White;
var timeSize = font.Measure(timeLabel.Text);
costLabel.Text = cost.ToString();
Expand Down
12 changes: 2 additions & 10 deletions mods/cnc/rules/structures.yaml
Expand Up @@ -30,28 +30,26 @@ FACT:
Type: Building.GDI
Factions: gdi
Group: Building
LowPowerSlowdown: 2
LowPowerModifier: 200
QueuedAudio: Building
ReadyAudio: ConstructionComplete
ProductionQueue@NodBuilding:
Type: Building.Nod
Factions: nod
Group: Building
LowPowerSlowdown: 2
LowPowerModifier: 200
QueuedAudio: Building
ReadyAudio: ConstructionComplete
ProductionQueue@GDIDefense:
Type: Defence.GDI
Factions: gdi
Group: Defence
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
ProductionQueue@NodDefense:
Type: Defence.Nod
Factions: nod
Group: Defence
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
BaseBuilding:
Expand Down Expand Up @@ -289,7 +287,6 @@ PYLE:
Type: Infantry.GDI
Group: Infantry
RequireOwner: false
LowPowerSlowdown: 3
ProductionBar:
Power:
Amount: -20
Expand Down Expand Up @@ -334,7 +331,6 @@ HAND:
Type: Infantry.Nod
Group: Infantry
RequireOwner: false
LowPowerSlowdown: 3
ProductionBar:
Power:
Amount: -20
Expand Down Expand Up @@ -385,7 +381,6 @@ AFLD:
Type: Vehicle.Nod
Group: Vehicle
RequireOwner: false
LowPowerSlowdown: 3
ReadyAudio:
ProductionBar:
Power:
Expand Down Expand Up @@ -438,7 +433,6 @@ WEAP:
Type: Vehicle.GDI
RequireOwner: false
Group: Vehicle
LowPowerSlowdown: 3
ProductionBar:
Power:
Amount: -50
Expand Down Expand Up @@ -480,12 +474,10 @@ HPAD:
Type: Aircraft.GDI
Factions: gdi
Group: Aircraft
LowPowerSlowdown: 3
ProductionQueue@Nod:
Type: Aircraft.Nod
Factions: nod
Group: Aircraft
LowPowerSlowdown: 3
ProductionBar@GDI:
ProductionType: Aircraft.GDI
ProductionBar@Nod:
Expand Down
1 change: 0 additions & 1 deletion mods/cnc/rules/tech.yaml
Expand Up @@ -70,7 +70,6 @@ BIO:
Type: Biolab
Group: Infantry
RequireOwner: false
LowPowerSlowdown: 3
ProductionBar:
RallyPoint:
Offset: -1,-1
Expand Down
9 changes: 2 additions & 7 deletions mods/d2k/rules/player.yaml
Expand Up @@ -4,49 +4,44 @@ Player:
ClassicProductionQueue@Building:
Type: Building
BuildDurationModifier: 250
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: BuildingReady
BlockedAudio: NoRoom
SpeedUp: true
ClassicProductionQueue@Infantry:
Type: Infantry
BuildDurationModifier: 250
LowPowerSlowdown: 3
BlockedAudio: NoRoom
SpeedUp: true
ClassicProductionQueue@Vehicle:
Type: Vehicle
BuildDurationModifier: 250
LowPowerSlowdown: 3
QueuedAudio: Building
BlockedAudio: NoRoom
SpeedUp: true
ClassicProductionQueue@Armor:
Type: Armor
BuildDurationModifier: 250
LowPowerSlowdown: 3
QueuedAudio: Building
BlockedAudio: NoRoom
SpeedUp: true
ClassicProductionQueue@Starport:
Type: Starport
BuildDurationModifier: 212
LowPowerSlowdown: 1
LowPowerModifier: 100
BlockedAudio: NoRoom
QueuedAudio: OrderPlaced
ReadyAudio:
ClassicProductionQueue@Aircraft:
Type: Aircraft
BuildDurationModifier: 312
LowPowerSlowdown: 3
QueuedAudio: Building
BlockedAudio: NoRoom
SpeedUp: true
ClassicProductionQueue@Upgrade: # Upgrade is defined after others so it won't be automatically selected by ProductionQueueFromSelection.
Type: Upgrade
BuildDurationModifier: 250
LowPowerSlowdown: 1
LowPowerModifier: 100
QueuedAudio: Upgrading
ReadyAudio: NewOptions
BlockedAudio: NoRoom
Expand Down
6 changes: 0 additions & 6 deletions mods/ra/rules/player.yaml
Expand Up @@ -3,34 +3,28 @@ Player:
TechTree:
ClassicProductionQueue@Building:
Type: Building
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
SpeedUp: True
ClassicProductionQueue@Defense:
Type: Defense
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
SpeedUp: True
ClassicProductionQueue@Vehicle:
Type: Vehicle
LowPowerSlowdown: 3
QueuedAudio: Building
SpeedUp: True
BuildTimeSpeedReduction: 100, 75, 60, 50
ClassicProductionQueue@Infantry:
Type: Infantry
LowPowerSlowdown: 3
SpeedUp: True
ClassicProductionQueue@Ship:
Type: Ship
LowPowerSlowdown: 3
QueuedAudio: Building
SpeedUp: True
ClassicProductionQueue@Aircraft:
Type: Aircraft
LowPowerSlowdown: 3
QueuedAudio: Building
SpeedUp: True
PlaceBuilding:
Expand Down
5 changes: 0 additions & 5 deletions mods/ts/rules/player.yaml
Expand Up @@ -5,31 +5,26 @@ Player:
ClassicProductionQueue@Building:
Type: Building
BuildDurationModifier: 120
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
SpeedUp: True
ClassicProductionQueue@Defense:
Type: Defense
BuildDurationModifier: 120
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
SpeedUp: True
ClassicProductionQueue@Vehicle:
Type: Vehicle
BuildDurationModifier: 120
LowPowerSlowdown: 3
SpeedUp: True
ClassicProductionQueue@Infantry:
Type: Infantry
BuildDurationModifier: 120
LowPowerSlowdown: 3
SpeedUp: True
ClassicProductionQueue@Air:
Type: Air
BuildDurationModifier: 120
LowPowerSlowdown: 3
SpeedUp: True
PlaceBuilding:
Palette: placebuilding
Expand Down

0 comments on commit 8666bcf

Please sign in to comment.