Remove World.TileSet.
This commit is contained in:
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Correlate the tile "image" aka subtile with its position to find the template origin
|
||||
var tile = w.Map.MapTiles.Value[cell].Type;
|
||||
var index = w.Map.MapTiles.Value[cell].Index;
|
||||
var template = w.TileSet.Templates[tile];
|
||||
var template = w.Map.Rules.TileSet.Templates[tile];
|
||||
var ni = cell.X - index % template.Size.X;
|
||||
var nj = cell.Y - index / template.Size.X;
|
||||
|
||||
|
||||
@@ -28,9 +28,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public void WorldLoaded(World world, WorldRenderer wr)
|
||||
{
|
||||
domainIndexes = new Dictionary<uint, MovementClassDomainIndex>();
|
||||
var tileSet = world.Map.Rules.TileSet;
|
||||
var movementClasses =
|
||||
world.Map.Rules.Actors.Where(ai => ai.Value.HasTraitInfo<MobileInfo>())
|
||||
.Select(ai => (uint)ai.Value.TraitInfo<MobileInfo>().GetMovementClass(world.TileSet)).Distinct();
|
||||
.Select(ai => (uint)ai.Value.TraitInfo<MobileInfo>().GetMovementClass(tileSet)).Distinct();
|
||||
|
||||
foreach (var mc in movementClasses)
|
||||
domainIndexes[mc] = new MovementClassDomainIndex(world, mc);
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
Map = self.World.Map;
|
||||
Tileset = self.World.TileSet;
|
||||
Tileset = self.World.Map.Rules.TileSet;
|
||||
|
||||
Tiles = new CellLayer<CellContents>(Map);
|
||||
Resources = self.TraitsImplementing<ResourceType>()
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void LoadPalettes(WorldRenderer wr)
|
||||
{
|
||||
wr.AddPalette(info.Name, new ImmutablePalette(wr.World.Map.Open(world.TileSet.Palette), info.ShadowIndex), info.AllowModifiers);
|
||||
wr.AddPalette(info.Name, new ImmutablePalette(wr.World.Map.Open(world.Map.Rules.TileSet.Palette), info.ShadowIndex), info.AllowModifiers);
|
||||
}
|
||||
|
||||
public IEnumerable<string> PaletteNames { get { yield return info.Name; } }
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
get
|
||||
{
|
||||
// Only expose the palette if it is available for the shellmap's tileset (which is a requirement for its use).
|
||||
if (info.Tileset == null || info.Tileset == world.TileSet.Id)
|
||||
if (info.Tileset == null || info.Tileset == world.Map.Rules.TileSet.Id)
|
||||
yield return info.Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var domainIndex = world.WorldActor.TraitOrDefault<DomainIndex>();
|
||||
if (domainIndex != null)
|
||||
{
|
||||
var passable = mi.GetMovementClass(world.TileSet);
|
||||
var passable = mi.GetMovementClass(world.Map.Rules.TileSet);
|
||||
if (!domainIndex.IsPassable(source, target, (uint)passable))
|
||||
return EmptyPath;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var domainIndex = world.WorldActor.TraitOrDefault<DomainIndex>();
|
||||
if (domainIndex != null)
|
||||
{
|
||||
var passable = mi.GetMovementClass(world.TileSet);
|
||||
var passable = mi.GetMovementClass(world.Map.Rules.TileSet);
|
||||
tilesInRange = new List<CPos>(tilesInRange.Where(t => domainIndex.IsPassable(source, t, (uint)passable)));
|
||||
if (!tilesInRange.Any())
|
||||
return EmptyPath;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void LoadPalettes(WorldRenderer wr)
|
||||
{
|
||||
var filename = world.TileSet.PlayerPalette ?? world.TileSet.Palette;
|
||||
var filename = world.Map.Rules.TileSet.PlayerPalette ?? world.Map.Rules.TileSet.Palette;
|
||||
wr.AddPalette(info.Name, new ImmutablePalette(wr.World.Map.Open(filename), info.ShadowIndex), info.AllowModifiers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!rt.Info.AllowOnRamps)
|
||||
{
|
||||
var tile = world.Map.MapTiles.Value[cell];
|
||||
var tileInfo = world.TileSet.GetTileInfo(tile);
|
||||
var tileInfo = world.Map.Rules.TileSet.GetTileInfo(tile);
|
||||
if (tileInfo != null && tileInfo.RampType > 0)
|
||||
return false;
|
||||
}
|
||||
@@ -214,7 +214,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
CellContents CreateResourceCell(ResourceType t, CPos cell)
|
||||
{
|
||||
world.Map.CustomTerrain[cell] = world.TileSet.GetTerrainIndex(t.Info.TerrainType);
|
||||
world.Map.CustomTerrain[cell] = world.Map.Rules.TileSet.GetTerrainIndex(t.Info.TerrainType);
|
||||
|
||||
return new CellContents
|
||||
{
|
||||
|
||||
@@ -50,9 +50,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
var map = wr.World.Map;
|
||||
var tileSet = wr.World.TileSet;
|
||||
var tileSet = wr.World.Map.Rules.TileSet;
|
||||
var wcr = Game.Renderer.WorldRgbaColorRenderer;
|
||||
var colors = wr.World.TileSet.HeightDebugColors;
|
||||
var colors = tileSet.HeightDebugColors;
|
||||
var mouseCell = wr.Viewport.ViewToWorld(Viewport.LastMousePos).ToMPos(wr.World.Map);
|
||||
|
||||
foreach (var uv in wr.Viewport.AllVisibleCells.CandidateMapCoords)
|
||||
|
||||
Reference in New Issue
Block a user