From f37f1f1e0c161241e168efced5558ba60c0642da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 10 Apr 2016 19:52:41 +0200 Subject: [PATCH] Add Player.GetActors to the Lua API. --- .../Scripting/Properties/PlayerProperties.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs index 413350d2f7..f2601e8286 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/PlayerProperties.cs @@ -59,7 +59,13 @@ namespace OpenRA.Mods.Common.Scripting public bool IsNonCombatant { get { return Player.NonCombatant; } } [Desc("Returns true if the player is the local player.")] - public bool IsLocalPlayer { get { return Player == (Player.World.RenderPlayer ?? Player.World.LocalPlayer); } } + public bool IsLocalPlayer { get { return Player == (Player.World.RenderPlayer ?? Player.World.LocalPlayer); } } + + [Desc("Returns all living actors staying inside the world for this player.")] + public Actor[] GetActors() + { + return Player.World.Actors.Where(actor => actor.Owner == Player && !actor.IsDead && actor.IsInWorld).ToArray(); + } [Desc("Returns an array of actors representing all ground attack units of this player.")] public Actor[] GetGroundAttackers()