diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
index fbaf2927d0..457091346f 100644
--- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
+++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
@@ -216,7 +216,6 @@
-
@@ -703,6 +702,7 @@
+
diff --git a/OpenRA.Mods.Common/Scripting/Global/EffectGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/EffectGlobal.cs
deleted file mode 100644
index b25cea7f5d..0000000000
--- a/OpenRA.Mods.Common/Scripting/Global/EffectGlobal.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-#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.Collections.Generic;
-using Eluant;
-using OpenRA.Mods.Common.Traits;
-using OpenRA.Scripting;
-
-namespace OpenRA.Mods.Common.Scripting
-{
- [ScriptGlobal("Effect")]
- public class EffectGlobal : ScriptGlobal
- {
- readonly IEnumerable fpes;
- readonly GlobalLightingPaletteEffect lighting;
-
- public EffectGlobal(ScriptContext context)
- : base(context)
- {
- fpes = context.World.WorldActor.TraitsImplementing();
- lighting = context.World.WorldActor.TraitOrDefault();
- }
-
- [Desc("Controls the `FlashPaletteEffect` trait.")]
- public void Flash(string type = null, int ticks = -1)
- {
- foreach (var fpe in fpes)
- if (fpe.Info.Type == type)
- fpe.Enable(ticks);
- }
-
- [Desc("Dynamically adjusts the `GlobalLightingPaletteEffect` trait.")]
- public void ChangeLighting(double red, double green, double blue, double ambient)
- {
- if (lighting == null)
- throw new LuaException("GlobalLightingPaletteEffect needs to be added to the World actor first.");
-
- lighting.Red = (float)red;
- lighting.Green = (float)green;
- lighting.Blue = (float)blue;
- lighting.Ambient = (float)ambient;
- }
- }
-}
diff --git a/OpenRA.Mods.Common/Scripting/Global/LightingGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/LightingGlobal.cs
new file mode 100644
index 0000000000..23d91491de
--- /dev/null
+++ b/OpenRA.Mods.Common/Scripting/Global/LightingGlobal.cs
@@ -0,0 +1,64 @@
+#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.Collections.Generic;
+using OpenRA.Mods.Common.Traits;
+using OpenRA.Scripting;
+
+namespace OpenRA.Mods.Common.Scripting
+{
+ [ScriptGlobal("Lighting")]
+ public class LightingGlobal : ScriptGlobal
+ {
+ readonly IEnumerable flashPaletteEffects;
+ readonly GlobalLightingPaletteEffect lighting;
+ readonly bool hasLighting;
+
+ public LightingGlobal(ScriptContext context)
+ : base(context)
+ {
+ flashPaletteEffects = context.World.WorldActor.TraitsImplementing();
+ lighting = context.World.WorldActor.TraitOrDefault();
+ hasLighting = lighting != null;
+ }
+
+ [Desc("Controls the `FlashPaletteEffect` trait.")]
+ public void Flash(string type = null, int ticks = -1)
+ {
+ foreach (var effect in flashPaletteEffects)
+ if (effect.Info.Type == type)
+ effect.Enable(ticks);
+ }
+
+ public double Red
+ {
+ get { return hasLighting ? lighting.Red : 0d; }
+ set { if (hasLighting) lighting.Red = (float)value; }
+ }
+
+ public double Green
+ {
+ get { return hasLighting ? lighting.Green : 0d; }
+ set { if (hasLighting) lighting.Green = (float)value; }
+ }
+
+ public double Blue
+ {
+ get { return hasLighting ? lighting.Blue : 0d; }
+ set { if (hasLighting) lighting.Blue = (float)value; }
+ }
+
+ public double Ambient
+ {
+ get { return hasLighting ? lighting.Ambient : 0d; }
+ set { if (hasLighting) lighting.Ambient = (float)value; }
+ }
+ }
+}
diff --git a/mods/ra/maps/fort-lonestar/fort-lonestar.lua b/mods/ra/maps/fort-lonestar/fort-lonestar.lua
index 965dd1ed22..5001e0bff2 100644
--- a/mods/ra/maps/fort-lonestar/fort-lonestar.lua
+++ b/mods/ra/maps/fort-lonestar/fort-lonestar.lua
@@ -150,7 +150,7 @@ end
Tick = function()
if (Utils.RandomInteger(1, 200) == 10) then
local delay = Utils.RandomInteger(1, 10)
- Effect.Flash("LightningStrike", delay)
+ Lighting.Flash("LightningStrike", delay)
Trigger.AfterDelay(delay, function()
Media.PlaySound("thunder" .. Utils.RandomInteger(1,6) .. ".aud")
end)