made microwave beeping less spammable

This commit is contained in:
termigator1359 committed 2020-12-07 15:00:15 -05:00
1 parent 0f77aaf312
commit 9aa5d68407
3 files changed
+160 -114

No files matched your search

+94 -92
View File
@@ -4282,98 +4282,100 @@ namespace CalamityMod.CalPlayer
//Custom Death Messages
if (alcoholPoisoning && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
if (Main.rand.Next(2) == 0)
damageSource = PlayerDeathReason.ByCustomReason(player.name + " downed too many shots.");
else
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s liver failed.");
}
if (vHex && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was charred by the brimstone inferno.");
}
if ((ZoneCalamity && player.lavaWet) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s soul was released by the lava.");
}
if (gsInferno && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s soul was extinguished.");
}
if (sulphurPoison && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
if (Main.rand.NextBool(2))
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was melted by the toxic waste.");
else
damageSource = PlayerDeathReason.ByOther(9);
}
if (lethalLavaBurn && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " disintegrated into ashes.");
}
if (hInferno && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was turned to ashes by the Profaned Goddess.");
}
if (hFlames && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " fell prey to their sins.");
}
if (waterLeechBleeding && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " lost too much blood.");
}
if (shadowflame && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s spirit was turned to ash.");
}
if (bBlood && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " became a blood geyser.");
}
if (cDepth && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
if (Main.rand.NextBool(2))
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was crushed by the pressure.");
else
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s lungs collapsed.");
}
if ((bFlames || aFlames) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was consumed by the black flames.");
}
if (pFlames && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
if (Main.rand.NextBool(2))
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s flesh was melted by the plague.");
else
damageSource = PlayerDeathReason.ByCustomReason(player.name + " didn't vaccinate.");
}
if (astralInfection && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
if (Main.rand.NextBool(2))
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s infection spread too far.");
else
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s skin was replaced by the astral virus.");
}
if (nightwither && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was incinerated by lunar rays.");
}
if (vaporfied && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " vaporized into thin air.");
}
if (manaOverloader && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s life was completely converted into mana.");
}
if ((bloodyMary || everclear || evergreenGin || fireball || margarita || moonshine || moscowMule || redWine || screwdriver || starBeamRye || tequila || tequilaSunrise || vodka || whiteWine)
&& damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " succumbed to alcohol sickness.");
}
if (damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8)
{
if (alcoholPoisoning)
{
if (Main.rand.NextBool())
damageSource = PlayerDeathReason.ByCustomReason(player.name + " downed too many shots.");
else
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s liver failed.");
}
if (vHex)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was charred by the brimstone inferno.");
}
if (ZoneCalamity && player.lavaWet)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s soul was released by the lava.");
}
if (gsInferno)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s soul was extinguished.");
}
if (sulphurPoison)
{
if (Main.rand.NextBool(2))
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was melted by the toxic waste.");
else
damageSource = PlayerDeathReason.ByOther(9);
}
if (lethalLavaBurn)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " disintegrated into ashes.");
}
if (hInferno)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was turned to ashes by the Profaned Goddess.");
}
if (hFlames)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " fell prey to their sins.");
}
if (waterLeechBleeding)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " lost too much blood.");
}
if (shadowflame)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s spirit was turned to ash.");
}
if (bBlood)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " became a blood geyser.");
}
if (cDepth)
{
if (Main.rand.NextBool())
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was crushed by the pressure.");
else
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s lungs collapsed.");
}
if (bFlames || aFlames)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was consumed by the black flames.");
}
if (pFlames)
{
if (Main.rand.NextBool())
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s flesh was melted by the plague.");
else
damageSource = PlayerDeathReason.ByCustomReason(player.name + " didn't vaccinate.");
}
if (astralInfection)
{
if (Main.rand.NextBool())
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s infection spread too far.");
else
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s skin was replaced by the astral virus.");
}
if (nightwither)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was incinerated by lunar rays.");
}
if (vaporfied)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " vaporized into thin air.");
}
if (manaOverloader)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s life was completely converted into mana.");
}
if (bloodyMary || everclear || evergreenGin || fireball || margarita || moonshine || moscowMule || redWine || screwdriver || starBeamRye || tequila || tequilaSunrise || vodka || whiteWine)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " succumbed to alcohol sickness.");
}
}
if (profanedCrystalBuffs && !profanedCrystalHide)
{
damageSource = PlayerDeathReason.ByCustomReason(player.name + " was summoned too soon.");
+32 -19
View File
@@ -34,20 +34,8 @@ namespace CalamityMod.Projectiles.Melee
public override void AI()
{
Projectile parent = Main.projectile[0];
bool active = false;
for (int i = 0; i < Main.projectile.Length; i++)
{
Projectile p = Main.projectile[i];
if (p.identity == projectile.ai[0] && p.active && p.type == ModContent.ProjectileType<MicrowaveYoyo>())
{
parent = p;
active = true;
break;
}
}
if (active)
Projectile parent = FindParent();
if (parent != null && parent.active)
{
projectile.Center = parent.Center;
projectile.timeLeft = 2;
@@ -56,18 +44,43 @@ namespace CalamityMod.Projectiles.Melee
{
projectile.Kill();
}
if (!parent.active)
{
projectile.Kill();
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 180);
if (target.life <= 0 && (FindParent().modProjectile as MicrowaveYoyo).soundCooldown <= 0)
{
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y);
(FindParent().modProjectile as MicrowaveYoyo).soundCooldown = 60;
}
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 180);
if (target.statLife <= 0 && (FindParent().modProjectile as MicrowaveYoyo).soundCooldown <= 0)
{
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y);
(FindParent().modProjectile as MicrowaveYoyo).soundCooldown = 60;
}
}
private Projectile FindParent()
{
Projectile parent = null;
for (int i = 0; i < Main.maxProjectiles; i++)
{
Projectile p = Main.projectile[i];
if (p.identity == projectile.ai[0] && p.active && p.type == ModContent.ProjectileType<MicrowaveYoyo>() && p.owner == projectile.owner)
{
parent = p;
break;
}
}
return parent;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft());
+34 -3
View File
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
@@ -14,6 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
private const float Radius = 100f;
private SoundEffectInstance mmmmmm = null;
private bool spawnedAura = false;
public int soundCooldown = 0;
public override void SetStaticDefaults()
{
@@ -41,6 +43,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
projectile.localNPCHitCooldown = 10;
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(soundCooldown);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
soundCooldown = reader.ReadInt32();
}
public override void AI()
{
// Sound is done manually, so that it can loop correctly.
@@ -51,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
CalamityUtils.ApplySoundStats(ref mmmmmm, projectile.Center);
Main.PlaySoundInstance(mmmmmm);
}
else if(!mmmmmm.IsDisposed)
else if (!mmmmmm.IsDisposed)
CalamityUtils.ApplySoundStats(ref mmmmmm, projectile.Center);
// Spawn invisible but damaging aura projectile
@@ -61,6 +73,10 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
spawnedAura = true;
}
// Decrement sound cooldown
if (soundCooldown > 0)
soundCooldown--;
// Dust circle appears for all players, even though the aura projectile is only spawned by the owner
int numDust = (int)(0.2f * MathHelper.TwoPi * Radius);
float angleIncrement = MathHelper.TwoPi / (float)numDust;
@@ -81,13 +97,13 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
Main.dust[dust].scale = 0.1599999999f;
}
if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f) //200 blocks
// Delete the projectile if it is farther than 200 blocks away from the player
if ((projectile.position - Main.player[projectile.owner].position).Length() > 3200f)
projectile.Kill();
}
public override void Kill(int timeLeft)
{
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y);
mmmmmm?.Stop();
mmmmmm?.Dispose();
}
@@ -107,6 +123,21 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 300);
if (target.life <= 0 && soundCooldown <= 0)
{
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y);
soundCooldown = 60;
}
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 300);
if (target.statLife <= 0 && soundCooldown <= 0)
{
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y);
soundCooldown = 60;
}
}
}
}