Merge pull request #6799 from pchote/additional-sounds
Made use of various additional sound files in Red Alert
This commit is contained in:
@@ -15,9 +15,15 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public class HealthInfo : ITraitInfo, UsesInit<HealthInit>
|
||||
{
|
||||
[Desc("HitPoints")]
|
||||
public readonly int HP = 0;
|
||||
|
||||
[Desc("Physical size of the unit used for damage calculations. Impacts within this radius apply full damage")]
|
||||
public readonly WRange Radius = new WRange(426);
|
||||
|
||||
[Desc("Don't trigger interfaces such as AnnounceOnKill.")]
|
||||
public readonly bool NotifyAppliedDamage = true;
|
||||
|
||||
public virtual object Create(ActorInitializer init) { return new Health(init, this); }
|
||||
}
|
||||
|
||||
@@ -92,7 +98,7 @@ namespace OpenRA.Traits
|
||||
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
|
||||
nd.DamageStateChanged(self, ai);
|
||||
|
||||
if (repairer != null && repairer.IsInWorld && !repairer.IsDead())
|
||||
if (Info.NotifyAppliedDamage && repairer != null && repairer.IsInWorld && !repairer.IsDead())
|
||||
foreach (var nd in repairer.TraitsImplementing<INotifyAppliedDamage>()
|
||||
.Concat(repairer.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
||||
nd.AppliedDamage(repairer, self, ai);
|
||||
@@ -135,7 +141,7 @@ namespace OpenRA.Traits
|
||||
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
|
||||
nd.DamageStateChanged(self, ai);
|
||||
|
||||
if (attacker != null && attacker.IsInWorld && !attacker.IsDead())
|
||||
if (Info.NotifyAppliedDamage && attacker != null && attacker.IsInWorld && !attacker.IsDead())
|
||||
foreach (var nd in attacker.TraitsImplementing<INotifyAppliedDamage>()
|
||||
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
||||
nd.AppliedDamage(attacker, self, ai);
|
||||
|
||||
@@ -26,8 +26,9 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var limitedAmmo = self.TraitOrDefault<LimitedAmmo>();
|
||||
if (!limitedAmmo.HasAmmo())
|
||||
{
|
||||
var info = self.Info.Traits.Get<MinelayerInfo>();
|
||||
// rearm & repair at fix, then back out here to refill the minefield some more
|
||||
var buildings = self.Info.Traits.Get<MinelayerInfo>().RearmBuildings;
|
||||
var buildings = info.RearmBuildings;
|
||||
var rearmTarget = self.World.Actors.Where(a => self.Owner.Stances[a.Owner] == Stance.Ally
|
||||
&& buildings.Contains(a.Info.Name))
|
||||
.ClosestTo(self);
|
||||
@@ -38,26 +39,27 @@ namespace OpenRA.Mods.RA.Activities
|
||||
return Util.SequenceActivities(
|
||||
new MoveAdjacentTo(self, Target.FromActor(rearmTarget)),
|
||||
movement.MoveTo(self.World.Map.CellContaining(rearmTarget.CenterPosition), rearmTarget),
|
||||
new Rearm(self),
|
||||
new Rearm(self, info.RearmSound),
|
||||
new Repair(rearmTarget),
|
||||
this);
|
||||
}
|
||||
|
||||
var ml = self.Trait<Minelayer>();
|
||||
if (ml.Minefield.Contains(self.Location) &&
|
||||
ShouldLayMine(self, self.Location))
|
||||
if (ml.Minefield.Contains(self.Location) && ShouldLayMine(self, self.Location))
|
||||
{
|
||||
LayMine(self);
|
||||
return Util.SequenceActivities(new Wait(20), this); // a little wait after placing each mine, for show
|
||||
}
|
||||
|
||||
if (ml.Minefield.Length > 0)
|
||||
{
|
||||
for (var n = 0; n < 20; n++) // dont get stuck forever here
|
||||
{
|
||||
var p = ml.Minefield.Random(self.World.SharedRandom);
|
||||
if (ShouldLayMine(self, p))
|
||||
return Util.SequenceActivities( movement.MoveTo(p, 0), this );
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: return somewhere likely to be safe (near fix) so we're not sitting out in the minefield.
|
||||
|
||||
|
||||
@@ -19,18 +19,21 @@ namespace OpenRA.Mods.RA.Activities
|
||||
readonly LimitedAmmo limitedAmmo;
|
||||
int ticksPerPip = 25 * 2;
|
||||
int remainingTicks = 25 * 2;
|
||||
string sound = null;
|
||||
|
||||
public Rearm(Actor self)
|
||||
public Rearm(Actor self, string sound = null)
|
||||
{
|
||||
limitedAmmo = self.TraitOrDefault<LimitedAmmo>();
|
||||
if (limitedAmmo != null)
|
||||
ticksPerPip = limitedAmmo.ReloadTimePerAmmo();
|
||||
remainingTicks = ticksPerPip;
|
||||
this.sound = sound;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled || limitedAmmo == null) return NextActivity;
|
||||
if (IsCanceled || limitedAmmo == null)
|
||||
return NextActivity;
|
||||
|
||||
if (--remainingTicks == 0)
|
||||
{
|
||||
@@ -44,6 +47,8 @@ namespace OpenRA.Mods.RA.Activities
|
||||
return NextActivity;
|
||||
|
||||
hostBuilding.Trait<RenderBuilding>().PlayCustomAnim(hostBuilding, "active");
|
||||
if (sound != null)
|
||||
Sound.Play(sound, self.CenterPosition);
|
||||
|
||||
remainingTicks = limitedAmmo.ReloadTimePerAmmo();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Play the Build voice of this actor when trained.")]
|
||||
public class AnnounceOnBuildInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new AnnounceOnBuild(init.self); }
|
||||
|
||||
@@ -12,15 +12,36 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
public class AnnounceOnKillInfo : TraitInfo<AnnounceOnKill> {}
|
||||
[Desc("Play the Kill voice of this actor when eliminating enemies.")]
|
||||
public class AnnounceOnKillInfo : ITraitInfo
|
||||
{
|
||||
[Desc("Minimum duration (in seconds) between sound events.")]
|
||||
public readonly int Interval = 5;
|
||||
|
||||
public object Create(ActorInitializer init) { return new AnnounceOnKill(init.self, this); }
|
||||
}
|
||||
|
||||
public class AnnounceOnKill : INotifyAppliedDamage
|
||||
{
|
||||
readonly AnnounceOnKillInfo info;
|
||||
|
||||
int lastAnnounce;
|
||||
|
||||
public AnnounceOnKill(Actor self, AnnounceOnKillInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
lastAnnounce = -info.Interval * 25;
|
||||
}
|
||||
|
||||
public void AppliedDamage(Actor self, Actor damaged, AttackInfo e)
|
||||
{
|
||||
if (e.DamageState == DamageState.Dead)
|
||||
Sound.PlayVoice("Kill", self, self.Owner.Country.Race);
|
||||
if (e.DamageState == DamageState.Dead && damaged != e.Attacker) // don't notify suicides
|
||||
{
|
||||
if (self.World.WorldTick - lastAnnounce > info.Interval * 25)
|
||||
Sound.PlayVoice("Kill", self, self.Owner.Country.Race);
|
||||
|
||||
lastAnnounce = self.World.WorldTick;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace OpenRA.Mods.RA
|
||||
public readonly int FlashInterval = 4;
|
||||
[Desc("Duration of each flash")]
|
||||
public readonly int FlashDuration = 3;
|
||||
[Desc("Voice string when planting explosive charges.")]
|
||||
public readonly string Voice = "Attack";
|
||||
|
||||
public object Create(ActorInitializer init) { return new C4Demolition(this); }
|
||||
}
|
||||
@@ -82,7 +84,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
{
|
||||
return order.OrderString == "C4" ? "Attack" : null;
|
||||
return order.OrderString == "C4" ? info.Voice : null;
|
||||
}
|
||||
|
||||
class C4DemolitionOrderTargeter : UnitOrderTargeter
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace OpenRA.Mods.RA
|
||||
[ActorReference] public readonly string Mine = "minv";
|
||||
[ActorReference] public readonly string[] RearmBuildings = { "fix" };
|
||||
|
||||
public readonly string RearmSound = "minelay1.aud";
|
||||
|
||||
public readonly float MinefieldDepth = 1.5f;
|
||||
|
||||
public object Create(ActorInitializer init) { return new Minelayer(init.self); }
|
||||
@@ -30,7 +32,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
class Minelayer : IIssueOrder, IResolveOrder, IPostRenderSelection, ISync
|
||||
{
|
||||
/* [Sync] when sync can cope with arrays! */
|
||||
/* TODO: [Sync] when sync can cope with arrays! */
|
||||
public CPos[] Minefield = null;
|
||||
[Sync] CPos minefieldStart;
|
||||
Actor self;
|
||||
|
||||
@@ -1338,6 +1338,8 @@ Rules:
|
||||
Percentage: 0
|
||||
InvulnerabilityUpgrade@UNKILLABLE:
|
||||
RequiresUpgrade: unkillable
|
||||
E7:
|
||||
-Selectable:
|
||||
|
||||
Sequences:
|
||||
|
||||
|
||||
@@ -250,6 +250,7 @@ E7:
|
||||
Range: 6c0
|
||||
C4Demolition:
|
||||
C4Delay: 45
|
||||
Voice: Demolish
|
||||
Passenger:
|
||||
PipType: Red
|
||||
Armament@PRIMARY:
|
||||
@@ -264,6 +265,8 @@ E7:
|
||||
TakeCover:
|
||||
RenderInfantry:
|
||||
IdleAnimations: idle1,idle2
|
||||
AnnounceOnBuild:
|
||||
AnnounceOnKill:
|
||||
|
||||
MEDI:
|
||||
Inherits: ^Infantry
|
||||
|
||||
@@ -7,6 +7,7 @@ MINP:
|
||||
Weapon: APMine
|
||||
Health:
|
||||
HP: 100
|
||||
NotifyAppliedDamage: false
|
||||
Armor:
|
||||
Type: Light
|
||||
RenderSimple:
|
||||
@@ -35,6 +36,7 @@ MINV:
|
||||
Weapon: ATMine
|
||||
Health:
|
||||
HP: 100
|
||||
NotifyAppliedDamage: false
|
||||
Armor:
|
||||
Type: Light
|
||||
RenderSimple:
|
||||
|
||||
@@ -46,11 +46,14 @@ MechanicVoice:
|
||||
TanyaVoice:
|
||||
Voices:
|
||||
Select: yo1,yes1,yeah1
|
||||
Move: rokroll1,onit1,cmon1
|
||||
Attack: tuffguy1,bombit1,gotit1
|
||||
Move: onit1,cmon1,rokroll1
|
||||
Attack: tuffguy1,bombit1
|
||||
Die: tandeth1
|
||||
Burned: tandeth1
|
||||
Zapped: tandeth1
|
||||
Build: laugh1
|
||||
Kill: gotit1,lefty1
|
||||
Demolish: keepem1,tuffguy1
|
||||
|
||||
DogVoice:
|
||||
Voices:
|
||||
|
||||
@@ -1093,7 +1093,7 @@ DepthCharge:
|
||||
SmudgeType: Crater
|
||||
Warhead@3Eff: CreateEffect
|
||||
Explosion: large_splash
|
||||
ImpactSound: splash9.aud
|
||||
ImpactSound: h2obomb2.aud
|
||||
Warhead@4EffHit: CreateEffect
|
||||
Explosion: small_explosion
|
||||
ImpactSound: kaboom15.aud
|
||||
|
||||
Reference in New Issue
Block a user