Give ally players a yellow hp bar for team health colors
This commit is contained in:
@@ -76,12 +76,28 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
Color GetHealthColor(Health health)
|
Color GetHealthColor(Health health)
|
||||||
{
|
{
|
||||||
if (Game.Settings.Game.TeamHealthColors)
|
var player = actor.World.RenderPlayer ?? actor.World.LocalPlayer;
|
||||||
|
|
||||||
|
if (Game.Settings.Game.TeamHealthColors && player != null && !player.Spectating)
|
||||||
{
|
{
|
||||||
var isAlly = actor.Owner.IsAlliedWith(actor.World.LocalPlayer)
|
var apparentOwner = actor.EffectiveOwner != null && actor.EffectiveOwner.Disguised
|
||||||
|| (actor.EffectiveOwner != null && actor.EffectiveOwner.Disguised
|
? actor.EffectiveOwner.Owner
|
||||||
&& actor.World.LocalPlayer.IsAlliedWith(actor.EffectiveOwner.Owner));
|
: actor.Owner;
|
||||||
return isAlly ? Color.LimeGreen : actor.Owner.NonCombatant ? Color.Tan : Color.Red;
|
|
||||||
|
// For friendly spies, treat the unit's owner as the actual owner
|
||||||
|
if (actor.Owner.IsAlliedWith(actor.World.RenderPlayer))
|
||||||
|
apparentOwner = actor.Owner;
|
||||||
|
|
||||||
|
if (apparentOwner == player)
|
||||||
|
return Color.LimeGreen;
|
||||||
|
|
||||||
|
if (apparentOwner.IsAlliedWith(player))
|
||||||
|
return Color.Yellow;
|
||||||
|
|
||||||
|
if (apparentOwner.NonCombatant)
|
||||||
|
return Color.Tan;
|
||||||
|
|
||||||
|
return Color.Red;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return health.DamageState == DamageState.Critical ? Color.Red :
|
return health.DamageState == DamageState.Critical ? Color.Red :
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ namespace OpenRA
|
|||||||
public readonly string InternalName;
|
public readonly string InternalName;
|
||||||
public readonly CountryInfo Country;
|
public readonly CountryInfo Country;
|
||||||
public readonly bool NonCombatant = false;
|
public readonly bool NonCombatant = false;
|
||||||
public readonly bool Spectating = false;
|
|
||||||
public readonly bool Playable = true;
|
public readonly bool Playable = true;
|
||||||
public readonly int ClientIndex;
|
public readonly int ClientIndex;
|
||||||
public readonly PlayerReference PlayerReference;
|
public readonly PlayerReference PlayerReference;
|
||||||
@@ -45,6 +44,7 @@ namespace OpenRA
|
|||||||
public bool IsBot;
|
public bool IsBot;
|
||||||
public int SpawnPoint;
|
public int SpawnPoint;
|
||||||
public bool HasObjectives = false;
|
public bool HasObjectives = false;
|
||||||
|
public bool Spectating;
|
||||||
|
|
||||||
public Shroud Shroud;
|
public Shroud Shroud;
|
||||||
public World World { get; private set; }
|
public World World { get; private set; }
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (world.ObserveAfterWinOrLose && world.LocalPlayer.WinState != WinState.Undefined)
|
if (world.ObserveAfterWinOrLose && world.LocalPlayer.WinState != WinState.Undefined)
|
||||||
Game.RunAfterTick(() =>
|
Game.RunAfterTick(() =>
|
||||||
{
|
{
|
||||||
|
world.LocalPlayer.Spectating = true;
|
||||||
playerRoot.RemoveChildren();
|
playerRoot.RemoveChildren();
|
||||||
Game.LoadWidget(world, "OBSERVER_WIDGETS", playerRoot, new WidgetArgs());
|
Game.LoadWidget(world, "OBSERVER_WIDGETS", playerRoot, new WidgetArgs());
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user