diff --git a/Projectiles/Summon/AtlasMunitionsAutocannon.cs b/Projectiles/Summon/AtlasMunitionsAutocannon.cs index 44450ba507..d01046351f 100644 --- a/Projectiles/Summon/AtlasMunitionsAutocannon.cs +++ b/Projectiles/Summon/AtlasMunitionsAutocannon.cs @@ -189,6 +189,7 @@ namespace CalamityMod.Projectiles.Summon Projectile heldCannon = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Main.LocalPlayer.Center, Vector2.UnitX, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer); heldCannon.ModProjectile().HeatInterpolant = HeatInterpolant * 0.65f; heldCannon.originalDamage = Projectile.originalDamage; + heldCannon.ai[2] = Projectile.ai[2]; CannonIsMounted = false; Projectile.netUpdate = true; diff --git a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs index ea50058069..64a475442a 100644 --- a/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs +++ b/Projectiles/Summon/AtlasMunitionsAutocannonHeld.cs @@ -192,6 +192,11 @@ namespace CalamityMod.Projectiles.Summon Projectile.owner = Main.myPlayer; Projectile.netUpdate = true; } + + // Destroy the cannon if the pod (base sentry) got replaced by other sentries + Projectile parent = Main.projectile[(int)Projectile.ai[2]]; + if (parent.type != ModContent.ProjectileType() || !parent.active) + Projectile.Kill(); } public void DetermineFrames() @@ -328,6 +333,12 @@ namespace CalamityMod.Projectiles.Summon // The cannon does not get destroyed by tile collisions. This only applies when in the dropped state. public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return true; + } + // The cannon itself does not do damage, but it does store damage for the lasers that it fires. public override bool? CanDamage() => false; }