Add WormAttack notification, fix worm min count and spawn interval

Enhance usage of WormManager Minimum and Maximum properties, add escape radius to AttackSwallow
This commit is contained in:
penev92
2014-12-03 06:29:49 +02:00
parent b4d1a605da
commit f57625f9e6
8 changed files with 89 additions and 54 deletions

View File

@@ -14,7 +14,6 @@ using System.Drawing;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Move;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
@@ -39,6 +38,7 @@ namespace OpenRA.Mods.RA
public IEnumerable<Armament> Armaments { get { return GetArmaments(); } }
protected Lazy<IFacing> facing;
protected Lazy<Building> building;
protected Lazy<IPositionable> positionable;
protected Func<IEnumerable<Armament>> GetArmaments;
readonly Actor self;
@@ -56,6 +56,7 @@ namespace OpenRA.Mods.RA
facing = Exts.Lazy(() => self.TraitOrDefault<IFacing>());
building = Exts.Lazy(() => self.TraitOrDefault<Building>());
positionable = Exts.Lazy(() => self.Trait<IPositionable>());
}
protected virtual bool CanAttack(Actor self, Target target)
@@ -146,8 +147,7 @@ namespace OpenRA.Mods.RA
{
if (Info.AttackRequiresEnteringCell)
{
var positionable = self.TraitOrDefault<IPositionable>();
if (positionable == null || !positionable.CanEnterCell(t.Actor.Location, null, false))
if (!positionable.Value.CanEnterCell(t.Actor.Location, null, false))
return false;
}