Add sprites for RGBass, NeptuneSummon (Megaladon), RGBAlloy, and add animations to rarities
This commit is contained in:
@@ -17,5 +17,16 @@ namespace ForgottenWawiTech.Content.Items.Materials
|
||||
Item.value = Item.buyPrice(gold: 50);
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe()
|
||||
.AddIngredient(ItemID.FragmentNebula, 5)
|
||||
.AddIngredient(ItemID.FragmentSolar, 5)
|
||||
.AddIngredient(ItemID.FragmentVortex, 5)
|
||||
.AddIngredient(ItemID.FragmentStardust, 5)
|
||||
.AddIngredient(ItemID.WormholePotion, 1)
|
||||
.AddTile<Content.Tiles.CraftingStations.SingularitySealingUnit>()
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,31 @@
|
||||
// Animated by British_Raccoon
|
||||
using Terraria.ID;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.DataStructures;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using System;
|
||||
using Terraria.GameContent;
|
||||
|
||||
namespace ForgottenWawiTech.Content.Items.Materials
|
||||
{
|
||||
public class RGBAlloy : ModItem
|
||||
{
|
||||
private const int FRAME_COUNT = 5;
|
||||
private const int TICKS_PER_FRAME = 10;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.RegisterItemAnimation(Type, new DrawAnimationVertical(TICKS_PER_FRAME, FRAME_COUNT));
|
||||
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 20;
|
||||
Item.height = 20;
|
||||
Item.width = 32;
|
||||
Item.height = 32;
|
||||
Item.maxStack = 9999;
|
||||
Item.rare = ItemRarityID.White;
|
||||
Item.value = Item.buyPrice(gold: 50);
|
||||
@@ -24,5 +39,28 @@ namespace ForgottenWawiTech.Content.Items.Materials
|
||||
.AddTile(TileID.Anvils)
|
||||
.Register();
|
||||
}
|
||||
|
||||
// Some tML setups won't animate dropped items with just RegisterItemAnimation.
|
||||
// Manually draw the animated frame in-world to ensure it animates when dropped.
|
||||
public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
|
||||
{
|
||||
Texture2D texture = Terraria.GameContent.TextureAssets.Item[Type].Value;
|
||||
|
||||
// Protect against incorrect frame count
|
||||
int frameHeight = texture.Height / Math.Max(1, FRAME_COUNT);
|
||||
int frame = (int)((Main.GameUpdateCount / (ulong)Math.Max(1, TICKS_PER_FRAME)) % (ulong)Math.Max(1, FRAME_COUNT));
|
||||
|
||||
Rectangle source = new Rectangle(0, frame * frameHeight, texture.Width, frameHeight);
|
||||
|
||||
Vector2 drawPos = Item.Center - Main.screenPosition;
|
||||
Vector2 origin = new Vector2(source.Width / 2f, source.Height / 2f);
|
||||
|
||||
// Use alphaColor for dropped items (includes item alpha), multiplied by light
|
||||
Color drawColor = lightColor;
|
||||
|
||||
spriteBatch.Draw(texture, drawPos, source, drawColor, rotation, origin, scale, SpriteEffects.None, 0f);
|
||||
|
||||
return false; // we've handled the draw
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 4.7 KiB |
@@ -16,5 +16,17 @@ namespace ForgottenWawiTech.Content.Items.Materials
|
||||
Item.rare = ModContent.RarityType<SingularityItem>();
|
||||
Item.value = Item.buyPrice(gold: 10);
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe()
|
||||
.AddIngredient(ModContent.ItemType<ControlledSingularity>(), 2)
|
||||
.AddIngredient(ItemID.HallowedBar, 5)
|
||||
.AddIngredient(ItemID.SoulofMight, 3)
|
||||
.AddIngredient(ItemID.SoulofSight, 3)
|
||||
.AddIngredient(ItemID.SoulofFright, 3)
|
||||
.AddTile<Content.Tiles.CraftingStations.SingularitySealingUnit>()
|
||||
.Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user