Disgusting Meat and Divine Cornucopia + cleanup

* Added Divine Cornucopia (sprite is a placeholder)
* Made Disgusting Meat consumable and stackable.
* Gave Disgusting Meat a custom player animation for vomiting up items.
* Renamed all of Piggy's and Divine Swine's sound files for consistency.
This commit is contained in:
fryzahh committed 2026-04-23 12:47:07 -04:00
1 parent ccd655c43c
commit d760f5c356
21 files changed
+220 -72

No files matched your search

-1
View File
@@ -12,7 +12,6 @@ namespace CalamityMod.Items.Potions.Food
public new string LocalizationCategory => "Items.Potions";
public override void SetStaticDefaults()
{
ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType<DisgustingMeat>();
Item.ResearchUnlockCount = 5;
Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3));
ItemID.Sets.FoodParticleColors[Type] = new Color[2] {
+42
View File
@@ -0,0 +1,42 @@
using CalamityMod.Items.Tools;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Potions.Food
{
public class DivineCornucopia : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Potions";
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 5;
Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3));
ItemID.Sets.IsFood[Type] = true;
ItemID.Sets.FoodParticleColors[Type] = new Color[3] {
new Color(241, 4, 8),
new Color(142, 183, 57),
new Color(245, 222, 73),
};
}
public override void SetDefaults()
{
Item.width = 32;
Item.height = 28;
Item.useAnimation = Item.useTime = 17;
Item.rare = ItemRarityID.Blue;
Item.value = Item.buyPrice(silver: 50);
Item.maxStack = 1;
Item.UseSound = SoundID.Item2;
Item.useStyle = ItemUseStyleID.DrinkLiquid;
Item.buffType = BuffID.WellFed;
Item.buffTime = CalamityUtils.MinutesToFrames(30);
Item.useTurn = true;
Item.consumable = false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

+157 -59
View File
@@ -1,8 +1,12 @@
using CalamityMod.Items.PermanentBoosters;
using CalamityMod.Items.Potions.Food;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using CalamityMod.Particles;
using Terraria.DataStructures;
namespace CalamityMod.Items.Tools
{
@@ -10,88 +14,182 @@ namespace CalamityMod.Items.Tools
{
public new string LocalizationCategory => "Items.Tools";
public override void SetStaticDefaults()
{
ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType<DeliciousMeat>();
}
public override void SetDefaults()
{
Item.DefaultToFood(26, 36, 0, 0);
Item.value = 0;
Item.UseSound = SoundID.NPCDeath13;
Item.maxStack = 1;
Item.consumable = false;
Item.UseSound = SoundID.NPCHit20;
}
public override bool AltFunctionUse(Player player) => true;
public override bool? UseItem(Player player)
{
if (player.ItemTimeIsZero)
{
var calPlayer = player.Calamity();
DisgustingMeatAnimationPlayer modPlayer = player.GetModPlayer<DisgustingMeatAnimationPlayer>();
if (player.altFunctionUse == 2)
{
TryDropBoosterItem(player, ref calPlayer.rageBoostOne, ModContent.ItemType<MushroomPlasmaRoot>());
TryDropBoosterItem(player, ref calPlayer.rageBoostTwo, ModContent.ItemType<InfernalBlood>());
TryDropBoosterItem(player, ref calPlayer.rageBoostThree, ModContent.ItemType<RedLightningContainer>());
TryDropBoosterItem(player, ref calPlayer.adrenalineBoostOne, ModContent.ItemType<ElectrolyteGelPack>());
TryDropBoosterItem(player, ref calPlayer.adrenalineBoostTwo, ModContent.ItemType<StarlightFuelCell>());
TryDropBoosterItem(player, ref calPlayer.adrenalineBoostThree, ModContent.ItemType<Ectoheart>());
}
else
{
if (calPlayer.sTangerine || calPlayer.mFruit || calPlayer.tCloudberry || calPlayer.sStrawberry)
{
TryDropBoosterItem(player, ref calPlayer.sTangerine, ModContent.ItemType<SanguineTangerine>());
TryDropBoosterItem(player, ref calPlayer.mFruit, ModContent.ItemType<MiracleFruit>());
TryDropBoosterItem(player, ref calPlayer.tCloudberry, ModContent.ItemType<TaintedCloudberry>());
TryDropBoosterItem(player, ref calPlayer.sStrawberry, ModContent.ItemType<SacredStrawberry>());
}
else
{
for (int i = 0; i < player.ConsumedLifeFruit; i++)
{
int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, ItemID.LifeFruit);
Main.item[drop].noGrabDelay = 100;
}
player.ConsumedLifeFruit = 0;
for (int j = 0; j < player.ConsumedLifeCrystals; j++)
{
int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, ItemID.LifeCrystal);
Main.item[drop].noGrabDelay = 100;
}
player.ConsumedLifeCrystals = 0;
}
if (calPlayer.cShard || calPlayer.eCore || calPlayer.pHeart)
{
TryDropBoosterItem(player, ref calPlayer.cShard, ModContent.ItemType<CometShard>());
TryDropBoosterItem(player, ref calPlayer.eCore, ModContent.ItemType<EtherealCore>());
TryDropBoosterItem(player, ref calPlayer.pHeart, ModContent.ItemType<PhantomHeart>());
}
else
{
for (int k = 0; k < player.ConsumedManaCrystals; k++)
{
int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, ItemID.ManaCrystal);
Main.item[drop].noGrabDelay = 100;
}
player.ConsumedManaCrystals = 0;
}
}
modPlayer.EjectRevengeanceModeUpgrades = true;
modPlayer.DoingVomitAnimation = true;
return true;
}
return null;
}
}
private static void TryDropBoosterItem(Player player, ref bool condition, int itemType)
public class DisgustingMeatAnimationPlayer : ModPlayer
{
public static int VomitEjectTime => 75;
public static int VomitMaxTime => 130;
public bool EjectRevengeanceModeUpgrades = false;
public bool DoingVomitAnimation = false;
public int VomitTime = 0;
public override void UpdateDead()
{
DoingVomitAnimation = false;
EjectRevengeanceModeUpgrades = false;
VomitTime = 0;
}
public override void PostUpdateMiscEffects()
{
if (DoingVomitAnimation)
{
// Eject all necessary items at once.
if (VomitTime == VomitEjectTime)
{
var calPlayer = Player.Calamity();
if (EjectRevengeanceModeUpgrades)
{
// Rage and Adrenaline upgrades.
TryDropBoosterItem(ref calPlayer.rageBoostOne, ModContent.ItemType<MushroomPlasmaRoot>());
TryDropBoosterItem(ref calPlayer.rageBoostTwo, ModContent.ItemType<InfernalBlood>());
TryDropBoosterItem(ref calPlayer.rageBoostThree, ModContent.ItemType<RedLightningContainer>());
TryDropBoosterItem(ref calPlayer.adrenalineBoostOne, ModContent.ItemType<ElectrolyteGelPack>());
TryDropBoosterItem(ref calPlayer.adrenalineBoostTwo, ModContent.ItemType<StarlightFuelCell>());
TryDropBoosterItem(ref calPlayer.adrenalineBoostThree, ModContent.ItemType<Ectoheart>());
}
else
{
if (calPlayer.sTangerine || calPlayer.mFruit || calPlayer.tCloudberry || calPlayer.sStrawberry)
{
// Calamity's health boosters.
TryDropBoosterItem(ref calPlayer.sTangerine, ModContent.ItemType<SanguineTangerine>());
TryDropBoosterItem(ref calPlayer.mFruit, ModContent.ItemType<MiracleFruit>());
TryDropBoosterItem(ref calPlayer.tCloudberry, ModContent.ItemType<TaintedCloudberry>());
TryDropBoosterItem(ref calPlayer.sStrawberry, ModContent.ItemType<SacredStrawberry>());
}
else
{
// Vanilla health boosters.
for (int i = 0; i < Player.ConsumedLifeFruit; i++)
{
int drop = Item.NewItem(Player.GetSource_DropAsItem(), Player.Hitbox, ItemID.LifeFruit);
Main.item[drop].noGrabDelay = 100;
Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f));
}
Player.ConsumedLifeFruit = 0;
for (int j = 0; j < Player.ConsumedLifeCrystals; j++)
{
int drop = Item.NewItem(Player.GetSource_DropAsItem(), Player.Hitbox, ItemID.LifeCrystal);
Main.item[drop].noGrabDelay = 100;
Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f));
}
Player.ConsumedLifeCrystals = 0;
}
if (calPlayer.cShard || calPlayer.eCore || calPlayer.pHeart)
{
// Calamity's mana boosters.
TryDropBoosterItem(ref calPlayer.cShard, ModContent.ItemType<CometShard>());
TryDropBoosterItem(ref calPlayer.eCore, ModContent.ItemType<EtherealCore>());
TryDropBoosterItem(ref calPlayer.pHeart, ModContent.ItemType<PhantomHeart>());
}
else
{
// Vanilla mana boosters.
for (int k = 0; k < Player.ConsumedManaCrystals; k++)
{
int drop = Item.NewItem(Player.GetSource_DropAsItem(), Player.Hitbox, ItemID.ManaCrystal);
Main.item[drop].noGrabDelay = 100;
Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f));
}
Player.ConsumedManaCrystals = 0;
}
}
SoundEngine.PlaySound(SoundID.NPCDeath13, Player.Center);
}
// Vomit particles bleeehhhhggghghghgh
if (VomitTime >= VomitEjectTime && VomitTime <= VomitMaxTime)
{
if (Main.rand.NextBool(2))
{
int dustAmt = Main.rand.Next(2, 5);
for (int i = 0; i < dustAmt; i++)
{
int dustType = Utils.SelectRandom(Main.rand, DustID.ToxicBubble, DustID.GreenBlood, DustID.Blood);
Vector2 spawnPosition = Player.Center + new Vector2(9f * Player.direction, -8f);
Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.ToRadians(20f) + Player.headRotation) * Main.rand.NextFloat(6f, 8f) * Player.direction;
Dust.NewDust(spawnPosition, 1, 1, dustType, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(0.8f, 1.2f));
}
}
if (Main.rand.NextBool(3))
{
Vector2 spawnPosition = Player.Center - new Vector2(9f * Player.direction, 8f);
Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.ToRadians(20f) + Player.headRotation) * Main.rand.NextFloat(6f, 8f) * Player.direction;
Color color = Color.Lerp(Color.DarkOliveGreen, Color.Green, Main.rand.NextFloat());
float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt();
TimedSmokeParticle vomit = new(spawnPosition, velocity, color, color, Main.rand.NextFloat(0.3f, 0.5f), Main.rand.NextFloat(0.8f, 1f), Main.rand.Next(30, 45), rotationSpeed);
GeneralParticleHandler.SpawnParticle(vomit, true);
}
}
if (VomitTime >= VomitMaxTime)
{
VomitTime = 0;
DoingVomitAnimation = false;
EjectRevengeanceModeUpgrades = false;
}
VomitTime++;
}
}
public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo)
{
if (VomitTime >= 0 && DoingVomitAnimation)
{
// Rapidly shift between random angles while vomiting.
float interpolant = Utils.GetLerpValue(0f, VomitEjectTime, VomitTime, true) * Utils.GetLerpValue(VomitMaxTime, VomitMaxTime - 15, VomitTime, true);
float idealRotationDegrees = MathHelper.Lerp(0f, 15f, interpolant);
drawInfo.drawPlayer.headRotation = MathHelper.ToRadians(Main.rand.NextFloat(-idealRotationDegrees, idealRotationDegrees));
// Close the eyes as well.
drawInfo.drawPlayer.eyeHelper.CurrentEyeFrame = Terraria.GameContent.PlayerEyeHelper.EyeFrame.EyeHalfClosed;
if (VomitTime >= VomitEjectTime)
drawInfo.drawPlayer.eyeHelper.CurrentEyeFrame = Terraria.GameContent.PlayerEyeHelper.EyeFrame.EyeClosed;
}
}
private void TryDropBoosterItem(ref bool condition, int itemType)
{
if (condition)
{
condition = false;
int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, itemType);
int drop = Item.NewItem(Player.GetSource_DropAsItem(), Player.Hitbox, itemType);
Main.item[drop].noGrabDelay = 100;
Main.item[drop].velocity = new Vector2(Main.rand.NextFloat(3f, 9f) * Player.direction, Main.rand.NextFloat(-6f, -4f));
}
}
}
@@ -416,6 +416,15 @@ Cometfruit: {
'''
}
DivineCornucopia: {
DisplayName: Divine Cornucopia
Tooltip:
'''
{$CommonItemTooltip.MinorStats}
'A bottomless wellspring of the finest produce'
'''
}
Jackfruit: {
DisplayName: Jackfruit
Tooltip: "{$CommonItemTooltip.MinorStats}"
+10 -10
View File
@@ -44,12 +44,12 @@ namespace CalamityMod.NPCs.NormalNPCs
private static Asset<Texture2D> MagicStarCircle;
private static Asset<Texture2D> FadedStarRing;
private static Asset<Texture2D> DistortionTexture;
private static Asset<Texture2D> DivineMeatTexture;
private static Asset<Texture2D> DivineCornucopiaTexture;
private static SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwine_Idle", 4);
private static SoundStyle CoinFailSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwine_CoinFail", 3);
private static SoundStyle CoinPassSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwine_CoinPass", 2);
private static SoundStyle SwineSpeakLoopingSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwine_NearbyLoop")
private static SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwineIdle", 4);
private static SoundStyle CoinFailSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwineCoinFail", 3);
private static SoundStyle CoinPassSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwineCoinPass", 2);
private static SoundStyle SwineSpeakLoopingSound = new("CalamityMod/Sounds/Custom/DivineSwine/DivineSwineNearbyLoop")
{
IsLooped = true,
PauseBehavior = PauseBehavior.PauseWithGame,
@@ -99,7 +99,7 @@ namespace CalamityMod.NPCs.NormalNPCs
MagicStarCircle = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/MagicStarCircle");
FadedStarRing = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/FadedStarRing");
DistortionTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Smudges");
DivineMeatTexture = ModContent.Request<Texture2D>("CalamityMod/Items/Potions/Food/DeliciousMeat");
DivineCornucopiaTexture = ModContent.Request<Texture2D>("CalamityMod/Items/Potions/Food/DivineCornucopia");
}
}
@@ -282,13 +282,13 @@ namespace CalamityMod.NPCs.NormalNPCs
}
}
// Meat granted
// Cornucopia granted
if (Timer == 210f)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int meat = Item.NewItem(NPC.GetSource_GiftOrReward(), NPC.Center, ModContent.ItemType<DeliciousMeat>());
Main.item[meat].velocity = Vector2.UnitY * -3f;
int cornucopia = Item.NewItem(NPC.GetSource_GiftOrReward(), NPC.Center, ModContent.ItemType<DivineCornucopia>());
Main.item[cornucopia].velocity = Vector2.UnitY * -3f;
}
CustomPulse meatLightRing = new(NPC.Center, Vector2.Zero, DivineBlue, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, 3f, 75);
@@ -650,7 +650,7 @@ namespace CalamityMod.NPCs.NormalNPCs
{
float rotation = (float)(Main.timeForVisualEffects / MathHelper.Pi * 0.08f) + NPC.whoAmI;
Vector2 backglowDrawPosition = drawPosition + Vector2.UnitX.RotatedBy(i * MathHelper.TwoPi / backShadowCount + rotation) * backShadowDistance;
spriteBatch.Draw(DivineMeatTexture.Value, backglowDrawPosition, DivineMeatTexture.Value.Frame(1, 3), NPC.GetAlpha(Color.White) * backShadowInterpolant, NPC.rotation, DivineMeatTexture.Value.Frame(1, 3).Size() * 0.5f, 1f, 0, 0f);
spriteBatch.Draw(DivineCornucopiaTexture.Value, backglowDrawPosition, DivineCornucopiaTexture.Value.Frame(1, 3), NPC.GetAlpha(Color.White) * backShadowInterpolant, NPC.rotation, DivineCornucopiaTexture.Value.Frame(1, 3).Size() * 0.5f, 1f, 0, 0f);
}
spriteBatch.SetBlendState(BlendState.AlphaBlend);
+1 -1
View File
@@ -54,7 +54,7 @@ namespace CalamityMod.NPCs.NormalNPCs
private static Asset<Texture2D> BloomCircle;
private static Asset<Texture2D> ShineFlare;
private static SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/Piggy/Piggy_Idle", 3)
private static SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/Piggy/PiggyIdle", 3)
{
Pitch = -0.6f,
PitchVariance = 0.2f,
+1 -1
View File
@@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.NormalNPCs
Running,
}
private static SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/Piggy/Piggy_Idle", 3);
private static SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/Piggy/PiggyIdle", 3);
public Vector2 SquashVector;
File renamed without changes.
File renamed without changes.
File renamed without changes.