Shift "XXX Lost" notification onto a trait. Hook up "Structure Lost" (cnc) and "Airborne Unit Lost" (ra).

This commit is contained in:
Paul Chote
2010-08-01 01:00:41 +12:00
parent 45e54e1ca8
commit d416f0be5c
10 changed files with 138 additions and 206 deletions

View File

@@ -21,7 +21,6 @@ namespace OpenRA.GameRules
public readonly string[] Move = { };
public readonly string[] Attack = null;
public readonly string[] Die = { };
public readonly string[] Lost = { };
public readonly Lazy<Dictionary<string, VoicePool>> Pools;
@@ -36,7 +35,6 @@ namespace OpenRA.GameRules
{ "Move", new VoicePool(Move) },
{ "Attack", new VoicePool( Attack ?? Move ) },
{ "Die", new VoicePool(Die) },
{ "Lost", new VoicePool(Lost) },
});
}
}

View File

@@ -19,15 +19,8 @@ namespace OpenRA.Traits
public object Create( ActorInitializer init ) { return new Unit(); }
}
public class Unit : INotifyDamage, IRadarSignature
public class Unit : IRadarSignature
{
public void Damaged(Actor self, AttackInfo e)
{
if (e.DamageState == DamageState.Dead)
if (self.Owner == self.World.LocalPlayer)
Sound.PlayVoice("Lost", self);
}
public IEnumerable<int2> RadarSignatureCells(Actor self)
{
yield return self.Location;

View File

@@ -0,0 +1,41 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 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. For more information,
* see LICENSE.
*/
#endregion
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class ActorLostNotificationInfo : ITraitInfo
{
public readonly string Notification = null;
public readonly bool NotifyAll = false;
public object Create(ActorInitializer init) { return new ActorLostNotification(this); }
}
class ActorLostNotification : INotifyDamage
{
ActorLostNotificationInfo Info;
public ActorLostNotification(ActorLostNotificationInfo info)
{
Info = info;
}
public void Damaged(Actor self, AttackInfo e)
{
if (e.DamageState == DamageState.Dead)
{
var player = (Info.NotifyAll) ? self.World.LocalPlayer : self.Owner;
Sound.PlayToPlayer(player, Info.Notification);
}
}
}
}

View File

@@ -232,6 +232,7 @@
<Compile Include="World\ChoosePaletteOnSelect.cs" />
<Compile Include="Transforms.cs" />
<Compile Include="Activities\Transform.cs" />
<Compile Include="ActorLostNotification.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -192,3 +192,52 @@ BRIDGE4:
Building:
Footprint: ______ ______ ______ ______
Dimensions: 6,4
C1:
Inherits: ^CivInfantry
Selectable:
Voice: CivilianMaleVoice
Bounds: 12,17,0,-9
C2:
Inherits: ^CivInfantry
Selectable:
Voice: CivilianFemaleVoice
Bounds: 12,17,0,-9
C3:
Inherits: ^CivInfantry
C4:
Inherits: ^CivInfantry
Selectable:
Voice: CivilianFemaleVoice
Bounds: 12,17,0,-9
C5:
Inherits: ^CivInfantry
C6:
Inherits: ^CivInfantry
Selectable:
Voice: CivilianFemaleVoice
Bounds: 12,17,0,-9
C7:
Inherits: ^CivInfantry
C8:
Inherits: ^CivInfantry
Selectable:
Voice: CivilianFemaleVoice
Bounds: 12,17,0,-9
C9:
Inherits: ^CivInfantry
C10:
Inherits: ^CivInfantry
Selectable:
Voice: CivilianFemaleVoice
Bounds: 12,17,0,-9

View File

@@ -18,6 +18,8 @@
GainsExperience:
GivesExperience:
DrawLineToTarget:
ActorLostNotification:
Notification: unitlost.aud
^Tank:
Category: Vehicle
@@ -39,6 +41,8 @@
GainsExperience:
GivesExperience:
DrawLineToTarget:
ActorLostNotification:
Notification: unitlost.aud
^Helicopter:
Category: Plane
@@ -54,6 +58,8 @@
TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River
TerrainSpeeds: 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%
DrawLineToTarget:
ActorLostNotification:
Notification: unitlost.aud
^Infantry:
Category: Infantry
@@ -79,6 +85,29 @@
GivesExperience:
# SharesCell:
DrawLineToTarget:
ActorLostNotification:
Notification: unitlost.aud
^CivInfantry:
Inherits: ^Infantry
Selectable:
Voice: CivilianMaleVoice
Bounds: 12,17,0,-9
Valued:
Cost: 70
Description: Civilian
Unit:
Mobile:
Speed: 4
Health:
HP: 20
RevealsShroud:
Range: 2
AttackBase:
PrimaryWeapon: Pistol
# ActorLostNotification:
# Notification: civdead1.aud
# NotifyAll: true
^Plane:
Category: Plane
@@ -91,6 +120,8 @@
GainsExperience:
GivesExperience:
DrawLineToTarget:
ActorLostNotification:
Notification: unitlost.aud
^Building:
Category: Building
@@ -118,6 +149,8 @@
CaptureNotification@NOD:
Race: nod
Notification: nodcapt1.aud
ActorLostNotification:
Notification: strclost.aud
^CivBuilding:
Inherits: ^Building

View File

@@ -164,182 +164,3 @@ RMBO:
TakeCover:
C4Demolition:
C4Delay: .03
C1:
Inherits: ^Infantry
Selectable:
Voice: CivilianMaleVoice
Bounds: 12,17,0,-9
Valued:
Cost: 70
Description: Technician
Unit:
Mobile:
Speed: 4
Health:
HP: 20
RevealsShroud:
Range: 2
AttackBase:
PrimaryWeapon: Pistol
C2:
Inherits: ^Infantry
Selectable:
Voice: CivilianFemaleVoice
Bounds: 12,17,0,-9
Valued:
Cost: 70
Description: Technician
Unit:
Mobile:
Speed: 4
Health:
HP: 20
RevealsShroud:
Range: 2
AttackBase:
PrimaryWeapon: Pistol
C3:
Inherits: ^Infantry
Selectable:
Voice: CivilianMaleVoice
Bounds: 12,17,0,-9
Valued:
Cost: 70
Description: Technician
Unit:
Mobile:
Speed: 4
Health:
HP: 20
RevealsShroud:
Range: 2
AttackBase:
PrimaryWeapon: Pistol
C4:
Inherits: ^Infantry
Selectable:
Voice: CivilianFemaleVoice
Bounds: 12,17,0,-9
Valued:
Cost: 70
Description: Technician
Unit:
Mobile:
Speed: 4
Health:
HP: 20
RevealsShroud:
Range: 2
AttackBase:
PrimaryWeapon: Pistol
C5:
Inherits: ^Infantry
Selectable:
Voice: CivilianMaleVoice
Bounds: 12,17,0,-9
Valued:
Cost: 70
Description: Technician
Unit:
Mobile:
Speed: 4
Health:
HP: 20
RevealsShroud:
Range: 2
AttackBase:
PrimaryWeapon: Pistol
C6:
Inherits: ^Infantry
Selectable:
Voice: CivilianMaleVoice
Bounds: 12,17,0,-9
Valued:
Cost: 70
Description: Technician
Unit:
Mobile:
Speed: 4
Health:
HP: 20
RevealsShroud:
Range: 2
AttackBase:
PrimaryWeapon: Pistol
C7:
Inherits: ^Infantry
Selectable:
Voice: CivilianMaleVoice
Bounds: 12,17,0,-9
Valued:
Cost: 70
Description: Technician
Unit:
Mobile:
Speed: 4
Health:
HP: 20
RevealsShroud:
Range: 2
AttackBase:
PrimaryWeapon: Pistol
C8:
Inherits: ^Infantry
Selectable:
Voice: CivilianMaleVoice
Bounds: 12,17,0,-9
Valued:
Cost: 70
Description: Technician
Unit:
Mobile:
Speed: 4
Health:
HP: 20
RevealsShroud:
Range: 2
AttackBase:
PrimaryWeapon: Pistol
C9:
Inherits: ^Infantry
Selectable:
Voice: CivilianMaleVoice
Bounds: 12,17,0,-9
Valued:
Cost: 70
Description: Technician
Unit:
Mobile:
Speed: 4
Health:
HP: 20
RevealsShroud:
Range: 2
AttackBase:
PrimaryWeapon: Pistol
C10:
Inherits: ^Infantry
Selectable:
Voice: CivilianMaleVoice
Bounds: 12,17,0,-9
Valued:
Cost: 70
Description: Technician
Unit:
Mobile:
Speed: 4
Health:
HP: 20
RevealsShroud:
Range: 2
AttackBase:
PrimaryWeapon: Pistol

View File

@@ -4,14 +4,12 @@ GenericVoice:
Select: await1,ready,report1,yessir1
Move: ackno,affirm1,noprob,ritaway,roger,ugotit
Die: nuyell1.aud,nuyell3.aud,nuyell4.aud,nuyell5.aud
Lost: unitlost.aud
VehicleVoice:
SovietVariants: .v00,.v02
AlliedVariants: .v00,.v02
Select: vehic1,yessir1,report1,await1,unit1
Move: ackno,affirm1,movout1
Lost: unitlost.aud
CivilianMaleVoice:
Select: guyyeah1

View File

@@ -18,6 +18,8 @@
GainsExperience:
GivesExperience:
DrawLineToTarget:
ActorLostNotification:
Notification: unitlst1.aud
^Tank:
Category: Vehicle
@@ -39,6 +41,8 @@
GainsExperience:
GivesExperience:
DrawLineToTarget:
ActorLostNotification:
Notification: unitlst1.aud
^Infantry:
Category: Infantry
@@ -63,6 +67,8 @@
GainsExperience:
GivesExperience:
DrawLineToTarget:
ActorLostNotification:
Notification: unitlst1.aud
^Ship:
Category: Ship
@@ -79,6 +85,8 @@
GainsExperience:
GivesExperience:
DrawLineToTarget:
ActorLostNotification:
Notification: navylst1.aud
^Plane:
Category: Plane
@@ -91,6 +99,8 @@
GainsExperience:
GivesExperience:
DrawLineToTarget:
ActorLostNotification:
Notification: aunitl1.aud
^Building:
Category: Building
@@ -110,6 +120,7 @@
FrozenUnderFog:
CaptureNotification:
Notification: strucap1.aud
^Wall:
Category: Building
Building:

View File

@@ -6,81 +6,68 @@ GenericVoice:
Select: await1,ready,report1,yessir1
Move: ackno,affirm1,noprob,overout,ritaway,roger,ugotit
Die: dedman1.aud,dedman2.aud,dedman3.aud,dedman4.aud,dedman5.aud,dedman6.aud,dedman7.aud,dedman8.aud,dedman10.aud
Lost: unitlst1.aud
VehicleVoice:
SovietVariants: .r00,.r02
AlliedVariants: .v00,.v02
Select: vehic1,yessir1,report1,await1
Move: ackno,affirm1
Lost: unitlst1.aud
ShipVoice:
SovietVariants: .r00,.r02
AlliedVariants: .v00,.v02
Select: vehic1,yessir1,report1,await1
Move: ackno,affirm1
Lost: navylst1.aud
EngineerVoice:
Select: eengin1,eyessir1
Move: eaffirm1,emovout1
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
Lost: unitlst1.aud
MedicVoice:
Select: mrespon1,myessir1
Move: maffirm1,mmovout1
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
Lost: unitlst1.aud
TanyaVoice:
Select: yo1,yes1,yeah1
Move: rokroll1,onit1,cmon1
Attack: tuffguy1,bombit1,gotit1
Die: tandeth1
Lost: unitlst1.aud
DogVoice:
Select:
Move: dogy1
Attack: dogg5p,dogw3px
Die: dogw5,dogw6,dogw7
Lost: unitlst1.aud
SpyVoice:
Select: syessir1,scomnd1
Move: sonway1,sindeed1
Attack: sking1
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
Lost: unitlst1.aud
ThiefVoice:
Select: swhat1,syeah1
Move: saffirm1,smout1,sokay1
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
Lost: unitlst1.aud
CivilianMaleVoice:
Select: guyyeah1
Move: guyokay1
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
Lost: unitlst1.aud
CivilianFemaleVoice:
Select: girlyeah
Move: girlokay
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
Lost: unitlst1.aud
EinsteinVoice:
Select: einah1,einok1,einyes1
Move: einah1,einok1,einyes1
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
Lost: unitlst1.aud
ShokVoice:
Select: jchrge1,jjuice1,jjump1,jpower1
Move: jdance1,jyes1
Attack: jburn1,jcrisp1,jshock1,jlight1
Lost: unitlst1.aud