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:
Taryn Hill
2015-04-01 11:16:04 -05:00
parent 14e9cfd433
commit 4ed53c5952
54 changed files with 59 additions and 109 deletions

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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

View File

@@ -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"; } }