oops; forgot about the mouse buttons
This commit is contained in:
@@ -16,14 +16,21 @@ namespace OpenRa.Game.Traits.Activities
|
|||||||
public IActivity Tick(Actor self)
|
public IActivity Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (target == null || target.IsDead) return NextActivity;
|
if (target == null || target.IsDead) return NextActivity;
|
||||||
// todo: don't waste engineers on things that have been captured
|
|
||||||
// between order issue time and the time we hit the building.
|
|
||||||
|
|
||||||
target.Health -= EngineerCapture.EngineerDamage;
|
if (target.Owner == self.Owner)
|
||||||
if (target.Health <= 0)
|
|
||||||
{
|
{
|
||||||
target.Owner = self.Owner;
|
if (target.Health == target.Info.Strength)
|
||||||
target.Health = EngineerCapture.EngineerDamage;
|
return NextActivity;
|
||||||
|
target.Health += EngineerCapture.EngineerDamage;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target.Health -= EngineerCapture.EngineerDamage;
|
||||||
|
if (target.Health <= 0)
|
||||||
|
{
|
||||||
|
target.Owner = self.Owner;
|
||||||
|
target.Health = EngineerCapture.EngineerDamage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// the engineer is sacrificed.
|
// the engineer is sacrificed.
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace OpenRa.Game.Traits
|
|||||||
|
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
|
if (mi.Button != MouseButton.Right) return null;
|
||||||
if (underCursor == null) return null;
|
if (underCursor == null) return null;
|
||||||
if (underCursor.Owner == self.Owner && !mi.Modifiers.HasModifier(Modifiers.Ctrl)) return null;
|
if (underCursor.Owner == self.Owner && !mi.Modifiers.HasModifier(Modifiers.Ctrl)) return null;
|
||||||
if (!underCursor.traits.Contains<Building>()) return null;
|
if (!underCursor.traits.Contains<Building>()) return null;
|
||||||
|
|||||||
@@ -8,10 +8,13 @@ namespace OpenRa.Game.Traits
|
|||||||
{
|
{
|
||||||
class EngineerCapture : IOrder
|
class EngineerCapture : IOrder
|
||||||
{
|
{
|
||||||
public const int EngineerDamage = 300;
|
public const int EngineerDamage = 300; // todo: push into rules, as a weapon
|
||||||
|
|
||||||
|
public EngineerCapture(Actor self) { }
|
||||||
|
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
|
if (mi.Button != MouseButton.Right) return null;
|
||||||
if (underCursor == null) return null;
|
if (underCursor == null) return null;
|
||||||
if (!underCursor.traits.Contains<Building>()) return null;
|
if (!underCursor.traits.Contains<Building>()) return null;
|
||||||
|
|
||||||
@@ -26,7 +29,7 @@ namespace OpenRa.Game.Traits
|
|||||||
if (order.OrderString == "Enter" || order.OrderString == "Capture")
|
if (order.OrderString == "Enter" || order.OrderString == "Capture")
|
||||||
{
|
{
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
self.QueueActivity(new Move(order.TargetActor, 2));
|
self.QueueActivity(new Move(order.TargetActor, 1));
|
||||||
self.QueueActivity(new CaptureBuilding(order.TargetActor));
|
self.QueueActivity(new CaptureBuilding(order.TargetActor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user