Merge pull request #7544 from delftswa2014/bugfix/sam_site_friendlyfire
Friendly fire fixes and sam sites
This commit is contained in:
@@ -164,6 +164,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void AttackTarget(Target target, bool queued, bool allowMove)
|
||||
{
|
||||
if (self.IsDisabled())
|
||||
return;
|
||||
|
||||
if (!target.IsValidFor(self))
|
||||
return;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public override object Create(ActorInitializer init) { return new AttackFollow(init.Self, this); }
|
||||
}
|
||||
|
||||
public class AttackFollow : AttackBase, ITick, ISync
|
||||
public class AttackFollow : AttackBase, ITick, INotifyOwnerChanged, ISync
|
||||
{
|
||||
public Target Target { get; protected set; }
|
||||
|
||||
@@ -46,6 +46,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Target = Target.Invalid;
|
||||
}
|
||||
|
||||
public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||
{
|
||||
Target = Target.Invalid;
|
||||
}
|
||||
|
||||
class AttackActivity : Activity
|
||||
{
|
||||
readonly AttackFollow attack;
|
||||
|
||||
@@ -35,12 +35,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!base.CanAttack(self, target))
|
||||
return false;
|
||||
|
||||
var canAttack = false;
|
||||
foreach (var t in turrets)
|
||||
if (t.FaceTarget(self, target))
|
||||
canAttack = true;
|
||||
return true;
|
||||
|
||||
return canAttack;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user