Remove RepairBuildings from Aircraft

Require them to use Repairable trait instead.
This commit is contained in:
reaperrr
2017-11-13 23:25:23 +01:00
committed by Paul Chote
parent ed7d12506d
commit 139d5efba8
9 changed files with 69 additions and 10 deletions

View File

@@ -19,6 +19,7 @@ namespace OpenRA.Mods.Common.Activities
public class HeliReturnToBase : Activity
{
readonly Aircraft aircraft;
readonly RepairableInfo repairableInfo;
readonly bool alwaysLand;
readonly bool abortOnResupply;
Actor dest;
@@ -26,6 +27,7 @@ namespace OpenRA.Mods.Common.Activities
public HeliReturnToBase(Actor self, bool abortOnResupply, Actor dest = null, bool alwaysLand = true)
{
aircraft = self.Trait<Aircraft>();
repairableInfo = self.Info.TraitInfoOrDefault<RepairableInfo>();
this.alwaysLand = alwaysLand;
this.abortOnResupply = abortOnResupply;
this.dest = dest;
@@ -114,7 +116,7 @@ namespace OpenRA.Mods.Common.Activities
if (alwaysLand)
return true;
if (aircraft.Info.RepairBuildings.Contains(dest.Info.Name) && self.GetDamageState() != DamageState.Undamaged)
if (repairableInfo != null && repairableInfo.RepairBuildings.Contains(dest.Info.Name) && self.GetDamageState() != DamageState.Undamaged)
return true;
return aircraft.Info.RearmBuildings.Contains(dest.Info.Name) && self.TraitsImplementing<AmmoPool>()