Merge branch 'master' of git://github.com/chrisforbes/OpenRA

This commit is contained in:
Alli
2009-12-23 22:24:31 +13:00
6 changed files with 33 additions and 36 deletions

View File

@@ -29,10 +29,13 @@ namespace OpenRa.Game.Traits
self.InflictDamage(crusher, self.Health, Rules.WarheadInfo["Crush"]);
}
public IEnumerable<UnitMovementType> CrushableBy()
public bool CrushableBy(UnitMovementType umt)
{
yield return UnitMovementType.Track;
//yield return UnitMovementType.Wheel; // Can infantry be crushed by wheel?
switch (umt)
{
case UnitMovementType.Track: return true;
default: return false;
}
}
}
}

View File

@@ -37,7 +37,14 @@ namespace OpenRa.Game.Traits
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
{
if (mi.Button == MouseButton.Left) return null;
if (underCursor != null) return null;
if (underCursor != null)
{
// force-move
if (!mi.Modifiers.HasModifier(Modifiers.Alt)) return null;
if (!Game.IsActorCrushableByActor(underCursor, self)) return null;
}
if (Util.GetEffectiveSpeed(self) == 0) return null; /* allow disabling move orders from modifiers */
if (xy == toCell) return null;
return Order.Move(self, xy);

View File

@@ -64,6 +64,6 @@ namespace OpenRa.Game.Traits
bool IsCrushableByFriend();
bool IsCrushableByEnemy();
void OnCrush(Actor crusher);
IEnumerable<UnitMovementType>CrushableBy();
bool CrushableBy(UnitMovementType umt);
}
}