From 4b390646617734fd09305bd557db0828008d7ce3 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Mon, 22 Jun 2015 20:55:39 +0200 Subject: [PATCH] Add a Demolish function to lua --- OpenRA.Mods.Common/OpenRA.Mods.Common.csproj | 1 + .../Properties/DemolitionProperties.cs | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 OpenRA.Mods.Common/Scripting/Properties/DemolitionProperties.cs diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 67807b257f..9c2c3969ed 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -232,6 +232,7 @@ + diff --git a/OpenRA.Mods.Common/Scripting/Properties/DemolitionProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/DemolitionProperties.cs new file mode 100644 index 0000000000..83255303ff --- /dev/null +++ b/OpenRA.Mods.Common/Scripting/Properties/DemolitionProperties.cs @@ -0,0 +1,41 @@ +#region Copyright & License Information +/* + * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. + */ +#endregion + +using System; +using System.Linq; +using Eluant; +using OpenRA.Activities; +using OpenRA.Mods.Common.Activities; +using OpenRA.Mods.Common.Traits; +using OpenRA.Scripting; +using OpenRA.Traits; + +namespace OpenRA.Mods.Common.Scripting +{ + [ScriptPropertyGroup("Combat")] + public class DemolitionProperties : ScriptActorProperties, Requires, Requires + { + readonly C4DemolitionInfo info; + + public DemolitionProperties(ScriptContext context, Actor self) + : base(context, self) + { + info = Self.Info.Traits.Get(); + } + + [ScriptActorPropertyActivity] + [Desc("Demolish the target actor.")] + public void Demolish(Actor target) + { + Self.QueueActivity(new Demolish(Self, target, info.C4Delay, info.Flashes, + info.FlashesDelay, info.FlashInterval, info.FlashDuration)); + } + } +}