From 4286cc3b277180497cec981d67f48b75b8913592 Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 7 Oct 2020 22:23:18 -0500 Subject: [PATCH] Placeable rock. --- Items/Rock.cs | 9 +++++++++ Tiles/PlacedRock.cs | 40 ++++++++++++++++++++++++++++++++++++++++ Tiles/PlacedRock.png | Bin 0 -> 213 bytes 3 files changed, 49 insertions(+) create mode 100644 Tiles/PlacedRock.cs create mode 100644 Tiles/PlacedRock.png diff --git a/Items/Rock.cs b/Items/Rock.cs index 49c2aa5bf0..15d49b2633 100644 --- a/Items/Rock.cs +++ b/Items/Rock.cs @@ -1,4 +1,6 @@ +using CalamityMod.Tiles; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items @@ -16,6 +18,13 @@ namespace CalamityMod.Items item.width = 20; item.height = 20; item.value = Item.buyPrice(0, 0, 0, 1); + item.createTile = ModContent.TileType(); + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; } } } diff --git a/Tiles/PlacedRock.cs b/Tiles/PlacedRock.cs new file mode 100644 index 0000000000..742922575a --- /dev/null +++ b/Tiles/PlacedRock.cs @@ -0,0 +1,40 @@ +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class PlacedRock : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + + dustType = DustID.Stone; + drop = ModContent.ItemType(); + + AddMapEntry(new Color(83, 91, 102)); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + WorldGen.Check1x1(i, j, Type); + return true; + } + + public override void PlaceInWorld(int i, int j, Item item) + { + Main.tile[i, j].frameX = 0; + Main.tile[i, j].frameY = 0; + } + } +} diff --git a/Tiles/PlacedRock.png b/Tiles/PlacedRock.png new file mode 100644 index 0000000000000000000000000000000000000000..26f0ed28a15f9d79aab2d16ea8e345e63917db44 GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|s0G|+7AT23kJab-KaY2%^gTIlvZE$oNQ1FY$RBIr`Q4-`A{2u}s?ltd? z1d4GMctjR6Fz_7)VaDV6D^h@hMxHK?AsWF)PZ%;W2=E*YxETMgJ~>qS?q1!@&!37X uY&y+oJ7exoz6p2S4JI#;o4q{!08^kSYwGv?fpdYn89ZJ6T-G@yGywqGr9vM7 literal 0 HcmV?d00001