Remove unused parameters and variables.

This commit is contained in:
Matthias Mailänder
2021-12-05 13:27:29 +01:00
committed by abcdefg30
parent 07815143f1
commit 9d905d8291
31 changed files with 54 additions and 59 deletions

View File

@@ -205,7 +205,7 @@ namespace OpenRA
customDataLoaded = true; customDataLoaded = true;
} }
static string[] YamlList(Dictionary<string, MiniYaml> yaml, string key, bool parsePaths = false) static string[] YamlList(Dictionary<string, MiniYaml> yaml, string key)
{ {
if (!yaml.ContainsKey(key)) if (!yaml.ContainsKey(key))
return Array.Empty<string>(); return Array.Empty<string>();

View File

@@ -326,13 +326,13 @@ namespace OpenRA
var inherited = new Dictionary<string, MiniYamlNode.SourceLocation>(); var inherited = new Dictionary<string, MiniYamlNode.SourceLocation>();
inherited.Add(kv.Key, default(MiniYamlNode.SourceLocation)); inherited.Add(kv.Key, default(MiniYamlNode.SourceLocation));
var children = ResolveInherits(kv.Key, kv.Value, tree, inherited); var children = ResolveInherits(kv.Value, tree, inherited);
resolved.Add(kv.Key, new MiniYaml(kv.Value.Value, children)); resolved.Add(kv.Key, new MiniYaml(kv.Value.Value, children));
} }
// Resolve any top-level removals (e.g. removing whole actor blocks) // Resolve any top-level removals (e.g. removing whole actor blocks)
var nodes = new MiniYaml("", resolved.Select(kv => new MiniYamlNode(kv.Key, kv.Value)).ToList()); var nodes = new MiniYaml("", resolved.Select(kv => new MiniYamlNode(kv.Key, kv.Value)).ToList());
return ResolveInherits("", nodes, tree, new Dictionary<string, MiniYamlNode.SourceLocation>()); return ResolveInherits(nodes, tree, new Dictionary<string, MiniYamlNode.SourceLocation>());
} }
static void MergeIntoResolved(MiniYamlNode overrideNode, List<MiniYamlNode> existingNodes, static void MergeIntoResolved(MiniYamlNode overrideNode, List<MiniYamlNode> existingNodes,
@@ -342,13 +342,13 @@ namespace OpenRA
if (existingNode != null) if (existingNode != null)
{ {
existingNode.Value = MergePartial(existingNode.Value, overrideNode.Value); existingNode.Value = MergePartial(existingNode.Value, overrideNode.Value);
existingNode.Value.Nodes = ResolveInherits(existingNode.Key, existingNode.Value, tree, inherited); existingNode.Value.Nodes = ResolveInherits(existingNode.Value, tree, inherited);
} }
else else
existingNodes.Add(overrideNode.Clone()); existingNodes.Add(overrideNode.Clone());
} }
static List<MiniYamlNode> ResolveInherits(string key, MiniYaml node, Dictionary<string, MiniYaml> tree, Dictionary<string, MiniYamlNode.SourceLocation> inherited) static List<MiniYamlNode> ResolveInherits(MiniYaml node, Dictionary<string, MiniYaml> tree, Dictionary<string, MiniYamlNode.SourceLocation> inherited)
{ {
var resolved = new List<MiniYamlNode>(node.Nodes.Count); var resolved = new List<MiniYamlNode>(node.Nodes.Count);
@@ -367,7 +367,7 @@ namespace OpenRA
throw new YamlException($"{n.Location}: Parent type `{n.Value.Value}` was already inherited by this yaml tree at {inherited[n.Value.Value]} (note: may be from a derived tree)"); throw new YamlException($"{n.Location}: Parent type `{n.Value.Value}` was already inherited by this yaml tree at {inherited[n.Value.Value]} (note: may be from a derived tree)");
inherited.Add(n.Value.Value, n.Location); inherited.Add(n.Value.Value, n.Location);
foreach (var r in ResolveInherits(n.Key, parent, tree, inherited)) foreach (var r in ResolveInherits(parent, tree, inherited))
MergeIntoResolved(r, resolved, tree, inherited); MergeIntoResolved(r, resolved, tree, inherited);
} }
else if (n.Key.StartsWith("-", StringComparison.Ordinal)) else if (n.Key.StartsWith("-", StringComparison.Ordinal))

View File

@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Cnc.Activities
var cargo = self.TraitOrDefault<Cargo>(); var cargo = self.TraitOrDefault<Cargo>();
if (cargo != null && teleporter != null) if (cargo != null && teleporter != null)
{ {
while (!cargo.IsEmpty(self)) while (!cargo.IsEmpty())
{ {
var a = cargo.Unload(self); var a = cargo.Unload(self);

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Cnc.Traits
if (!info.Types.Overlaps(types)) if (!info.Types.Overlaps(types))
return; return;
var transform = new Transform(self, info.IntoActor) var transform = new Transform(info.IntoActor)
{ {
ForceHealthPercentage = info.ForceHealthPercentage, ForceHealthPercentage = info.ForceHealthPercentage,
Faction = faction, Faction = faction,

View File

@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Cnc.Traits
void Transform(Actor self) void Transform(Actor self)
{ {
var transform = new Transform(self, info.IntoActor); var transform = new Transform(info.IntoActor);
var facing = self.TraitOrDefault<IFacing>(); var facing = self.TraitOrDefault<IFacing>();
if (facing != null) if (facing != null)

View File

@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Activities
if (enterLegacyHut != null) if (enterLegacyHut != null)
enterLegacyHut.Repair(self); enterLegacyHut.Repair(self);
else if (enterHut != null) else if (enterHut != null)
enterHut.Repair(enterActor, self); enterHut.Repair(self);
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", notification, self.Owner.Faction.InternalName); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", notification, self.Owner.Faction.InternalName);

View File

@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Activities
if (targetActor != enterActor) if (targetActor != enterActor)
return; return;
if (!enterCargo.CanLoad(enterActor, self)) if (!enterCargo.CanLoad(self))
return; return;
enterCargo.Load(enterActor, self); enterCargo.Load(enterActor, self);

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Activities
public bool SkipMakeAnims = false; public bool SkipMakeAnims = false;
public string Faction = null; public string Faction = null;
public Transform(Actor self, string toActor) public Transform(string toActor)
{ {
ToActor = toActor; ToActor = toActor;
} }

View File

@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Activities
public override bool Tick(Actor self) public override bool Tick(Actor self)
{ {
if (IsCanceling || cargo.IsEmpty(self)) if (IsCanceling || cargo.IsEmpty())
return true; return true;
if (cargo.CanUnload()) if (cargo.CanUnload())
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Activities
foreach (var inu in notifiers) foreach (var inu in notifiers)
inu.Unloading(self); inu.Unloading(self);
var actor = cargo.Peek(self); var actor = cargo.Peek();
var spawn = self.CenterPosition; var spawn = self.CenterPosition;
var exitSubCell = ChooseExitSubCell(actor); var exitSubCell = ChooseExitSubCell(actor);

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
protected abstract void AddCellsToPlayerShroud(Actor self, Player player, PPos[] uv); protected abstract void AddCellsToPlayerShroud(Actor self, Player player, PPos[] uv);
protected abstract void RemoveCellsFromPlayerShroud(Actor self, Player player); protected abstract void RemoveCellsFromPlayerShroud(Actor self, Player player);
public AffectsShroud(Actor self, AffectsShroudInfo info) public AffectsShroud(AffectsShroudInfo info)
: base(info) : base(info)
{ {
if (Info.Type == VisibilityType.Footprint) if (Info.Type == VisibilityType.Footprint)

View File

@@ -224,8 +224,6 @@ namespace OpenRA.Mods.Common.Traits
INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyActorDisposing, INotifyBecomingIdle, ICreationActivity, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyActorDisposing, INotifyBecomingIdle, ICreationActivity,
IActorPreviewInitModifier, IDeathActorInitModifier, IIssueDeployOrder, IIssueOrder, IResolveOrder, IOrderVoice IActorPreviewInitModifier, IDeathActorInitModifier, IIssueDeployOrder, IIssueOrder, IResolveOrder, IOrderVoice
{ {
static readonly (CPos, SubCell)[] NoCells = { };
readonly Actor self; readonly Actor self;
Repairable repairable; Repairable repairable;

View File

@@ -133,7 +133,7 @@ namespace OpenRA.Mods.Common.Traits
} }
} }
public void Repair(Actor self, Actor repairer) public void Repair(Actor repairer)
{ {
if (Info.RepairPropagationDelay > 0) if (Info.RepairPropagationDelay > 0)
{ {

View File

@@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
// Manually manage the inner activity queue // Manually manage the inner activity queue
var activity = currentTransform ?? transform.GetTransformActivity(self); var activity = currentTransform ?? transform.GetTransformActivity();
if (!order.Queued) if (!order.Queued)
activity.NextActivity?.Cancel(self); activity.NextActivity?.Cancel(self);

View File

@@ -99,7 +99,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
// Manually manage the inner activity queue // Manually manage the inner activity queue
var activity = currentTransform ?? transform.GetTransformActivity(self); var activity = currentTransform ?? transform.GetTransformActivity();
if (!order.Queued) if (!order.Queued)
activity.NextActivity?.Cancel(self); activity.NextActivity?.Cancel(self);

View File

@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
// Manually manage the inner activity queue // Manually manage the inner activity queue
var activity = currentTransform ?? transform.GetTransformActivity(self); var activity = currentTransform ?? transform.GetTransformActivity();
if (!order.Queued) if (!order.Queued)
activity.NextActivity?.Cancel(self); activity.NextActivity?.Cancel(self);

View File

@@ -133,7 +133,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
// Manually manage the inner activity queue // Manually manage the inner activity queue
var activity = currentTransform ?? transform.GetTransformActivity(self); var activity = currentTransform ?? transform.GetTransformActivity();
if (!order.Queued) if (!order.Queued)
activity.NextActivity?.Cancel(self); activity.NextActivity?.Cancel(self);

View File

@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
// Manually manage the inner activity queue // Manually manage the inner activity queue
var activity = currentTransform ?? transform.GetTransformActivity(self); var activity = currentTransform ?? transform.GetTransformActivity();
if (!order.Queued) if (!order.Queued)
activity.NextActivity?.Cancel(self); activity.NextActivity?.Cancel(self);

View File

@@ -243,11 +243,11 @@ namespace OpenRA.Mods.Common.Traits
return false; return false;
} }
return !IsEmpty(self) && (aircraft == null || aircraft.CanLand(self.Location, blockedByMobile: false)) return !IsEmpty() && (aircraft == null || aircraft.CanLand(self.Location, blockedByMobile: false))
&& CurrentAdjacentCells != null && CurrentAdjacentCells.Any(c => Passengers.Any(p => !p.IsDead && p.Trait<IPositionable>().CanEnterCell(c, null, check))); && CurrentAdjacentCells != null && CurrentAdjacentCells.Any(c => Passengers.Any(p => !p.IsDead && p.Trait<IPositionable>().CanEnterCell(c, null, check)));
} }
public bool CanLoad(Actor self, Actor a) public bool CanLoad(Actor a)
{ {
return reserves.Contains(a) || HasSpace(GetWeight(a)); return reserves.Contains(a) || HasSpace(GetWeight(a));
} }
@@ -320,16 +320,16 @@ namespace OpenRA.Mods.Common.Traits
public string VoicePhraseForOrder(Actor self, Order order) public string VoicePhraseForOrder(Actor self, Order order)
{ {
if (order.OrderString != "Unload" || IsEmpty(self) || !self.HasVoice(Info.UnloadVoice)) if (order.OrderString != "Unload" || IsEmpty() || !self.HasVoice(Info.UnloadVoice))
return null; return null;
return Info.UnloadVoice; return Info.UnloadVoice;
} }
public bool HasSpace(int weight) { return totalWeight + reservedWeight + weight <= Info.MaxWeight; } public bool HasSpace(int weight) { return totalWeight + reservedWeight + weight <= Info.MaxWeight; }
public bool IsEmpty(Actor self) { return cargo.Count == 0; } public bool IsEmpty() { return cargo.Count == 0; }
public Actor Peek(Actor self) { return cargo.Last(); } public Actor Peek() { return cargo.Last(); }
public Actor Unload(Actor self, Actor passenger = null) public Actor Unload(Actor self, Actor passenger = null)
{ {
@@ -406,7 +406,7 @@ namespace OpenRA.Mods.Common.Traits
void INotifyKilled.Killed(Actor self, AttackInfo e) void INotifyKilled.Killed(Actor self, AttackInfo e)
{ {
if (Info.EjectOnDeath) if (Info.EjectOnDeath)
while (!IsEmpty(self) && CanUnload(BlockedByActor.All)) while (!IsEmpty() && CanUnload(BlockedByActor.All))
{ {
var passenger = Unload(self); var passenger = Unload(self);
var cp = self.CenterPosition; var cp = self.CenterPosition;
@@ -445,7 +445,7 @@ namespace OpenRA.Mods.Common.Traits
if (!Info.EjectOnSell || cargo == null) if (!Info.EjectOnSell || cargo == null)
return; return;
while (!IsEmpty(self)) while (!IsEmpty())
SpawnPassenger(Unload(self)); SpawnPassenger(Unload(self));
} }

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Bot types that trigger the condition.")] [Desc("Bot types that trigger the condition.")]
public readonly string[] Bots = Array.Empty<string>(); public readonly string[] Bots = Array.Empty<string>();
public override object Create(ActorInitializer init) { return new GrantConditionOnBotOwner(init, this); } public override object Create(ActorInitializer init) { return new GrantConditionOnBotOwner(this); }
} }
public class GrantConditionOnBotOwner : INotifyCreated, INotifyOwnerChanged public class GrantConditionOnBotOwner : INotifyCreated, INotifyOwnerChanged
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
int conditionToken = Actor.InvalidConditionToken; int conditionToken = Actor.InvalidConditionToken;
public GrantConditionOnBotOwner(ActorInitializer init, GrantConditionOnBotOwnerInfo info) public GrantConditionOnBotOwner(GrantConditionOnBotOwnerInfo info)
{ {
this.info = info; this.info = info;
} }

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("List of required prerequisites.")] [Desc("List of required prerequisites.")]
public readonly string[] Prerequisites = Array.Empty<string>(); public readonly string[] Prerequisites = Array.Empty<string>();
public override object Create(ActorInitializer init) { return new GrantConditionOnPrerequisite(init.Self, this); } public override object Create(ActorInitializer init) { return new GrantConditionOnPrerequisite(this); }
} }
public class GrantConditionOnPrerequisite : INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged public class GrantConditionOnPrerequisite : INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
GrantConditionOnPrerequisiteManager globalManager; GrantConditionOnPrerequisiteManager globalManager;
int conditionToken = Actor.InvalidConditionToken; int conditionToken = Actor.InvalidConditionToken;
public GrantConditionOnPrerequisite(Actor self, GrantConditionOnPrerequisiteInfo info) public GrantConditionOnPrerequisite(GrantConditionOnPrerequisiteInfo info)
{ {
this.info = info; this.info = info;
} }

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Relationship the watching player needs to see the generated shroud.")] [Desc("Relationship the watching player needs to see the generated shroud.")]
public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Neutral | PlayerRelationship.Enemy; public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Neutral | PlayerRelationship.Enemy;
public override object Create(ActorInitializer init) { return new CreatesShroud(init.Self, this); } public override object Create(ActorInitializer init) { return new CreatesShroud(this); }
} }
public class CreatesShroud : AffectsShroud public class CreatesShroud : AffectsShroud
@@ -28,8 +28,8 @@ namespace OpenRA.Mods.Common.Traits
readonly CreatesShroudInfo info; readonly CreatesShroudInfo info;
IEnumerable<int> rangeModifiers; IEnumerable<int> rangeModifiers;
public CreatesShroud(Actor self, CreatesShroudInfo info) public CreatesShroud(CreatesShroudInfo info)
: base(self, info) : base(info)
{ {
this.info = info; this.info = info;
} }

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Allow palette modifiers to change the palette.")] [Desc("Allow palette modifiers to change the palette.")]
public readonly bool AllowModifiers = true; public readonly bool AllowModifiers = true;
public override object Create(ActorInitializer init) { return new ColorPickerPalette(init.World, this); } public override object Create(ActorInitializer init) { return new ColorPickerPalette(this); }
} }
class ColorPickerPalette : ILoadsPalettes, IProvidesAssetBrowserColorPickerPalettes, ITickRender class ColorPickerPalette : ILoadsPalettes, IProvidesAssetBrowserColorPickerPalettes, ITickRender
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits
readonly ColorPickerManagerInfo colorManager; readonly ColorPickerManagerInfo colorManager;
Color color; Color color;
public ColorPickerPalette(World world, ColorPickerPaletteInfo info) public ColorPickerPalette(ColorPickerPaletteInfo info)
{ {
// All users need to use the same TraitInfo instance, chosen as the default mod rules // All users need to use the same TraitInfo instance, chosen as the default mod rules
colorManager = Game.ModData.DefaultRules.Actors[SystemActors.World].TraitInfo<ColorPickerManagerInfo>(); colorManager = Game.ModData.DefaultRules.Actors[SystemActors.World].TraitInfo<ColorPickerManagerInfo>();

View File

@@ -81,10 +81,10 @@ namespace OpenRA.Mods.Common.Traits
OnExitedDropRange(self); OnExitedDropRange(self);
// Are we able to drop the next trooper? // Are we able to drop the next trooper?
if (!inDropRange || cargo.IsEmpty(self) || !self.World.Map.Contains(self.Location)) if (!inDropRange || cargo.IsEmpty() || !self.World.Map.Contains(self.Location))
return; return;
var dropActor = cargo.Peek(self); var dropActor = cargo.Peek();
var dropPositionable = dropActor.Trait<IPositionable>(); var dropPositionable = dropActor.Trait<IPositionable>();
var dropCell = self.Location; var dropCell = self.Location;
var dropSubCell = dropPositionable.GetAvailableSubCell(dropCell); var dropSubCell = dropPositionable.GetAvailableSubCell(dropCell);

View File

@@ -27,14 +27,14 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Should the level-up animation be suppressed when actor is created?")] [Desc("Should the level-up animation be suppressed when actor is created?")]
public readonly bool SuppressLevelupAnimation = true; public readonly bool SuppressLevelupAnimation = true;
public override object Create(ActorInitializer init) { return new ProducibleWithLevel(init, this); } public override object Create(ActorInitializer init) { return new ProducibleWithLevel(this); }
} }
public class ProducibleWithLevel : INotifyCreated public class ProducibleWithLevel : INotifyCreated
{ {
readonly ProducibleWithLevelInfo info; readonly ProducibleWithLevelInfo info;
public ProducibleWithLevel(ActorInitializer init, ProducibleWithLevelInfo info) public ProducibleWithLevel(ProducibleWithLevelInfo info)
{ {
this.info = info; this.info = info;
} }

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Can this actor reveal shroud generated by the `" + nameof(CreatesShroud) + "` trait?")] [Desc("Can this actor reveal shroud generated by the `" + nameof(CreatesShroud) + "` trait?")]
public readonly bool RevealGeneratedShroud = true; public readonly bool RevealGeneratedShroud = true;
public override object Create(ActorInitializer init) { return new RevealsShroud(init.Self, this); } public override object Create(ActorInitializer init) { return new RevealsShroud(this); }
} }
public class RevealsShroud : AffectsShroud public class RevealsShroud : AffectsShroud
@@ -32,8 +32,8 @@ namespace OpenRA.Mods.Common.Traits
readonly Shroud.SourceType type; readonly Shroud.SourceType type;
IEnumerable<int> rangeModifiers; IEnumerable<int> rangeModifiers;
public RevealsShroud(Actor self, RevealsShroudInfo info) public RevealsShroud(RevealsShroudInfo info)
: base(self, info) : base(info)
{ {
this.info = info; this.info = info;
type = info.RevealGeneratedShroud ? Shroud.SourceType.Visibility type = info.RevealGeneratedShroud ? Shroud.SourceType.Visibility

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
[Desc("Should the sound be delayed relative to preparation or actual attack?")] [Desc("Should the sound be delayed relative to preparation or actual attack?")]
public readonly AttackDelayType DelayRelativeTo = AttackDelayType.Preparation; public readonly AttackDelayType DelayRelativeTo = AttackDelayType.Preparation;
public override object Create(ActorInitializer init) { return new AttackSounds(init, this); } public override object Create(ActorInitializer init) { return new AttackSounds(this); }
} }
public class AttackSounds : ConditionalTrait<AttackSoundsInfo>, INotifyAttack, ITick public class AttackSounds : ConditionalTrait<AttackSoundsInfo>, INotifyAttack, ITick
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
readonly AttackSoundsInfo info; readonly AttackSoundsInfo info;
int tick; int tick;
public AttackSounds(ActorInitializer init, AttackSoundsInfo info) public AttackSounds(AttackSoundsInfo info)
: base(info) : base(info)
{ {
this.info = info; this.info = info;

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
var facing = crusher.TraitOrDefault<IFacing>(); var facing = crusher.TraitOrDefault<IFacing>();
var transform = new Transform(crusher, info.IntoActor) { Faction = faction }; var transform = new Transform(info.IntoActor) { Faction = faction };
if (facing != null) if (facing != null)
transform.Facing = facing.Facing; transform.Facing = facing.Facing;

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
var facing = self.TraitOrDefault<IFacing>(); var facing = self.TraitOrDefault<IFacing>();
var transform = new Transform(self, info.IntoActor) { ForceHealthPercentage = info.ForceHealthPercentage, Faction = faction }; var transform = new Transform(info.IntoActor) { ForceHealthPercentage = info.ForceHealthPercentage, Faction = faction };
if (facing != null) transform.Facing = facing.Facing; if (facing != null) transform.Facing = facing.Facing;
transform.SkipMakeAnims = info.SkipMakeAnims; transform.SkipMakeAnims = info.SkipMakeAnims;
self.QueueActivity(false, transform); self.QueueActivity(false, transform);

View File

@@ -89,9 +89,9 @@ namespace OpenRA.Mods.Common.Traits
return buildingInfo == null || self.World.CanPlaceBuilding(self.Location + Info.Offset, actorInfo, buildingInfo, self); return buildingInfo == null || self.World.CanPlaceBuilding(self.Location + Info.Offset, actorInfo, buildingInfo, self);
} }
public Activity GetTransformActivity(Actor self) public Activity GetTransformActivity()
{ {
return new Transform(self, Info.IntoActor) return new Transform(Info.IntoActor)
{ {
Offset = Info.Offset, Offset = Info.Offset,
Facing = Info.Facing, Facing = Info.Facing,
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
} }
self.QueueActivity(queued, GetTransformActivity(self)); self.QueueActivity(queued, GetTransformActivity());
} }
public void ResolveOrder(Actor self, Order order) public void ResolveOrder(Actor self, Order order)

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
throw new YamlException($"{nameof(ActorSpawnManager)}.{nameof(SpawnInterval)}'s value(s) must not be less than 0"); throw new YamlException($"{nameof(ActorSpawnManager)}.{nameof(SpawnInterval)}'s value(s) must not be less than 0");
} }
public override object Create(ActorInitializer init) { return new ActorSpawnManager(init.Self, this); } public override object Create(ActorInitializer init) { return new ActorSpawnManager(this); }
} }
public class ActorSpawnManager : ConditionalTrait<ActorSpawnManagerInfo>, ITick public class ActorSpawnManager : ConditionalTrait<ActorSpawnManagerInfo>, ITick
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
int spawnCountdown; int spawnCountdown;
int actorsPresent; int actorsPresent;
public ActorSpawnManager(Actor self, ActorSpawnManagerInfo info) public ActorSpawnManager(ActorSpawnManagerInfo info)
: base(info) : base(info)
{ {
this.info = info; this.info = info;

View File

@@ -276,10 +276,7 @@ namespace OpenRA.Mods.Common.Widgets
if (world.OrderGenerator is ForceModifiersOrderGenerator fmog && fmog.Modifiers.HasFlag(modifiers)) if (world.OrderGenerator is ForceModifiersOrderGenerator fmog && fmog.Modifiers.HasFlag(modifiers))
return true; return true;
if (world.OrderGenerator is UnitOrderGenerator uog && Game.GetModifierKeys().HasFlag(modifiers)) return world.OrderGenerator is UnitOrderGenerator && Game.GetModifierKeys().HasFlag(modifiers);
return true;
return false;
} }
void UpdateStateIfNecessary() void UpdateStateIfNecessary()