-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hook up make animation conditions for the default mods.
- Loading branch information
Showing
15 changed files
with
344 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
OpenRA.Mods.Common/UpdateRules/Rules/20180923/RemovedNotifyBuildComplete.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#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 RemovedNotifyBuildComplete : UpdateRule | ||
{ | ||
public override string Name { get { return "Render traits are no longer automatically disabled during Building make-animations"; } } | ||
public override string Description | ||
{ | ||
get | ||
{ | ||
return "With* render/animation traits are no longer force-disabled while the WithMakeAnimation trait is active.\n" + | ||
"Affected actors are listed so that conditions may be manually defined."; | ||
} | ||
} | ||
|
||
static readonly string[] Traits = | ||
{ | ||
"WithAcceptDeliveredCashAnimation", | ||
"WithBuildingPlacedAnimation", | ||
"WithBuildingPlacedOverlay", | ||
"WithChargeAnimation", | ||
"WithChargeOverlay", | ||
"WithDockedOverlay", | ||
"WithIdleAnimation", | ||
"WithIdleOverlay", | ||
"WithNukeLaunchAnimation", | ||
"WithNukeLaunchOverlay", | ||
"WithProductionDoorOverlay", | ||
"WithProductionOverlay", | ||
"WithRepairOverlay", | ||
"WithResources", | ||
"WithResupplyAnimation", | ||
"WithSiloAnimation", | ||
"WithSpriteTurret", | ||
"WithVoxelBarrel", | ||
"WithVoxelTurret", | ||
"WithDeliveryAnimation", | ||
"WithCrumbleOverlay", | ||
"WithDeliveryOverlay" | ||
}; | ||
|
||
readonly Dictionary<string, List<string>> locations = new Dictionary<string, List<string>>(); | ||
|
||
public override IEnumerable<string> AfterUpdate(ModData modData) | ||
{ | ||
if (locations.Any()) | ||
yield return "Review the following definitions and, for those that are buildings,\n" + | ||
"define conditions to disable them while WithMakeAnimation is active:\n" + | ||
UpdateUtils.FormatMessageList(locations.Select( | ||
kv => kv.Key + ":\n" + UpdateUtils.FormatMessageList(kv.Value))); | ||
|
||
locations.Clear(); | ||
} | ||
|
||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) | ||
{ | ||
var used = new List<string>(); | ||
foreach (var t in Traits) | ||
if (actorNode.LastChildMatching(t) != null) | ||
used.Add(t); | ||
|
||
if (used.Any()) | ||
{ | ||
var location = "{0} ({1})".F(actorNode.Key, actorNode.Location.Filename); | ||
locations[location] = used; | ||
} | ||
|
||
yield break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.