Fix production door not closing if the actor stays on the exit cell.

This commit is contained in:
Paul Chote
2020-01-27 10:35:12 +00:00
committed by abcdefg30
parent 817f75c808
commit 9dc4ea8541
2 changed files with 10 additions and 2 deletions

View File

@@ -636,7 +636,7 @@ namespace OpenRA.Mods.Common.Traits
return new ReturnToCellActivity(self);
}
class ReturnToCellActivity : Activity
public class ReturnToCellActivity : Activity
{
readonly Mobile mobile;
readonly bool recalculateSubCell;

View File

@@ -40,6 +40,7 @@ namespace OpenRA.Mods.Common.Traits.Render
readonly Animation door;
int desiredFrame;
CPos openExit;
Actor exitingActor;
public WithProductionDoorOverlay(Actor self, WithProductionDoorOverlayInfo info)
: base(info)
@@ -57,8 +58,14 @@ namespace OpenRA.Mods.Common.Traits.Render
void ITick.Tick(Actor self)
{
if (desiredFrame > 0 && !self.World.ActorMap.GetActorsAt(openExit).Any(a => a != self))
if (exitingActor == null)
return;
if (!exitingActor.IsInWorld || exitingActor.Location != openExit || !(exitingActor.CurrentActivity is Mobile.ReturnToCellActivity))
{
desiredFrame = 0;
exitingActor = null;
}
}
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
@@ -70,6 +77,7 @@ namespace OpenRA.Mods.Common.Traits.Render
void INotifyProduction.UnitProduced(Actor self, Actor other, CPos exit)
{
openExit = exit;
exitingActor = other;
desiredFrame = door.CurrentSequence.Length - 1;
}
}