Unhardcode support power blocked cursor.
This commit is contained in:
committed by
Gustas
parent
fc4ebf332d
commit
69d9bbb400
@@ -47,10 +47,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
"This requires the actor to have the WithSpriteBody trait or one of its derivatives.")]
|
||||
public readonly string Sequence = "active";
|
||||
|
||||
[CursorReference]
|
||||
[Desc("Cursor to display when there are no units to apply the condition in range.")]
|
||||
public readonly string BlockedCursor = "move-blocked";
|
||||
|
||||
public readonly string FootprintImage = "overlay";
|
||||
|
||||
[SequenceReference(nameof(FootprintImage))]
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly NukePowerInfo info;
|
||||
|
||||
public SelectNukePowerTarget(string order, SupportPowerManager manager, NukePowerInfo info, MouseButton button)
|
||||
: base(order, manager, info.Cursor, button)
|
||||
: base(order, manager, info, button)
|
||||
{
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi)
|
||||
{
|
||||
return world.Map.Contains(cell) ? cursor : "generic-blocked";
|
||||
return world.Map.Contains(cell) ? info.Cursor : info.BlockedCursor;
|
||||
}
|
||||
|
||||
bool IOrderGenerator.HandleKeyPress(KeyInput e) { return false; }
|
||||
|
||||
@@ -46,9 +46,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[PaletteReference]
|
||||
public readonly string EffectPalette = null;
|
||||
|
||||
[Desc("Cursor to display when the location is unsuitable.")]
|
||||
public readonly string BlockedCursor = "move-blocked";
|
||||
|
||||
public override object Create(ActorInitializer init) { return new SpawnActorPower(init.Self, this); }
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Cursor to display for using this support power.")]
|
||||
public readonly string Cursor = "ability";
|
||||
|
||||
[CursorReference]
|
||||
[Desc("Cursor when unable to activate on this position. ")]
|
||||
public readonly string BlockedCursor = "generic-blocked";
|
||||
|
||||
[Desc("If set to true, the support power will be fully charged when it becomes available. " +
|
||||
"Normal rules apply for subsequent charges.")]
|
||||
public readonly bool StartFullyCharged = false;
|
||||
@@ -209,7 +213,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public virtual void SelectTarget(Actor self, string order, SupportPowerManager manager)
|
||||
{
|
||||
self.World.OrderGenerator = new SelectGenericPowerTarget(order, manager, info.Cursor, MouseButton.Left);
|
||||
self.World.OrderGenerator = new SelectGenericPowerTarget(order, manager, info, MouseButton.Left);
|
||||
}
|
||||
|
||||
public virtual void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||
|
||||
@@ -283,12 +283,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class SelectGenericPowerTarget : OrderGenerator
|
||||
{
|
||||
readonly SupportPowerManager manager;
|
||||
readonly string cursor;
|
||||
readonly SupportPowerInfo info;
|
||||
readonly MouseButton expectedButton;
|
||||
|
||||
public string OrderKey { get; }
|
||||
|
||||
public SelectGenericPowerTarget(string order, SupportPowerManager manager, string cursor, MouseButton button)
|
||||
public SelectGenericPowerTarget(string order, SupportPowerManager manager, SupportPowerInfo info, MouseButton button)
|
||||
{
|
||||
// Clear selection if using Left-Click Orders
|
||||
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||
@@ -296,7 +296,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
this.manager = manager;
|
||||
OrderKey = order;
|
||||
this.cursor = cursor;
|
||||
this.info = info;
|
||||
expectedButton = button;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
protected override IEnumerable<IRenderable> RenderAnnotations(WorldRenderer wr, World world) { yield break; }
|
||||
protected override string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi)
|
||||
{
|
||||
return world.Map.Contains(cell) ? cursor : "generic-blocked";
|
||||
return world.Map.Contains(cell) ? info.Cursor : info.BlockedCursor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* 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, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class AddSupportPowerBlockedCursor : UpdateRule
|
||||
{
|
||||
public override string Name => "Add SpawnActorPower/GrantExternalConditionPower BlockedCursor.";
|
||||
|
||||
public override string Description =>
|
||||
"SpawnActorPower and GrantExternalConditionPower field BlockedCursor changed its default value.";
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode)
|
||||
{
|
||||
foreach (var power in new List<string> { "SpawnActorPower", "GrantExternalConditionPower" })
|
||||
{
|
||||
foreach (var spawnActorPower in actorNode.ChildrenMatching(power))
|
||||
{
|
||||
var cursor = spawnActorPower.LastChildMatching("BlockedCursor");
|
||||
if (cursor != null && !cursor.IsRemoval())
|
||||
yield break;
|
||||
var blockedCursorNode = new MiniYamlNodeBuilder("BlockedCursor", new MiniYamlBuilder("move-blocked"));
|
||||
spawnActorPower.AddNode(blockedCursorNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,6 +87,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
new RemoveConyardChronoReturnAnimation(),
|
||||
new RemoveEditorSelectionLayerProperties(),
|
||||
new AddMarkerLayerOverlay(),
|
||||
new AddSupportPowerBlockedCursor(),
|
||||
|
||||
// Execute these rules last to avoid premature yaml merge crashes.
|
||||
new ReplaceCloakPalette(),
|
||||
|
||||
@@ -110,6 +110,7 @@ Player:
|
||||
OnFireSound: ironcur9.aud
|
||||
Dimensions: 3, 3
|
||||
Footprint: _x_ xxx _x_
|
||||
BlockedCursor: move-blocked
|
||||
Production:
|
||||
Produces: Building
|
||||
LobbyPrerequisiteCheckbox@GLOBALBOUNTY:
|
||||
|
||||
@@ -382,6 +382,7 @@ powerproxy.sonarpulse:
|
||||
EffectPalette: moveflash
|
||||
SupportPowerPaletteOrder: 80
|
||||
EffectSequence: idle
|
||||
BlockedCursor: move-blocked
|
||||
|
||||
powerproxy.paratroopers:
|
||||
AlwaysVisible:
|
||||
|
||||
@@ -450,6 +450,7 @@ IRON:
|
||||
SupportPowerPaletteOrder: 10
|
||||
Dimensions: 3, 3
|
||||
Footprint: _x_ xxx _x_
|
||||
BlockedCursor: move-blocked
|
||||
SupportPowerChargeBar:
|
||||
InfiltrateForSupportPowerReset:
|
||||
Types: SpyInfiltrate
|
||||
|
||||
Reference in New Issue
Block a user