check voice actor references

This commit is contained in:
Matthias Mailänder
2015-06-20 12:09:58 +02:00
parent 264a63e58c
commit 50e5e9df24
52 changed files with 390 additions and 81 deletions

View File

@@ -19,10 +19,22 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
{
class DemoTruckInfo : TraitInfo<DemoTruck>, Requires<ExplodesInfo> { }
class DemoTruckInfo : ITraitInfo, Requires<ExplodesInfo>
{
[VoiceReference] public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new DemoTruck(init.Self, this); }
}
class DemoTruck : IIssueOrder, IResolveOrder, IOrderVoice
{
readonly DemoTruckInfo info;
public DemoTruck(Actor self, DemoTruckInfo info)
{
this.info = info;
}
static void Explode(Actor self)
{
self.World.AddFrameEndTask(w => self.InflictDamage(self, int.MaxValue, null));
@@ -50,7 +62,7 @@ namespace OpenRA.Mods.RA.Traits
public string VoicePhraseForOrder(Actor self, Order order)
{
return "Attack";
return info.Voice;
}
public void ResolveOrder(Actor self, Order order)

View File

@@ -57,10 +57,22 @@ namespace OpenRA.Mods.RA.Traits
}
[Desc("Provides access to the disguise command, which makes the actor appear to be another player's actor.")]
class DisguiseInfo : TraitInfo<Disguise> { }
class DisguiseInfo : ITraitInfo
{
[VoiceReference] public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new Disguise(init.Self, this); }
}
class Disguise : IEffectiveOwner, IIssueOrder, IResolveOrder, IOrderVoice, IRadarColorModifier, INotifyAttack
{
readonly DisguiseInfo info;
public Disguise(Actor self, DisguiseInfo info)
{
this.info = info;
}
public Player AsPlayer { get; private set; }
public string AsSprite { get; private set; }
public ITooltipInfo AsTooltipInfo { get; private set; }
@@ -95,7 +107,7 @@ namespace OpenRA.Mods.RA.Traits
public string VoicePhraseForOrder(Actor self, Order order)
{
return order.OrderString == "Disguise" ? "Attack" : null;
return order.OrderString == "Disguise" ? info.Voice : null;
}
public Color RadarColorOverride(Actor self)

View File

@@ -22,6 +22,8 @@ namespace OpenRA.Mods.RA.Traits
{
public readonly string[] Types = { };
[VoiceReference] public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new Infiltrates(this); }
}
@@ -81,7 +83,7 @@ namespace OpenRA.Mods.RA.Traits
public string VoicePhraseForOrder(Actor self, Order order)
{
return order.OrderString == "Infiltrate" && IsValidOrder(self, order)
? "Attack" : null;
? info.Voice : null;
}
public void ResolveOrder(Actor self, Order order)

View File

@@ -45,6 +45,8 @@ namespace OpenRA.Mods.RA.Traits
[ActorReference]
public readonly string DriverActor = "e1";
[VoiceReference] public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new MadTank(init.Self, this); }
}
@@ -107,7 +109,7 @@ namespace OpenRA.Mods.RA.Traits
public string VoicePhraseForOrder(Actor self, Order order)
{
return "Attack";
return info.Voice;
}
void Detonate()

View File

@@ -41,6 +41,8 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Cursor to display when unable to deploy the actor.")]
public readonly string DeployBlockedCursor = "deploy-blocked";
[VoiceReference] public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new PortableChrono(this); }
}
@@ -93,7 +95,7 @@ namespace OpenRA.Mods.RA.Traits
public string VoicePhraseForOrder(Actor self, Order order)
{
return order.OrderString == "PortableChronoTeleport" && CanTeleport ? "Move" : null;
return order.OrderString == "PortableChronoTeleport" && CanTeleport ? Info.Voice : null;
}
public void ResetChargeTime()