Allow mods to override Encyclopedia preview owners.
This commit is contained in:
@@ -28,6 +28,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Scale the actor preview.")]
|
[Desc("Scale the actor preview.")]
|
||||||
public readonly float Scale = 1f;
|
public readonly float Scale = 1f;
|
||||||
|
|
||||||
|
[Desc("Sets the player color of the actor preview to a player defined in the shellmap.")]
|
||||||
|
public readonly string PreviewOwner = null;
|
||||||
|
|
||||||
[Desc("Ignore the Buildable trait when listing information.")]
|
[Desc("Ignore the Buildable trait when listing information.")]
|
||||||
public readonly bool HideBuildable = false;
|
public readonly bool HideBuildable = false;
|
||||||
|
|
||||||
|
|||||||
@@ -162,9 +162,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var selectedInfo = info[actor];
|
var selectedInfo = info[actor];
|
||||||
selectedActor = actor;
|
selectedActor = actor;
|
||||||
|
|
||||||
|
Player previewOwner = null;
|
||||||
|
if (!string.IsNullOrEmpty(selectedInfo.PreviewOwner))
|
||||||
|
previewOwner = world.Players.FirstOrDefault(p => p.InternalName == selectedInfo.PreviewOwner);
|
||||||
|
|
||||||
var typeDictionary = new TypeDictionary()
|
var typeDictionary = new TypeDictionary()
|
||||||
{
|
{
|
||||||
new OwnerInit(world.WorldActor.Owner),
|
new OwnerInit(previewOwner ?? world.WorldActor.Owner),
|
||||||
new FactionInit(world.WorldActor.Owner.PlayerReference.Faction)
|
new FactionInit(world.WorldActor.Owner.PlayerReference.Faction)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user