added custom sell value trait. this fixes sell/repair on FACT, and buy/sell exploit on PROC

This commit is contained in:
Chris Forbes
2010-02-11 11:56:07 +13:00
parent f2133458ee
commit eeaf51a859
6 changed files with 31 additions and 3 deletions

View File

@@ -15,7 +15,8 @@ namespace OpenRa.Traits.Activities
void DoSell(Actor self)
{
var cost = self.Info.Traits.Get<BuildableInfo>().Cost;
var csv = self.Info.Traits.GetOrDefault<CustomSellValueInfo>();
var cost = csv != null ? csv.Value : self.Info.Traits.Get<BuildableInfo>().Cost;
var hp = self.Info.Traits.Get<OwnedActorInfo>().HP;
var refund = Rules.General.RefundPercent * self.Health * cost / hp;