Add an Unload voice for when a unit is unloading.
This commit is contained in:
@@ -42,7 +42,7 @@ namespace OpenRA
|
||||
else
|
||||
actors = (isCombine ? oldSelection.Union(newSelection) : newSelection).ToList();
|
||||
|
||||
var voicedUnit = actors.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.IsInWorld && a.HasVoice());
|
||||
var voicedUnit = actors.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.IsInWorld && a.HasVoices());
|
||||
if (voicedUnit != null)
|
||||
Sound.PlayVoice("Select", voicedUnit, voicedUnit.Owner.Country.Race);
|
||||
|
||||
|
||||
@@ -151,18 +151,24 @@ namespace OpenRA
|
||||
return new float2(Gauss1D(r, samples), Gauss1D(r, samples));
|
||||
}
|
||||
|
||||
public static bool HasVoice(this Actor a)
|
||||
public static bool HasVoices(this Actor a)
|
||||
{
|
||||
var selectable = a.Info.Traits.GetOrDefault<SelectableInfo>();
|
||||
return selectable != null && selectable.Voice != null;
|
||||
}
|
||||
|
||||
public static SoundInfo GetVoice(this Actor a)
|
||||
public static bool HasVoice(this Actor a, string voice)
|
||||
{
|
||||
var v = GetVoices(a);
|
||||
return v != null && v.Voices.ContainsKey(voice);
|
||||
}
|
||||
|
||||
public static SoundInfo GetVoices(this Actor a)
|
||||
{
|
||||
var selectable = a.Info.Traits.GetOrDefault<SelectableInfo>();
|
||||
if (selectable == null) return null;
|
||||
var v = selectable.Voice;
|
||||
return (v == null) ? null : Rules.Voices[v];
|
||||
return (v == null) ? null : Rules.Voices[v.ToLowerInvariant()];
|
||||
}
|
||||
|
||||
public static void PlayVoiceForOrders(this World w, Order[] orders)
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace OpenRA.Mods.RA
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString != "Unload" || IsEmpty(self)) return null;
|
||||
return "Move";
|
||||
return self.HasVoice("Unload") ? "Unload" : "Move";
|
||||
}
|
||||
|
||||
public bool HasSpace(int weight) { return totalWeight + weight <= info.MaxWeight; }
|
||||
|
||||
Reference in New Issue
Block a user