Use footprints in GrantExternalConditionPower.
This commit is contained in:
committed by
atlimit8
parent
485faac294
commit
54bd0eb99d
@@ -29,8 +29,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Duration of the condition (in ticks). Set to 0 for a permanent condition.")]
|
[Desc("Duration of the condition (in ticks). Set to 0 for a permanent condition.")]
|
||||||
public readonly int Duration = 0;
|
public readonly int Duration = 0;
|
||||||
|
|
||||||
[Desc("Cells - affects whole cells only")]
|
[FieldLoader.Require]
|
||||||
public readonly int Range = 1;
|
[Desc("Size of the footprint of the affected area.")]
|
||||||
|
public readonly CVec Dimensions = CVec.Zero;
|
||||||
|
|
||||||
|
[FieldLoader.Require]
|
||||||
|
[Desc("Actual footprint. Cells marked as x will be affected.")]
|
||||||
|
public readonly string Footprint = string.Empty;
|
||||||
|
|
||||||
[Desc("Sound to instantly play at the targeted area.")]
|
[Desc("Sound to instantly play at the targeted area.")]
|
||||||
public readonly string OnFireSound = null;
|
public readonly string OnFireSound = null;
|
||||||
@@ -88,8 +93,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public IEnumerable<Actor> UnitsInRange(CPos xy)
|
public IEnumerable<Actor> UnitsInRange(CPos xy)
|
||||||
{
|
{
|
||||||
var range = info.Range;
|
var tiles = CellsMatching(xy, info.Footprint, info.Dimensions);
|
||||||
var tiles = Self.World.Map.FindTilesInCircle(xy, range);
|
|
||||||
var units = new List<Actor>();
|
var units = new List<Actor>();
|
||||||
foreach (var t in tiles)
|
foreach (var t in tiles)
|
||||||
units.AddRange(Self.World.ActorMap.GetActorsAt(t));
|
units.AddRange(Self.World.ActorMap.GetActorsAt(t));
|
||||||
@@ -107,7 +111,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
class SelectConditionTarget : OrderGenerator
|
class SelectConditionTarget : OrderGenerator
|
||||||
{
|
{
|
||||||
readonly GrantExternalConditionPower power;
|
readonly GrantExternalConditionPower power;
|
||||||
readonly int range;
|
readonly string footprint;
|
||||||
|
readonly CVec dimensions;
|
||||||
readonly Sprite tile;
|
readonly Sprite tile;
|
||||||
readonly SupportPowerManager manager;
|
readonly SupportPowerManager manager;
|
||||||
readonly string order;
|
readonly string order;
|
||||||
@@ -121,7 +126,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.order = order;
|
this.order = order;
|
||||||
this.power = power;
|
this.power = power;
|
||||||
range = power.info.Range;
|
footprint = power.info.Footprint;
|
||||||
|
dimensions = power.info.Dimensions;
|
||||||
tile = world.Map.Rules.Sequences.GetSequence("overlay", "target-select").GetSprite(0);
|
tile = world.Map.Rules.Sequences.GetSequence("overlay", "target-select").GetSprite(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +163,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var xy = wr.Viewport.ViewToWorld(Viewport.LastMousePos);
|
var xy = wr.Viewport.ViewToWorld(Viewport.LastMousePos);
|
||||||
var pal = wr.Palette(TileSet.TerrainPaletteInternalName);
|
var pal = wr.Palette(TileSet.TerrainPaletteInternalName);
|
||||||
|
|
||||||
foreach (var t in world.Map.FindTilesInCircle(xy, range))
|
foreach (var t in power.CellsMatching(xy, footprint, dimensions))
|
||||||
yield return new SpriteRenderable(tile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, pal, 1f, true);
|
yield return new SpriteRenderable(tile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, pal, 1f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user