Skip to content

Commit

Permalink
Add an update rule adding ShakeOnDeath to bridges
Browse files Browse the repository at this point in the history
  • Loading branch information
abcdefg30 authored and reaperrr committed May 6, 2018
1 parent 917fd21 commit c6fee04
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
Expand Up @@ -579,6 +579,7 @@
<Compile Include="Traits\World\ActorSpawnManager.cs" />
<Compile Include="Traits\ActorSpawner.cs" />
<Compile Include="UpdateRules\Rules\ChangeIntensityToDuration.cs" />
<Compile Include="UpdateRules\Rules\AddShakeToBridge.cs" />
<Compile Include="UpdateRules\Rules\IgnoreAbstractActors.cs" />
<Compile Include="UtilityCommands\CheckYaml.cs" />
<Compile Include="UtilityCommands\ConvertPngToShpCommand.cs" />
Expand Down
47 changes: 47 additions & 0 deletions 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<string> 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);
}
}
}
1 change: 1 addition & 0 deletions OpenRA.Mods.Common/UpdateRules/UpdatePath.cs
Expand Up @@ -48,6 +48,7 @@ public class UpdatePath
new RemoveWithReloadingSpriteTurret(),
new ChangeIntensityToDuration(),
new IgnoreAbstractActors(),
new AddShakeToBridge(),
new AddEditorPlayer(),
new RemovePaletteFromCurrentTileset(),
new DefineLocomotors()
Expand Down

0 comments on commit c6fee04

Please sign in to comment.