Expose targetline colors to yaml.

All targetlines can now be set to a custom color in yaml or set to be invisible.
All automated behaviours including scripted activities now have no visible target lines.
This commit is contained in:
tovl
2020-08-02 22:22:39 +02:00
committed by Paul Chote
parent ea3c7a3c34
commit 84eb3c54ef
41 changed files with 139 additions and 58 deletions

View File

@@ -94,6 +94,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line for regular move orders.")]
public readonly Color TargetLineColor = Color.Green;
[GrantedConditionReference]
[Desc("The condition to grant to self while airborne.")]
public readonly string AirborneCondition = null;
@@ -165,6 +168,7 @@ namespace OpenRA.Mods.Common.Traits
public WAngle GetInitialFacing() { return InitialFacing; }
public WDist GetCruiseAltitude() { return CruiseAltitude; }
public Color GetTargetLineColor() { return TargetLineColor; }
public override object Create(ActorInitializer init) { return new Aircraft(init, this); }
@@ -1082,7 +1086,7 @@ namespace OpenRA.Mods.Common.Traits
var target = Target.FromCell(self.World, cell);
// TODO: this should scale with unit selection group size.
self.QueueActivity(order.Queued, new Fly(self, target, WDist.FromCells(8), targetLineColor: Color.Green));
self.QueueActivity(order.Queued, new Fly(self, target, WDist.FromCells(8), targetLineColor: Info.TargetLineColor));
self.ShowTargetLines();
}
else if (orderString == "Land")
@@ -1096,7 +1100,7 @@ namespace OpenRA.Mods.Common.Traits
var target = Target.FromCell(self.World, cell);
self.QueueActivity(order.Queued, new Land(self, target, targetLineColor: Color.Green));
self.QueueActivity(order.Queued, new Land(self, target, targetLineColor: Info.TargetLineColor));
self.ShowTargetLines();
}
else if (orderString == "Enter" || orderString == "ForceEnter" || orderString == "Repair")

View File

@@ -24,6 +24,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line.")]
public readonly Color TargetLineColor = Color.OrangeRed;
[GrantedConditionReference]
[Desc("The condition to grant to self while an attack-move is active.")]
public readonly string AttackMoveCondition = null;
@@ -76,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits
var assaultMoving = order.OrderString == "AssaultMove";
// TODO: this should scale with unit selection group size.
self.QueueActivity(order.Queued, new AttackMoveActivity(self, () => move.MoveTo(targetLocation, 8, targetLineColor: Color.OrangeRed), assaultMoving));
self.QueueActivity(order.Queued, new AttackMoveActivity(self, () => move.MoveTo(targetLocation, 8, targetLineColor: Info.TargetLineColor), assaultMoving));
self.ShowTargetLines();
}
}

View File

@@ -34,6 +34,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line for regular move orders.")]
public readonly Color TargetLineColor = Color.Green;
[Desc("Require the force-move modifier to display the move cursor.")]
public readonly bool RequiresForceMove = false;
@@ -113,7 +116,7 @@ namespace OpenRA.Mods.Common.Traits
if (!order.Queued)
activity.NextActivity?.Cancel(self);
activity.Queue(new IssueOrderAfterTransform("Move", order.Target, Color.Green));
activity.Queue(new IssueOrderAfterTransform("Move", order.Target, Info.TargetLineColor));
if (currentTransform == null)
self.QueueActivity(order.Queued, activity);

View File

@@ -58,6 +58,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line.")]
public readonly Color TargetLineColor = Color.Crimson;
public override object Create(ActorInitializer init) { return new Captures(init.Self, this); }
}
@@ -100,7 +103,7 @@ namespace OpenRA.Mods.Common.Traits
if (order.OrderString != "CaptureActor" || IsTraitDisabled)
return;
self.QueueActivity(order.Queued, new CaptureActor(self, order.Target));
self.QueueActivity(order.Queued, new CaptureActor(self, order.Target, Info.TargetLineColor));
self.ShowTargetLines();
}

View File

@@ -60,6 +60,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line.")]
public readonly Color TargetLineColor = Color.Yellow;
public override object Create(ActorInitializer init) { return new Carryall(init.Self, this); }
}

View File

@@ -12,6 +12,7 @@
using System.Collections.Generic;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Orders;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
@@ -37,6 +38,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line.")]
public readonly Color TargetLineColor = Color.Yellow;
public override object Create(ActorInitializer init) { return new DeliversCash(this); }
}
@@ -75,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits
if (order.OrderString != "DeliverCash")
return;
self.QueueActivity(order.Queued, new DonateCash(self, order.Target, info.Payload, info.PlayerExperience));
self.QueueActivity(order.Queued, new DonateCash(self, order.Target, info.Payload, info.PlayerExperience, info.TargetLineColor));
self.ShowTargetLines();
}

View File

@@ -12,6 +12,7 @@
using System.Collections.Generic;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Orders;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
@@ -31,6 +32,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line.")]
public readonly Color TargetLineColor = Color.Yellow;
public override object Create(ActorInitializer init) { return new DeliversExperience(init, this); }
}
@@ -86,7 +90,7 @@ namespace OpenRA.Mods.Common.Traits
else if (order.Target.Type != TargetType.FrozenActor)
return;
self.QueueActivity(order.Queued, new DonateExperience(self, order.Target, gainsExperience.Level, info.PlayerExperience));
self.QueueActivity(order.Queued, new DonateExperience(self, order.Target, gainsExperience.Level, info.PlayerExperience, info.TargetLineColor));
self.ShowTargetLines();
}

View File

@@ -44,6 +44,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Voice string when planting explosive charges.")]
public readonly string Voice = "Action";
[Desc("Color to use for the target line.")]
public readonly Color TargetLineColor = Color.Crimson;
public readonly PlayerRelationship TargetStances = PlayerRelationship.Enemy | PlayerRelationship.Neutral;
public readonly PlayerRelationship ForceTargetStances = PlayerRelationship.Enemy | PlayerRelationship.Neutral | PlayerRelationship.Ally;
@@ -88,7 +91,7 @@ namespace OpenRA.Mods.Common.Traits
}
self.QueueActivity(order.Queued, new Demolish(self, order.Target, info.EnterBehaviour, info.DetonationDelay,
info.Flashes, info.FlashesDelay, info.FlashInterval, info.DamageTypes));
info.Flashes, info.FlashesDelay, info.FlashInterval, info.DamageTypes, info.TargetLineColor));
self.ShowTargetLines();
}

View File

@@ -26,6 +26,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line.")]
public readonly Color TargetLineColor = Color.Yellow;
[Desc("Behaviour when entering the structure.",
"Possible values are Exit, Suicide, Dispose.")]
public readonly EnterBehaviour EnterBehaviour = EnterBehaviour.Dispose;

View File

@@ -31,6 +31,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line while in tunnels.")]
public readonly Color TargetLineColor = Color.Green;
[ConsumedConditionReference]
[Desc("Boolean expression defining the condition under which the regular (non-force) enter cursor is disabled.")]
public readonly BooleanExpression RequireForceMoveCondition = null;
@@ -42,12 +45,14 @@ namespace OpenRA.Mods.Common.Traits
{
readonly EntersTunnelsInfo info;
readonly IMove move;
readonly IMoveInfo moveInfo;
bool requireForceMove;
public EntersTunnels(Actor self, EntersTunnelsInfo info)
{
this.info = info;
move = self.Trait<IMove>();
moveInfo = self.Info.TraitInfo<IMoveInfo>();
}
public IEnumerable<IOrderTargeter> Orders
@@ -85,8 +90,8 @@ namespace OpenRA.Mods.Common.Traits
if (tunnel == null || !tunnel.Exit.HasValue)
return;
self.QueueActivity(order.Queued, move.MoveTo(tunnel.Entrance, tunnel.NearEnough, targetLineColor: Color.Green));
self.QueueActivity(move.MoveTo(tunnel.Exit.Value, tunnel.NearEnough, targetLineColor: Color.Green));
self.QueueActivity(order.Queued, move.MoveTo(tunnel.Entrance, tunnel.NearEnough, targetLineColor: moveInfo.GetTargetLineColor()));
self.QueueActivity(move.MoveTo(tunnel.Exit.Value, tunnel.NearEnough, targetLineColor: info.TargetLineColor));
self.ShowTargetLines();
}

View File

@@ -21,6 +21,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line.")]
public readonly Color TargetLineColor = Color.OrangeRed;
public override object Create(ActorInitializer init) { return new Guard(this); }
}
@@ -51,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
return;
var range = target.Actor.Info.TraitInfo<GuardableInfo>().Range;
self.QueueActivity(queued, new AttackMoveActivity(self, () => move.MoveFollow(self, target, WDist.Zero, range, targetLineColor: Color.OrangeRed)));
self.QueueActivity(queued, new AttackMoveActivity(self, () => move.MoveFollow(self, target, WDist.Zero, range, targetLineColor: info.TargetLineColor)));
self.ShowTargetLines();
}

View File

@@ -16,6 +16,7 @@ using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Orders;
using OpenRA.Mods.Common.Pathfinder;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
@@ -83,6 +84,12 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string DeliverVoice = "Action";
[Desc("Color to use for the target line of harvest orders.")]
public readonly Color HarvestLineColor = Color.Crimson;
[Desc("Color to use for the target line of harvest orders.")]
public readonly Color DeliverLineColor = Color.Green;
[Desc("Cursor to display when able to unload at target actor.")]
public readonly string EnterCursor = "enter";

View File

@@ -49,6 +49,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line for regular move orders.")]
public readonly Color TargetLineColor = Color.Green;
[Desc("Facing to use for actor previews (map editor, color picker, etc)")]
public readonly WAngle PreviewFacing = new WAngle(384);
@@ -68,6 +71,8 @@ namespace OpenRA.Mods.Common.Traits
yield return new FacingInit(PreviewFacing);
}
public Color GetTargetLineColor() { return TargetLineColor; }
public override object Create(ActorInitializer init) { return new Mobile(init, this); }
public LocomotorInfo LocomotorInfo { get; private set; }
@@ -923,7 +928,7 @@ namespace OpenRA.Mods.Common.Traits
if (!Info.LocomotorInfo.MoveIntoShroud && !self.Owner.Shroud.IsExplored(cell))
return;
self.QueueActivity(order.Queued, WrapMove(new Move(self, cell, WDist.FromCells(8), null, true, Color.Green)));
self.QueueActivity(order.Queued, WrapMove(new Move(self, cell, WDist.FromCells(8), null, true, Info.TargetLineColor)));
self.ShowTargetLines();
}

View File

@@ -12,6 +12,7 @@
using System.Collections.Generic;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Orders;
using OpenRA.Primitives;
using OpenRA.Support;
using OpenRA.Traits;
@@ -42,6 +43,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line.")]
public readonly Color TargetLineColor = Color.Green;
[ConsumedConditionReference]
[Desc("Boolean expression defining the condition under which the regular (non-force) enter cursor is disabled.")]
public readonly BooleanExpression RequireForceMoveCondition = null;
@@ -173,7 +177,7 @@ namespace OpenRA.Mods.Common.Traits
if (!IsCorrectCargoType(targetActor))
return;
self.QueueActivity(order.Queued, new RideTransport(self, order.Target));
self.QueueActivity(order.Queued, new RideTransport(self, order.Target, Info.TargetLineColor));
self.ShowTargetLines();
}

View File

@@ -12,6 +12,7 @@
using System.Collections.Generic;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Orders;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
@@ -22,6 +23,9 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Color to use for the target line.")]
public readonly Color TargetLineColor = Color.Yellow;
[Desc("Behaviour when entering the structure.",
"Possible values are Exit, Suicide, Dispose.")]
public readonly EnterBehaviour EnterBehaviour = EnterBehaviour.Dispose;
@@ -101,7 +105,7 @@ namespace OpenRA.Mods.Common.Traits
else
return;
self.QueueActivity(order.Queued, new RepairBridge(self, order.Target, info.EnterBehaviour, info.RepairNotification));
self.QueueActivity(order.Queued, new RepairBridge(self, order.Target, info.EnterBehaviour, info.RepairNotification, info.TargetLineColor));
self.ShowTargetLines();
}
}