pre-explore a little bit around the mcv at start
This commit is contained in:
@@ -114,5 +114,15 @@ namespace OpenRA.Traits
|
||||
if (a.Owner == null || a.Owner != a.Owner.World.LocalPlayer) return;
|
||||
RemoveActor(a); AddActor(a);
|
||||
}
|
||||
|
||||
public void Explore(World world, int2 center, int range)
|
||||
{
|
||||
foreach (var q in world.FindTilesInCircle(center, range))
|
||||
exploredCells[q.X, q.Y] = true;
|
||||
|
||||
var box = new Rectangle(center.X - range, center.Y - range, 2 * range + 1, 2 * range + 1);
|
||||
exploredBounds = exploredBounds.HasValue ?
|
||||
Rectangle.Union(exploredBounds.Value, box) : box;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,10 @@ using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
class SpawnDefaultUnitsInfo : StatelessTraitInfo<SpawnDefaultUnits> { }
|
||||
class SpawnDefaultUnitsInfo : StatelessTraitInfo<SpawnDefaultUnits>
|
||||
{
|
||||
public readonly int InitialExploreRange = 5;
|
||||
}
|
||||
|
||||
class SpawnDefaultUnits : IGameStarted
|
||||
{
|
||||
@@ -48,6 +51,10 @@ namespace OpenRA.Traits
|
||||
void SpawnUnitsForPlayer(Player p, int2 sp)
|
||||
{
|
||||
p.World.CreateActor("mcv", sp, p);
|
||||
|
||||
if (p == p.World.LocalPlayer)
|
||||
p.World.WorldActor.traits.Get<Shroud>().Explore( p.World, sp,
|
||||
p.World.WorldActor.Info.Traits.Get<SpawnDefaultUnitsInfo>().InitialExploreRange);
|
||||
}
|
||||
|
||||
static int2 ChooseSpawnPoint(World world, List<int2> available, List<int2> taken)
|
||||
|
||||
Reference in New Issue
Block a user