Remove IExplodeModifier interface.

This commit is contained in:
Paul Chote
2018-11-17 09:13:28 +00:00
committed by Oliver Brakmann
parent 80842fd4b8
commit 807a40c209
12 changed files with 72 additions and 11 deletions

View File

@@ -127,7 +127,12 @@ namespace OpenRA.Mods.Common.Traits
WeaponInfo ChooseWeaponForExplosion(Actor self)
{
var shouldExplode = self.TraitsImplementing<IExplodeModifier>().All(a => a.ShouldExplode(self));
var armaments = self.TraitsImplementing<Armament>();
if (!armaments.Any())
return Info.WeaponInfo;
// TODO: EmptyWeapon should be removed in favour of conditions
var shouldExplode = !armaments.All(a => a.IsReloading);
var useFullExplosion = self.World.SharedRandom.Next(100) <= Info.LoadedChance;
return (shouldExplode && useFullExplosion) ? Info.WeaponInfo : Info.EmptyWeaponInfo;
}