Onixplate + Wall

This commit is contained in:
Heart-Plus-Up committed 2023-01-24 16:09:21 -07:00
1 parent 32d70e5fa3
commit 015dfe6fe5
11 files changed
+189

No files matched your search

+2
View File
@@ -1,5 +1,6 @@
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Ores;
using CalamityMod.Items.Placeables.Plates;
using CalamityMod.Rarities;
using Terraria;
using Terraria.DataStructures;
@@ -39,6 +40,7 @@ namespace CalamityMod.Items.Accessories
CreateRecipe().
AddIngredient<HallowedRune>().
AddIngredient<RuinousSoul>(5).
AddIngredient<Onyxplate>(25).
AddIngredient<ExodiumCluster>(20).
AddTile(TileID.LunarCraftingStation).
Register();
+46
View File
@@ -0,0 +1,46 @@
using CalamityMod.Items.Placeables.Walls;
using CalamityMod.Items.Materials;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Placeables.Plates
{
public class Onyxplate : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Onyxplate");
Tooltip.SetDefault("It resonates with otherworldly energy.");
SacrificeTotal = 100;
}
public override void SetDefaults()
{
Item.createTile = ModContent.TileType<Tiles.Plates.Onyxplate>();
Item.useStyle = ItemUseStyleID.Swing;
Item.useTurn = true;
Item.useAnimation = 15;
Item.useTime = 10;
Item.autoReuse = true;
Item.consumable = true;
Item.width = 13;
Item.height = 10;
Item.maxStack = 999;
Item.value = Item.sellPrice(silver: 3);
Item.rare = ItemRarityID.Orange;
}
public override void AddRecipes()
{
CreateRecipe(25).
AddIngredient(ItemID.Obsidian, 50).
AddTile(TileID.Hellforge).
Register();
CreateRecipe().
AddIngredient<OnyxplateWall>(4).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

+34
View File
@@ -0,0 +1,34 @@
using Terraria.ModLoader;
using WallTiles = CalamityMod.Walls;
using Terraria.ID;
namespace CalamityMod.Items.Placeables.Walls
{
public class OnyxplateWall : ModItem
{
public override void SetStaticDefaults()
{
SacrificeTotal = 400;
DisplayName.SetDefault("Onyxplate Wall");
}
public override void SetDefaults()
{
Item.width = 12;
Item.height = 12;
Item.maxStack = 999;
Item.useTurn = true;
Item.autoReuse = true;
Item.useAnimation = 15;
Item.useTime = 7;
Item.useStyle = ItemUseStyleID.Swing;
Item.consumable = true;
Item.createWall = ModContent.WallType<WallTiles.OnyxplateWall>();
}
public override void AddRecipes()
{
CreateRecipe(4).AddIngredient(ModContent.ItemType<Plates.Onyxplate>()).AddTile(TileID.WorkBenches).Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

+81
View File
@@ -0,0 +1,81 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using ReLogic.Content;
namespace CalamityMod.Tiles.Plates
{
public class Onyxplate : ModTile
{
internal static Texture2D GlowTexture;
internal static Texture2D PulseTexture;
internal static Color[] PulseColors;
public override void SetStaticDefaults()
{
if (!Main.dedServ)
{
PulseTexture = ModContent.Request<Texture2D>("CalamityMod/Tiles/Plates/OnyxplatePulse", AssetRequestMode.ImmediateLoad).Value;
PulseColors = new Color[PulseTexture.Width];
Main.QueueMainThreadAction(() => PulseTexture.GetData(PulseColors));
GlowTexture = ModContent.Request<Texture2D>("CalamityMod/Tiles/Plates/OnyxplateGlow", AssetRequestMode.ImmediateLoad).Value;
}
Main.tileSolid[Type] = true;
Main.tileMergeDirt[Type] = true;
Main.tileBlockLight[Type] = true;
CalamityUtils.MergeWithGeneral(Type);
HitSound = SoundID.Tink;
MineResist = 1f;
DustType = 173;
ItemDrop = ModContent.ItemType<Items.Placeables.Plates.Onyxplate>();
AddMapEntry(new Color(182, 28, 232));
}
public override void PostDraw(int i, int j, SpriteBatch spriteBatch)
{
// If the cached textures don't exist for some reason, don't bother using them.
if (GlowTexture is null || PulseTexture is null)
return;
int xPos = Main.tile[i, j].TileFrameX;
int yPos = Main.tile[i, j].TileFrameY;
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;
// Glowmask 'pulse' effect
int factor = (int)Main.GameUpdateCount % PulseTexture.Width;
float brightness = PulseColors[factor].R / 255f;
int drawBrightness = (int)(80 * brightness) + 10;
Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness));
// If these tiles cause lag, comment out the pulse effect code and uncomment this:
//Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50));
Tile trackTile = Main.tile[i, j];
if (!trackTile.IsHalfBlock && trackTile.Slope == 0)
{
Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
else if (trackTile.IsHalfBlock)
{
Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 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;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B

+26
View File
@@ -0,0 +1,26 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Walls
{
public class OnyxplateWall : ModWall
{
public override void SetStaticDefaults()
{
Main.wallHouse[Type] = true;
ItemDrop = ModContent.ItemType<Items.Placeables.Walls.OnyxplateWall>();
AddMapEntry(new Color(92, 7, 92));
}
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 NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB