Add target param to INotifyAttack. Remove target field from AttackOmni
This commit is contained in:
@@ -105,7 +105,7 @@ namespace OpenRA.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public interface INotifyAttack { void Attacking(Actor self); }
|
||||
public interface INotifyAttack { void Attacking(Actor self, Target target); }
|
||||
public interface IRenderModifier { IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r); }
|
||||
public interface IDamageModifier { float GetDamageModifier(Actor attacker, WarheadInfo warhead); }
|
||||
public interface ISpeedModifier { decimal GetSpeedModifier(); }
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
void LayMine(Actor self)
|
||||
{
|
||||
var limitedAmmo = self.TraitOrDefault<LimitedAmmo>();
|
||||
if (limitedAmmo != null) limitedAmmo.Attacking(self);
|
||||
if (limitedAmmo != null) limitedAmmo.Attacking(self, Target.FromCell(self.Location));
|
||||
|
||||
self.World.AddFrameEndTask(
|
||||
w => w.CreateActor(self.Info.Traits.Get<MinelayerInfo>().Mine, new TypeDictionary
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
this.target = target;
|
||||
initialLocation = self.Trait<Mobile>().PxPosition;
|
||||
|
||||
self.Trait<RenderInfantry>().Attacking(self);
|
||||
self.Trait<RenderInfantry>().Attacking(self, target);
|
||||
Sound.Play("dogg5p.aud", self.CenterLocation);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace OpenRA.Mods.RA
|
||||
class AttackOmni : AttackBase, INotifyBuildComplete
|
||||
{
|
||||
bool buildComplete = false;
|
||||
protected Target target;
|
||||
public void BuildingComplete(Actor self) { buildComplete = true; }
|
||||
|
||||
public AttackOmni(Actor self) : base(self) { }
|
||||
@@ -33,12 +32,6 @@ namespace OpenRA.Mods.RA
|
||||
return base.CanAttack( self, target ) && !isBuilding;
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
base.Tick(self);
|
||||
DoAttack(self, target);
|
||||
}
|
||||
|
||||
protected override IActivity GetAttackActivity(Actor self, Target newTarget, bool allowMove)
|
||||
{
|
||||
return new SetTarget( newTarget );
|
||||
@@ -54,7 +47,7 @@ namespace OpenRA.Mods.RA
|
||||
if( IsCanceled || !target.IsValid )
|
||||
return NextActivity;
|
||||
|
||||
self.Trait<AttackOmni>().target = target;
|
||||
self.Trait<AttackOmni>().DoAttack(self, target);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.RA
|
||||
return target.Actor == previousTarget ? 3 : base.FireDelay(self, target, info);
|
||||
}
|
||||
|
||||
public void Attacking(Actor self)
|
||||
public void Attacking(Actor self, Target target)
|
||||
{
|
||||
foreach (var w in Weapons)
|
||||
w.FireDelay = 8;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.RA
|
||||
remainingTime = Math.Max(remainingTime, (int)(info.CloakDelay * 25));
|
||||
}
|
||||
|
||||
public void Attacking(Actor self) { DoUncloak(); }
|
||||
public void Attacking(Actor self, Target target) { DoUncloak(); }
|
||||
public void Damaged(Actor self, AttackInfo e)
|
||||
{
|
||||
canCloak = (e.DamageState < DamageState.Critical);
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.RA
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Attacking(Actor self) { --ammo; }
|
||||
public void Attacking(Actor self, Target target) { --ammo; }
|
||||
|
||||
public IEnumerable<PipType> GetPips(Actor self)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
return takeCover != null && takeCover.IsProne;
|
||||
}
|
||||
|
||||
public void Attacking(Actor self)
|
||||
public void Attacking(Actor self, Target target)
|
||||
{
|
||||
inAttack = true;
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace OpenRA.Mods.RA
|
||||
});
|
||||
|
||||
foreach (var na in self.TraitsImplementing<INotifyAttack>())
|
||||
na.Attacking(self);
|
||||
na.Attacking(self, target);
|
||||
|
||||
FiredShot();
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
|
||||
public void Attacking(Actor self)
|
||||
public void Attacking(Actor self, Target target)
|
||||
{
|
||||
isShowing = true;
|
||||
foreach( var mf in muzzleFlashes )
|
||||
|
||||
Reference in New Issue
Block a user