Clean up all projectile code.
This commit is contained in:
@@ -54,8 +54,7 @@ public class HellfireBeamProj : 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 HellfireBeamProj : 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 HellfireBeamProj : ModProjectile
|
||||
{
|
||||
if (Charge == MAX_CHARGE)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -100,9 +97,8 @@ public class HellfireBeamProj : ModProjectile
|
||||
Player player = Main.player[Projectile.owner];
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Vector2 diff = mousePos - player.Center;
|
||||
diff.Normalize();
|
||||
Projectile.velocity = diff;
|
||||
Projectile.velocity = mousePos - player.Center;
|
||||
Projectile.velocity.Normalize();s
|
||||
Projectile.direction = (Main.MouseWorld.X > player.position.X) ? 1 : (-1);
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
@@ -124,8 +120,7 @@ public class HellfireBeamProj : ModProjectile
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
Vector2 offset = Projectile.velocity;
|
||||
offset *= 40f;
|
||||
Vector2 offset = Projectile.velocity * 40f;
|
||||
Vector2 pos = player.Center + offset - new Vector2(10f, 10f);
|
||||
if (Charge < MAX_CHARGE)
|
||||
{
|
||||
@@ -138,7 +133,7 @@ public class HellfireBeamProj : 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,7 +144,6 @@ public class HellfireBeamProj : ModProjectile
|
||||
return;
|
||||
}
|
||||
Vector2 start = player.Center;
|
||||
_ = Projectile.velocity * -1f;
|
||||
for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f)
|
||||
{
|
||||
start = player.Center + Projectile.velocity * Distance;
|
||||
@@ -166,11 +160,8 @@ public class HellfireBeamProj : 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.BloodDust>(), 0f, 0f, 0, default, 1f);
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxWitherDust>(), 0f, 0f, 0, default, 1f);
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.BloodDust>());
|
||||
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.FoxWitherDust>());
|
||||
}
|
||||
DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f);
|
||||
Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * (Distance - MOVE_DISTANCE), 26f, new Utils.TileActionAttempt(DelegateMethods.CastLight));
|
||||
@@ -183,8 +174,7 @@ public class HellfireBeamProj : 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