Skip to content

Commit

Permalink
Add wires to WorldAnalysis
Browse files Browse the repository at this point in the history
  • Loading branch information
BinaryConstruct committed Jul 17, 2023
1 parent e99af73 commit 4f575b0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/TEdit/Terraria/WorldAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ private static void WriteAnalyzeWorld(StreamWriter sb, World world, bool fullAna
sb.WriteLine("===SECTION: Tiles===");

var tileCounts = new Dictionary<int, int>();
var wireCounts = new List<int>() { 0, 0, 0, 0 };



int activeTiles = 0;
for (int x = 0; x < world.TilesWide; x++)
Expand All @@ -73,6 +76,11 @@ private static void WriteAnalyzeWorld(StreamWriter sb, World world, bool fullAna

var tile = world.Tiles[x, y];

if (tile.WireBlue) { wireCounts[0]++; }
if (tile.WireGreen) { wireCounts[1]++; }
if (tile.WireRed) { wireCounts[2]++; }
if (tile.WireYellow) { wireCounts[3]++; }

if (tile.IsActive)
{
if (tileCounts.ContainsKey(tile.Type))
Expand Down Expand Up @@ -110,6 +118,11 @@ private static void WriteAnalyzeWorld(StreamWriter sb, World world, bool fullAna
sb.WriteLine("{0}: {1} ({2:P2})", name, tilePair.Value, tilePair.Value / totalTiles);
}

sb.WriteLine("Blue Wires: {0}", wireCounts[0]);
sb.WriteLine("Green Wires: {0}", wireCounts[1]);
sb.WriteLine("Red Wires: {0}", wireCounts[2]);
sb.WriteLine("Yellow Wires: {0}", wireCounts[3]);


sb.WriteLine("===SECTION: Chests===");
sb.WriteProperty("Chest Count", world.Chests.Count);
Expand Down

0 comments on commit 4f575b0

Please sign in to comment.