From 1f76789e5b97544b84f930fd12b519da577ebd1d Mon Sep 17 00:00:00 2001 From: GinYuH Date: Sun, 25 Sep 2022 19:31:25 -0700 Subject: [PATCH] astral to other conversion now uses a method --- NPCs/TownNPCs/AndroombaFriendly.cs | 11 +---------- World/AstralBiome.cs | 11 +++++++++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/NPCs/TownNPCs/AndroombaFriendly.cs b/NPCs/TownNPCs/AndroombaFriendly.cs index c81c1766d5..68c0945c1c 100644 --- a/NPCs/TownNPCs/AndroombaFriendly.cs +++ b/NPCs/TownNPCs/AndroombaFriendly.cs @@ -127,16 +127,7 @@ namespace CalamityMod.NPCs.TownNPCs type = ConvertType.Crimson; break; } - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - AstralBiome.ConvertFromAstral(x + i, y + j, type); - AstralBiome.ConvertFromAstral(x - i, y - j, type); - AstralBiome.ConvertFromAstral(x + i, y - j, type); - AstralBiome.ConvertFromAstral(x - i, y + j, type); - } - } + AstralBiome.ConvertFromAstral(x - 2, x + 2, y - 2, y + 2, type); WorldGen.Convert(x, y, conversionType, 2); } else diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index d92f450b84..2c59c7d6b7 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -892,6 +892,17 @@ namespace CalamityMod.World } } + public static void ConvertFromAstral(int startX, int endX, int startY, int endY, ConvertType convert) + { + for (int x = startX; x <= endX; x++) + { + for (int y = startY; y <= endY; y++) + { + ConvertFromAstral(x, y, convert); + } + } + } + public static void ConvertFromAstral(int x, int y, ConvertType convert, bool tileframe = true) { Tile tile = Main.tile[x, y];