Beispiel #1
0
        //in Terraria.Map.MapHelper.GetMapTileXnaColor after result is initialized call
        //  TileLoader.MapColor(tile, ref result);
        internal static void MapColor(MapTile mapTile, ref Color color)
        {
            Tile tile = Main.tile[mapTile.x, mapTile.y];

            if (tile.active())
            {
                ModTile modTile = GetTile(tile.type);
                if (modTile != null)
                {
                    Color?modColor = modTile.MapColor(mapTile.x, mapTile.y);
                    if (modColor.HasValue)
                    {
                        color = modColor.Value;
                    }
                }
            }
            else
            {
                ModWall modWall = WallLoader.GetWall(tile.wall);
                if (modWall != null)
                {
                    Color?modColor = modWall.MapColor(mapTile.x, mapTile.y);
                    if (modColor.HasValue)
                    {
                        color = modColor.Value;
                    }
                }
            }
        }
Beispiel #2
0
 //in Terraria.Main.DrawMap replace text = Lang.mapLegend[type]; with
 //  text = Lang.mapLegend[Main.Map[num91, num92]];
 public string this[MapTile mapTile]
 {
     get
     {
         Tile tile = Main.tile[mapTile.x, mapTile.y];
         if (tile.active())
         {
             if (tile.type >= TileID.Count)
             {
                 return(TileLoader.GetTile(tile.type).MapName(tile.frameX, tile.frameY));
             }
         }
         else if (tile.wall >= WallID.Count)
         {
             return(WallLoader.GetWall(tile.wall).mapName);
         }
         return(legend[mapTile.Type]);
     }
 }
Beispiel #3
0
 //at end of Terraria.Map.MapHelper.CreateMapTile before returning call
 //  MapLoader.ModMapOption(ref num16, i, j);
 internal static void ModMapOption(ref ushort mapType, int i, int j)
 {
     if (entryToTile.ContainsKey(mapType))
     {
         ModTile tile   = TileLoader.GetTile(entryToTile[mapType]);
         ushort  option = tile.GetMapOption(i, j);
         if (option < 0 || option >= modTileOptions(tile.Type))
         {
             throw new ArgumentOutOfRangeException("Bad map option for tile " + tile.Name + " from mod " + tile.mod.Name);
         }
         mapType += option;
     }
     else if (entryToWall.ContainsKey(mapType))
     {
         ModWall wall   = WallLoader.GetWall(entryToWall[mapType]);
         ushort  option = wall.GetMapOption(i, j);
         if (option < 0 || option >= modWallOptions(wall.Type))
         {
             throw new ArgumentOutOfRangeException("Bad map option for wall " + wall.Name + " from mod " + wall.mod.Name);
         }
         mapType += option;
     }
 }
Beispiel #4
0
 /// <summary>
 /// Gets the ModWall instance with the given type. If no ModWall with the given type exists, returns null.
 /// </summary>
 public static ModWall GetModWall(int type) => WallLoader.GetWall(type);