voices are no longer tied to having Unit; default is to have no voice; defaults.yaml set up appropriately for units that should have one.
This commit is contained in:
@@ -48,6 +48,11 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
static bool HasVoice(Actor a)
|
||||
{
|
||||
return a.Info.Traits.Contains<SelectableInfo>() && a.Info.Traits.Get<SelectableInfo>().Voice != null;
|
||||
}
|
||||
|
||||
void ApplyOrders(World world, float2 xy, MouseInput mi)
|
||||
{
|
||||
if (orderGenerator == null) return;
|
||||
@@ -56,14 +61,13 @@ namespace OpenRA
|
||||
Game.orderManager.IssueOrders( orders );
|
||||
|
||||
var voicedActor = orders.Select(o => o.Subject)
|
||||
.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.traits.Contains<Unit>());
|
||||
.FirstOrDefault(a => a.Owner == world.LocalPlayer && HasVoice(a));
|
||||
|
||||
var isMove = orders.Any(o => o.OrderString == "Move");
|
||||
var isAttack = orders.Any( o => o.OrderString == "Attack" );
|
||||
|
||||
if (voicedActor != null)
|
||||
{
|
||||
|
||||
if(voicedActor.traits.GetOrDefault<IMove>().CanEnterCell(xy.ToInt2()))
|
||||
Sound.PlayVoice(isAttack ? "Attack" : "Move", voicedActor);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public readonly int Priority = 10;
|
||||
public readonly int[] Bounds = null;
|
||||
public readonly string Voice = "GenericVoice";
|
||||
public readonly string Voice = null;
|
||||
public readonly float Radius = 10;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River
|
||||
TerrainSpeeds: 90%, 80%, 100%, 0%, 0%, 0%, 0%, 90%, 80%, 0%
|
||||
Selectable:
|
||||
Voice: GenericVoice
|
||||
RenderInfantry:
|
||||
AutoTarget:
|
||||
Passenger:
|
||||
@@ -74,6 +75,7 @@
|
||||
Unit:
|
||||
TargetType: Air
|
||||
Selectable:
|
||||
Voice: GenericVoice
|
||||
HiddenUnderFog:
|
||||
RevealsShroud:
|
||||
GainsExperience:
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River
|
||||
TerrainSpeeds: 90%, 80%, 100%, 0%, 0%, 0%, 0%, 100%, 80%, 0%
|
||||
Selectable:
|
||||
Voice: GenericVoice
|
||||
RenderInfantry:
|
||||
AutoTarget:
|
||||
Passenger:
|
||||
@@ -62,6 +63,7 @@
|
||||
TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River
|
||||
TerrainSpeeds: 0%, 0%, 0%, 0%, 100%, 0%, 0%, 0%, 0%, 0%
|
||||
Selectable:
|
||||
Voice: GenericVoice
|
||||
HiddenUnderFog:
|
||||
RevealsShroud:
|
||||
GainsExperience:
|
||||
@@ -72,6 +74,7 @@
|
||||
Unit:
|
||||
TargetType: Air
|
||||
Selectable:
|
||||
Voice: GenericVoice
|
||||
HiddenUnderFog:
|
||||
RevealsShroud:
|
||||
GainsExperience:
|
||||
|
||||
Reference in New Issue
Block a user