Clean up all projectile code.
This commit is contained in:
@@ -54,8 +54,7 @@ public class GoldenBeam : ModProjectile
|
||||
{
|
||||
if (Charge == MAX_CHARGE)
|
||||
{
|
||||
Vector2 unit = Projectile.velocity;
|
||||
DrawLaser(TextureAssets.Projectile[Projectile.type].Value, Main.player[Projectile.owner].Center, unit, 10f, Projectile.damage, -1.57f, 1f, 1000f, Color.White, 60);
|
||||
DrawLaser(TextureAssets.Projectile[Projectile.type].Value, Main.player[Projectile.owner].Center, Projectile.velocity, 10f, Projectile.damage, -1.57f, 1f, 1000f, Color.White, 60);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -65,9 +64,8 @@ public class GoldenBeam : ModProjectile
|
||||
float r = Utils.ToRotation(unit) + rotation;
|
||||
for (float i = transDist; i <= Distance; i += step)
|
||||
{
|
||||
Color c = Color.White;
|
||||
Vector2 origin = start + i * unit;
|
||||
Main.EntitySpriteDraw(texture, origin - Main.screenPosition, (Rectangle?)new Rectangle(0, 26, 28, 26), (i < transDist) ? Color.Transparent : c, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
|
||||
Main.EntitySpriteDraw(texture, origin - Main.screenPosition, (Rectangle?)new Rectangle(0, 26, 28, 26), (i < transDist) ? Color.Transparent : color, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
|
||||
}
|
||||
Main.EntitySpriteDraw(texture, start + unit * (transDist - step) - Main.screenPosition, (Rectangle?)new Rectangle(0, 0, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
|
||||
Main.EntitySpriteDraw(texture, start + (Distance + step) * unit - Main.screenPosition, (Rectangle?)new Rectangle(0, 52, 28, 26), Color.White, r, new Vector2(14f, 13f), scale, SpriteEffects.None, 0);
|
||||
@@ -77,10 +75,9 @@ public class GoldenBeam : ModProjectile
|
||||
{
|
||||
if (Charge == 50f)
|
||||
{
|
||||
Player p = Main.player[Projectile.owner];
|
||||
Vector2 unit = Projectile.velocity;
|
||||
Player player = Main.player[Projectile.owner];
|
||||
float point = 0f;
|
||||
if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetHitbox), Utils.Size(targetHitbox), p.Center, p.Center + unit * Distance, 22f, ref point))
|
||||
if (Collision.CheckAABBvLineCollision(Utils.TopLeft(targetHitbox), Utils.Size(targetHitbox), player.Center, player.Center + Projectile.velocity * Distance, 22f, ref point))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -139,7 +136,7 @@ public class GoldenBeam : ModProjectile
|
||||
for (int j = 0; j < chargeFact + 1; j++)
|
||||
{
|
||||
Vector2 spawn = spawnPos + Utils.ToRotationVector2((float)Main.rand.NextDouble() * 6.28f) * (12f - chargeFact * 2);
|
||||
Dust obj = Main.dust[Dust.NewDust(pos, 20, 20, DustID.YellowTorch, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f, 0, default, 1f)];
|
||||
Dust obj = Main.dust[Dust.NewDust(pos, 20, 20, DustID.YellowTorch, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f)];
|
||||
obj.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f;
|
||||
obj.noGravity = true;
|
||||
obj.scale = Main.rand.Next(10, 20) * 0.05f;
|
||||
@@ -149,11 +146,9 @@ public class GoldenBeam : ModProjectile
|
||||
{
|
||||
return;
|
||||
}
|
||||
Vector2 start = player.Center;
|
||||
_ = Projectile.velocity * -1f;
|
||||
for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f)
|
||||
{
|
||||
start = player.Center + Projectile.velocity * Distance;
|
||||
Vector2 start = player.Center + Projectile.velocity * Distance;
|
||||
if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1))
|
||||
{
|
||||
Distance -= 5f;
|
||||
@@ -167,9 +162,6 @@ public class GoldenBeam : ModProjectile
|
||||
}
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float num1 = Utils.ToRotation(Projectile.velocity) + ((Main.rand.NextBool(2)) ? (-1f) : 1f) * 1.57f;
|
||||
float num2 = (float)(Main.rand.NextDouble() * 0.800000011920929 + 1.0);
|
||||
new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2);
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.MeatDust>(), 0f, 0f, 0, default, 1f);
|
||||
}
|
||||
DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f);
|
||||
@@ -183,8 +175,7 @@ public class GoldenBeam : ModProjectile
|
||||
|
||||
public override void CutTiles()
|
||||
{
|
||||
DelegateMethods.tilecut_0 = (TileCuttingContext)2;
|
||||
Vector2 unit = Projectile.velocity;
|
||||
Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * Distance, (Projectile.width + 16) * Projectile.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
|
||||
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
|
||||
Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Distance, (Projectile.width + 16) * Projectile.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user