Remove hardcoded cursor bs; move TransformsOnDeploy to Mods.RA.
This commit is contained in:
@@ -132,7 +132,6 @@
|
|||||||
<Compile Include="Traits\World\SpatialBins.cs" />
|
<Compile Include="Traits\World\SpatialBins.cs" />
|
||||||
<Compile Include="Traits\World\ChoosePaletteOnSelect.cs" />
|
<Compile Include="Traits\World\ChoosePaletteOnSelect.cs" />
|
||||||
<Compile Include="Traits\World\Country.cs" />
|
<Compile Include="Traits\World\Country.cs" />
|
||||||
<Compile Include="Traits\Activities\TransformIntoActor.cs" />
|
|
||||||
<Compile Include="Actor.cs" />
|
<Compile Include="Actor.cs" />
|
||||||
<Compile Include="Controller.cs" />
|
<Compile Include="Controller.cs" />
|
||||||
<Compile Include="Cursor.cs" />
|
<Compile Include="Cursor.cs" />
|
||||||
@@ -182,7 +181,6 @@
|
|||||||
<Compile Include="Traits\ProvidesRadar.cs" />
|
<Compile Include="Traits\ProvidesRadar.cs" />
|
||||||
<Compile Include="Traits\Selectable.cs" />
|
<Compile Include="Traits\Selectable.cs" />
|
||||||
<Compile Include="Traits\Player\ProductionQueue.cs" />
|
<Compile Include="Traits\Player\ProductionQueue.cs" />
|
||||||
<Compile Include="Traits\TransformsOnDeploy.cs" />
|
|
||||||
<Compile Include="Traits\Mobile.cs" />
|
<Compile Include="Traits\Mobile.cs" />
|
||||||
<Compile Include="Traits\Production.cs" />
|
<Compile Include="Traits\Production.cs" />
|
||||||
<Compile Include="Traits\RallyPoint.cs" />
|
<Compile Include="Traits\RallyPoint.cs" />
|
||||||
@@ -264,5 +262,7 @@
|
|||||||
-->
|
-->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Traits\" />
|
<Folder Include="Traits\" />
|
||||||
|
<Folder Include="Traits\" />
|
||||||
|
<Folder Include="Traits\Activities\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -74,7 +74,8 @@ namespace OpenRA.Orders
|
|||||||
{
|
{
|
||||||
var p = Game.controller.MousePosition;
|
var p = Game.controller.MousePosition;
|
||||||
var c = Order(world, p.ToInt2(), mi)
|
var c = Order(world, p.ToInt2(), mi)
|
||||||
.Select(o => CursorForOrderString(o.OrderString, o.Subject, o.TargetLocation))
|
.Select(o => o.Subject.traits.WithInterface<IProvideCursor>()
|
||||||
|
.Select(pc => pc.CursorForOrderString(o.OrderString, o.Subject, o.TargetLocation)).FirstOrDefault(a => a != null))
|
||||||
.FirstOrDefault(a => a != null);
|
.FirstOrDefault(a => a != null);
|
||||||
|
|
||||||
return c ??
|
return c ??
|
||||||
@@ -83,42 +84,5 @@ namespace OpenRA.Orders
|
|||||||
? "select" : "default");
|
? "select" : "default");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string CursorForOrderString(string s, Actor a, int2 location)
|
|
||||||
{
|
|
||||||
switch (s)
|
|
||||||
{
|
|
||||||
case "Attack": return "attack";
|
|
||||||
case "Heal": return "heal";
|
|
||||||
case "C4": return "c4";
|
|
||||||
case "Move":
|
|
||||||
if (a.traits.GetOrDefault<IMove>().CanEnterCell(location))
|
|
||||||
return "move";
|
|
||||||
else
|
|
||||||
return "move-blocked";
|
|
||||||
case "DeployTransform":
|
|
||||||
var depInfo = a.Info.Traits.Get<TransformsOnDeployInfo>();
|
|
||||||
var transInfo = Rules.Info[depInfo.TransformsInto];
|
|
||||||
if (transInfo.Traits.Contains<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))
|
|
||||||
return "deploy-blocked";
|
|
||||||
}
|
|
||||||
return "deploy";
|
|
||||||
|
|
||||||
case "Deploy": return "deploy";
|
|
||||||
case "Enter": return "enter";
|
|
||||||
case "EnterTransport": return "enter";
|
|
||||||
case "Deliver": return "enter";
|
|
||||||
case "Infiltrate": return "enter";
|
|
||||||
case "Capture": return "capture";
|
|
||||||
case "Harvest": return "attackmove";
|
|
||||||
case "Steal" : return "enter";
|
|
||||||
case "BeginMinefield": return "ability";
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,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
|
public class Mobile : IIssueOrder, IResolveOrder, IOccupySpace, IMove, IProvideCursor
|
||||||
{
|
{
|
||||||
public readonly Actor self;
|
public readonly Actor self;
|
||||||
public readonly MobileInfo Info;
|
public readonly MobileInfo Info;
|
||||||
@@ -121,6 +121,14 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
if (s != "Move")
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return (CanEnterCell(location)) ? "move" : "move-blocked";
|
||||||
|
}
|
||||||
|
|
||||||
public int2 TopLeft { get { return toCell; } }
|
public int2 TopLeft { get { return toCell; } }
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly string[] Produces = { };
|
public readonly string[] Produces = { };
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Production : IIssueOrder, IResolveOrder, ITags
|
public class Production : IIssueOrder, IResolveOrder, ITags, IProvideCursor
|
||||||
{
|
{
|
||||||
public virtual int2? CreationLocation( Actor self, ActorInfo producee )
|
public virtual int2? CreationLocation( Actor self, ActorInfo producee )
|
||||||
{
|
{
|
||||||
@@ -108,7 +108,12 @@ namespace OpenRA.Traits
|
|||||||
return new Order("Deploy", self);
|
return new Order("Deploy", self);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "Deploy") ? "deploy" : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "Deploy")
|
if (order.OrderString == "Deploy")
|
||||||
|
|||||||
@@ -46,6 +46,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 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); }
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Aftermath
|
|||||||
public readonly int ChargeTime = 120; // Seconds
|
public readonly int ChargeTime = 120; // Seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChronoshiftDeploy : IIssueOrder, IResolveOrder, ITick, IPips
|
class ChronoshiftDeploy : IIssueOrder, IResolveOrder, ITick, IPips, IProvideCursor
|
||||||
{
|
{
|
||||||
// Recharge logic
|
// Recharge logic
|
||||||
[Sync]
|
[Sync]
|
||||||
@@ -78,6 +78,11 @@ namespace OpenRA.Mods.Aftermath
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "Deploy") ? "deploy" : null;
|
||||||
|
}
|
||||||
|
|
||||||
// Display 5 pips indicating the current charge status
|
// Display 5 pips indicating the current charge status
|
||||||
public IEnumerable<PipType> GetPips(Actor self)
|
public IEnumerable<PipType> GetPips(Actor self)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,8 +19,9 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Traits.Activities
|
namespace OpenRA.Mods.RA.Activities
|
||||||
{
|
{
|
||||||
class TransformIntoActor : IActivity
|
class TransformIntoActor : IActivity
|
||||||
{
|
{
|
||||||
@@ -45,7 +45,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
|
public class AttackBase : IIssueOrder, IResolveOrder, ITick, IExplodeModifier, IProvideCursor
|
||||||
{
|
{
|
||||||
[Sync] public Actor target;
|
[Sync] public Actor target;
|
||||||
|
|
||||||
@@ -253,6 +253,16 @@ namespace OpenRA.Mods.RA
|
|||||||
target = null;
|
target = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
switch (s)
|
||||||
|
{
|
||||||
|
case "Attack": return "attack";
|
||||||
|
case "Heal": return "heal";
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void QueueAttack(Actor self, Order order)
|
protected virtual void QueueAttack(Actor self, Order order)
|
||||||
{
|
{
|
||||||
/* todo: choose the appropriate weapon, when only one works against this target */
|
/* todo: choose the appropriate weapon, when only one works against this target */
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly float C4Delay = 0;
|
public readonly float C4Delay = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
class C4Demolition : IIssueOrder, IResolveOrder
|
class C4Demolition : IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -51,5 +51,10 @@ namespace OpenRA.Mods.RA
|
|||||||
self.QueueActivity(new Move(self.Location, 0));
|
self.QueueActivity(new Move(self.Location, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "C4") ? "c4" : null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int UnloadFacing = 0;
|
public readonly int UnloadFacing = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Cargo : IPips, IIssueOrder, IResolveOrder
|
public class Cargo : IPips, IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
List<Actor> cargo = new List<Actor>();
|
List<Actor> cargo = new List<Actor>();
|
||||||
|
|
||||||
@@ -59,6 +59,11 @@ namespace OpenRA.Mods.RA
|
|||||||
self.QueueActivity(new UnloadCargo());
|
self.QueueActivity(new UnloadCargo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "Deploy") ? "deploy" : null;
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsFull(Actor self)
|
public bool IsFull(Actor self)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class ConstructionYardInfo : TraitInfo<ConstructionYard> { }
|
class ConstructionYardInfo : TraitInfo<ConstructionYard> { }
|
||||||
|
|
||||||
public class ConstructionYard : IIssueOrder, IResolveOrder
|
public class ConstructionYard : IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -37,6 +37,11 @@ namespace OpenRA.Mods.RA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "Deploy") ? "deploy" : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "Deploy")
|
if (order.OrderString == "Deploy")
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int EngineerDamage = 300;
|
public readonly int EngineerDamage = 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
class EngineerCapture : IIssueOrder, IResolveOrder
|
class EngineerCapture : IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
|
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
@@ -48,6 +48,12 @@ namespace OpenRA.Mods.RA
|
|||||||
self, underCursor);
|
self, underCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "Infiltrate") ? "enter" :
|
||||||
|
(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")
|
if (order.OrderString == "Infiltrate" || order.OrderString == "Capture")
|
||||||
|
|||||||
@@ -36,7 +36,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
|
public class Harvester : IIssueOrder, IResolveOrder, INotifyDamage, IPips, IRenderModifier, IExplodeModifier, IProvideCursor
|
||||||
{
|
{
|
||||||
Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>();
|
Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>();
|
||||||
|
|
||||||
@@ -113,7 +113,13 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "Deliver") ? "enter" :
|
||||||
|
(s == "Harvest") ? "attackmove" : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "Harvest")
|
if (order.OrderString == "Harvest")
|
||||||
|
|||||||
@@ -38,7 +38,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
|
class Helicopter : Aircraft, ITick, IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
public IDisposable reservation;
|
public IDisposable reservation;
|
||||||
|
|
||||||
@@ -61,6 +61,11 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "Enter") ? "enter" : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string[] RearmBuildings = { "fix" };
|
public readonly string[] RearmBuildings = { "fix" };
|
||||||
}
|
}
|
||||||
|
|
||||||
class Minelayer : IIssueOrder, IResolveOrder
|
class Minelayer : IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
/* [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;
|
||||||
@@ -49,6 +49,11 @@ namespace OpenRA.Mods.RA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "BeginMinefield") ? "ability" : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "BeginMinefield")
|
if (order.OrderString == "BeginMinefield")
|
||||||
|
|||||||
@@ -202,6 +202,8 @@
|
|||||||
<Compile Include="Activities\Drag.cs" />
|
<Compile Include="Activities\Drag.cs" />
|
||||||
<Compile Include="ProducesHelicopters.cs" />
|
<Compile Include="ProducesHelicopters.cs" />
|
||||||
<Compile Include="StoresOre.cs" />
|
<Compile Include="StoresOre.cs" />
|
||||||
|
<Compile Include="TransformsOnDeploy.cs" />
|
||||||
|
<Compile Include="Activities\TransformIntoActor.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly PipType ColorOfCargoPip = PipType.Green;
|
public readonly PipType ColorOfCargoPip = PipType.Green;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Passenger : IIssueOrder, IResolveOrder
|
class Passenger : IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -51,6 +51,11 @@ 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)
|
||||||
|
{
|
||||||
|
return (s == "EnterTransport") ? "enter" : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,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
|
public class Plane : Aircraft, IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
public IDisposable reservation;
|
public IDisposable reservation;
|
||||||
|
|
||||||
@@ -50,7 +50,12 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "Enter") ? "enter" : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (reservation != null)
|
if (reservation != null)
|
||||||
|
|||||||
@@ -27,7 +27,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
|
class Repairable : IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
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,13 @@ namespace OpenRA.Mods.RA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "Enter") ? "enter" : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (order.OrderString == "Enter")
|
if (order.OrderString == "Enter")
|
||||||
{
|
{
|
||||||
var rp = order.TargetActor.traits.GetOrDefault<RallyPoint>();
|
var rp = order.TargetActor.traits.GetOrDefault<RallyPoint>();
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string[] Buildings = { "spen", "syrd" };
|
public readonly string[] Buildings = { "spen", "syrd" };
|
||||||
}
|
}
|
||||||
|
|
||||||
class RepairableNear : IIssueOrder, IResolveOrder
|
class RepairableNear : IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -46,6 +46,11 @@ namespace OpenRA.Mods.RA
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
return (s == "Enter") ? "enter" : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "Enter")
|
if (order.OrderString == "Enter")
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class SpyInfo : TraitInfo<Spy> { }
|
class SpyInfo : TraitInfo<Spy> { }
|
||||||
|
|
||||||
class Spy : IIssueOrder, IResolveOrder
|
class Spy : IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -38,6 +38,11 @@ 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)
|
||||||
|
{
|
||||||
|
return (s == "Infiltrate") ? "enter" : null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "Infiltrate")
|
if (order.OrderString == "Infiltrate")
|
||||||
|
|||||||
@@ -18,9 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Mods.RA.Activities;
|
||||||
|
using OpenRA.Traits;
|
||||||
using OpenRA.Traits.Activities;
|
using OpenRA.Traits.Activities;
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class TransformsOnDeployInfo : TraitInfo<TransformsOnDeploy>
|
class TransformsOnDeployInfo : TraitInfo<TransformsOnDeploy>
|
||||||
{
|
{
|
||||||
@@ -33,7 +35,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly string[] NoTransformSounds = null;
|
public readonly string[] NoTransformSounds = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TransformsOnDeploy : IIssueOrder, IResolveOrder
|
class TransformsOnDeploy : IIssueOrder, IResolveOrder, IProvideCursor
|
||||||
{
|
{
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
@@ -77,5 +79,21 @@ namespace OpenRA.Traits
|
|||||||
self.QueueActivity(new TransformIntoActor(info.TransformsInto, new int2(info.Offset[0], info.Offset[1]), info.TransferHealthPercentage, info.TransformSounds));
|
self.QueueActivity(new TransformIntoActor(info.TransformsInto, new int2(info.Offset[0], info.Offset[1]), info.TransferHealthPercentage, info.TransformSounds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
|
{
|
||||||
|
if (s != "DeployTransform")
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var depInfo = a.Info.Traits.Get<TransformsOnDeployInfo>();
|
||||||
|
var transInfo = Rules.Info[depInfo.TransformsInto];
|
||||||
|
if (transInfo.Traits.Contains<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))
|
||||||
|
return "deploy-blocked";
|
||||||
|
}
|
||||||
|
return "deploy";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user