fixing references to Ore.*
This commit is contained in:
@@ -28,7 +28,7 @@ namespace OpenRa
|
||||
if (impactSound != null) Sound.Play(impactSound + ".aud");
|
||||
|
||||
if (!isWater) Smudge.AddSmudge(targetTile, warhead);
|
||||
if (warhead.Ore) Ore.Destroy(targetTile.X, targetTile.Y);
|
||||
if (warhead.Ore) Game.world.Map.DestroyOre(targetTile.X, targetTile.Y);
|
||||
|
||||
var maxSpread = GetMaximumSpread(weapon, warhead);
|
||||
var hitActors = Game.world.FindUnitsInCircle(loc, maxSpread);
|
||||
|
||||
@@ -17,27 +17,29 @@ namespace OpenRa
|
||||
}
|
||||
}
|
||||
|
||||
public static void Destroy(int i, int j)
|
||||
public static void DestroyOre(this Map map, int i, int j)
|
||||
{
|
||||
if (Game.world.Map.ContainsResource(new int2(i, j)))
|
||||
if (map.ContainsResource(new int2(i, j)))
|
||||
{
|
||||
Game.world.Map.MapTiles[i, j].density = 0;
|
||||
Game.world.Map.MapTiles[i, j].overlay = 0xff;
|
||||
map.MapTiles[i, j].density = 0;
|
||||
map.MapTiles[i, j].overlay = 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CanSpreadInto(int i, int j)
|
||||
public static bool OreCanSpreadInto(this World world, int i, int j)
|
||||
{
|
||||
if (Game.world.BuildingInfluence.GetBuildingAt(new int2(i, j)) != null)
|
||||
if (world.BuildingInfluence.GetBuildingAt(new int2(i, j)) != null)
|
||||
return false;
|
||||
|
||||
return TerrainCosts.Cost(UnitMovementType.Wheel,
|
||||
Game.world.TileSet.GetWalkability(Game.world.Map.MapTiles[i, j]))
|
||||
world.TileSet.GetWalkability(world.Map.MapTiles[i, j]))
|
||||
< double.PositiveInfinity;
|
||||
}
|
||||
|
||||
public static void GrowOre(this Map map, Random r)
|
||||
public static void GrowOre(this World world, Random r)
|
||||
{
|
||||
var map = world.Map;
|
||||
|
||||
var mini = map.XOffset; var maxi = map.XOffset + map.Width;
|
||||
var minj = map.YOffset; var maxj = map.YOffset + map.Height;
|
||||
var chance = Rules.General.OreChance;
|
||||
@@ -53,7 +55,7 @@ namespace OpenRa
|
||||
if (!map.HasOverlay(i, j)
|
||||
&& r.NextDouble() < chance
|
||||
&& map.GetOreDensity(i, j) > 0
|
||||
&& CanSpreadInto(i,j))
|
||||
&& world.OreCanSpreadInto(i,j))
|
||||
newOverlay[i, j] = ChooseOre();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRa.Traits
|
||||
for (var j = -1; j < 2; j++)
|
||||
for (var i = -1; i < 2; i++)
|
||||
if (Game.SharedRandom.NextDouble() < info.Chance)
|
||||
if (Ore.CanSpreadInto(self.Location.X + i, self.Location.Y + j))
|
||||
if (Game.world.OreCanSpreadInto(self.Location.X + i, self.Location.Y + j))
|
||||
Game.world.Map.AddOre(self.Location.X + i, self.Location.Y + j);
|
||||
|
||||
ticks = info.Interval;
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace OpenRa
|
||||
if (--oreTicks == 0)
|
||||
using( new PerfSample( "ore" ) )
|
||||
{
|
||||
Map.GrowOre( Game.SharedRandom );
|
||||
this.GrowOre( Game.SharedRandom );
|
||||
Game.world.Minimap.InvalidateOre();
|
||||
oreTicks = oreFrequency;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user