Add a Demolish function to lua

This commit is contained in:
abcdefg30
2015-06-22 20:55:39 +02:00
parent be99ba7d61
commit 4b39064661
2 changed files with 42 additions and 0 deletions

View File

@@ -232,6 +232,7 @@
<Compile Include="Scripting\Properties\GuardProperties.cs" />
<Compile Include="Scripting\Properties\MissionObjectiveProperties.cs" />
<Compile Include="Scripting\Properties\MobileProperties.cs" />
<Compile Include="Scripting\Properties\DemolitionProperties.cs" />
<Compile Include="Scripting\Properties\PlaneProperties.cs" />
<Compile Include="Scripting\Properties\PlayerProperties.cs" />
<Compile Include="Scripting\Properties\PowerProperties.cs" />

View File

@@ -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<IMoveInfo>, Requires<C4DemolitionInfo>
{
readonly C4DemolitionInfo info;
public DemolitionProperties(ScriptContext context, Actor self)
: base(context, self)
{
info = Self.Info.Traits.Get<C4DemolitionInfo>();
}
[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));
}
}
}