diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index b1eeb49fba..686232b5d2 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -579,6 +579,7 @@ + diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/AddShakeToBridge.cs b/OpenRA.Mods.Common/UpdateRules/Rules/AddShakeToBridge.cs new file mode 100644 index 0000000000..1a1f9f7f4a --- /dev/null +++ b/OpenRA.Mods.Common/UpdateRules/Rules/AddShakeToBridge.cs @@ -0,0 +1,47 @@ +#region Copyright & License Information +/* + * Copyright 2007-2018 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, either version 3 of + * the License, or (at your option) any later version. For more + * information, see COPYING. + */ +#endregion + +using System.Collections.Generic; +using System.Linq; + +namespace OpenRA.Mods.Common.UpdateRules.Rules +{ + public class AddShakeToBridge : UpdateRule + { + public override string Name { get { return "Screen shaking was removed from dying bridges."; } } + public override string Description + { + get + { + return "'Bridges' (and 'GroundLevelBridges') no longer shake the screen on their own.\n" + + "The 'ShakeOnDeath' trait is to be used instead."; + } + } + + public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) + { + if (actorNode.ChildrenMatching("Bridge").Any()) + AddShakeNode(actorNode); + else if (actorNode.ChildrenMatching("GroundLevelBridge").Any()) + AddShakeNode(actorNode); + + yield break; + } + + void AddShakeNode(MiniYamlNode actorNode) + { + var shake = new MiniYamlNode("ShakeOnDeath", ""); + shake.AddNode("Duration", "15"); + shake.AddNode("Intensity", "6"); + actorNode.AddNode(shake); + } + } +} diff --git a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs index 2af568d2f7..74cefc988e 100644 --- a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs +++ b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs @@ -48,6 +48,7 @@ namespace OpenRA.Mods.Common.UpdateRules new RemoveWithReloadingSpriteTurret(), new ChangeIntensityToDuration(), new IgnoreAbstractActors(), + new AddShakeToBridge(), new AddEditorPlayer(), new RemovePaletteFromCurrentTileset(), new DefineLocomotors()