Add support for multiple (un)deploy sounds on GrantConditionOnDeploy
This commit is contained in:
@@ -597,6 +597,7 @@
|
||||
<Compile Include="Traits\World\ActorSpawnManager.cs" />
|
||||
<Compile Include="Traits\ActorSpawner.cs" />
|
||||
<Compile Include="UpdateRules\Rules\20181215\MakeMobilePausableConditional.cs" />
|
||||
<Compile Include="UpdateRules\Rules\20181215\MultipleDeploySounds.cs" />
|
||||
<Compile Include="UpdateRules\Rules\20181215\RemoveAttackIgnoresVisibility.cs" />
|
||||
<Compile Include="UpdateRules\Rules\20181215\RemoveAttackSuicides.cs" />
|
||||
<Compile Include="UpdateRules\Rules\20181215\RemovedDemolishLocking.cs" />
|
||||
|
||||
@@ -45,11 +45,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Facing that the actor must face before deploying. Set to -1 to deploy regardless of facing.")]
|
||||
public readonly int Facing = -1;
|
||||
|
||||
[Desc("Sound to play when deploying.")]
|
||||
public readonly string DeploySound = null;
|
||||
[Desc("Play a randomly selected sound from this list when deploying.")]
|
||||
public readonly string[] DeploySounds = null;
|
||||
|
||||
[Desc("Sound to play when undeploying.")]
|
||||
public readonly string UndeploySound = null;
|
||||
[Desc("Play a randomly selected sound from this list when undeploying.")]
|
||||
public readonly string[] UndeploySounds = null;
|
||||
|
||||
[Desc("Skip make/deploy animation?")]
|
||||
public readonly bool SkipMakeAnimation = false;
|
||||
@@ -221,8 +221,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!IsValidTerrain(self.Location))
|
||||
return;
|
||||
|
||||
if (!string.IsNullOrEmpty(Info.DeploySound))
|
||||
Game.Sound.Play(SoundType.World, Info.DeploySound, self.CenterPosition);
|
||||
if (Info.DeploySounds != null && Info.DeploySounds.Any())
|
||||
Game.Sound.Play(SoundType.World, Info.DeploySounds.Random(self.World.LocalRandom), self.CenterPosition);
|
||||
|
||||
// Revoke condition that is applied while undeployed.
|
||||
if (!init)
|
||||
@@ -245,8 +245,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!init && deployState != DeployState.Deployed)
|
||||
return;
|
||||
|
||||
if (!string.IsNullOrEmpty(Info.UndeploySound))
|
||||
Game.Sound.Play(SoundType.World, Info.UndeploySound, self.CenterPosition);
|
||||
if (Info.UndeploySounds != null && Info.UndeploySounds.Any())
|
||||
Game.Sound.Play(SoundType.World, Info.UndeploySounds.Random(self.World.LocalRandom), self.CenterPosition);
|
||||
|
||||
if (!init)
|
||||
OnUndeployStarted();
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#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;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class MultipleDeploySounds : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "'GrantConditionOnDeploy' now supports multiple (un)deploy sounds"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Renamed 'DeploySound' to 'DeploySounds' and 'UndeploySound' to 'UndeploySounds'\n" +
|
||||
"on 'GrantConditionOnDeploy'.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var grants = actorNode.ChildrenMatching("GrantConditionOnDeploy");
|
||||
foreach (var g in grants)
|
||||
{
|
||||
var deploy = g.LastChildMatching("DeploySound");
|
||||
if (deploy != null)
|
||||
deploy.RenameKey("DeploySounds");
|
||||
|
||||
var undeploy = g.LastChildMatching("UndeploySound");
|
||||
if (undeploy != null)
|
||||
undeploy.RenameKey("UndeploySounds");
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,6 +118,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
{
|
||||
// Bleed only changes here
|
||||
new RemoveAttackSuicides(),
|
||||
new MultipleDeploySounds(),
|
||||
new MakeMobilePausableConditional(),
|
||||
new StreamlineRepairableTraits(),
|
||||
})
|
||||
|
||||
@@ -349,8 +349,8 @@ JUGG:
|
||||
UndeployedCondition: undeployed
|
||||
Facing: 96
|
||||
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
||||
DeploySound: place2.aud
|
||||
UndeploySound: clicky1.aud
|
||||
DeploySounds: place2.aud
|
||||
UndeploySounds: clicky1.aud
|
||||
GrantCondition@PREVIEWWORKAROUND:
|
||||
Condition: real-actor
|
||||
QuantizeFacingsFromSequence:
|
||||
|
||||
@@ -136,8 +136,8 @@ TTNK:
|
||||
UndeployedCondition: undeployed
|
||||
Facing: 160
|
||||
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
||||
DeploySound: place2.aud
|
||||
UndeploySound: clicky1.aud
|
||||
DeploySounds: place2.aud
|
||||
UndeploySounds: clicky1.aud
|
||||
GrantCondition@PREVIEWWORKAROUND:
|
||||
Condition: real-actor
|
||||
WithVoxelBody:
|
||||
@@ -240,8 +240,8 @@ ART2:
|
||||
UndeployedCondition: undeployed
|
||||
Facing: 96
|
||||
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
||||
DeploySound: place2.aud
|
||||
UndeploySound: clicky1.aud
|
||||
DeploySounds: place2.aud
|
||||
UndeploySounds: clicky1.aud
|
||||
GrantCondition@PREVIEWWORKAROUND:
|
||||
Condition: real-actor
|
||||
WithVoxelBody:
|
||||
|
||||
@@ -147,8 +147,8 @@ LPST:
|
||||
UndeployedCondition: undeployed
|
||||
Facing: 160
|
||||
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
||||
DeploySound: place2.aud
|
||||
UndeploySound: clicky1.aud
|
||||
DeploySounds: place2.aud
|
||||
UndeploySounds: clicky1.aud
|
||||
WithVoxelBody:
|
||||
RequiresCondition: undeployed
|
||||
WithSpriteBody@deployed:
|
||||
|
||||
Reference in New Issue
Block a user