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\World\ActorSpawnManager.cs" />
|
||||||
<Compile Include="Traits\ActorSpawner.cs" />
|
<Compile Include="Traits\ActorSpawner.cs" />
|
||||||
<Compile Include="UpdateRules\Rules\20181215\MakeMobilePausableConditional.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\RemoveAttackIgnoresVisibility.cs" />
|
||||||
<Compile Include="UpdateRules\Rules\20181215\RemoveAttackSuicides.cs" />
|
<Compile Include="UpdateRules\Rules\20181215\RemoveAttackSuicides.cs" />
|
||||||
<Compile Include="UpdateRules\Rules\20181215\RemovedDemolishLocking.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.")]
|
[Desc("Facing that the actor must face before deploying. Set to -1 to deploy regardless of facing.")]
|
||||||
public readonly int Facing = -1;
|
public readonly int Facing = -1;
|
||||||
|
|
||||||
[Desc("Sound to play when deploying.")]
|
[Desc("Play a randomly selected sound from this list when deploying.")]
|
||||||
public readonly string DeploySound = null;
|
public readonly string[] DeploySounds = null;
|
||||||
|
|
||||||
[Desc("Sound to play when undeploying.")]
|
[Desc("Play a randomly selected sound from this list when undeploying.")]
|
||||||
public readonly string UndeploySound = null;
|
public readonly string[] UndeploySounds = null;
|
||||||
|
|
||||||
[Desc("Skip make/deploy animation?")]
|
[Desc("Skip make/deploy animation?")]
|
||||||
public readonly bool SkipMakeAnimation = false;
|
public readonly bool SkipMakeAnimation = false;
|
||||||
@@ -221,8 +221,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!IsValidTerrain(self.Location))
|
if (!IsValidTerrain(self.Location))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Info.DeploySound))
|
if (Info.DeploySounds != null && Info.DeploySounds.Any())
|
||||||
Game.Sound.Play(SoundType.World, Info.DeploySound, self.CenterPosition);
|
Game.Sound.Play(SoundType.World, Info.DeploySounds.Random(self.World.LocalRandom), self.CenterPosition);
|
||||||
|
|
||||||
// Revoke condition that is applied while undeployed.
|
// Revoke condition that is applied while undeployed.
|
||||||
if (!init)
|
if (!init)
|
||||||
@@ -245,8 +245,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!init && deployState != DeployState.Deployed)
|
if (!init && deployState != DeployState.Deployed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Info.UndeploySound))
|
if (Info.UndeploySounds != null && Info.UndeploySounds.Any())
|
||||||
Game.Sound.Play(SoundType.World, Info.UndeploySound, self.CenterPosition);
|
Game.Sound.Play(SoundType.World, Info.UndeploySounds.Random(self.World.LocalRandom), self.CenterPosition);
|
||||||
|
|
||||||
if (!init)
|
if (!init)
|
||||||
OnUndeployStarted();
|
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
|
// Bleed only changes here
|
||||||
new RemoveAttackSuicides(),
|
new RemoveAttackSuicides(),
|
||||||
|
new MultipleDeploySounds(),
|
||||||
new MakeMobilePausableConditional(),
|
new MakeMobilePausableConditional(),
|
||||||
new StreamlineRepairableTraits(),
|
new StreamlineRepairableTraits(),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -349,8 +349,8 @@ JUGG:
|
|||||||
UndeployedCondition: undeployed
|
UndeployedCondition: undeployed
|
||||||
Facing: 96
|
Facing: 96
|
||||||
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
||||||
DeploySound: place2.aud
|
DeploySounds: place2.aud
|
||||||
UndeploySound: clicky1.aud
|
UndeploySounds: clicky1.aud
|
||||||
GrantCondition@PREVIEWWORKAROUND:
|
GrantCondition@PREVIEWWORKAROUND:
|
||||||
Condition: real-actor
|
Condition: real-actor
|
||||||
QuantizeFacingsFromSequence:
|
QuantizeFacingsFromSequence:
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ TTNK:
|
|||||||
UndeployedCondition: undeployed
|
UndeployedCondition: undeployed
|
||||||
Facing: 160
|
Facing: 160
|
||||||
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
||||||
DeploySound: place2.aud
|
DeploySounds: place2.aud
|
||||||
UndeploySound: clicky1.aud
|
UndeploySounds: clicky1.aud
|
||||||
GrantCondition@PREVIEWWORKAROUND:
|
GrantCondition@PREVIEWWORKAROUND:
|
||||||
Condition: real-actor
|
Condition: real-actor
|
||||||
WithVoxelBody:
|
WithVoxelBody:
|
||||||
@@ -240,8 +240,8 @@ ART2:
|
|||||||
UndeployedCondition: undeployed
|
UndeployedCondition: undeployed
|
||||||
Facing: 96
|
Facing: 96
|
||||||
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
||||||
DeploySound: place2.aud
|
DeploySounds: place2.aud
|
||||||
UndeploySound: clicky1.aud
|
UndeploySounds: clicky1.aud
|
||||||
GrantCondition@PREVIEWWORKAROUND:
|
GrantCondition@PREVIEWWORKAROUND:
|
||||||
Condition: real-actor
|
Condition: real-actor
|
||||||
WithVoxelBody:
|
WithVoxelBody:
|
||||||
|
|||||||
@@ -147,8 +147,8 @@ LPST:
|
|||||||
UndeployedCondition: undeployed
|
UndeployedCondition: undeployed
|
||||||
Facing: 160
|
Facing: 160
|
||||||
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
AllowedTerrainTypes: Clear, Road, DirtRoad, Rough
|
||||||
DeploySound: place2.aud
|
DeploySounds: place2.aud
|
||||||
UndeploySound: clicky1.aud
|
UndeploySounds: clicky1.aud
|
||||||
WithVoxelBody:
|
WithVoxelBody:
|
||||||
RequiresCondition: undeployed
|
RequiresCondition: undeployed
|
||||||
WithSpriteBody@deployed:
|
WithSpriteBody@deployed:
|
||||||
|
|||||||
Reference in New Issue
Block a user