Simplify return statements.
Remove redundant ‘this’. Remove unused using directives. Simplify LINQ chains. Add some trait property descriptions. Add readonly where viable. Add fullstops to some yaml descriptions.
This commit is contained in:
@@ -15,6 +15,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("This unit can be guarded (followed and protected) by a Guard unit.")]
|
||||
public class GuardableInfo : TraitInfo<Guardable>
|
||||
{
|
||||
[Desc("Maximum range that guarding actors will maintain. Measured in cells.")]
|
||||
public readonly int Range = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,9 +74,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!checkTransientActors)
|
||||
return SubCell.FullCell;
|
||||
|
||||
return !self.World.ActorMap.GetUnitsAt(cell)
|
||||
.Where(x => x != ignoreActor)
|
||||
.Any() ? SubCell.FullCell : SubCell.Invalid;
|
||||
return self.World.ActorMap.GetUnitsAt(cell)
|
||||
.All(x => x == ignoreActor) ? SubCell.FullCell : SubCell.Invalid;
|
||||
}
|
||||
|
||||
public bool CanEnterCell(CPos a, Actor ignoreActor = null, bool checkTransientActors = true)
|
||||
|
||||
@@ -8,12 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
@@ -168,9 +168,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// Sign of dot-product indicates (roughly) if vectors are facing in same or opposite directions:
|
||||
var dp = CVec.Dot(selfMobile.ToCell - self.Location, otherMobile.ToCell - other.Location);
|
||||
if (dp <= 0) return false;
|
||||
|
||||
return true;
|
||||
return dp > 0;
|
||||
}
|
||||
|
||||
public int TileSetMovementHash(TileSet tileSet)
|
||||
@@ -688,7 +687,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public MoveOrderTargeter(Actor self, MobileInfo unitType)
|
||||
{
|
||||
this.unitType = unitType;
|
||||
this.rejectMove = !self.AcceptsOrder("Move");
|
||||
rejectMove = !self.AcceptsOrder("Move");
|
||||
}
|
||||
|
||||
public string OrderID { get { return "Move"; } }
|
||||
|
||||
Reference in New Issue
Block a user