Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ProductionAirdrop & WithDeliveryAnimation to Mods.Common #17406

Merged
merged 3 commits into from Dec 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -14,21 +14,21 @@
using OpenRA.Activities;
using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;

namespace OpenRA.Mods.Cnc.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Deliver the unit in production via skylift.")]
public class ProductionAirdropInfo : ProductionInfo
{
[NotificationReference("Speech")]
public readonly string ReadyAudio = "Reinforce";

[FieldLoader.Require]
[ActorReference(typeof(AircraftInfo))]
[Desc("Cargo aircraft used for delivery. Must have the `Aircraft` trait.")]
public readonly string ActorType = "c17";
public readonly string ActorType = null;

[Desc("The cargo aircraft will spawn at the player baseline (map edge closest to the player spawn)")]
public readonly bool BaselineSpawn = false;
Expand Down
Expand Up @@ -11,10 +11,9 @@

using System.Linq;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.Common.Traits.Render;
using OpenRA.Traits;

namespace OpenRA.Mods.Cnc.Traits.Render
namespace OpenRA.Mods.Common.Traits.Render
{
[Desc("Building animation to play when ProductionAirdrop is used to deliver units.")]
public class WithDeliveryAnimationInfo : ConditionalTraitInfo, Requires<WithSpriteBodyInfo>
Expand Down
@@ -0,0 +1,56 @@
#region Copyright & License Information
/*
* Copyright 2007-2019 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;
using System.Collections.Generic;
using System.Linq;

namespace OpenRA.Mods.Common.UpdateRules.Rules
{
public class RemoveAirdropActorTypeDefault : UpdateRule
{
public override string Name { get { return "Removed internal default of ProductionAirdrop.ActorType"; } }
public override string Description
{
get
{
return "Removed internal default of 'c17' from ProductionAirdrop.ActorType.";
}
}

readonly List<Tuple<string, string>> missingActorTypes = new List<Tuple<string, string>>();

public override IEnumerable<string> AfterUpdate(ModData modData)
{
var message = "ProductionAirdrop.ActorType no longer defaults to 'c17' and must be defined explicitly.\n"
+ "You may have to define it manually now in the following places:\n"
+ UpdateUtils.FormatMessageList(missingActorTypes.Select(n => n.Item1 + " (" + n.Item2 + ")"));

if (missingActorTypes.Any())
yield return message;

missingActorTypes.Clear();
}

public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
var airProd = actorNode.LastChildMatching("ProductionAirdrop");
if (airProd != null)
{
var actorTypeNode = airProd.LastChildMatching("ActorType");
if (actorTypeNode == null)
missingActorTypes.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
}

yield break;
}
}
}
1 change: 1 addition & 0 deletions OpenRA.Mods.Common/UpdateRules/UpdatePath.cs
Expand Up @@ -142,6 +142,7 @@ public class UpdatePath
// Bleed only changes here
new RemoveYesNo(),
new RemoveInitialFacingHardcoding(),
new RemoveAirdropActorTypeDefault(),
})
};

Expand Down
1 change: 1 addition & 0 deletions mods/cnc/rules/structures.yaml
Expand Up @@ -438,6 +438,7 @@ AFLD:
ExitCell: 3,1
ProductionAirdrop:
Produces: Vehicle.Nod
ActorType: c17
WithBuildingBib:
WithIdleOverlay@DISH:
RequiresCondition: !build-incomplete
Expand Down