Expose and document the palette used
by PlaceBuildingOrderGenerator for the structure placement overlay
This commit is contained in:
@@ -23,6 +23,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
readonly Actor producer;
|
readonly Actor producer;
|
||||||
readonly string building;
|
readonly string building;
|
||||||
readonly BuildingInfo buildingInfo;
|
readonly BuildingInfo buildingInfo;
|
||||||
|
readonly PlaceBuildingInfo placeBuildingInfo;
|
||||||
readonly string race;
|
readonly string race;
|
||||||
readonly Sprite buildOk;
|
readonly Sprite buildOk;
|
||||||
readonly Sprite buildBlocked;
|
readonly Sprite buildBlocked;
|
||||||
@@ -33,6 +34,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
public PlaceBuildingOrderGenerator(ProductionQueue queue, string name)
|
public PlaceBuildingOrderGenerator(ProductionQueue queue, string name)
|
||||||
{
|
{
|
||||||
producer = queue.Actor;
|
producer = queue.Actor;
|
||||||
|
placeBuildingInfo = producer.Info.Traits.Get<PlaceBuildingInfo>();
|
||||||
building = name;
|
building = name;
|
||||||
|
|
||||||
// Clear selection if using Left-Click Orders
|
// Clear selection if using Left-Click Orders
|
||||||
@@ -155,7 +157,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
cells.Add(t, isCloseEnough && world.IsCellBuildable(t, buildingInfo) && res.GetResource(t) == null);
|
cells.Add(t, isCloseEnough && world.IsCellBuildable(t, buildingInfo) && res.GetResource(t) == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pal = wr.Palette("terrain");
|
var pal = wr.Palette(placeBuildingInfo.Palette);
|
||||||
foreach (var c in cells)
|
foreach (var c in cells)
|
||||||
{
|
{
|
||||||
var tile = c.Value ? buildOk : buildBlocked;
|
var tile = c.Value ? buildOk : buildBlocked;
|
||||||
|
|||||||
@@ -16,7 +16,11 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Allows to execute build orders.", " Attach this to the player actor.")]
|
[Desc("Allows to execute build orders.", " Attach this to the player actor.")]
|
||||||
class PlaceBuildingInfo : TraitInfo<PlaceBuilding> { }
|
class PlaceBuildingInfo : TraitInfo<PlaceBuilding>
|
||||||
|
{
|
||||||
|
[Desc("Palette to use for rendering the placement sprite.")]
|
||||||
|
public readonly string Palette = "terrain";
|
||||||
|
}
|
||||||
|
|
||||||
class PlaceBuilding : IResolveOrder
|
class PlaceBuilding : IResolveOrder
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user