From aa68c8e1ab833b222a7ef76eeae98c624fb1eafa Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 8 Dec 2025 15:46:16 +0700 Subject: [PATCH] Supported extra features for Auric Land Mine - Weapon Rack placement - Wiring sight - Dangersense highlight - Activation mechanism identical to Land Mines (wiring, projectiles, NPCs) --- CalPlayer/CalamityPlayerMiscEffects.cs | 12 --------- .../FurnitureAuric/AuricLandMine.cs | 8 ++++++ NPCs/CalamityGlobalNPC.cs | 14 +---------- Tiles/FurnitureAuric/AuricLandMineTile.cs | 25 ++++++++++++++++++- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index c4ca95c14f..62dde173b2 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -926,7 +926,6 @@ namespace CalamityMod.CalPlayer int astralOreID = ModContent.TileType(); int auricOreID = ModContent.TileType(); int auricRepulserID = ModContent.TileType(); - int auricLandMineID = ModContent.TileType(); int scoriaOreID = ModContent.TileType(); int abyssKelpID = ModContent.TileType(); @@ -996,17 +995,6 @@ namespace CalamityMod.CalPlayer } SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), Player.Center); } - - if (tile.TileType == auricLandMineID) - { - SoundStyle explode = new("CalamityMod/Sounds/Item/DudFire"); - SoundEngine.PlaySound(explode with { Pitch = 0.8f }, touchedTile.ToWorldCoordinates()); - GenericSparkle sparker = new GenericSparkle(touchedTile.ToWorldCoordinates(), Vector2.Zero, Color.Goldenrod, Color.Gold, 2.5f, 9, Main.rand.NextFloat(-0.01f, 0.01f), 2.68f); - GeneralParticleHandler.SpawnParticle(sparker); - Player.RemoveAllIFrames(); - Projectile.NewProjectile(new EntitySource_TileInteraction(Player, touchedTile.X, touchedTile.Y), touchedTile.ToWorldCoordinates(), Vector2.Zero, ModContent.ProjectileType(), 40000, 0f); - WorldGen.KillTile(touchedTile.X, touchedTile.Y, noItem: true); - } } } private void HandleBlazingMouseEffects() diff --git a/Items/Placeables/FurnitureAuric/AuricLandMine.cs b/Items/Placeables/FurnitureAuric/AuricLandMine.cs index 2b512a453e..eb3c2cd940 100644 --- a/Items/Placeables/FurnitureAuric/AuricLandMine.cs +++ b/Items/Placeables/FurnitureAuric/AuricLandMine.cs @@ -9,10 +9,18 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric public class AuricLandMine : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + // Did you know Land Mines can be placed on Weapon Racks? Yeah, me neither. + ItemID.Sets.CanBePlacedOnWeaponRacks[Type] = true; + } + public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 1); + Item.mech = true; } public override void AddRecipes() diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 0afadd2e4d..b060dd3f0a 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3866,12 +3866,11 @@ namespace CalamityMod.NPCs npc.velocity *= velocitySlownessFactor; } - // Auric Ore/Repulsers reject Town NPCs and dummies (Auric Land Mines work on them too) + // Auric Ore/Repulsers reject Town NPCs and dummies if ((NPCID.Sets.ActsLikeTownNPC[npc.type] || npc.townNPC) && !npc.dontTakeDamage || npc.type == NPCType()) { int auricOreID = TileType(); int auricRepulserID = TileType(); - int auricLandMineID = TileType(); // Get a list of tiles near the npc // This is just Collision.GetEntityTiles but with a larger detection square because the sheer speed from auric boosts causes the detection to fail at higher speeds @@ -3911,17 +3910,6 @@ namespace CalamityMod.NPCs if (!tile.HasTile || !tile.HasUnactuatedTile) continue; - if (tile.TileType == auricLandMineID) - { - SoundStyle explode = new("CalamityMod/Sounds/Item/DudFire"); - SoundEngine.PlaySound(explode with { Pitch = 0.8f }, touchedTile.ToWorldCoordinates()); - GenericSparkle sparker = new GenericSparkle(touchedTile.ToWorldCoordinates(), Vector2.Zero, Color.Goldenrod, Color.Gold, 2.5f, 9, Main.rand.NextFloat(-0.01f, 0.01f), 2.68f); - GeneralParticleHandler.SpawnParticle(sparker); - Projectile.NewProjectile(new EntitySource_TileInteraction(npc, touchedTile.X, touchedTile.Y), touchedTile.ToWorldCoordinates(), Vector2.Zero, ProjectileType(), 40000, 0f); - WorldGen.KillTile(touchedTile.X, touchedTile.Y, noItem: true); - continue; - } - if (tile.TileType != auricOreID && tile.TileType != auricRepulserID) continue; diff --git a/Tiles/FurnitureAuric/AuricLandMineTile.cs b/Tiles/FurnitureAuric/AuricLandMineTile.cs index 70bb496e85..a2593907ca 100644 --- a/Tiles/FurnitureAuric/AuricLandMineTile.cs +++ b/Tiles/FurnitureAuric/AuricLandMineTile.cs @@ -1,5 +1,9 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -12,6 +16,8 @@ namespace CalamityMod.Tiles.FurnitureAuric { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; + // Land Mines break on all entity contact, and so does this + TileID.Sets.PressurePlate[Type] = 0; TileID.Sets.PreventsTileRemovalIfOnTopOfIt[Type] = true; TileID.Sets.PreventsTileHammeringIfOnTopOfIt[Type] = true; TileID.Sets.PreventsSandfall[Type] = true; @@ -25,6 +31,23 @@ namespace CalamityMod.Tiles.FurnitureAuric MinPick = 250; } + public override void HitSwitch(int i, int j) + { + Vector2 tileCenter = new Vector2(i, j) * 16f + Vector2.One * 8f; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Pitch = 0.8f }, tileCenter); + GenericSparkle sparkle = new(tileCenter, Vector2.Zero, Color.Goldenrod, Color.Gold, 2.5f, 9, Main.rand.NextFloat(-0.01f, 0.01f), 2.68f); + GeneralParticleHandler.SpawnParticle(sparkle); + WorldGen.KillTile(i, j, noItem: true); + NetMessage.SendTileSquare(-1, i, j); + // Remove all player iframes + Main.LocalPlayer.RemoveAllIFrames(); + Projectile.NewProjectile(new EntitySource_TileInteraction(Main.LocalPlayer, i, j), tileCenter, Vector2.Zero, ModContent.ProjectileType(), 40000, 0f); + } + + public override void HitWire(int i, int j) => Wiring.HitSwitchAndSync(i, j); + + public override bool IsTileDangerous(int i, int j, Player player) => true; + public override bool CanExplode(int i, int j) => false; public override bool CreateDust(int i, int j, ref int type)