Merge pull request #11809 from obrakmann/fix11808_player-lua-api-breakage
Fix Lua API returning wrong player info
This commit is contained in:
@@ -39,18 +39,25 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
Game.Debug("The property `PlayerProperties.Race` is deprecated! Use `PlayerProperties.Faction` instead!");
|
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.")]
|
[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.")]
|
[Desc("The player's spawnpoint ID.")]
|
||||||
public int Spawn { get { return Player.SpawnPoint; } }
|
public int Spawn { get { return Player.SpawnPoint; } }
|
||||||
|
|
||||||
[Desc("The player's team ID.")]
|
[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.")]
|
[Desc("Returns true if the player is a bot.")]
|
||||||
public bool IsBot { get { return Player.IsBot; } }
|
public bool IsBot { get { return Player.IsBot; } }
|
||||||
|
|||||||
Reference in New Issue
Block a user