Fix IDE0039
This commit is contained in:
@@ -390,7 +390,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return (null, 0);
|
||||
|
||||
// Find the buildable cell that is closest to pos and centered around center
|
||||
Func<CPos, CPos, int, int, (CPos? Location, int Variant)> findPos = (center, target, minRange, maxRange) =>
|
||||
(CPos? Location, int Variant) FindPos(CPos center, CPos target, int minRange, int maxRange)
|
||||
{
|
||||
var actorVariant = 0;
|
||||
var buildingVariantInfo = actorInfo.TraitInfoOrDefault<PlaceBuildingVariantsInfo>();
|
||||
@@ -461,7 +461,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
return (null, 0);
|
||||
};
|
||||
}
|
||||
|
||||
var baseCenter = baseBuilder.GetRandomBaseCenter();
|
||||
|
||||
@@ -475,7 +475,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var targetCell = closestEnemy != null ? closestEnemy.Location : baseCenter;
|
||||
|
||||
return findPos(baseBuilder.DefenseCenter, targetCell, baseBuilder.Info.MinimumDefenseRadius, baseBuilder.Info.MaximumDefenseRadius);
|
||||
return FindPos(baseBuilder.DefenseCenter, targetCell, baseBuilder.Info.MinimumDefenseRadius, baseBuilder.Info.MaximumDefenseRadius);
|
||||
|
||||
case BuildingType.Refinery:
|
||||
|
||||
@@ -488,17 +488,17 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
foreach (var r in nearbyResources)
|
||||
{
|
||||
var found = findPos(baseCenter, r, baseBuilder.Info.MinBaseRadius, baseBuilder.Info.MaxBaseRadius);
|
||||
var found = FindPos(baseCenter, r, baseBuilder.Info.MinBaseRadius, baseBuilder.Info.MaxBaseRadius);
|
||||
if (found.Location != null)
|
||||
return found;
|
||||
}
|
||||
}
|
||||
|
||||
// Try and find a free spot somewhere else in the base
|
||||
return findPos(baseCenter, baseCenter, baseBuilder.Info.MinBaseRadius, baseBuilder.Info.MaxBaseRadius);
|
||||
return FindPos(baseCenter, baseCenter, baseBuilder.Info.MinBaseRadius, baseBuilder.Info.MaxBaseRadius);
|
||||
|
||||
case BuildingType.Building:
|
||||
return findPos(baseCenter, baseCenter, baseBuilder.Info.MinBaseRadius,
|
||||
return FindPos(baseCenter, baseCenter, baseBuilder.Info.MinBaseRadius,
|
||||
distanceToBaseIsImportant ? baseBuilder.Info.MaxBaseRadius : world.Map.Grid.MaximumTileSearchRange);
|
||||
}
|
||||
|
||||
|
||||
@@ -138,12 +138,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
Target FindNextResource(Actor actor, HarvesterTraitWrapper harv)
|
||||
{
|
||||
Func<CPos, bool> isValidResource = cell =>
|
||||
bool IsValidResource(CPos cell) =>
|
||||
harv.Harvester.CanHarvestCell(cell) &&
|
||||
claimLayer.CanClaimCell(actor, cell);
|
||||
|
||||
var path = harv.Mobile.PathFinder.FindPathToTargetCellByPredicate(
|
||||
actor, new[] { actor.Location }, isValidResource, BlockedByActor.Stationary,
|
||||
actor, new[] { actor.Location }, IsValidResource, BlockedByActor.Stationary,
|
||||
loc => world.FindActorsInCircle(world.Map.CenterOfCell(loc), Info.HarvesterEnemyAvoidanceRadius)
|
||||
.Where(u => !u.IsDead && actor.Owner.RelationshipWith(u.Owner) == PlayerRelationship.Enemy)
|
||||
.Sum(u => Math.Max(WDist.Zero.Length, Info.HarvesterEnemyAvoidanceRadius.Length - (world.Map.CenterOfCell(loc) - u.CenterPosition).Length)));
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
@@ -178,7 +177,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return null;
|
||||
|
||||
// Find the buildable cell that is closest to pos and centered around center
|
||||
Func<CPos, CPos, int, int, CPos?> findPos = (center, target, minRange, maxRange) =>
|
||||
CPos? FindPos(CPos center, CPos target, int minRange, int maxRange)
|
||||
{
|
||||
var cells = world.Map.FindTilesInAnnulus(center, minRange, maxRange);
|
||||
|
||||
@@ -193,11 +192,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return cell;
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
var baseCenter = GetRandomBaseCenter();
|
||||
|
||||
return findPos(baseCenter, baseCenter, Info.MinBaseRadius,
|
||||
return FindPos(baseCenter, baseCenter, Info.MinBaseRadius,
|
||||
distanceToBaseIsImportant ? Info.MaxBaseRadius : world.Map.Grid.MaximumTileSearchRange);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user