diff --git a/OpenRA.Mods.Common/Effects/Beacon.cs b/OpenRA.Mods.Common/Effects/Beacon.cs
index 01d6ecd474..e6adb47a1a 100644
--- a/OpenRA.Mods.Common/Effects/Beacon.cs
+++ b/OpenRA.Mods.Common/Effects/Beacon.cs
@@ -12,10 +12,11 @@ using System;
using System.Collections.Generic;
using OpenRA.Effects;
using OpenRA.Graphics;
+using OpenRA.Scripting;
namespace OpenRA.Mods.Common.Effects
{
- public class Beacon : IEffect
+ public class Beacon : IEffect, IScriptBindable
{
static readonly int MaxArrowHeight = 512;
diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
index 67807b257f..aa0a9f8c1f 100644
--- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
+++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
@@ -213,6 +213,7 @@
+
diff --git a/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs
new file mode 100644
index 0000000000..c1446c48a0
--- /dev/null
+++ b/OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs
@@ -0,0 +1,47 @@
+#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.Linq;
+using OpenRA.Mods.Common.Effects;
+using OpenRA.Mods.Common.Traits;
+using OpenRA.Scripting;
+
+namespace OpenRA.Mods.Common.Scripting
+{
+ [ScriptGlobal("Beacon")]
+ public class BeaconGlobal : ScriptGlobal
+ {
+ readonly RadarPings radarPings;
+
+ public BeaconGlobal(ScriptContext context) : base(context)
+ {
+ radarPings = context.World.WorldActor.TraitOrDefault();
+ }
+
+ [Desc("Creates a new beacon that stays for the specified time at the specified WPos." +
+ "Does not remove player set beacons, nor gets removed by placing them.")]
+ public Beacon New(Player owner, WPos position, int duration = 30 * 25, bool showRadarPings = true, string palettePrefix = "player")
+ {
+ var playerBeacon = new Beacon(owner, position, duration, palettePrefix);
+ owner.PlayerActor.World.AddFrameEndTask(w => w.Add(playerBeacon));
+
+ if (showRadarPings && radarPings != null)
+ {
+ radarPings.Add(
+ () => owner.IsAlliedWith(owner.World.RenderPlayer),
+ position,
+ owner.Color.RGB,
+ duration);
+ }
+
+ return playerBeacon;
+ }
+ }
+}