Add an INotifyKilled interface, which is what most things that used INotifyDamaged actually cared about.
This commit is contained in:
@@ -108,6 +108,10 @@ namespace OpenRA.Traits
|
|||||||
attacker.Owner.Kills++;
|
attacker.Owner.Kills++;
|
||||||
self.Owner.Deaths++;
|
self.Owner.Deaths++;
|
||||||
|
|
||||||
|
foreach (var nd in self.TraitsImplementing<INotifyKilled>()
|
||||||
|
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyKilled>()))
|
||||||
|
nd.Killed(self, ai);
|
||||||
|
|
||||||
if( RemoveOnDeath )
|
if( RemoveOnDeath )
|
||||||
self.Destroy();
|
self.Destroy();
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ namespace OpenRA.Traits
|
|||||||
public interface IOrderVoice { string VoicePhraseForOrder(Actor self, Order order); }
|
public interface IOrderVoice { string VoicePhraseForOrder(Actor self, Order order); }
|
||||||
public interface INotifySold { void Selling(Actor self); void Sold(Actor self); }
|
public interface INotifySold { void Selling(Actor self); void Sold(Actor self); }
|
||||||
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
||||||
|
public interface INotifyKilled { void Killed(Actor self, AttackInfo e); }
|
||||||
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
|
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
|
||||||
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
||||||
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, int2 exit); }
|
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, int2 exit); }
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
public object Create(ActorInitializer init) { return new DeadBuildingState(init.self, this); }
|
public object Create(ActorInitializer init) { return new DeadBuildingState(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeadBuildingState : INotifyDamage
|
class DeadBuildingState : INotifyKilled
|
||||||
{
|
{
|
||||||
DeadBuildingStateInfo info;
|
DeadBuildingStateInfo info;
|
||||||
RenderSimple rs;
|
RenderSimple rs;
|
||||||
@@ -31,9 +31,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
self.Trait<Health>().RemoveOnDeath = !rs.anim.HasSequence("dead");
|
self.Trait<Health>().RemoveOnDeath = !rs.anim.HasSequence("dead");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
|
||||||
if (e.DamageStateChanged && e.DamageState == DamageState.Dead)
|
|
||||||
{
|
{
|
||||||
if (!rs.anim.HasSequence("dead")) return;
|
if (!rs.anim.HasSequence("dead")) return;
|
||||||
rs.anim.PlayRepeating("dead");
|
rs.anim.PlayRepeating("dead");
|
||||||
@@ -44,5 +42,4 @@ namespace OpenRA.Mods.Cnc
|
|||||||
() => self.Destroy())));
|
() => self.Destroy())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
public object Create(ActorInitializer init) { return new SpawnViceroid(this); }
|
public object Create(ActorInitializer init) { return new SpawnViceroid(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpawnViceroid : INotifyDamage
|
class SpawnViceroid : INotifyKilled
|
||||||
{
|
{
|
||||||
readonly SpawnViceroidInfo Info;
|
readonly SpawnViceroidInfo Info;
|
||||||
|
|
||||||
@@ -34,9 +34,9 @@ namespace OpenRA.Mods.Cnc
|
|||||||
Info = info;
|
Info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (e.DamageState == DamageState.Dead && e.Warhead != null && e.Warhead.InfDeath == Info.InfDeath
|
if (e.Warhead != null && e.Warhead.InfDeath == Info.InfDeath
|
||||||
&& self.World.SharedRandom.Next(100) <= Info.Probability)
|
&& self.World.SharedRandom.Next(100) <= Info.Probability)
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public object Create(ActorInitializer init) { return new ActorLostNotification(this); }
|
public object Create(ActorInitializer init) { return new ActorLostNotification(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ActorLostNotification : INotifyDamage
|
class ActorLostNotification : INotifyKilled
|
||||||
{
|
{
|
||||||
ActorLostNotificationInfo Info;
|
ActorLostNotificationInfo Info;
|
||||||
public ActorLostNotification(ActorLostNotificationInfo info)
|
public ActorLostNotification(ActorLostNotificationInfo info)
|
||||||
@@ -28,15 +28,11 @@ namespace OpenRA.Mods.RA
|
|||||||
Info = info;
|
Info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
|
||||||
if (e.DamageState == DamageState.Dead)
|
|
||||||
{
|
{
|
||||||
var player = (Info.NotifyAll) ? self.World.LocalPlayer : self.Owner;
|
var player = (Info.NotifyAll) ? self.World.LocalPlayer : self.Owner;
|
||||||
Sound.PlayToPlayer(player, Info.Notification);
|
Sound.PlayToPlayer(player, Info.Notification);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
public virtual object Create( ActorInitializer init ) { return new Aircraft( init , this ); }
|
public virtual object Create( ActorInitializer init ) { return new Aircraft( init , this ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Aircraft : IMove, IFacing, IOccupySpace, ISync, INotifyDamage
|
public class Aircraft : IMove, IFacing, IOccupySpace, ISync, INotifyKilled
|
||||||
{
|
{
|
||||||
public IDisposable reservation;
|
public IDisposable reservation;
|
||||||
|
|
||||||
@@ -88,9 +88,8 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (e.DamageState == DamageState.Dead)
|
|
||||||
UnReserve();
|
UnReserve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,37 +21,28 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string ChuteSound = "chute1.aud";
|
public readonly string ChuteSound = "chute1.aud";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EjectOnDeath : INotifyDamage
|
public class EjectOnDeath : INotifyKilled
|
||||||
{
|
{
|
||||||
|
public void Killed(Actor self, AttackInfo e)
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
|
||||||
{
|
{
|
||||||
if (self.IsDead())
|
|
||||||
{
|
|
||||||
var a = self;
|
|
||||||
var info = self.Info.Traits.Get<EjectOnDeathInfo>();
|
var info = self.Info.Traits.Get<EjectOnDeathInfo>();
|
||||||
var pilot = a.World.CreateActor(false, info.PilotActor.ToLowerInvariant(), new TypeDictionary { new OwnerInit(a.Owner) });
|
var pilot = self.World.CreateActor(false, info.PilotActor.ToLowerInvariant(), new TypeDictionary { new OwnerInit(self.Owner) });
|
||||||
var r = self.World.SharedRandom.Next(1, 100);
|
var r = self.World.SharedRandom.Next(1, 100);
|
||||||
var aircraft = a.Trait<IMove>();
|
var aircraft = self.Trait<IMove>();
|
||||||
|
|
||||||
if (IsSuitableCell(pilot, a.Location) && r > 100 - info.SuccessRate && aircraft.Altitude > 10)
|
if (IsSuitableCell(pilot, self.Location) && r > 100 - info.SuccessRate && aircraft.Altitude > 10)
|
||||||
{
|
{
|
||||||
var rs = pilot.Trait<RenderSimple>();
|
var rs = pilot.Trait<RenderSimple>();
|
||||||
|
self.World.AddFrameEndTask(w => w.Add(
|
||||||
|
|
||||||
a.World.AddFrameEndTask(w => w.Add(
|
|
||||||
new Parachute(pilot.Owner, rs.anim.Name,
|
new Parachute(pilot.Owner, rs.anim.Name,
|
||||||
Util.CenterOfCell(Util.CellContaining(a.CenterLocation)),
|
Util.CenterOfCell(Util.CellContaining(self.CenterLocation)),
|
||||||
aircraft.Altitude, pilot)));
|
aircraft.Altitude, pilot)));
|
||||||
|
|
||||||
Sound.Play(info.ChuteSound, a.CenterLocation);
|
Sound.Play(info.ChuteSound, self.CenterLocation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
pilot.Destroy();
|
pilot.Destroy();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsSuitableCell(Actor actorToDrop, int2 p)
|
bool IsSuitableCell(Actor actorToDrop, int2 p)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,11 +23,9 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
public readonly bool Moves = false;
|
public readonly bool Moves = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FallsToEarth : INotifyDamage
|
class FallsToEarth : INotifyKilled
|
||||||
{
|
{
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
|
||||||
if (self.IsDead())
|
|
||||||
{
|
{
|
||||||
self.Trait<Health>().RemoveOnDeath = false;
|
self.Trait<Health>().RemoveOnDeath = false;
|
||||||
|
|
||||||
@@ -35,7 +33,6 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
self.QueueActivity(new FallToEarth(self, self.Info.Traits.Get<FallsToEarthInfo>()));
|
self.QueueActivity(new FallToEarth(self, self.Info.Traits.Get<FallsToEarthInfo>()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
class FallToEarth : CancelableActivity
|
class FallToEarth : CancelableActivity
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
public override object Create( ActorInitializer init ) { return new Plane( init, this ); }
|
public override object Create( ActorInitializer init ) { return new Plane( init, this ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Plane : Aircraft, IIssueOrder, IResolveOrder, IOrderVoice, ITick, INotifyDamage, ISync
|
public class Plane : Aircraft, IIssueOrder, IResolveOrder, IOrderVoice, ITick, ISync
|
||||||
{
|
{
|
||||||
[Sync]
|
[Sync]
|
||||||
public int2 RTBPathHash;
|
public int2 RTBPathHash;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
public object Create(ActorInitializer init) { return new ShakeOnDeath(this); }
|
public object Create(ActorInitializer init) { return new ShakeOnDeath(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ShakeOnDeath : INotifyDamage
|
public class ShakeOnDeath : INotifyKilled
|
||||||
{
|
{
|
||||||
readonly ShakeOnDeathInfo Info;
|
readonly ShakeOnDeathInfo Info;
|
||||||
public ShakeOnDeath(ShakeOnDeathInfo info)
|
public ShakeOnDeath(ShakeOnDeathInfo info)
|
||||||
@@ -29,9 +29,8 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
this.Info = info;
|
this.Info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (e.DamageState == DamageState.Dead)
|
|
||||||
self.World.WorldActor.Trait<ScreenShaker>().AddEffect(Info.Intensity, self.CenterLocation, 1);
|
self.World.WorldActor.Trait<ScreenShaker>().AddEffect(Info.Intensity, self.CenterLocation, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public object Create( ActorInitializer init ) { return new Cargo( init.self ); }
|
public object Create( ActorInitializer init ) { return new Cargo( init.self ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Cargo : IPips, IIssueOrder, IResolveOrder, IOrderVoice, INotifyDamage
|
public class Cargo : IPips, IIssueOrder, IResolveOrder, IOrderVoice, INotifyKilled
|
||||||
{
|
{
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
List<Actor> cargo = new List<Actor>();
|
List<Actor> cargo = new List<Actor>();
|
||||||
@@ -145,14 +145,11 @@ namespace OpenRA.Mods.RA
|
|||||||
cargo.Add(a);
|
cargo.Add(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
|
||||||
if( e.DamageStateChanged && e.DamageState == DamageState.Dead )
|
|
||||||
{
|
{
|
||||||
foreach( var c in cargo )
|
foreach( var c in cargo )
|
||||||
c.Destroy();
|
c.Destroy();
|
||||||
cargo.Clear();
|
cargo.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class DemoTruckInfo : TraitInfo<DemoTruck> { }
|
class DemoTruckInfo : TraitInfo<DemoTruck> { }
|
||||||
|
|
||||||
class DemoTruck : Chronoshiftable, INotifyDamage
|
class DemoTruck : Chronoshiftable, INotifyKilled
|
||||||
{
|
{
|
||||||
// Explode on chronoshift
|
// Explode on chronoshift
|
||||||
public override bool Teleport(Actor self, int2 targetLocation, int duration, bool killCargo, Actor chronosphere)
|
public override bool Teleport(Actor self, int2 targetLocation, int duration, bool killCargo, Actor chronosphere)
|
||||||
@@ -24,9 +24,8 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fire primary on death
|
// Fire primary on death
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (e.DamageState == DamageState.Dead)
|
|
||||||
Detonate(self, e.Attacker);
|
Detonate(self, e.Attacker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string[] ActorTypes = { "e1" };
|
public readonly string[] ActorTypes = { "e1" };
|
||||||
}
|
}
|
||||||
|
|
||||||
class EmitInfantryOnSell : INotifySold, INotifyDamage
|
class EmitInfantryOnSell : INotifySold, INotifyKilled
|
||||||
{
|
{
|
||||||
public void Selling(Actor self) { }
|
public void Selling(Actor self) { }
|
||||||
|
|
||||||
@@ -62,9 +62,8 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public void Sold(Actor self) { Emit(self); }
|
public void Sold(Actor self) { Emit(self); }
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (e.DamageStateChanged && e.DamageState == DamageState.Dead)
|
|
||||||
Emit(self);
|
Emit(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,9 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int Chance = 100;
|
public readonly int Chance = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Explodes : INotifyDamage
|
class Explodes : INotifyKilled
|
||||||
{
|
{
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
|
||||||
if (e.DamageState == DamageState.Dead)
|
|
||||||
{
|
{
|
||||||
if (self.World.SharedRandom.Next(100) > self.Info.Traits.Get<ExplodesInfo>().Chance)
|
if (self.World.SharedRandom.Next(100) > self.Info.Traits.Get<ExplodesInfo>().Chance)
|
||||||
return;
|
return;
|
||||||
@@ -40,7 +38,6 @@ namespace OpenRA.Mods.RA
|
|||||||
Combat.DoExplosion(e.Attacker, weapon, self.CenterLocation, altitude);
|
Combat.DoExplosion(e.Attacker, weapon, self.CenterLocation, altitude);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
string ChooseWeaponForExplosion(Actor self)
|
string ChooseWeaponForExplosion(Actor self)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int LevelMod = 125;
|
public readonly int LevelMod = 125;
|
||||||
}
|
}
|
||||||
|
|
||||||
class GivesBounty : INotifyDamage
|
class GivesBounty : INotifyKilled
|
||||||
{
|
{
|
||||||
|
|
||||||
int GetMultiplier(Actor self)
|
int GetMultiplier(Actor self)
|
||||||
@@ -34,9 +34,7 @@ namespace OpenRA.Mods.RA
|
|||||||
return (slevel > 0) ? slevel * info.LevelMod : 100;
|
return (slevel > 0) ? slevel * info.LevelMod : 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
|
||||||
if (e.DamageState == DamageState.Dead)
|
|
||||||
{
|
{
|
||||||
var info = self.Info.Traits.Get<GivesBountyInfo>();
|
var info = self.Info.Traits.Get<GivesBountyInfo>();
|
||||||
// Prevent TK from giving Bounty
|
// Prevent TK from giving Bounty
|
||||||
@@ -46,14 +44,12 @@ namespace OpenRA.Mods.RA
|
|||||||
var valued = self.Info.Traits.GetOrDefault<ValuedInfo>();
|
var valued = self.Info.Traits.GetOrDefault<ValuedInfo>();
|
||||||
var cost = valued != null ? valued.Cost : 0;
|
var cost = valued != null ? valued.Cost : 0;
|
||||||
// 2 hundreds because of GetMultiplier and info.Percentage.
|
// 2 hundreds because of GetMultiplier and info.Percentage.
|
||||||
var bounty = (int)(cost * GetMultiplier(self) * info.Percentage / 10000);
|
var bounty = cost * GetMultiplier(self) * info.Percentage / 10000;
|
||||||
|
|
||||||
if (e.Attacker.World.LocalPlayer != null && e.Attacker.Owner.Stances[e.Attacker.World.LocalPlayer] == Stance.Ally)
|
if (e.Attacker.World.LocalPlayer != null && e.Attacker.Owner.Stances[e.Attacker.World.LocalPlayer] == Stance.Ally)
|
||||||
e.Attacker.World.AddFrameEndTask(w => w.Add(new CashTick(bounty, 20, 1, self.CenterLocation, e.Attacker.Owner.ColorRamp.GetColor(0))));
|
e.Attacker.World.AddFrameEndTask(w => w.Add(new CashTick(bounty, 20, 1, self.CenterLocation, e.Attacker.Owner.ColorRamp.GetColor(0))));
|
||||||
|
|
||||||
e.Attacker.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(bounty);
|
e.Attacker.Owner.PlayerActor.Trait<PlayerResources>().GiveCash(bounty);
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,9 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class GivesExperienceInfo : TraitInfo<GivesExperience> { public readonly int Experience = -1; }
|
class GivesExperienceInfo : TraitInfo<GivesExperience> { public readonly int Experience = -1; }
|
||||||
|
|
||||||
class GivesExperience : INotifyDamage
|
class GivesExperience : INotifyKilled
|
||||||
{
|
{
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
|
||||||
if (e.DamageState == DamageState.Dead)
|
|
||||||
{
|
{
|
||||||
// Prevent TK from giving exp
|
// Prevent TK from giving exp
|
||||||
if (e.Attacker == null || e.Attacker.Destroyed || e.Attacker.Owner.Stances[ self.Owner ] == Stance.Ally )
|
if (e.Attacker == null || e.Attacker.Destroyed || e.Attacker.Owner.Stances[ self.Owner ] == Stance.Ally )
|
||||||
@@ -36,5 +34,4 @@ namespace OpenRA.Mods.RA
|
|||||||
killer.GiveExperience(exp);
|
killer.GiveExperience(exp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,10 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string HuskActor = null;
|
public readonly string HuskActor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
class LeavesHusk : INotifyDamage
|
class LeavesHusk : INotifyKilled
|
||||||
{
|
{
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (e.DamageState == DamageState.Dead)
|
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
var info = self.Info.Traits.Get<LeavesHuskInfo>();
|
var info = self.Info.Traits.Get<LeavesHuskInfo>();
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public virtual object Create(ActorInitializer init) { return new OreRefinery(init.self, this); }
|
public virtual object Create(ActorInitializer init) { return new OreRefinery(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OreRefinery : ITick, IAcceptOre, INotifyDamage, INotifySold, INotifyCapture, IExplodeModifier, ISync
|
public class OreRefinery : ITick, IAcceptOre, INotifyKilled, INotifySold, INotifyCapture, IExplodeModifier, ISync
|
||||||
{
|
{
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
readonly OreRefineryInfo Info;
|
readonly OreRefineryInfo Info;
|
||||||
@@ -110,15 +110,12 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged (Actor self, AttackInfo e)
|
public void Killed (Actor self, AttackInfo e)
|
||||||
{
|
|
||||||
if (e.DamageState == DamageState.Dead)
|
|
||||||
{
|
{
|
||||||
CancelDock(self);
|
CancelDock(self);
|
||||||
foreach (var harv in GetLinkedHarvesters())
|
foreach (var harv in GetLinkedHarvesters())
|
||||||
harv.Trait.UnlinkProc(harv.Actor, self);
|
harv.Trait.UnlinkProc(harv.Actor, self);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void OnDock (Actor harv, DeliverResources dockOrder)
|
public void OnDock (Actor harv, DeliverResources dockOrder)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
public override object Create(ActorInitializer init) { return new RenderInfantry(init.self, this); }
|
public override object Create(ActorInitializer init) { return new RenderInfantry(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RenderInfantry : RenderSimple, INotifyAttack, INotifyDamage, INotifyIdle
|
public class RenderInfantry : RenderSimple, INotifyAttack, INotifyKilled, INotifyIdle
|
||||||
{
|
{
|
||||||
public enum AnimationState
|
public enum AnimationState
|
||||||
{
|
{
|
||||||
@@ -117,14 +117,11 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
|
||||||
if (e.DamageState == DamageState.Dead)
|
|
||||||
{
|
{
|
||||||
var death = e.Warhead != null ? e.Warhead.InfDeath : 0;
|
var death = e.Warhead != null ? e.Warhead.InfDeath : 0;
|
||||||
Sound.PlayVoice("Die", self, self.Owner.Country.Race);
|
Sound.PlayVoice("Die", self, self.Owner.Country.Race);
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Corpse(self, death)));
|
self.World.AddFrameEndTask(w => w.Add(new Corpse(self, death)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class ReservableInfo : TraitInfo<Reservable> {}
|
class ReservableInfo : TraitInfo<Reservable> {}
|
||||||
|
|
||||||
public class Reservable : ITick, INotifyDamage, INotifyCapture, INotifySold
|
public class Reservable : ITick, INotifyKilled, INotifyCapture, INotifySold
|
||||||
{
|
{
|
||||||
Actor reservedFor;
|
Actor reservedFor;
|
||||||
Aircraft herp;
|
Aircraft herp;
|
||||||
@@ -52,9 +52,9 @@ namespace OpenRA.Mods.RA
|
|||||||
return res != null && res.reservedFor != null;
|
return res != null && res.reservedFor != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (herp != null && e.DamageStateChanged && e.DamageState == DamageState.Dead)
|
if (herp != null)
|
||||||
herp.UnReserve();
|
herp.UnReserve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public object Create(ActorInitializer init) { return new StoresOre(init.self, this); }
|
public object Create(ActorInitializer init) { return new StoresOre(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class StoresOre : IPips, INotifyCapture, INotifyDamage, IExplodeModifier, IStoreOre, ISync
|
class StoresOre : IPips, INotifyCapture, INotifyKilled, IExplodeModifier, IStoreOre, ISync
|
||||||
{
|
{
|
||||||
readonly StoresOreInfo Info;
|
readonly StoresOreInfo Info;
|
||||||
|
|
||||||
@@ -45,9 +45,8 @@ namespace OpenRA.Mods.RA
|
|||||||
Player.GiveOre(ore);
|
Player.GiveOre(ore);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (self.IsDead())
|
|
||||||
Player.TakeOre(Stored); // Lose the stored ore
|
Player.TakeOre(Stored); // Lose the stored ore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public override object Create(ActorInitializer init) { return new GpsPower(init.self, this); }
|
public override object Create(ActorInitializer init) { return new GpsPower(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class GpsPower : SupportPower, INotifyDamage, ISync, INotifyStanceChanged, INotifySold
|
class GpsPower : SupportPower, INotifyKilled, ISync, INotifyStanceChanged, INotifySold
|
||||||
{
|
{
|
||||||
public GpsPower(Actor self, GpsPowerInfo info) : base(self, info) { }
|
public GpsPower(Actor self, GpsPowerInfo info) : base(self, info) { }
|
||||||
|
|
||||||
@@ -48,20 +48,9 @@ namespace OpenRA.Mods.RA
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Selling(Actor self)
|
public void Selling(Actor self) { DisableGps(); }
|
||||||
{
|
|
||||||
DisableGps();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Sold(Actor self) { }
|
public void Sold(Actor self) { }
|
||||||
|
public void Killed(Actor self, AttackInfo e) { DisableGps(); }
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
|
||||||
{
|
|
||||||
if (e.DamageState == DamageState.Dead)
|
|
||||||
{
|
|
||||||
DisableGps();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisableGps()
|
void DisableGps()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user