Added Gates

FIXUP: account for full gate footprint when updating neighbours.

FIXUP: gate-wall connection adjacency yaml.
This commit is contained in:
teees
2015-11-16 14:33:05 +01:00
parent 3d597c7880
commit 65e1e301f4
12 changed files with 464 additions and 4 deletions

View File

@@ -284,6 +284,13 @@ namespace OpenRA.Traits
bool CanEnterTargetNow(Actor self, Target target);
}
[RequireExplicitImplementation]
public interface ITemporaryBlocker
{
bool CanRemoveBlockage(Actor self, Actor blocking);
bool IsBlocking(Actor self, CPos cell);
}
public interface INotifyBlockingMove { void OnNotifyBlockingMove(Actor self, Actor blocking); }
public interface IFacing

View File

@@ -37,6 +37,23 @@ namespace OpenRA
a => (a.CenterPosition - origin).HorizontalLengthSquared <= r.LengthSquared);
}
public static bool ContainsTemporaryBlocker(this World world, CPos cell, Actor ignoreActor = null)
{
var temporaryBlockers = world.ActorMap.GetActorsAt(cell);
foreach (var temporaryBlocker in temporaryBlockers)
{
if (temporaryBlocker == ignoreActor)
continue;
var temporaryBlockerTraits = temporaryBlocker.TraitsImplementing<ITemporaryBlocker>();
foreach (var temporaryBlockerTrait in temporaryBlockerTraits)
if (temporaryBlockerTrait.IsBlocking(temporaryBlocker, cell))
return true;
}
return false;
}
public static void DoTimed<T>(this IEnumerable<T> e, Action<T> a, string text)
{
// PERF: This is a hot path and must run with minimal added overhead.