Merge branch 'master' of git://github.com/chrisforbes/OpenRA
This commit is contained in:
@@ -241,20 +241,11 @@ namespace OpenRa.Game
|
||||
}
|
||||
public static bool IsActorCrushableByMovementType(Actor a, UnitMovementType umt)
|
||||
{
|
||||
if (a != null)
|
||||
{
|
||||
foreach (var crush in a.traits.WithInterface<ICrushable>())
|
||||
{
|
||||
if (((crush.IsCrushableByEnemy() && a.Owner != Game.LocalPlayer) || (crush.IsCrushableByFriend() && a.Owner == Game.LocalPlayer))
|
||||
&& crush.CrushableBy().Contains(umt))
|
||||
{
|
||||
Log.Write("{0} is crushable by MovementType {1}", a.Info.Name, umt);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Log.Write("{0} is NOT crushable by MovementType {1}", a.Info.Name, umt);
|
||||
}
|
||||
return false;
|
||||
return a != null &&
|
||||
a.traits.WithInterface<ICrushable>()
|
||||
.Any(c => c.CrushableBy(umt) &&
|
||||
((c.IsCrushableByEnemy() && a.Owner != Game.LocalPlayer) ||
|
||||
(c.IsCrushableByFriend() && a.Owner == Game.LocalPlayer)));
|
||||
}
|
||||
|
||||
public static bool IsWater(int2 a)
|
||||
|
||||
@@ -43,8 +43,6 @@ namespace OpenRa.Game.Graphics
|
||||
Log.Write("* LoadSequencesForCursor() done");
|
||||
}
|
||||
|
||||
public static void ForcePrecache() { } // force static ctor to run
|
||||
|
||||
static void LoadSequencesForUnit(XmlElement eUnit)
|
||||
{
|
||||
string unitName = eUnit.GetAttribute("name");
|
||||
|
||||
@@ -62,8 +62,6 @@ namespace OpenRa.Game
|
||||
Game.Initialize(settings.GetValue("map", "scm12ea.ini"), renderer, new int2(ClientSize),
|
||||
settings.GetValue("player", 1), useAftermath, controller);
|
||||
|
||||
SequenceProvider.ForcePrecache();
|
||||
|
||||
ShowCursor(false);
|
||||
Game.ResetTimer();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -64,6 +64,6 @@ namespace OpenRa.Game.Traits
|
||||
bool IsCrushableByFriend();
|
||||
bool IsCrushableByEnemy();
|
||||
void OnCrush(Actor crusher);
|
||||
IEnumerable<UnitMovementType>CrushableBy();
|
||||
bool CrushableBy(UnitMovementType umt);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user