Use in parameter for Target

This commit is contained in:
teinarss
2020-08-19 20:47:59 +02:00
committed by abcdefg30
parent 13a8b6bda2
commit 13581c030d
113 changed files with 259 additions and 240 deletions

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Warheads
public readonly WDist Range = WDist.FromCells(1);
public override void DoImpact(Target target, WarheadArgs args)
public override void DoImpact(in Target target, WarheadArgs args)
{
var firedBy = args.SourceActor;
var actors = target.Type == TargetType.Actor ? new[] { target.Actor } :

View File

@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Warheads
return true;
}
public override void DoImpact(Target target, WarheadArgs args)
public override void DoImpact(in Target target, WarheadArgs args)
{
if (target.Type == TargetType.Invalid)
return;

View File

@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Warheads
}
// TODO: Allow maximum resource splatter to be defined. (Per tile, and in total).
public override void DoImpact(Target target, WarheadArgs args)
public override void DoImpact(in Target target, WarheadArgs args)
{
if (target.Type == TargetType.Invalid)
return;

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Warheads
return base.IsValidAgainst(victim, firedBy);
}
public override void DoImpact(Target target, WarheadArgs args)
public override void DoImpact(in Target target, WarheadArgs args)
{
var firedBy = args.SourceActor;

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Warheads
public readonly int[] Size = { 0, 0 };
// TODO: Allow maximum resource removal to be defined. (Per tile, and in total).
public override void DoImpact(Target target, WarheadArgs args)
public override void DoImpact(in Target target, WarheadArgs args)
{
if (target.Type == TargetType.Invalid)
return;

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Warheads
throw new YamlException("Weapons Ruleset does not contain an entry '{0}'".F(Weapon.ToLowerInvariant()));
}
public override void DoImpact(Target target, WarheadArgs args)
public override void DoImpact(in Target target, WarheadArgs args)
{
if (target.Type == TargetType.Invalid)
return;

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Warheads
[Desc("Duration of the flashing, measured in ticks. Set to -1 to default to the `Length` of the `FlashPaletteEffect`.")]
public readonly int Duration = 0;
public override void DoImpact(Target target, WarheadArgs args)
public override void DoImpact(in Target target, WarheadArgs args)
{
foreach (var flash in args.SourceActor.World.WorldActor.TraitsImplementing<FlashPaletteEffect>())
if (flash.Info.Type == FlashType)

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Warheads
public readonly WDist Range = WDist.FromCells(1);
public override void DoImpact(Target target, WarheadArgs args)
public override void DoImpact(in Target target, WarheadArgs args)
{
var firedBy = args.SourceActor;
var actors = target.Type == TargetType.Actor ? new[] { target.Actor } :

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Warheads
[Desc("Percentual chance the smudge is created.")]
public readonly int Chance = 100;
public override void DoImpact(Target target, WarheadArgs args)
public override void DoImpact(in Target target, WarheadArgs args)
{
if (target.Type == TargetType.Invalid)
return;

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Warheads
[Desc("Shake multipliers by the X and Y axis, comma-separated.")]
public readonly float2 Multiplier = new float2(0, 0);
public override void DoImpact(Target target, WarheadArgs args)
public override void DoImpact(in Target target, WarheadArgs args)
{
args.SourceActor.World.WorldActor.Trait<ScreenShaker>().AddEffect(Duration, target.CenterPosition, Intensity, Multiplier);
}

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Warheads
}
/// <summary>Applies the warhead's effect against the target.</summary>
public abstract void DoImpact(Target target, WarheadArgs args);
public abstract void DoImpact(in Target target, WarheadArgs args);
/// <summary>Checks if the warhead is valid against (can do something to) the actor.</summary>
public virtual bool IsValidAgainst(Actor victim, Actor firedBy)