Some trait info moved from GlobalDefaults to sane places

This commit is contained in:
alzeih
2010-04-02 15:30:04 +13:00
parent df336aee70
commit c54d904e2b
5 changed files with 9 additions and 9 deletions

View File

@@ -94,7 +94,6 @@
<Compile Include="Effects\Smoke.cs" /> <Compile Include="Effects\Smoke.cs" />
<Compile Include="Effects\TeslaZap.cs" /> <Compile Include="Effects\TeslaZap.cs" />
<Compile Include="Exts.cs" /> <Compile Include="Exts.cs" />
<Compile Include="GameRules\GeneralInfo.cs" />
<Compile Include="GameRules\ActorInfo.cs" /> <Compile Include="GameRules\ActorInfo.cs" />
<Compile Include="GameRules\TechTree.cs" /> <Compile Include="GameRules\TechTree.cs" />
<Compile Include="GameRules\UserSettings.cs" /> <Compile Include="GameRules\UserSettings.cs" />

View File

@@ -27,6 +27,8 @@ namespace OpenRA.Traits
{ {
class ProductionQueueInfo : ITraitInfo class ProductionQueueInfo : ITraitInfo
{ {
public readonly float BuildSpeed = 0.4f;
public readonly int LowPowerSlowdown = 3;
public object Create(Actor self) { return new ProductionQueue(self); } public object Create(Actor self) { return new ProductionQueue(self); }
} }
@@ -57,7 +59,7 @@ namespace OpenRA.Traits
var unit = Rules.Info[order.TargetString]; var unit = Rules.Info[order.TargetString];
var ui = unit.Traits.Get<BuildableInfo>(); var ui = unit.Traits.Get<BuildableInfo>();
var time = ui.Cost var time = ui.Cost
* self.World.Defaults.BuildSpeed /* todo: country-specific build speed bonus */ * self.Owner.PlayerActor.Info.Traits.Get<ProductionQueueInfo>().BuildSpeed /* todo: country-specific build speed bonus */
* (25 * 60) /* frames per min */ /* todo: build acceleration, if we do that */ * (25 * 60) /* frames per min */ /* todo: build acceleration, if we do that */
/ 1000; / 1000;
@@ -192,7 +194,7 @@ namespace OpenRA.Traits
class ProductionItem class ProductionItem
{ {
public readonly string Item; public readonly string Item;
public readonly int TotalTime; public readonly int TotalTime;
public readonly int TotalCost; public readonly int TotalCost;
public int RemainingTime { get; private set; } public int RemainingTime { get; private set; }
@@ -226,14 +228,13 @@ namespace OpenRA.Traits
if (player.GetPowerState() != PowerState.Normal) if (player.GetPowerState() != PowerState.Normal)
{ {
if (--slowdown <= 0) if (--slowdown <= 0)
slowdown = player.World.Defaults.LowPowerSlowdown; slowdown = player.PlayerActor.Info.Traits.Get<ProductionQueueInfo>().LowPowerSlowdown;
else else
return; return;
} }
var costThisFrame = RemainingCost / RemainingTime; var costThisFrame = RemainingCost / RemainingTime;
if (costThisFrame != 0 && !player.TakeCash(costThisFrame)) return; if (costThisFrame != 0 && !player.TakeCash(costThisFrame)) return;
RemainingCost -= costThisFrame; RemainingCost -= costThisFrame;
RemainingTime -= 1; RemainingTime -= 1;
if (RemainingTime > 0) return; if (RemainingTime > 0) return;

View File

@@ -42,7 +42,6 @@ namespace OpenRA.Traits
public readonly int Incoming = 10; public readonly int Incoming = 10;
/* Income & Production */ /* Income & Production */
public readonly float BuildSpeed = 0.4f;
public readonly float BuildupTime = 0.06f; public readonly float BuildupTime = 0.06f;
public readonly float OreTruckRate = 1; public readonly float OreTruckRate = 1;
public readonly bool SeparateAircraft = false; public readonly bool SeparateAircraft = false;
@@ -75,12 +74,9 @@ namespace OpenRA.Traits
public readonly int LZScanRadius = 16; public readonly int LZScanRadius = 16;
public readonly bool MineAware = true; public readonly bool MineAware = true;
public readonly float Stray = 2.0f; public readonly float Stray = 2.0f;
public readonly float SubmergeDelay = 0.02f;
public readonly float SuspendDelay = 2.0f; public readonly float SuspendDelay = 2.0f;
public readonly int SuspendPriority = 20; public readonly int SuspendPriority = 20;
public readonly float TeamDelay = 0.6f; public readonly float TeamDelay = 0.6f;
public readonly int LowPowerSlowdown = 3;
} }
public class GlobalDefaults {} public class GlobalDefaults {}

View File

@@ -1,5 +1,7 @@
Player: Player:
ProductionQueue: ProductionQueue:
BuildSpeed: .4
LowPowerSlowdown: 3
PlaceBuilding: PlaceBuilding:
NukePower: NukePower:
Image: atomicnh Image: atomicnh

View File

@@ -1,5 +1,7 @@
Player: Player:
ProductionQueue: ProductionQueue:
BuildSpeed: .4
LowPowerSlowdown: 3
PlaceBuilding: PlaceBuilding:
GpsPower: GpsPower:
Image: gpssicon Image: gpssicon