Less carp
This commit is contained in:
@@ -32,7 +32,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public ProductionSurround(Actor self) : base(self) { }
|
||||
|
||||
static int2? FindAdjacentTile(Actor self, UnitMovementType umt)
|
||||
static int2? FindAdjacentTile(Actor self, bool waterBound)
|
||||
{
|
||||
var tiles = Footprint.Tiles(self, self.traits.Get<Traits.Building>());
|
||||
var min = tiles.Aggregate(int2.Min) - new int2(1, 1);
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Traits
|
||||
|
||||
for (var j = min.Y; j <= max.Y; j++)
|
||||
for (var i = min.X; i <= max.X; i++)
|
||||
if (self.World.IsCellBuildable(new int2(i, j), umt))
|
||||
if (self.World.IsCellBuildable(new int2(i, j), waterBound))
|
||||
return new int2(i, j);
|
||||
|
||||
return null;
|
||||
@@ -48,8 +48,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public override int2? CreationLocation(Actor self, ActorInfo producee)
|
||||
{
|
||||
return FindAdjacentTile(self, producee.Traits.Get<OwnedActorInfo>().WaterBound ?
|
||||
UnitMovementType.Float : UnitMovementType.Wheel); /* hackety hack */
|
||||
return FindAdjacentTile(self, producee.Traits.Get<OwnedActorInfo>().WaterBound);
|
||||
}
|
||||
|
||||
public override int CreationFacing(Actor self, Actor newUnit)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region Copyright & License Information
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||
* This file is part of OpenRA.
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Traits
|
||||
for (var j = -1; j < 2; j++)
|
||||
for (var i = -1; i < 2; i++)
|
||||
if (self.World.SharedRandom.NextDouble() < info.Chance)
|
||||
if (self.World.IsCellBuildable(self.Location + new int2(i, j), UnitMovementType.Wheel))
|
||||
if (self.World.IsCellBuildable(self.Location + new int2(i, j), false))
|
||||
resLayer.AddResource(resourceType, self.Location.X + i, self.Location.Y + j, 1);
|
||||
|
||||
ticks = info.Interval;
|
||||
|
||||
@@ -62,13 +62,12 @@ namespace OpenRA.Traits
|
||||
void SpawnCrate(Actor self, CrateSpawnerInfo info)
|
||||
{
|
||||
var inWater = self.World.SharedRandom.NextDouble() < info.WaterChance;
|
||||
var umt = inWater ? UnitMovementType.Float : UnitMovementType.Wheel;
|
||||
|
||||
for (var n = 0; n < ChooseCrateLocationAttempts; n++)
|
||||
{
|
||||
var p = self.World.ChooseRandomCell(self.World.SharedRandom);
|
||||
|
||||
if (self.World.IsCellBuildable(p, umt))
|
||||
if (self.World.IsCellBuildable(p, inWater))
|
||||
{
|
||||
self.World.AddFrameEndTask(
|
||||
w => crates.Add(w.CreateActor("crate", p, self.World.NeutralPlayer)));
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace OpenRA.Traits
|
||||
for (int i = mini; i < maxi; i++)
|
||||
if (content[i,j].type == null
|
||||
&& GetAdjacentCellsWith(info, i,j ) > 0
|
||||
&& w.IsCellBuildable(new int2(i, j), UnitMovementType.Wheel))
|
||||
&& w.IsCellBuildable(new int2(i, j), false))
|
||||
growMask[i, j] = true;
|
||||
|
||||
for (int j = minj; j < maxj; j++)
|
||||
|
||||
Reference in New Issue
Block a user