From ed6a625c69a243753ab865936c86d5caa3e3fb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 27 Jun 2012 10:53:01 +0200 Subject: [PATCH] nonstandard build time value for a cnc classic mod fixes #2164 remove the testcase in structures.yaml if unwanted for cnc mod --- .../Buildings/CustomBuildTimeValue.cs | 23 +++++++++++++++++++ OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 1 + OpenRA.Mods.RA/Player/ProductionQueue.cs | 4 ++++ mods/cnc/rules/structures.yaml | 2 ++ 4 files changed, 30 insertions(+) create mode 100755 OpenRA.Mods.RA/Buildings/CustomBuildTimeValue.cs diff --git a/OpenRA.Mods.RA/Buildings/CustomBuildTimeValue.cs b/OpenRA.Mods.RA/Buildings/CustomBuildTimeValue.cs new file mode 100755 index 0000000000..f881894de8 --- /dev/null +++ b/OpenRA.Mods.RA/Buildings/CustomBuildTimeValue.cs @@ -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 + { + public readonly int Value = 0; //in milisecons + } + + public class CustomBuildTimeValue { } +} diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index bd04530279..cf6f8c3ed1 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -146,6 +146,7 @@ + diff --git a/OpenRA.Mods.RA/Player/ProductionQueue.cs b/OpenRA.Mods.RA/Player/ProductionQueue.cs index d5fc343382..06a31a31ec 100755 --- a/OpenRA.Mods.RA/Player/ProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ProductionQueue.cs @@ -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()) + time = unit.Traits.Get().Value * (1 / Info.BuildSpeed); + return (int) time; } diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 5029ed6479..502c0d51af 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -100,6 +100,8 @@ PROC: Bounds: 73,72 CustomSellValue: Value: 300 + CustomBuildTimeValue: + Value: 80 FreeActor: Actor: HARV InitialActivity: FindResources