Fixed Crystyl Crusher and Sparkling Beam ray problems

This commit is contained in:
DominicKarma authored and Cameron Ewell committed 2021-05-02 14:53:44 -04:00
1 parent fdfc4e5436
commit e69f168e26
2 files changed
+5 -19

No files matched your search

+4 -9
View File
@@ -7,6 +7,7 @@ using Terraria.ModLoader;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Items.Fishing.SunkenSeaCatches;
using Terraria.ID;
using System.Linq;
namespace CalamityMod.Projectiles.Magic
{
@@ -214,15 +215,9 @@ namespace CalamityMod.Projectiles.Magic
*/
private void SetLaserPosition(Player player)
{
for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f)
{
var start = player.Center + projectile.velocity * Distance;
if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1))
{
Distance -= 5f;
break;
}
}
float[] samplingPoints = new float[12];
Collision.LaserScan(player.Center + projectile.velocity * MOVE_DISTANCE, projectile.velocity, projectile.width * 0.5f, 2200f, samplingPoints);
Distance = MathHelper.Max(samplingPoints.Average() + projectile.height * 2f, 40f);
}
private void ChargeLaser(Player player)
+1 -10
View File
@@ -146,16 +146,7 @@ namespace CalamityMod.Projectiles.Melee
*/
private void SetLaserPosition(Player player)
{
Vector2 maxLength = Main.MouseWorld - Main.player[projectile.owner].Center;
for (Distance = MOVE_DISTANCE; Distance <= maxLength.Length(); Distance += 5f)
{
var start = player.Center + projectile.velocity * Distance;
if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1))
{
Distance -= 5f;
break;
}
}
Distance = MathHelper.Max(Main.player[projectile.owner].Distance(Main.MouseWorld) - 20f, MOVE_DISTANCE + 5f);
}
private void ChargeLaser(Player player)