From 86f9b8807eb30779fd72fb8c6abc3a01571be51b Mon Sep 17 00:00:00 2001 From: Kevin Hinton Date: Wed, 13 Dec 2017 05:53:02 +0000 Subject: [PATCH] Add EffectiveOwner to Lua Scripting API. --- .../Scripting/Properties/GeneralProperties.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs index 9dd8dd43de..6925ed6af9 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/GeneralProperties.cs @@ -80,6 +80,18 @@ namespace OpenRA.Mods.Common.Scripting { Self.World.Add(new FlashTarget(Self, asPlayer, duration)); } + + [Desc("The effective owner of the actor.")] + public Player EffectiveOwner + { + get + { + if (Self.EffectiveOwner == null || Self.EffectiveOwner.Owner == null) + return Self.Owner; + + return Self.EffectiveOwner.Owner; + } + } } [ScriptPropertyGroup("General")]