Use expression body syntax

This commit is contained in:
teinarss
2021-02-25 20:52:13 +01:00
committed by Paul Chote
parent 555c43843b
commit 4a1e4f3e16
403 changed files with 1342 additions and 2031 deletions

View File

@@ -162,7 +162,7 @@ namespace OpenRA.Mods.Cnc.Traits
}
Color ISelectionBar.GetColor() { return Info.TimeBarColor; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
bool ISelectionBar.DisplayWhenEmpty => false;
void ModifyActorInit(TypeDictionary init)
{

View File

@@ -254,6 +254,6 @@ namespace OpenRA.Mods.Cnc.Traits
}
Color ISelectionBar.GetColor() { return info.TimeBarColor; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
bool ISelectionBar.DisplayWhenEmpty => false;
}
}

View File

@@ -37,13 +37,7 @@ namespace OpenRA.Mods.Cnc.Traits
disguise = self.Trait<Disguise>();
}
public ITooltipInfo TooltipInfo
{
get
{
return disguise.Disguised ? disguise.AsTooltipInfo : Info;
}
}
public ITooltipInfo TooltipInfo => disguise.Disguised ? disguise.AsTooltipInfo : Info;
public Player Owner
{
@@ -98,7 +92,7 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly string Cursor = "ability";
[GrantedConditionReference]
public IEnumerable<string> LinterConditions { get { return DisguisedAsConditions.Values; } }
public IEnumerable<string> LinterConditions => DisguisedAsConditions.Values;
public override object Create(ActorInitializer init) { return new Disguise(init.Self, this); }
}
@@ -110,8 +104,8 @@ namespace OpenRA.Mods.Cnc.Traits
public Player AsPlayer { get; private set; }
public ITooltipInfo AsTooltipInfo { get; private set; }
public bool Disguised { get { return AsPlayer != null; } }
public Player Owner { get { return AsPlayer; } }
public bool Disguised => AsPlayer != null;
public Player Owner => AsPlayer;
readonly Actor self;
readonly DisguiseInfo info;

View File

@@ -337,8 +337,8 @@ namespace OpenRA.Mods.Cnc.Traits
class BeginMinefieldOrderTargeter : IOrderTargeter
{
public string OrderID { get { return "BeginMinefield"; } }
public int OrderPriority { get { return 5; } }
public string OrderID => "BeginMinefield";
public int OrderPriority => 5;
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)

View File

@@ -149,10 +149,7 @@ namespace OpenRA.Mods.Cnc.Traits
chargeTick = Info.ChargeDelay;
}
public bool CanTeleport
{
get { return chargeTick <= 0; }
}
public bool CanTeleport => chargeTick <= 0;
float ISelectionBar.GetValue()
{
@@ -160,7 +157,7 @@ namespace OpenRA.Mods.Cnc.Traits
}
Color ISelectionBar.GetColor() { return Color.Magenta; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
bool ISelectionBar.DisplayWhenEmpty => false;
}
class PortableChronoOrderTargeter : IOrderTargeter
@@ -172,8 +169,8 @@ namespace OpenRA.Mods.Cnc.Traits
this.targetCursor = targetCursor;
}
public string OrderID { get { return "PortableChronoTeleport"; } }
public int OrderPriority { get { return 5; } }
public string OrderID => "PortableChronoTeleport";
public int OrderPriority => 5;
public bool IsQueued { get; protected set; }
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Cnc.Traits
return new ReadOnlyDictionary<CPos, SubCell>(occupied);
}
bool IOccupySpaceInfo.SharesCell { get { return false; } }
bool IOccupySpaceInfo.SharesCell => false;
// Used to determine if actor can spawn
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
@@ -70,19 +70,19 @@ namespace OpenRA.Mods.Cnc.Traits
[Sync]
public WAngle Facing
{
get { return orientation.Yaw; }
set { orientation = orientation.WithYaw(value); }
get => orientation.Yaw;
set => orientation = orientation.WithYaw(value);
}
public WRot Orientation { get { return orientation; } }
public WRot Orientation => orientation;
[Sync]
public WPos CenterPosition { get; private set; }
public CPos TopLeft { get { return self.World.Map.CellContaining(CenterPosition); } }
public CPos TopLeft => self.World.Map.CellContaining(CenterPosition);
// Isn't used anyway
public WAngle TurnSpeed { get { return WAngle.Zero; } }
public WAngle TurnSpeed => WAngle.Zero;
CPos cachedLocation;
@@ -142,10 +142,7 @@ namespace OpenRA.Mods.Cnc.Traits
Facing = Facing == Left ? Right : Left;
}
int MovementSpeed
{
get { return OpenRA.Mods.Common.Util.ApplyPercentageModifiers(Info.Speed, speedModifiers); }
}
int MovementSpeed => OpenRA.Mods.Common.Util.ApplyPercentageModifiers(Info.Speed, speedModifiers);
public (CPos, SubCell)[] OccupiedCells() { return new[] { (TopLeft, SubCell.FullCell) }; }
@@ -223,7 +220,7 @@ namespace OpenRA.Mods.Cnc.Traits
public CPos NearestMoveableCell(CPos cell) { return cell; }
// Actors with TDGunboat always move
public MovementType CurrentMovementTypes { get { return MovementType.Horizontal; } set { } }
public MovementType CurrentMovementTypes { get => MovementType.Horizontal; set { } }
public bool CanEnterTargetNow(Actor self, in Target target)
{

View File

@@ -58,6 +58,6 @@ namespace OpenRA.Mods.Cnc.Traits
this.remaining = remaining;
}
string IConditionTimerWatcher.Condition { get { return info.Condition; } }
string IConditionTimerWatcher.Condition => info.Condition;
}
}