Make UnitOrderGenerator more extensible by giving inherited classes access to some methods

This commit is contained in:
michaeldgg2
2024-01-01 15:55:08 +01:00
committed by Gustas
parent e96865b55e
commit 9a1823d805

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Orders
readonly string worldSelectCursor = ChromeMetrics.Get<string>("WorldSelectCursor"); readonly string worldSelectCursor = ChromeMetrics.Get<string>("WorldSelectCursor");
readonly string worldDefaultCursor = ChromeMetrics.Get<string>("WorldDefaultCursor"); readonly string worldDefaultCursor = ChromeMetrics.Get<string>("WorldDefaultCursor");
static Target TargetForInput(World world, CPos cell, int2 worldPixel, MouseInput mi) protected static Target TargetForInput(World world, CPos cell, int2 worldPixel, MouseInput mi)
{ {
var actor = world.ScreenMap.ActorsAtMouse(mi) var actor = world.ScreenMap.ActorsAtMouse(mi)
.Where(a => !a.Actor.IsDead && a.Actor.Info.HasTraitInfo<ITargetableInfo>() && !world.FogObscures(a.Actor)) .Where(a => !a.Actor.IsDead && a.Actor.Info.HasTraitInfo<ITargetableInfo>() && !world.FogObscures(a.Actor))
@@ -134,7 +134,7 @@ namespace OpenRA.Mods.Common.Orders
/// First priority is given to orders that interact with the given actors. /// First priority is given to orders that interact with the given actors.
/// Second priority is given to actors in the given cell. /// Second priority is given to actors in the given cell.
/// </summary> /// </summary>
static UnitOrderResult OrderForUnit(Actor self, Target target, CPos xy, MouseInput mi) protected static UnitOrderResult OrderForUnit(Actor self, Target target, CPos xy, MouseInput mi)
{ {
if (mi.Button != Game.Settings.Game.MouseButtonPreference.Action) if (mi.Button != Game.Settings.Game.MouseButtonPreference.Action)
return null; return null;
@@ -194,7 +194,7 @@ namespace OpenRA.Mods.Common.Orders
return order; return order;
} }
sealed class UnitOrderResult protected sealed class UnitOrderResult
{ {
public readonly Actor Actor; public readonly Actor Actor;
public readonly IOrderTargeter Order; public readonly IOrderTargeter Order;