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:
committed by
Chris Forbes
parent
d498ff1085
commit
ed6a625c69
23
OpenRA.Mods.RA/Buildings/CustomBuildTimeValue.cs
Executable file
23
OpenRA.Mods.RA/Buildings/CustomBuildTimeValue.cs
Executable 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 { }
|
||||||
|
}
|
||||||
@@ -146,6 +146,7 @@
|
|||||||
<Compile Include="Buildings\BuildingInfluence.cs" />
|
<Compile Include="Buildings\BuildingInfluence.cs" />
|
||||||
<Compile Include="Buildings\CanPowerDown.cs" />
|
<Compile Include="Buildings\CanPowerDown.cs" />
|
||||||
<Compile Include="Buildings\CustomSellValue.cs" />
|
<Compile Include="Buildings\CustomSellValue.cs" />
|
||||||
|
<Compile Include="Buildings\CustomBuildTimeValue.cs" />
|
||||||
<Compile Include="Buildings\FootprintUtils.cs" />
|
<Compile Include="Buildings\FootprintUtils.cs" />
|
||||||
<Compile Include="Buildings\LineBuild.cs" />
|
<Compile Include="Buildings\LineBuild.cs" />
|
||||||
<Compile Include="Buildings\PowerManager.cs" />
|
<Compile Include="Buildings\PowerManager.cs" />
|
||||||
|
|||||||
@@ -254,6 +254,10 @@ namespace OpenRA.Mods.RA
|
|||||||
* Info.BuildSpeed
|
* Info.BuildSpeed
|
||||||
* (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;
|
||||||
|
|
||||||
|
if (unit.Traits.Contains<CustomBuildTimeValueInfo>())
|
||||||
|
time = unit.Traits.Get<CustomBuildTimeValueInfo>().Value * (1 / Info.BuildSpeed);
|
||||||
|
|
||||||
return (int) time;
|
return (int) time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ PROC:
|
|||||||
Bounds: 73,72
|
Bounds: 73,72
|
||||||
CustomSellValue:
|
CustomSellValue:
|
||||||
Value: 300
|
Value: 300
|
||||||
|
CustomBuildTimeValue:
|
||||||
|
Value: 80
|
||||||
FreeActor:
|
FreeActor:
|
||||||
Actor: HARV
|
Actor: HARV
|
||||||
InitialActivity: FindResources
|
InitialActivity: FindResources
|
||||||
|
|||||||
Reference in New Issue
Block a user