Let order generators account for selection changes

This commit is contained in:
abcdefg30
2020-05-22 11:21:57 +02:00
committed by Paul Chote
parent b5e3f25418
commit 07d58337f1
12 changed files with 63 additions and 24 deletions

View File

@@ -12,6 +12,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA;
using OpenRA.Graphics;
using OpenRA.Mods.Cnc.Activities;
using OpenRA.Mods.Common.Orders;
@@ -211,9 +212,10 @@ namespace OpenRA.Mods.Cnc.Traits
}
}
protected override void Tick(World world)
protected override void SelectionChanged(World world, IEnumerable<Actor> selected)
{
minelayers.RemoveAll(minelayer => !minelayer.IsInWorld || minelayer.IsDead);
minelayers.Clear();
minelayers.AddRange(selected.Where(s => s.Info.HasTraitInfo<MinelayerInfo>()));
if (!minelayers.Any())
world.CancelInputMode();
}