Fixed possible Timekeeper crash if the sibling projectile doesn't exists anymore.
This commit is contained in:
parent
f188eb2757
commit
923c05a70a
@ -23,7 +23,24 @@ namespace Decimation.Content.Projectiles.Boss.DuneWyrm
|
||||
set => projectile.localAI[1] = value;
|
||||
}
|
||||
|
||||
private Projectile SiblingProjectile => !IsChild && Sibling >= 0 && Sibling < Main.projectile.Length ? Main.projectile[Sibling] : null;
|
||||
private Projectile SiblingProjectile
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Sibling >= 0 && Sibling < Main.projectile.Length)
|
||||
{
|
||||
Projectile sibling = Main.projectile[Sibling];
|
||||
if (sibling.active)
|
||||
{
|
||||
|
||||
Main.NewText("test");
|
||||
return sibling;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private int Counter
|
||||
{
|
||||
@ -45,14 +62,12 @@ namespace Decimation.Content.Projectiles.Boss.DuneWyrm
|
||||
projectile.penetrate = -1;
|
||||
projectile.aiStyle = -1;
|
||||
projectile.timeLeft = 600;
|
||||
|
||||
Sibling = -1;
|
||||
}
|
||||
|
||||
public override bool PreKill(int timeLeft)
|
||||
{
|
||||
SiblingProjectile?.Kill();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -89,7 +104,6 @@ namespace Decimation.Content.Projectiles.Boss.DuneWyrm
|
||||
Vector2 siblingVelocity = parentVelocity * new Vector2(1, -1);
|
||||
SiblingProjectile.velocity = siblingVelocity.RotatedBy(Rotation);
|
||||
|
||||
|
||||
if (Initialization)
|
||||
{
|
||||
Vector2 offset = new Vector2(projectile.position.X - SiblingProjectile.position.X, -16);
|
||||
@ -107,8 +121,11 @@ namespace Decimation.Content.Projectiles.Boss.DuneWyrm
|
||||
}
|
||||
|
||||
Lighting.AddLight(projectile.Center, _dustColor);
|
||||
Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X * 0.2f,
|
||||
|
||||
Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 229,
|
||||
projectile.velocity.X * 0.2f,
|
||||
projectile.velocity.Y * 0.2f, 100, default, 1f * projectile.scale);
|
||||
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user