Remove unused parameters.

This commit is contained in:
Matthias Mailänder
2022-03-13 12:02:52 +01:00
committed by abcdefg30
parent ea243b8558
commit 0e7ad43425
205 changed files with 451 additions and 455 deletions

View File

@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Activities
return false;
target = target.Recalculate(self.Owner, out var targetIsHiddenActor);
attackAircraft.SetRequestedTarget(self, target, forceAttack);
attackAircraft.SetRequestedTarget(target, forceAttack);
hasTicked = true;
if (!targetIsHiddenActor && target.Type == TargetType.Actor)
@@ -171,9 +171,9 @@ namespace OpenRA.Mods.Common.Activities
// The aircraft must keep moving forward even if it is already in an ideal position.
else if (attackAircraft.Info.AttackType == AirAttackType.Strafe)
QueueChild(new StrafeAttackRun(self, attackAircraft, aircraft, target, strafeDistance != WDist.Zero ? strafeDistance : lastVisibleMaximumRange));
QueueChild(new StrafeAttackRun(attackAircraft, aircraft, target, strafeDistance != WDist.Zero ? strafeDistance : lastVisibleMaximumRange));
else if (attackAircraft.Info.AttackType == AirAttackType.Default && !aircraft.Info.CanHover)
QueueChild(new FlyAttackRun(self, target, lastVisibleMaximumRange, attackAircraft));
QueueChild(new FlyAttackRun(target, lastVisibleMaximumRange, attackAircraft));
// Turn to face the target if required.
else if (!attackAircraft.TargetInFiringArc(self, target, attackAircraft.Info.FacingTolerance))
@@ -220,7 +220,7 @@ namespace OpenRA.Mods.Common.Activities
Target target;
bool targetIsVisibleActor;
public FlyAttackRun(Actor self, in Target t, WDist exitRange, AttackAircraft attack)
public FlyAttackRun(in Target t, WDist exitRange, AttackAircraft attack)
{
ChildHasPriority = false;
@@ -269,7 +269,7 @@ namespace OpenRA.Mods.Common.Activities
Target target;
public StrafeAttackRun(Actor self, AttackAircraft attackAircraft, Aircraft aircraft, in Target t, WDist exitRange)
public StrafeAttackRun(AttackAircraft attackAircraft, Aircraft aircraft, in Target t, WDist exitRange)
{
ChildHasPriority = false;
@@ -304,7 +304,7 @@ namespace OpenRA.Mods.Common.Activities
// Update the position if we seen the target move; keep the previous one if it dies or disappears
target = target.Recalculate(self.Owner, out var targetIsHiddenActor);
if (!targetIsHiddenActor && target.Type == TargetType.Actor)
attackAircraft.SetRequestedTarget(self, Target.FromTargetPositions(target), true);
attackAircraft.SetRequestedTarget(Target.FromTargetPositions(target), true);
return false;
}

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Activities
protected override void OnFirstRun(Actor self)
{
if (targetActor != null && targetActor.IsInWorld)
harv.LinkProc(self, targetActor);
harv.LinkProc(targetActor);
}
public override bool Tick(Actor self)

View File

@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Activities
self.Trait<Aircraft>().RemoveInfluence();
var localOffset = carryall.CarryableOffset.Rotate(body.QuantizeOrientation(self, self.Orientation));
var localOffset = carryall.CarryableOffset.Rotate(body.QuantizeOrientation(self.Orientation));
var targetPosition = self.CenterPosition + body.LocalToWorld(localOffset);
var targetLocation = self.World.Map.CellContaining(targetPosition);
carryall.Carryable.Trait<IPositionable>().SetPosition(carryall.Carryable, targetLocation, SubCell.FullCell);

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Activities
if (IsCanceling || (deploy.DeployState != DeployState.Deployed && moving))
return true;
QueueChild(new DeployInner(self, deploy));
QueueChild(new DeployInner(deploy));
return true;
}
}
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Activities
readonly GrantConditionOnDeploy deployment;
bool initiated;
public DeployInner(Actor self, GrantConditionOnDeploy deployment)
public DeployInner(GrantConditionOnDeploy deployment)
{
this.deployment = deployment;

View File

@@ -159,19 +159,19 @@ namespace OpenRA.Mods.Common.Activities
// Harvesters should respect an explicit harvest order instead of harvesting the current cell.
if (orderLocation == null)
{
if (harv.CanHarvestCell(self, self.Location) && claimLayer.CanClaimCell(self, self.Location))
if (harv.CanHarvestCell(self.Location) && claimLayer.CanClaimCell(self, self.Location))
return self.Location;
}
else
{
if (harv.CanHarvestCell(self, orderLocation.Value) && claimLayer.CanClaimCell(self, orderLocation.Value))
if (harv.CanHarvestCell(orderLocation.Value) && claimLayer.CanClaimCell(self, orderLocation.Value))
return orderLocation;
orderLocation = null;
}
// Determine where to search from and how far to search:
var procLoc = GetSearchFromProcLocation(self);
var procLoc = GetSearchFromProcLocation();
var searchFromLoc = lastHarvestedCell ?? procLoc ?? self.Location;
var searchRadius = lastHarvestedCell.HasValue ? harvInfo.SearchFromHarvesterRadius : harvInfo.SearchFromProcRadius;
@@ -186,7 +186,7 @@ namespace OpenRA.Mods.Common.Activities
using (var search = PathSearch.ToTargetCellByPredicate(
self.World, mobile.Locomotor, self, new[] { searchFromLoc, self.Location },
loc =>
harv.CanHarvestCell(self, loc) &&
harv.CanHarvestCell(loc) &&
claimLayer.CanClaimCell(self, loc),
BlockedByActor.Stationary,
loc =>
@@ -196,7 +196,7 @@ namespace OpenRA.Mods.Common.Activities
// Add a cost modifier to harvestable cells to prefer resources that are closer to the refinery.
// This reduces the tendency for harvesters to move in straight lines
if (procPos.HasValue && harvInfo.ResourceRefineryDirectionPenalty > 0 && harv.CanHarvestCell(self, loc))
if (procPos.HasValue && harvInfo.ResourceRefineryDirectionPenalty > 0 && harv.CanHarvestCell(loc))
{
var pos = map.CenterOfCell(loc);
@@ -244,7 +244,7 @@ namespace OpenRA.Mods.Common.Activities
yield return new TargetLineNode(Target.FromActor(deliverActor), harvInfo.DeliverLineColor);
}
CPos? GetSearchFromProcLocation(Actor self)
CPos? GetSearchFromProcLocation()
{
if (harv.LastLinkedProc != null && !harv.LastLinkedProc.IsDead && harv.LastLinkedProc.IsInWorld)
return harv.LastLinkedProc.Location + harv.LastLinkedProc.Trait<IAcceptResources>().DeliveryOffset;

View File

@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Activities
return false;
}
if (!harv.CanHarvestCell(self, self.Location))
if (!harv.CanHarvestCell(self.Location))
return true;
// Turn to one of the harvestable facings

View File

@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Activities
case DockingState.Complete:
Harv.LastLinkedProc = Harv.LinkedProc;
Harv.LinkProc(self, null);
Harv.LinkProc(null);
if (IsDragRequired)
QueueChild(new Drag(self, EndDrag, StartDrag, DragLength));

View File

@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Activities
}
// Can complete the move in this step
var speed = mobile.MovementSpeedForCell(self, self.Location);
var speed = mobile.MovementSpeedForCell(self.Location);
if (delta.LengthSquared <= speed * speed)
{
mobile.SetCenterPosition(self, targetPos);

View File

@@ -415,7 +415,7 @@ namespace OpenRA.Mods.Common.Activities
// Only move by a full speed step if we didn't already move this tick.
// If we did, we limit the move to any carried-over leftover progress.
if (Move.lastMovePartCompletedTick < self.World.WorldTick)
progress += mobile.MovementSpeedForCell(self, mobile.ToCell);
progress += mobile.MovementSpeedForCell(mobile.ToCell);
if (progress >= Distance)
{
@@ -448,13 +448,13 @@ namespace OpenRA.Mods.Common.Activities
{
var currentCellOrientation = self.World.Map.TerrainOrientation(mobile.FromCell);
var orientation = WRot.SLerp(FromTerrainOrientation.Value, currentCellOrientation, progress, terrainOrientationMargin);
mobile.SetTerrainRampOrientation(self, orientation);
mobile.SetTerrainRampOrientation(orientation);
}
else if (ToTerrainOrientation.HasValue && Distance - progress < terrainOrientationMargin)
{
var currentCellOrientation = self.World.Map.TerrainOrientation(mobile.FromCell);
var orientation = WRot.SLerp(ToTerrainOrientation.Value, currentCellOrientation, Distance - progress, terrainOrientationMargin);
mobile.SetTerrainRampOrientation(self, orientation);
mobile.SetTerrainRampOrientation(orientation);
}
mobile.Facing = WAngle.Lerp(FromFacing, ToFacing, progress, Distance);

View File

@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Activities
// Pickup position and facing are now known - swap the fly/wait activity with Land
ChildActivity.Cancel(self);
var localOffset = carryall.OffsetForCarryable(self, cargo).Rotate(carryableBody.QuantizeOrientation(self, cargo.Orientation));
var localOffset = carryall.OffsetForCarryable(self, cargo).Rotate(carryableBody.QuantizeOrientation(cargo.Orientation));
QueueChild(new Land(self, Target.FromActor(cargo), -carryableBody.LocalToWorld(localOffset), carryableFacing.Facing));
// Pause briefly before attachment for visual effect

View File

@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Widgets
if (mi.Modifiers.HasModifier(Modifiers.Shift))
{
FloodFillWithBrush(cell, isMoving);
FloodFillWithBrush(cell);
painting = false;
}
else
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Widgets
editorActionManager.Add(new PaintTileEditorAction(Template, world.Map, cell));
}
void FloodFillWithBrush(CPos cell, bool isMoving)
void FloodFillWithBrush(CPos cell)
{
var map = world.Map;
var mapTiles = map.Tiles;

View File

@@ -113,10 +113,10 @@ namespace OpenRA.Mods.Common.Effects
if (targetLineNodes.Count == 0)
return SpriteRenderable.None;
return RenderInner(wr);
return RenderInner();
}
IEnumerable<IRenderable> RenderInner(WorldRenderer wr)
IEnumerable<IRenderable> RenderInner()
{
var prev = targetLineNodes[0];
foreach (var pos in targetLineNodes.Skip(1))

View File

@@ -59,9 +59,9 @@ namespace OpenRA.Mods.Common.FileFormats
3, 4, 5, 6, 7, 8
};
static readonly Huffman LitCode = new Huffman(LitLen, LitLen.Length, 256);
static readonly Huffman LenCode = new Huffman(LenLen, LenLen.Length, 16);
static readonly Huffman DistCode = new Huffman(DistLen, DistLen.Length, 64);
static readonly Huffman LitCode = new Huffman(LitLen, 256);
static readonly Huffman LenCode = new Huffman(LenLen, 16);
static readonly Huffman DistCode = new Huffman(DistLen, 64);
/// <summary>PKWare Compression Library stream.</summary>
/// <param name="input">Compressed input stream.</param>
@@ -247,7 +247,7 @@ namespace OpenRA.Mods.Common.FileFormats
public short[] Count; // number of symbols of each length
public short[] Symbol; // canonically ordered symbols
public Huffman(byte[] rep, int n, short symbolCount)
public Huffman(byte[] rep, short symbolCount)
{
var length = new short[256]; // code lengths
var s = 0; // current symbol
@@ -262,7 +262,7 @@ namespace OpenRA.Mods.Common.FileFormats
while (--num > 0);
}
n = s;
var n = s;
// count number of codes of each length
Count = new short[Blast.MAXBITS + 1];

View File

@@ -41,6 +41,7 @@ namespace OpenRA.Mods.Common.Graphics
public class DefaultSpriteSequenceLoader : ISpriteSequenceLoader
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "IDE0060:Remove unused parameter", Justification = "Load game API")]
public DefaultSpriteSequenceLoader(ModData modData) { }
public virtual ISpriteSequence CreateSequence(ModData modData, string tileSet, SpriteCache cache, string sequence, string animation, MiniYaml info)

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Graphics
public IRenderable OffsetBy(in WVec vec) { return new SelectionBarsAnnotationRenderable(pos + vec, actor, decorationBounds); }
public IRenderable AsDecoration() { return this; }
void DrawExtraBars(WorldRenderer wr, float2 start, float2 end)
void DrawExtraBars(float2 start, float2 end)
{
foreach (var extraBar in actor.TraitsImplementing<ISelectionBar>())
{
@@ -58,12 +58,12 @@ namespace OpenRA.Mods.Common.Graphics
var offset = new float2(0, 4);
start += offset;
end += offset;
DrawSelectionBar(wr, start, end, extraBar.GetValue(), extraBar.GetColor());
DrawSelectionBar(start, end, extraBar.GetValue(), extraBar.GetColor());
}
}
}
void DrawSelectionBar(WorldRenderer wr, float2 start, float2 end, float value, Color barColor)
void DrawSelectionBar(float2 start, float2 end, float value, Color barColor)
{
var c = Color.FromArgb(128, 30, 30, 30);
var c2 = Color.FromArgb(128, 10, 10, 10);
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Graphics
health.DamageState == DamageState.Heavy ? Color.Yellow : Color.LimeGreen;
}
void DrawHealthBar(WorldRenderer wr, IHealth health, float2 start, float2 end)
void DrawHealthBar(IHealth health, float2 start, float2 end)
{
if (health == null || health.IsDead)
return;
@@ -149,10 +149,10 @@ namespace OpenRA.Mods.Common.Graphics
var end = wr.Viewport.WorldToViewPx(new float2(decorationBounds.Right - 1, decorationBounds.Top));
if (DisplayHealth)
DrawHealthBar(wr, health, start, end);
DrawHealthBar(health, start, end);
if (DisplayExtra)
DrawExtraBars(wr, start, end);
DrawExtraBars(start, end);
}
public void RenderDebugGeometry(WorldRenderer wr) { }

View File

@@ -59,12 +59,12 @@ namespace OpenRA.Mods.Common.Lint
foreach (var filename in modData.Manifest.ChromeLayout)
{
var yaml = MiniYaml.FromStream(modData.DefaultFileSystem.Open(filename), filename);
CheckInner(modData, namedKeys, checkWidgetFields, customLintMethods, yaml, filename, null, emitError, emitWarning);
CheckInner(modData, namedKeys, checkWidgetFields, customLintMethods, yaml, filename, null, emitError);
}
}
void CheckInner(ModData modData, string[] namedKeys, (string Widget, string Field)[] checkWidgetFields, Dictionary<string, List<string>> customLintMethods,
List<MiniYamlNode> nodes, string filename, MiniYamlNode parent, Action<string> emitError, Action<string> emitWarning)
List<MiniYamlNode> nodes, string filename, MiniYamlNode parent, Action<string> emitError)
{
foreach (var node in nodes)
{
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Lint
if (customLintMethods.TryGetValue(widgetType, out var checkMethods))
{
var type = modData.ObjectCreator.FindType(widgetType + "Widget");
var keyNames = checkMethods.SelectMany(m => (IEnumerable<string>)type.GetMethod(m).Invoke(null, new object[] { node, emitError, emitWarning }));
var keyNames = checkMethods.SelectMany(m => (IEnumerable<string>)type.GetMethod(m).Invoke(null, new object[] { node, emitError }));
foreach (var name in keyNames)
if (!namedKeys.Contains(name) && !Hotkey.TryParse(name, out var unused))
@@ -114,7 +114,7 @@ namespace OpenRA.Mods.Common.Lint
}
if (node.Value.Nodes != null)
CheckInner(modData, namedKeys, checkWidgetFields, customLintMethods, node.Value.Nodes, filename, node, emitError, emitWarning);
CheckInner(modData, namedKeys, checkWidgetFields, customLintMethods, node.Value.Nodes, filename, node, emitError);
}
}
}

View File

@@ -51,14 +51,14 @@ namespace OpenRA.Mods.Common.Lint
if (string.IsNullOrEmpty(locomotor))
continue;
CheckLocomotors(actorInfo.Value, emitError, rules, locomotorInfos, locomotor);
CheckLocomotors(actorInfo.Value, emitError, locomotorInfos, locomotor);
}
}
}
}
}
void CheckLocomotors(ActorInfo actorInfo, Action<string> emitError, Ruleset rules, LocomotorInfo[] locomotorInfos, string locomotor)
void CheckLocomotors(ActorInfo actorInfo, Action<string> emitError, LocomotorInfo[] locomotorInfos, string locomotor)
{
if (!locomotorInfos.Any(l => l.Name == locomotor))
emitError($"Actor {actorInfo.Name} defines Locomotor {locomotor} not found on World actor.");

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Lint
{
var palettes = new List<string>();
var playerPalettes = new List<string>();
GetPalettes(emitError, rules, palettes, playerPalettes);
GetPalettes(rules, palettes, playerPalettes);
foreach (var actorInfo in rules.Actors)
{
@@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Lint
}
}
void GetPalettes(Action<string> emitError, Ruleset rules, List<string> palettes, List<string> playerPalettes)
void GetPalettes(Ruleset rules, List<string> palettes, List<string> playerPalettes)
{
foreach (var actorInfo in rules.Actors)
{

View File

@@ -47,12 +47,12 @@ namespace OpenRA.Mods.Common.Lint
var images = new HashSet<string>()
{
renderInfo.GetImage(actorInfo.Value, sequences, null).ToLowerInvariant()
renderInfo.GetImage(actorInfo.Value, null).ToLowerInvariant()
};
// Some actors define faction-specific artwork
foreach (var faction in factions)
images.Add(renderInfo.GetImage(actorInfo.Value, sequences, faction).ToLowerInvariant());
images.Add(renderInfo.GetImage(actorInfo.Value, faction).ToLowerInvariant());
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
{

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Orders
public int OrderPriority { get; private set; }
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor)
{
if (target.Type != TargetType.Actor)
return false;

View File

@@ -230,7 +230,7 @@ namespace OpenRA.Mods.Common.Orders
{
foreach (var a in world.ActorMap.GetActorsAt(cell))
foreach (var p in a.TraitsImplementing<Pluggable>())
if (p.AcceptsPlug(a, plug.Type))
if (p.AcceptsPlug(plug.Type))
return true;
return false;

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Orders
public abstract bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor);
public abstract bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor);
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor)
{
var type = target.Type;
if (type != TargetType.Actor && type != TargetType.FrozenActor)

View File

@@ -302,7 +302,7 @@ namespace OpenRA.Mods.Common.Projectiles
if ((sbyte)vFacing < 0)
speed = minSpeed;
else if (!WillClimbWithinDistance(vFacing, loopRadius, predClfDist, diffClfMslHgt)
&& !WillClimbAroundInclineTop(vFacing, loopRadius, predClfDist, diffClfMslHgt, speed))
&& !WillClimbAroundInclineTop(vFacing, loopRadius, predClfDist, diffClfMslHgt))
{
// Find highest speed greater than the above minimum that allows the missile
// to surmount the incline
@@ -311,7 +311,7 @@ namespace OpenRA.Mods.Common.Projectiles
{
var lpRds = LoopRadius(spd, info.VerticalRateOfTurn.Facing);
return WillClimbWithinDistance(vFac, lpRds, predClfDist, diffClfMslHgt)
|| WillClimbAroundInclineTop(vFac, lpRds, predClfDist, diffClfMslHgt, spd);
|| WillClimbAroundInclineTop(vFac, lpRds, predClfDist, diffClfMslHgt);
});
}
else
@@ -401,7 +401,7 @@ namespace OpenRA.Mods.Common.Projectiles
// Will missile climb around incline top if bringing vertical facing
// down to zero on an arc of radius loopRadius
// Calling this function only makes sense when IsNearInclineTop returns true
static bool WillClimbAroundInclineTop(int vFacing, int loopRadius, int predClfDist, int diffClfMslHgt, int speed)
static bool WillClimbAroundInclineTop(int vFacing, int loopRadius, int predClfDist, int diffClfMslHgt)
{
// Vector from missile's current position pointing to the loop's center
var radius = new WVec(loopRadius, 0, 0)
@@ -523,7 +523,7 @@ namespace OpenRA.Mods.Common.Projectiles
// Missile will climb around incline top if bringing vertical facing
// down to zero on an arc of radius loopRadius
else if (IsNearInclineTop(vFacing, loopRadius, predClfDist)
&& WillClimbAroundInclineTop(vFacing, loopRadius, predClfDist, diffClfMslHgt, speed))
&& WillClimbAroundInclineTop(vFacing, loopRadius, predClfDist, diffClfMslHgt))
desiredVFacing = 0;
// Missile will not climb terrAltDiff w-units within hHeightChange w-units
@@ -537,7 +537,7 @@ namespace OpenRA.Mods.Common.Projectiles
for (var vFac = System.Math.Min(vFacing + info.VerticalRateOfTurn.Facing - 1, 63); vFac >= vFacing; vFac--)
if (!WillClimbWithinDistance(vFac, loopRadius, predClfDist, diffClfMslHgt)
&& !(predClfDist <= loopRadius * (1024 - WAngle.FromFacing(vFac).Sin()) / 1024
&& WillClimbAroundInclineTop(vFac, loopRadius, predClfDist, diffClfMslHgt, speed)))
&& WillClimbAroundInclineTop(vFac, loopRadius, predClfDist, diffClfMslHgt)))
{
desiredVFacing = vFac + 1;
break;
@@ -568,7 +568,7 @@ namespace OpenRA.Mods.Common.Projectiles
}
int HomingInnerTick(int predClfDist, int diffClfMslHgt, int relTarHorDist, int lastHtChg, int lastHt,
int nxtRelTarHorDist, int relTarHgt, int vFacing, bool targetPassedBy)
int relTarHgt, int vFacing, bool targetPassedBy)
{
int desiredVFacing = vFacing;
@@ -772,7 +772,7 @@ namespace OpenRA.Mods.Common.Projectiles
targetPassedBy = false;
var desiredVFacing = HomingInnerTick(predClfDist, diffClfMslHgt, relTarHorDist, lastHtChg, lastHt,
nxtRelTarHorDist, relTarHgt, vFacing, targetPassedBy);
relTarHgt, vFacing, targetPassedBy);
// The target has been passed by
if (tarDistVec.HorizontalLength < speed * WAngle.FromFacing(vFacing).Cos() / 1024)

View File

@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Scripting
void ITick.Tick(Actor self)
{
context.Tick(self);
context.Tick();
}
void INotifyActorDisposing.Disposing(Actor self)

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Scripting
public int GrantCondition(string condition, int duration = 0)
{
var external = externalConditions
.FirstOrDefault(t => t.Info.Condition == condition && t.CanGrantCondition(Self, this));
.FirstOrDefault(t => t.Info.Condition == condition && t.CanGrantCondition(this));
if (external == null)
throw new LuaException($"Condition `{condition}` has not been listed on an enabled ExternalCondition trait");
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Scripting
public bool AcceptsCondition(string condition)
{
return externalConditions
.Any(t => t.Info.Condition == condition && t.CanGrantCondition(Self, this));
.Any(t => t.Info.Condition == condition && t.CanGrantCondition(this));
}
}
}

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Scripting
public int GrantCondition(string condition, int duration = 0)
{
var external = externalConditions
.FirstOrDefault(t => t.Info.Condition == condition && t.CanGrantCondition(Player.PlayerActor, this));
.FirstOrDefault(t => t.Info.Condition == condition && t.CanGrantCondition(this));
if (external == null)
throw new LuaException($"Condition `{condition}` has not been listed on an enabled ExternalCondition trait");
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Scripting
public bool AcceptsCondition(string condition)
{
return externalConditions
.Any(t => t.Info.Condition == condition && t.CanGrantCondition(Player.PlayerActor, this));
.Any(t => t.Info.Condition == condition && t.CanGrantCondition(this));
}
}
}

View File

@@ -20,6 +20,7 @@ namespace OpenRA.Mods.Common.Terrain
{
public class DefaultTerrainLoader : ITerrainLoader
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "IDE0060:Remove unused parameter", Justification = "Load game API")]
public DefaultTerrainLoader(ModData modData) { }
public ITerrainInfo ParseTerrain(IReadOnlyFileSystem fileSystem, string path)

View File

@@ -23,11 +23,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Player relationships the owner of the delivering actor needs.")]
public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally;
public override object Create(ActorInitializer init) { return new AcceptsDeliveredExperience(init.Self, this); }
public override object Create(ActorInitializer init) { return new AcceptsDeliveredExperience(); }
}
public class AcceptsDeliveredExperience
{
public AcceptsDeliveredExperience(Actor self, AcceptsDeliveredExperienceInfo info) { }
public AcceptsDeliveredExperience() { }
}
}

View File

@@ -1286,7 +1286,7 @@ namespace OpenRA.Mods.Common.Traits
return modifiers.HasModifier(TargetModifiers.ForceMove);
}
public virtual bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
public virtual bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor)
{
if (target.Type != TargetType.Terrain || (aircraft.requireForceMove && !modifiers.HasModifier(TargetModifiers.ForceMove)))
return false;

View File

@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits
OnExitedAttackRange(self);
}
public void SetTarget(World w, WPos pos) { target = Target.FromPos(pos); }
public void SetTarget(WPos pos) { target = Target.FromPos(pos); }
void INotifyRemovedFromWorld.RemovedFromWorld(Actor self)
{

View File

@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The condition to grant to self for each ammo point in this pool.")]
public readonly string AmmoCondition = null;
public override object Create(ActorInitializer init) { return new AmmoPool(init.Self, this); }
public override object Create(ActorInitializer init) { return new AmmoPool(this); }
}
public class AmmoPool : INotifyCreated, INotifyAttack, ISync
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits
public bool HasAmmo => CurrentAmmoCount > 0;
public bool HasFullAmmo => CurrentAmmoCount == Info.Ammo;
public AmmoPool(Actor self, AmmoPoolInfo info)
public AmmoPool(AmmoPoolInfo info)
{
Info = info;
CurrentAmmoCount = Info.InitialAmmo < Info.Ammo && Info.InitialAmmo >= 0 ? Info.InitialAmmo : Info.Ammo;

View File

@@ -380,7 +380,7 @@ namespace OpenRA.Mods.Common.Traits
var localOffset = b.Offset + new WVec(-Recoil, WDist.Zero, WDist.Zero);
// Turret coordinates to body coordinates
var bodyOrientation = coords.QuantizeOrientation(self, self.Orientation);
var bodyOrientation = coords.QuantizeOrientation(self.Orientation);
if (turret != null)
localOffset = localOffset.Rotate(turret.WorldOrientation) + turret.Offset.Rotate(bodyOrientation);
else

View File

@@ -19,12 +19,12 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly string Type = null;
public override object Create(ActorInitializer init) { return new Armor(init.Self, this); }
public override object Create(ActorInitializer init) { return new Armor(this); }
}
public class Armor : ConditionalTrait<ArmorInfo>
{
public Armor(Actor self, ArmorInfo info)
public Armor(ArmorInfo info)
: base(info) { }
}
}

View File

@@ -474,7 +474,7 @@ namespace OpenRA.Mods.Common.Traits
return true;
}
bool CanTargetLocation(Actor self, CPos location, List<Actor> actorsAtLocation, TargetModifiers modifiers, ref string cursor)
bool CanTargetLocation(Actor self, CPos location, TargetModifiers modifiers, ref string cursor)
{
if (!self.World.Map.Contains(location))
return false;
@@ -505,7 +505,7 @@ namespace OpenRA.Mods.Common.Traits
return true;
}
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor)
{
switch (target.Type)
{
@@ -513,7 +513,7 @@ namespace OpenRA.Mods.Common.Traits
case TargetType.FrozenActor:
return CanTargetActor(self, target, ref modifiers, ref cursor);
case TargetType.Terrain:
return CanTargetLocation(self, self.World.Map.CellContaining(target.CenterPosition), othersAtTarget, modifiers, ref cursor);
return CanTargetLocation(self, self.World.Map.CellContaining(target.CenterPosition), modifiers, ref cursor);
default:
return false;
}

View File

@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
bool opportunityForceAttack;
bool opportunityTargetIsPersistentTarget;
public void SetRequestedTarget(Actor self, in Target target, bool isForceAttack = false)
public void SetRequestedTarget(in Target target, bool isForceAttack = false)
{
RequestedTarget = target;
requestedForceAttack = isForceAttack;
@@ -274,7 +274,7 @@ namespace OpenRA.Mods.Common.Traits
return false;
target = target.Recalculate(self.Owner, out var targetIsHiddenActor);
attack.SetRequestedTarget(self, target, forceAttack);
attack.SetRequestedTarget(target, forceAttack);
hasTicked = true;
if (!targetIsHiddenActor && target.Type == TargetType.Actor)

View File

@@ -139,7 +139,7 @@ namespace OpenRA.Mods.Common.Traits
WVec PortOffset(Actor self, FirePort p)
{
var bodyOrientation = coords.Value.QuantizeOrientation(self, self.Orientation);
var bodyOrientation = coords.Value.QuantizeOrientation(self.Orientation);
return coords.Value.LocalToWorld(p.Offset.Rotate(bodyOrientation));
}
@@ -193,7 +193,7 @@ namespace OpenRA.Mods.Common.Traits
// Display muzzle flashes
foreach (var m in muzzles)
foreach (var r in m.Render(self, wr, pal))
foreach (var r in m.Render(self, pal))
yield return r;
}

View File

@@ -19,15 +19,15 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Required distance away from destination before requesting a pickup. Default is 6 cells.")]
public readonly WDist MinDistance = WDist.FromCells(6);
public override object Create(ActorInitializer init) { return new AutoCarryable(init.Self, this); }
public override object Create(ActorInitializer init) { return new AutoCarryable(this); }
}
public class AutoCarryable : Carryable, ICallForTransport
{
readonly AutoCarryableInfo info;
public AutoCarryable(Actor self, AutoCarryableInfo info)
: base(self, info)
public AutoCarryable(AutoCarryableInfo info)
: base(info)
{
this.info = info;
}
@@ -35,10 +35,10 @@ namespace OpenRA.Mods.Common.Traits
public WDist MinimumDistance => info.MinDistance;
// No longer want to be carried
void ICallForTransport.MovementCancelled(Actor self) { MovementCancelled(self); }
void ICallForTransport.MovementCancelled(Actor self) { MovementCancelled(); }
void ICallForTransport.RequestTransport(Actor self, CPos destination) { RequestTransport(self, destination); }
void MovementCancelled(Actor self)
void MovementCancelled()
{
if (state == State.Locked)
return;
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Traits
if (delta.HorizontalLengthSquared < info.MinDistance.LengthSquared)
{
// Cancel pickup
MovementCancelled(self);
MovementCancelled();
return false;
}
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
if (delta.HorizontalLengthSquared < info.MinDistance.LengthSquared)
{
// Cancel pickup
MovementCancelled(self);
MovementCancelled();
return LockResponse.Failed;
}

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
return false;
}
bool IsBestAutoCarryallForCargo(Actor self, Actor candidateCargo)
static bool IsBestAutoCarryallForCargo(Actor self, Actor candidateCargo)
{
// Find carriers
var carriers = self.World.ActorsHavingTrait<AutoCarryall>(c => !c.busy)

View File

@@ -257,7 +257,7 @@ namespace OpenRA.Mods.Common.Traits
Aggressor = attacker;
Attack(self, Target.FromActor(Aggressor), allowMove);
Attack(Target.FromActor(Aggressor), allowMove);
}
void INotifyIdle.TickIdle(Actor self)
@@ -309,10 +309,10 @@ namespace OpenRA.Mods.Common.Traits
{
var target = ScanForTarget(self, allowMove, allowTurn);
if (target.Type != TargetType.Invalid)
Attack(self, target, allowMove);
Attack(target, allowMove);
}
void Attack(Actor self, in Target target, bool allowMove)
void Attack(in Target target, bool allowMove)
{
foreach (var ab in ActiveAttackBases)
ab.AttackTarget(target, AttackSource.AutoTarget, false, allowMove);

View File

@@ -22,12 +22,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Determines what projectiles to block based on their allegiance to the wall owner.")]
public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally | PlayerRelationship.Neutral | PlayerRelationship.Enemy;
public override object Create(ActorInitializer init) { return new BlocksProjectiles(init.Self, this); }
public override object Create(ActorInitializer init) { return new BlocksProjectiles(this); }
}
public class BlocksProjectiles : ConditionalTrait<BlocksProjectilesInfo>, IBlocksProjectiles
{
public BlocksProjectiles(Actor self, BlocksProjectilesInfo info)
public BlocksProjectiles(BlocksProjectilesInfo info)
: base(info) { }
WDist IBlocksProjectiles.BlockingHeight => Info.Height;

View File

@@ -101,7 +101,7 @@ namespace OpenRA.Mods.Common.Traits
return info.LocalToWorld(vec);
}
public WRot QuantizeOrientation(Actor self, in WRot orientation)
public WRot QuantizeOrientation(in WRot orientation)
{
return info.QuantizeOrientation(orientation, quantizedFacings.Value);
}

View File

@@ -143,7 +143,7 @@ namespace OpenRA.Mods.Common.Traits
if (plugInfo != null)
{
var possibleBuilding = world.ActorsWithTrait<Pluggable>().FirstOrDefault(a =>
a.Actor.Owner == player && a.Trait.AcceptsPlug(a.Actor, plugInfo.Type));
a.Actor.Owner == player && a.Trait.AcceptsPlug(plugInfo.Type));
if (possibleBuilding.Actor != null)
{

View File

@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits
// IsValid check filters out Frozen Actors that have not initialized their Owner
foreach (var scrutinized in checkFrozen)
answer += consideration.GetAttractiveness(scrutinized, firedBy.RelationshipWith(scrutinized.Owner), firedBy);
answer += consideration.GetAttractiveness(scrutinized, firedBy.RelationshipWith(scrutinized.Owner));
}
return answer;
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Traits
foreach (var consideration in Considerations)
foreach (var scrutinized in frozenActors)
if (scrutinized.IsValid && scrutinized.Visible)
answer += consideration.GetAttractiveness(scrutinized, firedBy.RelationshipWith(scrutinized.Owner), firedBy);
answer += consideration.GetAttractiveness(scrutinized, firedBy.RelationshipWith(scrutinized.Owner));
return answer;
}
@@ -174,7 +174,7 @@ namespace OpenRA.Mods.Common.Traits
return 0;
}
public int GetAttractiveness(FrozenActor fa, PlayerRelationship stance, Player firedBy)
public int GetAttractiveness(FrozenActor fa, PlayerRelationship stance)
{
if (stance != Against)
return 0;

View File

@@ -16,12 +16,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Manages AI repairing base buildings.")]
public class BuildingRepairBotModuleInfo : ConditionalTraitInfo
{
public override object Create(ActorInitializer init) { return new BuildingRepairBotModule(init.Self, this); }
public override object Create(ActorInitializer init) { return new BuildingRepairBotModule(this); }
}
public class BuildingRepairBotModule : ConditionalTrait<BuildingRepairBotModuleInfo>, IBotRespondToAttack
{
public BuildingRepairBotModule(Actor self, BuildingRepairBotModuleInfo info)
public BuildingRepairBotModule(BuildingRepairBotModuleInfo info)
: base(info) { }
void IBotRespondToAttack.RespondToAttack(IBot bot, Actor self, AttackInfo e)

View File

@@ -143,7 +143,7 @@ namespace OpenRA.Mods.Common.Traits
Target FindNextResource(Actor actor, HarvesterTraitWrapper harv)
{
Func<CPos, bool> isValidResource = cell =>
harv.Harvester.CanHarvestCell(actor, cell) &&
harv.Harvester.CanHarvestCell(cell) &&
claimLayer.CanClaimCell(actor, cell);
List<CPos> path;

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
readonly IActorPreview[] preview;
public ActorPreviewPlaceBuildingPreviewPreview(WorldRenderer wr, ActorInfo ai, ActorPreviewPlaceBuildingPreviewInfo info, TypeDictionary init)
: base(wr, ai, info, init)
: base(wr, ai, info)
{
this.info = info;
var previewInit = new ActorPreviewInitializer(ActorInfo, wr, init);

View File

@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits
return buildRadiusEnabled && (self.Owner == self.World.RenderPlayer || (allyBuildEnabled && self.Owner.IsAlliedWith(self.World.RenderPlayer)));
}
public IEnumerable<IRenderable> RangeCircleRenderables(WorldRenderer wr)
public IEnumerable<IRenderable> RangeCircleRenderables()
{
if (IsTraitDisabled)
yield break;
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Traits
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
{
return RangeCircleRenderables(wr);
return RangeCircleRenderables();
}
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;

View File

@@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Traits
return terrainInfo.GetTerrainInfo(new TerrainTile(template, (byte)index));
}
public void LinkNeighbouringBridges(World world, LegacyBridgeLayer bridges)
public void LinkNeighbouringBridges(LegacyBridgeLayer bridges)
{
for (var d = 0; d <= 1; d++)
{

View File

@@ -259,7 +259,7 @@ namespace OpenRA.Mods.Common.Traits
if (!RequiresBaseProvider)
return SpriteRenderable.None;
return w.ActorsWithTrait<BaseProvider>().SelectMany(a => a.Trait.RangeCircleRenderables(wr));
return w.ActorsWithTrait<BaseProvider>().SelectMany(a => a.Trait.RangeCircleRenderables());
}
}

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
protected virtual IPlaceBuildingPreview CreatePreview(WorldRenderer wr, ActorInfo ai, TypeDictionary init)
{
return new FootprintPlaceBuildingPreviewPreview(wr, ai, this, init);
return new FootprintPlaceBuildingPreviewPreview(wr, ai, this);
}
IPlaceBuildingPreview IPlaceBuildingPreviewGeneratorInfo.CreatePreview(WorldRenderer wr, ActorInfo ai, TypeDictionary init)
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
readonly Sprite validTile, blockedTile;
readonly float validAlpha, blockedAlpha;
public FootprintPlaceBuildingPreviewPreview(WorldRenderer wr, ActorInfo ai, FootprintPlaceBuildingPreviewInfo info, TypeDictionary init)
public FootprintPlaceBuildingPreviewPreview(WorldRenderer wr, ActorInfo ai, FootprintPlaceBuildingPreviewInfo info)
{
ActorInfo = ai;
this.info = info;

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
{
public bool IsValidTarget(ActorInfo actorInfo, Actor saboteur) { return false; } // TODO: bridges don't support frozen under fog
public override object Create(ActorInitializer init) { return new LegacyBridgeHut(init, this); }
public override object Create(ActorInitializer init) { return new LegacyBridgeHut(init); }
}
class LegacyBridgeHut : IDemolishable
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
public bool Repairing => repairDirections > 0;
int repairDirections = 0;
public LegacyBridgeHut(ActorInitializer init, LegacyBridgeHutInfo info)
public LegacyBridgeHut(ActorInitializer init)
{
var bridge = init.Get<ParentActorInit>().Value;
init.World.AddFrameEndTask(_ =>

View File

@@ -143,7 +143,7 @@ namespace OpenRA.Mods.Common.Traits
public bool ForceSet { get; private set; }
public bool IsQueued { get; protected set; }
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor)
{
if (target.Type != TargetType.Terrain)
return false;

View File

@@ -138,7 +138,7 @@ namespace OpenRA.Mods.Common.Traits
return count;
}
void CancelDock(Actor self)
void CancelDock()
{
preventDock = true;
}
@@ -161,7 +161,7 @@ namespace OpenRA.Mods.Common.Traits
void INotifyActorDisposing.Disposing(Actor self)
{
CancelDock(self);
CancelDock();
foreach (var harv in GetLinkedHarvesters())
harv.Trait.UnlinkProc(harv.Actor, self);
}
@@ -193,11 +193,11 @@ namespace OpenRA.Mods.Common.Traits
dockedHarv.ChangeOwner(newOwner);
// Relink to this refinery
dockedHarv.Trait<Harvester>().LinkProc(dockedHarv, self);
dockedHarv.Trait<Harvester>().LinkProc(self);
}
}
void INotifySold.Selling(Actor self) { CancelDock(self); }
void INotifySold.Selling(Actor self) { CancelDock(); }
void INotifySold.Sold(Actor self)
{
foreach (var harv in GetLinkedHarvesters())

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
readonly PaletteReference palette;
public SequencePlaceBuildingPreviewPreview(WorldRenderer wr, ActorInfo ai, SequencePlaceBuildingPreviewInfo info, TypeDictionary init)
: base(wr, ai, info, init)
: base(wr, ai, info)
{
this.info = info;
var ownerName = init.Get<OwnerInit>().InternalName;
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits
var rsi = ai.TraitInfo<RenderSpritesInfo>();
palette = wr.Palette(rsi.Palette ?? rsi.PlayerPalette + ownerName);
preview = new Animation(wr.World, rsi.GetImage(ai, wr.World.Map.Rules.Sequences, faction));
preview = new Animation(wr.World, rsi.GetImage(ai, faction));
preview.PlayRepeating(info.Sequence);
}

View File

@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits
AircraftCanEnter,
target => Reservable.IsAvailableFor(target, self));
yield return new AircraftMoveOrderTargeter(self, this);
yield return new AircraftMoveOrderTargeter(this);
}
}
}
@@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Traits
return modifiers.HasModifier(TargetModifiers.ForceMove);
}
public AircraftMoveOrderTargeter(Actor self, TransformsIntoAircraft aircraft)
public AircraftMoveOrderTargeter(TransformsIntoAircraft aircraft)
{
this.aircraft = aircraft;
}
@@ -200,7 +200,7 @@ namespace OpenRA.Mods.Common.Traits
public int OrderPriority => 4;
public bool IsQueued { get; protected set; }
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor)
{
if (target.Type != TargetType.Terrain || (aircraft.Info.RequiresForceMove && !modifiers.HasModifier(TargetModifiers.ForceMove)))
return false;

View File

@@ -189,7 +189,7 @@ namespace OpenRA.Mods.Common.Traits
public int OrderPriority => 4;
public bool IsQueued { get; protected set; }
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor)
{
if (rejectMove || target.Type != TargetType.Terrain || (mobile.Info.RequiresForceMove && !modifiers.HasModifier(TargetModifiers.ForceMove)))
return false;

View File

@@ -20,12 +20,12 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
public override object Create(ActorInitializer init) { return new TransformsIntoTransforms(init.Self, this); }
public override object Create(ActorInitializer init) { return new TransformsIntoTransforms(this); }
}
public class TransformsIntoTransforms : ConditionalTrait<TransformsIntoTransformsInfo>, IResolveOrder, IOrderVoice, IIssueDeployOrder
{
public TransformsIntoTransforms(Actor self, TransformsIntoTransformsInfo info)
public TransformsIntoTransforms(TransformsIntoTransformsInfo info)
: base(info) { }
void IResolveOrder.ResolveOrder(Actor self, Order order)

View File

@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits
self.CancelActivity();
}
protected override void TraitEnabled(Actor self) { captureManager.RefreshCapturable(self); }
protected override void TraitDisabled(Actor self) { captureManager.RefreshCapturable(self); }
protected override void TraitEnabled(Actor self) { captureManager.RefreshCapturable(); }
protected override void TraitDisabled(Actor self) { captureManager.RefreshCapturable(); }
}
}

View File

@@ -21,14 +21,14 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly Color Color = Color.Orange;
public override object Create(ActorInitializer init) { return new CapturableProgressBar(init.Self, this); }
public override object Create(ActorInitializer init) { return new CapturableProgressBar(this); }
}
class CapturableProgressBar : ConditionalTrait<CapturableProgressBarInfo>, ISelectionBar, ICaptureProgressWatcher
{
readonly Dictionary<Actor, (int Current, int Total)> progress = new Dictionary<Actor, (int, int)>();
public CapturableProgressBar(Actor self, CapturableProgressBarInfo info)
public CapturableProgressBar(CapturableProgressBarInfo info)
: base(info) { }
void ICaptureProgressWatcher.Update(Actor self, Actor captor, Actor target, int current, int total)

View File

@@ -99,11 +99,11 @@ namespace OpenRA.Mods.Common.Traits
.ToArray()
.Where(Exts.IsTraitEnabled);
RefreshCaptures(self);
RefreshCapturable(self);
RefreshCaptures();
RefreshCapturable();
}
public void RefreshCapturable(Actor self)
public void RefreshCapturable()
{
allyCapturableTypes = neutralCapturableTypes = enemyCapturableTypes = default(BitSet<CaptureType>);
foreach (var c in enabledCapturable)
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
public void RefreshCaptures(Actor self)
public void RefreshCaptures()
{
capturesTypes = enabledCaptures.Aggregate(
default(BitSet<CaptureType>),

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly Color Color = Color.Orange;
public override object Create(ActorInitializer init) { return new CaptureProgressBar(init.Self, this); }
public override object Create(ActorInitializer init) { return new CaptureProgressBar(this); }
}
class CaptureProgressBar : ConditionalTrait<CaptureProgressBarInfo>, ISelectionBar, ICaptureProgressWatcher
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
int current;
int total;
public CaptureProgressBar(Actor self, CaptureProgressBarInfo info)
public CaptureProgressBar(CaptureProgressBarInfo info)
: base(info) { }
void ICaptureProgressWatcher.Update(Actor self, Actor captor, Actor target, int current, int total)

View File

@@ -110,8 +110,8 @@ namespace OpenRA.Mods.Common.Traits
self.ShowTargetLines();
}
protected override void TraitEnabled(Actor self) { captureManager.RefreshCaptures(self); }
protected override void TraitDisabled(Actor self) { captureManager.RefreshCaptures(self); }
protected override void TraitEnabled(Actor self) { captureManager.RefreshCaptures(); }
protected override void TraitDisabled(Actor self) { captureManager.RefreshCaptures(); }
class CaptureOrderTargeter : UnitOrderTargeter
{

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Carryall attachment point relative to body.")]
public readonly WVec LocalOffset = WVec.Zero;
public override object Create(ActorInitializer init) { return new Carryable(init.Self, this); }
public override object Create(ActorInitializer init) { return new Carryable(this); }
}
public enum LockResponse { Success, Pending, Failed }
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits
protected State state = State.Free;
protected bool attached;
public Carryable(Actor self, CarryableInfo info)
public Carryable(CarryableInfo info)
: base(info) { }
protected override void Created(Actor self)

View File

@@ -200,7 +200,7 @@ namespace OpenRA.Mods.Common.Traits
{
get
{
var localOffset = CarryableOffset.Rotate(body.QuantizeOrientation(self, self.Orientation));
var localOffset = CarryableOffset.Rotate(body.QuantizeOrientation(self.Orientation));
return body.LocalToWorld(localOffset);
}
}
@@ -285,7 +285,7 @@ namespace OpenRA.Mods.Common.Traits
.ToArray();
}
var offset = body.LocalToWorld(CarryableOffset.Rotate(body.QuantizeOrientation(self, self.Orientation)));
var offset = body.LocalToWorld(CarryableOffset.Rotate(body.QuantizeOrientation(self.Orientation)));
var previewRenderables = carryablePreview
.SelectMany(p => p.Render(wr, self.CenterPosition + offset))
.OrderBy(WorldRenderer.RenderableZPositionComparisonKey);
@@ -430,7 +430,7 @@ namespace OpenRA.Mods.Common.Traits
this.info = info;
}
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor)
{
if (!info.AllowDropOff || !modifiers.HasModifier(TargetModifiers.ForceMove))
return false;

View File

@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits
foreach (var s in shapes)
{
foreach (var a in s.RenderDebugAnnotations(self, wr))
foreach (var a in s.RenderDebugAnnotations(self))
yield return a;
foreach (var r in s.RenderDebugOverlay(self, wr))
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits
// Fire ports on garrisonable structures
if (attack is AttackGarrisoned garrison)
{
var bodyOrientation = coords.Value.QuantizeOrientation(self, self.Orientation);
var bodyOrientation = coords.Value.QuantizeOrientation(self.Orientation);
foreach (var p in garrison.Info.Ports)
{
var pos = self.CenterPosition + coords.Value.LocalToWorld(p.Offset.Rotate(bodyOrientation));

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("If > 0, restrict the number of times that this condition can be granted by any source.")]
public readonly int TotalCap = 0;
public override object Create(ActorInitializer init) { return new ExternalCondition(init.Self, this); }
public override object Create(ActorInitializer init) { return new ExternalCondition(this); }
}
public class ExternalCondition : ITick, INotifyCreated
@@ -63,12 +63,12 @@ namespace OpenRA.Mods.Common.Traits
int duration;
int expires;
public ExternalCondition(Actor self, ExternalConditionInfo info)
public ExternalCondition(ExternalConditionInfo info)
{
Info = info;
}
public bool CanGrantCondition(Actor self, object source)
public bool CanGrantCondition(object source)
{
if (source == null)
return false;
@@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Traits
public int GrantCondition(Actor self, object source, int duration = 0, int remaining = 0)
{
if (!CanGrantCondition(self, source))
if (!CanGrantCondition(source))
return Actor.InvalidConditionToken;
var token = self.GrantCondition(Info.Condition);

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Should all instances be revoked instead of only one?")]
public readonly bool RevokeAll = false;
public override object Create(ActorInitializer init) { return new GrantConditionOnAttack(init, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnAttack(this); }
}
public class GrantConditionOnAttack : PausableConditionalTrait<GrantConditionOnAttackInfo>, INotifyCreated, ITick, INotifyAttack
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
// Only tracked when RevokeOnNewTarget is true.
Target lastTarget = Target.Invalid;
public GrantConditionOnAttack(ActorInitializer init, GrantConditionOnAttackInfo info)
public GrantConditionOnAttack(GrantConditionOnAttackInfo info)
: base(info) { }
void GrantInstance(Actor self, string cond)

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The condition to grant.")]
public readonly string Condition = null;
public override object Create(ActorInitializer init) { return new GrantConditionOnCombatantOwner(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnCombatantOwner(this); }
}
public class GrantConditionOnCombatantOwner : INotifyCreated, INotifyOwnerChanged
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
int conditionToken = Actor.InvalidConditionToken;
public GrantConditionOnCombatantOwner(Actor self, GrantConditionOnCombatantOwnerInfo info)
public GrantConditionOnCombatantOwner(GrantConditionOnCombatantOwnerInfo info)
{
this.info = info;
}

View File

@@ -13,7 +13,7 @@ namespace OpenRA.Mods.Common.Traits
{
public class GrantConditionOnJumpjetLayerInfo : GrantConditionOnLayerInfo
{
public override object Create(ActorInitializer init) { return new GrantConditionOnJumpjetLayer(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnJumpjetLayer(this); }
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
{
@@ -29,8 +29,8 @@ namespace OpenRA.Mods.Common.Traits
{
bool jumpjetInAir;
public GrantConditionOnJumpjetLayer(Actor self, GrantConditionOnJumpjetLayerInfo info)
: base(self, info, CustomMovementLayerType.Jumpjet) { }
public GrantConditionOnJumpjetLayer(GrantConditionOnJumpjetLayerInfo info)
: base(info, CustomMovementLayerType.Jumpjet) { }
void INotifyFinishedMoving.FinishedMoving(Actor self, byte oldLayer, byte newLayer)
{

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
protected readonly byte ValidLayerType;
protected int conditionToken = Actor.InvalidConditionToken;
public GrantConditionOnLayer(Actor self, InfoType info, byte validLayer)
public GrantConditionOnLayer(InfoType info, byte validLayer)
: base(info)
{
ValidLayerType = validLayer;

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly bool ShowSelectionBar = true;
public readonly Color SelectionBarColor = Color.Magenta;
public override object Create(ActorInitializer init) { return new GrantConditionOnProduction(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnProduction(this); }
}
public class GrantConditionOnProduction : INotifyProduction, ITick, ISync, ISelectionBar
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
int ticks;
public GrantConditionOnProduction(Actor self, GrantConditionOnProductionInfo info)
public GrantConditionOnProduction(GrantConditionOnProductionInfo info)
{
this.info = info;
ticks = info.Duration;

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Dig sound to play when transitioning.")]
public readonly string SubterraneanTransitionSound = null;
public override object Create(ActorInitializer init) { return new GrantConditionOnSubterraneanLayer(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnSubterraneanLayer(this); }
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
{
@@ -46,8 +46,8 @@ namespace OpenRA.Mods.Common.Traits
{
WDist transitionDepth;
public GrantConditionOnSubterraneanLayer(Actor self, GrantConditionOnSubterraneanLayerInfo info)
: base(self, info, CustomMovementLayerType.Subterranean) { }
public GrantConditionOnSubterraneanLayer(GrantConditionOnSubterraneanLayerInfo info)
: base(info, CustomMovementLayerType.Subterranean) { }
protected override void Created(Actor self)
{

View File

@@ -13,12 +13,12 @@ namespace OpenRA.Mods.Common.Traits
{
public class GrantConditionOnTunnelLayerInfo : GrantConditionOnLayerInfo
{
public override object Create(ActorInitializer init) { return new GrantConditionOnTunnelLayer(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnTunnelLayer(this); }
}
public class GrantConditionOnTunnelLayer : GrantConditionOnLayer<GrantConditionOnTunnelLayerInfo>
{
public GrantConditionOnTunnelLayer(Actor self, GrantConditionOnTunnelLayerInfo info)
: base(self, info, CustomMovementLayerType.Tunnel) { }
public GrantConditionOnTunnelLayer(GrantConditionOnTunnelLayerInfo info)
: base(info, CustomMovementLayerType.Tunnel) { }
}
}

View File

@@ -30,14 +30,14 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Duration of the condition applied on a successful crush (in ticks). Set to 0 for a permanent condition.")]
public readonly int OnCrushDuration = 0;
public override object Create(ActorInitializer init) { return new GrantExternalConditionToCrusher(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantExternalConditionToCrusher(this); }
}
public class GrantExternalConditionToCrusher : INotifyCrushed
{
public readonly GrantExternalConditionToCrusherInfo Info;
public GrantExternalConditionToCrusher(Actor self, GrantExternalConditionToCrusherInfo info)
public GrantExternalConditionToCrusher(GrantExternalConditionToCrusherInfo info)
{
Info = info;
}
@@ -45,14 +45,14 @@ namespace OpenRA.Mods.Common.Traits
void INotifyCrushed.OnCrush(Actor self, Actor crusher, BitSet<CrushClass> crushClasses)
{
crusher.TraitsImplementing<ExternalCondition>()
.FirstOrDefault(t => t.Info.Condition == Info.OnCrushCondition && t.CanGrantCondition(crusher, self))
.FirstOrDefault(t => t.Info.Condition == Info.OnCrushCondition && t.CanGrantCondition(self))
?.GrantCondition(crusher, self, Info.OnCrushDuration);
}
void INotifyCrushed.WarnCrush(Actor self, Actor crusher, BitSet<CrushClass> crushClasses)
{
crusher.TraitsImplementing<ExternalCondition>()
.FirstOrDefault(t => t.Info.Condition == Info.WarnCrushCondition && t.CanGrantCondition(crusher, self))
.FirstOrDefault(t => t.Info.Condition == Info.WarnCrushCondition && t.CanGrantCondition(self))
?.GrantCondition(crusher, self, Info.WarnCrushDuration);
}
}

View File

@@ -23,12 +23,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Duration of the condition (in ticks). Set to 0 for a permanent condition.")]
public readonly int Duration = 0;
public override object Create(ActorInitializer init) { return new GrantExternalConditionToProduced(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantExternalConditionToProduced(this); }
}
public class GrantExternalConditionToProduced : ConditionalTrait<GrantExternalConditionToProducedInfo>, INotifyProduction
{
public GrantExternalConditionToProduced(Actor self, GrantExternalConditionToProducedInfo info)
public GrantExternalConditionToProduced(GrantExternalConditionToProducedInfo info)
: base(info) { }
void INotifyProduction.UnitProduced(Actor self, Actor other, CPos exit)
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
return;
other.TraitsImplementing<ExternalCondition>()
.FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(other, self))
.FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(other))
?.GrantCondition(other, self, Info.Duration);
}
}

View File

@@ -22,14 +22,14 @@ namespace OpenRA.Mods.Common.Traits.Conditions
[Desc("List of conditions to grant from.")]
public readonly string[] Conditions = null;
public override object Create(ActorInitializer init) { return new GrantRandomCondition(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantRandomCondition(this); }
}
public class GrantRandomCondition : INotifyCreated
{
readonly GrantRandomConditionInfo info;
public GrantRandomCondition(Actor self, GrantRandomConditionInfo info)
public GrantRandomCondition(GrantRandomConditionInfo info)
{
this.info = info;
}

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")]
public readonly string Condition = null;
public override object Create(ActorInitializer init) { return new LineBuildSegmentExternalCondition(init.Self, this); }
public override object Create(ActorInitializer init) { return new LineBuildSegmentExternalCondition(this); }
}
public class LineBuildSegmentExternalCondition : ConditionalTrait<LineBuildSegmentExternalConditionInfo>, INotifyLineBuildSegmentsChanged
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
readonly HashSet<Actor> segments = new HashSet<Actor>();
readonly Dictionary<Actor, int> tokens = new Dictionary<Actor, int>();
public LineBuildSegmentExternalCondition(Actor self, LineBuildSegmentExternalConditionInfo info)
public LineBuildSegmentExternalCondition(LineBuildSegmentExternalConditionInfo info)
: base(info) { }
void GrantCondition(Actor self, Actor segment)
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
return;
var external = segment.TraitsImplementing<ExternalCondition>()
.FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(segment, self));
.FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(segment));
if (external != null)
tokens[segment] = external.GrantCondition(segment, self);

View File

@@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Traits
return;
var external = a.TraitsImplementing<ExternalCondition>()
.FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(a, self));
.FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(self));
if (external != null)
tokens[a] = external.GrantCondition(a, self);
@@ -139,7 +139,7 @@ namespace OpenRA.Mods.Common.Traits
return;
var external = produced.TraitsImplementing<ExternalCondition>()
.FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(produced, self));
.FirstOrDefault(t => t.Info.Condition == Info.Condition && t.CanGrantCondition(self));
if (external != null)
tokens[produced] = external.GrantCondition(produced, self);

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string DisabledSpeech = null;
public override object Create(ActorInitializer init) { return new ToggleConditionOnOrder(init.Self, this); }
public override object Create(ActorInitializer init) { return new ToggleConditionOnOrder(this); }
}
public class ToggleConditionOnOrder : PausableConditionalTrait<ToggleConditionOnOrderInfo>, IResolveOrder
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
bool enabled = false;
public ToggleConditionOnOrder(Actor self, ToggleConditionOnOrderInfo info)
public ToggleConditionOnOrder(ToggleConditionOnOrderInfo info)
: base(info) { }
void SetCondition(Actor self, bool granted)

View File

@@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Traits
// Sets the location (Location) and position (CenterPosition)
public void SetPosition(Actor self, CPos cell, SubCell subCell = SubCell.Any)
{
SetLocation(self, cell, subCell);
SetLocation(self, cell);
SetCenterPosition(self, self.World.Map.CenterOfCell(cell));
}
@@ -208,7 +208,7 @@ namespace OpenRA.Mods.Common.Traits
}
// Sets only the location (Location)
void SetLocation(Actor self, CPos cell, SubCell subCell = SubCell.Any)
void SetLocation(Actor self, CPos cell)
{
self.World.ActorMap.RemoveInfluence(self, this);
Location = cell;

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
bool AcceptsCondition(Actor a)
{
return a.TraitsImplementing<ExternalCondition>()
.Any(t => t.Info.Condition == info.Condition && t.CanGrantCondition(a, self));
.Any(t => t.Info.Condition == info.Condition && t.CanGrantCondition(self));
}
public override int GetSelectionShares(Actor collector)
@@ -79,9 +79,9 @@ namespace OpenRA.Mods.Common.Traits
ExternalCondition external = null;
for (var n = 0; n < info.Levels; n++)
{
if (external == null || !external.CanGrantCondition(a, self))
if (external == null || !external.CanGrantCondition(self))
{
external = externals.FirstOrDefault(t => t.CanGrantCondition(a, self));
external = externals.FirstOrDefault(t => t.CanGrantCondition(self));
if (external == null)
break;
}

View File

@@ -36,12 +36,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Risks stuck units when they don't have the Paratrooper trait.")]
public readonly bool AllowUnsuitableCell = false;
public override object Create(ActorInitializer init) { return new EjectOnDeath(init.Self, this); }
public override object Create(ActorInitializer init) { return new EjectOnDeath(this); }
}
public class EjectOnDeath : ConditionalTrait<EjectOnDeathInfo>, INotifyKilled
{
public EjectOnDeath(Actor self, EjectOnDeathInfo info)
public EjectOnDeath(EjectOnDeathInfo info)
: base(info) { }
void INotifyKilled.Killed(Actor self, AttackInfo e)

View File

@@ -47,12 +47,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Cursor to display when target actor has full health so it can't be repaired.")]
public readonly string RepairBlockedCursor = "goldwrench-blocked";
public override object Create(ActorInitializer init) { return new EngineerRepair(init, this); }
public override object Create(ActorInitializer init) { return new EngineerRepair(this); }
}
class EngineerRepair : ConditionalTrait<EngineerRepairInfo>, IIssueOrder, IResolveOrder, IOrderVoice
{
public EngineerRepair(ActorInitializer init, EngineerRepairInfo info)
public EngineerRepair(EngineerRepairInfo info)
: base(info) { }
public IEnumerable<IOrderTargeter> Orders
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Traits
return new Order(order.OrderID, self, target, queued);
}
static bool IsValidOrder(Actor self, Order order)
static bool IsValidOrder(Order order)
{
if (order.Target.Type == TargetType.FrozenActor)
return order.Target.FrozenActor.DamageState > DamageState.Undamaged;
@@ -87,13 +87,13 @@ namespace OpenRA.Mods.Common.Traits
public string VoicePhraseForOrder(Actor self, Order order)
{
return order.OrderString == "EngineerRepair" && IsValidOrder(self, order)
return order.OrderString == "EngineerRepair" && IsValidOrder(order)
? Info.Voice : null;
}
public void ResolveOrder(Actor self, Order order)
{
if (order.OrderString != "EngineerRepair" || !IsValidOrder(self, order))
if (order.OrderString != "EngineerRepair" || !IsValidOrder(order))
return;
self.QueueActivity(order.Queued, new RepairBuilding(self, order.Target, Info));

View File

@@ -21,12 +21,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Actors with these Types under EngineerRepair trait can repair me.")]
public readonly BitSet<EngineerRepairType> Types = default(BitSet<EngineerRepairType>);
public override object Create(ActorInitializer init) { return new EngineerRepairable(init, this); }
public override object Create(ActorInitializer init) { return new EngineerRepairable(this); }
}
class EngineerRepairable : ConditionalTrait<EngineerRepairableInfo>
{
public EngineerRepairable(ActorInitializer init, EngineerRepairableInfo info)
public EngineerRepairable(EngineerRepairableInfo info)
: base(info) { }
}
}

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
public WeaponInfo WeaponInfo { get; private set; }
public override object Create(ActorInitializer init) { return new ExplosionOnDamageTransition(this, init.Self); }
public override object Create(ActorInitializer init) { return new ExplosionOnDamageTransition(this); }
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
{
@@ -51,10 +51,8 @@ namespace OpenRA.Mods.Common.Traits
{
bool triggered;
public ExplosionOnDamageTransition(ExplosionOnDamageTransitionInfo info, Actor self)
: base(info)
{
}
public ExplosionOnDamageTransition(ExplosionOnDamageTransitionInfo info)
: base(info) { }
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e)
{

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Percentage of the `Experience` value that is being granted to the player owning the killing actor.")]
public readonly int PlayerExperienceModifier = 0;
public override object Create(ActorInitializer init) { return new GivesExperience(init.Self, this); }
public override object Create(ActorInitializer init) { return new GivesExperience(this); }
}
class GivesExperience : INotifyKilled, INotifyCreated
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
int exp;
IEnumerable<int> experienceModifiers;
public GivesExperience(Actor self, GivesExperienceInfo info)
public GivesExperience(GivesExperienceInfo info)
{
this.info = info;
}

View File

@@ -157,7 +157,7 @@ namespace OpenRA.Mods.Common.Traits
base.Created(self);
}
public void LinkProc(Actor self, Actor proc)
public void LinkProc(Actor proc)
{
LinkedProc = proc;
}
@@ -171,7 +171,7 @@ namespace OpenRA.Mods.Common.Traits
public void ChooseNewProc(Actor self, Actor ignore)
{
LastLinkedProc = null;
LinkProc(self, ClosestProc(self, ignore));
LinkProc(ClosestProc(self, ignore));
}
bool IsAcceptableProcType(Actor proc)
@@ -277,7 +277,7 @@ namespace OpenRA.Mods.Common.Traits
return contents.Count == 0;
}
public bool CanHarvestCell(Actor self, CPos cell)
public bool CanHarvestCell(CPos cell)
{
// Resources only exist in the ground layer
if (cell.Layer != 0)
@@ -333,7 +333,7 @@ namespace OpenRA.Mods.Common.Traits
if (order.OrderString == "Harvest")
{
// NOTE: An explicit harvest order allows the harvester to decide which refinery to deliver to.
LinkProc(self, null);
LinkProc(null);
CPos loc;
if (order.Target.Type != TargetType.Invalid)
@@ -391,7 +391,7 @@ namespace OpenRA.Mods.Common.Traits
public bool IsQueued { get; protected set; }
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor)
{
if (target.Type != TargetType.Terrain)
return false;

View File

@@ -136,7 +136,7 @@ namespace OpenRA.Mods.Common.Traits
WVec CalculateTargetableOffset(Actor self, in WVec offset)
{
var localOffset = offset;
var quantizedBodyOrientation = orientation.QuantizeOrientation(self, self.Orientation);
var quantizedBodyOrientation = orientation.QuantizeOrientation(self.Orientation);
if (turret != null)
{
@@ -154,7 +154,7 @@ namespace OpenRA.Mods.Common.Traits
return Info.Type.DistanceFromEdge(pos, origin, orientation);
}
public IEnumerable<IRenderable> RenderDebugAnnotations(Actor self, WorldRenderer wr)
public IEnumerable<IRenderable> RenderDebugAnnotations(Actor self)
{
var targetPosHLine = new WVec(0, 128, 0);
var targetPosVLine = new WVec(128, 0, 0);

View File

@@ -311,10 +311,10 @@ namespace OpenRA.Mods.Common.Traits
void ITick.Tick(Actor self)
{
UpdateMovement(self);
UpdateMovement();
}
public void UpdateMovement(Actor self)
public void UpdateMovement()
{
var newMovementTypes = MovementType.None;
if ((oldPos - CenterPosition).HorizontalLengthSquared != 0)
@@ -494,7 +494,7 @@ namespace OpenRA.Mods.Common.Traits
self.World.UpdateMaps(self, this);
var map = self.World.Map;
SetTerrainRampOrientation(self, map.TerrainOrientation(map.CellContaining(pos)));
SetTerrainRampOrientation(map.TerrainOrientation(map.CellContaining(pos)));
// The first time SetCenterPosition is called is in the constructor before creation, so we need a null check here as well
if (notifyCenterPositionChanged == null)
@@ -504,7 +504,7 @@ namespace OpenRA.Mods.Common.Traits
n.CenterPositionChanged(self, fromCell.Layer, toCell.Layer);
}
public void SetTerrainRampOrientation(Actor self, WRot orientation)
public void SetTerrainRampOrientation(WRot orientation)
{
if (Info.TerrainOrientationAdjustmentMargin.Length >= 0)
terrainRampOrientation = orientation;
@@ -723,7 +723,7 @@ namespace OpenRA.Mods.Common.Traits
public int EstimatedMoveDuration(Actor self, WPos fromPos, WPos toPos)
{
var speed = MovementSpeedForCell(self, self.Location);
var speed = MovementSpeedForCell(self.Location);
return speed > 0 ? (toPos - fromPos).Length / speed : 0;
}
@@ -745,7 +745,7 @@ namespace OpenRA.Mods.Common.Traits
#region Local IMove-related
public int MovementSpeedForCell(Actor self, CPos cell)
public int MovementSpeedForCell(CPos cell)
{
var terrainSpeed = Locomotor.MovementSpeedForCell(cell);
var modifiers = speedModifiers.Value.Append(terrainSpeed);
@@ -809,7 +809,7 @@ namespace OpenRA.Mods.Common.Traits
Activity LocalMove(Actor self, WPos fromPos, WPos toPos, CPos cell)
{
var speed = MovementSpeedForCell(self, cell);
var speed = MovementSpeedForCell(cell);
var length = speed > 0 ? (toPos - fromPos).Length / speed : 0;
var delta = toPos - fromPos;
@@ -850,7 +850,7 @@ namespace OpenRA.Mods.Common.Traits
// Allows the husk to drag to its final position
if (CanEnterCell(self.Location, self, BlockedByActor.Stationary))
init.Add(new HuskSpeedInit(MovementSpeedForCell(self, self.Location)));
init.Add(new HuskSpeedInit(MovementSpeedForCell(self.Location)));
}
void INotifyBecomingIdle.OnBecomingIdle(Actor self)
@@ -1006,7 +1006,7 @@ namespace OpenRA.Mods.Common.Traits
public int OrderPriority => 4;
public bool IsQueued { get; protected set; }
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
public bool CanTarget(Actor self, in Target target, ref TargetModifiers modifiers, ref string cursor)
{
if (rejectMove || target.Type != TargetType.Terrain || (mobile.requireForceMove && !modifiers.HasModifier(TargetModifiers.ForceMove)))
return false;

View File

@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Traits
});
}
void UpdateFrozenActor(Actor self, FrozenActor frozenActor, int playerIndex)
void UpdateFrozenActor(FrozenActor frozenActor, int playerIndex)
{
VisibilityHash |= 1 << (playerIndex % 32);
frozenActor.RefreshState();
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Traits
frozenStates[frozen.Viewer].IsVisible = !frozen.Visible;
}
bool IsVisibleInner(Actor self, Player byPlayer)
bool IsVisibleInner(Player byPlayer)
{
// If fog is disabled visibility is determined by shroud
if (!byPlayer.Shroud.FogEnabled)
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Traits
return true;
var relationship = self.Owner.RelationshipWith(byPlayer);
return info.AlwaysVisibleRelationships.HasRelationship(relationship) || IsVisibleInner(self, byPlayer);
return info.AlwaysVisibleRelationships.HasRelationship(relationship) || IsVisibleInner(byPlayer);
}
void ITick.Tick(Actor self)
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Traits
if (!created && startsRevealed)
{
for (var playerIndex = 0; playerIndex < frozenStates.Count; playerIndex++)
UpdateFrozenActor(self, frozenStates[playerIndex].FrozenActor, playerIndex);
UpdateFrozenActor(frozenStates[playerIndex].FrozenActor, playerIndex);
created = true;
return;
@@ -136,7 +136,7 @@ namespace OpenRA.Mods.Common.Traits
state.IsVisible = isVisible;
if (isVisible)
UpdateFrozenActor(self, frozenActor, playerIndex);
UpdateFrozenActor(frozenActor, playerIndex);
}
}
@@ -183,7 +183,7 @@ namespace OpenRA.Mods.Common.Traits
{
// Force a state update for the old owner so the tooltip etc doesn't show them as the owner
var oldOwnerIndex = self.World.Players.IndexOf(oldOwner);
UpdateFrozenActor(self, frozenStates[oldOwnerIndex].FrozenActor, oldOwnerIndex);
UpdateFrozenActor(frozenStates[oldOwnerIndex].FrozenActor, oldOwnerIndex);
}
void INotifyActorDisposing.Disposing(Actor self)

View File

@@ -42,10 +42,10 @@ namespace OpenRA.Mods.Common.Traits
if (IsTraitDisabled)
return r;
return ModifiedRender(self, wr, r);
return ModifiedRender(r);
}
IEnumerable<IRenderable> ModifiedRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
IEnumerable<IRenderable> ModifiedRender(IEnumerable<IRenderable> r)
{
foreach (var a in r)
{

View File

@@ -31,12 +31,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The deathtypes used when 'Action' is 'Kill'.")]
public readonly BitSet<DamageType> DeathTypes = default(BitSet<DamageType>);
public override object Create(ActorInitializer init) { return new OwnerLostAction(init, this); }
public override object Create(ActorInitializer init) { return new OwnerLostAction(this); }
}
public class OwnerLostAction : ConditionalTrait<OwnerLostActionInfo>, INotifyOwnerLost
{
public OwnerLostAction(ActorInitializer init, OwnerLostActionInfo info)
public OwnerLostAction(OwnerLostActionInfo info)
: base(info) { }
void INotifyOwnerLost.OnOwnerLost(Actor self)

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
int penalty;
public ClassicParallelProductionQueue(ActorInitializer init, ClassicParallelProductionQueueInfo info)
: base(init, init.Self, info)
: base(init, info)
{
self = init.Self;
this.info = info;

View File

@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
readonly ClassicProductionQueueInfo info;
public ClassicProductionQueue(ActorInitializer init, ClassicProductionQueueInfo info)
: base(init, init.Self, info)
: base(init, info)
{
self = init.Self;
this.info = info;

View File

@@ -15,13 +15,13 @@ namespace OpenRA.Mods.Common.Traits
{
public class ParallelProductionQueueInfo : ProductionQueueInfo
{
public override object Create(ActorInitializer init) { return new ParallelProductionQueue(init, init.Self.Owner.PlayerActor, this); }
public override object Create(ActorInitializer init) { return new ParallelProductionQueue(init, this); }
}
public class ParallelProductionQueue : ProductionQueue
{
public ParallelProductionQueue(ActorInitializer init, Actor playerActor, ParallelProductionQueueInfo info)
: base(init, playerActor, info) { }
public ParallelProductionQueue(ActorInitializer init, ParallelProductionQueueInfo info)
: base(init, info) { }
protected override void TickInner(Actor self, bool allProductionPaused)
{

View File

@@ -163,7 +163,7 @@ namespace OpenRA.Mods.Common.Traits
foreach (var a in self.World.ActorMap.GetActorsAt(targetLocation))
{
var pluggables = a.TraitsImplementing<Pluggable>()
.Where(p => p.AcceptsPlug(a, plugInfo.Type))
.Where(p => p.AcceptsPlug(plugInfo.Type))
.ToList();
var pluggable = pluggables.FirstOrDefault(p => a.Location + p.Info.Offset == targetLocation)

View File

@@ -159,7 +159,7 @@ namespace OpenRA.Mods.Common.Traits
if (BuildableInfo != null && rsi != null)
{
var image = rsi.GetImage(actorInfo, owner.World.Map.Rules.Sequences, owner.Faction.Name);
var image = rsi.GetImage(actorInfo, owner.Faction.Name);
Icon = new Animation(owner.World, image);
Icon.Play(BuildableInfo.Icon);
IconPalette = BuildableInfo.IconPalette;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Attach this to an actor (usually a building) to let it produce units or construct buildings.",
"If one builds another actor of this type, he will get a separate queue to create two actors",
"at the same time. Will only work together with the Production: trait.")]
public class ProductionQueueInfo : TraitInfo
public class ProductionQueueInfo : TraitInfo, IRulesetLoaded
{
[FieldLoader.Require]
[Desc("What kind of production will be added (e.g. Building, Infantry, Vehicle, ...)")]
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string CancelledAudio = null;
public override object Create(ActorInitializer init) { return new ProductionQueue(init, init.Self.Owner.PlayerActor, this); }
public override object Create(ActorInitializer init) { return new ProductionQueue(init, this); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{
@@ -132,7 +132,7 @@ namespace OpenRA.Mods.Common.Traits
[Sync]
public bool IsValidFaction { get; private set; }
public ProductionQueue(ActorInitializer init, Actor playerActor, ProductionQueueInfo info)
public ProductionQueue(ActorInitializer init, ProductionQueueInfo info)
{
self = init.Self;
Info = info;
@@ -153,7 +153,7 @@ namespace OpenRA.Mods.Common.Traits
techTree = self.Owner.PlayerActor.Trait<TechTree>();
productionTraits = self.TraitsImplementing<Production>().Where(p => p.Info.Produces.Contains(Info.Type)).ToArray();
CacheProducibles(self.Owner.PlayerActor);
CacheProducibles();
}
protected void ClearQueue()
@@ -181,7 +181,7 @@ namespace OpenRA.Mods.Common.Traits
// Regenerate the producibles and tech tree state
oldOwner.PlayerActor.Trait<TechTree>().Remove(this);
CacheProducibles(newOwner.PlayerActor);
CacheProducibles();
techTree.Update();
}
@@ -193,7 +193,7 @@ namespace OpenRA.Mods.Common.Traits
void INotifyTransform.OnTransform(Actor self) { }
void INotifyTransform.AfterTransform(Actor self) { }
void CacheProducibles(Actor playerActor)
void CacheProducibles()
{
Producible.Clear();
if (!Enabled)

View File

@@ -107,7 +107,7 @@ namespace OpenRA.Mods.Common.Traits
EnablePlug(self, initialPlug);
}
public bool AcceptsPlug(Actor self, string type)
public bool AcceptsPlug(string type)
{
if (!Info.Conditions.ContainsKey(type))
return false;

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
throw new InvalidOperationException("Actor " + ai.Name + " is missing sequence to quantize facings from.");
var rsi = ai.TraitInfo<RenderSpritesInfo>();
return sequenceProvider.GetSequence(rsi.GetImage(ai, sequenceProvider, race), Sequence).Facings;
return sequenceProvider.GetSequence(rsi.GetImage(ai, race), Sequence).Facings;
}
public override object Create(ActorInitializer init) { return new QuantizeFacingsFromSequence(this); }

Some files were not shown because too many files have changed in this diff Show More