diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj
index 84f9a6276a..b427fe0c01 100644
--- a/OpenRa.Game/OpenRa.Game.csproj
+++ b/OpenRa.Game/OpenRa.Game.csproj
@@ -118,6 +118,7 @@
+
diff --git a/OpenRa.Game/Traits/Activities/Sell.cs b/OpenRa.Game/Traits/Activities/Sell.cs
index e5189bac57..4887503158 100644
--- a/OpenRa.Game/Traits/Activities/Sell.cs
+++ b/OpenRa.Game/Traits/Activities/Sell.cs
@@ -15,7 +15,8 @@ namespace OpenRa.Traits.Activities
void DoSell(Actor self)
{
- var cost = self.Info.Traits.Get().Cost;
+ var csv = self.Info.Traits.GetOrDefault();
+ var cost = csv != null ? csv.Value : self.Info.Traits.Get().Cost;
var hp = self.Info.Traits.Get().HP;
var refund = Rules.General.RefundPercent * self.Health * cost / hp;
diff --git a/OpenRa.Game/Traits/Building.cs b/OpenRa.Game/Traits/Building.cs
index f11a302276..698106345a 100644
--- a/OpenRa.Game/Traits/Building.cs
+++ b/OpenRa.Game/Traits/Building.cs
@@ -96,8 +96,10 @@ namespace OpenRa.Traits
if (remainingTicks == 0)
{
+ var csv = self.Info.Traits.GetOrDefault();
+ var buildingValue = csv != null ? csv.Value : self.Info.Traits.Get().Cost;
var maxHP = self.Info.Traits.Get().HP;
- var costPerHp = (Rules.General.URepairPercent * self.Info.Traits.Get().Cost) / maxHP;
+ var costPerHp = (Rules.General.URepairPercent * buildingValue) / maxHP;
var hpToRepair = Math.Min(Rules.General.URepairStep, maxHP - self.Health);
var cost = (int)Math.Ceiling(costPerHp * hpToRepair);
if (!self.Owner.TakeCash(cost))
diff --git a/OpenRa.Game/Traits/CustomSellValue.cs b/OpenRa.Game/Traits/CustomSellValue.cs
new file mode 100644
index 0000000000..93eca979b0
--- /dev/null
+++ b/OpenRa.Game/Traits/CustomSellValue.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace OpenRa.Traits
+{
+ // allow a nonstandard sell/repair value to avoid
+ // buy-sell exploits like c&c's PROC.
+
+ class CustomSellValueInfo : StatelessTraitInfo
+ {
+ public readonly int Value = 0;
+ }
+
+ class CustomSellValue {}
+}
diff --git a/mods/cnc/structures.yaml b/mods/cnc/structures.yaml
index 3c4202dd80..90f5c966f5 100644
--- a/mods/cnc/structures.yaml
+++ b/mods/cnc/structures.yaml
@@ -58,6 +58,9 @@ PROC:
StoresOre:
Pips: 17
Capacity: 1000
+ CustomSellValue:
+ Value: 600
+
SILO:
Inherits: ^Building
Buildable:
diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml
index 4e4e206fec..bca1563d4a 100644
--- a/mods/ra/rules.yaml
+++ b/mods/ra/rules.yaml
@@ -1354,7 +1354,9 @@ FACT:
Production:
Produces: Building,Defense
ConstructionYard:
- IronCurtainable:
+ IronCurtainable:
+ CustomSellValue:
+ Value: 1000
PROC:
Inherits: ^Building
@@ -1380,6 +1382,8 @@ PROC:
Pips: 17
Capacity: 2000
IronCurtainable:
+ CustomSellValue:
+ Value: 600
SILO:
Inherits: ^Building