sub stays uncloaked for 2s; submarine/cloak traits merged, since they do the same thing
This commit is contained in:
@@ -292,7 +292,6 @@
|
|||||||
<Compile Include="Traits\World\ScreenShaker.cs" />
|
<Compile Include="Traits\World\ScreenShaker.cs" />
|
||||||
<Compile Include="Traits\LineBuild.cs" />
|
<Compile Include="Traits\LineBuild.cs" />
|
||||||
<Compile Include="Traits\World\Theater.cs" />
|
<Compile Include="Traits\World\Theater.cs" />
|
||||||
<Compile Include="Traits\Cloak.cs" />
|
|
||||||
<Compile Include="Widgets\WidgetLoader.cs" />
|
<Compile Include="Widgets\WidgetLoader.cs" />
|
||||||
<Compile Include="Widgets\ButtonWidget.cs" />
|
<Compile Include="Widgets\ButtonWidget.cs" />
|
||||||
<Compile Include="Widgets\Widget.cs" />
|
<Compile Include="Widgets\Widget.cs" />
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
|
||||||
* This file is part of OpenRA.
|
|
||||||
*
|
|
||||||
* OpenRA is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* OpenRA is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
|
||||||
{
|
|
||||||
class CloakInfo : ITraitInfo
|
|
||||||
{
|
|
||||||
public readonly float CloakDelay = 1.2f; // Seconds
|
|
||||||
public readonly string CloakSound = "appear1.aud";
|
|
||||||
public readonly string UncloakSound = "appear1.aud";
|
|
||||||
public object Create(Actor self) { return new Cloak(self); }
|
|
||||||
}
|
|
||||||
|
|
||||||
class Cloak : IRenderModifier, INotifyAttack, ITick
|
|
||||||
{
|
|
||||||
[Sync]
|
|
||||||
int remainingUncloakTime = 2; /* setup for initial cloak */
|
|
||||||
|
|
||||||
Actor self;
|
|
||||||
public Cloak(Actor self)
|
|
||||||
{
|
|
||||||
this.self = self;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Attacking(Actor self)
|
|
||||||
{
|
|
||||||
if (remainingUncloakTime <= 0)
|
|
||||||
OnCloak();
|
|
||||||
|
|
||||||
remainingUncloakTime = (int)(self.Info.Traits.Get<CloakInfo>().CloakDelay * 25);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Renderable>
|
|
||||||
ModifyRender(Actor self, IEnumerable<Renderable> rs)
|
|
||||||
{
|
|
||||||
if (remainingUncloakTime > 0)
|
|
||||||
return rs;
|
|
||||||
|
|
||||||
if (self.Owner == self.World.LocalPlayer)
|
|
||||||
return rs.Select(a => a.WithPalette("shadow"));
|
|
||||||
else
|
|
||||||
return new Renderable[] { };
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Tick(Actor self)
|
|
||||||
{
|
|
||||||
if (remainingUncloakTime > 0)
|
|
||||||
if (--remainingUncloakTime <= 0)
|
|
||||||
OnUncloak();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnCloak()
|
|
||||||
{
|
|
||||||
Sound.Play(self.Info.Traits.Get<CloakInfo>().CloakSound, self.CenterLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnUncloak()
|
|
||||||
{
|
|
||||||
Sound.Play(self.Info.Traits.Get<CloakInfo>().UncloakSound, self.CenterLocation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,31 +23,33 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
class SubmarineInfo : ITraitInfo
|
class CloakInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly float SubmergeDelay = 1.2f; // Seconds
|
public readonly float InitialDelay = .4f; // seconds
|
||||||
public readonly string SubmergeSound = "subshow1.aud";
|
public readonly float CloakDelay = 1.2f; // Seconds
|
||||||
public readonly string SurfaceSound = "subshow1.aud";
|
public readonly string CloakSound = "subshow1.aud";
|
||||||
public object Create(Actor self) { return new Submarine(self); }
|
public readonly string UncloakSound = "subshow1.aud";
|
||||||
|
public object Create(Actor self) { return new Cloak(self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Submarine : IRenderModifier, INotifyAttack, ITick, INotifyDamage
|
class Cloak : IRenderModifier, INotifyAttack, ITick, INotifyDamage
|
||||||
{
|
{
|
||||||
[Sync]
|
[Sync]
|
||||||
int remainingSurfaceTime = 2; /* setup for initial dive */
|
int remainingTime;
|
||||||
|
|
||||||
Actor self;
|
Actor self;
|
||||||
public Submarine(Actor self)
|
public Cloak(Actor self)
|
||||||
{
|
{
|
||||||
|
remainingTime = (int)(self.Info.Traits.Get<CloakInfo>().InitialDelay * 25);
|
||||||
this.self = self;
|
this.self = self;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoSurface()
|
void DoSurface()
|
||||||
{
|
{
|
||||||
if (remainingSurfaceTime <= 0)
|
if (remainingTime <= 0)
|
||||||
OnSurface();
|
OnSurface();
|
||||||
|
|
||||||
remainingSurfaceTime = (int)(self.Info.Traits.Get<SubmarineInfo>().SubmergeDelay * 25);
|
remainingTime = (int)(self.Info.Traits.Get<CloakInfo>().CloakDelay * 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attacking(Actor self) { DoSurface(); }
|
public void Attacking(Actor self) { DoSurface(); }
|
||||||
@@ -56,7 +58,7 @@ namespace OpenRA.Traits
|
|||||||
public IEnumerable<Renderable>
|
public IEnumerable<Renderable>
|
||||||
ModifyRender(Actor self, IEnumerable<Renderable> rs)
|
ModifyRender(Actor self, IEnumerable<Renderable> rs)
|
||||||
{
|
{
|
||||||
if (remainingSurfaceTime > 0)
|
if (remainingTime > 0)
|
||||||
return rs;
|
return rs;
|
||||||
|
|
||||||
if (self.Owner == self.World.LocalPlayer)
|
if (self.Owner == self.World.LocalPlayer)
|
||||||
@@ -67,19 +69,21 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (remainingSurfaceTime > 0)
|
if (remainingTime > 0)
|
||||||
if (--remainingSurfaceTime <= 0)
|
if (--remainingTime <= 0)
|
||||||
OnDive();
|
OnDive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSurface()
|
void OnSurface()
|
||||||
{
|
{
|
||||||
Sound.Play(self.Info.Traits.Get<SubmarineInfo>().SurfaceSound, self.CenterLocation);
|
Sound.Play(self.Info.Traits.Get<CloakInfo>().UncloakSound, self.CenterLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDive()
|
void OnDive()
|
||||||
{
|
{
|
||||||
Sound.Play(self.Info.Traits.Get<SubmarineInfo>().SubmergeSound, self.CenterLocation);
|
Sound.Play(self.Info.Traits.Get<CloakInfo>().CloakSound, self.CenterLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Cloaked { get { return remainingTime > 0; } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,11 @@ MSUB:
|
|||||||
PrimaryWeapon: SubSCUD
|
PrimaryWeapon: SubSCUD
|
||||||
FireDelay: 2
|
FireDelay: 2
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
Submarine:
|
Cloak:
|
||||||
|
InitialDelay: .4
|
||||||
|
CloakDelay: 2.0
|
||||||
|
CloakSound: subshow1.aud
|
||||||
|
UncloakSound: subshow1.aud
|
||||||
Chronoshiftable:
|
Chronoshiftable:
|
||||||
|
|
||||||
SHOK:
|
SHOK:
|
||||||
|
|||||||
@@ -375,6 +375,10 @@ STNK:
|
|||||||
Sight: 4
|
Sight: 4
|
||||||
Speed: 15
|
Speed: 15
|
||||||
Cloak:
|
Cloak:
|
||||||
|
InitialDelay: .4
|
||||||
|
CloakDelay: 2.0
|
||||||
|
CloakSound: appear1.aud
|
||||||
|
UncloakSound: appear1.aud
|
||||||
Mobile:
|
Mobile:
|
||||||
MovementType: Track
|
MovementType: Track
|
||||||
AttackBase:
|
AttackBase:
|
||||||
|
|||||||
@@ -392,7 +392,11 @@ SS:
|
|||||||
WaterBound: yes
|
WaterBound: yes
|
||||||
TargetType: Sub
|
TargetType: Sub
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
Submarine:
|
Cloak:
|
||||||
|
InitialDelay: .4
|
||||||
|
CloakDelay: 2.0
|
||||||
|
CloakSound: subshow1.aud
|
||||||
|
UncloakSound: subshow1.aud
|
||||||
AttackBase:
|
AttackBase:
|
||||||
PrimaryWeapon: TorpTube
|
PrimaryWeapon: TorpTube
|
||||||
FireDelay: 2
|
FireDelay: 2
|
||||||
|
|||||||
Reference in New Issue
Block a user