Supported extra features for Auric Land Mine

- Weapon Rack placement
- Wiring sight
- Dangersense highlight
- Activation mechanism identical to Land Mines (wiring, projectiles, NPCs)
This commit is contained in:
Altixal committed 2025-12-08 15:46:16 +07:00
1 parent 1097ed83db
commit aa68c8e1ab
4 files changed
+33 -26

No files matched your search

-12
View File
@@ -926,7 +926,6 @@ namespace CalamityMod.CalPlayer
int astralOreID = ModContent.TileType<AstralOre>();
int auricOreID = ModContent.TileType<AuricOre>();
int auricRepulserID = ModContent.TileType<AuricRepulserPanelTile>();
int auricLandMineID = ModContent.TileType<AuricLandMineTile>();
int scoriaOreID = ModContent.TileType<ScoriaOre>();
int abyssKelpID = ModContent.TileType<AbyssKelp>();
@@ -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<AuricLandMineExplosion>(), 40000, 0f);
WorldGen.KillTile(touchedTile.X, touchedTile.Y, noItem: true);
}
}
}
private void HandleBlazingMouseEffects()
@@ -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<AuricLandMineTile>());
Item.value = Item.sellPrice(gold: 1);
Item.mech = true;
}
public override void AddRecipes()
+1 -13
View File
@@ -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<SuperDummyNPC>())
{
int auricOreID = TileType<AuricOre>();
int auricRepulserID = TileType<AuricRepulserPanelTile>();
int auricLandMineID = TileType<AuricLandMineTile>();
// 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<AuricLandMineExplosion>(), 40000, 0f);
WorldGen.KillTile(touchedTile.X, touchedTile.Y, noItem: true);
continue;
}
if (tile.TileType != auricOreID && tile.TileType != auricRepulserID)
continue;
+24 -1
View File
@@ -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<AuricLandMineExplosion>(), 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)