Use in parameter for Target
This commit is contained in:
@@ -24,14 +24,14 @@ namespace OpenRA.Mods.Cnc.Activities
|
||||
readonly INotifyInfiltration[] notifiers;
|
||||
Actor enterActor;
|
||||
|
||||
public Infiltrate(Actor self, Target target, Infiltrates infiltrates)
|
||||
public Infiltrate(Actor self, in Target target, Infiltrates infiltrates)
|
||||
: base(self, target, Color.Crimson)
|
||||
{
|
||||
this.infiltrates = infiltrates;
|
||||
notifiers = self.TraitsImplementing<INotifyInfiltration>().ToArray();
|
||||
}
|
||||
|
||||
protected override void TickInner(Actor self, Target target, bool targetIsDeadOrHiddenActor)
|
||||
protected override void TickInner(Actor self, in Target target, bool targetIsDeadOrHiddenActor)
|
||||
{
|
||||
if (infiltrates.IsTraitDisabled)
|
||||
Cancel(self, true);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Cnc.Activities
|
||||
int ticks = 0;
|
||||
WPos targetPosition;
|
||||
|
||||
public Leap(Actor self, Target target, Mobile mobile, Mobile targetMobile, int speed, AttackLeap attack, EdibleByLeap edible)
|
||||
public Leap(Actor self, in Target target, Mobile mobile, Mobile targetMobile, int speed, AttackLeap attack, EdibleByLeap edible)
|
||||
{
|
||||
this.mobile = mobile;
|
||||
this.targetMobile = targetMobile;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Cnc.Activities
|
||||
BitSet<TargetableType> lastVisibleTargetTypes;
|
||||
Player lastVisibleOwner;
|
||||
|
||||
public LeapAttack(Actor self, Target target, bool allowMovement, bool forceAttack, AttackLeap attack, AttackLeapInfo info, Color? targetLineColor = null)
|
||||
public LeapAttack(Actor self, in Target target, bool allowMovement, bool forceAttack, AttackLeap attack, AttackLeapInfo info, Color? targetLineColor = null)
|
||||
{
|
||||
this.target = target;
|
||||
this.targetLineColor = targetLineColor;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Effects
|
||||
int weaponDelay;
|
||||
bool impacted = false;
|
||||
|
||||
public DropPodImpact(Player firedBy, WeaponInfo weapon, World world, WPos launchPos, Target target,
|
||||
public DropPodImpact(Player firedBy, WeaponInfo weapon, World world, WPos launchPos, in Target target,
|
||||
int delay, string entryEffect, string entrySequence, string entryPalette)
|
||||
{
|
||||
this.target = target;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Cnc.Effects
|
||||
int weaponDelay;
|
||||
bool impacted = false;
|
||||
|
||||
public IonCannon(Player firedBy, WeaponInfo weapon, World world, WPos launchPos, Target target, string effect, string sequence, string palette, int delay)
|
||||
public IonCannon(Player firedBy, WeaponInfo weapon, World world, WPos launchPos, in Target target, string effect, string sequence, string palette, int delay)
|
||||
{
|
||||
this.target = target;
|
||||
this.firedBy = firedBy;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
protected override bool CanAttack(Actor self, Target target)
|
||||
protected override bool CanAttack(Actor self, in Target target)
|
||||
{
|
||||
if (target.Type != TargetType.Actor)
|
||||
return false;
|
||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
leapToken = self.RevokeCondition(leapToken);
|
||||
}
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor)
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor)
|
||||
{
|
||||
return new LeapAttack(self, newTarget, allowMove, forceAttack, this, info, targetLineColor);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool CanAttack(Actor self, Target target)
|
||||
protected override bool CanAttack(Actor self, in Target target)
|
||||
{
|
||||
if (state == PopupState.Closed)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
public AttackTDGunboatTurreted(Actor self, AttackTDGunboatTurretedInfo info)
|
||||
: base(self, info) { }
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor)
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor)
|
||||
{
|
||||
return new AttackTDGunboatTurretedActivity(self, newTarget, allowMove, forceAttack, targetLineColor);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
readonly Color? targetLineColor;
|
||||
bool hasTicked;
|
||||
|
||||
public AttackTDGunboatTurretedActivity(Actor self, Target target, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
public AttackTDGunboatTurretedActivity(Actor self, in Target target, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
attack = self.Trait<AttackTDGunboatTurreted>();
|
||||
this.target = target;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
charges = info.MaxCharges;
|
||||
}
|
||||
|
||||
protected override bool CanAttack(Actor self, Target target)
|
||||
protected override bool CanAttack(Actor self, in Target target)
|
||||
{
|
||||
if (!IsReachableTarget(target, true))
|
||||
return false;
|
||||
@@ -70,15 +70,15 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
return base.CanAttack(self, target);
|
||||
}
|
||||
|
||||
void INotifyAttack.Attacking(Actor self, Target target, Armament a, Barrel barrel)
|
||||
void INotifyAttack.Attacking(Actor self, in Target target, Armament a, Barrel barrel)
|
||||
{
|
||||
--charges;
|
||||
timeToRecharge = info.ReloadDelay;
|
||||
}
|
||||
|
||||
void INotifyAttack.PreparingAttack(Actor self, Target target, Armament a, Barrel barrel) { }
|
||||
void INotifyAttack.PreparingAttack(Actor self, in Target target, Armament a, Barrel barrel) { }
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
return new ChargeAttack(this, newTarget, forceAttack, targetLineColor);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
readonly bool forceAttack;
|
||||
readonly Color? targetLineColor;
|
||||
|
||||
public ChargeAttack(AttackTesla attack, Target target, bool forceAttack, Color? targetLineColor = null)
|
||||
public ChargeAttack(AttackTesla attack, in Target target, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
this.attack = attack;
|
||||
this.target = target;
|
||||
@@ -149,7 +149,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
readonly AttackTesla attack;
|
||||
readonly Target target;
|
||||
|
||||
public ChargeFire(AttackTesla attack, Target target)
|
||||
public ChargeFire(AttackTesla attack, in Target target)
|
||||
{
|
||||
this.attack = attack;
|
||||
this.target = target;
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
}
|
||||
}
|
||||
|
||||
Order IIssueOrder.IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||
Order IIssueOrder.IssueOrder(Actor self, IOrderTargeter order, in Target target, bool queued)
|
||||
{
|
||||
if (order.OrderID == "Disguise")
|
||||
return new Order(order.OrderID, self, target, queued);
|
||||
@@ -244,9 +244,9 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
}
|
||||
}
|
||||
|
||||
void INotifyAttack.PreparingAttack(Actor self, Target target, Armament a, Barrel barrel) { }
|
||||
void INotifyAttack.PreparingAttack(Actor self, in Target target, Armament a, Barrel barrel) { }
|
||||
|
||||
void INotifyAttack.Attacking(Actor self, Target target, Armament a, Barrel barrel)
|
||||
void INotifyAttack.Attacking(Actor self, in Target target, Armament a, Barrel barrel)
|
||||
{
|
||||
if (info.RevealDisguiseOn.HasFlag(RevealDisguiseType.Attack))
|
||||
DisguiseAs(null);
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||
public Order IssueOrder(Actor self, IOrderTargeter order, in Target target, bool queued)
|
||||
{
|
||||
if (order.OrderID != "Infiltrate")
|
||||
return null;
|
||||
@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
? Info.Voice : null;
|
||||
}
|
||||
|
||||
public bool CanInfiltrateTarget(Actor self, Target target)
|
||||
public bool CanInfiltrateTarget(Actor self, in Target target)
|
||||
{
|
||||
switch (target.Type)
|
||||
{
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
}
|
||||
}
|
||||
|
||||
Order IIssueOrder.IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||
Order IIssueOrder.IssueOrder(Actor self, IOrderTargeter order, in Target target, bool queued)
|
||||
{
|
||||
if (order.OrderID != "DetonateAttack" && order.OrderID != "Detonate")
|
||||
return null;
|
||||
@@ -150,7 +150,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
assignTargetOnFirstRun = true;
|
||||
}
|
||||
|
||||
public DetonationSequence(Actor self, MadTank mad, Target target)
|
||||
public DetonationSequence(Actor self, MadTank mad, in Target target)
|
||||
{
|
||||
this.self = self;
|
||||
this.mad = mad;
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
}
|
||||
}
|
||||
|
||||
Order IIssueOrder.IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||
Order IIssueOrder.IssueOrder(Actor self, IOrderTargeter order, in Target target, bool queued)
|
||||
{
|
||||
switch (order.OrderID)
|
||||
{
|
||||
@@ -299,9 +299,9 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
{
|
||||
public string OrderID { get { return "BeginMinefield"; } }
|
||||
public int OrderPriority { get { return 5; } }
|
||||
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
if (target.Type != TargetType.Terrain)
|
||||
return false;
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||
public Order IssueOrder(Actor self, IOrderTargeter order, in Target target, bool queued)
|
||||
{
|
||||
if (order.OrderID == "PortableChronoDeploy")
|
||||
{
|
||||
@@ -172,9 +172,9 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
public string OrderID { get { return "PortableChronoTeleport"; } }
|
||||
public int OrderPriority { get { return 5; } }
|
||||
public bool IsQueued { get; protected set; }
|
||||
public bool TargetOverridesSelection(Actor self, Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
if (modifiers.HasModifier(TargetModifiers.ForceMove))
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
||||
wsb = init.Self.TraitsImplementing<WithSpriteBody>().Single(w => w.Info.Name == info.Body);
|
||||
}
|
||||
|
||||
void INotifyTeslaCharging.Charging(Actor self, Target target)
|
||||
void INotifyTeslaCharging.Charging(Actor self, in Target target)
|
||||
{
|
||||
wsb.PlayCustomAnimation(self, info.ChargeSequence, () => wsb.CancelCustomAnimation(self));
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
||||
info.Palette, info.IsPlayerPalette);
|
||||
}
|
||||
|
||||
void INotifyTeslaCharging.Charging(Actor self, Target target)
|
||||
void INotifyTeslaCharging.Charging(Actor self, in Target target)
|
||||
{
|
||||
charging = true;
|
||||
overlay.PlayThen(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.Sequence), () => charging = false);
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
base.Created(self);
|
||||
}
|
||||
|
||||
void INotifyBurstComplete.FiredBurst(Actor self, Target target, Armament a)
|
||||
void INotifyBurstComplete.FiredBurst(Actor self, in Target target, Armament a)
|
||||
{
|
||||
self.World.IssueOrder(new Order("Stop", self, false));
|
||||
}
|
||||
|
||||
@@ -202,16 +202,16 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
public Activity MoveTo(CPos cell, int nearEnough = 0, Actor ignoreActor = null,
|
||||
bool evaluateNearestMovableCell = false, Color? targetLineColor = null) { return null; }
|
||||
public Activity MoveWithinRange(Target target, WDist range,
|
||||
public Activity MoveWithinRange(in Target target, WDist range,
|
||||
WPos? initialTargetPosition = null, Color? targetLineColor = null) { return null; }
|
||||
public Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange,
|
||||
public Activity MoveWithinRange(in Target target, WDist minRange, WDist maxRange,
|
||||
WPos? initialTargetPosition = null, Color? targetLineColor = null) { return null; }
|
||||
public Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange,
|
||||
public Activity MoveFollow(Actor self, in Target target, WDist minRange, WDist maxRange,
|
||||
WPos? initialTargetPosition = null, Color? targetLineColor = null) { return null; }
|
||||
public Activity ReturnToCell(Actor self) { return null; }
|
||||
public Activity MoveToTarget(Actor self, Target target,
|
||||
public Activity MoveToTarget(Actor self, in Target target,
|
||||
WPos? initialTargetPosition = null, Color? targetLineColor = null) { return null; }
|
||||
public Activity MoveIntoTarget(Actor self, Target target) { return null; }
|
||||
public Activity MoveIntoTarget(Actor self, in Target target) { return null; }
|
||||
public Activity VisualMove(Actor self, WPos fromPos, WPos toPos) { return null; }
|
||||
|
||||
public int EstimatedMoveDuration(Actor self, WPos fromPos, WPos toPos)
|
||||
@@ -224,7 +224,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
// Actors with TDGunboat always move
|
||||
public MovementType CurrentMovementTypes { get { return MovementType.Horizontal; } set { } }
|
||||
|
||||
public bool CanEnterTargetNow(Actor self, Target target)
|
||||
public bool CanEnterTargetNow(Actor self, in Target target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -14,5 +14,5 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Cnc.Traits
|
||||
{
|
||||
[RequireExplicitImplementation]
|
||||
public interface INotifyTeslaCharging { void Charging(Actor self, Target target); }
|
||||
public interface INotifyTeslaCharging { void Charging(Actor self, in Target target); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user