Skip to content

Commit

Permalink
More style fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
MustaphaTR committed Mar 15, 2024
1 parent b72cef1 commit 233aa77
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ StatsDropDownOption CreateStatsOption(string title, ObserverStatsRVPanel panel,

var statsDropDownOptions = new StatsDropDownOption[]
{
new StatsDropDownOption
new()
{
Title = TranslationProvider.GetString(InformationNone),
IsSelected = () => activePanel == ObserverStatsRVPanel.None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ StatsDropDownOption CreateStatsOption(string title, ObserverStatsSPPanel panel,

var statsDropDownOptions = new StatsDropDownOption[]
{
new StatsDropDownOption
new()
{
Title = TranslationProvider.GetString(InformationNone),
IsSelected = () => activePanel == ObserverStatsSPPanel.None,
Expand Down
4 changes: 2 additions & 2 deletions OpenRA.Mods.AS/Projectiles/WarheadTrailProjectile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public enum FireMode
public class WarheadTrailProjectileInfo : IProjectileInfo, IRulesetLoaded<WeaponInfo>
{
[Desc("Warhead explosion offsets")]
public readonly WVec[] Offsets = { new WVec(0, 1, 0) };
public readonly WVec[] Offsets = { new(0, 1, 0) };

[Desc("Projectile speed in WDist / tick, two values indicate variable velocity.")]
public readonly WDist[] Speed = { new WDist(17) };
public readonly WDist[] Speed = { new(17) };

[Desc("Maximum inaccuracy offset.")]
public readonly WDist Inaccuracy = WDist.Zero;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ List<MiniYamlNode> IGameSaveTraitData.IssueTraitData(Actor self)

return new List<MiniYamlNode>()
{
new MiniYamlNode("InitialBaseCenter", FieldSaver.FormatValue(initialBaseCenter))
new("InitialBaseCenter", FieldSaver.FormatValue(initialBaseCenter))
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ List<MiniYamlNode> IGameSaveTraitData.IssueTraitData(Actor self)

return new List<MiniYamlNode>()
{
new MiniYamlNode("WaitingPowers", "", waitingPowersNodes)
new("WaitingPowers", "", waitingPowersNodes)
};
}

Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.AS/Warheads/FireFragmentWarhead.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class FireFragmentWarhead : WarheadAS, IRulesetLoaded<WeaponInfo>
public readonly int Chance = 100;

[Desc("Target offsets relative to warhead explosion.")]
public readonly WVec[] Offsets = { new WVec(0, 0, 0) };
public readonly WVec[] Offsets = { new(0, 0, 0) };

[Desc("If set, Offset's Z value will be used as absolute height instead of explosion height.")]
public readonly bool UseZOffsetAsAbsoluteHeight = false;
Expand Down
12 changes: 1 addition & 11 deletions OpenRA.Mods.Common/Projectiles/GravityBomb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void Tick(World world)
pos += velocity;
velocity += acceleration;

if (info.PointDefenseTypes.Any())
if (!info.PointDefenseTypes.IsEmpty)
{
var shouldExplode = world.ActorsWithTrait<IPointDefense>().Any(x => x.Trait.Destroy(pos, args.SourceActor.Owner, info.PointDefenseTypes));
if (shouldExplode)
Expand Down Expand Up @@ -132,16 +132,6 @@ public void Tick(World world)
args.Weapon.Impact(Target.FromPos(pos), warheadArgs);
}

if (info.PointDefenseTypes.Any())
{
var shouldExplode = world.ActorsWithTrait<IPointDefense>().Any(x => x.Trait.Destroy(pos, args.SourceActor.Owner, info.PointDefenseTypes));
if (shouldExplode)
{
args.Weapon.Impact(Target.FromPos(pos), new WarheadArgs(args));
world.AddFrameEndTask(w => w.Remove(this));
}
}

anim?.Tick();
}

Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Projectiles/Missile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ public void Tick(World world)
pos = blockedPos;
shouldExplode = true;
}
else if (info.PointDefenseTypes.Any() && world.ActorsWithTrait<IPointDefense>().Any(a => a.Trait.Destroy(pos, args.SourceActor.Owner, info.PointDefenseTypes)))
else if (!info.PointDefenseTypes.IsEmpty && world.ActorsWithTrait<IPointDefense>().Any(a => a.Trait.Destroy(pos, args.SourceActor.Owner, info.PointDefenseTypes)))
{
shouldExplode = true;
}
Expand Down

0 comments on commit 233aa77

Please sign in to comment.