From ce3efb76141e708816fdfdc8a64b2aab2aa2ce4f Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Tue, 28 Dec 2021 05:19:09 +0100 Subject: [PATCH] Fuck you *abstractifies your class* --- Items/Placeables/MetaTile.cs | 2 +- Tiles/MetaTileCrystalExample.cs | 33 +++++++++++++++++++++++++++++++++ Tiles/SuperDirectionalTile.cs | 23 +---------------------- 3 files changed, 35 insertions(+), 23 deletions(-) create mode 100644 Tiles/MetaTileCrystalExample.cs diff --git a/Items/Placeables/MetaTile.cs b/Items/Placeables/MetaTile.cs index 9cd8449ab8..49bbecbd29 100644 --- a/Items/Placeables/MetaTile.cs +++ b/Items/Placeables/MetaTile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables public override void SetDefaults() { - item.createTile = ModContent.TileType(); + item.createTile = ModContent.TileType(); item.useStyle = ItemUseStyleID.SwingThrow; item.useTurn = true; item.useAnimation = 15; diff --git a/Tiles/MetaTileCrystalExample.cs b/Tiles/MetaTileCrystalExample.cs new file mode 100644 index 0000000000..649402d5ab --- /dev/null +++ b/Tiles/MetaTileCrystalExample.cs @@ -0,0 +1,33 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles +{ + public class MetaTileCrystalExample : SuperDirectionalTile + { + public override bool Autoload(ref string name, ref string texture) + { + texture = "CalamityMod/Tiles/MetaTileCrystalExample"; + return base.Autoload(ref name, ref texture); + } + + public override void SetDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeAstralTiles(Type); + CalamityUtils.SetMerge(Type, TileID.LeafBlock); + CalamityUtils.SetMerge(Type, TileID.LivingMahoganyLeaves); + CalamityUtils.SetMerge(Type, TileID.LivingWood); + CalamityUtils.SetMerge(Type, TileID.LivingMahogany); + + drop = ModContent.ItemType(); + AddMapEntry(new Color(45, 36, 63)); + } + } +} diff --git a/Tiles/SuperDirectionalTile.cs b/Tiles/SuperDirectionalTile.cs index 704b708ec7..a0ee26e578 100644 --- a/Tiles/SuperDirectionalTile.cs +++ b/Tiles/SuperDirectionalTile.cs @@ -6,13 +6,8 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles { - public class SuperDirectionalTile : ModTile + public abstract class SuperDirectionalTile : ModTile { - public override bool Autoload(ref string name, ref string texture) - { - texture = "CalamityMod/Tiles/MetaTileCrystalExample"; - return base.Autoload(ref name, ref texture); - } private enum TileDirection : byte { Up, Down, Left, Right, UpLeft, UpRight, DownLeft, DownRight, Center @@ -33,22 +28,6 @@ namespace CalamityMod.Tiles { 1, 1, 2, 2, 3, 3, 1, 2, 3, null, null, null, null } }; - public override void SetDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; - - CalamityUtils.MergeWithGeneral(Type); - CalamityUtils.MergeAstralTiles(Type); - CalamityUtils.SetMerge(Type, TileID.LeafBlock); - CalamityUtils.SetMerge(Type, TileID.LivingMahoganyLeaves); - CalamityUtils.SetMerge(Type, TileID.LivingWood); - CalamityUtils.SetMerge(Type, TileID.LivingMahogany); - - drop = ModContent.ItemType(); - AddMapEntry(new Color(45, 36, 63)); - } - private TileDirection? GiveDirection(int type, int i, int j) { Tile tile = Main.tile[i, j];