Track per-player frozen actors.

This commit is contained in:
Paul Chote
2013-08-07 13:48:23 +12:00
parent c3bcca2ff7
commit eef941fd42
10 changed files with 277 additions and 74 deletions

View File

@@ -27,6 +27,20 @@ namespace OpenRA
return FindActorsInBox(world, loc, loc).Where(a => !world.FogObscures(a));
}
public static readonly IEnumerable<FrozenActor> NoFrozenActors = new FrozenActor[0].AsEnumerable();
public static IEnumerable<FrozenActor> FindFrozenActorsAtMouse(this World world, int2 mouseLocation)
{
if (world.RenderPlayer == null)
return NoFrozenActors;
var frozenLayer = world.RenderPlayer.PlayerActor.TraitOrDefault<FrozenActorLayer>();
if (frozenLayer == null)
return NoFrozenActors;
var loc = Game.viewport.ViewToWorldPx(mouseLocation).ToInt2();
return frozenLayer.FrozenActorsAt(loc);
}
public static IEnumerable<Actor> FindActorsInBox(this World world, CPos tl, CPos br)
{
return world.FindActorsInBox(tl.TopLeft, br.BottomRight);