diff --git a/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs index f2601e8286..bbe7812119 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs @@ -39,18 +39,25 @@ namespace OpenRA.Mods.Common.Scripting get { Game.Debug("The property `PlayerProperties.Race` is deprecated! Use `PlayerProperties.Faction` instead!"); - return Player.PlayerReference.Faction; + return Player.Faction.InternalName; } } [Desc("The player's faction.")] - public string Faction { get { return Player.PlayerReference.Faction; } } + public string Faction { get { return Player.Faction.InternalName; } } [Desc("The player's spawnpoint ID.")] public int Spawn { get { return Player.SpawnPoint; } } [Desc("The player's team ID.")] - public int Team { get { return Player.PlayerReference.Team; } } + public int Team + { + get + { + var c = Player.World.LobbyInfo.Clients[Player.ClientIndex]; + return c != null ? c.Team : 0; + } + } [Desc("Returns true if the player is a bot.")] public bool IsBot { get { return Player.IsBot; } }