Migrate BuildSpeed from float to int

This commit is contained in:
reaperrr
2016-03-24 16:45:22 +01:00
parent a0f9af1ebe
commit 38cea38f6b
11 changed files with 54 additions and 38 deletions

View File

@@ -128,7 +128,7 @@ namespace OpenRA.Mods.Common.Traits
if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait<DeveloperMode>().FastBuild)
return 0;
var time = (int)(unit.GetBuildTime() * Info.BuildSpeed);
var time = unit.GetBuildTime() * Info.BuildSpeed / 100;
if (info.SpeedUp)
{

View File

@@ -34,8 +34,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Should the prerequisite remain enabled if the owner changes?")]
public readonly bool Sticky = true;
[Desc("This value is used to translate the unit cost into build time.")]
public readonly float BuildSpeed = 0.4f;
[Desc("This percentage value is multiplied with actor cost to translate into build time (lower means faster).")]
public readonly int BuildSpeed = 40;
[Desc("The build time is multiplied with this value on low power.")]
public readonly int LowPowerSlowdown = 3;
@@ -319,8 +319,8 @@ namespace OpenRA.Mods.Common.Traits
if (self.World.AllowDevCommands && self.Owner.PlayerActor.Trait<DeveloperMode>().FastBuild)
return 0;
var time = unit.GetBuildTime() * Info.BuildSpeed;
return (int)time;
var time = unit.GetBuildTime() * Info.BuildSpeed / 100;
return time;
}
protected void CancelProduction(string itemName, uint numberToCancel)

View File

@@ -644,6 +644,22 @@ namespace OpenRA.Mods.Common.UtilityCommands
node.Key = "ReloadDelay";
}
// Migrated ProductionQueue BuildSpeed to use int percentage instead of float
if (engineVersion < 20160325)
{
if (node.Key.StartsWith("ProductionQueue") || node.Key.StartsWith("ClassicProductionQueue"))
{
var buildSpeedNode = node.Value.Nodes.FirstOrDefault(x => x.Key == "BuildSpeed");
if (buildSpeedNode != null)
{
// The BuildSpeed value is now an int percentage, so multiply the float with 100.
var oldValue = FieldLoader.GetValue<float>("BuildSpeed", buildSpeedNode.Value.Value);
var newValue = (int)(oldValue * 100);
buildSpeedNode.Value.Value = newValue.ToString();
}
}
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}

View File

@@ -25,7 +25,7 @@ FACT:
Type: Building.GDI
Factions: gdi
Group: Building
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 2
QueuedAudio: Building
ReadyAudio: ConstructionComplete
@@ -33,7 +33,7 @@ FACT:
Type: Building.Nod
Factions: nod
Group: Building
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 2
QueuedAudio: Building
ReadyAudio: ConstructionComplete
@@ -41,7 +41,7 @@ FACT:
Type: Defence.GDI
Factions: gdi
Group: Defence
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
@@ -49,7 +49,7 @@ FACT:
Type: Defence.Nod
Factions: nod
Group: Defence
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
@@ -260,7 +260,7 @@ PYLE:
Type: Infantry.GDI
Group: Infantry
RequireOwner: false
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
ProductionBar:
Power:
@@ -300,7 +300,7 @@ HAND:
Type: Infantry.Nod
Group: Infantry
RequireOwner: false
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
ProductionBar:
Power:
@@ -344,7 +344,7 @@ AFLD:
Type: Vehicle.Nod
Group: Vehicle
RequireOwner: false
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
ReadyAudio:
ProductionBar:
@@ -391,7 +391,7 @@ WEAP:
Type: Vehicle.GDI
RequireOwner: false
Group: Vehicle
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
ProductionBar:
Power:
@@ -428,13 +428,13 @@ HPAD:
Type: Aircraft.GDI
Factions: gdi
Group: Aircraft
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
ProductionQueue@Nod:
Type: Aircraft.Nod
Factions: nod
Group: Aircraft
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
ProductionBar@GDI:
ProductionType: Aircraft.GDI

View File

@@ -65,7 +65,7 @@ BIO:
Type: Biolab
Group: Infantry
RequireOwner: false
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
ProductionBar:
RallyPoint:

View File

@@ -3,7 +3,7 @@ Player:
TechTree:
ClassicProductionQueue@Building:
Type: Building
BuildSpeed: 1.0
BuildSpeed: 100
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: BuildingReady
@@ -11,7 +11,7 @@ Player:
SpeedUp: true
ClassicProductionQueue@Upgrade:
Type: Upgrade
BuildSpeed: 1.0
BuildSpeed: 100
LowPowerSlowdown: 0
QueuedAudio: Upgrading
ReadyAudio: NewOptions
@@ -19,34 +19,34 @@ Player:
SpeedUp: true
ClassicProductionQueue@Infantry:
Type: Infantry
BuildSpeed: 1.0
BuildSpeed: 100
LowPowerSlowdown: 3
BlockedAudio: NoRoom
SpeedUp: true
ClassicProductionQueue@Vehicle:
Type: Vehicle
BuildSpeed: 1.0
BuildSpeed: 100
LowPowerSlowdown: 3
QueuedAudio: Building
BlockedAudio: NoRoom
SpeedUp: true
ClassicProductionQueue@Armor:
Type: Armor
BuildSpeed: 1.0
BuildSpeed: 100
LowPowerSlowdown: 3
QueuedAudio: Building
BlockedAudio: NoRoom
SpeedUp: true
ClassicProductionQueue@Starport:
Type: Starport
BuildSpeed: 0.85
BuildSpeed: 85
LowPowerSlowdown: 0
BlockedAudio: NoRoom
QueuedAudio: OrderPlaced
ReadyAudio:
ClassicProductionQueue@Aircraft:
Type: Aircraft
BuildSpeed: 1.25
BuildSpeed: 125
LowPowerSlowdown: 3
QueuedAudio: Building
BlockedAudio: NoRoom

View File

@@ -54,7 +54,7 @@ SILO:
Player:
ClassicProductionQueue@Building:
BuildSpeed: 0.4
BuildSpeed: 40
Shroud:
FogLocked: True
FogEnabled: True

View File

@@ -76,7 +76,7 @@ FORTCRATE:
Player:
ClassicProductionQueue@Infantry:
BuildSpeed: 1
BuildSpeed: 100
-EnemyWatcher:
Shroud:
FogLocked: True

View File

@@ -11,9 +11,9 @@ World:
Player:
ClassicProductionQueue@Infantry:
BuildSpeed: 1
BuildSpeed: 100
ClassicProductionQueue@Vehicle:
BuildSpeed: 1
BuildSpeed: 100
Shroud:
FogLocked: True
FogEnabled: True

View File

@@ -3,36 +3,36 @@ Player:
TechTree:
ClassicProductionQueue@Building:
Type: Building
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
SpeedUp: True
ClassicProductionQueue@Defense:
Type: Defense
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
SpeedUp: True
ClassicProductionQueue@Vehicle:
Type: Vehicle
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
SpeedUp: True
ClassicProductionQueue@Infantry:
Type: Infantry
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
SpeedUp: True
ClassicProductionQueue@Ship:
Type: Ship
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
SpeedUp: True
ClassicProductionQueue@Aircraft:
Type: Aircraft
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
SpeedUp: True
PlaceBuilding:

View File

@@ -4,31 +4,31 @@ Player:
GlobalUpgradeManager:
ClassicProductionQueue@Building:
Type: Building
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
SpeedUp: True
ClassicProductionQueue@Defense:
Type: Defense
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
QueuedAudio: Building
ReadyAudio: ConstructionComplete
SpeedUp: True
ClassicProductionQueue@Vehicle:
Type: Vehicle
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
SpeedUp: True
ClassicProductionQueue@Infantry:
Type: Infantry
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
SpeedUp: True
ClassicProductionQueue@Air:
Type: Air
BuildSpeed: .4
BuildSpeed: 40
LowPowerSlowdown: 3
SpeedUp: True
PlaceBuilding: