Skip to content

Commit

Permalink
Hacky stuff to allow Chinooks to move over stuff
Browse files Browse the repository at this point in the history
while still blocking each other
  • Loading branch information
MustaphaTR committed Jan 14, 2018
1 parent 43f3b26 commit 201b653
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions OpenRA.Mods.Common/Traits/Mobile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public class MobileInfo : ConditionalTraitInfo, IMoveInfo, IPositionableInfo, IF
[Desc("Occupy space? Units such as Mob spawners doesn't occupy space, letting others to enter.")]
public readonly bool OccupySpace = true;

[Desc("If this value is not null, these actors can't block me.")]
public readonly string[] NonBlockerActors = null;

[Desc("If this value is not null, only these actors can block me.")]
public readonly string[] BlockerActors = null;

[Desc("Can the actor be ordered to move in to shroud?")]
public readonly bool MoveIntoShroud = true;

Expand Down Expand Up @@ -324,6 +330,14 @@ bool IsBlockedBy(Actor self, Actor otherActor, Actor ignoreActor, CellConditions
IsMovingInMyDirection(self, otherActor))
return false;

if (BlockerActors != null)
if (!BlockerActors.Contains(otherActor.Info.Name))
return false;

if (NonBlockerActors != null)
if (NonBlockerActors.Contains(otherActor.Info.Name))
return false;

// If there is a temporary blocker in our path, but we can remove it, we are not blocked.
var temporaryBlocker = otherActor.TraitOrDefault<ITemporaryBlocker>();
if (temporaryBlocker != null && temporaryBlocker.CanRemoveBlockage(otherActor, self))
Expand Down

0 comments on commit 201b653

Please sign in to comment.