Fix CursorForOrderString to work with orders + preliminary e6 fixes
This commit is contained in:
@@ -56,8 +56,8 @@ namespace OpenRA.Orders
|
|||||||
public string GetCursor( World world, int2 xy, MouseInput mi )
|
public string GetCursor( World world, int2 xy, MouseInput mi )
|
||||||
{
|
{
|
||||||
var c = Order(world, xy, mi)
|
var c = Order(world, xy, mi)
|
||||||
.Select(o => o.Subject.traits.WithInterface<IProvideCursor>()
|
.Select(o => o.Subject.traits.WithInterface<IOrderCursor>()
|
||||||
.Select(pc => pc.CursorForOrderString(o.OrderString, o.Subject, o.TargetLocation)).FirstOrDefault(a => a != null))
|
.Select(pc => pc.CursorForOrder(o.Subject, o)).FirstOrDefault(a => a != null))
|
||||||
.FirstOrDefault(a => a != null);
|
.FirstOrDefault(a => a != null);
|
||||||
|
|
||||||
return c ??
|
return c ??
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Traits
|
|||||||
public virtual object Create(ActorInitializer init) { return new Mobile(init, this); }
|
public virtual object Create(ActorInitializer init) { return new Mobile(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Mobile : IIssueOrder, IResolveOrder, IOccupySpace, IMove, IProvideCursor, INudge
|
public class Mobile : IIssueOrder, IResolveOrder, IOccupySpace, IMove, IOrderCursor, INudge
|
||||||
{
|
{
|
||||||
public readonly Actor self;
|
public readonly Actor self;
|
||||||
public readonly MobileInfo Info;
|
public readonly MobileInfo Info;
|
||||||
@@ -112,12 +112,12 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (s != "Move")
|
if (order.OrderString != "Move")
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return (CanEnterCell(location)) ? "move" : "move-blocked";
|
return (CanEnterCell(order.TargetLocation)) ? "move" : "move-blocked";
|
||||||
}
|
}
|
||||||
|
|
||||||
public int2 TopLeft { get { return toCell; } }
|
public int2 TopLeft { get { return toCell; } }
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly string[] Produces = { };
|
public readonly string[] Produces = { };
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Production : IIssueOrder, IResolveOrder, ITags, IProvideCursor
|
public class Production : IIssueOrder, IResolveOrder, ITags, IOrderCursor
|
||||||
{
|
{
|
||||||
public virtual int2? CreationLocation( Actor self, ActorInfo producee )
|
public virtual int2? CreationLocation( Actor self, ActorInfo producee )
|
||||||
{
|
{
|
||||||
@@ -99,9 +99,9 @@ namespace OpenRA.Traits
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "Deploy") ? "deploy" : null;
|
return (order.OrderString == "Deploy") ? "deploy" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Traits
|
|||||||
public interface IRender { IEnumerable<Renderable> Render(Actor self); }
|
public interface IRender { IEnumerable<Renderable> Render(Actor self); }
|
||||||
public interface IIssueOrder { Order IssueOrder( Actor self, int2 xy, MouseInput mi, Actor underCursor ); }
|
public interface IIssueOrder { Order IssueOrder( Actor self, int2 xy, MouseInput mi, Actor underCursor ); }
|
||||||
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
||||||
public interface IProvideCursor { string CursorForOrderString(string s, Actor a, int2 location); }
|
public interface IOrderCursor { string CursorForOrder(Actor self, Order order); }
|
||||||
|
|
||||||
public interface INotifySold { void Selling( Actor self ); void Sold( Actor self ); }
|
public interface INotifySold { void Selling( Actor self ); void Sold( Actor self ); }
|
||||||
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Aftermath
|
|||||||
public readonly int ChargeTime = 120; // Seconds
|
public readonly int ChargeTime = 120; // Seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChronoshiftDeploy : IIssueOrder, IResolveOrder, ITick, IPips, IProvideCursor
|
class ChronoshiftDeploy : IIssueOrder, IResolveOrder, ITick, IPips, IOrderCursor
|
||||||
{
|
{
|
||||||
// Recharge logic
|
// Recharge logic
|
||||||
[Sync]
|
[Sync]
|
||||||
@@ -67,9 +67,9 @@ namespace OpenRA.Mods.Aftermath
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "Deploy") ? "deploy" : null;
|
return (order.OrderString == "Deploy") ? "deploy" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display 5 pips indicating the current charge status
|
// Display 5 pips indicating the current charge status
|
||||||
|
|||||||
@@ -23,19 +23,13 @@ namespace OpenRA.Mods.RA.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;
|
||||||
var damage = -self.Info.Traits.Get<EngineerCaptureInfo>().EngineerDamage;
|
var damage = self.Info.Traits.Get<EngineerCaptureInfo>().EngineerDamage;
|
||||||
if (self.Owner.Stances[ target.Owner ] == Stance.Ally)
|
|
||||||
{
|
|
||||||
if (target.Health == target.Info.Traits.Get<OwnedActorInfo>().HP)
|
|
||||||
return NextActivity;
|
|
||||||
target.InflictDamage(self, damage, null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (target.Health - damage <= 0)
|
if (target.Health - damage <= 0)
|
||||||
{
|
{
|
||||||
target.World.AddFrameEndTask(w =>
|
target.World.AddFrameEndTask(w =>
|
||||||
{ // momentarily remove from world so the ownership queries don't get confused
|
{
|
||||||
|
// momentarily remove from world so the ownership queries don't get confused
|
||||||
w.Remove(target);
|
w.Remove(target);
|
||||||
target.Owner = self.Owner;
|
target.Owner = self.Owner;
|
||||||
w.Add(target);
|
w.Add(target);
|
||||||
@@ -48,7 +42,6 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
target.InflictDamage(self, damage, null);
|
target.InflictDamage(self, damage, null);
|
||||||
}
|
|
||||||
|
|
||||||
// the engineer is sacrificed.
|
// the engineer is sacrificed.
|
||||||
self.World.AddFrameEndTask(w => w.Remove(self));
|
self.World.AddFrameEndTask(w => w.Remove(self));
|
||||||
|
|||||||
37
OpenRA.Mods.RA/Activities/RepairBuilding.cs
Normal file
37
OpenRA.Mods.RA/Activities/RepairBuilding.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see LICENSE.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA.Activities
|
||||||
|
{
|
||||||
|
class RepairBuilding : IActivity
|
||||||
|
{
|
||||||
|
Actor target;
|
||||||
|
|
||||||
|
public RepairBuilding(Actor target) { this.target = target; }
|
||||||
|
|
||||||
|
public IActivity NextActivity { get; set; }
|
||||||
|
|
||||||
|
public IActivity Tick(Actor self)
|
||||||
|
{
|
||||||
|
if (target == null || target.IsDead) return NextActivity;
|
||||||
|
if (target.Health == target.GetMaxHP())
|
||||||
|
return NextActivity;
|
||||||
|
|
||||||
|
target.InflictDamage(self, -target.GetMaxHP(), null);
|
||||||
|
self.World.AddFrameEndTask(w => w.Remove(self));
|
||||||
|
|
||||||
|
return NextActivity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Cancel(Actor self) { target = null; NextActivity = null; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public virtual object Create(ActorInitializer init) { return new AttackBase(init.self); }
|
public virtual object Create(ActorInitializer init) { return new AttackBase(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AttackBase : IIssueOrder, IResolveOrder, ITick, IExplodeModifier, IProvideCursor
|
public class AttackBase : IIssueOrder, IResolveOrder, ITick, IExplodeModifier, IOrderCursor
|
||||||
{
|
{
|
||||||
public Target target;
|
public Target target;
|
||||||
|
|
||||||
@@ -253,9 +253,9 @@ namespace OpenRA.Mods.RA
|
|||||||
target = Target.None;
|
target = Target.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
switch (s)
|
switch (order.OrderString)
|
||||||
{
|
{
|
||||||
case "Attack": return "attack";
|
case "Attack": return "attack";
|
||||||
case "Heal": return "heal";
|
case "Heal": return "heal";
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly float C4Delay = 0;
|
public readonly float C4Delay = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
class C4Demolition : IIssueOrder, IResolveOrder, IProvideCursor
|
class C4Demolition : IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -42,9 +42,9 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "C4") ? "c4" : null;
|
return (order.OrderString == "C4") ? "c4" : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int UnloadFacing = 0;
|
public readonly int UnloadFacing = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Cargo : IPips, IIssueOrder, IResolveOrder, IProvideCursor
|
public class Cargo : IPips, IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
List<Actor> cargo = new List<Actor>();
|
List<Actor> cargo = new List<Actor>();
|
||||||
|
|
||||||
@@ -49,9 +49,9 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "Deploy") ? "deploy" : null;
|
return (order.OrderString == "Deploy") ? "deploy" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsFull(Actor self)
|
public bool IsFull(Actor self)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class ConstructionYardInfo : TraitInfo<ConstructionYard> { }
|
class ConstructionYardInfo : TraitInfo<ConstructionYard> { }
|
||||||
|
|
||||||
public class ConstructionYard : IIssueOrder, IResolveOrder, IProvideCursor
|
public class ConstructionYard : IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -27,9 +27,9 @@ namespace OpenRA.Mods.RA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "Deploy") ? "deploy" : null;
|
return (order.OrderString == "Deploy") ? "deploy" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -19,37 +19,30 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int EngineerDamage = 300;
|
public readonly int EngineerDamage = 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
class EngineerCapture : IIssueOrder, IResolveOrder, IProvideCursor
|
class EngineerCapture : IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
|
|
||||||
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 (mi.Button != MouseButton.Right) return null;
|
||||||
if (underCursor == null) return null;
|
if (underCursor == null) return null;
|
||||||
|
if (self.Owner.Stances[underCursor.Owner] != Stance.Enemy) return null;
|
||||||
if (!underCursor.traits.Contains<Building>()) return null;
|
if (!underCursor.traits.Contains<Building>()) return null;
|
||||||
|
var isCapture = underCursor.Health <= self.Info.Traits.Get<EngineerCaptureInfo>().EngineerDamage;
|
||||||
|
|
||||||
// todo: other bits
|
return new Order(isCapture ? "Capture" : "Infiltrate",
|
||||||
if (underCursor.Owner == null) return null; // don't allow capturing of bridges, etc.
|
|
||||||
|
|
||||||
var isCapture = underCursor.Health <= self.Info.Traits.Get<EngineerCaptureInfo>().EngineerDamage &&
|
|
||||||
self.Owner.Stances[underCursor.Owner] != Stance.Ally;
|
|
||||||
|
|
||||||
var isHeal = self.Owner.Stances[underCursor.Owner] == Stance.Ally;
|
|
||||||
return new Order(isCapture ? "Capture" :
|
|
||||||
isHeal ? "Repair" : "Infiltrate",
|
|
||||||
self, underCursor);
|
self, underCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "Infiltrate") ? "enter" :
|
return (order.OrderString == "Infiltrate") ? "enter" :
|
||||||
(s == "Repair") ? "goldwrench" :
|
(order.OrderString == "Capture") ? "capture" : null;
|
||||||
(s == "Capture") ? "capture" : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "Infiltrate" || order.OrderString == "Capture" || order.OrderString == "Repair")
|
if (order.OrderString == "Infiltrate" || order.OrderString == "Capture")
|
||||||
{
|
{
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
self.QueueActivity(new Move(order.TargetActor, 1));
|
self.QueueActivity(new Move(order.TargetActor, 1));
|
||||||
|
|||||||
59
OpenRA.Mods.RA/EngineerRepair.cs
Normal file
59
OpenRA.Mods.RA/EngineerRepair.cs
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see LICENSE.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Mods.RA.Activities;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Traits.Activities;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
class EngineerRepairInfo : TraitInfo<EngineerRepair>
|
||||||
|
{
|
||||||
|
public readonly bool RepairsBridges = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class EngineerRepair : IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
|
{
|
||||||
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
|
{
|
||||||
|
if (mi.Button != MouseButton.Right) return null;
|
||||||
|
if (underCursor == null) return null;
|
||||||
|
if (!CanRepair(self, underCursor)) return null;
|
||||||
|
|
||||||
|
return new Order("EngineerRepair", self, underCursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CanRepair(Actor self, Actor a)
|
||||||
|
{
|
||||||
|
if (!a.traits.Contains<Building>()) return false;
|
||||||
|
bool bridge = a.traits.Contains<Bridge>() && !self.Info.Traits.Get<EngineerRepairInfo>().RepairsBridges;
|
||||||
|
|
||||||
|
return (bridge || self.Owner.Stances[a.Owner] == Stance.Ally);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CursorForOrder(Actor self, Order order)
|
||||||
|
{
|
||||||
|
if (order.OrderString != "EngineerRepair") return null;
|
||||||
|
if (order.TargetActor == null) return null;
|
||||||
|
|
||||||
|
return (order.TargetActor.Health == order.TargetActor.GetMaxHP()) ? "goldwrench-blocked" : "goldwrench";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
{
|
||||||
|
if (order.OrderString == "EngineerRepair" && order.TargetActor.Health < order.TargetActor.GetMaxHP())
|
||||||
|
{
|
||||||
|
self.CancelActivity();
|
||||||
|
self.QueueActivity(new Move(order.TargetActor, 1));
|
||||||
|
self.QueueActivity(new RepairBuilding(order.TargetActor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public object Create(ActorInitializer init) { return new Harvester(init.self, this); }
|
public object Create(ActorInitializer init) { return new Harvester(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Harvester : IIssueOrder, IResolveOrder, INotifyDamage, IPips, IRenderModifier, IExplodeModifier, IProvideCursor
|
public class Harvester : IIssueOrder, IResolveOrder, INotifyDamage, IPips, IRenderModifier, IExplodeModifier, IOrderCursor
|
||||||
{
|
{
|
||||||
Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>();
|
Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>();
|
||||||
|
|
||||||
@@ -104,10 +104,10 @@ namespace OpenRA.Mods.RA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "Deliver") ? "enter" :
|
return (order.OrderString == "Deliver") ? "enter" :
|
||||||
(s == "Harvest") ? "attackmove" : null;
|
(order.OrderString == "Harvest") ? "attackmove" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public override object Create( ActorInitializer init ) { return new Helicopter( init ); }
|
public override object Create( ActorInitializer init ) { return new Helicopter( init ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Helicopter : Aircraft, ITick, IIssueOrder, IResolveOrder, IProvideCursor
|
class Helicopter : Aircraft, ITick, IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
public IDisposable reservation;
|
public IDisposable reservation;
|
||||||
|
|
||||||
@@ -51,9 +51,9 @@ namespace OpenRA.Mods.RA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "Enter") ? "enter" : null;
|
return (order.OrderString == "Enter") ? "enter" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string[] RearmBuildings = { "fix" };
|
public readonly string[] RearmBuildings = { "fix" };
|
||||||
}
|
}
|
||||||
|
|
||||||
class Minelayer : IIssueOrder, IResolveOrder, IProvideCursor
|
class Minelayer : IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
/* [Sync] when sync can cope with arrays! */ public int2[] minefield = null;
|
/* [Sync] when sync can cope with arrays! */ public int2[] minefield = null;
|
||||||
[Sync] int2 minefieldStart;
|
[Sync] int2 minefieldStart;
|
||||||
@@ -39,9 +39,9 @@ namespace OpenRA.Mods.RA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "BeginMinefield") ? "ability" : null;
|
return (order.OrderString == "BeginMinefield") ? "ability" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -209,6 +209,8 @@
|
|||||||
<Compile Include="PaletteFromCurrentTheatre.cs" />
|
<Compile Include="PaletteFromCurrentTheatre.cs" />
|
||||||
<Compile Include="Widgets\Delegates\OrderButtonsChromeDelegate.cs" />
|
<Compile Include="Widgets\Delegates\OrderButtonsChromeDelegate.cs" />
|
||||||
<Compile Include="RadarColorFromTerrain.cs" />
|
<Compile Include="RadarColorFromTerrain.cs" />
|
||||||
|
<Compile Include="EngineerRepair.cs" />
|
||||||
|
<Compile Include="Activities\RepairBuilding.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly PipType ColorOfCargoPip = PipType.Green;
|
public readonly PipType ColorOfCargoPip = PipType.Green;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Passenger : IIssueOrder, IResolveOrder, IProvideCursor
|
class Passenger : IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -41,9 +41,9 @@ namespace OpenRA.Mods.RA
|
|||||||
//return new Order("EnterTransport", self, underCursor);
|
//return new Order("EnterTransport", self, underCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "EnterTransport") ? "enter" : null;
|
return (order.OrderString == "EnterTransport") ? "enter" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public override object Create( ActorInitializer init ) { return new Plane( init ); }
|
public override object Create( ActorInitializer init ) { return new Plane( init ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Plane : Aircraft, IIssueOrder, IResolveOrder, IProvideCursor
|
public class Plane : Aircraft, IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
public IDisposable reservation;
|
public IDisposable reservation;
|
||||||
|
|
||||||
@@ -41,9 +41,9 @@ namespace OpenRA.Mods.RA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "Enter") ? "enter" : null;
|
return (order.OrderString == "Enter") ? "enter" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class RepairableInfo : TraitInfo<Repairable> { public readonly string[] RepairBuildings = { "fix" }; }
|
class RepairableInfo : TraitInfo<Repairable> { public readonly string[] RepairBuildings = { "fix" }; }
|
||||||
|
|
||||||
class Repairable : IIssueOrder, IResolveOrder, IProvideCursor
|
class Repairable : IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -31,9 +31,9 @@ namespace OpenRA.Mods.RA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "Enter") ? "enter" : null;
|
return (order.OrderString == "Enter") ? "enter" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string[] Buildings = { "spen", "syrd" };
|
public readonly string[] Buildings = { "spen", "syrd" };
|
||||||
}
|
}
|
||||||
|
|
||||||
class RepairableNear : IIssueOrder, IResolveOrder, IProvideCursor
|
class RepairableNear : IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -36,9 +36,9 @@ namespace OpenRA.Mods.RA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "Enter") ? "enter" : null;
|
return (order.OrderString == "Enter") ? "enter" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class SpyInfo : TraitInfo<Spy> { }
|
class SpyInfo : TraitInfo<Spy> { }
|
||||||
|
|
||||||
class Spy : IIssueOrder, IResolveOrder, IProvideCursor
|
class Spy : IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -28,9 +28,9 @@ namespace OpenRA.Mods.RA
|
|||||||
return new Order("Infiltrate", self, underCursor);
|
return new Order("Infiltrate", self, underCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (s == "Infiltrate") ? "enter" : null;
|
return (order.OrderString == "Infiltrate") ? "enter" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string[] NoTransformSounds = null;
|
public readonly string[] NoTransformSounds = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TransformsOnDeploy : IIssueOrder, IResolveOrder, IProvideCursor
|
class TransformsOnDeploy : IIssueOrder, IResolveOrder, IOrderCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -70,17 +70,17 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CursorForOrderString(string s, Actor a, int2 location)
|
public string CursorForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (s != "DeployTransform")
|
if (order.OrderString != "DeployTransform")
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var depInfo = a.Info.Traits.Get<TransformsOnDeployInfo>();
|
var depInfo = self.Info.Traits.Get<TransformsOnDeployInfo>();
|
||||||
var transInfo = Rules.Info[depInfo.TransformsInto];
|
var transInfo = Rules.Info[depInfo.TransformsInto];
|
||||||
if (transInfo.Traits.Contains<BuildingInfo>())
|
if (transInfo.Traits.Contains<BuildingInfo>())
|
||||||
{
|
{
|
||||||
var bi = transInfo.Traits.Get<BuildingInfo>();
|
var bi = transInfo.Traits.Get<BuildingInfo>();
|
||||||
if (!a.World.CanPlaceBuilding(depInfo.TransformsInto, bi, a.Location + new int2(depInfo.Offset[0], depInfo.Offset[1]), a))
|
if (!self.World.CanPlaceBuilding(depInfo.TransformsInto, bi, self.Location + new int2(depInfo.Offset[0], depInfo.Offset[1]), self))
|
||||||
return "deploy-blocked";
|
return "deploy-blocked";
|
||||||
}
|
}
|
||||||
return "deploy";
|
return "deploy";
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ E6:
|
|||||||
TakeCover:
|
TakeCover:
|
||||||
Passenger:
|
Passenger:
|
||||||
ColorOfCargoPip: Yellow
|
ColorOfCargoPip: Yellow
|
||||||
|
EngineerRepair:
|
||||||
EngineerCapture:
|
EngineerCapture:
|
||||||
EngineerDamage: 9999999
|
EngineerDamage: 9999999
|
||||||
-AutoTarget:
|
-AutoTarget:
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ E6:
|
|||||||
Speed: 4
|
Speed: 4
|
||||||
Passenger:
|
Passenger:
|
||||||
ColorOfCargoPip: Yellow
|
ColorOfCargoPip: Yellow
|
||||||
|
EngineerRepair:
|
||||||
EngineerCapture:
|
EngineerCapture:
|
||||||
TakeCover:
|
TakeCover:
|
||||||
-AutoTarget:
|
-AutoTarget:
|
||||||
|
|||||||
Reference in New Issue
Block a user