Skip to content

Commit

Permalink
Hook up make animation conditions for the default mods.
Browse files Browse the repository at this point in the history
  • Loading branch information
pchote committed Oct 6, 2018
1 parent 4531ff6 commit 7c00335
Show file tree
Hide file tree
Showing 15 changed files with 344 additions and 81 deletions.
1 change: 1 addition & 0 deletions OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@
<Compile Include="Traits\World\WeatherOverlay.cs" />
<Compile Include="Traits\World\ActorSpawnManager.cs" />
<Compile Include="Traits\ActorSpawner.cs" />
<Compile Include="UpdateRules\Rules\20180923\RemovedNotifyBuildComplete.cs" />
<Compile Include="UtilityCommands\CheckYaml.cs" />
<Compile Include="UtilityCommands\ConvertPngToShpCommand.cs" />
<Compile Include="UtilityCommands\ConvertSpriteToPngCommand.cs" />
Expand Down
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;
}
}
}
1 change: 1 addition & 0 deletions OpenRA.Mods.Common/UpdateRules/UpdatePath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public class UpdatePath
new RenameEditorTilesetFilter(),
new DefineNotificationDefaults(),
new MergeRearmAndRepairAnimation(),
new RemovedNotifyBuildComplete(),
})
};

Expand Down
45 changes: 36 additions & 9 deletions mods/cnc/rules/structures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ FACT:
Type: Wood
RevealsShroud:
Range: 10c0
WithBuildingBib:
Production:
Produces: Building.GDI, Building.Nod, Defence.GDI, Defence.Nod
Transforms:
Expand Down Expand Up @@ -84,7 +83,11 @@ FACT:
BaseProvider:
Cooldown: 75
Range: 14c0
WithBuildingBib:
WithMakeAnimation:
Condition: build-incomplete
WithBuildingPlacedAnimation:
RequiresCondition: !build-incomplete
Power:
Amount: 0
ProvidesPrerequisite@buildingname:
Expand Down Expand Up @@ -205,7 +208,6 @@ PROC:
HP: 100000
RevealsShroud:
Range: 6c0
WithBuildingBib:
Refinery:
DockAngle: 112
DockOffset: 0,2
Expand All @@ -226,7 +228,11 @@ PROC:
Actor: HARV
SpawnOffset: 1,2
Facing: 64
WithBuildingBib:
WithMakeAnimation:
Condition: build-incomplete
WithResources:
RequiresCondition: !build-incomplete
Power:
Amount: -40
ProvidesPrerequisite@buildingname:
Expand Down Expand Up @@ -254,9 +260,10 @@ SILO:
Range: 4c0
WithBuildingBib:
HasMinibib: Yes
RenderSprites:
WithSpriteBody:
WithMakeAnimation:
Condition: build-incomplete
WithSiloAnimation:
RequiresCondition: !build-incomplete
StoresResources:
PipCount: 10
PipColor: Green
Expand Down Expand Up @@ -406,17 +413,21 @@ AFLD:
HP: 110000
RevealsShroud:
Range: 7c0
WithBuildingBib:
WithIdleOverlay@DISH:
Sequence: idle-dish
RallyPoint:
Offset: 4,2
Exit@1:
SpawnOffset: -1024,0,0
ExitCell: 3,1
ProductionAirdrop:
Produces: Vehicle.Nod
WithBuildingBib:
WithMakeAnimation:
Condition: build-incomplete
WithIdleOverlay@DISH:
RequiresCondition: !build-incomplete
Sequence: idle-dish
WithDeliveryAnimation:
RequiresCondition: !build-incomplete
ProductionQueue:
Type: Vehicle.Nod
Group: Vehicle
Expand Down Expand Up @@ -463,7 +474,10 @@ WEAP:
RevealsShroud:
Range: 4c0
WithBuildingBib:
WithMakeAnimation:
Condition: build-incomplete
WithProductionDoorOverlay:
RequiresCondition: !build-incomplete
Sequence: build-top
RallyPoint:
Offset: 0,2
Expand Down Expand Up @@ -521,7 +535,10 @@ HPAD:
HpPerStep: 1000
PlayerExperience: 25
StartRepairingNotification: Repairing
WithMakeAnimation:
Condition: build-incomplete
WithResupplyAnimation:
RequiresCondition: !build-incomplete
RallyPoint:
ProductionQueue@GDI:
Type: Aircraft.GDI
Expand Down Expand Up @@ -647,14 +664,17 @@ FIX:
Range: 5c0
WithBuildingBib:
HasMinibib: Yes
WithMakeAnimation:
Condition: build-incomplete
WithResupplyAnimation:
RequiresCondition: !build-incomplete
Reservable:
RepairsUnits:
HpPerStep: 1000
Interval: 15
PlayerExperience: 25
StartRepairingNotification: Repairing
RallyPoint:
WithResupplyAnimation:
Power:
Amount: -20
ProvidesPrerequisite@buildingname:
Expand Down Expand Up @@ -749,7 +769,6 @@ TMPL:
HP: 210000
RevealsShroud:
Range: 6c0
WithBuildingBib:
RenderDetectionCircle:
DetectCloaked:
Range: 5c0
Expand Down Expand Up @@ -778,8 +797,13 @@ TMPL:
ArrowSequence: arrow
ClockSequence: clock
CircleSequence: circles
WithBuildingBib:
WithMakeAnimation:
Condition: build-incomplete
WithNukeLaunchAnimation:
RequiresCondition: !build-incomplete
WithNukeLaunchOverlay:
RequiresCondition: !build-incomplete
Sequence: smoke
SupportPowerChargeBar:
Power:
Expand Down Expand Up @@ -906,7 +930,10 @@ OBLI:
Range: 8c0
WithBuildingBib:
HasMinibib: Yes
WithMakeAnimation:
Condition: build-incomplete
WithChargeAnimation:
RequiresCondition: !build-incomplete
Armament:
Weapon: Laser
LocalOffset: 0,-85,1280
Expand Down
7 changes: 5 additions & 2 deletions mods/d2k/rules/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@
SoundOnDamageTransition:
DamagedSounds: EXPLSML1.WAV
DestroyedSounds: EXPLHG1.WAV
WithSpriteBody:
Explodes:
Type: Footprint
Weapon: BuildingExplode
Expand All @@ -413,7 +412,6 @@
SellSounds: BUILD1.WAV
Guardable:
Range: 3c0
WithCrumbleOverlay:
Demolishable:
DamagedByTerrain:
Damage: 500
Expand All @@ -425,7 +423,11 @@
Weapons: Debris, Debris2, Debris3, Debris4
Pieces: 2, 5
Range: 1c512, 4c0
WithSpriteBody:
WithMakeAnimation:
Condition: build-incomplete
WithCrumbleOverlay:
RequiresCondition: !build-incomplete
RevealOnDeath:
Duration: 100
Radius: 4c768
Expand All @@ -448,6 +450,7 @@
Range: 1c768
-GivesBuildableArea:
-WithMakeAnimation:
-WithCrumbleOverlay:
-Capturable:
-WithSpriteBody:
WithWallSpriteBody:
Expand Down
Loading

0 comments on commit 7c00335

Please sign in to comment.