Use expression body syntax
This commit is contained in:
@@ -27,6 +27,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public ActorSpawner(ActorSpawnerInfo info)
|
||||
: base(info) { }
|
||||
|
||||
public HashSet<string> Types { get { return Info.Types; } }
|
||||
public HashSet<string> Types => Info.Types;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
RemoveCellsFromPlayerShroud(self, p);
|
||||
}
|
||||
|
||||
public virtual WDist Range { get { return CachedTraitDisabled ? WDist.Zero : Info.Range; } }
|
||||
public virtual WDist Range => CachedTraitDisabled ? WDist.Zero : Info.Range;
|
||||
|
||||
void INotifyMoving.MovementTypeChanged(Actor self, MovementType type)
|
||||
{
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) { return new ReadOnlyDictionary<CPos, SubCell>(); }
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell { get { return false; } }
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
// Used to determine if an aircraft can spawn landed
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
@@ -232,30 +232,30 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
public WAngle Facing
|
||||
{
|
||||
get { return orientation.Yaw; }
|
||||
set { orientation = orientation.WithYaw(value); }
|
||||
get => orientation.Yaw;
|
||||
set => orientation = orientation.WithYaw(value);
|
||||
}
|
||||
|
||||
public WAngle Pitch
|
||||
{
|
||||
get { return orientation.Pitch; }
|
||||
set { orientation = orientation.WithPitch(value); }
|
||||
get => orientation.Pitch;
|
||||
set => orientation = orientation.WithPitch(value);
|
||||
}
|
||||
|
||||
public WAngle Roll
|
||||
{
|
||||
get { return orientation.Roll; }
|
||||
set { orientation = orientation.WithRoll(value); }
|
||||
get => orientation.Roll;
|
||||
set => orientation = orientation.WithRoll(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 WAngle TurnSpeed { get { return !IsTraitDisabled && !IsTraitPaused ? Info.TurnSpeed : WAngle.Zero; } }
|
||||
public WAngle? IdleTurnSpeed { get { return Info.IdleTurnSpeed; } }
|
||||
public CPos TopLeft => self.World.Map.CellContaining(CenterPosition);
|
||||
public WAngle TurnSpeed => !IsTraitDisabled && !IsTraitPaused ? Info.TurnSpeed : WAngle.Zero;
|
||||
public WAngle? IdleTurnSpeed => Info.IdleTurnSpeed;
|
||||
|
||||
public Actor ReservedActor { get; private set; }
|
||||
public bool MayYieldReservation { get; private set; }
|
||||
@@ -272,7 +272,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return self.CenterPosition - new WVec(WDist.Zero, WDist.Zero, self.World.Map.DistanceAboveTerrain(self.CenterPosition));
|
||||
}
|
||||
|
||||
public bool AtLandAltitude { get { return self.World.Map.DistanceAboveTerrain(GetPosition()) == LandAltitude; } }
|
||||
public bool AtLandAltitude => self.World.Map.DistanceAboveTerrain(GetPosition()) == LandAltitude;
|
||||
|
||||
bool airborne;
|
||||
bool cruising;
|
||||
@@ -595,10 +595,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return allowedToEnterRearmer || allowedToEnterRepairer;
|
||||
}
|
||||
|
||||
public int MovementSpeed
|
||||
{
|
||||
get { return !IsTraitDisabled && !IsTraitPaused ? Util.ApplyPercentageModifiers(Info.Speed, speedModifiers) : 0; }
|
||||
}
|
||||
public int MovementSpeed => !IsTraitDisabled && !IsTraitPaused ? Util.ApplyPercentageModifiers(Info.Speed, speedModifiers) : 0;
|
||||
|
||||
public (CPos Cell, SubCell SubCell)[] OccupiedCells()
|
||||
{
|
||||
@@ -967,10 +964,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public MovementType CurrentMovementTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return movementTypes;
|
||||
}
|
||||
get => movementTypes;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -1247,7 +1241,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly Aircraft aircraft;
|
||||
|
||||
public string OrderID { get; protected set; }
|
||||
public int OrderPriority { get { return 4; } }
|
||||
public int OrderPriority => 4;
|
||||
public bool IsQueued { get; protected set; }
|
||||
|
||||
public AircraftMoveOrderTargeter(Aircraft aircraft)
|
||||
|
||||
@@ -60,8 +60,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
// We return init.Self.Owner if there's no effective owner
|
||||
bool IEffectiveOwner.Disguised { get { return true; } }
|
||||
Player IEffectiveOwner.Owner { get { return effectiveOwner; } }
|
||||
bool IEffectiveOwner.Disguised => true;
|
||||
Player IEffectiveOwner.Owner => effectiveOwner;
|
||||
|
||||
void INotifyCreated.Created(Actor self)
|
||||
{
|
||||
|
||||
@@ -59,8 +59,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
public int CurrentAmmoCount { get; private set; }
|
||||
|
||||
public bool HasAmmo { get { return CurrentAmmoCount > 0; } }
|
||||
public bool HasFullAmmo { get { return CurrentAmmoCount == Info.Ammo; } }
|
||||
public bool HasAmmo => CurrentAmmoCount > 0;
|
||||
public bool HasFullAmmo => CurrentAmmoCount == Info.Ammo;
|
||||
|
||||
public AmmoPool(Actor self, AmmoPoolInfo info)
|
||||
{
|
||||
|
||||
@@ -363,7 +363,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsReloading { get { return FireDelay > 0 || IsTraitDisabled; } }
|
||||
public virtual bool IsReloading => FireDelay > 0 || IsTraitDisabled;
|
||||
|
||||
public WVec MuzzleOffset(Actor self, Barrel b)
|
||||
{
|
||||
@@ -396,6 +396,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return WRot.FromYaw(b.Yaw).Rotate(turret != null ? turret.WorldOrientation : self.Orientation);
|
||||
}
|
||||
|
||||
public Actor Actor { get { return self; } }
|
||||
public Actor Actor => self;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
public bool IsAiming { get; set; }
|
||||
|
||||
public IEnumerable<Armament> Armaments { get { return getArmaments(); } }
|
||||
public IEnumerable<Armament> Armaments => getArmaments();
|
||||
|
||||
protected IFacing facing;
|
||||
protected IPositionable positionable;
|
||||
|
||||
@@ -155,6 +155,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ClearSelectionOnLeftClick { get { return false; } }
|
||||
public override bool ClearSelectionOnLeftClick => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public WDist MinimumDistance { get { return info.MinDistance; } }
|
||||
public WDist MinimumDistance => info.MinDistance;
|
||||
|
||||
// No longer want to be carried
|
||||
void ICallForTransport.MovementCancelled(Actor self) { MovementCancelled(self); }
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
int nextScanTime = 0;
|
||||
|
||||
public UnitStance Stance { get { return stance; } }
|
||||
public UnitStance Stance => stance;
|
||||
|
||||
[Sync]
|
||||
public Actor Aggressor;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public BlocksProjectiles(Actor self, BlocksProjectilesInfo info)
|
||||
: base(info) { }
|
||||
|
||||
WDist IBlocksProjectiles.BlockingHeight { get { return Info.Height; } }
|
||||
WDist IBlocksProjectiles.BlockingHeight => Info.Height;
|
||||
|
||||
public static bool AnyBlockingActorAt(World world, WPos pos)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly Lazy<int> quantizedFacings;
|
||||
|
||||
[Sync]
|
||||
public int QuantizedFacings { get { return quantizedFacings.Value; } }
|
||||
public int QuantizedFacings => quantizedFacings.Value;
|
||||
|
||||
public BodyOrientation(ActorInitializer init, BodyOrientationInfo info)
|
||||
{
|
||||
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
}
|
||||
|
||||
public WAngle CameraPitch { get { return info.CameraPitch; } }
|
||||
public WAngle CameraPitch => info.CameraPitch;
|
||||
|
||||
public WVec LocalToWorld(WVec vec)
|
||||
{
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return randomConstructionYard != null ? randomConstructionYard.Location : initialBaseCenter;
|
||||
}
|
||||
|
||||
public CPos DefenseCenter { get { return defenseCenter; } }
|
||||
public CPos DefenseCenter => defenseCenter;
|
||||
|
||||
readonly World world;
|
||||
readonly Player player;
|
||||
@@ -194,10 +194,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
defenseCenter = newLocation;
|
||||
}
|
||||
|
||||
bool IBotRequestPauseUnitProduction.PauseUnitProduction
|
||||
{
|
||||
get { return !IsTraitDisabled && !HasAdequateRefineryCount; }
|
||||
}
|
||||
bool IBotRequestPauseUnitProduction.PauseUnitProduction => !IsTraitDisabled && !HasAdequateRefineryCount;
|
||||
|
||||
void IBotTick.BotTick(IBot bot)
|
||||
{
|
||||
@@ -261,25 +258,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return info != null && world.IsCellBuildable(x, null, info);
|
||||
}
|
||||
|
||||
public bool HasAdequateRefineryCount
|
||||
{
|
||||
get
|
||||
{
|
||||
// Require at least one refinery, unless we can't build it.
|
||||
return !Info.RefineryTypes.Any() ||
|
||||
AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount ||
|
||||
AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 ||
|
||||
AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0;
|
||||
}
|
||||
}
|
||||
// Require at least one refinery, unless we can't build it.
|
||||
public bool HasAdequateRefineryCount =>
|
||||
!Info.RefineryTypes.Any() ||
|
||||
AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount ||
|
||||
AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 ||
|
||||
AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0;
|
||||
|
||||
int MinimumRefineryCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return AIUtils.CountBuildingByCommonName(Info.BarracksTypes, player) > 0 ? Info.InititalMinimumRefineryCount + Info.AdditionalMinimumRefineryCount : Info.InititalMinimumRefineryCount;
|
||||
}
|
||||
}
|
||||
int MinimumRefineryCount => AIUtils.CountBuildingByCommonName(Info.BarracksTypes, player) > 0 ? Info.InititalMinimumRefineryCount + Info.AdditionalMinimumRefineryCount : Info.InititalMinimumRefineryCount;
|
||||
|
||||
List<MiniYamlNode> IGameSaveTraitData.IssueTraitData(Actor self)
|
||||
{
|
||||
|
||||
@@ -68,23 +68,17 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
FuzzyStateMachine.Update(this);
|
||||
}
|
||||
|
||||
public bool IsValid { get { return Units.Any(); } }
|
||||
public bool IsValid => Units.Any();
|
||||
|
||||
public Actor TargetActor
|
||||
{
|
||||
get { return Target.Actor; }
|
||||
set { Target = Target.FromActor(value); }
|
||||
get => Target.Actor;
|
||||
set => Target = Target.FromActor(value);
|
||||
}
|
||||
|
||||
public bool IsTargetValid
|
||||
{
|
||||
get { return Target.IsValidFor(Units.FirstOrDefault()) && !Target.Actor.Info.HasTraitInfo<HuskInfo>(); }
|
||||
}
|
||||
public bool IsTargetValid => Target.IsValidFor(Units.FirstOrDefault()) && !Target.Actor.Info.HasTraitInfo<HuskInfo>();
|
||||
|
||||
public bool IsTargetVisible
|
||||
{
|
||||
get { return TargetActor.CanBeViewedByPlayer(Bot.Player); }
|
||||
}
|
||||
public bool IsTargetVisible => TargetActor.CanBeViewedByPlayer(Bot.Player);
|
||||
|
||||
public WPos CenterPosition { get { return Units.Select(u => u.CenterPosition).Average(); } }
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return RangeCircleRenderables(wr);
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
|
||||
|
||||
float ISelectionBar.GetValue()
|
||||
{
|
||||
@@ -130,6 +130,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return Color.Purple; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Dictionary<CPos, byte> footprint;
|
||||
|
||||
public LegacyBridgeHut Hut { get; private set; }
|
||||
public bool IsDangling { get { return isDangling.Value; } }
|
||||
public bool IsDangling => isDangling.Value;
|
||||
|
||||
public Bridge(Actor self, BridgeInfo info)
|
||||
{
|
||||
|
||||
@@ -236,6 +236,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public bool Repairing { get { return repairStep < segmentLocations.Count; } }
|
||||
public bool Repairing => repairStep < segmentLocations.Count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,10 +75,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
string IBridgeSegment.Type { get { return Info.Type; } }
|
||||
DamageState IBridgeSegment.DamageState { get { return Info.DamageState; } }
|
||||
bool IBridgeSegment.Valid { get { return self.IsInWorld; } }
|
||||
CVec[] IBridgeSegment.NeighbourOffsets { get { return Info.NeighbourOffsets; } }
|
||||
CPos IBridgeSegment.Location { get { return self.Location; } }
|
||||
string IBridgeSegment.Type => Info.Type;
|
||||
DamageState IBridgeSegment.DamageState => Info.DamageState;
|
||||
bool IBridgeSegment.Valid => self.IsInWorld;
|
||||
CVec[] IBridgeSegment.NeighbourOffsets => Info.NeighbourOffsets;
|
||||
CPos IBridgeSegment.Location => self.Location;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return new ReadOnlyDictionary<CPos, SubCell>(occupied);
|
||||
}
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell { get { return false; } }
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
public IEnumerable<IRenderable> RenderAnnotations(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||
{
|
||||
@@ -270,7 +270,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
(CPos, SubCell)[] targetableCells;
|
||||
CPos[] transitOnlyCells;
|
||||
|
||||
public CPos TopLeft { get { return topLeft; } }
|
||||
public CPos TopLeft => topLeft;
|
||||
public WPos CenterPosition { get; private set; }
|
||||
|
||||
public Building(ActorInitializer init, BuildingInfo info)
|
||||
|
||||
@@ -129,6 +129,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void IPlaceBuildingPreview.Tick() { TickInner(); }
|
||||
|
||||
int2 IPlaceBuildingPreview.TopLeftScreenOffset { get { return topLeftScreenOffset; } }
|
||||
int2 IPlaceBuildingPreview.TopLeftScreenOffset => topLeftScreenOffset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,12 +136,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return blockedPositions.Any(loc => self.World.ActorMap.GetActorsAt(loc).Any(a => a != self));
|
||||
}
|
||||
|
||||
WDist IBlocksProjectiles.BlockingHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return new WDist(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition);
|
||||
}
|
||||
}
|
||||
WDist IBlocksProjectiles.BlockingHeight => new WDist(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
readonly HashSet<string> noAreaTypes = new HashSet<string>();
|
||||
|
||||
public HashSet<string> AreaTypes { get { return !IsTraitDisabled ? Info.AreaTypes : noAreaTypes; } }
|
||||
public HashSet<string> AreaTypes => !IsTraitDisabled ? Info.AreaTypes : noAreaTypes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,10 +117,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
}
|
||||
|
||||
string IBridgeSegment.Type { get { return Info.Type; } }
|
||||
DamageState IBridgeSegment.DamageState { get { return self.GetDamageState(); } }
|
||||
bool IBridgeSegment.Valid { get { return self.IsInWorld; } }
|
||||
CVec[] IBridgeSegment.NeighbourOffsets { get { return Info.NeighbourOffsets; } }
|
||||
CPos IBridgeSegment.Location { get { return self.Location; } }
|
||||
string IBridgeSegment.Type => Info.Type;
|
||||
DamageState IBridgeSegment.DamageState => self.GetDamageState();
|
||||
bool IBridgeSegment.Valid => self.IsInWorld;
|
||||
CVec[] IBridgeSegment.NeighbourOffsets => Info.NeighbourOffsets;
|
||||
CPos IBridgeSegment.Location => self.Location;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public Bridge FirstBridge { get; private set; }
|
||||
public Bridge Bridge { get; private set; }
|
||||
public DamageState BridgeDamageState { get { return Bridge.AggregateDamageState(); } }
|
||||
public bool Repairing { get { return repairDirections > 0; } }
|
||||
public DamageState BridgeDamageState => Bridge.AggregateDamageState();
|
||||
public bool Repairing => repairDirections > 0;
|
||||
int repairDirections = 0;
|
||||
|
||||
public LegacyBridgeHut(ActorInitializer init, LegacyBridgeHutInfo info)
|
||||
|
||||
@@ -132,8 +132,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
this.cursor = cursor;
|
||||
}
|
||||
|
||||
public string OrderID { get { return "SetRallyPoint"; } }
|
||||
public int OrderPriority { get { return 0; } }
|
||||
public string OrderID => "SetRallyPoint";
|
||||
public int OrderPriority => 0;
|
||||
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||
public bool ForceSet { get; private set; }
|
||||
public bool IsQueued { get; protected set; }
|
||||
|
||||
@@ -69,12 +69,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
bool preventDock = false;
|
||||
|
||||
public bool AllowDocking { get { return !preventDock; } }
|
||||
public CVec DeliveryOffset { get { return info.DockOffset; } }
|
||||
public WAngle DeliveryAngle { get { return info.DockAngle; } }
|
||||
public bool IsDragRequired { get { return info.IsDragRequired; } }
|
||||
public WVec DragOffset { get { return info.DragOffset; } }
|
||||
public int DragLength { get { return info.DragLength; } }
|
||||
public bool AllowDocking => !preventDock;
|
||||
public CVec DeliveryOffset => info.DockOffset;
|
||||
public WAngle DeliveryAngle => info.DockAngle;
|
||||
public bool IsDragRequired => info.IsDragRequired;
|
||||
public WVec DragOffset => info.DragOffset;
|
||||
public int DragLength => info.DragLength;
|
||||
|
||||
public Refinery(Actor self, RefineryInfo info)
|
||||
{
|
||||
|
||||
@@ -186,8 +186,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
this.aircraft = aircraft;
|
||||
}
|
||||
|
||||
public string OrderID { get { return "Move"; } }
|
||||
public int OrderPriority { get { return 4; } }
|
||||
public string OrderID => "Move";
|
||||
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)
|
||||
|
||||
@@ -177,8 +177,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
rejectMove = !self.AcceptsOrder("Move");
|
||||
}
|
||||
|
||||
public string OrderID { get { return "Move"; } }
|
||||
public int OrderPriority { get { return 4; } }
|
||||
public string OrderID => "Move";
|
||||
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)
|
||||
|
||||
@@ -51,6 +51,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return Info.Color; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return Info.Color; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly Dictionary<string, string> PassengerConditions = new Dictionary<string, string>();
|
||||
|
||||
[GrantedConditionReference]
|
||||
public IEnumerable<string> LinterPassengerConditions { get { return PassengerConditions.Values; } }
|
||||
public IEnumerable<string> LinterPassengerConditions => PassengerConditions.Values;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new Cargo(init, this); }
|
||||
}
|
||||
@@ -108,13 +108,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
readonly CachedTransform<CPos, IEnumerable<CPos>> currentAdjacentCells;
|
||||
|
||||
public IEnumerable<CPos> CurrentAdjacentCells
|
||||
{
|
||||
get { return currentAdjacentCells.Update(self.Location); }
|
||||
}
|
||||
public IEnumerable<CPos> CurrentAdjacentCells => currentAdjacentCells.Update(self.Location);
|
||||
|
||||
public IEnumerable<Actor> Passengers { get { return cargo; } }
|
||||
public int PassengerCount { get { return cargo.Count; } }
|
||||
public IEnumerable<Actor> Passengers => cargo;
|
||||
public int PassengerCount => cargo.Count;
|
||||
|
||||
enum State { Free, Locked }
|
||||
State state = State.Free;
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
IDelayCarryallPickup[] delayPickups;
|
||||
|
||||
public Actor Carrier { get; private set; }
|
||||
public bool Reserved { get { return state != State.Free; } }
|
||||
public bool Reserved => state != State.Free;
|
||||
public CPos? Destination { get; protected set; }
|
||||
public bool WantsTransport { get { return Destination != null && !IsTraitDisabled; } }
|
||||
public bool WantsTransport => Destination != null && !IsTraitDisabled;
|
||||
|
||||
protected enum State { Free, Reserved, Locked }
|
||||
protected State state = State.Free;
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
HashSet<string> IOverrideAircraftLanding.LandableTerrainTypes { get { return landableTerrainTypes ?? aircraft.Info.LandableTerrainTypes; } }
|
||||
HashSet<string> IOverrideAircraftLanding.LandableTerrainTypes => landableTerrainTypes ?? aircraft.Info.LandableTerrainTypes;
|
||||
|
||||
public virtual bool AttachCarryable(Actor self, Actor carryable)
|
||||
{
|
||||
@@ -399,8 +399,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly AircraftInfo aircraftInfo;
|
||||
readonly CarryallInfo info;
|
||||
|
||||
public string OrderID { get { return "DeliverUnit"; } }
|
||||
public int OrderPriority { get { return 6; } }
|
||||
public string OrderID => "DeliverUnit";
|
||||
public int OrderPriority => 6;
|
||||
public bool IsQueued { get; protected set; }
|
||||
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
base.Created(self);
|
||||
}
|
||||
|
||||
public bool Cloaked { get { return !IsTraitDisabled && !IsTraitPaused && remainingTime <= 0; } }
|
||||
public bool Cloaked => !IsTraitDisabled && !IsTraitPaused && remainingTime <= 0;
|
||||
|
||||
public void Uncloak() { Uncloak(Info.CloakDelay); }
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
yield return r;
|
||||
}
|
||||
|
||||
bool IRenderAnnotations.SpatiallyPartitionable { get { return true; } }
|
||||
bool IRenderAnnotations.SpatiallyPartitionable => true;
|
||||
|
||||
IEnumerable<IRenderable> RenderArmaments(Actor self, AttackBase attack)
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
int deployedToken = Actor.InvalidConditionToken;
|
||||
int undeployedToken = Actor.InvalidConditionToken;
|
||||
|
||||
public DeployState DeployState { get { return deployState; } }
|
||||
public DeployState DeployState => deployState;
|
||||
|
||||
public GrantConditionOnDeploy(ActorInitializer init, GrantConditionOnDeployInfo info)
|
||||
: base(info)
|
||||
|
||||
@@ -79,6 +79,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return info.SelectionBarColor; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return new ReadOnlyDictionary<CPos, SubCell>(occupied);
|
||||
}
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell { get { return false; } }
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.Dispose();
|
||||
}
|
||||
|
||||
public CPos TopLeft { get { return Location; } }
|
||||
public CPos TopLeft => Location;
|
||||
public (CPos, SubCell)[] OccupiedCells() { return new[] { (Location, SubCell.FullCell) }; }
|
||||
|
||||
public WPos CenterPosition { get; private set; }
|
||||
|
||||
@@ -101,6 +101,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return true; } }
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly Dictionary<int, string> Conditions = null;
|
||||
|
||||
[GrantedConditionReference]
|
||||
public IEnumerable<string> LinterConditions { get { return Conditions.Values; } }
|
||||
public IEnumerable<string> LinterConditions => Conditions.Values;
|
||||
|
||||
[Desc("Image for the level up sprite.")]
|
||||
public readonly string LevelUpImage = null;
|
||||
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
GiveExperience(initialExperience, info.SuppressLevelupAnimation);
|
||||
}
|
||||
|
||||
public bool CanGainLevel { get { return Level < MaxLevel; } }
|
||||
public bool CanGainLevel => Level < MaxLevel;
|
||||
|
||||
public void GiveLevels(int numLevels, bool silent = false)
|
||||
{
|
||||
|
||||
@@ -214,9 +214,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool IsFull { get { return contents.Values.Sum() == Info.Capacity; } }
|
||||
public bool IsEmpty { get { return contents.Values.Sum() == 0; } }
|
||||
public int Fullness { get { return contents.Values.Sum() * 100 / Info.Capacity; } }
|
||||
public bool IsFull => contents.Values.Sum() == Info.Capacity;
|
||||
public bool IsEmpty => contents.Values.Sum() == 0;
|
||||
public int Fullness => contents.Values.Sum() * 100 / Info.Capacity;
|
||||
|
||||
void UpdateCondition(Actor self)
|
||||
{
|
||||
@@ -366,8 +366,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
class HarvestOrderTargeter : IOrderTargeter
|
||||
{
|
||||
public string OrderID { get { return "Harvest"; } }
|
||||
public int OrderPriority { get { return 10; } }
|
||||
public string OrderID => "Harvest";
|
||||
public int OrderPriority => 10;
|
||||
public bool IsQueued { get; protected set; }
|
||||
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
throw new YamlException("Actors with Health need at least one HitShape trait!");
|
||||
}
|
||||
|
||||
int IHealthInfo.MaxHP { get { return HP; } }
|
||||
int IHealthInfo.MaxHP => HP;
|
||||
|
||||
IEnumerable<EditorActorOption> IEditorActorOptions.ActorOptions(ActorInfo ai, World world)
|
||||
{
|
||||
@@ -78,10 +78,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
DisplayHP = hp;
|
||||
}
|
||||
|
||||
public int HP { get { return hp; } }
|
||||
public int HP => hp;
|
||||
public int MaxHP { get; private set; }
|
||||
|
||||
public bool IsDead { get { return hp <= 0; } }
|
||||
public bool IsDead => hp <= 0;
|
||||
public bool RemoveOnDeath = true;
|
||||
|
||||
public DamageState DamageState
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
base.Created(self);
|
||||
}
|
||||
|
||||
bool ITargetablePositions.AlwaysEnabled { get { return Info.RequiresCondition == null; } }
|
||||
bool ITargetablePositions.AlwaysEnabled => Info.RequiresCondition == null;
|
||||
|
||||
IEnumerable<WPos> ITargetablePositions.TargetablePositions(Actor self)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return new ReadOnlyDictionary<CPos, SubCell>(occupied);
|
||||
}
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell { get { return false; } }
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
@@ -73,13 +73,13 @@ namespace OpenRA.Mods.Common.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;
|
||||
|
||||
public WAngle TurnSpeed { get { return WAngle.Zero; } }
|
||||
public WAngle TurnSpeed => WAngle.Zero;
|
||||
|
||||
public Husk(ActorInitializer init, HuskInfo info)
|
||||
{
|
||||
@@ -175,8 +175,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
// We return self.Owner if there's no effective owner
|
||||
bool IEffectiveOwner.Disguised { get { return true; } }
|
||||
Player IEffectiveOwner.Owner { get { return effectiveOwner; } }
|
||||
bool IEffectiveOwner.Disguised => true;
|
||||
Player IEffectiveOwner.Owner => effectiveOwner;
|
||||
}
|
||||
|
||||
public class HuskSpeedInit : ValueActorInit<int>, ISingleInstanceInit
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return new ReadOnlyDictionary<CPos, SubCell>(occupied);
|
||||
}
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell { get { return false; } }
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
}
|
||||
|
||||
class Immobile : IOccupySpace, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||
@@ -52,8 +52,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
occupied = new (CPos, SubCell)[0];
|
||||
}
|
||||
|
||||
public CPos TopLeft { get { return location; } }
|
||||
public WPos CenterPosition { get { return position; } }
|
||||
public CPos TopLeft => location;
|
||||
public WPos CenterPosition => position;
|
||||
public (CPos, SubCell)[] OccupiedCells() { return occupied; }
|
||||
|
||||
void INotifyAddedToWorld.AddedToWorld(Actor self)
|
||||
|
||||
@@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
[Sync]
|
||||
int panicStartedTick;
|
||||
bool Panicking { get { return panicStartedTick > 0; } }
|
||||
bool Panicking => panicStartedTick > 0;
|
||||
|
||||
bool IRenderInfantrySequenceModifier.IsModifyingSequence { get { return Panicking; } }
|
||||
string IRenderInfantrySequenceModifier.SequencePrefix { get { return info.PanicSequencePrefix; } }
|
||||
bool IRenderInfantrySequenceModifier.IsModifyingSequence => Panicking;
|
||||
string IRenderInfantrySequenceModifier.SequencePrefix => info.PanicSequencePrefix;
|
||||
|
||||
public ScaredyCat(Actor self, ScaredyCatInfo info)
|
||||
{
|
||||
|
||||
@@ -58,10 +58,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
int remainingDuration = 0;
|
||||
|
||||
bool IsProne { get { return !IsTraitDisabled && remainingDuration != 0; } }
|
||||
bool IsProne => !IsTraitDisabled && remainingDuration != 0;
|
||||
|
||||
bool IRenderInfantrySequenceModifier.IsModifyingSequence { get { return IsProne; } }
|
||||
string IRenderInfantrySequenceModifier.SequencePrefix { get { return info.ProneSequencePrefix; } }
|
||||
bool IRenderInfantrySequenceModifier.IsModifyingSequence => IsProne;
|
||||
string IRenderInfantrySequenceModifier.SequencePrefix => info.ProneSequencePrefix;
|
||||
|
||||
public TakeCover(ActorInitializer init, TakeCoverInfo info)
|
||||
: base(init, info)
|
||||
@@ -96,10 +96,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
localOffset = WVec.Zero;
|
||||
}
|
||||
|
||||
public override bool HasAchievedDesiredFacing
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
public override bool HasAchievedDesiredFacing => true;
|
||||
|
||||
int IDamageModifier.GetDamageModifier(Actor attacker, Damage damage)
|
||||
{
|
||||
|
||||
@@ -54,9 +54,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public override object Create(ActorInitializer init) { return new IsometricSelectable(init.Self, this); }
|
||||
|
||||
int ISelectableInfo.Priority { get { return Priority; } }
|
||||
SelectionPriorityModifiers ISelectableInfo.PriorityModifiers { get { return PriorityModifiers; } }
|
||||
string ISelectableInfo.Voice { get { return Voice; } }
|
||||
int ISelectableInfo.Priority => Priority;
|
||||
SelectionPriorityModifiers ISelectableInfo.PriorityModifiers => PriorityModifiers;
|
||||
string ISelectableInfo.Voice => Voice;
|
||||
|
||||
public virtual void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||
{
|
||||
@@ -136,6 +136,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return Bounds(self, wr);
|
||||
}
|
||||
|
||||
string ISelectable.Class { get { return selectionClass; } }
|
||||
string ISelectable.Class => selectionClass;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public class JamsMissiles : ConditionalTrait<JamsMissilesInfo>
|
||||
{
|
||||
public WDist Range { get { return IsTraitDisabled ? WDist.Zero : Info.Range; } }
|
||||
public PlayerRelationship DeflectionStances { get { return Info.DeflectionRelationships; } }
|
||||
public int Chance { get { return Info.Chance; } }
|
||||
public WDist Range => IsTraitDisabled ? WDist.Zero : Info.Range;
|
||||
public PlayerRelationship DeflectionStances => Info.DeflectionRelationships;
|
||||
public int Chance => Info.Chance;
|
||||
|
||||
public JamsMissiles(JamsMissilesInfo info)
|
||||
: base(info) { }
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return new ReadOnlyDictionary<CPos, SubCell>(new Dictionary<CPos, SubCell>() { { location, subCell } });
|
||||
}
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell { get { return LocomotorInfo.SharesCell; } }
|
||||
bool IOccupySpaceInfo.SharesCell => LocomotorInfo.SharesCell;
|
||||
|
||||
IEnumerable<EditorActorOption> IEditorActorOptions.ActorOptions(ActorInfo ai, World world)
|
||||
{
|
||||
@@ -159,10 +159,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
MovementType movementTypes;
|
||||
public MovementType CurrentMovementTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return movementTypes;
|
||||
}
|
||||
get => movementTypes;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -195,30 +192,28 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public bool TurnToMove;
|
||||
public bool IsBlocking { get; private set; }
|
||||
|
||||
public bool IsMovingBetweenCells
|
||||
{
|
||||
get { return FromCell != ToCell; }
|
||||
}
|
||||
public bool IsMovingBetweenCells => FromCell != ToCell;
|
||||
|
||||
#region IFacing
|
||||
|
||||
[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;
|
||||
|
||||
public WAngle TurnSpeed => Info.TurnSpeed;
|
||||
|
||||
public WAngle TurnSpeed { get { return Info.TurnSpeed; } }
|
||||
#endregion
|
||||
|
||||
[Sync]
|
||||
public CPos FromCell { get { return fromCell; } }
|
||||
public CPos FromCell => fromCell;
|
||||
|
||||
[Sync]
|
||||
public CPos ToCell { get { return toCell; } }
|
||||
public CPos ToCell => toCell;
|
||||
|
||||
[Sync]
|
||||
public int PathHash; // written by Move.EvalPath, to temporarily debug this crap.
|
||||
@@ -232,7 +227,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
public WPos CenterPosition { get; private set; }
|
||||
|
||||
public CPos TopLeft { get { return ToCell; } }
|
||||
public CPos TopLeft => ToCell;
|
||||
|
||||
public (CPos, SubCell)[] OccupiedCells()
|
||||
{
|
||||
@@ -989,8 +984,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
rejectMove = !self.AcceptsOrder("Move");
|
||||
}
|
||||
|
||||
public string OrderID { get { return "Move"; } }
|
||||
public int OrderPriority { get { return 4; } }
|
||||
public string OrderID => "Move";
|
||||
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)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly Dictionary<string, string> CargoConditions = new Dictionary<string, string>();
|
||||
|
||||
[GrantedConditionReference]
|
||||
public IEnumerable<string> LinterCargoConditions { get { return CargoConditions.Values; } }
|
||||
public IEnumerable<string> LinterCargoConditions => CargoConditions.Values;
|
||||
|
||||
[VoiceReference]
|
||||
public readonly string Voice = "Action";
|
||||
|
||||
@@ -95,13 +95,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
bool buildAnywhere;
|
||||
|
||||
public bool FastCharge { get { return Enabled && fastCharge; } }
|
||||
public bool AllTech { get { return Enabled && allTech; } }
|
||||
public bool FastBuild { get { return Enabled && fastBuild; } }
|
||||
public bool DisableShroud { get { return Enabled && disableShroud; } }
|
||||
public bool PathDebug { get { return Enabled && pathDebug; } }
|
||||
public bool UnlimitedPower { get { return Enabled && unlimitedPower; } }
|
||||
public bool BuildAnywhere { get { return Enabled && buildAnywhere; } }
|
||||
public bool FastCharge => Enabled && fastCharge;
|
||||
public bool AllTech => Enabled && allTech;
|
||||
public bool FastBuild => Enabled && fastBuild;
|
||||
public bool DisableShroud => Enabled && disableShroud;
|
||||
public bool PathDebug => Enabled && pathDebug;
|
||||
public bool UnlimitedPower => Enabled && unlimitedPower;
|
||||
public bool BuildAnywhere => Enabled && buildAnywhere;
|
||||
|
||||
bool enableAll;
|
||||
|
||||
@@ -275,6 +275,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Game.Debug("Cheat used: {0} by {1}{2}", order.OrderString, self.Owner.PlayerName, debugSuffix);
|
||||
}
|
||||
|
||||
bool IUnlocksRenderPlayer.RenderPlayerUnlocked { get { return Enabled; } }
|
||||
bool IUnlocksRenderPlayer.RenderPlayerUnlocked => Enabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Internal id for this bot.")]
|
||||
public readonly string Type = null;
|
||||
|
||||
string IBotInfo.Type { get { return Type; } }
|
||||
string IBotInfo.Type => Type;
|
||||
|
||||
string IBotInfo.Name { get { return Name; } }
|
||||
string IBotInfo.Name => Name;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new DummyBot(this); }
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void IBot.QueueOrder(Order order) { }
|
||||
|
||||
IBotInfo IBot.Info { get { return info; } }
|
||||
Player IBot.Player { get { return player; } }
|
||||
IBotInfo IBot.Info => info;
|
||||
Player IBot.Player => player;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
readonly ObjectivesPanelInfo info;
|
||||
public ObjectivesPanel(ObjectivesPanelInfo info) { this.info = info; }
|
||||
public string PanelName { get { return info.PanelName; } }
|
||||
public int ExitDelay { get { return info.ExitDelay; } }
|
||||
public string PanelName => info.PanelName;
|
||||
public int ExitDelay => info.ExitDelay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Minimum portion of pending orders to issue each tick (e.g. 5 issues at least 1/5th of all pending orders). Excess orders remain queued for subsequent ticks.")]
|
||||
public readonly int MinOrderQuotientPerTick = 5;
|
||||
|
||||
string IBotInfo.Type { get { return Type; } }
|
||||
string IBotInfo.Type => Type;
|
||||
|
||||
string IBotInfo.Name { get { return Name; } }
|
||||
string IBotInfo.Name => Name;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new ModularBot(this, init); }
|
||||
}
|
||||
@@ -50,8 +50,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
IBotTick[] tickModules;
|
||||
IBotRespondToAttack[] attackResponseModules;
|
||||
|
||||
IBotInfo IBot.Info { get { return info; } }
|
||||
Player IBot.Player { get { return player; } }
|
||||
IBotInfo IBot.Info => info;
|
||||
Player IBot.Player => player;
|
||||
|
||||
public ModularBot(ModularBotInfo info, ActorInitializer init)
|
||||
{
|
||||
|
||||
@@ -81,10 +81,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
}
|
||||
|
||||
public (int Left, int Right) this[MPos uv]
|
||||
{
|
||||
get { return terrainColor[uv]; }
|
||||
}
|
||||
public (int Left, int Right) this[MPos uv] => terrainColor[uv];
|
||||
|
||||
public static (int Left, int Right) GetColor(Map map, MPos uv)
|
||||
{
|
||||
|
||||
@@ -31,13 +31,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public int OrderCount;
|
||||
|
||||
public int Experience
|
||||
{
|
||||
get
|
||||
{
|
||||
return experience != null ? experience.Experience : 0;
|
||||
}
|
||||
}
|
||||
public int Experience => experience != null ? experience.Experience : 0;
|
||||
|
||||
// Low resolution (every 30 seconds) record of earnings, covering the entire game
|
||||
public List<int> IncomeSamples = new List<int>(100);
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
protected DeveloperMode developerMode;
|
||||
protected TechTree techTree;
|
||||
|
||||
public Actor Actor { get { return self; } }
|
||||
public Actor Actor => self;
|
||||
|
||||
[Sync]
|
||||
public bool Enabled { get; protected set; }
|
||||
@@ -603,14 +603,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public int TotalTime { get; private set; }
|
||||
public int RemainingTime { get; private set; }
|
||||
public int RemainingCost { get; private set; }
|
||||
public int RemainingTimeActual
|
||||
{
|
||||
get
|
||||
{
|
||||
return (pm == null || pm.PowerState == PowerState.Normal) ? RemainingTime :
|
||||
RemainingTime * Queue.Info.LowPowerModifier / 100;
|
||||
}
|
||||
}
|
||||
public int RemainingTimeActual =>
|
||||
(pm == null || pm.PowerState == PowerState.Normal) ? RemainingTime :
|
||||
RemainingTime * Queue.Info.LowPowerModifier / 100;
|
||||
|
||||
public bool Paused { get; private set; }
|
||||
public bool Done { get; private set; }
|
||||
|
||||
@@ -37,15 +37,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
static readonly string[] NoPrerequisites = new string[0];
|
||||
|
||||
public string Name { get { return info.Name; } }
|
||||
public string Name => info.Name;
|
||||
|
||||
public IEnumerable<string> ProvidesPrerequisites
|
||||
{
|
||||
get
|
||||
{
|
||||
return enabled ? info.Prerequisites : NoPrerequisites;
|
||||
}
|
||||
}
|
||||
public IEnumerable<string> ProvidesPrerequisites => enabled ? info.Prerequisites : NoPrerequisites;
|
||||
|
||||
public ProvidesTechPrerequisite(ProvidesTechPrerequisiteInfo info, ActorInitializer init)
|
||||
{
|
||||
|
||||
@@ -66,15 +66,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
shortGame = player.World.WorldActor.Trait<MapOptions>().ShortGame;
|
||||
}
|
||||
|
||||
public IEnumerable<Actor> AllPoints
|
||||
{
|
||||
get { return player.World.ActorsHavingTrait<StrategicPoint>(); }
|
||||
}
|
||||
public IEnumerable<Actor> AllPoints => player.World.ActorsHavingTrait<StrategicPoint>();
|
||||
|
||||
public int Total { get { return AllPoints.Count(); } }
|
||||
public int Total => AllPoints.Count();
|
||||
int Owned { get { return AllPoints.Count(a => a.Owner.RelationshipWith(player) == PlayerRelationship.Ally); } }
|
||||
|
||||
public bool Holding { get { return Owned >= info.RatioRequired * Total / 100; } }
|
||||
public bool Holding => Owned >= info.RatioRequired * Total / 100;
|
||||
|
||||
void ITick.Tick(Actor self)
|
||||
{
|
||||
|
||||
@@ -106,12 +106,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Player Owner { get { return player; } }
|
||||
public Player Owner => player;
|
||||
|
||||
class Watcher
|
||||
{
|
||||
public readonly string Key;
|
||||
public ITechTreeElement RegisteredBy { get { return watcher; } }
|
||||
public ITechTreeElement RegisteredBy => watcher;
|
||||
|
||||
// Strings may be either actor type, or "alternate name" key
|
||||
readonly string[] prerequisites;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly int EditorDisplayOrder = 5;
|
||||
|
||||
[GrantedConditionReference]
|
||||
public IEnumerable<string> LinterConditions { get { return Conditions.Values; } }
|
||||
public IEnumerable<string> LinterConditions => Conditions.Values;
|
||||
|
||||
[ConsumedConditionReference]
|
||||
public IEnumerable<string> ConsumedConditions
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return Color.Yellow;
|
||||
}
|
||||
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
|
||||
public void UpdateStatus(Actor self)
|
||||
{
|
||||
|
||||
@@ -37,14 +37,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
int totalProvided;
|
||||
|
||||
public int PowerProvided { get { return totalProvided; } }
|
||||
public int PowerProvided => totalProvided;
|
||||
|
||||
[Sync]
|
||||
int totalDrained;
|
||||
|
||||
public int PowerDrained { get { return totalDrained; } }
|
||||
public int PowerDrained => totalDrained;
|
||||
|
||||
public int ExcessPower { get { return totalProvided - totalDrained; } }
|
||||
public int ExcessPower => totalProvided - totalDrained;
|
||||
|
||||
public int PowerOutageRemainingTicks { get; private set; }
|
||||
public int PowerOutageTotalTicks { get; private set; }
|
||||
|
||||
@@ -37,13 +37,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return forPlayer == self.Owner;
|
||||
}
|
||||
|
||||
public string TooltipText
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Power Usage: {0}{1}".F(powerManager.PowerDrained, developerMode.UnlimitedPower ? "" : "/" + powerManager.PowerProvided);
|
||||
}
|
||||
}
|
||||
public string TooltipText => "Power Usage: {0}{1}".F(powerManager.PowerDrained, developerMode.UnlimitedPower ? "" : "/" + powerManager.PowerProvided);
|
||||
|
||||
public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class ProximityCapturable : ITick, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged
|
||||
{
|
||||
public readonly Player OriginalOwner;
|
||||
public bool Captured { get { return Self.Owner != OriginalOwner; } }
|
||||
public bool Captured => Self.Owner != OriginalOwner;
|
||||
|
||||
public ProximityCapturableInfo Info;
|
||||
public Actor Self;
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public class RejectsOrders : ConditionalTrait<RejectsOrdersInfo>
|
||||
{
|
||||
public HashSet<string> Reject { get { return Info.Reject; } }
|
||||
public HashSet<string> Except { get { return Info.Except; } }
|
||||
public HashSet<string> Reject => Info.Reject;
|
||||
public HashSet<string> Except => Info.Except;
|
||||
|
||||
public RejectsOrders(RejectsOrdersInfo info)
|
||||
: base(info) { }
|
||||
|
||||
@@ -51,6 +51,6 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return info.Color; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotations.SpatiallyPartitionable => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
yield return new SpriteRenderable(n.Tile, n.Target.CenterPosition, WVec.Zero, -511, pal, 1f, 1f, float3.Ones, TintModifiers.IgnoreWorldTint, true);
|
||||
}
|
||||
|
||||
bool IRenderAboveShroud.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAboveShroud.SpatiallyPartitionable => false;
|
||||
|
||||
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
|
||||
{
|
||||
@@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return renderableCache.ToArray();
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
|
||||
}
|
||||
|
||||
public static class LineTargetExts
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return Info.Color; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
|
||||
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||
{
|
||||
|
||||
@@ -54,6 +54,6 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return info.Color; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,6 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
yield return new TextAnnotationRenderable(font, self.CenterPosition + offset, 0, color, aiSquadInfo);
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return true; } }
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
info.BorderWidth);
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
|
||||
|
||||
void ITick.Tick(Actor self)
|
||||
{
|
||||
|
||||
@@ -84,6 +84,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,6 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
return RangeCircleRenderables(wr);
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return RangeCircleRenderables(self, wr);
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,13 +118,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
PaletteReference = null;
|
||||
}
|
||||
|
||||
public bool IsVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
return Animation.DisableFunc == null || !Animation.DisableFunc();
|
||||
}
|
||||
}
|
||||
public bool IsVisible => Animation.DisableFunc == null || !Animation.DisableFunc();
|
||||
|
||||
public bool Tick()
|
||||
{
|
||||
|
||||
@@ -164,7 +164,8 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
yield return c.ScreenBounds(pos, wr, Info.Scale);
|
||||
}
|
||||
|
||||
public string Image { get { return Info.Image ?? self.Info.Name; } }
|
||||
public string Image => Info.Image ?? self.Info.Name;
|
||||
|
||||
public void Add(ModelAnimation m)
|
||||
{
|
||||
components.Add(m);
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
return DrawDecorations(self, wr);
|
||||
}
|
||||
|
||||
bool IRenderAnnotations.SpatiallyPartitionable { get { return true; } }
|
||||
bool IRenderAnnotations.SpatiallyPartitionable => true;
|
||||
|
||||
IEnumerable<IRenderable> DrawDecorations(Actor self, WorldRenderer wr)
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return Info.Color; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
|
||||
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
value = duration > 0 ? remaining * 1f / duration : 0;
|
||||
}
|
||||
|
||||
string IConditionTimerWatcher.Condition { get { return info.Condition; } }
|
||||
string IConditionTimerWatcher.Condition => info.Condition;
|
||||
|
||||
float ISelectionBar.GetValue()
|
||||
{
|
||||
@@ -54,6 +54,6 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return info.Color; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +69,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
}
|
||||
}
|
||||
|
||||
Sprite IProductionIconOverlay.Sprite { get { return sprite; } }
|
||||
string IProductionIconOverlay.Palette { get { return info.Palette; } }
|
||||
Sprite IProductionIconOverlay.Sprite => sprite;
|
||||
string IProductionIconOverlay.Palette => info.Palette;
|
||||
|
||||
float2 IProductionIconOverlay.Offset(float2 iconSize)
|
||||
{
|
||||
var x = (sprite.Size.X - iconSize.X) / 2;
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IDecoration.RequiresSelection { get { return Info.RequiresSelection; } }
|
||||
bool IDecoration.RequiresSelection => Info.RequiresSelection;
|
||||
|
||||
protected abstract IEnumerable<IRenderable> RenderDecoration(Actor self, WorldRenderer wr, int2 pos);
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
AnimationState state;
|
||||
IRenderInfantrySequenceModifier rsm;
|
||||
|
||||
bool IsModifyingSequence { get { return rsm != null && rsm.IsModifyingSequence; } }
|
||||
bool IsModifyingSequence => rsm != null && rsm.IsModifyingSequence;
|
||||
bool wasModifying;
|
||||
|
||||
// Allow subclasses to override the info that we use for rendering
|
||||
|
||||
@@ -113,13 +113,13 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
return RenderRangeCircle(self, wr, RangeCircleVisibility.WhenSelected);
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
|
||||
|
||||
IEnumerable<IRenderable> IRenderAnnotations.RenderAnnotations(Actor self, WorldRenderer wr)
|
||||
{
|
||||
return RenderRangeCircle(self, wr, RangeCircleVisibility.Always);
|
||||
}
|
||||
|
||||
bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotations.SpatiallyPartitionable => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
anim = new Animation(self.World, Info.Image);
|
||||
}
|
||||
|
||||
bool IDecoration.RequiresSelection { get { return true; } }
|
||||
bool IDecoration.RequiresSelection => true;
|
||||
|
||||
IEnumerable<IRenderable> IDecoration.RenderDecoration(Actor self, WorldRenderer wr, ISelectionDecorations container)
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
label = new CachedTransform<int, string>(g => g.ToString());
|
||||
}
|
||||
|
||||
bool IDecoration.RequiresSelection { get { return true; } }
|
||||
bool IDecoration.RequiresSelection => true;
|
||||
|
||||
IEnumerable<IRenderable> IDecoration.RenderDecoration(Actor self, WorldRenderer wr, ISelectionDecorations container)
|
||||
{
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public override object Create(ActorInitializer init) { return new Selectable(init.Self, this); }
|
||||
|
||||
int ISelectableInfo.Priority { get { return Priority; } }
|
||||
SelectionPriorityModifiers ISelectableInfo.PriorityModifiers { get { return PriorityModifiers; } }
|
||||
string ISelectableInfo.Voice { get { return Voice; } }
|
||||
int ISelectableInfo.Priority => Priority;
|
||||
SelectionPriorityModifiers ISelectableInfo.PriorityModifiers => PriorityModifiers;
|
||||
string ISelectableInfo.Voice => Voice;
|
||||
}
|
||||
|
||||
public class Selectable : Interactable, ISelectable
|
||||
@@ -50,6 +50,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Info = info;
|
||||
}
|
||||
|
||||
string ISelectable.Class { get { return selectionClass; } }
|
||||
string ISelectable.Class => selectionClass;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
PlayerResources player;
|
||||
|
||||
[Sync]
|
||||
public int Stored { get { return player.ResourceCapacity == 0 ? 0 : (int)((long)info.Capacity * player.Resources / player.ResourceCapacity); } }
|
||||
public int Stored => player.ResourceCapacity == 0 ? 0 : (int)((long)info.Capacity * player.Resources / player.ResourceCapacity);
|
||||
|
||||
public StoresResources(Actor self, StoresResourcesInfo info)
|
||||
{
|
||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
player = self.Owner.PlayerActor.Trait<PlayerResources>();
|
||||
}
|
||||
|
||||
int IStoreResources.Capacity { get { return info.Capacity; } }
|
||||
int IStoreResources.Capacity => info.Capacity;
|
||||
|
||||
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||
{
|
||||
|
||||
@@ -112,10 +112,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void IOrderGenerator.SelectionChanged(World world, IEnumerable<Actor> selected) { }
|
||||
|
||||
bool IsOutsideDragZone
|
||||
{
|
||||
get { return dragStarted && dragDirection.Length > MinDragThreshold; }
|
||||
}
|
||||
bool IsOutsideDragZone => dragStarted && dragDirection.Length > MinDragThreshold;
|
||||
|
||||
IEnumerable<IRenderable> IOrderGenerator.Render(WorldRenderer wr, World world) { yield break; }
|
||||
|
||||
|
||||
@@ -147,21 +147,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly int TotalTicks;
|
||||
|
||||
protected int remainingSubTicks;
|
||||
public int RemainingTicks { get { return remainingSubTicks / 100; } }
|
||||
public int RemainingTicks => remainingSubTicks / 100;
|
||||
public bool Active { get; private set; }
|
||||
public bool Disabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return Manager.Self.Owner.WinState == WinState.Lost ||
|
||||
(!prereqsAvailable && !Manager.DevMode.AllTech) ||
|
||||
!instancesEnabled ||
|
||||
oneShotFired;
|
||||
}
|
||||
}
|
||||
public bool Disabled =>
|
||||
Manager.Self.Owner.WinState == WinState.Lost ||
|
||||
(!prereqsAvailable && !Manager.DevMode.AllTech) ||
|
||||
!instancesEnabled ||
|
||||
oneShotFired;
|
||||
|
||||
public SupportPowerInfo Info { get { return Instances.Select(i => i.Info).FirstOrDefault(); } }
|
||||
public bool Ready { get { return Active && RemainingTicks == 0; } }
|
||||
public bool Ready => Active && RemainingTicks == 0;
|
||||
|
||||
bool instancesEnabled;
|
||||
bool prereqsAvailable = true;
|
||||
@@ -285,7 +280,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly string cursor;
|
||||
readonly MouseButton expectedButton;
|
||||
|
||||
public string OrderKey { get { return order; } }
|
||||
public string OrderKey => order;
|
||||
|
||||
public SelectGenericPowerTarget(string order, SupportPowerManager manager, string cursor, MouseButton button)
|
||||
{
|
||||
|
||||
@@ -53,8 +53,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return cloaks.All(c => c.IsTraitDisabled || c.IsVisible(self, viewer.Owner));
|
||||
}
|
||||
|
||||
public virtual BitSet<TargetableType> TargetTypes { get { return Info.TargetTypes; } }
|
||||
public virtual BitSet<TargetableType> TargetTypes => Info.TargetTypes;
|
||||
|
||||
public bool RequiresForceFire { get { return Info.RequiresForceFire; } }
|
||||
public bool RequiresForceFire => Info.RequiresForceFire;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return info.BarColor;
|
||||
}
|
||||
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return GenericName;
|
||||
}
|
||||
|
||||
public bool IsOwnerRowVisible { get { return ShowOwnerRow; } }
|
||||
public bool IsOwnerRowVisible => ShowOwnerRow;
|
||||
}
|
||||
|
||||
public class Tooltip : ConditionalTrait<TooltipInfo>, ITooltip
|
||||
@@ -76,15 +76,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly Actor self;
|
||||
readonly TooltipInfo info;
|
||||
|
||||
public ITooltipInfo TooltipInfo { get { return info; } }
|
||||
public ITooltipInfo TooltipInfo => info;
|
||||
|
||||
public Player Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return self.EffectiveOwner != null ? self.EffectiveOwner.Owner : self.Owner;
|
||||
}
|
||||
}
|
||||
public Player Owner => self.EffectiveOwner != null ? self.EffectiveOwner.Owner : self.Owner;
|
||||
|
||||
public Tooltip(Actor self, TooltipInfo info)
|
||||
: base(info)
|
||||
|
||||
@@ -29,13 +29,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
readonly Actor self;
|
||||
|
||||
public Player Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return self.EffectiveOwner != null ? self.EffectiveOwner.Owner : self.Owner;
|
||||
}
|
||||
}
|
||||
public Player Owner => self.EffectiveOwner != null ? self.EffectiveOwner.Owner : self.Owner;
|
||||
|
||||
public TooltipDescription(Actor self, TooltipDescriptionInfo info)
|
||||
: base(info)
|
||||
@@ -55,12 +49,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return Info.ValidRelationships.HasRelationship(Owner.RelationshipWith(forPlayer));
|
||||
}
|
||||
|
||||
public string TooltipText
|
||||
{
|
||||
get
|
||||
{
|
||||
return Info.Description;
|
||||
}
|
||||
}
|
||||
public string TooltipText => Info.Description;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public readonly CPos Entrance;
|
||||
public CPos? Exit { get; private set; }
|
||||
public int NearEnough { get { return info.Margin; } }
|
||||
public int NearEnough => info.Margin;
|
||||
|
||||
public TunnelEntrance(Actor self, TunnelEntranceInfo info)
|
||||
{
|
||||
|
||||
@@ -159,8 +159,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// For subclasses that want to move the turret relative to the body
|
||||
protected WVec localOffset = WVec.Zero;
|
||||
|
||||
public WVec Offset { get { return Info.Offset + localOffset; } }
|
||||
public string Name { get { return Info.Turret; } }
|
||||
public WVec Offset => Info.Offset + localOffset;
|
||||
public string Name => Info.Turret;
|
||||
|
||||
public Turreted(ActorInitializer init, TurretedInfo info)
|
||||
: base(info)
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Info = info;
|
||||
}
|
||||
|
||||
string IVoiced.VoiceSet { get { return Info.VoiceSet; } }
|
||||
string IVoiced.VoiceSet => Info.VoiceSet;
|
||||
|
||||
bool IVoiced.PlayVoice(Actor self, string phrase, string variant)
|
||||
{
|
||||
|
||||
@@ -228,12 +228,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
public void Reset() { throw new NotSupportedException(); }
|
||||
public Actor Current
|
||||
{
|
||||
get { return current; }
|
||||
}
|
||||
public Actor Current => current;
|
||||
|
||||
object IEnumerator.Current { get { return current; } }
|
||||
object IEnumerator.Current => current;
|
||||
public void Dispose() { }
|
||||
public bool MoveNext()
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user