nonstandard build time value for a cnc classic mod fixes #2164

remove the testcase in structures.yaml if unwanted for cnc mod
This commit is contained in:
Matthias Mailänder
2012-06-27 10:53:01 +02:00
committed by Chris Forbes
parent d498ff1085
commit ed6a625c69
4 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
#region Copyright & License Information
/*
* Copyright 2007-2012 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Buildings
{
// allow a nonstandard build time value for a cnc classic mod
public class CustomBuildTimeValueInfo : TraitInfo<CustomBuildTimeValue>
{
public readonly int Value = 0; //in milisecons
}
public class CustomBuildTimeValue { }
}

View File

@@ -146,6 +146,7 @@
<Compile Include="Buildings\BuildingInfluence.cs" />
<Compile Include="Buildings\CanPowerDown.cs" />
<Compile Include="Buildings\CustomSellValue.cs" />
<Compile Include="Buildings\CustomBuildTimeValue.cs" />
<Compile Include="Buildings\FootprintUtils.cs" />
<Compile Include="Buildings\LineBuild.cs" />
<Compile Include="Buildings\PowerManager.cs" />

View File

@@ -254,6 +254,10 @@ namespace OpenRA.Mods.RA
* Info.BuildSpeed
* (25 * 60) /* frames per min */ /* todo: build acceleration, if we do that */
/ 1000;
if (unit.Traits.Contains<CustomBuildTimeValueInfo>())
time = unit.Traits.Get<CustomBuildTimeValueInfo>().Value * (1 / Info.BuildSpeed);
return (int) time;
}

View File

@@ -100,6 +100,8 @@ PROC:
Bounds: 73,72
CustomSellValue:
Value: 300
CustomBuildTimeValue:
Value: 80
FreeActor:
Actor: HARV
InitialActivity: FindResources