From b08e1e9350019e9d254c7d8f49e39be718cf6e1d Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 20 Dec 2009 18:06:40 +1300 Subject: [PATCH] submarines are forced to the surface on damage --- OpenRa.Game/Traits/Submarine.cs | 19 +++++++++++-------- progress.txt | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/OpenRa.Game/Traits/Submarine.cs b/OpenRa.Game/Traits/Submarine.cs index f831b7acdb..421e4b605e 100644 --- a/OpenRa.Game/Traits/Submarine.cs +++ b/OpenRa.Game/Traits/Submarine.cs @@ -4,19 +4,22 @@ using OpenRa.Game.Graphics; namespace OpenRa.Game.Traits { - class Submarine : IRenderModifier, INotifyAttack, ITick + class Submarine : IRenderModifier, INotifyAttack, ITick, INotifyDamage { int remainingSurfaceTime = 2; /* setup for initial dive */ public Submarine(Actor self) { } - public void Attacking(Actor self) - { - if (remainingSurfaceTime <= 0) - OnSurface(); + void DoSurface() + { + if (remainingSurfaceTime <= 0) + OnSurface(); - remainingSurfaceTime = (int)(Rules.General.SubmergeDelay * 60 * 25); - } + remainingSurfaceTime = (int)(Rules.General.SubmergeDelay * 60 * 25); + } + + public void Attacking(Actor self) { DoSurface(); } + public void Damaged(Actor self, AttackInfo e) { DoSurface(); } public IEnumerable> ModifyRender(Actor self, IEnumerable> rs) @@ -46,5 +49,5 @@ namespace OpenRa.Game.Traits { Sound.Play("subshow1.aud"); /* is this the right sound?? */ } - } + } } diff --git a/progress.txt b/progress.txt index 1d8f7009bc..ae4fc3f186 100644 --- a/progress.txt +++ b/progress.txt @@ -42,7 +42,7 @@ Planes Ships CA Works -SS Doesn't surface on damage +SS Works DD AA weapon doesn't work, depth charges don't work PT depth charges don't work LST Cargo doesn't work