Moves BlocksBullets, DeathSounds, ActorLostNotification, AnnounceOnBuild and AnnounceOnKill to Mods.Common
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 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 COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class ActorLostNotificationInfo : ITraitInfo
|
||||
{
|
||||
public readonly string Notification = "UnitLost";
|
||||
public readonly bool NotifyAll = false;
|
||||
|
||||
public object Create(ActorInitializer init) { return new ActorLostNotification(this); }
|
||||
}
|
||||
|
||||
class ActorLostNotification : INotifyKilled
|
||||
{
|
||||
ActorLostNotificationInfo info;
|
||||
public ActorLostNotification(ActorLostNotificationInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public void Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
var player = (info.NotifyAll) ? self.World.LocalPlayer : self.Owner;
|
||||
Sound.PlayNotification(self.World.Map.Rules, player, "Speech", info.Notification, self.Owner.Country.Race);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 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 COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Play the Build voice of this actor when trained.")]
|
||||
public class AnnounceOnBuildInfo : TraitInfo<AnnounceOnBuild> { }
|
||||
|
||||
public class AnnounceOnBuild : INotifyBuildComplete
|
||||
{
|
||||
public void BuildingComplete(Actor self)
|
||||
{
|
||||
Sound.PlayVoice("Build", self, self.Owner.Country.Race);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 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 COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[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 && 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 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 COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
//TODO: Add functionality like a customizable Height that is compared to projectile altitude
|
||||
[Desc("This actor blocks bullets and missiles without 'High' property.")]
|
||||
public class BlocksBulletsInfo : TraitInfo<BlocksBullets> { }
|
||||
public class BlocksBullets : IBlocksBullets { }
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 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 COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Sounds to play when killed.")]
|
||||
public class DeathSoundsInfo : ITraitInfo
|
||||
{
|
||||
[Desc("Death notification voice.")]
|
||||
public readonly string DeathSound = "Die";
|
||||
|
||||
[Desc("Multiply volume with this factor.")]
|
||||
public readonly float VolumeMultiplier = 1f;
|
||||
|
||||
[Desc("DeathTypes that this should be used for. If empty, this will be used as the default sound.")]
|
||||
public readonly string[] DeathTypes = { };
|
||||
|
||||
public object Create(ActorInitializer init) { return new DeathSounds(this); }
|
||||
}
|
||||
|
||||
public class DeathSounds : INotifyKilled
|
||||
{
|
||||
DeathSoundsInfo info;
|
||||
|
||||
public DeathSounds(DeathSoundsInfo info) { this.info = info; }
|
||||
|
||||
public void Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
// Killed by some non-standard means
|
||||
if (e.Warhead == null)
|
||||
return;
|
||||
|
||||
var cp = self.CenterPosition;
|
||||
|
||||
if (info.DeathTypes.Contains(e.Warhead.DeathType) || (!info.DeathTypes.Any() && !self.Info.Traits.WithInterface<DeathSoundsInfo>().Any(dsi => dsi.DeathTypes.Contains(e.Warhead.DeathType))))
|
||||
Sound.PlayVoiceLocal(info.DeathSound, self, self.Owner.Country.Race, cp, info.VolumeMultiplier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,6 @@
|
||||
<Compile Include="Activities\UnloadCargo.cs" />
|
||||
<Compile Include="Activities\Wait.cs" />
|
||||
<Compile Include="ActorExts.cs" />
|
||||
<Compile Include="ActorLostNotification.cs" />
|
||||
<Compile Include="Air\Aircraft.cs" />
|
||||
<Compile Include="Air\AttackHeli.cs" />
|
||||
<Compile Include="Air\AttackPlane.cs" />
|
||||
@@ -147,8 +146,6 @@
|
||||
<Compile Include="Air\TargetableAircraft.cs" />
|
||||
<Compile Include="AI\RushFuzzy.cs" />
|
||||
<Compile Include="AI\StateMachine.cs" />
|
||||
<Compile Include="AnnounceOnBuild.cs" />
|
||||
<Compile Include="AnnounceOnKill.cs" />
|
||||
<Compile Include="AppearsOnRadar.cs" />
|
||||
<Compile Include="AttackMove.cs" />
|
||||
<Compile Include="Attack\AttackBase.cs" />
|
||||
@@ -182,7 +179,6 @@
|
||||
<Compile Include="Buildings\ShakeOnDeath.cs" />
|
||||
<Compile Include="Buildings\SoundOnDamageTransition.cs" />
|
||||
<Compile Include="Buildings\Util.cs" />
|
||||
<Compile Include="BlocksBullets.cs" />
|
||||
<Compile Include="Burns.cs" />
|
||||
<Compile Include="C4Demolition.cs" />
|
||||
<Compile Include="ExternalCapturable.cs" />
|
||||
@@ -209,7 +205,6 @@
|
||||
<Compile Include="Crates\SupportPowerCrateAction.cs" />
|
||||
<Compile Include="CreateMPPlayers.cs" />
|
||||
<Compile Include="Crushable.cs" />
|
||||
<Compile Include="DeathSounds.cs" />
|
||||
<Compile Include="DemoTruck.cs" />
|
||||
<Compile Include="DetectCloaked.cs" />
|
||||
<Compile Include="Effects\GpsDot.cs" />
|
||||
@@ -567,4 +562,4 @@ copy "FuzzyLogicLibrary.dll" "$(SolutionDir)"
|
||||
cd "$(SolutionDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup />
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user