From dfc7874885b31cc93ecd7f1e2de42628d6422968 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 5 Jan 2025 17:13:22 -0500 Subject: [PATCH] Hostile lab turrets are highlighted by Dangersense --- Tiles/DraedonStructures/DraedonLabTurret.cs | 12 ++++++++++++ Tiles/DraedonStructures/HostileFireTurret .cs | 12 ++++++++++++ Tiles/DraedonStructures/HostileIceTurret .cs | 12 ++++++++++++ Tiles/DraedonStructures/HostileLaserTurret .cs | 12 ++++++++++++ Tiles/DraedonStructures/HostileOnyxTurret.cs | 12 ++++++++++++ Tiles/DraedonStructures/HostilePlagueTurret.cs | 12 ++++++++++++ Tiles/DraedonStructures/HostileWaterTurret.cs | 12 ++++++++++++ 7 files changed, 84 insertions(+) diff --git a/Tiles/DraedonStructures/DraedonLabTurret.cs b/Tiles/DraedonStructures/DraedonLabTurret.cs index f43c7b4568..be174bc706 100644 --- a/Tiles/DraedonStructures/DraedonLabTurret.cs +++ b/Tiles/DraedonStructures/DraedonLabTurret.cs @@ -73,6 +73,8 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { @@ -85,6 +87,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/PulseTurret").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostileFireTurret .cs b/Tiles/DraedonStructures/HostileFireTurret .cs index 5a07e876a0..8884ceb5c6 100644 --- a/Tiles/DraedonStructures/HostileFireTurret .cs +++ b/Tiles/DraedonStructures/HostileFireTurret .cs @@ -68,6 +68,8 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/FireTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostileIceTurret .cs b/Tiles/DraedonStructures/HostileIceTurret .cs index d5b2ed5af2..0425289e9d 100644 --- a/Tiles/DraedonStructures/HostileIceTurret .cs +++ b/Tiles/DraedonStructures/HostileIceTurret .cs @@ -68,6 +68,8 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/IceTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostileLaserTurret .cs b/Tiles/DraedonStructures/HostileLaserTurret .cs index 39765b670d..434a6c8043 100644 --- a/Tiles/DraedonStructures/HostileLaserTurret .cs +++ b/Tiles/DraedonStructures/HostileLaserTurret .cs @@ -68,6 +68,8 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/LaserTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostileOnyxTurret.cs b/Tiles/DraedonStructures/HostileOnyxTurret.cs index 0412860bb6..2f65fecf9f 100644 --- a/Tiles/DraedonStructures/HostileOnyxTurret.cs +++ b/Tiles/DraedonStructures/HostileOnyxTurret.cs @@ -68,6 +68,8 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/OnyxTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostilePlagueTurret.cs b/Tiles/DraedonStructures/HostilePlagueTurret.cs index 68934114c7..48d64e8aae 100644 --- a/Tiles/DraedonStructures/HostilePlagueTurret.cs +++ b/Tiles/DraedonStructures/HostilePlagueTurret.cs @@ -68,6 +68,8 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/PlagueTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/DraedonStructures/HostileWaterTurret.cs b/Tiles/DraedonStructures/HostileWaterTurret.cs index 0f47a29ea4..3f9910d303 100644 --- a/Tiles/DraedonStructures/HostileWaterTurret.cs +++ b/Tiles/DraedonStructures/HostileWaterTurret.cs @@ -68,6 +68,8 @@ namespace CalamityMod.Tiles.DraedonStructures te?.Kill(left, top); } + // Used to highlight the tile with Dangersense. + public override bool IsTileDangerous(int i, int j, Player player) => true; // The turret tile draws a pulse turret on top of itself. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { @@ -80,6 +82,16 @@ namespace CalamityMod.Tiles.DraedonStructures return; int drawDirection = te.Direction; Color drawColor = Lighting.GetColor(i, j); + // Make sure the tile entity is also highlighted by Dangersense. + if (Main.LocalPlayer.dangerSense) + { + if (drawColor.R < 255) + drawColor.R = 255; + if (drawColor.G < 50) + drawColor.G = 50; + if (drawColor.B < 50) + drawColor.B = 50; + } Texture2D tex = ModContent.Request("CalamityMod/Tiles/PlayerTurrets/WaterTurretHead").Value; Vector2 screenOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);