From dc59bcd10df71b00e424398cc30b754f5aca9ec7 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 30 Dec 2022 17:08:18 -0500 Subject: [PATCH 1/4] fix thorium compatibility with direwolf's directions --- Items/Fishing/GlimmeringGemfish.cs | 36 ++++++++-------- Items/Fishing/StuffedFish.cs | 66 ++++++++++++++++-------------- World/DraedonStructures.cs | 19 ++++----- 3 files changed, 62 insertions(+), 59 deletions(-) diff --git a/Items/Fishing/GlimmeringGemfish.cs b/Items/Fishing/GlimmeringGemfish.cs index ca30a54b77..17fa488496 100644 --- a/Items/Fishing/GlimmeringGemfish.cs +++ b/Items/Fishing/GlimmeringGemfish.cs @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Fishing Item.value = Item.sellPrice(silver: 50); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) @@ -42,20 +42,22 @@ namespace CalamityMod.Items.Fishing itemLoot.Add(ItemID.Diamond, 10, gemMin, gemMax); itemLoot.Add(ItemID.Amber, 8, gemMin, gemMax); + // Add Thorium gems if Thorium is loaded. Mod thorium = CalamityMod.Instance.thorium; - if (thorium is not null) - { - try - { - itemLoot.Add(thorium.Find("Pearl").Type, 4, gemMin, gemMax); - itemLoot.Add(thorium.Find("Opal").Type, 4, gemMin, gemMax); - itemLoot.Add(thorium.Find("Onyx").Type, 4, gemMin, gemMax); - } - catch - { - CalamityMod.Instance.Logger.Debug("One of the items in this file got renamed internally. Please report this in the #bugs-read-pins channel of the official Calamity discord server."); - } - } + if (thorium is null) + return; + + var aquamarine = thorium.Find("Aquamarine"); + if (aquamarine is not null) + itemLoot.Add(aquamarine.Type, 4, gemMin, gemMax); + else + CalamityMod.Instance.Logger.Warn("Could not find Thorium Aquamarine gem. This item will not be added to Glimmering Gemfish."); + + var opal = thorium.Find("Opal"); + if (opal is not null) + itemLoot.Add(opal.Type, 4, gemMin, gemMax); + else + CalamityMod.Instance.Logger.Warn("Could not find Thorium Opal gem. This item will not be added to Glimmering Gemfish."); } } } diff --git a/Items/Fishing/StuffedFish.cs b/Items/Fishing/StuffedFish.cs index 776485d826..d0008900e4 100644 --- a/Items/Fishing/StuffedFish.cs +++ b/Items/Fishing/StuffedFish.cs @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Fishing Item.value = Item.sellPrice(silver: 50); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; - } + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.GoodieBags; + } public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) @@ -66,41 +66,45 @@ namespace CalamityMod.Items.Fishing itemLoot.AddIf(() => WorldGen.crimson , ItemID.CrimsonSeeds, 20, seedMin, seedMax); itemLoot.AddIf(() => Main.hardMode , ItemID.HallowedSeeds, 20, seedMin, seedMax); + // Add Thorium Marine Kelp if Thorium is loaded. Mod thorium = CalamityMod.Instance.thorium; - if (thorium is not null) - { - try - { - itemLoot.Add(thorium.Find("MarineKelp").Type, 4, herbMin, herbMax); - itemLoot.Add(thorium.Find("MarineKelpSeeds").Type, 10, seedMin, seedMax); - } - catch - { - CalamityMod.Instance.Logger.Debug("One of the items in this file got renamed internally. Please report this in the #bugs-read-pins channel of the official Calamity discord server."); - } - } + if (thorium is null) + return; + var marineKelp = thorium.Find("MarineKelp"); + var marineKelpSeeds = thorium.Find("MarineKelpSeeds"); + if (marineKelp is not null && marineKelpSeeds is not null) + { + itemLoot.Add(marineKelp.Type, 4, herbMin, herbMax); + itemLoot.Add(marineKelpSeeds.Type, 10, seedMin, seedMax); + } + else + CalamityMod.Instance.Logger.Warn("Could not find either Marine Kelp or Marine Kelp Seeds from Thorium. These items will not be added to Stuffed Fish."); + + // Ozzatron 30DEC2022: It is unlikely SoA will ever be ported to 1.4 and beyond. Commenting this out indefinitely. + /* Mod soa = CalamityMod.Instance.soa; if (soa is not null) { - try - { - itemLoot.Add(soa.Find("Welkinbell").Type, 4, herbMin, herbMax); - itemLoot.Add(soa.Find("WelkinbellSeeds").Type, 10, seedMin, seedMax); + try + { + itemLoot.Add(soa.Find("Welkinbell").Type, 4, herbMin, herbMax); + itemLoot.Add(soa.Find("WelkinbellSeeds").Type, 10, seedMin, seedMax); - itemLoot.AddIf(() => Main.hardMode, soa.Find("Illumifern").Type, 4, herbMin, herbMax); - itemLoot.AddIf(() => Main.hardMode, soa.Find("IllumifernSeeds").Type, 10, seedMin, seedMax); + itemLoot.AddIf(() => Main.hardMode, soa.Find("Illumifern").Type, 4, herbMin, herbMax); + itemLoot.AddIf(() => Main.hardMode, soa.Find("IllumifernSeeds").Type, 10, seedMin, seedMax); - // TODO -- There is no way to determine if SoA's Abaddon is dead without reflection. - // Dan Yami has confirmed that downed calls will be added to SoA eventually. - //itemLoot.AddIf(() => SacredTools.ModdedWorld.downedAbaddon, soa.Find("Enduflora").Type, 4, herbMin, herbMax); - //itemLoot.AddIf(() => SacredTools.ModdedWorld.downedAbaddon, soa.Find("EndufloraSeeds").Type, 10, seedMin, seedMax); - } - catch - { - CalamityMod.Instance.Logger.Debug("One of the items in this file got renamed internally. Please report this in the #bugs-read-pins channel of the official Calamity discord server."); - } + // TODO -- There is no way to determine if SoA's Abaddon is dead without reflection. + // Dan Yami has confirmed that downed calls will be added to SoA eventually. + //itemLoot.AddIf(() => SacredTools.ModdedWorld.downedAbaddon, soa.Find("Enduflora").Type, 4, herbMin, herbMax); + //itemLoot.AddIf(() => SacredTools.ModdedWorld.downedAbaddon, soa.Find("EndufloraSeeds").Type, 10, seedMin, seedMax); + } + catch + { + CalamityMod.Instance.Logger.Debug("One of the items in this file got renamed internally. Please report this in the #bugs-read-pins channel of the official Calamity discord server."); + } } + */ } } } diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 11fef26c56..fbdb6bd2c1 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -575,18 +575,15 @@ namespace CalamityMod.World else contents.Insert(8, new ChestItem(ItemID.CrimsonPlanterBox, WorldGen.genRand.Next(5, 9 + 1))); + // Add Thorium Marine Kelp if Thorium is loaded. Mod thorium = CalamityMod.Instance.thorium; - if (thorium != null) - { - try - { - contents.Add(new ChestItem(thorium.Find("MarineKelpPlanterBox").Type, WorldGen.genRand.Next(5, 9 + 1))); - } - catch - { - CalamityMod.Instance.Logger.Debug("One of the items in this file got renamed internally. Please report this in the #bugs-read-pins channel of the official Calamity discord server."); - } - } + if (thorium is not null) + { + var marineKelpPlanterBox = thorium.Find("MarineKelpPlanterBox"); + contents.Add(new ChestItem(marineKelpPlanterBox.Type, WorldGen.genRand.Next(5, 9 + 1))); + } + else + CalamityMod.Instance.Logger.Warn("Could not find Thorium Marine Kelp Planter Box. This item will not be added to the Draedon Planetoid Lab."); //Adds the Jungle Seeking Mechanism contents.Insert(0, new ChestItem(ModContent.ItemType(), 1)); From 1ca4230082d1a6cbf180f77f8989f69f9d201596 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 30 Dec 2022 17:19:06 -0500 Subject: [PATCH 2/4] unreleased version bump to 2.0.1.006 (one ahead of release) --- build.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.txt b/build.txt index 02f151571a..b8e27991ea 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 2.0.1.004 +version = 2.0.1.006 displayName = Calamity Mod homepage = https://discord.gg/calamity buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes From cf4da7ac130146bb4856cc7d6fa6c73ec7710b18 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Sat, 31 Dec 2022 05:29:41 +0700 Subject: [PATCH 3/4] condemnation star --- Projectiles/Ranged/CondemnationHoldout.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index 70c7f32eb4..5a712961e1 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -91,6 +91,28 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.dedServ) return; + + //Special visuals for the final loaded arrow + if (ArrowsLoaded >= Condemnation.MaxLoadedArrows - 1f) + { + //Star + for (int i = 0; i < 5; i++) + { + float angle = MathHelper.Pi * 1.5f - i * MathHelper.TwoPi / 5f; + float nextAngle = MathHelper.Pi * 1.5f - (i + 2) * MathHelper.TwoPi / 5f; + Vector2 start = angle.ToRotationVector2(); + Vector2 end = nextAngle.ToRotationVector2(); + for (int j = 0; j < 40; j++) + { + Dust starDust = Dust.NewDustPerfect(tipPosition, 267); + starDust.scale = 2.5f; + starDust.velocity = Vector2.Lerp(start, end, j / 40f) * 16f; + starDust.color = Color.Crimson; + starDust.noGravity = true; + } + } + return; + } for (int i = 0; i < 36; i++) { From be423477e20800bf8d3e577553ce702d616a35e9 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Sat, 31 Dec 2022 06:59:33 +0700 Subject: [PATCH 4/4] Added Ashen Accent Slab --- .../FurnitureAshen/AshenAccentSlab.cs | 45 ++ Tiles/FurnitureAshen/AshenAccentSlab.cs | 659 ++++++++++++++++++ 2 files changed, 704 insertions(+) create mode 100644 Items/Placeables/FurnitureAshen/AshenAccentSlab.cs create mode 100644 Tiles/FurnitureAshen/AshenAccentSlab.cs diff --git a/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs b/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs new file mode 100644 index 0000000000..9565c9b6b7 --- /dev/null +++ b/Items/Placeables/FurnitureAshen/AshenAccentSlab.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureAshen +{ + public class AshenAccentSlab : ModItem + { + public override string Texture => "CalamityMod/Items/Placeables/FurnitureAshen/AshenSlab"; + + public override void SetStaticDefaults() + { + SacrificeTotal = 100; + Tooltip.SetDefault("An Ashen Slab variant that merges differently with nearby blocks\n" + + "Favored by advanced builders"); + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Orange; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void AddRecipes() + { + CreateRecipe(50). + AddIngredient(50). + AddIngredient(). + AddTile(). + AddCondition(Recipe.Condition.InGraveyardBiome). + Register(); + } + } +} diff --git a/Tiles/FurnitureAshen/AshenAccentSlab.cs b/Tiles/FurnitureAshen/AshenAccentSlab.cs new file mode 100644 index 0000000000..82dd833065 --- /dev/null +++ b/Tiles/FurnitureAshen/AshenAccentSlab.cs @@ -0,0 +1,659 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Tiles.FurnitureAshen +{ + public class AshenAccentSlab : ModTile + { + public override string Texture => "CalamityMod/Tiles/FurnitureAshen/AshenSlab"; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = false; + Main.tileBlockLight[Type] = true; + + ItemDrop = ModContent.ItemType(); + HitSound = SoundID.Tink; + MineResist = 5f; + MinPick = 180; + AddMapEntry(new Color(40, 24, 48)); + AnimationFrameHeight = 90; + } + int animationFrameWidth = 234; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + { + int uniqueAnimationFrameX = Main.tileFrame[Type] + i; + int uniqueAnimationFrameY = Main.tileFrame[Type] + j; + int xPos = i % 2; + int yPos = j % 3; + int xPattern = i % 20 / 2; + int yPattern = j % 30 / 3; + int xOffset; + switch (xPattern) + { + case 0: + switch (yPattern) + { + case 1: + xOffset = 1; + break; + case 5: + xOffset = 0; + break; + case 8: + xOffset = 2; + break; + case 9: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 1: + switch (yPattern) + { + case 0: + xOffset = 2; + break; + case 3: + xOffset = 0; + break; + case 8: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 2: + switch (yPattern) + { + case 2: + xOffset = 0; + break; + case 7: + xOffset = 1; + break; + case 8: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 3: + switch (yPattern) + { + case 2: + xOffset = 2; + break; + case 5: + xOffset = 2; + break; + case 7: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 4: + switch (yPattern) + { + case 1: + xOffset = 0; + break; + case 4: + xOffset = 0; + break; + case 9: + xOffset = 2; + break; + default: + xOffset = -1; + break; + } + break; + case 5: + switch (yPattern) + { + case 0: + xOffset = 1; + break; + case 7: + xOffset = 0; + break; + case 8: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 6: + switch (yPattern) + { + case 5: + xOffset = 2; + break; + case 8: + xOffset = 1; + break; + case 12: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 7: + switch (yPattern) + { + case 2: + xOffset = 0; + break; + case 6: + xOffset = 0; + break; + case 7: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 8: + switch (yPattern) + { + case 3: + xOffset = 0; + break; + case 4: + xOffset = 0; + break; + case 9: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 9: + switch (yPattern) + { + case 1: + xOffset = 0; + break; + case 7: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + default: + xOffset = -1; + break; + } + if (yPos < 2) + { + if (xOffset != -1) + { + if (j % 3 < 2) + { + uniqueAnimationFrameX = Main.tile[i - (i % 2), j - (j % 3)].TileFrameNumber; + } + if (uniqueAnimationFrameX != 0) + { + uniqueAnimationFrameX += xOffset; + } + } + else + { + uniqueAnimationFrameX = 0; + } + } + switch (yPos) + { + case 0: + switch (xPos) + { + case 0: + uniqueAnimationFrameY = 0; + break; + case 1: + uniqueAnimationFrameY = 2; + break; + } + break; + case 1: + switch (xPos) + { + case 0: + uniqueAnimationFrameY = 1; + break; + case 1: + uniqueAnimationFrameY = 3; + break; + } + break; + case 2: + uniqueAnimationFrameY = 4 + xPos; + uniqueAnimationFrameX = 0; + break; + default: + uniqueAnimationFrameY = 0; + break; + } + frameXOffset = uniqueAnimationFrameX * animationFrameWidth; + frameYOffset = uniqueAnimationFrameY * AnimationFrameHeight; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + int uniqueAnimationFrameX = 0; + int uniqueAnimationFrameY = 0; + int xPos = i % 2; + int yPos = j % 3; + int xPattern = i % 20 / 2; + int yPattern = j % 30 / 3; + int xOffset; + switch (xPattern) + { + case 0: + switch (yPattern) + { + case 1: + xOffset = 1; + break; + case 5: + xOffset = 0; + break; + case 8: + xOffset = 2; + break; + case 9: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 1: + switch (yPattern) + { + case 0: + xOffset = 2; + break; + case 3: + xOffset = 0; + break; + case 8: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 2: + switch (yPattern) + { + case 2: + xOffset = 0; + break; + case 7: + xOffset = 1; + break; + case 8: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 3: + switch (yPattern) + { + case 2: + xOffset = 2; + break; + case 5: + xOffset = 2; + break; + case 7: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 4: + switch (yPattern) + { + case 1: + xOffset = 0; + break; + case 4: + xOffset = 0; + break; + case 9: + xOffset = 2; + break; + default: + xOffset = -1; + break; + } + break; + case 5: + switch (yPattern) + { + case 0: + xOffset = 1; + break; + case 7: + xOffset = 0; + break; + case 8: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 6: + switch (yPattern) + { + case 5: + xOffset = 2; + break; + case 8: + xOffset = 1; + break; + case 12: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 7: + switch (yPattern) + { + case 2: + xOffset = 0; + break; + case 6: + xOffset = 0; + break; + case 7: + xOffset = 1; + break; + default: + xOffset = -1; + break; + } + break; + case 8: + switch (yPattern) + { + case 3: + xOffset = 0; + break; + case 4: + xOffset = 0; + break; + case 9: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + case 9: + switch (yPattern) + { + case 1: + xOffset = 0; + break; + case 7: + xOffset = 0; + break; + default: + xOffset = -1; + break; + } + break; + default: + xOffset = -1; + break; + } + if (yPos < 2) + { + if (xOffset != -1) + { + if (j % 3 < 2) + { + uniqueAnimationFrameX = Main.tile[i - (i % 2), j - (j % 3)].TileFrameNumber; + } + if (uniqueAnimationFrameX != 0) + { + uniqueAnimationFrameX += xOffset; + } + } + else + { + uniqueAnimationFrameX = 0; + } + } + switch (yPos) + { + case 0: + switch (xPos) + { + case 0: + uniqueAnimationFrameY = 0; + break; + case 1: + uniqueAnimationFrameY = 2; + break; + } + break; + case 1: + switch (xPos) + { + case 0: + uniqueAnimationFrameY = 1; + break; + case 1: + uniqueAnimationFrameY = 3; + break; + } + break; + case 2: + uniqueAnimationFrameY = 4 + xPos; + uniqueAnimationFrameX = 0; + break; + default: + uniqueAnimationFrameY = 0; + break; + } + int AnimationFrameHeight = 90; + int animationFrameWidth = 234; + int xDrawPos = Main.tile[i, j].TileFrameX + (uniqueAnimationFrameX * animationFrameWidth); + int yDrawPos = Main.tile[i, j].TileFrameY + (uniqueAnimationFrameY * AnimationFrameHeight); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenSlabGlow").Value; + Color drawColour = GetDrawColour(i, j, new Color(64, 64, 64, 64)); + Tile trackTile = Main.tile[i, j]; + double num6 = Main.time * 0.08; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + { + Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xDrawPos, yDrawPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + else if (trackTile.IsHalfBlock) + { + Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xDrawPos, yDrawPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + + private Color GetDrawColour(int i, int j, Color colour) + { + int colType = Main.tile[i, j].TileColor; + Color paintCol = WorldGen.paintColor(colType); + if (colType >= 13 && colType <= 24) + { + colour.R = (byte)(paintCol.R / 255f * colour.R); + colour.G = (byte)(paintCol.G / 255f * colour.G); + colour.B = (byte)(paintCol.B / 255f * colour.B); + } + return colour; + } + + /* + /// + /// Gets the tile variant to use. Returns -1 by default + /// + /// + /// + /// + public int GetTileVariant(int i, int j) + { + int variant = 0; //Default to using variant 1 + if (j % 3 < 2) + { + //We need to get the particular tile to refer to. This is the top left tile in each iteration of the pattern (large slab above the small rune bricks + Tile sourceTile = Main.tile[i - (i % 2), j - (j % 3)]; //Gets the tile for this iteration by taking the current position of the tile minus this tile's position in the pattern + //Now to get the particular 'variant group' to use, which is used to take the frameX/frameY of the tile and convert it to the variant the tile is using + int frameX = sourceTile.frameX / 18; + int frameY = sourceTile.frameY / 18; + if (frameY < 3 && !(frameX >= 6 && frameX < 9)) + { + int group = 0; + int[] group1XPos = new int[] { 1, 2, 3 }; + int[] group2XPos = new int[] { 0, 4, 5, 9, 10, 11, 12 }; + foreach (int k in group1XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 1; + } + } + foreach (int k in group2XPos) + { + if (frameX < k + 1 && frameX >= k) + { + group = 2; + } + } + if (group == 1) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 3) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (group == 2) + { + if (frameY < 1) + { + variant = 0; + } + else if (frameY < 2) + { + variant = 1; + } + else + { + variant = 2; + } + } + } + else if (frameX < 6 && frameY >= 3) + { + if (frameX < 2) + { + variant = 0; + } + else if (frameX < 4) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 6 && frameX < 9) + { + if (frameX < 7) + { + variant = 0; + } + else if (frameX < 8) + { + variant = 1; + } + else + { + variant = 2; + } + } + else if (frameX >= 9 && frameY >= 3) + { + if (frameX < 10) + { + variant = 0; + } + else if (frameX < 11) + { + variant = 1; + } + else + { + variant = 2; + } + } + } + return (variant); + } + */ + } +}