From a98a78ca1e5a670bad04a9e7287283a6190a6a8d Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Sat, 21 Mar 2020 16:09:22 -0500 Subject: [PATCH] Gamma laser telegraph and geyser fix --- NPCs/AcidRain/GammaSlime.cs | 24 ++++++++++++++++++++++++ Projectiles/Enemy/GammaBeam.cs | 2 ++ Tiles/Abyss/SteamGeyser.cs | 4 +++- World/Abyss.cs | 9 ++++++++- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index cbb96877a4..6227b6690b 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; @@ -108,6 +109,20 @@ namespace CalamityMod.NPCs.AcidRain dust.velocity = Vector2.Normalize(destination - dust.position) * 3f; dust.scale = scale; dust.noGravity = true; + if (npc.ai[3] <= 540f) + { + float length = MathHelper.Lerp(20f, 550f, (npc.ai[3] - 480f) / 60f); + float outwardness = MathHelper.Lerp(1f, 0f, (npc.ai[3] - 480f) / 60f); + for (float i = npc.Top.Y + 4f; i >= npc.Top.Y + 4f - length; i -= 8f) + { + float angle = i / 24f; + Vector2 spawnPosition = new Vector2(npc.Center.X, i); + dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.SulfurousSeaAcid); + dust.scale = 1.5f; + dust.velocity = Vector2.UnitX * (float)Math.Cos(angle) * 4f * outwardness; + dust.noGravity = true; + } + } } // Release laser if (npc.ai[3] == 480f) @@ -162,5 +177,14 @@ namespace CalamityMod.NPCs.AcidRain } } } + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (npc.ai[3] >= 480f && npc.ai[3] <= 540f) + { + float length = MathHelper.Lerp(20f, 550f, (npc.ai[3] - 480f) / 60f); + float opacity = MathHelper.Lerp(0.3f, 0.9f, (npc.ai[3] - 480f) / 60f); + Utils.DrawLine(spriteBatch, npc.Top + new Vector2(0f, 4f), npc.Top + new Vector2(0f, 4f) - Vector2.UnitY * length, Color.Lerp(Color.Lime, Color.Transparent, opacity)); + } + } } } diff --git a/Projectiles/Enemy/GammaBeam.cs b/Projectiles/Enemy/GammaBeam.cs index bcbe50d7fb..bf07125159 100644 --- a/Projectiles/Enemy/GammaBeam.cs +++ b/Projectiles/Enemy/GammaBeam.cs @@ -103,6 +103,8 @@ namespace CalamityMod.Projectiles.Enemy } determinedLength /= samples.Length; + determinedLength = MathHelper.Clamp(determinedLength, maximumLength * 0.5f, maximumLength); + float lerpDelta = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, lerpDelta); Vector2 beamEndPosiiton = projectile.Center + projectile.velocity * (projectile.localAI[1] - 6f); diff --git a/Tiles/Abyss/SteamGeyser.cs b/Tiles/Abyss/SteamGeyser.cs index f53322750f..315b0de6e4 100644 --- a/Tiles/Abyss/SteamGeyser.cs +++ b/Tiles/Abyss/SteamGeyser.cs @@ -31,7 +31,9 @@ namespace CalamityMod.Tiles.Abyss } public override void NearbyEffects(int i, int j, bool closer) { - if (WorldGen.genRand.NextBool(60)) + bool noTilesBetweenPlayer = Collision.CanHit(new Vector2(i, j) * 16, 1, 1, new Vector2(i * 16f, Main.LocalPlayer.Center.Y), 1, 1); + + if (WorldGen.genRand.NextBool(60) && !Main.gamePaused && noTilesBetweenPlayer) { if (Math.Abs(Main.LocalPlayer.Center.X - i * 16) < 80 && Main.LocalPlayer.Bottom.Y < j * 16 && diff --git a/World/Abyss.cs b/World/Abyss.cs index e761856ba1..9f4328e1de 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -525,7 +525,14 @@ namespace CalamityMod.World { Main.tile[trueX, y].slope(0); Main.tile[trueX, y].halfBrick(false); - Tile.SmoothSlope(trueX, y); + try + { + Tile.SmoothSlope(trueX, y); + } + catch + { + continue; + } } } }