Fix AI crashing when trying to make parachuted harvester search map for resources while mid-air

This commit is contained in:
reaperrr
2017-12-08 02:12:51 +01:00
committed by abcdefg30
parent b5ffe17d60
commit 85c5259361
2 changed files with 10 additions and 0 deletions

View File

@@ -59,6 +59,8 @@ namespace OpenRA.Mods.Common.Traits
positionable = self.Trait<IPositionable>();
}
public bool IsInAir { get; private set; }
void INotifyCreated.Created(Actor self)
{
conditionManager = self.TraitOrDefault<ConditionManager>();
@@ -66,12 +68,16 @@ namespace OpenRA.Mods.Common.Traits
void INotifyParachute.OnParachute(Actor self)
{
IsInAir = true;
if (conditionManager != null && parachutingToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(info.ParachutingCondition))
parachutingToken = conditionManager.GrantCondition(self, info.ParachutingCondition);
}
void INotifyParachute.OnLanded(Actor self, Actor ignore)
{
IsInAir = false;
if (parachutingToken != ConditionManager.InvalidConditionToken)
parachutingToken = conditionManager.RevokeCondition(self, parachutingToken);