From 46c48453cd320ddc4c7c416893d7a3f63ce71bd1 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Wed, 11 Jun 2025 15:21:59 -0500 Subject: [PATCH 01/48] Gave ravager solid rock pillars --- CalPlayer/CalamityPlayer.cs | 106 ++++++++++++++++++++++++++++++++++++ NPCs/Ravager/RockPillar.cs | 7 +++ 2 files changed, 113 insertions(+) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 1f7e29d431..71b4cafbf3 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -70,6 +70,7 @@ using Terraria.ModLoader; using Terraria.ModLoader.IO; using Terraria.Graphics.Effects; using static Terraria.ModLoader.ModContent; +using CalamityMod.NPCs.Ravager; namespace CalamityMod.CalPlayer { @@ -4313,6 +4314,111 @@ namespace CalamityMod.CalPlayer if (CalamityKeybinds.ExoChairSlowdownHotkey.Current) Player.velocity *= 0.5f; } + + foreach (var npc in Main.ActiveNPCs) + { + //This is the ravager rock pillar collision logic. It should only apply to rock pillars that are mostly opaque to ensure players don't get stopped by invisible pillars right when they spawn. + //This could also potentially be limited to only run with the pillar is stationary if desired. + if (npc.type == ModContent.NPCType() && npc.Opacity > 0.9f) + { + float origX = Player.velocity.X; + float origY = Player.velocity.Y; + //Yes, testing intercepts on th X, Y, and X+Y individually has a purpose. It makes it far more stable and consistent. + bool intersectX = false; + Player.position.X += Player.velocity.X; + if (Player.Hitbox.Intersects(npc.Hitbox)) + intersectX = true; + Player.position.X -= Player.velocity.X; + bool intersectY = false; + Player.position.Y += Player.velocity.Y; + if (Player.Hitbox.Intersects(npc.Hitbox)) + intersectY = true; + Player.position.Y -= Player.velocity.Y; + bool intersect = false; + //We only bother checking the X+Y together if individually they return false. + //This accounts for moving diagonal onto a corner. + if (!intersectX && !intersectY) + { + Player.position += Player.velocity; + if (Player.Hitbox.Intersects(npc.Hitbox)) + intersect = true; + Player.position -= Player.velocity; + } + if (intersectX || intersect) + { + //This checks if the player is to the left of the pillar + if (Player.Center.X < npc.Center.X) + { + float playerEdge = Player.Hitbox.X + Player.Hitbox.Width; + float pillarEdge = npc.Hitbox.X; + float goalEdge = playerEdge + Player.velocity.X; + if (goalEdge > pillarEdge) + { + Player.velocity.X += pillarEdge - goalEdge; + if (Player.velocity.X < 0) + if (!Collision.SolidCollision(Player.position + new Vector2(Player.velocity.X, 0), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.X += Player.velocity.X; + Player.velocity.X = 0; + } + else + { + Player.velocity.X = origX; + } + } + } + //This is for if the player is to the right of the pillar + else + { + float playerEdge = Player.Hitbox.X; + float pillarEdge = npc.Hitbox.X + npc.Hitbox.Width; + float goalEdge = playerEdge + Player.velocity.X; + if (goalEdge < pillarEdge) + { + Player.velocity.X += pillarEdge - goalEdge; + if (Player.velocity.X > 0) + if (!Collision.SolidCollision(Player.position + new Vector2(Player.velocity.X, 0), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.X += Player.velocity.X; + Player.velocity.X = 0; + } + else + { + Player.velocity.X = origX; + } + } + } + } + //For the vertical axis, we don't distinguish between top and bottom, and always move players to the top + //This is so being placed inside a pillar teleports a player to the top, which applies primarily to teleporting or pillar spawning + //Additionally, this is set to only work when the pillar is stationary vertically to prevent janky interations when pillars are moving. + if ((intersectY || intersect) && npc.velocity.Y == 0) + { + float playerEdge = Player.Hitbox.Y + Player.Hitbox.Height; + float pillarEdge = npc.Hitbox.Y; + float goalEdge = playerEdge + Player.velocity.Y; + if (goalEdge > pillarEdge) + { + Player.velocity.Y += pillarEdge - goalEdge; + if (Player.velocity.Y < 0) + if (!Collision.SolidCollision(Player.position + new Vector2(0, Player.velocity.Y), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.Y += Player.velocity.Y; + Player.velocity.Y = 0; + } + else + { + Player.velocity.Y = origY; + } + } + } + //This is to guarantee we can stand on top of rock pillars instead of looking like we're "floating" on top of them. + if (intersectY && Player.velocity.Y < 0.25f && Player.velocity.Y > -0.25f) + { + Player.velocity.Y = 0; + } + } + } } #endregion diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 08344e4ead..d125b49c8b 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -42,6 +42,13 @@ namespace CalamityMod.NPCs.Ravager CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } + //Disable dmg when stationary vertically or before jumping + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + if (NPC.velocity.Y == 0 || NPC.ai[0] == 0f) + return false; + return base.CanHitPlayer(target, ref cooldownSlot); + } public override void AI() { if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) From 92095bd09ea6e3a92e3eb78a39d837404919195e Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 12 Jun 2025 18:52:28 -0500 Subject: [PATCH 02/48] fixed pillar warp --- CalPlayer/CalamityPlayer.cs | 52 ++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 71b4cafbf3..0f2ab30885 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4394,22 +4394,44 @@ namespace CalamityMod.CalPlayer //Additionally, this is set to only work when the pillar is stationary vertically to prevent janky interations when pillars are moving. if ((intersectY || intersect) && npc.velocity.Y == 0) { - float playerEdge = Player.Hitbox.Y + Player.Hitbox.Height; - float pillarEdge = npc.Hitbox.Y; - float goalEdge = playerEdge + Player.velocity.Y; - if (goalEdge > pillarEdge) + if (Player.Center.X < npc.Center.X) { - Player.velocity.Y += pillarEdge - goalEdge; - if (Player.velocity.Y < 0) - if (!Collision.SolidCollision(Player.position + new Vector2(0, Player.velocity.Y), Player.Hitbox.Width, Player.Hitbox.Height)) - { - Player.position.Y += Player.velocity.Y; - Player.velocity.Y = 0; - } - else - { - Player.velocity.Y = origY; - } + float playerEdge = Player.Hitbox.Y + Player.Hitbox.Height; + float pillarEdge = npc.Hitbox.Y; + float goalEdge = playerEdge + Player.velocity.Y; + if (goalEdge > pillarEdge) + { + Player.velocity.Y += pillarEdge - goalEdge; + if (Player.velocity.Y < 0) + if (!Collision.SolidCollision(Player.position + new Vector2(0, Player.velocity.Y), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.Y += Player.velocity.Y; + Player.velocity.Y = 0; + } + else + { + Player.velocity.Y = origY; + } + } + } else + { + float playerEdge = Player.Hitbox.Y; + float pillarEdge = npc.Hitbox.Y + npc.Hitbox.Height; + float goalEdge = playerEdge + Player.velocity.Y; + if (goalEdge < pillarEdge) + { + Player.velocity.Y += pillarEdge - goalEdge; + if (Player.velocity.Y > 0) + if (!Collision.SolidCollision(Player.position + new Vector2(0, Player.velocity.Y), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.Y += Player.velocity.Y; + Player.velocity.Y = 0; + } + else + { + Player.velocity.Y = origY; + } + } } } //This is to guarantee we can stand on top of rock pillars instead of looking like we're "floating" on top of them. From cc90206b0c1f6ad617ababa4ec299feca73af4a3 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 12 Jun 2025 19:57:55 -0500 Subject: [PATCH 03/48] no more ravager elevator --- CalPlayer/CalamityPlayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 0f2ab30885..13d9a47315 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4394,7 +4394,7 @@ namespace CalamityMod.CalPlayer //Additionally, this is set to only work when the pillar is stationary vertically to prevent janky interations when pillars are moving. if ((intersectY || intersect) && npc.velocity.Y == 0) { - if (Player.Center.X < npc.Center.X) + if (Player.Center.Y < npc.Center.Y) { float playerEdge = Player.Hitbox.Y + Player.Hitbox.Height; float pillarEdge = npc.Hitbox.Y; From 9a1f2c5ffe7f95bf630cbd35701b4574e315f148 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Sat, 14 Jun 2025 14:38:49 -0500 Subject: [PATCH 04/48] pick pillars! more pillars! --- NPCs/Ravager/FlamePillar.cs | 19 +++++++++++++++++++ NPCs/Ravager/RavagerBody.cs | 5 +++-- NPCs/Ravager/RockPillar.cs | 23 +++++++++++++++++++++-- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 78144eff7a..b84db284b3 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -214,5 +214,24 @@ namespace CalamityMod.NPCs.Ravager } } } + + public override void ModifyHitByItem(Player player, Item item, ref NPC.HitModifiers modifiers) + { + if (item.pick > 0) + { + modifiers.ScalingBonusDamage += item.pick / 5f; + } + base.ModifyHitByItem(player, item, ref modifiers); + } + + public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) + { + var item = Main.player[projectile.owner].HeldItem; + if (item.pick > 0 && projectile.CountsAsClass()) + { + modifiers.ScalingBonusDamage += item.pick / 5f; + } + base.ModifyHitByProjectile(projectile, ref modifiers); + } } } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 9076571ce5..8920929cc7 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -591,7 +592,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.netMode != NetmodeID.MultiplayerClient) { - bool anyRockPillars = NPC.AnyNPCs(ModContent.NPCType()); + bool anyRockPillars = Main.npc.Any(x => x.active && x.type == ModContent.NPCType() && x.ai[1] < 1); bool anyFlamePillars = NPC.AnyNPCs(ModContent.NPCType()); if (CalamityWorld.LegendaryMode) @@ -624,7 +625,7 @@ namespace CalamityMod.NPCs.Ravager { if (n.type == ModContent.NPCType() && n.ai[0] == 0f) { - n.ai[1] = -1f; + n.ai[1]++; n.direction = NPC.direction; n.netUpdate = true; } diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index d125b49c8b..7dda44310c 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -79,11 +79,11 @@ namespace CalamityMod.NPCs.Ravager NPC.damage = NPC.defDamage; } - if (NPC.ai[0] == 0f) + if (NPC.ai[0] == 0) { if (NPC.velocity.Y == 0f) { - if (NPC.ai[1] == -1f) + if (NPC.ai[1] >= 2) { SoundEngine.PlaySound(SoundID.Item62, NPC.Center); @@ -218,5 +218,24 @@ namespace CalamityMod.NPCs.Ravager } } } + + public override void ModifyHitByItem(Player player, Item item, ref NPC.HitModifiers modifiers) + { + if (item.pick > 0) + { + modifiers.ScalingBonusDamage += item.pick / 5f; + } + base.ModifyHitByItem(player, item, ref modifiers); + } + + public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) + { + var item = Main.player[projectile.owner].HeldItem; + if (item.pick > 0 && projectile.CountsAsClass()) + { + modifiers.ScalingBonusDamage += item.pick / 5f; + } + base.ModifyHitByProjectile(projectile, ref modifiers); + } } } From f3eca37fb9e7d3e758035ecfeddf18abb3e7acd1 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Sat, 14 Jun 2025 15:35:30 -0500 Subject: [PATCH 05/48] pillars now have 2000% pick power worth of HP --- NPCs/Ravager/FlamePillar.cs | 6 ++++-- NPCs/Ravager/RockPillar.cs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index b84db284b3..f02a4b6769 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -219,7 +219,8 @@ namespace CalamityMod.NPCs.Ravager { if (item.pick > 0) { - modifiers.ScalingBonusDamage += item.pick / 5f; + modifiers.FlatBonusDamage += -10000; + modifiers.FinalDamage.Flat += (NPC.lifeMax / 2000f) * item.pick; } base.ModifyHitByItem(player, item, ref modifiers); } @@ -229,7 +230,8 @@ namespace CalamityMod.NPCs.Ravager var item = Main.player[projectile.owner].HeldItem; if (item.pick > 0 && projectile.CountsAsClass()) { - modifiers.ScalingBonusDamage += item.pick / 5f; + modifiers.FlatBonusDamage += -10000; + modifiers.FinalDamage.Flat += (NPC.lifeMax / 2000f) * item.pick; } base.ModifyHitByProjectile(projectile, ref modifiers); } diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 7dda44310c..d983350dde 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -223,7 +223,8 @@ namespace CalamityMod.NPCs.Ravager { if (item.pick > 0) { - modifiers.ScalingBonusDamage += item.pick / 5f; + modifiers.FlatBonusDamage += -10000; + modifiers.FinalDamage.Flat += (NPC.lifeMax / 2000f) * item.pick; } base.ModifyHitByItem(player, item, ref modifiers); } @@ -233,7 +234,8 @@ namespace CalamityMod.NPCs.Ravager var item = Main.player[projectile.owner].HeldItem; if (item.pick > 0 && projectile.CountsAsClass()) { - modifiers.ScalingBonusDamage += item.pick / 5f; + modifiers.FlatBonusDamage += -10000; + modifiers.FinalDamage.Flat += (NPC.lifeMax / 2000f) * item.pick; } base.ModifyHitByProjectile(projectile, ref modifiers); } From 6e33c4aca72096be319dc30e1f8330f8c035065f Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Wed, 25 Jun 2025 14:52:24 -0500 Subject: [PATCH 06/48] Pickaxe pillar cleanup, more rock pillars --- NPCs/Ravager/FlamePillar.cs | 25 ++++++++++++++++++++++--- NPCs/Ravager/RavagerBody.cs | 9 ++------- NPCs/Ravager/RockPillar.cs | 30 +++++++++++++++++++++++++----- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 2d7125d06c..abbb9ed7db 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -20,6 +20,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { this.HideFromBestiary(); + NPCID.Sets.ImmuneToAllBuffs[Type] = true; Main.npcFrameCount[Type] = 4; if (!Main.dedServ) { @@ -35,7 +36,7 @@ namespace CalamityMod.NPCs.Ravager NPC.defense = 35; NPC.DR_NERD(0.2f); NPC.chaseable = false; - NPC.lifeMax = DownedBossSystem.downedProvidence ? 14000 : 3500; + NPC.lifeMax = 1250; NPC.alpha = 255; NPC.aiStyle = -1; AIType = -1; @@ -60,6 +61,10 @@ namespace CalamityMod.NPCs.Ravager public override void AI() { + if (NPC.lifeMax > 1250) + NPC.lifeMax = 1250; + if (NPC.life > NPC.lifeMax) + NPC.life = NPC.lifeMax; // Avoid cheap bullshit NPC.damage = 0; @@ -221,7 +226,14 @@ namespace CalamityMod.NPCs.Ravager if (item.pick > 0) { modifiers.FlatBonusDamage += -10000; - modifiers.FinalDamage.Flat += (NPC.lifeMax / 2000f) * item.pick; + modifiers.FinalDamage.Flat += item.pick - 1; + modifiers.SetCrit(); + } + else + { + modifiers.SetMaxDamage(1); + modifiers.DisableCrit(); + modifiers.HideCombatText(); } base.ModifyHitByItem(player, item, ref modifiers); } @@ -232,7 +244,14 @@ namespace CalamityMod.NPCs.Ravager if (item.pick > 0 && projectile.CountsAsClass()) { modifiers.FlatBonusDamage += -10000; - modifiers.FinalDamage.Flat += (NPC.lifeMax / 2000f) * item.pick; + modifiers.FinalDamage.Flat += item.pick-1; + modifiers.SetCrit(); + } + else + { + modifiers.SetMaxDamage(1); + modifiers.DisableCrit(); + modifiers.HideCombatText(); } base.ModifyHitByProjectile(projectile, ref modifiers); } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index a34a175a5a..38aee040ba 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -592,7 +592,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.netMode != NetmodeID.MultiplayerClient) { - bool anyRockPillars = Main.npc.Any(x => x.active && x.type == ModContent.NPCType() && x.ai[1] < 1); + bool anyRockPillars = Main.npc.Any(x => x.active && x.type == ModContent.NPCType() && x.ai[1] < 2); bool anyFlamePillars = NPC.AnyNPCs(ModContent.NPCType()); if (CalamityWorld.LegendaryMode) @@ -632,17 +632,12 @@ namespace CalamityMod.NPCs.Ravager } int spawnDistance = 360; - - if (!anyRockPillars || !anyFlamePillars) { SoundEngine.PlaySound(PillarSound, NPC.Center); - } - if (!anyRockPillars || CalamityWorld.LegendaryMode) - { NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X - spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X + spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); } - else if (!anyFlamePillars || CalamityWorld.LegendaryMode) + if (!anyFlamePillars) { float distanceMultiplier = finalPhase ? 2.5f : 2f; NPC.NewNPC(NPC.GetSource_FromAI(), (int)player.Center.X - (int)(spawnDistance * distanceMultiplier), (int)player.Center.Y - 100, ModContent.NPCType()); diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 2c52fdb9d8..d3288a5610 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -16,6 +16,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetStaticDefaults() { this.HideFromBestiary(); + NPCID.Sets.ImmuneToAllBuffs[Type] = true; } public override void SetDefaults() @@ -27,7 +28,6 @@ namespace CalamityMod.NPCs.Ravager NPC.defense = 50; NPC.DR_NERD(0.3f); NPC.chaseable = false; - NPC.lifeMax = DownedBossSystem.downedProvidence ? 20000 : 5000; NPC.alpha = 255; NPC.aiStyle = -1; AIType = -1; @@ -36,10 +36,12 @@ namespace CalamityMod.NPCs.Ravager NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; + NPCID.Sets.ImmuneToAllBuffs[Type] = true; // Scale stats in Expert and Master CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + NPC.lifeMax = 1800; } //Disable dmg when stationary vertically or before jumping @@ -51,6 +53,10 @@ namespace CalamityMod.NPCs.Ravager } public override void AI() { + if (NPC.lifeMax > 1800) + NPC.lifeMax = 1800; + if (NPC.life > NPC.lifeMax) + NPC.life = NPC.lifeMax; if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -110,7 +116,7 @@ namespace CalamityMod.NPCs.Ravager NPC.velocity.X = (BossRushEvent.BossRushActive ? 15 : 12) * NPC.direction; NPC.velocity.Y = -28.5f; NPC.ai[0] = 1f; - NPC.ai[1] = 0f; + NPC.ai[1] = 0; } } } @@ -135,7 +141,7 @@ namespace CalamityMod.NPCs.Ravager } } } - public override bool? CanFallThroughPlatforms() => NPC.target >= 0 && Main.player[NPC.target].position.Y > NPC.position.Y + NPC.height; + public override bool? CanFallThroughPlatforms() => (NPC.alpha > 10) || (NPC.target >= 0 && Main.player[NPC.target].position.Y > NPC.position.Y + NPC.height); public override bool CheckActive() => false; public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) @@ -224,7 +230,14 @@ namespace CalamityMod.NPCs.Ravager if (item.pick > 0) { modifiers.FlatBonusDamage += -10000; - modifiers.FinalDamage.Flat += (NPC.lifeMax / 2000f) * item.pick; + modifiers.FinalDamage.Flat += item.pick - 1; + modifiers.SetCrit(); + } + else + { + modifiers.SetMaxDamage(1); + modifiers.DisableCrit(); + modifiers.HideCombatText(); } base.ModifyHitByItem(player, item, ref modifiers); } @@ -235,7 +248,14 @@ namespace CalamityMod.NPCs.Ravager if (item.pick > 0 && projectile.CountsAsClass()) { modifiers.FlatBonusDamage += -10000; - modifiers.FinalDamage.Flat += (NPC.lifeMax / 2000f) * item.pick; + modifiers.FinalDamage.Flat += item.pick - 1; + modifiers.SetCrit(); + } + else + { + modifiers.SetMaxDamage(1); + modifiers.DisableCrit(); + modifiers.HideCombatText(); } base.ModifyHitByProjectile(projectile, ref modifiers); } From c1a4b03f11451af4dc0b39778585ea364984a808 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Wed, 25 Jun 2025 16:09:43 -0500 Subject: [PATCH 07/48] Rock pillars anti jank, death changes --- CalPlayer/CalamityPlayer.cs | 231 ++++++++++++++++++++---------------- NPCs/Ravager/RavagerBody.cs | 33 ++++-- NPCs/Ravager/RockPillar.cs | 12 +- 3 files changed, 159 insertions(+), 117 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 03f19ef7d3..6990d1de98 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4315,126 +4315,151 @@ namespace CalamityMod.CalPlayer { //This is the ravager rock pillar collision logic. It should only apply to rock pillars that are mostly opaque to ensure players don't get stopped by invisible pillars right when they spawn. //This could also potentially be limited to only run with the pillar is stationary if desired. - if (npc.type == ModContent.NPCType() && npc.Opacity > 0.9f) + if (npc.type == ModContent.NPCType() && npc.Opacity > 0.9f && npc.damage < 1) { + bool LandedOnPlayer = false; float origX = Player.velocity.X; float origY = Player.velocity.Y; - //Yes, testing intercepts on th X, Y, and X+Y individually has a purpose. It makes it far more stable and consistent. - bool intersectX = false; - Player.position.X += Player.velocity.X; + npc.position += npc.velocity; + bool intersectPreVel = false; + Player.position += Player.velocity; + if (Player.Hitbox.Intersects(npc.Hitbox)) - intersectX = true; - Player.position.X -= Player.velocity.X; - bool intersectY = false; - Player.position.Y += Player.velocity.Y; - if (Player.Hitbox.Intersects(npc.Hitbox)) - intersectY = true; - Player.position.Y -= Player.velocity.Y; - bool intersect = false; - //We only bother checking the X+Y together if individually they return false. - //This accounts for moving diagonal onto a corner. - if (!intersectX && !intersectY) + intersectPreVel = true; + Player.position -= Player.velocity; + if (intersectPreVel) { - Player.position += Player.velocity; + Player.position += npc.velocity; + if (Collision.SolidCollision(Player.position, Player.Hitbox.Width, Player.Hitbox.Height) || Main.npc.Any(x => x.active && x.type == ModContent.NPCType() && x.Opacity > 0.9f && x.whoAmI != npc.whoAmI && x.Hitbox.Intersects(Player.Hitbox))) + { + npc.damage = npc.defDamage; + npc.ai[0] = 1; + LandedOnPlayer = true; + Player.position -= npc.velocity; + } + } + npc.position -= npc.velocity; + + if (!LandedOnPlayer) + { + //Yes, testing intercepts on th X, Y, and X+Y individually has a purpose. It makes it far more stable and consistent. + bool intersectX = false; + Player.position.X += Player.velocity.X; if (Player.Hitbox.Intersects(npc.Hitbox)) - intersect = true; - Player.position -= Player.velocity; - } - if (intersectX || intersect) - { - //This checks if the player is to the left of the pillar - if (Player.Center.X < npc.Center.X) + intersectX = true; + Player.position.X -= Player.velocity.X; + bool intersectY = false; + Player.position.Y += Player.velocity.Y; + if (Player.Hitbox.Intersects(npc.Hitbox)) + intersectY = true; + Player.position.Y -= Player.velocity.Y; + bool intersect = false; + //We only bother checking the X+Y together if individually they return false. + //This accounts for moving diagonal onto a corner. + if (!intersectX && !intersectY) { - float playerEdge = Player.Hitbox.X + Player.Hitbox.Width; - float pillarEdge = npc.Hitbox.X; - float goalEdge = playerEdge + Player.velocity.X; - if (goalEdge > pillarEdge) + Player.position += Player.velocity; + if (Player.Hitbox.Intersects(npc.Hitbox)) + intersect = true; + Player.position -= Player.velocity; + } + if (intersectX || intersect) + { + //This checks if the player is to the left of the pillar + if (Player.Center.X < npc.Center.X) { - Player.velocity.X += pillarEdge - goalEdge; - if (Player.velocity.X < 0) - if (!Collision.SolidCollision(Player.position + new Vector2(Player.velocity.X, 0), Player.Hitbox.Width, Player.Hitbox.Height)) - { - Player.position.X += Player.velocity.X; - Player.velocity.X = 0; - } - else - { - Player.velocity.X = origX; - } + float playerEdge = Player.Hitbox.X + Player.Hitbox.Width; + float pillarEdge = npc.Hitbox.X; + float goalEdge = playerEdge + Player.velocity.X; + if (goalEdge > pillarEdge) + { + Player.velocity.X += pillarEdge - goalEdge; + if (Player.velocity.X < 0) + if (!Collision.SolidCollision(Player.position + new Vector2(Player.velocity.X, 0), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.X += Player.velocity.X; + Player.velocity.X = 0; + } + else + { + Player.velocity.X = origX; + } + } + } + //This is for if the player is to the right of the pillar + else + { + float playerEdge = Player.Hitbox.X; + float pillarEdge = npc.Hitbox.X + npc.Hitbox.Width; + float goalEdge = playerEdge + Player.velocity.X; + if (goalEdge < pillarEdge) + { + Player.velocity.X += pillarEdge - goalEdge; + if (Player.velocity.X > 0) + if (!Collision.SolidCollision(Player.position + new Vector2(Player.velocity.X, 0), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.X += Player.velocity.X; + Player.velocity.X = 0; + } + else + { + Player.velocity.X = origX; + } + } } } - //This is for if the player is to the right of the pillar - else + //For the vertical axis, we don't distinguish between top and bottom, and always move players to the top + //This is so being placed inside a pillar teleports a player to the top, which applies primarily to teleporting or pillar spawning + //Additionally, this is set to only work when the pillar is stationary vertically to prevent janky interations when pillars are moving. + if ((intersectY || intersect)) { - float playerEdge = Player.Hitbox.X; - float pillarEdge = npc.Hitbox.X + npc.Hitbox.Width; - float goalEdge = playerEdge + Player.velocity.X; - if (goalEdge < pillarEdge) + if (Player.Center.Y < npc.Center.Y) { - Player.velocity.X += pillarEdge - goalEdge; - if (Player.velocity.X > 0) - if (!Collision.SolidCollision(Player.position + new Vector2(Player.velocity.X, 0), Player.Hitbox.Width, Player.Hitbox.Height)) - { - Player.position.X += Player.velocity.X; - Player.velocity.X = 0; - } - else - { - Player.velocity.X = origX; - } + float playerEdge = Player.Hitbox.Y + Player.Hitbox.Height; + float pillarEdge = npc.Hitbox.Y; + float goalEdge = playerEdge + Player.velocity.Y; + if (goalEdge > pillarEdge) + { + Player.velocity.Y += pillarEdge - goalEdge; + if (Player.velocity.Y < 0) + if (!Collision.SolidCollision(Player.position + new Vector2(0, Player.velocity.Y), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.Y += Player.velocity.Y; + Player.velocity.Y = 0; + } + else + { + Player.velocity.Y = origY; + } + } + } + else + { + float playerEdge = Player.Hitbox.Y; + float pillarEdge = npc.Hitbox.Y + npc.Hitbox.Height; + float goalEdge = playerEdge + Player.velocity.Y; + if (goalEdge < pillarEdge) + { + Player.velocity.Y += pillarEdge - goalEdge; + if (Player.velocity.Y > 0) + if (!Collision.SolidCollision(Player.position + new Vector2(0, Player.velocity.Y), Player.Hitbox.Width, Player.Hitbox.Height)) + { + Player.position.Y += Player.velocity.Y; + Player.velocity.Y = 0; + } + else + { + Player.velocity.Y = origY; + } + } } } - } - //For the vertical axis, we don't distinguish between top and bottom, and always move players to the top - //This is so being placed inside a pillar teleports a player to the top, which applies primarily to teleporting or pillar spawning - //Additionally, this is set to only work when the pillar is stationary vertically to prevent janky interations when pillars are moving. - if ((intersectY || intersect) && npc.velocity.Y == 0) - { - if (Player.Center.Y < npc.Center.Y) + //This is to guarantee we can stand on top of rock pillars instead of looking like we're "floating" on top of them. + if (intersectY && Player.velocity.Y < 0.25f && Player.velocity.Y > -0.25f) { - float playerEdge = Player.Hitbox.Y + Player.Hitbox.Height; - float pillarEdge = npc.Hitbox.Y; - float goalEdge = playerEdge + Player.velocity.Y; - if (goalEdge > pillarEdge) - { - Player.velocity.Y += pillarEdge - goalEdge; - if (Player.velocity.Y < 0) - if (!Collision.SolidCollision(Player.position + new Vector2(0, Player.velocity.Y), Player.Hitbox.Width, Player.Hitbox.Height)) - { - Player.position.Y += Player.velocity.Y; - Player.velocity.Y = 0; - } - else - { - Player.velocity.Y = origY; - } - } - } else - { - float playerEdge = Player.Hitbox.Y; - float pillarEdge = npc.Hitbox.Y + npc.Hitbox.Height; - float goalEdge = playerEdge + Player.velocity.Y; - if (goalEdge < pillarEdge) - { - Player.velocity.Y += pillarEdge - goalEdge; - if (Player.velocity.Y > 0) - if (!Collision.SolidCollision(Player.position + new Vector2(0, Player.velocity.Y), Player.Hitbox.Width, Player.Hitbox.Height)) - { - Player.position.Y += Player.velocity.Y; - Player.velocity.Y = 0; - } - else - { - Player.velocity.Y = origY; - } - } + Player.velocity.Y = 0; } } - //This is to guarantee we can stand on top of rock pillars instead of looking like we're "floating" on top of them. - if (intersectY && Player.velocity.Y < 0.25f && Player.velocity.Y > -0.25f) - { - Player.velocity.Y = 0; - } } } } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 38aee040ba..9fce483037 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -515,7 +515,7 @@ namespace CalamityMod.NPCs.Ravager player = Main.player[NPC.target]; bool shouldFall = player.position.Y >= NPC.Bottom.Y; - float velocityXBoost = !anyHeadActive ? 6f : death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + float velocityXBoost = !anyHeadActive ? 6f : 4f * (1f - lifeRatio); float velocityX = 4f + velocityXBoost; if (velocityY != 16) @@ -548,13 +548,13 @@ namespace CalamityMod.NPCs.Ravager { velocityX *= 2f; if (!shouldFall) - velocityY *= 0.5f; + velocityY *= 0.75f; } else if (calamityGlobalNPC.newAI[0] % 2f == 0f) { velocityX *= 1.5f; if (!shouldFall) - velocityY *= 0.75f; + velocityY *= 1f; } } @@ -632,11 +632,28 @@ namespace CalamityMod.NPCs.Ravager } int spawnDistance = 360; - { + if (death && phase2) + spawnDistance = 300; SoundEngine.PlaySound(PillarSound, NPC.Center); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X - spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X + spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); - } + + if (death && !leftClawActive && !rightClawActive) + { + + var index = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X), (int)player.Center.Y - spawnDistance - 100, ModContent.NPCType()); + if (Main.npc.IndexInRange(index)) + { + var npc = Main.npc[index]; + (int, int) H_W = (npc.height, npc.width); + npc.position = npc.Center; + npc.height = H_W.Item2; + npc.width = H_W.Item1; + npc.rotation = -MathHelper.PiOver2; + npc.Center = npc.position; + npc.ModNPC.DrawOffsetY = npc.width / 2 - npc.height / 2; + } + } if (!anyFlamePillars) { float distanceMultiplier = finalPhase ? 2.5f : 2f; @@ -708,7 +725,7 @@ namespace CalamityMod.NPCs.Ravager else calamityGlobalNPC.newAI[2] = player.direction; - float maxOffsetScale = death ? 320f : 240f; + float maxOffsetScale = 240f; float maxOffset = maxOffsetScale * (1f - lifeRatio); float offset = phase2 ? maxOffset * calamityGlobalNPC.newAI[2] : 0f; int quarterWidth = (int)(NPC.width * 0.25f); @@ -750,7 +767,7 @@ namespace CalamityMod.NPCs.Ravager if (NPC.Bottom.Y < player.position.Y) { - float fallSpeedBoost = !anyHeadActive ? 0.9f : death ? 0.9f * (1f - lifeRatio) : 0.6f * (1f - lifeRatio); + float fallSpeedBoost = !anyHeadActive ? 0.9f : 0.6f * (1f - lifeRatio); float fallSpeed = (bossRush ? 0.9f : 0.6f) + fallSpeedBoost; if (calamityGlobalNPC.newAI[1] > 1f) @@ -765,7 +782,7 @@ namespace CalamityMod.NPCs.Ravager float velocityMult = bossRush ? 2f : 1.8f; float velocityXChange = 0.2f + Math.Abs(NPC.Center.X - player.Center.X) * 0.001f; - float velocityXBoost = !anyHeadActive ? 6f : death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + float velocityXBoost = !anyHeadActive ? 6f : 4f * (1f - lifeRatio); float velocityXCap = 8f + velocityXBoost + Math.Abs(NPC.Center.X - player.Center.X) * 0.001f; if (!rightClawActive) diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index d3288a5610..3b230cd26a 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -79,10 +79,6 @@ namespace CalamityMod.NPCs.Ravager } else { - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - NPC.damage = (int)(NPC.defDamage * 1.5); - else - NPC.damage = NPC.defDamage; } if (NPC.ai[0] == 0) @@ -113,10 +109,14 @@ namespace CalamityMod.NPCs.Ravager } NPC.noTileCollide = true; - NPC.velocity.X = (BossRushEvent.BossRushActive ? 15 : 12) * NPC.direction; + if (NPC.rotation == 0) + NPC.velocity.X = (BossRushEvent.BossRushActive ? 15 : 12) * NPC.direction; NPC.velocity.Y = -28.5f; NPC.ai[0] = 1f; NPC.ai[1] = 0; + NPC.damage = NPC.defDamage; + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) + NPC.damage = (int)(NPC.defDamage * 1.5); } } } @@ -141,7 +141,7 @@ namespace CalamityMod.NPCs.Ravager } } } - public override bool? CanFallThroughPlatforms() => (NPC.alpha > 10) || (NPC.target >= 0 && Main.player[NPC.target].position.Y > NPC.position.Y + NPC.height); + public override bool? CanFallThroughPlatforms() => NPC.ai[0] != 0 || ((NPC.alpha > 10) || (NPC.target >= 0 && Main.player[NPC.target].position.Y > NPC.position.Y + NPC.height)); public override bool CheckActive() => false; public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) From 065c8125fdaed5f5436abfbdd3faa444832a1fe3 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Mon, 7 Jul 2025 22:24:36 -0500 Subject: [PATCH 08/48] Flame pillar visuals, detached head no longer fires beams and is invincible --- NPCs/Ravager/FlamePillar.cs | 3 +-- NPCs/Ravager/RavagerHead2.cs | 5 +++-- Projectiles/Boss/RavagerFlame.cs | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index abbb9ed7db..692d310041 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -33,8 +33,6 @@ namespace CalamityMod.NPCs.Ravager NPC.GetNPCDamage(); NPC.width = 40; NPC.height = 150; - NPC.defense = 35; - NPC.DR_NERD(0.2f); NPC.chaseable = false; NPC.lifeMax = 1250; NPC.alpha = 255; @@ -129,6 +127,7 @@ namespace CalamityMod.NPCs.Ravager int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + NPC.SimpleStrikeNPC(NPC.lifeMax/4,0,false,noPlayerInteraction:true); } NPC.ai[2] += 1f; diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index b2aaf4dd89..f52cba531e 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -51,6 +51,7 @@ namespace CalamityMod.NPCs.Ravager // Scale stats in Expert and Master CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + NPC.dontTakeDamage = true; } public override void AI() @@ -133,8 +134,8 @@ namespace CalamityMod.NPCs.Ravager { if (Main.netMode != NetmodeID.MultiplayerClient) { - SoundEngine.PlaySound(SoundID.Item33, NPC.Center); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, -1f); + //SoundEngine.PlaySound(SoundID.Item33, NPC.Center); + //Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, -1f); } } } diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index 69f81fa5da..53bc023b24 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -1,5 +1,7 @@ using CalamityMod.Events; +using CalamityMod.Particles; using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -24,14 +26,16 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.extraUpdates = BossRushEvent.BossRushActive ? 2 : 1; + Projectile.extraUpdates = 1; } public override void AI() { + Particle beam3 = new CustomSpark(Projectile.Center, new Vector2(1).RotatedByRandom(6.3f), "CalamityMod/Particles/BloomCircle", false, 10, 0.25f, Color.SkyBlue, new Vector2(1), true, false, 0, false, false, 0f); + GeneralParticleHandler.SpawnParticle(beam3); for (int i = 0; i < 2; i++) { - int icyFlame = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default, 3f); + int icyFlame = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceTorch, 0f, 0f, 100, default, 1.5f); Main.dust[icyFlame].noGravity = true; Main.dust[icyFlame].velocity *= 0f; } From 362e988ec84770e3093f336d65248fe6cff105ae Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Tue, 5 Aug 2025 12:45:20 -0500 Subject: [PATCH 09/48] Ancient Light, Ancient Doom, and Ice Mist changes --- .../VanillaNPCAIOverrides/Bosses/CultistAI.cs | 96 ++++++------------- 1 file changed, 30 insertions(+), 66 deletions(-) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index 404908d767..249a619266 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -64,7 +64,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int lightningDamage = isCultist ? LightningDamage : 0; int iceMistFireRate = phase2 ? 50 : 60; - float iceMistSpeed = (phase6 ? 12f : 10f) + (death ? (1f - lifeRatio) : 0f); + float iceMistSpeed = 8f + (death ? 2 : 1) * (1f - lifeRatio); int iceMistAmt = phase3 ? 2 : 1; int fireballFireRate = (phase5 ? 10 : 12) - (death ? 6 : 0); float fireballSpeed = ((phase7 ? 8f : phase6 ? 7f : 6f) + (death ? (1f - lifeRatio) : 0f)) * (isCultist ? 1f : 0.5f); @@ -257,11 +257,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Move to target case 0: - case 2: case 4: case 6: case 8: - case 10: case 12: case 14: case 16: @@ -270,6 +268,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses phase = 0; break; + case 2: + case 10: + phase = 0; + distanceAboveTarget *= death ? 1.5f : 2; + predictionDistance *= death ? 1.5f : 2; + break; // Fireball case 1: case 15: @@ -470,7 +474,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 iceMistDirection = npc.Center + new Vector2(npc.direction * 30, 12f); Vector2 iceMistVelocity = vec * iceMistSpeed; - Projectile.NewProjectile(npc.GetSource_FromAI(), iceMistDirection, iceMistVelocity, ProjectileID.CultistBossIceMist, iceMistDamage, 0f, Main.myPlayer, 0f, 1f); + var icemist = Main.projectile[Projectile.NewProjectile(npc.GetSource_FromAI(), iceMistDirection, iceMistVelocity, ProjectileID.CultistBossIceMist, iceMistDamage, 0f, Main.myPlayer, 0f, 1f)]; + icemist.timeLeft = 120; } } @@ -826,7 +831,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (playerDirection.HasNaNs()) playerDirection = new Vector2(npc.direction, 0f); - if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % ancientLightSpawnRate == 0) + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % ancientLightSpawnRate == 0 && (int)(npc.ai[1] - 4f) / ancientLightSpawnRate <= (death ? 4 : 3)) { if ((int)(npc.ai[1] - 4f) / ancientLightSpawnRate == 2) { @@ -858,26 +863,27 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (playerDirection.HasNaNs()) playerDirection = new Vector2(npc.direction, 0f); - Vector2 ancientLightShootDirection = npc.Center + new Vector2(npc.direction * 30, 12f); + Vector2 ancientLightShootDirection = npc.Center; float scaleFactor = death ? 6f : 4f; - float ancientLightSpread = MathHelper.ToRadians(15f); + float ancientLightSpread = MathHelper.ToRadians(80f); int ancientLightInc = 0; - float totalAncientLights = 5f; - while (ancientLightInc < totalAncientLights) + float totalAncientLights = death ? 9 : 7; + float adjustTotal = totalAncientLights - 1; + for (var i = 0; i < totalAncientLights; i++) { - Vector2 ancientLightSpeed = playerDirection * scaleFactor; - ancientLightSpeed = ancientLightSpeed.RotatedBy(ancientLightSpread * ancientLightInc - (MathHelper.Pi / totalAncientLights * 2f - ancientLightSpread) / 2f); + var shotgunscalar = Math.Abs(i - (adjustTotal * 0.5f)) / (adjustTotal * 0.5f); + float angleOffset = ancientLightSpread * (i / adjustTotal) - ancientLightSpread * 0.5f; + Vector2 ancientLightSpeed = playerDirection.RotatedBy(angleOffset) * scaleFactor * (0.75f + 1.5f * shotgunscalar); float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; int ancientLightProj = NPC.NewNPC(npc.GetSource_FromAI(), (int)ancientLightShootDirection.X, (int)ancientLightShootDirection.Y + 7, NPCID.AncientLight, 0, 0f, ai, ancientLightSpeed.X, ancientLightSpeed.Y); Main.npc[ancientLightProj].velocity = ancientLightSpeed; - ancientLightInc++; } } } npc.ai[1] += 1f; - if (npc.ai[1] >= (4 + ancientLightSpawnRate * ancientLightAmt)) + if (npc.ai[1] >= (30 + ancientLightSpawnRate * ancientLightAmt)) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -892,7 +898,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.localAI[2] = 13f; - if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % 20f == 0f) + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % 20f == 0f && npc.ai[1] <= 64) { List list8 = new List(); for (int k = 0; k < Main.maxNPCs; k++) @@ -911,56 +917,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - if (phase4) - { // Spawn circle of Ancient Dooms around target - for (int i = 0; i < ancientDoomLimit; i++) + for (int i = 0; i < ancientDoomLimit * (0.5f + 1-lifeRatio); i++) { float ai2 = i * 120; NPC.NewNPC(npc.GetSource_FromAI(), (int)(player.Center.X + (float)(Math.Sin(i * 120) * 550)), (int)(player.Center.Y + (float)(Math.Cos(i * 120) * 550)), NPCID.AncientDoom, 0, npc.whoAmI, 0f, ai2, 0f, Main.maxPlayers); } - } - else - { - // Spawn Ancient Dooms randomly around the target - for (int i = 0; i < ancientDoomAmt; i++) - { - Point cultistCenterTileCoords = npc.Center.ToTileCoordinates(); - Point targetCenterTileCoords = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 targetDistanceDoom = Main.player[npc.target].Center - npc.Center; - int randSpawnOffset = 20; - int cultistCenterSpawnOffset = 3; - int targetCenterSpawnOffset = 7; - int tileCollisionRange = 2; - int spawnAttempts = 0; - bool doomSufficientlyFar = targetDistanceDoom.Length() > 2800f; - while (!doomSufficientlyFar && spawnAttempts < 100) - { - spawnAttempts++; - int ancientDoomSpawnX = Main.rand.Next(targetCenterTileCoords.X - randSpawnOffset, targetCenterTileCoords.X + randSpawnOffset + 1); - int ancientDoomSpawnY = Main.rand.Next(targetCenterTileCoords.Y - randSpawnOffset, targetCenterTileCoords.Y + randSpawnOffset + 1); - if ((ancientDoomSpawnY < targetCenterTileCoords.Y - targetCenterSpawnOffset || ancientDoomSpawnY > targetCenterTileCoords.Y + targetCenterSpawnOffset || ancientDoomSpawnX < targetCenterTileCoords.X - targetCenterSpawnOffset || ancientDoomSpawnX > targetCenterTileCoords.X + targetCenterSpawnOffset) && (ancientDoomSpawnY < cultistCenterTileCoords.Y - cultistCenterSpawnOffset || ancientDoomSpawnY > cultistCenterTileCoords.Y + cultistCenterSpawnOffset || ancientDoomSpawnX < cultistCenterTileCoords.X - cultistCenterSpawnOffset || ancientDoomSpawnX > cultistCenterTileCoords.X + cultistCenterSpawnOffset) && !Main.tile[ancientDoomSpawnX, ancientDoomSpawnY].HasUnactuatedTile) - { - bool notInsideTiles = true; - if (notInsideTiles && Collision.SolidTiles(ancientDoomSpawnX - tileCollisionRange, ancientDoomSpawnX + tileCollisionRange, ancientDoomSpawnY - tileCollisionRange, ancientDoomSpawnY + tileCollisionRange)) - notInsideTiles = false; - - if (notInsideTiles) - { - NPC.NewNPC(npc.GetSource_FromAI(), ancientDoomSpawnX * 16 + 8, ancientDoomSpawnY * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI); - break; - } - } - } - } - } } } npc.ai[1] += 1f; - if (npc.ai[1] >= 64f) + if (npc.ai[1] >= 240f) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -1091,7 +1060,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = npc.defDamage = 0; float duration = 420f; float spawnAnimTime = 120f; - int rateOfChange = death ? 2 : 1; + int rateOfChange = 6; float splitProjVelocity = death ? 4.5f : 3f; // Percent life remaining for Cultist or Eidolon Wyrm @@ -1108,12 +1077,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (target == Main.maxPlayers) target = Main.npc[(int)npc.ai[0]].target; - if (phase2 || death) - rateOfChange++; - - if (phase4 || death) - rateOfChange++; - if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) npc.dontTakeDamage = true; } @@ -1128,8 +1091,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.Center = npc.position; npc.alpha = (int)(255f - growthRate * 255f); - if (phase3) - { if (npc.ai[3] == 0f) npc.ai[3] = npc.ai[2]; @@ -1146,7 +1107,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.position.Y = Main.player[target].Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; float spinVelocity = 8f * (1f - (npc.ai[1] / duration)); npc.ai[3] += spinVelocity; - } if (Main.rand.NextBool(6)) { @@ -1195,13 +1155,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses kill = true; if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = CalamityWorld.LegendaryMode ? 9 : (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss && !phase3) ? 8 : death ? 5 : 4; + int totalProjectiles = Main.getGoodWorld ? 7 : death ? 5 : 3; + if (!phase3) + totalProjectiles -= death ? 2 : 1; float radians = MathHelper.TwoPi / totalProjectiles; Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); + var rotOffset = npc.DirectionTo(Main.player[target].Center).ToRotation(); for (int k = 0; k < totalProjectiles; k++) { - Vector2 doomProjRotate = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, doomProjRotate, type, damage, 0f, Main.myPlayer); + Vector2 doomProjRotate = spinningPoint.RotatedBy(rotOffset + MathHelper.Pi*((k+1)/(float)(totalProjectiles+1))); + var proj = Main.projectile[Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, doomProjRotate, type, damage, 0f, Main.myPlayer)]; + proj.tileCollide = false; } } } From 7f44ad680762d8286c4bdaefb3b3e86e22888c1b Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Wed, 6 Aug 2025 11:20:49 -0500 Subject: [PATCH 10/48] Ice Mist rework --- CalPlayer/CalamityPlayerHitHurt.cs | 20 ++++++++--- .../VanillaNPCAIOverrides/Bosses/CultistAI.cs | 10 +++--- Projectiles/CalamityGlobalProjectile.cs | 36 +++---------------- 3 files changed, 26 insertions(+), 40 deletions(-) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 0c2e5e9043..e87a2f335b 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -915,6 +915,22 @@ namespace CalamityMod.CalPlayer #region Modify Hit By Proj public override void ModifyHitByProjectile(Projectile proj, ref Player.HurtModifiers modifiers) { + //This goes first so it activated before dodges or any other effects, as these projectiles aren't supposed to "hit" the player, but just inflict debuffs + if (CalamityWorld.revenge) + { + if (proj.type == ProjectileID.CultistBossIceMist && proj.ai[1] == 1f) // Main ice mists only; no shards + { + Player.AddBuff(BuffID.Frozen, 120); + modifiers.Cancel(); + return; + } + else if (proj.type == ProjectileID.CultistBossIceMist && proj.ai[1] != 1f) // Ice Mist shards + { + Player.AddBuff(BuffID.Chilled, 240); + modifiers.Cancel(); + return; + } + } if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { double dodgeDamageGateValuePercent = 0.05; @@ -1396,10 +1412,6 @@ namespace CalamityMod.CalPlayer { Player.AddBuff(ModContent.BuffType(), 180); } - else if (proj.type == ProjectileID.CultistBossIceMist && proj.ai[1] == 1f) // Main ice mists only; no shards - { - Player.AddBuff(BuffID.Chilled, 180); - } else if (proj.type == ProjectileID.CultistBossLightningOrbArc) { Player.AddBuff(BuffID.Electrified, 180); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index 249a619266..d02bfd53b4 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Vanilla values public static int CloneFireballDamage = 18; // 72 public static int FireballDamage = 20; // 80 - public static int IceMistDamage = 25; // 100 + public static int IceMistDamage = 1; // This attack never actually hits, so damage number is irrelevant public static int LightningDamage = 30; // 120 public static int DoomDamage = 45; // 180 (Also fixes Master Mode scaling) @@ -64,7 +64,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int lightningDamage = isCultist ? LightningDamage : 0; int iceMistFireRate = phase2 ? 50 : 60; - float iceMistSpeed = 8f + (death ? 2 : 1) * (1f - lifeRatio); + float iceMistSpeed = 12f + (death ? 4f : 2f) * (1f - lifeRatio); int iceMistAmt = phase3 ? 2 : 1; int fireballFireRate = (phase5 ? 10 : 12) - (death ? 6 : 0); float fireballSpeed = ((phase7 ? 8f : phase6 ? 7f : 6f) + (death ? (1f - lifeRatio) : 0f)) * (isCultist ? 1f : 0.5f); @@ -271,8 +271,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses case 2: case 10: phase = 0; - distanceAboveTarget *= death ? 1.5f : 2; - predictionDistance *= death ? 1.5f : 2; + distanceAboveTarget *= 1.5f; + predictionDistance *= 1.5f; break; // Fireball case 1: @@ -475,7 +475,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 iceMistDirection = npc.Center + new Vector2(npc.direction * 30, 12f); Vector2 iceMistVelocity = vec * iceMistSpeed; var icemist = Main.projectile[Projectile.NewProjectile(npc.GetSource_FromAI(), iceMistDirection, iceMistVelocity, ProjectileID.CultistBossIceMist, iceMistDamage, 0f, Main.myPlayer, 0f, 1f)]; - icemist.timeLeft = 120; + icemist.timeLeft = 240; } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index c37c40fd03..c38784c4ac 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2596,42 +2596,16 @@ namespace CalamityMod.Projectiles Vector2 vector11 = Main.player[num103].Center - projectile.Center; float scaleFactor2 = projectile.velocity.Length(); vector11.Normalize(); + if (vector11.HasNaNs()) + vector11 = Vector2.Zero; vector11 *= scaleFactor2; projectile.velocity = (projectile.velocity * 20f + vector11) / 21f; projectile.velocity.Normalize(); projectile.velocity *= scaleFactor2; + projectile.velocity *= 0.99f; - // Fly away from other Ice Mists in Master - if (death) - { - float pushForce = 0.06f; - float pushDistance = 120f; - for (int k = 0; k < Main.maxProjectiles; k++) - { - Projectile otherProj = Main.projectile[k]; - // Short circuits to make the loop as fast as possible - if (!otherProj.active || k == projectile.whoAmI) - continue; - - // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away - bool sameProjType = otherProj.type == projectile.type; - float taxicabDist = Vector2.Distance(projectile.Center, otherProj.Center); - if (sameProjType && taxicabDist < pushDistance) - { - if (projectile.position.X < otherProj.position.X) - projectile.velocity.X -= pushForce; - else - projectile.velocity.X += pushForce; - - if (projectile.position.Y < otherProj.position.Y) - projectile.velocity.Y -= pushForce; - else - projectile.velocity.Y += pushForce; - } - } - } - - if (projectile.ai[0] % (death ? 30f : 60f) == 0f && Main.netMode != NetmodeID.MultiplayerClient) + + if (projectile.ai[0] % (death ? 20f : 30f) == 0f && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector50 = projectile.rotation.ToRotationVector2(); Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, vector50, projectile.type, projectile.damage, projectile.knockBack, projectile.owner); From 734965ba64cda2c9b4356fe601f011846c75611b Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Wed, 10 Sep 2025 19:41:10 -0500 Subject: [PATCH 11/48] ritual is real again & other tweaks - Fireballs now fire slower in a spread of 3 - More time between attacks - Ritual can be failed by hitting clones. Hitting the real cultist removes all clones. Ritual spawns more clones at a time depending on HP and difficulty - Ancient Doom amount now scales with HP, and each ancient doom always splits into 3 projectiles (except on FTW) - Ancient light lifetime decreased --- .../VanillaNPCAIOverrides/Bosses/CultistAI.cs | 70 ++++++++++++++----- 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index d02bfd53b4..2bcc323b34 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -66,14 +66,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int iceMistFireRate = phase2 ? 50 : 60; float iceMistSpeed = 12f + (death ? 4f : 2f) * (1f - lifeRatio); int iceMistAmt = phase3 ? 2 : 1; - int fireballFireRate = (phase5 ? 10 : 12) - (death ? 6 : 0); + int fireballFireRate = (phase5 ? 20 : 24) - (death ? 5 : 0); float fireballSpeed = ((phase7 ? 8f : phase6 ? 7f : 6f) + (death ? (1f - lifeRatio) : 0f)) * (isCultist ? 1f : 0.5f); - int fireballAmt = death ? 20 : 4; + int fireballAmt = death ? 8 : 4; int lightningOrbPhaseTime = phase2 ? 90 : 120; int ancientLightSpawnRate = phase7 ? 20 : phase4 ? 25 : 30; int ancientLightAmt = phase7 ? 4 : phase4 ? 3 : 2; int ancientDoomLimit = 10; - int idleTime = phase8 ? 20 : phase7 ? 30 : phase3 ? 35 : 40; + int idleTime = phase8 ? 40 : phase7 ? 45 : phase3 ? 55 : 60; float timeToFinishRitual = phase8 ? 180f : phase7 ? 240f : phase5 ? 300f : 360f; if (CalamityWorld.LegendaryMode) @@ -135,6 +135,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[0] = Main.npc[(int)npc.ai[3]].ai[0]; npc.ai[1] = Main.npc[(int)npc.ai[3]].ai[1]; dontTakeDamage = true; + + if (npc.ai[0] == 5f && npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual) + { + dontTakeDamage = false; + if (npc.justHit) + { + var mainCultist = Main.npc[(int)npc.ai[3]]; + mainCultist.ai[1] = timeToFinishRitual; + } + } } // Stop spawning ritual if hit @@ -152,6 +162,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; Main.projectile[(int)npc.ai[2]].ai[1] = -1f; Main.projectile[(int)npc.ai[2]].netUpdate = true; + + foreach (var item in Main.ActiveNPCs) + { + if (item.type == NPCID.CultistBossClone && item.ai[3] == npc.whoAmI) + { + item.active = false; + item.ForceNetUpdate(); + } + } } // Despawn @@ -539,14 +558,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - playerDirection = Vector2.Normalize(player.Center - npc.Center); + playerDirection = npc.DirectionTo(player.Center); if (playerDirection.HasNaNs()) playerDirection = new Vector2(npc.direction, 0f); Vector2 fireballDirection = npc.Center + new Vector2(npc.direction * 30, 12f); Vector2 fireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); fireballVelocity = fireballVelocity.RotatedByRandom(Math.PI / 6D); - Projectile.NewProjectile(npc.GetSource_FromAI(), fireballDirection, fireballVelocity, ProjectileID.CultistBossFireBall, fireballDamage, 0f, Main.myPlayer); + for (var i = -1; i <= 1; i++) + Projectile.NewProjectile(npc.GetSource_FromAI(), fireballDirection, fireballVelocity.RotatedBy(1f * i), ProjectileID.CultistBossFireBall, fireballDamage, 0f, Main.myPlayer); } } @@ -644,10 +664,20 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) list6.Add(k); } - - int potentialExtraClones = 6 - list6.Count; - if (potentialExtraClones > 2) - potentialExtraClones = 2; + int maxClonesSpawned = 2; + if (death) + maxClonesSpawned += 2; + if (lifeRatio < 0.75f) + maxClonesSpawned++; + if (lifeRatio < 0.5f) + maxClonesSpawned++; + if (lifeRatio < 0.25f) + maxClonesSpawned++; + if (lifeRatio < 0.1f) + maxClonesSpawned++; + int potentialExtraClones = 8 - list6.Count; + if (potentialExtraClones > maxClonesSpawned) + potentialExtraClones = maxClonesSpawned; int newCloneAmt = list6.Count + potentialExtraClones + 1; float[] array = new float[newCloneAmt]; @@ -907,9 +937,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses list8.Add(k); } - int ancientDoomAmt = list8.Count + 1; - if (ancientDoomAmt > 2) - ancientDoomAmt = 2; + int ancientDoomAmount = 2; + if (lifeRatio < 0.75f && death) + ancientDoomAmount++; + if (lifeRatio < 0.5f) + ancientDoomAmount++; + if (lifeRatio < 0.25f && death) + ancientDoomAmount++; int ancientDoomFaceDirection = Math.Sign(player.Center.X - npc.Center.X); if (ancientDoomFaceDirection != 0) @@ -918,9 +952,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { // Spawn circle of Ancient Dooms around target - for (int i = 0; i < ancientDoomLimit * (0.5f + 1-lifeRatio); i++) + for (int i = 0; i < ancientDoomAmount; i++) { - float ai2 = i * 120; + float ai2 = i * (360f/ancientDoomAmount); NPC.NewNPC(npc.GetSource_FromAI(), (int)(player.Center.X + (float)(Math.Sin(i * 120) * 550)), (int)(player.Center.Y + (float)(Math.Cos(i * 120) * 550)), NPCID.AncientDoom, 0, npc.whoAmI, 0f, ai2, 0f, Main.maxPlayers); } @@ -967,9 +1001,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity = Vector2.Zero; npc.position = npc.oldPosition; - // Kill after 4 seconds + // Kill after half a second npc.ai[1] += 1f; - if (npc.ai[1] >= 240f) + if (npc.ai[1] >= 30f) { npc.HitEffect(0, 9999.0); npc.active = false; @@ -1155,9 +1189,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses kill = true; if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = Main.getGoodWorld ? 7 : death ? 5 : 3; - if (!phase3) - totalProjectiles -= death ? 2 : 1; + int totalProjectiles = Main.getGoodWorld ? 5 : 3; float radians = MathHelper.TwoPi / totalProjectiles; Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); var rotOffset = npc.DirectionTo(Main.player[target].Center).ToRotation(); From 0a8924d4ad4af796703eaeee64d5079a7bdcb539 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Fri, 12 Sep 2025 17:19:01 -0500 Subject: [PATCH 12/48] nerfs phase 2 no longer spawns rock walls death no longer boosts fist speed death top wall only spawns in phase 2 fist speed/fire rate under 20% hp reduced --- NPCs/Ravager/RavagerBody.cs | 35 ++++++++++++++++---------------- NPCs/Ravager/RavagerClawLeft.cs | 19 ++++++++--------- NPCs/Ravager/RavagerClawRight.cs | 19 ++++++++--------- 3 files changed, 35 insertions(+), 38 deletions(-) diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 9fce483037..87f6c0a533 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -632,29 +632,28 @@ namespace CalamityMod.NPCs.Ravager } int spawnDistance = 360; + SoundEngine.PlaySound(PillarSound, NPC.Center); if (death && phase2) + { spawnDistance = 300; - SoundEngine.PlaySound(PillarSound, NPC.Center); - NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X - spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); - NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X + spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); - - if (death && !leftClawActive && !rightClawActive) + var index = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X), (int)player.Center.Y - spawnDistance - 100, ModContent.NPCType()); + if (Main.npc.IndexInRange(index)) { + var npc = Main.npc[index]; + (int, int) H_W = (npc.height, npc.width); + npc.position = npc.Center; + npc.height = H_W.Item2; + npc.width = H_W.Item1; + npc.rotation = -MathHelper.PiOver2; + npc.Center = npc.position; + npc.ModNPC.DrawOffsetY = npc.width / 2 - npc.height / 2; - var index = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X), (int)player.Center.Y - spawnDistance - 100, ModContent.NPCType()); - if (Main.npc.IndexInRange(index)) - { - var npc = Main.npc[index]; - (int, int) H_W = (npc.height, npc.width); - npc.position = npc.Center; - npc.height = H_W.Item2; - npc.width = H_W.Item1; - npc.rotation = -MathHelper.PiOver2; - npc.Center = npc.position; - npc.ModNPC.DrawOffsetY = npc.width / 2 - npc.height / 2; - } } - if (!anyFlamePillars) + } + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X - spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X + spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); + + if (!anyFlamePillars && !phase2) { float distanceMultiplier = finalPhase ? 2.5f : 2f; NPC.NewNPC(NPC.GetSource_FromAI(), (int)player.Center.X - (int)(spawnDistance * distanceMultiplier), (int)player.Center.Y - 100, ModContent.NPCType()); diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 84cda3e20c..0c560f0992 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -67,7 +67,6 @@ namespace CalamityMod.NPCs.Ravager return; } - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (NPC.timeLeft < 1800) { NPC.timeLeft = 1800; @@ -98,17 +97,17 @@ namespace CalamityMod.NPCs.Ravager NPC.rotation = 0f; NPC.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(-120f, 50f); NPC.ai[1] += 1f; - if (NPC.life < NPC.lifeMax / 2 || death) + if (NPC.life < NPC.lifeMax / 2) { NPC.ai[1] += 1f; } - if (NPC.life < NPC.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3) { NPC.ai[1] += 1f; } - if (NPC.life < NPC.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5) { - NPC.ai[1] += 5f; + NPC.ai[1] += 2f; } if (NPC.ai[1] >= 60f) { @@ -148,17 +147,17 @@ namespace CalamityMod.NPCs.Ravager NPC.collideX = false; NPC.collideY = false; float clawSpeed = 12f; - if (NPC.life < NPC.lifeMax / 2 || death) + if (NPC.life < NPC.lifeMax / 2) { clawSpeed += 2f; } - if (NPC.life < NPC.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3) { clawSpeed += 2f; } - if (NPC.life < NPC.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5) { - clawSpeed += 5f; + clawSpeed += 4f; } Vector2 npcCenterAttack = new Vector2(NPC.Center.X, NPC.Center.Y); float targetX = Main.player[NPC.target].Center.X - npcCenterAttack.X; @@ -205,7 +204,7 @@ namespace CalamityMod.NPCs.Ravager bodyReturnYDist += 40f; bodyReturnXDist -= 110f; float bodyReturnDistance = (float)Math.Sqrt(bodyReturnXDist * bodyReturnXDist + bodyReturnYDist * bodyReturnYDist); - if ((bodyReturnDistance > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) + if ((bodyReturnDistance > 700f || NPC.collideX || NPC.collideY) | NPC.justHit) { // Avoid cheap bullshit NPC.damage = 0; diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index b8855ebe09..08d86aba82 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -68,7 +68,6 @@ namespace CalamityMod.NPCs.Ravager return; } - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (NPC.timeLeft < 1800) { NPC.timeLeft = 1800; @@ -99,17 +98,17 @@ namespace CalamityMod.NPCs.Ravager NPC.rotation = 0f; NPC.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(120f, 50f); NPC.ai[1] += 1f; - if (NPC.life < NPC.lifeMax / 2 || death) + if (NPC.life < NPC.lifeMax / 2) { NPC.ai[1] += 1f; } - if (NPC.life < NPC.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3) { NPC.ai[1] += 1f; } - if (NPC.life < NPC.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5) { - NPC.ai[1] += 5f; + NPC.ai[1] += 2f; } if (NPC.ai[1] >= 60f) { @@ -149,17 +148,17 @@ namespace CalamityMod.NPCs.Ravager NPC.collideX = false; NPC.collideY = false; float clawSpeed = 12f; - if (NPC.life < NPC.lifeMax / 2 || death) + if (NPC.life < NPC.lifeMax / 2) { clawSpeed += 2f; } - if (NPC.life < NPC.lifeMax / 3 || death) + if (NPC.life < NPC.lifeMax / 3) { clawSpeed += 2f; } - if (NPC.life < NPC.lifeMax / 5 || death) + if (NPC.life < NPC.lifeMax / 5) { - clawSpeed += 5f; + clawSpeed += 4f; } Vector2 npcCenterAttack = new Vector2(NPC.Center.X, NPC.Center.Y); float targetX = Main.player[NPC.target].Center.X - npcCenterAttack.X; @@ -206,7 +205,7 @@ namespace CalamityMod.NPCs.Ravager bodyReturnYDist += 40f; bodyReturnXDist += 110f; float bodyReturnDistance = (float)Math.Sqrt(bodyReturnXDist * bodyReturnXDist + bodyReturnYDist * bodyReturnYDist); - if ((bodyReturnDistance > (death ? 900f : 700f) || NPC.collideX || NPC.collideY) | NPC.justHit) + if ((bodyReturnDistance > 700f || NPC.collideX || NPC.collideY) | NPC.justHit) { // Avoid cheap bullshit NPC.damage = 0; From 2079d20b6274f649bf84487b4bcb37b5c0cf8028 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 19 Oct 2025 16:13:01 -0400 Subject: [PATCH 13/48] A few balance tweaks - Ancient Light have a slower starting speed and a slightly larger spread in Death - Reduced how much Ancient Light can drift off their paths at the end of their life in Rev+ - Reduced downtime after Ancient Doom attack --- NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index 1ca064b740..aaa39395d8 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -894,10 +894,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses playerDirection = new Vector2(npc.direction, 0f); Vector2 ancientLightShootDirection = npc.Center; - float scaleFactor = death ? 6f : 4f; + float scaleFactor = death ? 5f : 4f; - float ancientLightSpread = MathHelper.ToRadians(80f); - int ancientLightInc = 0; + float ancientLightSpread = MathHelper.ToRadians(CalamityWorld.death ? 90f : 80f); float totalAncientLights = death ? 9 : 7; float adjustTotal = totalAncientLights - 1; for (var i = 0; i < totalAncientLights; i++) @@ -905,7 +904,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses var shotgunscalar = Math.Abs(i - (adjustTotal * 0.5f)) / (adjustTotal * 0.5f); float angleOffset = ancientLightSpread * (i / adjustTotal) - ancientLightSpread * 0.5f; Vector2 ancientLightSpeed = playerDirection.RotatedBy(angleOffset) * scaleFactor * (0.75f + 1.5f * shotgunscalar); - float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; + float ai = (Main.rand.NextFloat() - 0.5f) * 0.2f * MathHelper.TwoPi / 60f; int ancientLightProj = NPC.NewNPC(npc.GetSource_FromAI(), (int)ancientLightShootDirection.X, (int)ancientLightShootDirection.Y + 7, NPCID.AncientLight, 0, 0f, ai, ancientLightSpeed.X, ancientLightSpeed.Y); Main.npc[ancientLightProj].velocity = ancientLightSpeed; } @@ -963,7 +962,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } npc.ai[1] += 1f; - if (npc.ai[1] >= 240f) + if (npc.ai[1] >= 195f) { npc.ai[0] = 0f; npc.ai[1] = 0f; From d21e6340125b35fec3e901b6bc0e86a03889606d Mon Sep 17 00:00:00 2001 From: Dreitone Date: Tue, 9 Dec 2025 04:29:10 -0600 Subject: [PATCH 14/48] i will strangle imogen --- Graphics/Primitives/PrimitiveRenderer.cs | 197 ++++++++++++++++++++--- Graphics/Primitives/PrimitiveSettings.cs | 84 +++++++++- 2 files changed, 259 insertions(+), 22 deletions(-) diff --git a/Graphics/Primitives/PrimitiveRenderer.cs b/Graphics/Primitives/PrimitiveRenderer.cs index 84e3d9ca65..38ad3e1757 100644 --- a/Graphics/Primitives/PrimitiveRenderer.cs +++ b/Graphics/Primitives/PrimitiveRenderer.cs @@ -44,6 +44,12 @@ namespace CalamityMod.Graphics.Primitives private static short PositionsIndex; + private static float[] MainCompletionRatios; + + private static float TotalTrailLength; + + private const float Epsilon = 1e-6f; + private static short VerticesIndex; private static short IndicesIndex; @@ -55,6 +61,7 @@ namespace CalamityMod.Graphics.Primitives MainPositions = new Vector2[MaxPositions]; MainVertices = new VertexPosition2DColorTexture[MaxVertices]; MainIndices = new short[MaxIndices]; + MainCompletionRatios = new float[MaxPositions]; VertexBuffer ??= new DynamicVertexBuffer(Main.instance.GraphicsDevice, VertexPosition2DColorTexture.VertexDeclaration2D, MaxVertices, BufferUsage.WriteOnly); IndexBuffer ??= new DynamicIndexBuffer(Main.instance.GraphicsDevice, IndexElementSize.SixteenBits, MaxIndices, BufferUsage.WriteOnly); }); @@ -100,10 +107,11 @@ namespace CalamityMod.Graphics.Primitives return; // A trail with only one point or less has nothing to connect to, and therefore, can't make a trail. - if (MainPositions.Length <= 2) - return; - MainSettings = settings; + AssignCompletionData(); + + if (PositionsIndex <= 2) + return; AssignVerticesRectangleTrail(); AssignIndicesRectangleTrail(); @@ -239,43 +247,192 @@ namespace CalamityMod.Graphics.Primitives return true; } + private static void AssignCompletionData() + { + TotalTrailLength = 0f; + + if (PositionsIndex <= 0) + return; + + MainCompletionRatios[0] = 0f; + + for (int i = 1; i < PositionsIndex; i++) + { + float segmentLength = Vector2.Distance(MainPositions[i], MainPositions[i - 1]); + TotalTrailLength += segmentLength; + MainCompletionRatios[i] = TotalTrailLength; + } + + if (PositionsIndex <= 0) + return; + + if (TotalTrailLength > Epsilon) + { + float inverseTotal = 1f / TotalTrailLength; + for (int i = 1; i < PositionsIndex; i++) + MainCompletionRatios[i] *= inverseTotal; + + MainCompletionRatios[PositionsIndex - 1] = 1f; + } + else + { + for (int i = 1; i < PositionsIndex; i++) + MainCompletionRatios[i] = 0f; + } + } + private static void AssignVerticesRectangleTrail() { VerticesIndex = 0; for (int i = 0; i < PositionsIndex; i++) { - float completionRatio = (i - 1f) / (float)(PositionsIndex - 1); - float widthAtVertex = MainSettings.WidthFunction(completionRatio); + float completionRatio = GetCompletionRatioForIndex(i); + float widthAtVertex = Math.Max(MainSettings.WidthFunction(completionRatio), 0f); Color vertexColor = MainSettings.ColorFunction(completionRatio); - Vector2 currentPosition = MainPositions[i]; - Vector2 directionToAhead = i == PositionsIndex - 1 ? (MainPositions[i] - MainPositions[i - 1]).SafeNormalize(Vector2.Zero) : (MainPositions[i + 1] - MainPositions[i]).SafeNormalize(Vector2.Zero); - Vector2 leftCurrentTextureCoord = new(completionRatio, 0.5f - widthAtVertex * 0.5f); - Vector2 rightCurrentTextureCoord = new(completionRatio, 0.5f + widthAtVertex * 0.5f); + float textureU = ComputeTextureCoordinateForIndex(i, completionRatio); - // Point 90 degrees away from the direction towards the next point, and use it to mark the edges of the rectangle. - // This doesn't use RotatedBy for the sake of performance (there can potentially be a lot of trail points). - Vector2 sideDirection = new(-directionToAhead.Y, directionToAhead.X); - - Vector2 left = currentPosition - sideDirection * widthAtVertex; - Vector2 right = currentPosition + sideDirection * widthAtVertex; + ComputeEdgePositions(i, widthAtVertex, out Vector2 left, out Vector2 right, out float effectiveHalfWidth); // Override the initial vertex positions if requested. if (i == 0 && MainSettings.InitialVertexPositionsOverride.HasValue && MainSettings.InitialVertexPositionsOverride.Value.Item1 != Vector2.Zero && MainSettings.InitialVertexPositionsOverride.Value.Item2 != Vector2.Zero) { left = MainSettings.InitialVertexPositionsOverride.Value.Item1; right = MainSettings.InitialVertexPositionsOverride.Value.Item2; + effectiveHalfWidth = Math.Max(Vector2.Distance(left, right) * 0.5f, Epsilon); } - // What this is doing, at its core, is defining a rectangle based on two triangles. - // These triangles are defined based on the width of the strip at that point. - // The resulting rectangles combined are what make the trail itself. - MainVertices[VerticesIndex] = new VertexPosition2DColorTexture(left, vertexColor, leftCurrentTextureCoord, widthAtVertex); + // Guard against degenerate width + effectiveHalfWidth = Math.Max(effectiveHalfWidth, Epsilon); + + Vector2 leftCurrentTextureCoord = new Vector2(textureU, 0.5f - effectiveHalfWidth * 0.5f); + Vector2 rightCurrentTextureCoord = new Vector2(textureU, 0.5f + effectiveHalfWidth * 0.5f); + + MainVertices[VerticesIndex] = new VertexPosition2DColorTexture(left, vertexColor, leftCurrentTextureCoord, effectiveHalfWidth); VerticesIndex++; - MainVertices[VerticesIndex] = new VertexPosition2DColorTexture(right, vertexColor, rightCurrentTextureCoord, widthAtVertex); + MainVertices[VerticesIndex] = new VertexPosition2DColorTexture(right, vertexColor, rightCurrentTextureCoord, effectiveHalfWidth); VerticesIndex++; } } + private static float GetCompletionRatioForIndex(int index) + { + if (PositionsIndex <= 0) + return 0f; + + if (index <= 0) + return MainCompletionRatios[0]; + + if (index >= PositionsIndex) + return MainCompletionRatios[PositionsIndex - 1]; + + return MainCompletionRatios[index]; + } + + private static float ComputeTextureCoordinateForIndex(int index, float completionRatio) + { + float clampedCompletion = MathHelper.Clamp(completionRatio, 0f, 1f); + + if (MainSettings.TextureCoordinateFunction != null) + return MainSettings.TextureCoordinateFunction(clampedCompletion); + + float cycleLength = MainSettings.TextureCycleLength; + if (Math.Abs(cycleLength) <= Epsilon) + cycleLength = cycleLength >= 0f ? 1f : -1f; + + switch (MainSettings.TextureCoordinateMode) + { + case PrimitiveTextureMode.Distance: + float distance = clampedCompletion * TotalTrailLength + MainSettings.TextureScrollOffset; + return distance / cycleLength; + + default: + return clampedCompletion * cycleLength + MainSettings.TextureScrollOffset; + } + } + + private static void ComputeEdgePositions(int index, float halfWidth, out Vector2 left, out Vector2 right, out float effectiveHalfWidth) + { + Vector2 currentPosition = MainPositions[index]; + + if (halfWidth <= 0f) + { + left = currentPosition; + right = currentPosition; + effectiveHalfWidth = Epsilon; + return; + } + + Vector2 forward = index >= PositionsIndex - 1 ? MainPositions[index] - MainPositions[index - 1] : MainPositions[index + 1] - MainPositions[index]; + Vector2 backward = index <= 0 ? forward : MainPositions[index] - MainPositions[index - 1]; + + Vector2 forwardDir = forward.SafeNormalize(Vector2.Zero); + if (forwardDir == Vector2.Zero) + forwardDir = backward.SafeNormalize(Vector2.UnitX); + if (forwardDir == Vector2.Zero) + forwardDir = Vector2.UnitX; + + Vector2 defaultNormal = new Vector2(-forwardDir.Y, forwardDir.X).SafeNormalize(Vector2.UnitY); + + if (MainSettings.JoinStyle == PrimitiveJoinStyle.Flat || PositionsIndex <= 2 || index == 0 || index == PositionsIndex - 1) + { + Vector2 offset = defaultNormal * halfWidth; + left = currentPosition - offset; + right = currentPosition + offset; + effectiveHalfWidth = halfWidth; + return; + } + + Vector2 backwardDir = backward.SafeNormalize(forwardDir); + Vector2 averageTangent = backwardDir + forwardDir; + if (averageTangent.LengthSquared() <= Epsilon) + averageTangent = forwardDir; + Vector2 averageNormal = new Vector2(-averageTangent.Y, averageTangent.X).SafeNormalize(defaultNormal); + + switch (MainSettings.JoinStyle) + { + case PrimitiveJoinStyle.Smooth: + { + Vector2 offset = averageNormal * halfWidth; + left = currentPosition - offset; + right = currentPosition + offset; + effectiveHalfWidth = halfWidth; + return; + } + + case PrimitiveJoinStyle.Miter: + { + Vector2 prevNormal = new Vector2(-backwardDir.Y, backwardDir.X).SafeNormalize(defaultNormal); + Vector2 nextNormal = new Vector2(-forwardDir.Y, forwardDir.X).SafeNormalize(defaultNormal); + Vector2 miter = prevNormal + nextNormal; + if (miter.LengthSquared() <= Epsilon) + miter = averageNormal; + + miter = miter.SafeNormalize(averageNormal); + float denom = Vector2.Dot(miter, nextNormal); + if (Math.Abs(denom) < Epsilon) + denom = denom >= 0f ? Epsilon : -Epsilon; + + float miterLength = halfWidth / denom; + float maxLength = halfWidth * MainSettings.JoinMiterLimit; + miterLength = MathHelper.Clamp(miterLength, -maxLength, maxLength); + Vector2 offset = miter * miterLength; + left = currentPosition - offset; + right = currentPosition + offset; + effectiveHalfWidth = Math.Max(Math.Abs(miterLength), Epsilon); + return; + } + + default: + { + Vector2 offset = defaultNormal * halfWidth; + left = currentPosition - offset; + right = currentPosition + offset; + effectiveHalfWidth = halfWidth; + return; + } + } + } + private static void AssignIndicesRectangleTrail() { // What this is doing is basically representing each point on the vertices list as diff --git a/Graphics/Primitives/PrimitiveSettings.cs b/Graphics/Primitives/PrimitiveSettings.cs index 21ade8e9ca..3340f5be68 100644 --- a/Graphics/Primitives/PrimitiveSettings.cs +++ b/Graphics/Primitives/PrimitiveSettings.cs @@ -1,8 +1,46 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria.Graphics.Shaders; namespace CalamityMod.Graphics.Primitives { + /// + /// Controls how U texture coordinates are generated for primitive ribbons. + /// + public enum PrimitiveTextureMode + { + /// + /// U coordinates run from 0 to 1 across the full trail length. This matches the legacy behavior. + /// + Normalized, + + /// + /// U coordinates advance according to distance along the trail. One full texture cycle occurs every pixels. + /// + Distance + } + + /// + /// Controls how adjacent segments are joined together when expanding points into quads. + /// + public enum PrimitiveJoinStyle + { + /// + /// Legacy behavior. Each segment is expanded using its forward direction only. + /// + Flat, + + /// + /// Uses the averaged tangent of neighbouring segments to smooth corners. + /// + Smooth, + + /// + /// Uses a mitered join to keep width continuous around sharp corners. + /// + Miter + } + /// /// Contains all the various options to use when creating a primitive trail. New members can be added freely without breaking existing implementations. /// @@ -72,6 +110,36 @@ namespace CalamityMod.Graphics.Primitives /// An optional override to force the trail to use the provided positions as the side positions of the initial vertex. They are the left and right positions respectively. /// public readonly (Vector2, Vector2)? InitialVertexPositionsOverride; + + /// + /// Determines how U texture coordinates are generated. + /// + public readonly PrimitiveTextureMode TextureCoordinateMode; + + /// + /// Controls the scale of generated U coordinates. In this is a multiplier, in this is the distance (in pixels) for one full texture cycle. + /// + public readonly float TextureCycleLength; + + /// + /// Adds an additional offset to the generated U coordinate. In distance mode this value is interpreted in pixels. + /// + public readonly float TextureScrollOffset; + + /// + /// Allows overriding the automatically generated U coordinate with a custom function. Receives the normalized completion ratio (0-1) and should return the desired U coordinate. + /// + public readonly Func TextureCoordinateFunction; + + /// + /// Determines how consecutive segments are joined together when expanding into quads. + /// + public readonly PrimitiveJoinStyle JoinStyle; + + /// + /// Maximum multiplier applied to miter joins to keep spikes under control. + /// + public readonly float JoinMiterLimit; #endregion /// @@ -85,7 +153,13 @@ namespace CalamityMod.Graphics.Primitives /// The shader to apply when rendering the primitives. /// Whether to use unscaled perspective matrices when rendering primitives. Recommended when using this system outside of its typical context; i.e. rendering primitives in the background via a CustomSky. /// An optional override to force the trail to use the provided positions as the side positions of the initial vertex. They are the left and right positions respectively and should be in screen space. - public PrimitiveSettings(VertexWidthFunction widthFunction, VertexColorFunction colorFunction, VertexOffsetFunction offsetFunction = null, bool smoothen = true, bool pixelate = false, MiscShaderData shader = null, bool useUnscaledMatrices = false, (Vector2, Vector2)? initialVertexPositionsOverride = null) + /// Determines how U texture coordinates are generated. + /// Controls how fast U coordinates advance. Acts as a multiplier in normalized mode, or the distance per cycle in distance mode. + /// Adds an offset to generated U coordinates. Interpreted in pixels when using distance mode. + /// Optional override that receives the completion ratio and returns a custom U coordinate. + /// Determines how neighbouring segments are joined when expanding into quads. + /// Maximum multiplier applied to miter joins to prevent spikes. Only used when is . + public PrimitiveSettings(VertexWidthFunction widthFunction, VertexColorFunction colorFunction, VertexOffsetFunction offsetFunction = null, bool smoothen = true, bool pixelate = false, MiscShaderData shader = null, bool useUnscaledMatrices = false, (Vector2, Vector2)? initialVertexPositionsOverride = null, PrimitiveTextureMode textureCoordinateMode = PrimitiveTextureMode.Normalized, float textureCycleLength = 1f, float textureScrollOffset = 0f, Func textureCoordinateFunction = null, PrimitiveJoinStyle joinStyle = PrimitiveJoinStyle.Flat, float joinMiterLimit = 4f) { WidthFunction = widthFunction; ColorFunction = colorFunction; @@ -95,6 +169,12 @@ namespace CalamityMod.Graphics.Primitives Shader = shader; UseUnscaledMatrices = useUnscaledMatrices; InitialVertexPositionsOverride = initialVertexPositionsOverride; + TextureCoordinateMode = textureCoordinateMode; + TextureCycleLength = Math.Abs(textureCycleLength) <= 1e-4f ? 1f : textureCycleLength; + TextureScrollOffset = textureScrollOffset; + TextureCoordinateFunction = textureCoordinateFunction; + JoinStyle = joinStyle; + JoinMiterLimit = Math.Max(joinMiterLimit, 1f); } } } From eb621140f240d3e9493856ca9d1bac48bac51cbb Mon Sep 17 00:00:00 2001 From: Dreitone Date: Tue, 9 Dec 2025 07:13:21 -0600 Subject: [PATCH 15/48] opts + debugging view --- Graphics/Primitives/PrimitiveRenderer.cs | 148 ++++++++++++++++++++--- Graphics/Primitives/PrimitiveSettings.cs | 18 ++- 2 files changed, 144 insertions(+), 22 deletions(-) diff --git a/Graphics/Primitives/PrimitiveRenderer.cs b/Graphics/Primitives/PrimitiveRenderer.cs index 0a181aca19..03afe3f942 100644 --- a/Graphics/Primitives/PrimitiveRenderer.cs +++ b/Graphics/Primitives/PrimitiveRenderer.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -36,19 +35,29 @@ namespace CalamityMod.Graphics.Primitives private static short[] MainIndices; + private static VertexPositionColor[] WireframeVertices; + + private static int WireframeVertexCount; + + private static BasicEffect WireframeEffect; + + private static int[] NonSmoothIndexScratch; + private const short MaxPositions = 1000; private const short MaxVertices = 3072; private const short MaxIndices = 8192; + private static readonly List ControlPointsCache = new(MaxPositions); + private static short PositionsIndex; private static float[] MainCompletionRatios; private static float TotalTrailLength; - private const float Epsilon = 1e-6f; + public const float Epsilon = 1e-6f; private static short VerticesIndex; @@ -62,11 +71,25 @@ namespace CalamityMod.Graphics.Primitives MainVertices = new VertexPosition2DColorTexture[MaxVertices]; MainIndices = new short[MaxIndices]; MainCompletionRatios = new float[MaxPositions]; + WireframeVertices = new VertexPositionColor[MaxPositions * 8]; + NonSmoothIndexScratch = new int[MaxPositions]; VertexBuffer ??= new DynamicVertexBuffer(Main.instance.GraphicsDevice, VertexPosition2DColorTexture.VertexDeclaration2D, MaxVertices, BufferUsage.WriteOnly); IndexBuffer ??= new DynamicIndexBuffer(Main.instance.GraphicsDevice, IndexElementSize.SixteenBits, MaxIndices, BufferUsage.WriteOnly); + WireframeEffect ??= new BasicEffect(Main.instance.GraphicsDevice) + { + VertexColorEnabled = true, + TextureEnabled = false, + LightingEnabled = false + }; }); } + public override void OnModUnload() + { + WireframeEffect?.Dispose(); + WireframeEffect = null; + } + private static void PerformPixelationSafetyChecks(PrimitiveSettings settings) { // Don't allow accidental screw ups with these. @@ -99,11 +122,14 @@ namespace CalamityMod.Graphics.Primitives return; // Return if too many to draw anything, - if (positions.Length >= MaxPositions) + if (positions.Length > MaxPositions) return; + int desiredPointCount = pointsToCreate ?? positions.Length; + desiredPointCount = Math.Clamp(desiredPointCount, 2, MaxPositions); + // IF this is false, a correct position trail could not be made and rendering should not continue. - if (!AssignPointsRectangleTrail(positions, settings, pointsToCreate ?? positions.Length)) + if (!AssignPointsRectangleTrail(positions, settings, desiredPointCount)) return; // A trail with only one point or less has nothing to connect to, and therefore, can't make a trail. @@ -148,6 +174,9 @@ namespace CalamityMod.Graphics.Primitives Main.instance.GraphicsDevice.SetVertexBuffer(VertexBuffer); Main.instance.GraphicsDevice.Indices = IndexBuffer; Main.instance.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, VerticesIndex, 0, IndicesIndex / 3); + + if (MainSettings.DebugWireframe && WireframeEffect != null && TryBuildWireframeGeometry(MainSettings.WireframeColor, out int lineCount)) + DrawWireframe(view, projection, lineCount); } #endregion @@ -159,27 +188,39 @@ namespace CalamityMod.Graphics.Primitives { PositionsIndex = 0; - // Would like to remove this, but unsure how else to properly ensure that none are zero. - positions = positions.Where(originalPosition => originalPosition != Vector2.Zero).ToArray(); + int validCount = 0; + for (int i = 0; i < positions.Length; i++) + { + if (positions[i] == Vector2.Zero) + continue; - if (positions.Length <= 2) + NonSmoothIndexScratch[validCount++] = i; + } + + if (validCount <= 2) return false; - // Remap the original positions across a certain length. + int lastIndex = validCount - 1; + float inversePointCount = 1f / (pointsToCreate - 1); + float lastIndexFloat = lastIndex; + + // Remap the original positions across a certain length without additional allocations. for (int i = 0; i < pointsToCreate; i++) { - float completionRatio = i / (float)(pointsToCreate - 1f); - int currentIndex = (int)(completionRatio * (positions.Length - 1)); - Vector2 currentPoint = positions[currentIndex]; - Vector2 nextPoint = positions[(currentIndex + 1) % positions.Length]; + float completionRatio = i * inversePointCount; + float scaledIndex = completionRatio * lastIndexFloat; + int currentIndex = (int)scaledIndex; + int nextIndex = Math.Min(currentIndex + 1, lastIndex); + float localInterpolant = scaledIndex - currentIndex; - // 29FEB2024: Ozzatron: offset function needs to apply even in cases where smoothing is off. - Vector2 finalPos = Vector2.Lerp(currentPoint, nextPoint, completionRatio * (positions.Length - 1) % 0.99999f) - Main.screenPosition; + Vector2 currentPoint = positions[NonSmoothIndexScratch[currentIndex]]; + Vector2 nextPoint = positions[NonSmoothIndexScratch[nextIndex]]; + Vector2 interpolatedWorld = Vector2.Lerp(currentPoint, nextPoint, localInterpolant); + Vector2 finalPos = interpolatedWorld - Main.screenPosition; if (settings.OffsetFunction != null) - finalPos += settings.OffsetFunction(completionRatio, finalPos); + finalPos += settings.OffsetFunction(completionRatio, interpolatedWorld); - MainPositions[PositionsIndex] = finalPos; - PositionsIndex++; + MainPositions[PositionsIndex++] = finalPos; } return true; } @@ -188,7 +229,8 @@ namespace CalamityMod.Graphics.Primitives PositionsIndex = 1; // Create the control points for the spline. - List controlPoints = new(); + List controlPoints = ControlPointsCache; + controlPoints.Clear(); for (int i = 0; i < positions.Length; i++) { // Don't incorporate points that are zeroed out. @@ -241,8 +283,8 @@ namespace CalamityMod.Graphics.Primitives } // Manually insert the front and end points. - MainPositions[0] = controlPoints.First(); - MainPositions[PositionsIndex] = controlPoints.Last(); + MainPositions[0] = controlPoints[0]; + MainPositions[PositionsIndex] = controlPoints[controlPoints.Count - 1]; PositionsIndex++; return true; } @@ -433,6 +475,72 @@ namespace CalamityMod.Graphics.Primitives } } + private static bool TryBuildWireframeGeometry(Color lineColor, out int lineCount) + { + lineCount = 0; + + if (WireframeVertices == null) + return false; + + int segments = PositionsIndex - 1; + if (segments <= 0) + return false; + + WireframeVertexCount = 0; + + for (int i = 0; i < segments; i++) + { + int currentLeft = i * 2; + int currentRight = currentLeft + 1; + int nextLeft = currentLeft + 2; + int nextRight = nextLeft + 1; + + AddWireframeLineFromIndices(currentLeft, nextLeft, lineColor); + AddWireframeLineFromIndices(currentRight, nextRight, lineColor); + } + + for (int i = 0; i < PositionsIndex; i++) + { + int leftIndex = i * 2; + AddWireframeLineFromIndices(leftIndex, leftIndex + 1, lineColor); + } + + lineCount = WireframeVertexCount / 2; + return lineCount > 0; + } + + private static void AddWireframeLineFromIndices(int startVertexIndex, int endVertexIndex, Color color) + { + if (WireframeVertexCount + 1 >= WireframeVertices.Length) + return; + + int vertexCount = VerticesIndex; + if (startVertexIndex >= vertexCount || endVertexIndex >= vertexCount) + return; + + ref readonly VertexPosition2DColorTexture start = ref MainVertices[startVertexIndex]; + ref readonly VertexPosition2DColorTexture end = ref MainVertices[endVertexIndex]; + WireframeVertices[WireframeVertexCount++] = new VertexPositionColor(new Vector3(start.Position, 0f), color); + WireframeVertices[WireframeVertexCount++] = new VertexPositionColor(new Vector3(end.Position, 0f), color); + } + + private static void DrawWireframe(Matrix view, Matrix projection, int lineCount) + { + if (lineCount <= 0 || WireframeEffect == null) + return; + + WireframeEffect.World = Matrix.Identity; + WireframeEffect.View = view; + WireframeEffect.Projection = projection; + + var device = Main.instance.GraphicsDevice; + foreach (EffectPass pass in WireframeEffect.CurrentTechnique.Passes) + { + pass.Apply(); + device.DrawUserPrimitives(PrimitiveType.LineList, WireframeVertices, 0, lineCount); + } + } + private static void AssignIndicesRectangleTrail() { // What this is doing is basically representing each point on the vertices list as diff --git a/Graphics/Primitives/PrimitiveSettings.cs b/Graphics/Primitives/PrimitiveSettings.cs index c724b68abe..d96642c48e 100644 --- a/Graphics/Primitives/PrimitiveSettings.cs +++ b/Graphics/Primitives/PrimitiveSettings.cs @@ -140,6 +140,16 @@ namespace CalamityMod.Graphics.Primitives /// Maximum multiplier applied to miter joins to keep spikes under control. /// public readonly float JoinMiterLimit; + + /// + /// If true, a debug wireframe will be rendered on top of the primitive. + /// + public readonly bool DebugWireframe; + + /// + /// The color used for the optional wireframe overlay. + /// + public readonly Color WireframeColor; #endregion /// @@ -159,7 +169,9 @@ namespace CalamityMod.Graphics.Primitives /// Optional override that receives the completion ratio and returns a custom U coordinate. /// Determines how neighbouring segments are joined when expanding into quads. /// Maximum multiplier applied to miter joins to prevent spikes. Only used when is . - public PrimitiveSettings(VertexWidthFunction widthFunction, VertexColorFunction colorFunction, VertexOffsetFunction offsetFunction = null, bool smoothen = true, bool pixelate = false, MiscShaderData shader = null, bool useUnscaledMatrices = false, (Vector2, Vector2)? initialVertexPositionsOverride = null, PrimitiveTextureMode textureCoordinateMode = PrimitiveTextureMode.Normalized, float textureCycleLength = 1f, float textureScrollOffset = 0f, Func textureCoordinateFunction = null, PrimitiveJoinStyle joinStyle = PrimitiveJoinStyle.Flat, float joinMiterLimit = 4f) + /// When true, draws a wireframe overlay useful for debugging primitive geometry. + /// Optional override for the wireframe color. If null, a vivid green is used. + public PrimitiveSettings(VertexWidthFunction widthFunction, VertexColorFunction colorFunction, VertexOffsetFunction offsetFunction = null, bool smoothen = true, bool pixelate = false, MiscShaderData shader = null, bool useUnscaledMatrices = false, (Vector2, Vector2)? initialVertexPositionsOverride = null, PrimitiveTextureMode textureCoordinateMode = PrimitiveTextureMode.Normalized, float textureCycleLength = 1f, float textureScrollOffset = 0f, Func textureCoordinateFunction = null, PrimitiveJoinStyle joinStyle = PrimitiveJoinStyle.Flat, float joinMiterLimit = 4f, bool debugWireframe = false, Color? wireframeColor = null) { WidthFunction = widthFunction; ColorFunction = colorFunction; @@ -170,11 +182,13 @@ namespace CalamityMod.Graphics.Primitives UseUnscaledMatrices = useUnscaledMatrices; InitialVertexPositionsOverride = initialVertexPositionsOverride; TextureCoordinateMode = textureCoordinateMode; - TextureCycleLength = Math.Abs(textureCycleLength) <= 1e-4f ? 1f : textureCycleLength; + TextureCycleLength = Math.Abs(textureCycleLength) <= PrimitiveRenderer.Epsilon ? 1f : textureCycleLength; TextureScrollOffset = textureScrollOffset; TextureCoordinateFunction = textureCoordinateFunction; JoinStyle = joinStyle; JoinMiterLimit = Math.Max(joinMiterLimit, 1f); + DebugWireframe = true; + WireframeColor = wireframeColor ?? Color.LimeGreen; } } } From 39702c32ae11d9862bf193dca173a62b7cd8772a Mon Sep 17 00:00:00 2001 From: Dreitone Date: Tue, 9 Dec 2025 08:43:14 -0600 Subject: [PATCH 16/48] prims remake --- Graphics/Primitives/PrimitiveRenderer.cs | 417 +++++++++++++++++++---- Graphics/Primitives/PrimitiveSettings.cs | 125 ++++++- 2 files changed, 476 insertions(+), 66 deletions(-) diff --git a/Graphics/Primitives/PrimitiveRenderer.cs b/Graphics/Primitives/PrimitiveRenderer.cs index 03afe3f942..4f06690c39 100644 --- a/Graphics/Primitives/PrimitiveRenderer.cs +++ b/Graphics/Primitives/PrimitiveRenderer.cs @@ -29,8 +29,14 @@ namespace CalamityMod.Graphics.Primitives private static PrimitiveSettings MainSettings; + private static PrimitiveTopology ActiveTopology; + private static Vector2[] MainPositions; + private static Vector2[] MainTangents; + + private static Vector2[] MainNormals; + private static VertexPosition2DColorTexture[] MainVertices; private static short[] MainIndices; @@ -43,6 +49,10 @@ namespace CalamityMod.Graphics.Primitives private static int[] NonSmoothIndexScratch; + private static short StartCapCenterIndex; + + private static short EndCapCenterIndex; + private const short MaxPositions = 1000; private const short MaxVertices = 3072; @@ -71,6 +81,8 @@ namespace CalamityMod.Graphics.Primitives MainVertices = new VertexPosition2DColorTexture[MaxVertices]; MainIndices = new short[MaxIndices]; MainCompletionRatios = new float[MaxPositions]; + MainTangents = new Vector2[MaxPositions]; + MainNormals = new Vector2[MaxPositions]; WireframeVertices = new VertexPositionColor[MaxPositions * 8]; NonSmoothIndexScratch = new int[MaxPositions]; VertexBuffer ??= new DynamicVertexBuffer(Main.instance.GraphicsDevice, VertexPosition2DColorTexture.VertexDeclaration2D, MaxVertices, BufferUsage.WriteOnly); @@ -128,19 +140,21 @@ namespace CalamityMod.Graphics.Primitives int desiredPointCount = pointsToCreate ?? positions.Length; desiredPointCount = Math.Clamp(desiredPointCount, 2, MaxPositions); + MainSettings = settings; + ActiveTopology = settings.CapStyle != PrimitiveCapStyle.None ? PrimitiveTopology.TriangleList : settings.Topology; + // IF this is false, a correct position trail could not be made and rendering should not continue. if (!AssignPointsRectangleTrail(positions, settings, desiredPointCount)) return; // A trail with only one point or less has nothing to connect to, and therefore, can't make a trail. - MainSettings = settings; AssignCompletionData(); if (PositionsIndex <= 2) return; AssignVerticesRectangleTrail(); - AssignIndicesRectangleTrail(); + AssignIndices(); // Else render without wasting resources creating a set. PrivateRender(); @@ -149,7 +163,15 @@ namespace CalamityMod.Graphics.Primitives private static void PrivateRender() { - if (IndicesIndex % 6 != 0 || VerticesIndex <= 3) + if (VerticesIndex <= 3) + return; + + if (ActiveTopology == PrimitiveTopology.TriangleList) + { + if (IndicesIndex < 6 || IndicesIndex % 3 != 0) + return; + } + else if (ActiveTopology == PrimitiveTopology.TriangleStrip && IndicesIndex < 4) return; // Perform screen culling, for performance reasons. @@ -173,7 +195,10 @@ namespace CalamityMod.Graphics.Primitives Main.instance.GraphicsDevice.SetVertexBuffer(VertexBuffer); Main.instance.GraphicsDevice.Indices = IndexBuffer; - Main.instance.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, VerticesIndex, 0, IndicesIndex / 3); + + PrimitiveType primitiveType = ActiveTopology == PrimitiveTopology.TriangleStrip ? PrimitiveType.TriangleStrip : PrimitiveType.TriangleList; + int primitiveCount = primitiveType == PrimitiveType.TriangleStrip ? Math.Max(IndicesIndex - 2, 0) : IndicesIndex / 3; + Main.instance.GraphicsDevice.DrawIndexedPrimitives(primitiveType, 0, 0, VerticesIndex, 0, primitiveCount); if (MainSettings.DebugWireframe && WireframeEffect != null && TryBuildWireframeGeometry(MainSettings.WireframeColor, out int lineCount)) DrawWireframe(view, projection, lineCount); @@ -225,16 +250,13 @@ namespace CalamityMod.Graphics.Primitives return true; } - // Due to the first point being manually added, points should be added starting at the second position instead of the first. - PositionsIndex = 1; + PositionsIndex = 0; // Create the control points for the spline. List controlPoints = ControlPointsCache; controlPoints.Clear(); for (int i = 0; i < positions.Length; i++) { - // Don't incorporate points that are zeroed out. - // They are almost certainly a result of incomplete oldPos arrays. if (positions[i] == Vector2.Zero) continue; @@ -245,47 +267,73 @@ namespace CalamityMod.Graphics.Primitives controlPoints.Add(positions[i] + offset); } - // Avoid stupid index errors. - if (controlPoints.Count <= 4) + int controlCount = controlPoints.Count; + if (controlCount <= 1) + { + controlPoints.Clear(); return false; + } + + int segmentCount = controlCount - 1; + + if (settings.SmoothingSegments > 0) + { + int segmentsPerEdge = Math.Max(1, settings.SmoothingSegments); + PrimitiveSmoothingType smoothingType = settings.SmoothingType; + + for (int segment = 0; segment < segmentCount; segment++) + { + Vector2 p0 = controlPoints[Math.Max(segment - 1, 0)]; + Vector2 p1 = controlPoints[segment]; + Vector2 p2 = controlPoints[segment + 1]; + Vector2 p3 = controlPoints[Math.Min(segment + 2, controlCount - 1)]; + + for (int step = segment == 0 ? 0 : 1; step <= segmentsPerEdge; step++) + { + if (PositionsIndex >= MaxPositions - 1) + { + controlPoints.Clear(); + return true; + } + + float localT = step / (float)segmentsPerEdge; + Vector2 point = EvaluateCurve(smoothingType, p0, p1, p2, p3, localT, settings); + MainPositions[PositionsIndex++] = point; + } + } + + controlPoints.Clear(); + return true; + } + + // Legacy behaviour: sample based on requested point count using Catmull-Rom style interpolation. + PositionsIndex = 1; + float controlCountMinusOne = controlCount - 1f; + PrimitiveSmoothingType legacyType = settings.SmoothingType; for (int j = 0; j < pointsToCreate; j++) { + if (PositionsIndex >= MaxPositions - 1) + break; + float splineInterpolant = j / (float)pointsToCreate; - float localSplineInterpolant = splineInterpolant * (controlPoints.Count - 1f) % 1f; - int localSplineIndex = (int)(splineInterpolant * (controlPoints.Count - 1f)); + float positionOnCurve = splineInterpolant * controlCountMinusOne; + int localSplineIndex = (int)positionOnCurve; + float localSplineInterpolant = positionOnCurve - localSplineIndex; - Vector2 farLeft; - Vector2 left = controlPoints[localSplineIndex]; - Vector2 right = controlPoints[localSplineIndex + 1]; - Vector2 farRight; + Vector2 p0 = controlPoints[Math.Max(localSplineIndex - 1, 0)]; + Vector2 p1 = controlPoints[localSplineIndex]; + Vector2 p2 = controlPoints[Math.Min(localSplineIndex + 1, controlCount - 1)]; + Vector2 p3 = controlPoints[Math.Min(localSplineIndex + 2, controlCount - 1)]; - // Special case: If the spline attempts to access the previous/next index but the index is already at the very beginning/end, simply - // cheat a little bit by creating a phantom point that's mirrored from the previous one. - if (localSplineIndex <= 0) - { - Vector2 mirrored = left * 2f - right; - farLeft = mirrored; - } - else - farLeft = controlPoints[localSplineIndex - 1]; - - if (localSplineIndex >= controlPoints.Count - 2) - { - Vector2 mirrored = right * 2f - left; - farRight = mirrored; - } - else - farRight = controlPoints[localSplineIndex + 2]; - - MainPositions[PositionsIndex] = Vector2.CatmullRom(farLeft, left, right, farRight, localSplineInterpolant); + MainPositions[PositionsIndex] = EvaluateCurve(legacyType, p0, p1, p2, p3, localSplineInterpolant, settings); PositionsIndex++; } - // Manually insert the front and end points. MainPositions[0] = controlPoints[0]; - MainPositions[PositionsIndex] = controlPoints[controlPoints.Count - 1]; + MainPositions[PositionsIndex] = controlPoints[controlCount - 1]; PositionsIndex++; + controlPoints.Clear(); return true; } @@ -311,8 +359,27 @@ namespace CalamityMod.Graphics.Primitives if (TotalTrailLength > Epsilon) { float inverseTotal = 1f / TotalTrailLength; - for (int i = 1; i < PositionsIndex; i++) - MainCompletionRatios[i] *= inverseTotal; + int lastIndex = PositionsIndex - 1; + + if (System.Numerics.Vector.IsHardwareAccelerated && PositionsIndex - 1 >= System.Numerics.Vector.Count) + { + var scale = new System.Numerics.Vector(inverseTotal); + int i = 1; + int upperBound = lastIndex - System.Numerics.Vector.Count + 1; + for (; i <= upperBound; i += System.Numerics.Vector.Count) + { + var values = new System.Numerics.Vector(MainCompletionRatios, i); + (values * scale).CopyTo(MainCompletionRatios, i); + } + + for (; i <= lastIndex; i++) + MainCompletionRatios[i] *= inverseTotal; + } + else + { + for (int i = 1; i < PositionsIndex; i++) + MainCompletionRatios[i] *= inverseTotal; + } MainCompletionRatios[PositionsIndex - 1] = 1f; } @@ -326,6 +393,9 @@ namespace CalamityMod.Graphics.Primitives private static void AssignVerticesRectangleTrail() { VerticesIndex = 0; + StartCapCenterIndex = -1; + EndCapCenterIndex = -1; + ComputeFrameData(); for (int i = 0; i < PositionsIndex; i++) { float completionRatio = GetCompletionRatioForIndex(i); @@ -354,6 +424,45 @@ namespace CalamityMod.Graphics.Primitives MainVertices[VerticesIndex] = new VertexPosition2DColorTexture(right, vertexColor, rightCurrentTextureCoord, effectiveHalfWidth); VerticesIndex++; } + + AddCaps(); + } + + private static void AddCaps() + { + if (MainSettings.CapStyle == PrimitiveCapStyle.None || PositionsIndex <= 0) + return; + + if (ActiveTopology == PrimitiveTopology.TriangleStrip) + return; + + StartCapCenterIndex = TryCreateCapVertex(0); + if (PositionsIndex > 1) + EndCapCenterIndex = TryCreateCapVertex(PositionsIndex - 1); + } + + private static short TryCreateCapVertex(int positionIndex) + { + if (VerticesIndex >= MaxVertices - 1) + return -1; + + int leftVertexIndex = positionIndex * 2; + int rightVertexIndex = leftVertexIndex + 1; + if (rightVertexIndex >= VerticesIndex) + return -1; + + ref readonly VertexPosition2DColorTexture leftVertex = ref MainVertices[leftVertexIndex]; + ref readonly VertexPosition2DColorTexture rightVertex = ref MainVertices[rightVertexIndex]; + + Vector2 centerPosition = MainPositions[positionIndex]; + Color centerColor = Color.Lerp(leftVertex.Color, rightVertex.Color, 0.5f); + float centerHalfWidth = Math.Max(Math.Max(leftVertex.TextureCoordinates.Z, rightVertex.TextureCoordinates.Z), Epsilon); + float centerU = (leftVertex.TextureCoordinates.X + rightVertex.TextureCoordinates.X) * 0.5f; + Vector2 centerTexcoord = new(centerU, 0.5f); + + short newVertexIndex = VerticesIndex; + MainVertices[VerticesIndex++] = new VertexPosition2DColorTexture(centerPosition, centerColor, centerTexcoord, centerHalfWidth); + return newVertexIndex; } private static float GetCompletionRatioForIndex(int index) @@ -392,6 +501,146 @@ namespace CalamityMod.Graphics.Primitives } } + private static void ComputeFrameData() + { + if (PositionsIndex <= 0) + return; + + Vector2 fallbackTangent = Vector2.UnitX; + + for (int i = 0; i < PositionsIndex; i++) + { + Vector2 tangent = ComputeTangent(i, fallbackTangent); + tangent = tangent.SafeNormalize(fallbackTangent.SafeNormalize(Vector2.UnitX)); + MainTangents[i] = tangent; + fallbackTangent = tangent; + } + + Vector2 previousNormal = Vector2.Zero; + + for (int i = 0; i < PositionsIndex; i++) + { + Vector2 tangent = MainTangents[i]; + if (tangent.LengthSquared() <= Epsilon) + tangent = fallbackTangent.SafeNormalize(Vector2.UnitX); + + Vector2 baseNormal = new Vector2(-tangent.Y, tangent.X); + Vector2 normal; + + if (MainSettings.FrameTransportMode == PrimitiveFrameTransportMode.ParallelTransport && i > 0 && previousNormal.LengthSquared() > Epsilon) + { + Vector2 previousTangent = MainTangents[i - 1]; + float cosine = MathHelper.Clamp(Vector2.Dot(previousTangent, tangent), -1f, 1f); + float sine = Cross(previousTangent, tangent); + Vector2 transported = new Vector2( + cosine * previousNormal.X - sine * previousNormal.Y, + sine * previousNormal.X + cosine * previousNormal.Y + ); + normal = transported; + } + else + normal = baseNormal; + + if (normal.LengthSquared() <= Epsilon) + normal = previousNormal.LengthSquared() > Epsilon ? previousNormal : baseNormal; + + normal = normal.SafeNormalize(previousNormal.LengthSquared() > Epsilon ? previousNormal : Vector2.UnitY); + MainNormals[i] = normal; + previousNormal = normal; + } + } + + private static Vector2 ComputeTangent(int index, Vector2 fallback) + { + int last = PositionsIndex - 1; + Vector2 tangent; + + if (PositionsIndex <= 1) + { + tangent = fallback; + } + else if (index <= 0) + { + tangent = MainPositions[1] - MainPositions[0]; + } + else if (index >= last) + { + tangent = MainPositions[last] - MainPositions[last - 1]; + } + else + { + Vector2 forward = MainPositions[index + 1] - MainPositions[index]; + Vector2 backward = MainPositions[index] - MainPositions[index - 1]; + tangent = forward + backward; + + if (tangent.LengthSquared() <= Epsilon) + tangent = forward.LengthSquared() >= backward.LengthSquared() ? forward : backward; + } + + if (tangent.LengthSquared() <= Epsilon) + tangent = fallback.LengthSquared() > Epsilon ? fallback : Vector2.UnitX; + + return tangent; + } + + private static Vector2 EvaluateCurve(PrimitiveSmoothingType type, Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3, float t, PrimitiveSettings settings) + { + t = MathHelper.Clamp(t, 0f, 1f); + + switch (type) + { + case PrimitiveSmoothingType.Linear: + return Vector2.Lerp(p1, p2, t); + + case PrimitiveSmoothingType.Cardinal: + { + float tension = MathHelper.Clamp(settings.SmoothingTension, -1f, 1f); + float scale = (1f - tension) * 0.5f; + Vector2 m0 = (p2 - p0) * scale; + Vector2 m1 = (p3 - p1) * scale; + return EvaluateHermiteSpan(p1, p2, m0, m1, t); + } + + case PrimitiveSmoothingType.Hermite: + { + Vector2 m0 = 0.5f * (p2 - p0); + Vector2 m1 = 0.5f * (p3 - p1); + return EvaluateHermiteSpan(p1, p2, m0, m1, t); + } + + case PrimitiveSmoothingType.CubicBezier: + { + Vector2 handle1 = p1 + (p2 - p0) / 3f; + Vector2 handle2 = p2 - (p3 - p1) / 3f; + return EvaluateBezierSpan(p1, handle1, handle2, p2, t); + } + + default: + return Vector2.CatmullRom(p0, p1, p2, p3, t); + } + } + + private static Vector2 EvaluateHermiteSpan(Vector2 start, Vector2 end, Vector2 tangentStart, Vector2 tangentEnd, float t) + { + float t2 = t * t; + float t3 = t2 * t; + float h00 = 2f * t3 - 3f * t2 + 1f; + float h10 = t3 - 2f * t2 + t; + float h01 = -2f * t3 + 3f * t2; + float h11 = t3 - t2; + return h00 * start + h10 * tangentStart + h01 * end + h11 * tangentEnd; + } + + private static Vector2 EvaluateBezierSpan(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3, float t) + { + float u = 1f - t; + float u2 = u * u; + float u3 = u2 * u; + float t2 = t * t; + float t3 = t2 * t; + return u3 * p0 + 3f * u2 * t * p1 + 3f * u * t2 * p2 + t3 * p3; + } + private static void ComputeEdgePositions(int index, float halfWidth, out Vector2 left, out Vector2 right, out float effectiveHalfWidth) { Vector2 currentPosition = MainPositions[index]; @@ -404,16 +653,9 @@ namespace CalamityMod.Graphics.Primitives return; } - Vector2 forward = index >= PositionsIndex - 1 ? MainPositions[index] - MainPositions[index - 1] : MainPositions[index + 1] - MainPositions[index]; - Vector2 backward = index <= 0 ? forward : MainPositions[index] - MainPositions[index - 1]; - - Vector2 forwardDir = forward.SafeNormalize(Vector2.Zero); - if (forwardDir == Vector2.Zero) - forwardDir = backward.SafeNormalize(Vector2.UnitX); - if (forwardDir == Vector2.Zero) - forwardDir = Vector2.UnitX; - - Vector2 defaultNormal = new Vector2(-forwardDir.Y, forwardDir.X).SafeNormalize(Vector2.UnitY); + Vector2 defaultNormal = MainNormals[index]; + if (defaultNormal.LengthSquared() <= Epsilon) + defaultNormal = Vector2.UnitY; if (MainSettings.JoinStyle == PrimitiveJoinStyle.Flat || PositionsIndex <= 2 || index == 0 || index == PositionsIndex - 1) { @@ -424,17 +666,23 @@ namespace CalamityMod.Graphics.Primitives return; } - Vector2 backwardDir = backward.SafeNormalize(forwardDir); - Vector2 averageTangent = backwardDir + forwardDir; - if (averageTangent.LengthSquared() <= Epsilon) - averageTangent = forwardDir; - Vector2 averageNormal = new Vector2(-averageTangent.Y, averageTangent.X).SafeNormalize(defaultNormal); + Vector2 prevNormal = MainNormals[Math.Max(index - 1, 0)]; + if (prevNormal.LengthSquared() <= Epsilon) + prevNormal = defaultNormal; + + Vector2 nextNormal = MainNormals[Math.Min(index + 1, PositionsIndex - 1)]; + if (nextNormal.LengthSquared() <= Epsilon) + nextNormal = defaultNormal; switch (MainSettings.JoinStyle) { case PrimitiveJoinStyle.Smooth: { - Vector2 offset = averageNormal * halfWidth; + Vector2 averageNormal = (prevNormal + defaultNormal + nextNormal) * (1f / 3f); + if (averageNormal.LengthSquared() <= Epsilon) + averageNormal = defaultNormal; + + Vector2 offset = averageNormal.SafeNormalize(defaultNormal) * halfWidth; left = currentPosition - offset; right = currentPosition + offset; effectiveHalfWidth = halfWidth; @@ -443,14 +691,14 @@ namespace CalamityMod.Graphics.Primitives case PrimitiveJoinStyle.Miter: { - Vector2 prevNormal = new Vector2(-backwardDir.Y, backwardDir.X).SafeNormalize(defaultNormal); - Vector2 nextNormal = new Vector2(-forwardDir.Y, forwardDir.X).SafeNormalize(defaultNormal); - Vector2 miter = prevNormal + nextNormal; + Vector2 prev = prevNormal.SafeNormalize(defaultNormal); + Vector2 next = nextNormal.SafeNormalize(defaultNormal); + Vector2 miter = prev + next; if (miter.LengthSquared() <= Epsilon) - miter = averageNormal; + miter = defaultNormal; - miter = miter.SafeNormalize(averageNormal); - float denom = Vector2.Dot(miter, nextNormal); + miter = miter.SafeNormalize(defaultNormal); + float denom = Vector2.Dot(miter, next); if (Math.Abs(denom) < Epsilon) denom = denom >= 0f ? Epsilon : -Epsilon; @@ -541,15 +789,23 @@ namespace CalamityMod.Graphics.Primitives } } - private static void AssignIndicesRectangleTrail() + private static void AssignIndices() { + IndicesIndex = 0; + + if (ActiveTopology == PrimitiveTopology.TriangleStrip) + { + for (short i = 0; i < VerticesIndex && IndicesIndex < MaxIndices; i++) + MainIndices[IndicesIndex++] = i; + return; + } + // What this is doing is basically representing each point on the vertices list as // indices. These indices should come together to create a tiny rectangle that acts // as a segment on the trail. This is achieved here by splitting the indices (or rather, points) // into 2 triangles, which requires 6 points. // The logic here basically determines which indices are connected together. - IndicesIndex = 0; - for (short i = 0; i < PositionsIndex - 2; i++) + for (short i = 0; i < PositionsIndex - 2 && IndicesIndex + 5 < MaxIndices; i++) { short connectToIndex = (short)(i * 2); MainIndices[IndicesIndex] = connectToIndex; @@ -570,6 +826,37 @@ namespace CalamityMod.Graphics.Primitives MainIndices[IndicesIndex] = (short)(connectToIndex + 3); IndicesIndex++; } + + AppendCapTriangles(); + } + + private static void AppendCapTriangles() + { + if (MainSettings.CapStyle == PrimitiveCapStyle.None) + return; + + if (PositionsIndex <= 0) + return; + + if (StartCapCenterIndex >= 0) + AddTriangle((short)(StartCapCenterIndex), 0, 1); + + if (EndCapCenterIndex >= 0) + { + short leftIndex = (short)((PositionsIndex - 1) * 2); + short rightIndex = (short)(leftIndex + 1); + AddTriangle(leftIndex, rightIndex, EndCapCenterIndex); + } + } + + private static void AddTriangle(short i0, short i1, short i2) + { + if (IndicesIndex + 2 >= MaxIndices) + return; + + MainIndices[IndicesIndex++] = i0; + MainIndices[IndicesIndex++] = i1; + MainIndices[IndicesIndex++] = i2; } private static void CalcuatePixelatedPerspectiveMatrices(out Matrix viewMatrix, out Matrix projectionMatrix) @@ -578,6 +865,8 @@ namespace CalamityMod.Graphics.Primitives projectionMatrix = Matrix.CreateOrthographicOffCenter(0, Main.screenWidth, Main.screenHeight, 0, -1, 1); viewMatrix = Matrix.Identity; } + + private static float Cross(Vector2 a, Vector2 b) => a.X * b.Y - a.Y * b.X; #endregion } } diff --git a/Graphics/Primitives/PrimitiveSettings.cs b/Graphics/Primitives/PrimitiveSettings.cs index d96642c48e..ebc4b51fcd 100644 --- a/Graphics/Primitives/PrimitiveSettings.cs +++ b/Graphics/Primitives/PrimitiveSettings.cs @@ -41,6 +41,85 @@ namespace CalamityMod.Graphics.Primitives Miter } + /// + /// Determines how intermediate sample points are generated for smoothing. + /// + public enum PrimitiveSmoothingType + { + /// + /// Classic Catmull-Rom interpolation between points. + /// + CatmullRom, + + /// + /// Cardinal spline interpolation with configurable tension. + /// + Cardinal, + + /// + /// Straight-line interpolation between neighbouring points. + /// + Linear, + + /// + /// Cubic Hermite interpolation using central difference tangents. + /// + Hermite, + + /// + /// Cubic Bezier interpolation using Catmull-Rom handles. + /// + CubicBezier + } + + /// + /// Selects how orientation frames propagate along the trail. + /// + public enum PrimitiveFrameTransportMode + { + /// + /// Derives the normal from the instantaneous tangent (legacy behaviour). + /// + Basic, + + /// + /// Uses parallel transport to minimise twisting. + /// + ParallelTransport + } + + /// + /// Determines the topology used when submitting geometry to the GPU. + /// + public enum PrimitiveTopology + { + /// + /// Expands geometry into independent triangles (legacy behaviour). + /// + TriangleList, + + /// + /// Connects geometry using a continuous triangle strip. + /// + TriangleStrip + } + + /// + /// Controls how the start and end of the primitive are capped. + /// + public enum PrimitiveCapStyle + { + /// + /// Leaves the ribbon open (legacy behaviour). + /// + None, + + /// + /// Adds a flat triangular cap across the ribbon ends. + /// + Flat + } + /// /// Contains all the various options to use when creating a primitive trail. New members can be added freely without breaking existing implementations. /// @@ -150,6 +229,36 @@ namespace CalamityMod.Graphics.Primitives /// The color used for the optional wireframe overlay. /// public readonly Color WireframeColor; + + /// + /// Determines the interpolation style when smoothing the provided point list. + /// + public readonly PrimitiveSmoothingType SmoothingType; + + /// + /// Controls how many intermediate subdivisions are generated per control segment when smoothing. Set to 0 for automatic distribution. + /// + public readonly int SmoothingSegments; + + /// + /// Additional tension used by smoothing functions that support it (e.g. Cardinal splines). + /// + public readonly float SmoothingTension; + + /// + /// Determines how normals are transported along the curve. + /// + public readonly PrimitiveFrameTransportMode FrameTransportMode; + + /// + /// Chooses the primitive topology when submitting geometry to the GPU. + /// + public readonly PrimitiveTopology Topology; + + /// + /// Determines how the ribbon is capped at its extremities. + /// + public readonly PrimitiveCapStyle CapStyle; #endregion /// @@ -171,7 +280,13 @@ namespace CalamityMod.Graphics.Primitives /// Maximum multiplier applied to miter joins to prevent spikes. Only used when is . /// When true, draws a wireframe overlay useful for debugging primitive geometry. /// Optional override for the wireframe color. If null, a vivid green is used. - public PrimitiveSettings(VertexWidthFunction widthFunction, VertexColorFunction colorFunction, VertexOffsetFunction offsetFunction = null, bool smoothen = true, bool pixelate = false, MiscShaderData shader = null, bool useUnscaledMatrices = false, (Vector2, Vector2)? initialVertexPositionsOverride = null, PrimitiveTextureMode textureCoordinateMode = PrimitiveTextureMode.Normalized, float textureCycleLength = 1f, float textureScrollOffset = 0f, Func textureCoordinateFunction = null, PrimitiveJoinStyle joinStyle = PrimitiveJoinStyle.Flat, float joinMiterLimit = 4f, bool debugWireframe = false, Color? wireframeColor = null) + /// Determines the interpolation style used when smoothing the control points. + /// When greater than zero, specifies the number of subdivisions created per control edge. + /// Optional tension parameter used by certain smoothing types such as cardinal splines. + /// Controls how frame orientation is propagated along the curve. + /// Specifies the primitive topology used when submitting geometry. + /// Selects how the ribbon's start and end are capped. + public PrimitiveSettings(VertexWidthFunction widthFunction, VertexColorFunction colorFunction, VertexOffsetFunction offsetFunction = null, bool smoothen = true, bool pixelate = false, MiscShaderData shader = null, bool useUnscaledMatrices = false, (Vector2, Vector2)? initialVertexPositionsOverride = null, PrimitiveTextureMode textureCoordinateMode = PrimitiveTextureMode.Normalized, float textureCycleLength = 1f, float textureScrollOffset = 0f, Func textureCoordinateFunction = null, PrimitiveJoinStyle joinStyle = PrimitiveJoinStyle.Smooth, float joinMiterLimit = 4f, bool debugWireframe = false, Color? wireframeColor = null, PrimitiveSmoothingType smoothingType = PrimitiveSmoothingType.CatmullRom, int smoothingSegments = 0, float smoothingTension = 0f, PrimitiveFrameTransportMode frameTransportMode = PrimitiveFrameTransportMode.ParallelTransport, PrimitiveTopology topology = PrimitiveTopology.TriangleStrip, PrimitiveCapStyle capStyle = PrimitiveCapStyle.None) { WidthFunction = widthFunction; ColorFunction = colorFunction; @@ -187,8 +302,14 @@ namespace CalamityMod.Graphics.Primitives TextureCoordinateFunction = textureCoordinateFunction; JoinStyle = joinStyle; JoinMiterLimit = Math.Max(joinMiterLimit, 1f); - DebugWireframe = true; + DebugWireframe = debugWireframe; WireframeColor = wireframeColor ?? Color.LimeGreen; + SmoothingType = smoothingType; + SmoothingSegments = Math.Max(smoothingSegments, 0); + SmoothingTension = smoothingTension; + FrameTransportMode = frameTransportMode; + Topology = topology; + CapStyle = PrimitiveCapStyle.Flat; } } } From 2d9d467e96ac345e8ecbbc89fba14aa3b6446307 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 15 Dec 2025 20:48:44 +0700 Subject: [PATCH 17/48] bonus potion balance round --- Items/Potions/BoundingPotion.cs | 6 +++--- Items/Potions/HadalStew.cs | 20 +++++++++----------- Items/Potions/ZenPotion.cs | 2 +- Items/Potions/ZergPotion.cs | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Items/Potions/BoundingPotion.cs b/Items/Potions/BoundingPotion.cs index a5906281fa..416300231c 100644 --- a/Items/Potions/BoundingPotion.cs +++ b/Items/Potions/BoundingPotion.cs @@ -34,9 +34,9 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { - CreateRecipe(3). - AddIngredient(ItemID.BottledWater, 3). - AddIngredient(ItemID.Frog). + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(ItemID.PinkGel). AddIngredient(ItemID.Moonglow). AddTile(TileID.Bottles). Register(); diff --git a/Items/Potions/HadalStew.cs b/Items/Potions/HadalStew.cs index e1938d2400..a8d36ded4e 100644 --- a/Items/Potions/HadalStew.cs +++ b/Items/Potions/HadalStew.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Potions public class HadalStew : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; - public static int BuffType = BuffID.WellFed2; - public static int BuffDuration = CalamityUtils.MinutesToFrames(60); + public static int BuffType = BuffID.WellFed3; + public static int BuffDuration = CalamityUtils.MinutesToFrames(8); public static int SicknessDuration = CalamityUtils.SecondsToFrames(50); public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(BuffDuration / 3600); @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - Item.DefaultToHealingPotion(28, 18, 120); + Item.DefaultToHealingPotion(28, 18, 100); Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.Green; } @@ -50,19 +50,17 @@ namespace CalamityMod.Items.Potions public override void AddRecipes() { - CreateRecipe(2). - AddIngredient(10). + CreateRecipe(). + AddIngredient(3). AddIngredient(). - AddIngredient(ItemID.Honeyfin). - AddIngredient(ItemID.Bowl, 2). + AddIngredient(ItemID.Bowl). AddTile(TileID.CookingPots). Register(); - CreateRecipe(2). - AddIngredient(10). + CreateRecipe(). + AddIngredient(3). AddIngredient(). - AddIngredient(ItemID.Honeyfin). - AddIngredient(ItemID.Bowl, 2). + AddIngredient(ItemID.Bowl). AddTile(TileID.CookingPots). Register(); } diff --git a/Items/Potions/ZenPotion.cs b/Items/Potions/ZenPotion.cs index ca8656fc27..44636fe640 100644 --- a/Items/Potions/ZenPotion.cs +++ b/Items/Potions/ZenPotion.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - Item.DefaultToFood(24, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(15), true); + Item.DefaultToFood(24, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(12), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Potions/ZergPotion.cs b/Items/Potions/ZergPotion.cs index 18a531edbe..edeaf48637 100644 --- a/Items/Potions/ZergPotion.cs +++ b/Items/Potions/ZergPotion.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - Item.DefaultToFood(24, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(15), true); + Item.DefaultToFood(24, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(7), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } From 6b9ec7ebf00f58f81f8db0e203bd379fbff8b3be Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 15 Dec 2025 10:59:47 -0500 Subject: [PATCH 18/48] Anahita projectile behavior ends after exactly two attack cycles This prevents desyncing from telegraphs getting interrupted by bubbles/charges --- NPCs/Leviathan/Anahita.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index abfd453e40..c07457543b 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -446,6 +446,9 @@ namespace CalamityMod.NPCs.Leviathan NPC.rotation = NPC.velocity.X * 0.02f; NPC.spriteDirection = NPC.direction; + // Remove projectile telegraph + DrawProjectileTelegraphTimer = 0; + Vector2 anahitaPos = NPC.Center; float playerXDist = player.position.X + (player.width / 2) - anahitaPos.X; float playerYDist = player.position.Y + (player.height / 2) - 200f * NPC.scale - anahitaPos.Y; @@ -788,12 +791,8 @@ namespace CalamityMod.NPCs.Leviathan NPC.spriteDirection = NPC.direction; } - float phaseTimer = 300f; - phaseTimer -= 50f * enrageScale; - if (!leviAlive || phase4) - phaseTimer -= 150f * (1f - lifeRatio); - - if (NPC.ai[1] >= phaseTimer) + // End behavior after attacking twice + if (NPC.ai[1] > attackDivisor * 2) { NPC.ai[0] = -1f; NPC.ai[1] = 2f; From 055839623bf03649c5408a40f99f078a76731029 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Tue, 16 Dec 2025 12:43:00 +0900 Subject: [PATCH 19/48] Set BeforeAllTiles as flag 1 for better flag supports --- Enums/GeneralDrawLayer.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Enums/GeneralDrawLayer.cs b/Enums/GeneralDrawLayer.cs index 319e734f49..b7cc6cd797 100644 --- a/Enums/GeneralDrawLayer.cs +++ b/Enums/GeneralDrawLayer.cs @@ -8,14 +8,14 @@ namespace CalamityMod.Enums [Flags] public enum GeneralDrawLayer { - BeforeAllTiles = 0, - BeforeSolidTiles = 1, - BeforeNPCs = 2, - AfterNPCs = 4, - BeforeProjectiles = 8, - AfterProjectiles = 16, - AfterPlayers = 32, - AfterDusts = 64, - AfterEverything = 128, + BeforeAllTiles = 1 << 0, + BeforeSolidTiles = 1 << 1, + BeforeNPCs = 1 << 2, + AfterNPCs = 1 << 3, + BeforeProjectiles = 1 << 4, + AfterProjectiles = 1 << 5, + AfterPlayers = 1 << 6, + AfterDusts = 1 << 7, + AfterEverything = 1 << 8, } } From d314a0c26287d7827c13b76c618ff6ddd7e4bd64 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Mon, 15 Dec 2025 23:28:40 -0500 Subject: [PATCH 20/48] Fixes / improves localization for new tile merge blending config setting --- .../en-US/Mods.CalamityMod.Configs.hjson | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index f7c39ffaf6..4083c303e5 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -369,12 +369,8 @@ CalamityClientConfig: { } TileTextureBlendingQuality: { - Label: "[i:GlowPaint] Tile Blending Quality" - Tooltip: - ''' - Change quality of tile merge soft-blending renderer. - This controls the quality of soft-blending between different types of merged tile. - ''' + Label: "[i:GlowPaint] Tile Merge Soft Blending" + Tooltip: Changes the quality of the soft-blending renderer used when different types of tiles merge together. } VanillaCooldownDisplay: { @@ -610,21 +606,21 @@ TileBlendingQuality: { Tooltip: "" Disable: { - Label: Disable - Tooltip: Disable Tile Texture Soft Blending + Label: Disabled + Tooltip: Tile texture soft blending is disabled. } Normal: { - Label: Normal - Tooltip: Enable Tile Texture Soft Blending + Label: Enabled + Tooltip: Tile texture soft blending is enabled. } High: { - Label: High + Label: Enabled + Slices Tooltip: ''' - Enable Tile Texture Soft Blending. - [c/F05A5A:Allows Sliced Rendering. Not recommended for low-end devices.] + Tile texture soft blending is enabled and uses sliced rendering. + [c/F05A5A:Not recommended for low-end devices.] ''' } } From 5ac6c8047a200df50c2e29d6f12d17fa0262b7c5 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 16 Dec 2025 00:06:32 -0500 Subject: [PATCH 21/48] Eye of the Golem nerf --- Items/CalamityGlobalItem.cs | 4 ++-- Localization/en-US/Mods.CalamityMod.Vanilla.hjson | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index fe36457f50..6e1684d282 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1218,13 +1218,13 @@ namespace CalamityMod.Items if (item.type == ItemID.EyeoftheGolem) { - player.Calamity().critDamage += 0.2f; + player.Calamity().critDamage += 0.15f; } if (item.type == ItemID.SniperScope) { player.GetDamage() -= 0.1f; //Total 0% damage player.GetCritChance() += 2; //Total 12% crit - player.Calamity().critDamage += 0.2f; + player.Calamity().critDamage += 0.15f; } if (item.type == ItemID.FireGauntlet) diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index 4814d6cee0..e317a28caf 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -13,7 +13,8 @@ AddedTooltip: { */ TitanGloveLine: 10% increased true melee damage YoyoGlove: Secondary yoyos will do 50% less damage - EyeoftheGolem: 20% increased critical strike damage + // Also used by Sniper Scope + EyeoftheGolem: 15% increased critical strike damage RifleScope: The scope effect can be toggled with visibility ArcaneFlower: 5% increased magic damage HellfireTreads: From f26538597969c5f747ca40136e5c10b803c31146 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Sat, 13 Dec 2025 11:14:50 +0900 Subject: [PATCH 22/48] Remove destroyerLaserColor field --- CalamityNetcode.cs | 1 - NPCs/CalamityGlobalNPC.cs | 41 ++++++--------- NPCs/CalamityVanillaAIOverrideNPC.cs | 23 +++++++++ .../Bosses/DestroyerAI.cs | 50 +++++++++++++------ .../VanillaAIOverride.cs | 2 + .../SyncDestroyerLaserColorPacket.cs | 34 ------------- Utilities/NPCUtils.cs | 13 ----- 7 files changed, 74 insertions(+), 90 deletions(-) delete mode 100644 Packets/Entities/VanillaChanges/SyncDestroyerLaserColorPacket.cs diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index ec95e43bc7..bfffa1013f 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -145,7 +145,6 @@ namespace CalamityMod ExaltationDirection, // Syncs for specific bosses or entities - SyncDestroyerLaserColor, SyncCalamityNPCAIArray, SyncVanillaNPCLocalAIArray, SpawnSuperDummy, diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 7667e5aa1e..fb7bb4e422 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -210,12 +210,6 @@ namespace CalamityMod.NPCs /// private const float BossZenDistance = 6400f; - /// - /// Destroyer laser colors, used for telegraphs.
- /// None = -1, Red = 0, Green = 1, Cyan = 2 - ///
- public int destroyerLaserColor = -1; - /// Constant multiplier used to decrease the health and/or damage of pre-Hardmode Desert enemies. private const double DesertEnemyStatMultiplier = 0.75; @@ -544,8 +538,6 @@ namespace CalamityMod.NPCs myClone.miscDefenseLoss = miscDefenseLoss; - myClone.destroyerLaserColor = destroyerLaserColor; - myClone.dashImmunityTime = new int[maxPlayerImmunities]; for (int i = 0; i < maxPlayerImmunities; ++i) myClone.dashImmunityTime[i] = dashImmunityTime[i]; @@ -5788,28 +5780,25 @@ namespace CalamityMod.NPCs // Telegraph for body lasers float telegraphProgress = 0f; - if (destroyerLaserColor != -1) + if (npc.TryGetAIOverride(out var destroyerAI) && destroyerAI.LaserColor != -1) { - if (npc.type == NPCID.TheDestroyerBody && revenge) + float shootProjectileTime = death ? (phase5 ? 180f : phase4 ? 270f : 360f) : 450f; + float telegraphGateValue = shootProjectileTime - DestroyerAI.LaserTelegraphTime; + if (newAI[0] > telegraphGateValue) { - float shootProjectileTime = death ? (phase5 ? 180f : phase4 ? 270f : 360f) : 450f; - float telegraphGateValue = shootProjectileTime - DestroyerAI.LaserTelegraphTime; - if (newAI[0] > telegraphGateValue) + switch (destroyerAI.LaserColor) { - switch (destroyerLaserColor) - { - default: - case 0: - break; - case 1: - telegraphColor = telegraphColor_Green; - break; - case 2: - telegraphColor = telegraphColor_Cyan; - break; - } - telegraphProgress = MathHelper.Clamp((newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); + default: + case 0: + break; + case 1: + telegraphColor = telegraphColor_Green; + break; + case 2: + telegraphColor = telegraphColor_Cyan; + break; } + telegraphProgress = MathHelper.Clamp((newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); } } diff --git a/NPCs/CalamityVanillaAIOverrideNPC.cs b/NPCs/CalamityVanillaAIOverrideNPC.cs index e7bd9d6354..d0c53b0f67 100644 --- a/NPCs/CalamityVanillaAIOverrideNPC.cs +++ b/NPCs/CalamityVanillaAIOverrideNPC.cs @@ -26,6 +26,24 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.NPCs; +public static class VanillaAIOverrideExtension +{ + extension(NPC npc) + { + public bool TryGetAIOverride(out AI aiInstance) where AI : VanillaAIOverride, new() + { + if (!npc.TryGetGlobalNPC(out var aiOverrideNPC)) + { + aiInstance = null; + return false; + } + + aiInstance = aiOverrideNPC.AIOverride as AI; + return aiInstance != null; + } + } +} + public sealed class CalamityVanillaAIOverrideNPC : GlobalNPC { /// @@ -920,6 +938,11 @@ public sealed class CalamityVanillaAIOverrideNPC : GlobalNPC return base.PreDraw(npc, spriteBatch, screenPos, drawColor); } + public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + AIOverride?.PostDraw(Mod, spriteBatch, screenPos, drawColor); + } + #endregion #region Networking diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 764116860a..bbfcf11786 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using CalamityMod.Events; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -10,6 +11,7 @@ using Terraria.DataStructures; using Terraria.Enums; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { @@ -37,6 +39,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Rev+ exclusive public static int LaserDamage = 25; // 100 (buffed); Applies to all Rev+ lasers + /// + /// Destroyer laser colors, used for telegraphs.
+ /// None = -1, Red = 0, Green = 1, Cyan = 2 + ///
+ public sbyte LaserColor = -1; + + public override void SendExtraAI(BitWriter bitWriter, BinaryWriter binaryWriter) + { + binaryWriter.Write(LaserColor); + } + + public override void ReceiveExtraAI(BitReader bitReader, BinaryReader binaryReader) + { + LaserColor = binaryReader.ReadSByte(); + } + public override bool AI(Mod mod) { int mechdusaCurvedSpineSegmentIndex = 0; @@ -262,33 +280,33 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Fire lasers if (NPC.type == NPCID.TheDestroyerBody) { - bool ableToFireLaser = calamityGlobalNPC.destroyerLaserColor != -1; + bool ableToFireLaser = LaserColor != -1; // Set laser color and type - if (calamityGlobalNPC.destroyerLaserColor == -1 && !probeLaunched) + if (LaserColor == -1 && !probeLaunched) { int random = phase3 ? 4 : phase2 ? 3 : 2; switch (Main.rand.Next(random)) { case 0: case 1: - calamityGlobalNPC.destroyerLaserColor = 0; + LaserColor = 0; break; case 2: - calamityGlobalNPC.destroyerLaserColor = 1; + LaserColor = 1; break; case 3: - calamityGlobalNPC.destroyerLaserColor = 2; + LaserColor = 2; break; } - NPC.SyncDestroyerLaserColor(); + NPC.netUpdate = true; } if (probeLaunched && ableToFireLaser) { - calamityGlobalNPC.destroyerLaserColor = -1; - NPC.SyncDestroyerLaserColor(); + LaserColor = -1; + NPC.netUpdate = true; } // Laser rate of fire @@ -304,7 +322,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } Color telegraphColor = Color.Transparent; - switch (calamityGlobalNPC.destroyerLaserColor) + switch (LaserColor) { case 0: telegraphColor = Color.Red; @@ -379,7 +397,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set projectile damage and type int projectileType = ProjectileID.DeathLaser; - switch (calamityGlobalNPC.destroyerLaserColor) + switch (LaserColor) { default: case 0: @@ -408,15 +426,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) { - calamityGlobalNPC.destroyerLaserColor = -1; - NPC.SyncDestroyerLaserColor(); + LaserColor = -1; + NPC.netUpdate = true; } } if (!death) { - calamityGlobalNPC.destroyerLaserColor = -1; - NPC.SyncDestroyerLaserColor(); + LaserColor = -1; + NPC.netUpdate = true; } } } @@ -515,7 +533,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Telegraph for the laser breath and body lasers float telegraphProgress = 0f; - if (calamityGlobalNPC.destroyerLaserColor != -1) + if (LaserColor != -1) { if (NPC.type == NPCID.TheDestroyerBody) { @@ -523,7 +541,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float telegraphGateValue = shootProjectileTime - LaserTelegraphTime; if (calamityGlobalNPC.newAI[0] > telegraphGateValue) { - switch (calamityGlobalNPC.destroyerLaserColor) + switch (LaserColor) { default: case 0: diff --git a/NPCs/VanillaNPCAIOverrides/VanillaAIOverride.cs b/NPCs/VanillaNPCAIOverrides/VanillaAIOverride.cs index 6b43999d7f..a26c0a6bb0 100644 --- a/NPCs/VanillaNPCAIOverrides/VanillaAIOverride.cs +++ b/NPCs/VanillaNPCAIOverrides/VanillaAIOverride.cs @@ -49,6 +49,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides public virtual bool PreDraw(Mod mod, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) => true; + public virtual void PostDraw(Mod mod, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { } + /// /// This Method should be Implemented If we added our custom field to AI Overrides /// diff --git a/Packets/Entities/VanillaChanges/SyncDestroyerLaserColorPacket.cs b/Packets/Entities/VanillaChanges/SyncDestroyerLaserColorPacket.cs deleted file mode 100644 index f85088c450..0000000000 --- a/Packets/Entities/VanillaChanges/SyncDestroyerLaserColorPacket.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.IO; -using Terraria; - -namespace CalamityMod.Packets -{ - internal sealed class SyncDestroyerLaserColorPacket : CalamityPacket - { - public static SyncDestroyerLaserColorPacket Instance { get; private set; } - - public override byte MessageType => (byte)CalamityModMessageType.SyncDestroyerLaserColor; - - public static void Send(NPC npc, int toClient = -1, int ignoreClient = -1) - { - if (npc is null) - return; - - var packet = Instance.CreateBasePacket(); - packet.WriteWhoAmI(npc); - packet.Write(npc.Calamity().destroyerLaserColor); - packet.Send(toClient, ignoreClient); - } - - public override void HandlePacket(in BinaryReader packet, int sender) - { - var npc = packet.ReadNPC(); - var laserColor = packet.ReadInt32(); - - if (npc is null) - return; - - npc.Calamity().destroyerLaserColor = laserColor; - } - } -} diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index b933fbe9eb..5d5e1b672e 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -345,19 +345,6 @@ namespace CalamityMod { SyncNPCPosAndRotOnlyPacket.Send(npc); } - - /// - /// Syncs . This exists to sync the Destroyer's lasers so that the telegraphs and segment colors display properly. - /// - /// - public static void SyncDestroyerLaserColor(this NPC npc) - { - // Don't bother attempting to send packets in singleplayer. - if (Main.netMode == NetmodeID.SinglePlayer) - return; - - SyncDestroyerLaserColorPacket.Send(npc); - } #endregion #region Smooth Movement From aeec75d881149ba2a687b5d87c149d0f4fa36137 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 16 Dec 2025 01:02:20 -0500 Subject: [PATCH 23/48] Rotten Brain and Amal Brain no longer increase damage --- Items/Accessories/AmalgamatedBrain.cs | 3 --- Items/Accessories/RottenBrain.cs | 1 - Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson | 2 -- 3 files changed, 6 deletions(-) diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index 9a4429e39b..642fcd0085 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -10,9 +10,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; - public static float DamageBoost = 0.05f; public static int NimbusDamage => CalamityUtils.ScaleWithDifficulty(18); - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent()); public override void SetDefaults() { @@ -30,7 +28,6 @@ namespace CalamityMod.Items.Accessories modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit modPlayer.aBrain = true; player.brainOfConfusionItem = Item; - player.GetDamage() += DamageBoost; } public override void AddRecipes() diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index 0096be660d..a7524744d6 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.rBrain = true; - player.GetDamage() += 0.05f; } public override void AddRecipes() diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index b61a8f2699..6fde1df8e4 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -88,7 +88,6 @@ AmalgamatedBrain: { DisplayName: Amalgamated Brain Tooltip: ''' - {0}% increased damage Taking damage confuses nearby enemies and spawns a dank creeper The dank creeper flies above you, exploding into several shaderain clouds Grants the ability to dodge attacks @@ -1487,7 +1486,6 @@ RottenBrain: { DisplayName: Rotten Brain Tooltip: ''' - 5% increased damage Taking damage spawns a dank creeper The dank creeper flies above you, exploding into several shaderain clouds ''' From 38e72ac17a5b87900ae01258969a6a44b8ab9047 Mon Sep 17 00:00:00 2001 From: doze-zoze Date: Tue, 16 Dec 2025 00:17:55 -0600 Subject: [PATCH 24/48] rotten brain line nerf shade was doing insane contribution for amalgamated brain so a heavy nerf was in order. also a fix for chaos stone if the player has 0 max mana (in case of another mod doing that) --- Projectiles/Typeless/ShadeNimbusSpawner.cs | 2 +- UI/ResourceSets/CalamityResourceOverlay.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Projectiles/Typeless/ShadeNimbusSpawner.cs b/Projectiles/Typeless/ShadeNimbusSpawner.cs index 3f8221445f..a1fd3ff705 100644 --- a/Projectiles/Typeless/ShadeNimbusSpawner.cs +++ b/Projectiles/Typeless/ShadeNimbusSpawner.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Typeless // Number of clouds and their damage scale based on what accessory in the upgrade path triggered it (damage is set when the spawner is created) if (Main.myPlayer == Projectile.owner) { - int cloudAmt = EffectStrength == 3f ? 11 : EffectStrength == 2f ? 7 : 5; + int cloudAmt = EffectStrength == 3f ? 5 : EffectStrength == 2f ? 3 : 2; for (int c = -(cloudAmt - 1) / 2; c <= (cloudAmt - 1) / 2; c++) { Vector2 cloudVelocity = c == 0 ? Vector2.Zero : Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 72f) * Main.rand.NextFloat(3f, 9.5f); diff --git a/UI/ResourceSets/CalamityResourceOverlay.cs b/UI/ResourceSets/CalamityResourceOverlay.cs index e970458711..0021e85bf0 100644 --- a/UI/ResourceSets/CalamityResourceOverlay.cs +++ b/UI/ResourceSets/CalamityResourceOverlay.cs @@ -238,6 +238,8 @@ namespace CalamityMod.UI.ResourceSets // This works by dynamically creating a texture that it then draws over the life bar. int width = 12 * stars; + if (width < 1) + width = 1; GraphicsDevice _graphicsDevice = Main.graphics.GraphicsDevice; var barOverlay = new Texture2D(_graphicsDevice, width, 12); Color[] barTextureData = new Color[12*12]; From a0e7afb97cca7f646b09c7b7c2e09873d06c2c8d Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <142704082+CongratsIsTrash@users.noreply.github.com> Date: Tue, 16 Dec 2025 16:30:35 -0500 Subject: [PATCH 25/48] Igneous Exaltation no longer uses Seashine Hilt --- Items/Weapons/Summon/IgneousExaltation.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 22d23a44fc..2523a46969 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -140,7 +140,6 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(). AddIngredient(10). AddIngredient(5). AddTile(TileID.MythrilAnvil). From 511f2179bbf2cb89312ee1e99e3421f3cce6cd54 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 8 Dec 2025 02:21:57 +0900 Subject: [PATCH 26/48] Remove LightingUtils --- Waters/BasaltGullyWater.cs | 6 +++--- Waters/MiddleAbyssWater.cs | 4 ++-- Waters/SulphuricDepthsWater.cs | 4 ++-- Waters/SulphuricWater.cs | 4 ++-- Waters/SunkenSeaBurrowsWater.cs | 2 +- Waters/SunkenSeaPolypWater.cs | 2 +- Waters/SunkenSeaReefsWater.cs | 2 +- Waters/SunkenSeaShoresWater.cs | 2 +- Waters/UpperAbyssWater.cs | 4 ++-- Waters/VoidWater.cs | 4 ++-- Utilities/LightingUtils.cs => Waters/WaterStyleCommon.cs | 9 +++++++-- 11 files changed, 24 insertions(+), 19 deletions(-) rename Utilities/LightingUtils.cs => Waters/WaterStyleCommon.cs (91%) diff --git a/Waters/BasaltGullyWater.cs b/Waters/BasaltGullyWater.cs index 825caaac77..9b0b2c97af 100644 --- a/Waters/BasaltGullyWater.cs +++ b/Waters/BasaltGullyWater.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Waters { public class BasaltGullyWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, false); } public class BasaltGullyWater : ModWaterStyle, IWaterStyleModifyColor, IWaterStyleModifyLight @@ -30,7 +30,7 @@ namespace CalamityMod.Waters if (tile.TileType != RustyChestTile.TileType) { - CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + WaterStyleCommon.ModifySunkenSeaWaterLight(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } r = outputColor.X; @@ -38,7 +38,7 @@ namespace CalamityMod.Waters b = outputColor.Z; } - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, isSlope); public override int ChooseWaterfallStyle() => ModContent.Find("CalamityMod/BasaltGullyWaterflow").Slot; public override int GetSplashDust() => ModContent.DustType(); diff --git a/Waters/MiddleAbyssWater.cs b/Waters/MiddleAbyssWater.cs index a31adb55e0..d891c79074 100644 --- a/Waters/MiddleAbyssWater.cs +++ b/Waters/MiddleAbyssWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters { public class MiddleAbyssWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, false); } public class MiddleAbyssWater : ModWaterStyle, IWaterStyleModifyColor @@ -41,6 +41,6 @@ namespace CalamityMod.Waters public override int GetDropletGore() => DropletGore; public override Color BiomeHairColor() => new Color(36, 23, 19); - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, isSlope); } } diff --git a/Waters/SulphuricDepthsWater.cs b/Waters/SulphuricDepthsWater.cs index e506d10cdb..60249e4fe5 100644 --- a/Waters/SulphuricDepthsWater.cs +++ b/Waters/SulphuricDepthsWater.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Waters { public class SulphuricDepthsWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, false); } public class SulphuricDepthsWater : ModWaterStyle, IWaterStyleModifyColor, IWaterStyleModifyLight @@ -44,7 +44,7 @@ namespace CalamityMod.Waters public override int GetSplashDust() => SplashDust; public override int GetDropletGore() => DropletGore; public override Color BiomeHairColor() => new Color(35, 117, 89); - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, isSlope); public void ModifyLight(in Tile tile, int i, int j, ref float r, ref float g, ref float b) { Vector3 outputColor = new Vector3(r, g, b); diff --git a/Waters/SulphuricWater.cs b/Waters/SulphuricWater.cs index 36228647f6..267115e3f5 100644 --- a/Waters/SulphuricWater.cs +++ b/Waters/SulphuricWater.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Waters { public class SulphuricWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifySulphuricWaterColor(x, y, ref liquidColor, false); } public class SulphuricWater : ModWaterStyle, IWaterStyleModifyColor, IWaterStyleModifyLight, IWaterStylePostDrawEffect @@ -50,7 +50,7 @@ namespace CalamityMod.Waters public override byte GetRainVariant() => (byte)Main.rand.Next(3); public override Color BiomeHairColor() => new Color(43, 168, 110); - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); public void ModifyLight(in Tile tile, int i, int j, ref float r, ref float g, ref float b) { Vector3 outputColor = new Vector3(r, g, b); diff --git a/Waters/SunkenSeaBurrowsWater.cs b/Waters/SunkenSeaBurrowsWater.cs index 23fa8b8098..c64a56a0f4 100644 --- a/Waters/SunkenSeaBurrowsWater.cs +++ b/Waters/SunkenSeaBurrowsWater.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Waters if (tile.TileType != RustyChestTile.TileType) { - CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + WaterStyleCommon.ModifySunkenSeaWaterLight(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } r = outputColor.X; diff --git a/Waters/SunkenSeaPolypWater.cs b/Waters/SunkenSeaPolypWater.cs index 58888e60c3..104529fcd0 100644 --- a/Waters/SunkenSeaPolypWater.cs +++ b/Waters/SunkenSeaPolypWater.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Waters if (tile.TileType != RustyChestTile.TileType) { - CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + WaterStyleCommon.ModifySunkenSeaWaterLight(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } r = outputColor.X; diff --git a/Waters/SunkenSeaReefsWater.cs b/Waters/SunkenSeaReefsWater.cs index 984d526377..229f30f3d8 100644 --- a/Waters/SunkenSeaReefsWater.cs +++ b/Waters/SunkenSeaReefsWater.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Waters if (tile.TileType != RustyChestTile.TileType) { - CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + WaterStyleCommon.ModifySunkenSeaWaterLight(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } r = outputColor.X; diff --git a/Waters/SunkenSeaShoresWater.cs b/Waters/SunkenSeaShoresWater.cs index 7ac2747c99..2b8fcefc43 100644 --- a/Waters/SunkenSeaShoresWater.cs +++ b/Waters/SunkenSeaShoresWater.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Waters if (tile.TileType != RustyChestTile.TileType) { - CalamityUtils.SunkenSeaWaterLighting(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); + WaterStyleCommon.ModifySunkenSeaWaterLight(i, j, WaterGlowColor, ref outputColor.X, ref outputColor.Y, ref outputColor.Z); } r = outputColor.X; diff --git a/Waters/UpperAbyssWater.cs b/Waters/UpperAbyssWater.cs index 0ec0088064..8946a23609 100644 --- a/Waters/UpperAbyssWater.cs +++ b/Waters/UpperAbyssWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters { public class UpperAbyssWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, false); } public class UpperAbyssWater : ModWaterStyle, IWaterStyleModifyColor @@ -40,6 +40,6 @@ namespace CalamityMod.Waters public override int GetSplashDust() => SplashDust; public override int GetDropletGore() => DropletGore; public override Color BiomeHairColor() => new Color(9, 69, 82); - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, isSlope); } } diff --git a/Waters/VoidWater.cs b/Waters/VoidWater.cs index 36f62e2f54..b18e5f5c4b 100644 --- a/Waters/VoidWater.cs +++ b/Waters/VoidWater.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Waters { public class VoidWaterflow : ModWaterfallStyle, IWaterfallStyleModifyColor { - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, false); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, false); } public class VoidWater : ModWaterStyle, IWaterStyleModifyColor @@ -40,6 +40,6 @@ namespace CalamityMod.Waters public override int GetSplashDust() => SplashDust; public override int GetDropletGore() => DropletGore; public override Color BiomeHairColor() => new Color(16, 8, 30); - public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => CalamityUtils.ModifySulphuricWaterColor(x, y, ref liquidColor, isSlope); + public void ModifyColor(in Tile tile, int x, int y, ref VertexColors liquidColor, bool isSlope) => WaterStyleCommon.ModifyTransparentWaterColor(x, y, ref liquidColor, isSlope); } } diff --git a/Utilities/LightingUtils.cs b/Waters/WaterStyleCommon.cs similarity index 91% rename from Utilities/LightingUtils.cs rename to Waters/WaterStyleCommon.cs index aa1bd268e0..d0f8cebe45 100644 --- a/Utilities/LightingUtils.cs +++ b/Waters/WaterStyleCommon.cs @@ -7,7 +7,7 @@ using Terraria.Graphics; namespace CalamityMod { - public static partial class CalamityUtils + internal static class WaterStyleCommon { public static void ModifySulphuricWaterColor(int x, int y, ref VertexColors initialColor, bool isSlope) { @@ -32,6 +32,11 @@ namespace CalamityMod ModifyColor(new(x + 0.5f, y + 0.5f), ref initialColor.BottomRightColor); } + ModifyTransparentWaterColor(x, y, ref initialColor, isSlope); + } + + public static void ModifyTransparentWaterColor(int x, int y, ref VertexColors initialColor, bool isSlope) + { if (isSlope) { initialColor.TopLeftColor *= 1f / 3; @@ -48,7 +53,7 @@ namespace CalamityMod } } - public static void SunkenSeaWaterLighting(int x, int y, Vector3 waterColor, ref float r, ref float g, ref float b) + public static void ModifySunkenSeaWaterLight(int x, int y, Vector3 waterColor, ref float r, ref float g, ref float b) { float tick = (float)Main.timeForVisualEffects; float brightness = MathHelper.Clamp(0.07f, 0f, 0.07f); From 3ded57b85ab6d08e7db5665dd0c4875387ff921c Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 8 Dec 2025 02:31:23 +0900 Subject: [PATCH 27/48] Remove GlobalEntityUtils --- NPCs/CalamityDrawParameterNPC.cs | 4 +-- Utilities/GlobalEntityUtils.cs | 43 -------------------------------- 2 files changed, 2 insertions(+), 45 deletions(-) delete mode 100644 Utilities/GlobalEntityUtils.cs diff --git a/NPCs/CalamityDrawParameterNPC.cs b/NPCs/CalamityDrawParameterNPC.cs index 72699e2f97..91fd106261 100644 --- a/NPCs/CalamityDrawParameterNPC.cs +++ b/NPCs/CalamityDrawParameterNPC.cs @@ -109,7 +109,7 @@ namespace CalamityMod.NPCs return false; // Safety check for weird MP bug when getting global npcs. - if (!npc.TryGetGlobalNPCSafer(out var calNPC) || !npc.TryGetGlobalNPCSafer(out var polNPC)) + if (!npc.TryGetGlobalNPC(out var calNPC) || !npc.TryGetGlobalNPC(out var polNPC)) return false; // Do not draw if the npc does not have miracle blight, or has the polarity effect. @@ -131,7 +131,7 @@ namespace CalamityMod.NPCs return false; // Safety check for weird MP bug when getting global npcs. - if (!npc.TryGetGlobalNPCSafer(out var calNPC) || !npc.TryGetGlobalNPCSafer(out var polNPC)) + if (!npc.TryGetGlobalNPC(out var calNPC) || !npc.TryGetGlobalNPC(out var polNPC)) return false; // I don't know who would be using this while also inflicting miracle blight, but in that rare case, do not draw these. diff --git a/Utilities/GlobalEntityUtils.cs b/Utilities/GlobalEntityUtils.cs deleted file mode 100644 index 18d57efa44..0000000000 --- a/Utilities/GlobalEntityUtils.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Terraria.ModLoader; -using Terraria; - -namespace CalamityMod -{ - public static partial class CalamityUtils - { - /// - /// Actual "Thread-Safe" version of TryGetGlobalNPC - /// - /// GlobalNPC type to get - /// Input NPC - /// GlobalNPC output - /// true If we successfully get GlobalNPC. otherwise false - public static bool TryGetGlobalNPCSafer(this NPC npc, out T globalNPC) where T : GlobalNPC - { - try - { - if (npc is null) - { - globalNPC = null; - return false; - } - - int slot = ModContent.GetInstance()?.PerEntityIndex ?? -1; - int length = npc.EntityGlobals.Length; - if (slot < 0 || slot >= length) - { - globalNPC = null; - return false; - } - - npc.TryGetGlobalNPC(out globalNPC); - return globalNPC != null; - } - catch - { - globalNPC = null; - return false; - } - } - } -} From 0acb1f71d7cf76ef21d7fc18db05f1a6cb3462a8 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 8 Dec 2025 02:31:34 +0900 Subject: [PATCH 28/48] Remove ILEditingUtils --- Utilities/ILEditingUtils.cs | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 Utilities/ILEditingUtils.cs diff --git a/Utilities/ILEditingUtils.cs b/Utilities/ILEditingUtils.cs deleted file mode 100644 index bd0cfa0557..0000000000 --- a/Utilities/ILEditingUtils.cs +++ /dev/null @@ -1,17 +0,0 @@ -using MonoMod.Cil; - -namespace CalamityMod -{ - public static partial class CalamityUtils - { - /// - /// Moves an to the final Ret call in the method the cursor is assocated with. - /// - /// The cursor. - public static ILCursor GotoFinalRet(this ILCursor cursor) - { - while (cursor.TryGotoNext(c => c.MatchRet())) { } - return cursor; - } - } -} From c65b6e9ce956b137ea2064d1ccf0b62a7fe17f90 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 8 Dec 2025 02:34:27 +0900 Subject: [PATCH 29/48] Remove few util methods --- Utilities/GeneralExtensionUtils.cs | 1 - Utilities/StringUtils.cs | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/Utilities/GeneralExtensionUtils.cs b/Utilities/GeneralExtensionUtils.cs index e362fa0f54..412bbb784a 100644 --- a/Utilities/GeneralExtensionUtils.cs +++ b/Utilities/GeneralExtensionUtils.cs @@ -11,7 +11,6 @@ namespace CalamityMod { public static CalamityPlayer Calamity(this Player player) => player.GetModPlayer(); public static CalamityGlobalNPC Calamity(this NPC npc) => npc.GetGlobalNPC(); - public static CalamityVanillaAIOverrideNPC AIOverrideNPC(this NPC npc) => npc.GetGlobalNPC(); public static CalamityTileCollisionHarmNPC FlungNPC(this NPC npc) => npc.GetGlobalNPC(); public static CalamityPolarityNPC PolarityNPC(this NPC npc) => npc.GetGlobalNPC(); public static CalamityGlobalItem Calamity(this Item item) => item.GetGlobalItem(); diff --git a/Utilities/StringUtils.cs b/Utilities/StringUtils.cs index 503a80cc3d..7e3f553a1f 100644 --- a/Utilities/StringUtils.cs +++ b/Utilities/StringUtils.cs @@ -1,6 +1,4 @@ using System.Linq; -using System.Text; -using Microsoft.Xna.Framework; using Terraria; namespace CalamityMod @@ -9,19 +7,5 @@ namespace CalamityMod { internal static readonly string AlphanumericCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; public static string GenerateRandomAlphanumericString(int length) => new string(Enumerable.Repeat(AlphanumericCharacters, length).Select(s => s[Main.rand.Next(s.Length)]).ToArray()); - - public static string ColorMessage(this Color color, string text, bool newline = false) - { - int bufferSize = text.Length < 200 ? 256 : text.Length + 32; - StringBuilder sb = new(bufferSize); - sb.Append("[c/"); - sb.Append(color.Hex3()); - sb.Append(':'); - sb.Append(text); - sb.Append(']'); - if (newline) - sb.Append('\n'); - return sb.ToString(); - } } } From c98700aa2dc0bff034f264f0de43c542abee35f6 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 8 Dec 2025 03:08:23 +0900 Subject: [PATCH 30/48] Decoupled Reforge Rework --- Items/CalamityGlobalItem.cs | 77 +--------- Prefixes/ReforgeChange.cs | 296 ++++++++++++++++++++++++++++++++++++ Utilities/ItemUtils.cs | 217 -------------------------- 3 files changed, 303 insertions(+), 287 deletions(-) create mode 100644 Prefixes/ReforgeChange.cs diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 6e1684d282..a91ebf319d 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -24,7 +24,6 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Other; using CalamityMod.NPCs.TownNPCs; -using CalamityMod.Packets; using CalamityMod.Particles; using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Magic; @@ -36,7 +35,6 @@ using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -46,7 +44,6 @@ using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; -using Terraria.Utilities; using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items @@ -1613,73 +1610,6 @@ namespace CalamityMod.Items } #endregion - #region Reforge Mechanic Rework - private static int storedPrefix = -1; - public override void PreReforge(Item item) - { - StealthStrikePrefixBonus = 0f; - storedPrefix = item.prefix; - } - - // Ozzatron 31AUG2022: total rework to the reforge rework for mod compatibility - // you can now disable the rework with config in case it isn't enough to solve your conflicts - // removed data saved on items; reforging is now a coalescing flowchart that has no RNG - public override int ChoosePrefix(Item item, UnifiedRandom rand) - { - if (storedPrefix == -1 && item.CountsAsClass() && (item.maxStack == 1 || item.AllowReforgeForStackableItem)) - { - // Crafting (or first reforge of) a rogue weapon has a 75% chance for a random modifier, this check is done by vanilla - // Negative modifiers have a 66.66% chance of being voided, Annoying modifier is intentionally ignored by vanilla - int prefix = CalamityUtils.RandomRoguePrefix(); - bool keepPrefix = !CalamityUtils.NegativeRoguePrefix(prefix) || Main.rand.NextBool(3); - return keepPrefix ? prefix : 0; - } - - if (Main.gameMenu) - return -1; - - if (item.accessory) - { - return CalamityUtils.GetAccessoryReforge(item, rand, storedPrefix); - } - else - { - if (CalamityServerConfig.Instance.RemoveReforgeRNG && storedPrefix != -1) - { - return CalamityUtils.GetReworkedReforge(item, rand, storedPrefix); - } - } - - return -1; - } - - public override void PostReforge(Item item) - { - storedPrefix = -1; - // Bandit steals 20% of the total price of the reforge if she's around. - if (NPC.AnyNPCs(NPCType())) - { - // Calculate the item's reforge cost. - int value = item.value; - Player p = Main.LocalPlayer; - ItemLoader.ReforgePrice(item, ref value, ref p.discountAvailable); - - // Steal 20% of that money. - int stolen = value / 5; - CalamityWorld.MoneyStolenByBandit += stolen; - - // Increment the reforge counter to allow the Bandit to refund - // Also triggers Tinkerer dialogue that hints to the player that money is being stolen - CalamityWorld.Reforges++; - - if (Main.netMode == NetmodeID.MultiplayerClient) - { - BanditStolenMoneySyncPacket.Send(stolen); - } - } - } - #endregion - #region Rarity Price Table // Base numeric rarity pricing guide. private static readonly int Rarity0BuyPrice = Item.buyPrice(0, 0, 50, 0); @@ -1744,6 +1674,13 @@ namespace CalamityMod.Items public static int RarityCalamityRedBuyPrice => Rarity17BuyPrice; #endregion + #region PreReforge + public override void PreReforge(Item item) + { + StealthStrikePrefixBonus = 0f; + } + #endregion + // // !! WARNING !! // diff --git a/Prefixes/ReforgeChange.cs b/Prefixes/ReforgeChange.cs new file mode 100644 index 0000000000..6a56d6f0a1 --- /dev/null +++ b/Prefixes/ReforgeChange.cs @@ -0,0 +1,296 @@ +using System.Collections.Generic; +using System.Linq; +using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Packets; +using CalamityMod.World; +using Terraria; +using Terraria.GameContent.Prefixes; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; + +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Prefixes +{ + public sealed class ReforgeChange : GlobalItem + { + public override bool InstancePerEntity => false; + + // Ozzatron 31AUG2022: total rework to the reforge rework for mod compatibility + // you can now disable the rework with config in case it isn't enough to solve your conflicts + // removed data saved on items; reforging is now a coalescing flowchart that has no RNG + public override int ChoosePrefix(Item item, UnifiedRandom rand) + { + int storedPrefix = item.prefix; + if (storedPrefix == -1 && item.CountsAsClass() && (item.maxStack == 1 || item.AllowReforgeForStackableItem)) + { + // Crafting (or first reforge of) a rogue weapon has a 75% chance for a random modifier, this check is done by vanilla + // Negative modifiers have a 66.66% chance of being voided, Annoying modifier is intentionally ignored by vanilla + int prefix = CalamityUtils.RandomRoguePrefix(); + bool keepPrefix = !CalamityUtils.NegativeRoguePrefix(prefix) || Main.rand.NextBool(3); + return keepPrefix ? prefix : 0; + } + + if (Main.gameMenu) + return -1; + + if (item.accessory && CalamityServerConfig.Instance.SimplifyAccessoryReforge) + { + return GetSimplifiedAccessoryReforge(item, rand, storedPrefix); + } + else if (storedPrefix != -1 && CalamityServerConfig.Instance.RemoveReforgeRNG) + { + return GetReworkedReforge(item, rand, storedPrefix); + } + + return -1; + } + + public override void PostReforge(Item item) + { + // Bandit steals 20% of the total price of the reforge if she's around. + if (NPC.AnyNPCs(NPCType())) + { + // Calculate the item's reforge cost. + int value = item.value; + Player p = Main.LocalPlayer; + ItemLoader.ReforgePrice(item, ref value, ref p.discountAvailable); + + // Steal 20% of that money. + int stolen = value / 5; + CalamityWorld.MoneyStolenByBandit += stolen; + + // Increment the reforge counter to allow the Bandit to refund + // Also triggers Tinkerer dialogue that hints to the player that money is being stolen + CalamityWorld.Reforges++; + + if (Main.netMode == NetmodeID.MultiplayerClient) + { + BanditStolenMoneySyncPacket.Send(stolen); + } + } + } + + #region Prefix Tier Definition + public static int[][] AccessoryPrefixTiers = + [ + /* 0 */ [PrefixID.Hard, PrefixID.Jagged, PrefixID.Brisk, PrefixID.Wild], + /* 1 */ [PrefixID.Guarding, PrefixID.Spiked, PrefixID.Precise, PrefixID.Fleeting, PrefixID.Rash], + /* 2 */ [PrefixID.Armored, PrefixID.Angry, PrefixID.Hasty2, PrefixID.Intrepid, PrefixID.Arcane], + /* 3 */ [PrefixID.Warding, PrefixID.Menacing, PrefixID.Lucky, PrefixID.Quick2, PrefixID.Violent, PrefixType(), PrefixType(), PrefixType()], + ]; + + public static int[][] TerrarianPrefixTiers = + [ + /* 0 */ [PrefixID.Keen, PrefixID.Forceful, PrefixID.Strong], + /* 1 */ [PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous], + /* 2 */ [PrefixID.Superior, PrefixID.Demonic, PrefixID.Godly], + /* 3 */ [PrefixID.Legendary2], + ]; + + public static int[][] MeleePrefixTiers = + [ + /* 0 */ [PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Light, PrefixID.Heavy, PrefixID.Light, PrefixID.Forceful, PrefixID.Strong], + /* 1 */ [PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Pointy, PrefixID.Bulky], + /* 2 */ [PrefixID.Murderous, PrefixID.Agile, PrefixID.Large, PrefixID.Dangerous, PrefixID.Sharp], + /* 3 */ [PrefixID.Massive, PrefixID.Unpleasant, PrefixID.Savage, PrefixID.Superior], + /* 4 */ [PrefixID.Demonic, PrefixID.Deadly2, PrefixID.Godly], + /* 5 */ [PrefixID.Legendary] // for non-tools, Light is a mediocre low-tier reforge + ]; + + public static int[][] MeleeNoSpeedPrefixTiers = + [ + /* 0 */ [PrefixID.Keen, PrefixID.Forceful, PrefixID.Strong], + /* 1 */ [PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous], + /* 2 */ [PrefixID.Superior, PrefixID.Demonic], + /* 3 */ [PrefixID.Godly] + ]; + + // 14MAR2025: Ozzatron: Add support for allowing Ruthless over Godly if the player has more than 100% crit chance of the appropriate class + public static int[][] MeleeNoSpeedAlwaysCritPrefixTiers = + [ + /* 0 */ [PrefixID.Keen, PrefixID.Forceful, PrefixID.Strong], + /* 1 */ [PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous], + /* 2 */ [PrefixID.Superior, PrefixID.Demonic], + /* 3 */ [PrefixID.Godly, PrefixID.Ruthless] + ]; + + public static int[][] ToolPrefixTiers = + [ + /* 0 */ [PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Heavy, PrefixID.Forceful, PrefixID.Strong], + /* 1 */ [PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Pointy, PrefixID.Bulky], + /* 2 */ [PrefixID.Murderous, PrefixID.Agile, PrefixID.Large, PrefixID.Dangerous, PrefixID.Sharp], + /* 3 */ [PrefixID.Massive, PrefixID.Unpleasant, PrefixID.Savage, PrefixID.Superior], + /* 4 */ [PrefixID.Demonic, PrefixID.Deadly2, PrefixID.Godly], + /* 5 */ [PrefixID.Legendary, PrefixID.Light] // for some tools, light is better than legendary. for others, it's equal + ]; + + public static int[][] RangedPrefixTiers = + [ + /* 0 */ [PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Powerful, PrefixID.Forceful, PrefixID.Strong], + /* 1 */ [PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Intimidating], + /* 2 */ [PrefixID.Murderous, PrefixID.Agile, PrefixID.Hasty, PrefixID.Staunch, PrefixID.Unpleasant], + /* 3 */ [PrefixID.Superior, PrefixID.Demonic, PrefixID.Sighted], + /* 4 */ [PrefixID.Godly, PrefixID.Rapid, /* ranged Deadly */ PrefixID.Deadly, /* universal Deadly */ PrefixID.Deadly2], + /* 5 */ [PrefixID.Unreal] + ]; + + public static int[][] MagicPrefixTiers = + [ + /* 0 */ [PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Furious, PrefixID.Forceful, PrefixID.Strong], + /* 1 */ [PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Taboo, PrefixID.Manic], + /* 2 */ [PrefixID.Murderous, PrefixID.Agile, PrefixID.Adept, PrefixID.Celestial, PrefixID.Unpleasant], + /* 3 */ [PrefixID.Superior, PrefixID.Demonic, PrefixID.Mystic], + /* 4 */ [PrefixID.Godly, PrefixID.Masterful, PrefixID.Deadly2], + /* 5 */ [PrefixID.Mythical] + ]; + + public static int[][] SummonPrefixTiers = + [ + /* 0 */ [PrefixID.Nimble, PrefixID.Furious], + /* 1 */ [PrefixID.Forceful, PrefixID.Strong, PrefixID.Quick, PrefixID.Taboo, PrefixID.Manic], + /* 2 */ [PrefixID.Hurtful, PrefixID.Adept, PrefixID.Celestial], + /* 3 */ [PrefixID.Superior, PrefixID.Demonic, PrefixID.Mystic, PrefixID.Deadly2], + /* 4 */ [PrefixID.Masterful, PrefixID.Godly], + /* 5 */ [PrefixID.Mythical, PrefixID.Ruthless] // you may want mythical early game for the knockback. + ]; + + // Added appropriate universal reforges to rogue, so they don't ONLY get modded prefixes. + public static int[][] RoguePrefixTiers = + [ + /* 0 */ [PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Forceful, PrefixID.Strong, PrefixType(), PrefixType()], + /* 1 */ [PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixType(), PrefixType()], + /* 2 */ [PrefixID.Murderous, PrefixID.Agile, PrefixID.Unpleasant, PrefixType(), PrefixType(), PrefixType()], + /* 3 */ [PrefixID.Superior, PrefixID.Demonic, PrefixType(), PrefixType()], + /* 4 */ [PrefixID.Godly, PrefixID.Deadly2, PrefixType(), PrefixType()], + /* 5 */ [PrefixType()] + ]; + #endregion + + #region Reworked Reforge + internal static int GetReworkedReforge(Item item, UnifiedRandom rand, int currentPrefix) + { + // This is the hardcoded value to "do nothing", and is thus the default choice. + int prefix = -1; + bool supportsLegendary = PrefixLegacy.ItemSets.SwordsHammersAxesPicks[item.type] || (item.ModItem != null && item.ModItem.MeleePrefix()); + + // ACCESSORIES + if (item.accessory) + { + int accRerolls = 0; + // Try to prevent the player from rolling the same modifier twice + do + { + int newPrefix = IteratePrefix(rand, AccessoryPrefixTiers, currentPrefix); + if (newPrefix != currentPrefix) + { + prefix = newPrefix; + break; + } + accRerolls++; + } while (accRerolls < 20); + } + + // MELEE (includes tools and whips) + // Melee-ranged hybrid weapons prioritize Legendary if available, otherwise go for Unreal + else if ((item.CountsAsClass() || item.CountsAsClass()) && !(item.CountsAsClass() && !supportsLegendary)) + { + // Terrarian (has its own special "Legendary" for marketing reasons) + // Other items that want to use Legendary2 are also compatible + if (PrefixLegacy.ItemSets.ItemsThatCanHaveLegendary2[item.type]) + { + prefix = IteratePrefix(rand, TerrarianPrefixTiers, currentPrefix); + } + + // Swords, Whips, Tools, other items that support the Legendary modifier + else if (supportsLegendary) + { + var tierListToUse = (item.pick > 0 || item.axe > 0 || item.hammer > 0) ? ToolPrefixTiers : MeleePrefixTiers; + prefix = IteratePrefix(rand, tierListToUse, currentPrefix); + } + + // Yoyos, Flails, Spears, etc. + // Spears actually work fine with Legendary, but vanilla doesn't give it to them, so we won't either. + else + { + bool has100Crit = Main.LocalPlayer.GetTotalCritChance(item.DamageType) >= 100; + prefix = IteratePrefix(rand, has100Crit ? MeleeNoSpeedAlwaysCritPrefixTiers : MeleeNoSpeedPrefixTiers, currentPrefix); + } + } + + // RANGED + else if (item.CountsAsClass()) + { + prefix = IteratePrefix(rand, RangedPrefixTiers, currentPrefix); + } + + // MAGIC + else if (item.CountsAsClass() || item.CountsAsClass()) + { + prefix = IteratePrefix(rand, MagicPrefixTiers, currentPrefix); + } + + // SUMMON (not whips) + else if (item.CountsAsClass()) + { + prefix = IteratePrefix(rand, SummonPrefixTiers, currentPrefix); + } + + // ROGUE (Calamity adds these reforges to all 1.4 TML throwing items) + else if (item.CountsAsClass()) + { + prefix = IteratePrefix(rand, RoguePrefixTiers, currentPrefix); + } + + return prefix; + } + + private static int GetPrefixTier(int[][] tiers, int currentPrefix) + { + for (int checkingTier = 0; checkingTier < tiers.Length; ++checkingTier) + { + int[] tierList = tiers[checkingTier]; + for (int i = 0; i < tierList.Length; ++i) + if (tierList[i] == currentPrefix) + return checkingTier; + } + + // If an invalid or modded prefix is detected, return -1. + // This will give a random tier 0 prefix (the "next tier"), starting fresh with a low-tier vanilla or Calamity prefix. + return -1; + } + + private static int IteratePrefix(UnifiedRandom rand, int[][] reforgeTiers, int currentPrefix) + { + int currentTier = GetPrefixTier(reforgeTiers, currentPrefix); + + // If max tier: give max tier reforges forever + // Otherwise: go up by 1 tier with every reforge, guaranteed + int newTier = currentTier == reforgeTiers.Length - 1 ? currentTier : currentTier + 1; + return rand.Next(reforgeTiers[newTier]); + } + #endregion + + #region Simplified Accessory Reforge + internal static int GetSimplifiedAccessoryReforge(Item item, UnifiedRandom rand, int currentPrefix) + { + var pool = new HashSet() + { + PrefixID.Warding, + PrefixID.Menacing, + PrefixID.Lucky, + PrefixID.Quick2, + PrefixID.Violent, + PrefixID.Arcane, + PrefixType(), + PrefixType(), + PrefixType() + }; + + pool.Remove(currentPrefix); + return pool.ElementAt(rand.Next(0, pool.Count)); + } + #endregion + } +} diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index bb08ebe275..5cf69ae0cc 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -4,15 +4,12 @@ using System.Linq; using System.Text; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.DataStructures; -using CalamityMod.Prefixes; using CalamityMod.UI.CalamitasEnchants; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.GameContent.Prefixes; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Utilities; namespace CalamityMod { @@ -44,220 +41,6 @@ namespace CalamityMod internal static readonly Color DonatorItemColor = new Color(255, 121, 156); #endregion - #region Reforging Algorithm - internal static int GetAccessoryReforge(Item item, UnifiedRandom rand, int currentPrefix) - { - if (CalamityServerConfig.Instance.SimplifyAccessoryReforge) - { - var pool = new HashSet() - { - PrefixID.Warding, - PrefixID.Menacing, - PrefixID.Lucky, - PrefixID.Quick2, - PrefixID.Violent, - PrefixID.Arcane, - ModContent.PrefixType(), - ModContent.PrefixType(), - ModContent.PrefixType() - }; - - pool.Remove(currentPrefix); - return pool.ElementAt(rand.Next(0, pool.Count)); - } - return -1; // Do Nothing if Config is off - } - - internal static int GetReworkedReforge(Item item, UnifiedRandom rand, int currentPrefix) - { - CalamityMod mod = CalamityMod.Instance; - int GetCalPrefix(string name) - { - bool found = mod.TryFind(name, out ModPrefix ret); - return found ? ret.Type : 0; - } - - // This is the hardcoded value to "do nothing", and is thus the default choice. - int prefix = -1; - bool supportsLegendary = PrefixLegacy.ItemSets.SwordsHammersAxesPicks[item.type] || (item.ModItem != null && item.ModItem.MeleePrefix()); - - // ACCESSORIES - if (item.accessory) - { - int accRerolls = 0; - int[][] accessoryReforgeTiers = new int[][] - { - /* 0 */ new int[] { PrefixID.Hard, PrefixID.Jagged, PrefixID.Brisk, PrefixID.Wild }, - /* 1 */ new int[] { PrefixID.Guarding, PrefixID.Spiked, PrefixID.Precise, PrefixID.Fleeting, PrefixID.Rash }, - /* 2 */ new int[] { PrefixID.Armored, PrefixID.Angry, PrefixID.Hasty2, PrefixID.Intrepid, PrefixID.Arcane }, - /* 3 */ new int[] { PrefixID.Warding, PrefixID.Menacing, PrefixID.Lucky, PrefixID.Quick2, PrefixID.Violent, GetCalPrefix("Silent") }, - }; - - // Try to prevent the player from rolling the same modifier twice - do - { - int newPrefix = IteratePrefix(rand, accessoryReforgeTiers, currentPrefix); - if (newPrefix != currentPrefix) - { - prefix = newPrefix; - break; - } - accRerolls++; - } while (accRerolls < 20); - } - - // MELEE (includes tools and whips) - // Melee-ranged hybrid weapons prioritize Legendary if available, otherwise go for Unreal - else if ((item.CountsAsClass() || item.CountsAsClass()) && !(item.CountsAsClass() && !supportsLegendary)) - { - // Terrarian (has its own special "Legendary" for marketing reasons) - // Other items that want to use Legendary2 are also compatible - if (PrefixLegacy.ItemSets.ItemsThatCanHaveLegendary2[item.type]) - { - int[][] terrarianReforgeTiers = new int[][] - { - /* 0 */ new int[] { PrefixID.Keen, PrefixID.Forceful, PrefixID.Strong }, - /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous }, - /* 2 */ new int[] { PrefixID.Superior, PrefixID.Demonic, PrefixID.Godly }, - /* 3 */ new int[] { PrefixID.Legendary2 }, - }; - prefix = IteratePrefix(rand, terrarianReforgeTiers, currentPrefix); - } - - // Swords, Whips, Tools, other items that support the Legendary modifier - else if (supportsLegendary) - { - int[][] meleeReforgeTiers = new int[][] - { - /* 0 */ new int[] { PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Light, PrefixID.Heavy, PrefixID.Light, PrefixID.Forceful, PrefixID.Strong }, - /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Pointy, PrefixID.Bulky }, - /* 2 */ new int[] { PrefixID.Murderous, PrefixID.Agile, PrefixID.Large, PrefixID.Dangerous, PrefixID.Sharp }, - /* 3 */ new int[] { PrefixID.Massive, PrefixID.Unpleasant, PrefixID.Savage, PrefixID.Superior }, - /* 4 */ new int[] { PrefixID.Demonic, PrefixID.Deadly2, PrefixID.Godly }, - /* 5 */ new int[] { PrefixID.Legendary } // for non-tools, Light is a mediocre low-tier reforge - }; - int[][] toolReforgeTiers = new int[][] - { - /* 0 */ new int[] { PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Heavy, PrefixID.Forceful, PrefixID.Strong }, - /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Pointy, PrefixID.Bulky }, - /* 2 */ new int[] { PrefixID.Murderous, PrefixID.Agile, PrefixID.Large, PrefixID.Dangerous, PrefixID.Sharp }, - /* 3 */ new int[] { PrefixID.Massive, PrefixID.Unpleasant, PrefixID.Savage, PrefixID.Superior }, - /* 4 */ new int[] { PrefixID.Demonic, PrefixID.Deadly2, PrefixID.Godly }, - /* 5 */ new int[] { PrefixID.Legendary, PrefixID.Light } // for some tools, light is better than legendary. for others, it's equal - }; - - var tierListToUse = (item.pick > 0 || item.axe > 0 || item.hammer > 0) ? toolReforgeTiers : meleeReforgeTiers; - prefix = IteratePrefix(rand, tierListToUse, currentPrefix); - } - - // Yoyos, Flails, Spears, etc. - // Spears actually work fine with Legendary, but vanilla doesn't give it to them, so we won't either. - else - { - // 14MAR2025: Ozzatron: Add support for allowing Ruthless over Godly if the player has more than 100% crit chance of the appropriate class - bool has100Crit = Main.LocalPlayer.GetTotalCritChance(item.DamageType) >= 100; - - int[][] meleeNoSpeedReforgeTiers = new int[][] - { - /* 0 */ new int[] { PrefixID.Keen, PrefixID.Forceful, PrefixID.Strong }, - /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous }, - /* 2 */ new int[] { PrefixID.Superior, PrefixID.Demonic }, - /* 3 */ has100Crit ? new int[] { PrefixID.Godly, PrefixID.Ruthless } : new int[] { PrefixID.Godly } - }; - prefix = IteratePrefix(rand, meleeNoSpeedReforgeTiers, currentPrefix); - } - } - - // RANGED - else if (item.CountsAsClass()) - { - int[][] rangedReforgeTiers = new int[][] - { - /* 0 */ new int[] { PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Powerful, PrefixID.Forceful, PrefixID.Strong }, - /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Intimidating }, - /* 2 */ new int[] { PrefixID.Murderous, PrefixID.Agile, PrefixID.Hasty, PrefixID.Staunch, PrefixID.Unpleasant }, - /* 3 */ new int[] { PrefixID.Superior, PrefixID.Demonic, PrefixID.Sighted }, - /* 4 */ new int[] { PrefixID.Godly, PrefixID.Rapid, /* ranged Deadly */ PrefixID.Deadly, /* universal Deadly */ PrefixID.Deadly2 }, - /* 5 */ new int[] { PrefixID.Unreal } - }; - prefix = IteratePrefix(rand, rangedReforgeTiers, currentPrefix); - } - - // MAGIC - else if (item.CountsAsClass() || item.CountsAsClass()) - { - int[][] magicReforgeTiers = new int[][] - { - /* 0 */ new int[] { PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Furious, PrefixID.Forceful, PrefixID.Strong }, - /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, PrefixID.Taboo, PrefixID.Manic }, - /* 2 */ new int[] { PrefixID.Murderous, PrefixID.Agile, PrefixID.Adept, PrefixID.Celestial, PrefixID.Unpleasant }, - /* 3 */ new int[] { PrefixID.Superior, PrefixID.Demonic, PrefixID.Mystic }, - /* 4 */ new int[] { PrefixID.Godly, PrefixID.Masterful, PrefixID.Deadly2 }, - /* 5 */ new int[] { PrefixID.Mythical } - }; - prefix = IteratePrefix(rand, magicReforgeTiers, currentPrefix); - } - - // SUMMON (not whips) - else if (item.CountsAsClass()) - { - int[][] summonReforgeTiers = new int[][] - { - /* 0 */ new int[] { PrefixID.Nimble, PrefixID.Furious }, - /* 1 */ new int[] { PrefixID.Forceful, PrefixID.Strong, PrefixID.Quick, PrefixID.Taboo, PrefixID.Manic }, - /* 2 */ new int[] { PrefixID.Hurtful, PrefixID.Adept, PrefixID.Celestial }, - /* 3 */ new int[] { PrefixID.Superior, PrefixID.Demonic, PrefixID.Mystic, PrefixID.Deadly2 }, - /* 4 */ new int[] { PrefixID.Masterful, PrefixID.Godly }, - /* 5 */ new int[] { PrefixID.Mythical, PrefixID.Ruthless } // you may want mythical early game for the knockback. - }; - prefix = IteratePrefix(rand, summonReforgeTiers, currentPrefix); - } - - // ROGUE (Calamity adds these reforges to all 1.4 TML throwing items) - else if (item.CountsAsClass()) - { - // Added appropriate universal reforges to rogue, so they don't ONLY get modded prefixes. - int[][] rogueReforgeTiers = new int[][] - { - /* 0 */ new int[] { PrefixID.Keen, PrefixID.Nimble, PrefixID.Nasty, PrefixID.Forceful, PrefixID.Strong, GetCalPrefix("Radical"), GetCalPrefix("Pointy") }, - /* 1 */ new int[] { PrefixID.Hurtful, PrefixID.Ruthless, PrefixID.Zealous, PrefixID.Quick, GetCalPrefix("Sharp"), GetCalPrefix("Glorious") }, - /* 2 */ new int[] { PrefixID.Murderous, PrefixID.Agile, PrefixID.Unpleasant, GetCalPrefix("Feathered"), GetCalPrefix("Sleek"), GetCalPrefix("Hefty") }, - /* 3 */ new int[] { PrefixID.Superior, PrefixID.Demonic, GetCalPrefix("Mighty"), GetCalPrefix("Serrated") }, - /* 4 */ new int[] { PrefixID.Godly, PrefixID.Deadly2, GetCalPrefix("Vicious"), GetCalPrefix("Lethal") }, - /* 5 */ new int[] { GetCalPrefix("Flawless") } - }; - prefix = IteratePrefix(rand, rogueReforgeTiers, currentPrefix); - } - - return prefix; - } - - private static int GetPrefixTier(int[][] tiers, int currentPrefix) - { - for (int checkingTier = 0; checkingTier < tiers.Length; ++checkingTier) - { - int[] tierList = tiers[checkingTier]; - for (int i = 0; i < tierList.Length; ++i) - if (tierList[i] == currentPrefix) - return checkingTier; - } - - // If an invalid or modded prefix is detected, return -1. - // This will give a random tier 0 prefix (the "next tier"), starting fresh with a low-tier vanilla or Calamity prefix. - return -1; - } - - private static int IteratePrefix(UnifiedRandom rand, int[][] reforgeTiers, int currentPrefix) - { - int currentTier = GetPrefixTier(reforgeTiers, currentPrefix); - - // If max tier: give max tier reforges forever - // Otherwise: go up by 1 tier with every reforge, guaranteed - int newTier = currentTier == reforgeTiers.Length - 1 ? currentTier : currentTier + 1; - return rand.Next(reforgeTiers[newTier]); - } - #endregion - /// /// Converts the given ModKeybind into a string for insertion into item tooltips.

/// This allows the user's actual keybind choices to be shown to them in tooltips. From f25ae561575003c93706d1f9b33d87fa1eded293 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 8 Dec 2025 03:16:23 +0900 Subject: [PATCH 31/48] GenericAIUtils as CommonProjectileAI --- Projectiles/CommonProjectileAI.cs | 623 +++++++++++++++++ .../DraedonsArsenal/StarSwallowerSummon.cs | 1 - Projectiles/Healing/BurntSiennaProj.cs | 1 - Projectiles/Healing/CactusHealOrb.cs | 1 - Projectiles/Healing/EssenceFlame.cs | 1 - Projectiles/Healing/GladiatorHealOrb.cs | 2 +- Projectiles/Magic/HadalUrnLamprey.cs | 1 - Projectiles/Magic/WaterLeechProj.cs | 1 - Projectiles/Melee/BonebreakerProjectile.cs | 1 - Projectiles/Pets/PerforaMini.cs | 1 - Projectiles/Pets/RotomPet.cs | 1 - Projectiles/Ranged/HydraHead.cs | 2 - .../Rogue/DimensionTearingDiskProjectile.cs | 4 - Projectiles/Rogue/EclipsesStealth.cs | 2 - Projectiles/Rogue/GodsParanoiaProj.cs | 1 - Projectiles/Rogue/JawsProjectile.cs | 1 - Projectiles/Rogue/KelvinCatalystBoomerang.cs | 1 - Projectiles/Rogue/LionfishProj.cs | 1 - Projectiles/Rogue/MetalShard.cs | 1 - Projectiles/Rogue/NastyChollaBol.cs | 1 - Projectiles/Rogue/SnapClamProj.cs | 1 - Projectiles/Rogue/SnapClamStealth.cs | 1 - Projectiles/Summon/AquaticStarMinion.cs | 2 - Projectiles/Summon/AureusBomber.cs | 2 - Projectiles/Summon/BelladonnaSpirit.cs | 1 - Projectiles/Summon/BlackHawkSummon.cs | 2 - Projectiles/Summon/Calamitamini.cs | 1 - Projectiles/Summon/Cataclymini.cs | 1 - Projectiles/Summon/Catastromini.cs | 1 - Projectiles/Summon/CausticStaffSummon.cs | 2 - Projectiles/Summon/CelestialAxeMinion.cs | 1 - Projectiles/Summon/CosmicViperSummon.cs | 1 - Projectiles/Summon/DormantBrimseekerBab.cs | 1 - Projectiles/Summon/EnchantedBladeSummon.cs | 1 - Projectiles/Summon/EndoCooperBody.cs | 1 - Projectiles/Summon/EndoHydraHead.cs | 1 - Projectiles/Summon/EyeOfNightCell.cs | 1 - Projectiles/Summon/FieryDraconid.cs | 1 - Projectiles/Summon/GammaHead.cs | 2 - Projectiles/Summon/GastricBelcher.cs | 2 - Projectiles/Summon/HerringAI.cs | 2 - Projectiles/Summon/IceClasperMinion.cs | 1 - Projectiles/Summon/MidnightSunUFO.cs | 1 - Projectiles/Summon/MiniGuardianHealer.cs | 1 - Projectiles/Summon/PlaguebringerSummon.cs | 1 - Projectiles/Summon/SandElementalHealer.cs | 1 - Projectiles/Summon/SlimePuppet.cs | 1 - Projectiles/Summon/TacticalPlagueJet.cs | 2 - Projectiles/Summon/Valkyrie.cs | 1 - Projectiles/Typeless/FungalClumpMinion.cs | 2 - Utilities/GenericAIUtils.cs | 626 ------------------ 51 files changed, 624 insertions(+), 689 deletions(-) create mode 100644 Projectiles/CommonProjectileAI.cs delete mode 100644 Utilities/GenericAIUtils.cs diff --git a/Projectiles/CommonProjectileAI.cs b/Projectiles/CommonProjectileAI.cs new file mode 100644 index 0000000000..03e846d237 --- /dev/null +++ b/Projectiles/CommonProjectileAI.cs @@ -0,0 +1,623 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Enums; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles; + +internal static class CommonProjectileAI +{ + public static void ChargingMinionAI(this Projectile projectile, float range, float maxPlayerDist, float extraMaxPlayerDist, float safeDist, int initialUpdates, float chargeDelayTime, float goToSpeed, float goBackSpeed, Vector2 returnOffset, float chargeCounterMax, float chargeSpeed, bool tileVision, bool ignoreTilesWhenCharging, int updateDifference = 1) + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + projectile.MinionAntiClump(); + + //Breather time between charges as like a reset + bool chargeDelay = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = initialUpdates + updateDifference; + if (projectile.ai[1] > chargeDelayTime) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = initialUpdates; + // CIT 2OCT2024: This line was breaking how the game counted minions, + // which resulted in minions being counted extra times and despawning other minions, most notoriously with Resurrection Butterfly. + // As such, I have commented it out. + // projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + chargeDelay = true; + } + } + if (chargeDelay) + { + return; + } + + //Find a target + float maxDist = range; + Vector2 targetVec = projectile.position; + bool foundTarget = false; + bool isButterfly = projectile.type == ProjectileType(); + //Prioritize the targeted enemy if possible + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + bool fishronCheck = npc.type == NPCID.DukeFishron && npc.active && isButterfly; + if (npc.CanBeChasedBy(projectile, false) || fishronCheck) + { + //Check the size of the target to make it easier to hit fat targets like Levi + float extraDist = (npc.width / 2) + (npc.height / 2); + + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + //Some minions will ignore tiles when choosing a target like Ice Claspers, others will not + bool canHit = true; + if (extraDist < maxDist && !tileVision) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + if (!foundTarget && targetDist < (maxDist + extraDist) && canHit) + { + maxDist = targetDist; + targetVec = npc.Center; + foundTarget = true; + } + } + } + //If no npc is specifically targetted or the selected enemy can't be found, check through the entire array + if (!foundTarget) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + bool fishronCheck = npc.type == NPCID.DukeFishron && npc.active && isButterfly; + if (npc.CanBeChasedBy(projectile, false) || fishronCheck) + { + float extraDist = (npc.width / 2) + (npc.height / 2); + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + bool canHit = true; + if (extraDist < maxDist && !tileVision) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + if (!foundTarget && targetDist < (maxDist + extraDist) && canHit) + { + maxDist = targetDist; + targetVec = npc.Center; + foundTarget = true; + } + } + } + } + + //If the player is too far, return to the player. Range is increased while attacking something. + float distBeforeForcedReturn = maxPlayerDist; + if (foundTarget) + { + distBeforeForcedReturn = extraMaxPlayerDist; + } + if (Vector2.Distance(player.Center, projectile.Center) > distBeforeForcedReturn) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + + //Go to the target if you found one + if (foundTarget && projectile.ai[0] == 0f) + { + //Some minions don't ignore tiles while charging like brittle stars + projectile.tileCollide = !ignoreTilesWhenCharging; + Vector2 targetSpot = targetVec - projectile.Center; + float targetDist = targetSpot.Length(); + targetSpot.Normalize(); + //Tries to get the minion in the sweet spot of 200 pixels away but the minion also charges so idk what good it does + if (targetDist > 200f) + { + float speed = goToSpeed; //8 + targetSpot *= speed; + projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; + } + else + { + float speed = -goBackSpeed; //-4 + targetSpot *= speed; + projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; //41 + } + } + + //Movement for idle or returning to the player + else + { + //Ignore tiles so they don't get stuck everywhere like Optic Staff + projectile.tileCollide = false; + + bool returningToPlayer = false; + if (!returningToPlayer) + { + returningToPlayer = projectile.ai[0] == 1f; + } + + //Player distance calculations + Vector2 playerVec = player.Center - projectile.Center + returnOffset; + float playerDist = playerVec.Length(); + + //If the minion is actively returning, move faster + float playerHomeSpeed = 6f; + if (returningToPlayer) + { + playerHomeSpeed = 15f; + } + //Move somewhat faster if the player is kinda far~ish + if (playerDist > 200f && playerHomeSpeed < 8f) + { + playerHomeSpeed = 8f; + } + //Return to normal if close enough to the player + if (playerDist < safeDist && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + //Teleport to the player if abnormally far + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + //If more than 70 pixels away, move toward the player + if (playerDist > 70f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; + } + //Minions never stay still + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + + //Increment attack counter randomly + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + //If high enough, prepare to attack + if (projectile.ai[1] > chargeCounterMax) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + + //Charge at an enemy if not on cooldown + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && foundTarget && maxDist < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 targetPos = targetVec - projectile.Center; + targetPos.Normalize(); + projectile.velocity = targetPos * chargeSpeed; //8 + projectile.netUpdate = true; + } + } + } + } + + public static void FloatingPetAI(this Projectile projectile, bool faceRight, float tiltFloat, bool lightPet = false) + { + Player player = Main.player[projectile.owner]; + + //anti sticking movement as a failsafe + float SAImovement = 0.05f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || otherProj.owner != projectile.owner || !Main.projPet[otherProj.type] || k == projectile.whoAmI) + continue; + + // If the other projectile is indeed another pet owned by the same player and they're too close, nudge them away. + bool isPet = Main.projPet[otherProj.type]; + float taxicabDist = Math.Abs(projectile.position.X - otherProj.position.X) + Math.Abs(projectile.position.Y - otherProj.position.Y); + if (isPet && taxicabDist < projectile.width) + { + if (projectile.position.X < otherProj.position.X) + projectile.velocity.X -= SAImovement; + else + projectile.velocity.X += SAImovement; + + if (projectile.position.Y < otherProj.position.Y) + projectile.velocity.Y -= SAImovement; + else + projectile.velocity.Y += SAImovement; + } + } + + float passiveMvtFloat = 0.5f; + projectile.tileCollide = false; + float range = 100f; + Vector2 projPos = projectile.Center; + float xDist = player.Center.X - projPos.X; + float yDist = player.Center.Y - projPos.Y; + yDist += Main.rand.NextFloat(-10, 20); + xDist += Main.rand.NextFloat(-10, 20); + //Light pets lead the player, normal pets trail the player + xDist += 60f * (lightPet ? (float)player.direction : -(float)player.direction); + yDist -= 60f; + Vector2 playerVector = new Vector2(xDist, yDist); + float playerDist = playerVector.Length(); + float returnSpeed = 18f; + + //If player is close enough, resume normal + if (playerDist < range && player.velocity.Y == 0f && + projectile.Bottom.Y <= player.Bottom.Y && + !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + if (projectile.velocity.Y < -6f) + { + projectile.velocity.Y = -6f; + } + } + + //Teleport to player if too far + if (playerDist > 2000f) + { + projectile.position.X = player.Center.X - projectile.width / 2; + projectile.position.Y = player.Center.Y - projectile.height / 2; + projectile.netUpdate = true; + } + + if (playerDist < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.99f; + } + passiveMvtFloat = 0.01f; + } + else + { + if (playerDist < 100f) + { + passiveMvtFloat = 0.1f; + } + if (playerDist > 300f) + { + passiveMvtFloat = 1f; + } + playerDist = returnSpeed / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; + } + if (projectile.velocity.X < playerVector.X) + { + projectile.velocity.X += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X += passiveMvtFloat; + } + } + if (projectile.velocity.X > playerVector.X) + { + projectile.velocity.X -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X -= passiveMvtFloat; + } + } + if (projectile.velocity.Y < playerVector.Y) + { + projectile.velocity.Y += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y += passiveMvtFloat * 2f; + } + } + if (projectile.velocity.Y > playerVector.Y) + { + projectile.velocity.Y -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y -= passiveMvtFloat * 2f; + } + } + if (projectile.velocity.X >= 0.25f) + { + projectile.direction = faceRight ? 1 : -1; + } + else if (projectile.velocity.X < -0.25f) + { + projectile.direction = faceRight ? -1 : 1; + } + //Tilting and change directions + projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.X * tiltFloat; + } + + public static void HealingProjectile(this Projectile projectile, int healing, int playerToHeal, float homingVelocity, float inertia, bool autoHomes = true, int timeCheck = 120) + { + int target = playerToHeal; + Player player = Main.player[target]; + float homingSpeed = homingVelocity; + if (player.lifeMagnet) + homingSpeed *= 1.5f; + + Vector2 playerVector = player.Center - projectile.Center; + float playerDist = playerVector.Length(); + if (playerDist < 50f && projectile.position.X < player.position.X + player.width && projectile.position.X + projectile.width > player.position.X && projectile.position.Y < player.position.Y + player.height && projectile.position.Y + projectile.height > player.position.Y) + { + if (projectile.owner == Main.myPlayer && !Main.LocalPlayer.moonLeech) + { + int healAmt = healing; + player.HealPlayer(healAmt, HealTextType.Local); + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, healAmt, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + if (autoHomes) + { + playerDist = homingSpeed / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; + projectile.velocity.X = (projectile.velocity.X * inertia + playerVector.X) / (inertia + 1f); + projectile.velocity.Y = (projectile.velocity.Y * inertia + playerVector.Y) / (inertia + 1f); + } + else if (player.lifeMagnet && projectile.timeLeft < timeCheck) + { + playerDist = homingVelocity / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; + projectile.velocity.X = (projectile.velocity.X * inertia + playerVector.X) / (inertia + 1f); + projectile.velocity.Y = (projectile.velocity.Y * inertia + playerVector.Y) / (inertia + 1f); + } + } + + public static void MinionAntiClump(this Projectile projectile, float pushForce = 0.05f) + { + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || otherProj.owner != projectile.owner || !otherProj.minion || k == projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == projectile.type; + float taxicabDist = Math.Abs(projectile.position.X - otherProj.position.X) + Math.Abs(projectile.position.Y - otherProj.position.Y); + if (sameProjType && taxicabDist < projectile.width) + { + if (projectile.position.X < otherProj.position.X) + projectile.velocity.X -= pushForce; + else + projectile.velocity.X += pushForce; + + if (projectile.position.Y < otherProj.position.Y) + projectile.velocity.Y -= pushForce; + else + projectile.velocity.Y += pushForce; + } + } + } + + /// + /// Call this function in ModifyHitNPC to make your projectiles stick to enemies, needs StickyProjAI to be called in the AI of the projectile + /// + /// The projectile you're giving sticky behaviour to + /// How many projectiles of this type can stick to one enemy + public static void ModifyHitNPCSticky(this Projectile projectile, int maxStick) + { + Player player = Main.player[projectile.owner]; + Rectangle myRect = projectile.Hitbox; + + if (projectile.owner == Main.myPlayer) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + //covers most edge cases like voodoo dolls + if (npc.active && !npc.dontTakeDamage && + ((projectile.friendly && (!npc.friendly || (npc.type == NPCID.Guide && projectile.owner < Main.maxPlayers && player.killGuide) || (npc.type == NPCID.Clothier && projectile.owner < Main.maxPlayers && player.killClothier))) || + (projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles)) && (projectile.owner < 0 || npc.immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) + { + if (npc.noTileCollide || !projectile.ownerHitCheck) + { + bool stickingToNPC; + //Solar Crawltipede tail has special collision + if (npc.type == NPCID.SolarCrawltipedeTail) + { + Rectangle rect = npc.Hitbox; + int crawltipedeHitboxMod = 8; + rect.X -= crawltipedeHitboxMod; + rect.Y -= crawltipedeHitboxMod; + rect.Width += crawltipedeHitboxMod * 2; + rect.Height += crawltipedeHitboxMod * 2; + stickingToNPC = projectile.Colliding(myRect, rect); + } + else + { + stickingToNPC = projectile.Colliding(myRect, npc.Hitbox); + } + if (stickingToNPC) + { + //reflect projectile if the npc can reflect it (like Selenians) + if (npc.reflectsProjectiles && projectile.CanBeReflected()) + { + npc.ReflectProjectile(projectile); + return; + } + + //let the projectile know it is sticking and the npc it is sticking too + projectile.ai[0] = 1f; + projectile.ai[1] = (float)npcIndex; + + //follow the NPC + projectile.velocity = (npc.Center - projectile.Center); + + projectile.netUpdate = true; + + //Count how many projectiles are attached, delete as necessary + Point[] array2 = new Point[maxStick]; + int projCount = 0; + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) + { + Projectile proj = Main.projectile[projIndex]; + if (projIndex != projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == projectile.type && proj.ai[0] == 1f && proj.ai[1] == (float)npcIndex) + { + array2[projCount++] = new Point(projIndex, proj.timeLeft); + if (projCount >= array2.Length) + { + break; + } + } + } + if (projCount >= array2.Length) + { + int stuckProjAmt = 0; + for (int m = 1; m < array2.Length; m++) + { + if (array2[m].Y < array2[stuckProjAmt].Y) + { + stuckProjAmt = m; + } + } + Main.projectile[array2[stuckProjAmt].X].Kill(); + } + } + } + } + } + } + } + + public static void StickToTiles(this Projectile projectile, bool ignorePlatforms, bool stickToEverything) + { + try + { + int xLeft = (int)(projectile.position.X / 16f) - 1; + int xRight = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; + int yBottom = (int)(projectile.position.Y / 16f) - 1; + int yTop = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; + if (xLeft < 0) + { + xLeft = 0; + } + if (xRight > Main.maxTilesX) + { + xRight = Main.maxTilesX; + } + if (yBottom < 0) + { + yBottom = 0; + } + if (yTop > Main.maxTilesY) + { + yTop = Main.maxTilesY; + } + for (int x = xLeft; x < xRight; x++) + { + for (int y = yBottom; y < yTop; y++) + { + Tile tile = Main.tile[x, y]; + bool platformCheck = true; + if (ignorePlatforms) + platformCheck = !TileID.Sets.Platforms[tile.TileType] && tile.TileType != TileID.PlanterBox; + bool tableCheck = false; + if (stickToEverything) + tableCheck = Main.tileSolidTop[tile.TileType] && tile.TileFrameY == 0; + if (tile != null && tile.HasUnactuatedTile && platformCheck && (Main.tileSolid[tile.TileType] || tableCheck)) + { + Vector2 tileSize; + tileSize.X = (float)(x * 16); + tileSize.Y = (float)(y * 16); + if (projectile.position.X + (float)projectile.width - 4f > tileSize.X && projectile.position.X + 4f < tileSize.X + 16f && projectile.position.Y + (float)projectile.height - 4f > tileSize.Y && projectile.position.Y + 4f < tileSize.Y + 16f) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -0.2f; + } + } + } + } + } + catch + { + } + } + + /// + /// Call this function in the ai of your projectile so it can stick to enemies, also requires ModifyHitNPCSticky to be called in ModifyHitNPC + /// + /// The projectile you're adding sticky behaviour to + /// Number of seconds you want a projectile to cling to an NPC + public static void StickyProjAI(this Projectile projectile, int timeLeft, bool findNewNPC = false) + { + if (projectile.ai[0] == 1f) + { + int seconds = timeLeft; + bool killProj = false; + bool spawnDust = false; + + //the projectile follows the NPC, even if it goes into blocks + projectile.tileCollide = false; + + //timer for triggering hit effects + projectile.localAI[0]++; + if (projectile.localAI[0] % 30f == 0f) + { + spawnDust = true; + } + + //So AI knows what NPC it is sticking to + int npcIndex = (int)projectile.ai[1]; + NPC npc = Main.npc[npcIndex]; + + //Kill projectile after so many seconds or if the NPC it is stuck to no longer exists + if (projectile.localAI[0] >= (float)(60 * seconds)) + { + killProj = true; + } + else if (!npcIndex.WithinBounds(Main.maxNPCs)) + { + killProj = true; + } + + else if (npc.active && !npc.dontTakeDamage) + { + //follow the NPC + projectile.Center = npc.Center - projectile.velocity * 2f; + projectile.gfxOffY = npc.gfxOffY; + + //if attached to npc, trigger npc hit effects every half a second + if (spawnDust) + { + npc.HitEffect(0, 1.0); + } + } + else + { + killProj = true; + } + + //Kill the projectile or reset stats if needed + if (killProj) + { + if (findNewNPC) + projectile.ai[0] = 0f; + else + projectile.Kill(); + } + } + } +} diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs index e5c35b3a87..23defbd09c 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -140,7 +140,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal PlayerSeparationAnxietyAI(player, ref minimumFrame, ref maximumFrame); FallThroughYPoint = player.Top.Y; } - Projectile.MinionAntiClump(); ManipulateFrames(minimumFrame, maximumFrame); } diff --git a/Projectiles/Healing/BurntSiennaProj.cs b/Projectiles/Healing/BurntSiennaProj.cs index 52efdc55f8..727296cc48 100644 --- a/Projectiles/Healing/BurntSiennaProj.cs +++ b/Projectiles/Healing/BurntSiennaProj.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.velocity *= 0.95f; - Projectile.HealingProjectile(3, (int)Projectile.ai[0], 6f, 15f, false); int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dusty]; diff --git a/Projectiles/Healing/CactusHealOrb.cs b/Projectiles/Healing/CactusHealOrb.cs index 23f54b162e..868b2601d6 100644 --- a/Projectiles/Healing/CactusHealOrb.cs +++ b/Projectiles/Healing/CactusHealOrb.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.velocity.Y *= 0.98f; - Projectile.HealingProjectile(15, Projectile.owner, 12f, 15f, false); int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 200, 0), 1.5f); Dust dust = Main.dust[dusty]; diff --git a/Projectiles/Healing/EssenceFlame.cs b/Projectiles/Healing/EssenceFlame.cs index d06bdfd4c6..610a4dd1e2 100644 --- a/Projectiles/Healing/EssenceFlame.cs +++ b/Projectiles/Healing/EssenceFlame.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Projectiles.Healing { Projectile.frame = 0; } - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 3.5f, 15f); return; } diff --git a/Projectiles/Healing/GladiatorHealOrb.cs b/Projectiles/Healing/GladiatorHealOrb.cs index e7c9296c9a..bbebf4fcd9 100644 --- a/Projectiles/Healing/GladiatorHealOrb.cs +++ b/Projectiles/Healing/GladiatorHealOrb.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Healing public void PassiveBehavior() { float maxYVelocity = 2f; - CalamityUtils.StickToTiles(Projectile, false, false); + CommonProjectileAI.StickToTiles(Projectile, false, false); Projectile.velocity.X *= 0.99f; if (Projectile.velocity.Y < maxYVelocity) Projectile.velocity.Y += 0.02f; diff --git a/Projectiles/Magic/HadalUrnLamprey.cs b/Projectiles/Magic/HadalUrnLamprey.cs index a8b5030619..3e57137c2e 100644 --- a/Projectiles/Magic/HadalUrnLamprey.cs +++ b/Projectiles/Magic/HadalUrnLamprey.cs @@ -48,7 +48,6 @@ namespace CalamityMod.Projectiles.Magic { Projectile.rotation = Projectile.velocity.ToRotation(); } - //Sticky Behaviour Projectile.StickyProjAI(15); Projectile.frameCounter++; diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index a85083f258..6bb8d4bf4d 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -47,7 +47,6 @@ namespace CalamityMod.Projectiles.Magic { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; } - //Sticky Behaviour Projectile.StickyProjAI(5); } diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 41c5b560a3..b2f5d2d035 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -46,7 +46,6 @@ namespace CalamityMod.Projectiles.Melee } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } - //Sticky Behaviour Projectile.StickyProjAI(15); } diff --git a/Projectiles/Pets/PerforaMini.cs b/Projectiles/Pets/PerforaMini.cs index d11e8856f5..8ef9a80541 100644 --- a/Projectiles/Pets/PerforaMini.cs +++ b/Projectiles/Pets/PerforaMini.cs @@ -57,7 +57,6 @@ namespace CalamityMod.Projectiles.Pets { Projectile.timeLeft = 2; } - Projectile.FloatingPetAI(true, 0.1f); //Dust diff --git a/Projectiles/Pets/RotomPet.cs b/Projectiles/Pets/RotomPet.cs index f9920c8963..54291d3730 100644 --- a/Projectiles/Pets/RotomPet.cs +++ b/Projectiles/Pets/RotomPet.cs @@ -69,7 +69,6 @@ namespace CalamityMod.Projectiles.Pets UpdateForm(player); UpdateFrames(); - Projectile.FloatingPetAI(true, 0.05f); } diff --git a/Projectiles/Ranged/HydraHead.cs b/Projectiles/Ranged/HydraHead.cs index ae90151da0..1a12887c45 100644 --- a/Projectiles/Ranged/HydraHead.cs +++ b/Projectiles/Ranged/HydraHead.cs @@ -123,8 +123,6 @@ namespace CalamityMod.Projectiles.Ranged // Clamp the center so that it does not go too far from the return position. if (Projectile.Distance(returnPosition) > 120f) Projectile.Center = returnPosition + Projectile.DirectionFrom(returnPosition) * 120f; - - // Disallow heads from getting too close to each other. Projectile.MinionAntiClump(0.15f); } diff --git a/Projectiles/Rogue/DimensionTearingDiskProjectile.cs b/Projectiles/Rogue/DimensionTearingDiskProjectile.cs index bcb2876335..cda9d5b223 100644 --- a/Projectiles/Rogue/DimensionTearingDiskProjectile.cs +++ b/Projectiles/Rogue/DimensionTearingDiskProjectile.cs @@ -138,8 +138,6 @@ namespace CalamityMod.Projectiles.Rogue laser.DamageType = RogueDamageClass.Instance; } } - - // Stay stuck to the target. Projectile.StickyProjAI(6, true); // If still attached to a target, do nothing. @@ -209,8 +207,6 @@ namespace CalamityMod.Projectiles.Rogue // Provide a fixed amount of grind time so that DPS can't vary wildly. Projectile.timeLeft = 90; } - - // Apply sticky AI. Projectile.ModifyHitNPCSticky(3); } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index bdf017b9f2..77e0bc3d4c 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -87,8 +87,6 @@ namespace CalamityMod.Projectiles.Rogue } } } - - // Sticky behavior. Lets the projectile impale enemies and sticks to its impaled enemy automatically. Projectile.StickyProjAI(10); } diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index 5c2bc3d735..ba9ca80eed 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -43,7 +43,6 @@ namespace CalamityMod.Projectiles.Rogue flame.velocity = Vector2.Zero; flame.noGravity = true; } - Projectile.StickyProjAI(50); if (Projectile.ai[0] == 1f) diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index cf28eed5b5..d06de31ee4 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -51,7 +51,6 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[dust].noGravity = true; } } - //Sticky Behaviour Projectile.StickyProjAI(15); } diff --git a/Projectiles/Rogue/KelvinCatalystBoomerang.cs b/Projectiles/Rogue/KelvinCatalystBoomerang.cs index fbf1f6df10..d9c564f0cc 100644 --- a/Projectiles/Rogue/KelvinCatalystBoomerang.cs +++ b/Projectiles/Rogue/KelvinCatalystBoomerang.cs @@ -67,7 +67,6 @@ namespace CalamityMod.Projectiles.Rogue ReturnToPlayer(); break; case 2: - // Will target the targetted NPC that minions use btw Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 1, 40f, 12f, 6f, new Vector2(0f, -60f), 40f, 12f, true, true); Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= 180) diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index 7d5cb2ecae..023b266700 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -65,7 +65,6 @@ namespace CalamityMod.Projectiles.Rogue } } } - //Sticky Behaviour Projectile.StickyProjAI(15); } diff --git a/Projectiles/Rogue/MetalShard.cs b/Projectiles/Rogue/MetalShard.cs index 83d25aece6..0622bbe146 100644 --- a/Projectiles/Rogue/MetalShard.cs +++ b/Projectiles/Rogue/MetalShard.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.velocity.Y > 16f) Projectile.velocity.Y = 16f; } - //Sticky Behaviour Projectile.StickyProjAI(15); } diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index 82a59ad5dd..ddbf587f4c 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - //Sticky Behaviour Projectile.StickyProjAI(15); if (Projectile.ai[0] != 1f) { diff --git a/Projectiles/Rogue/SnapClamProj.cs b/Projectiles/Rogue/SnapClamProj.cs index 2aff8e2686..12675173a0 100644 --- a/Projectiles/Rogue/SnapClamProj.cs +++ b/Projectiles/Rogue/SnapClamProj.cs @@ -45,7 +45,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation += 0.4f * (float)Projectile.direction; Projectile.spriteDirection = Projectile.direction; } - //Sticky Behaviour Projectile.StickyProjAI(15); if (Projectile.ai[2] < 30f && Projectile.ai[0] != 1f) { diff --git a/Projectiles/Rogue/SnapClamStealth.cs b/Projectiles/Rogue/SnapClamStealth.cs index 12ddd3ee4b..d4f4a2cd02 100644 --- a/Projectiles/Rogue/SnapClamStealth.cs +++ b/Projectiles/Rogue/SnapClamStealth.cs @@ -47,7 +47,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation += 0.4f * (float)Projectile.direction; Projectile.spriteDirection = Projectile.direction; } - //Sticky Behaviour Projectile.StickyProjAI(15); if (Projectile.ai[2] < 30f && Projectile.ai[0] != 1f) { diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 8267a409ae..4a78c8a8fa 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -66,8 +66,6 @@ namespace CalamityMod.Projectiles.Summon // Does a dust effect where the minion spawns. Projectile.rotation += Projectile.velocity.X * 0.04f; - // Make the minion spin depending on how fast it is. - Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 12f, 12f, false, false, 1); } diff --git a/Projectiles/Summon/AureusBomber.cs b/Projectiles/Summon/AureusBomber.cs index 52d7dd22ef..b8f427ad7e 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -62,8 +62,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - - //anti sticking movement Projectile.MinionAntiClump(); //get in a line diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index 34f577a36c..feea46e3ca 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Projectiles.Summon FollowPlayer(); if (Target != null) AttackTarget(); - Projectile.MinionAntiClump(); Projectile.spriteDirection = Target == null ? MathF.Sign(Projectile.velocity.X) : MathF.Sign(Target.Center.X - Projectile.Center.X); diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index 93d42c501c..b1ae973b7d 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -114,8 +114,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } - - //Anti sticky movement to prevent overlapping minions Projectile.MinionAntiClump(); float maxDistance = 700f; diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index f1c755a738..bdaafb3318 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -73,7 +73,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } - Projectile.MinionAntiClump(); Projectile.frameCounter++; diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index b67690cdcc..820f09e23f 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -66,7 +66,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } - Projectile.MinionAntiClump(); Projectile.frameCounter++; diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 956f049214..9666b486ca 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -79,7 +79,6 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 0; } - Projectile.ChargingMinionAI(Calamitamini.Range, Calamitamini.SeparationAnxietyMin, Calamitamini.SeparationAnxietyMax, Calamitamini.SafeDist, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, true); } diff --git a/Projectiles/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs index 501472f410..654f6293a7 100644 --- a/Projectiles/Summon/CausticStaffSummon.cs +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -71,8 +71,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } - - //Anti sticky movement to prevent minions from stacking Projectile.MinionAntiClump(); //Set tile collision for only when trying to return to the player diff --git a/Projectiles/Summon/CelestialAxeMinion.cs b/Projectiles/Summon/CelestialAxeMinion.cs index 932f8ec4fb..7db74490e4 100644 --- a/Projectiles/Summon/CelestialAxeMinion.cs +++ b/Projectiles/Summon/CelestialAxeMinion.cs @@ -58,7 +58,6 @@ namespace CalamityMod.Projectiles.Summon } } Projectile.rotation += 0.075f; - Projectile.ChargingMinionAI(1600f, 1800f, 2500f, 400f, 1, 30f, 24f, 12f, new Vector2(0f, -60f), 30f, 16f, true, true); // Destroy trees in GFB, because it's an axe, and axes should do that diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index 0dffeca8d7..f9548599a1 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -111,7 +111,6 @@ namespace CalamityMod.Projectiles.Summon float colorScale = (float)Projectile.alpha / 255f; Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); - Projectile.MinionAntiClump(); float detectRange = 2200f; diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index 183b6108fc..a2079fd6b0 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -97,7 +97,6 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = (Projectile.localAI[1] == 1f).ToInt() * 4; } - Projectile.MinionAntiClump(0.1f); if (Projectile.Distance(player.Center) > 2700f) { diff --git a/Projectiles/Summon/EnchantedBladeSummon.cs b/Projectiles/Summon/EnchantedBladeSummon.cs index 12f42ec889..827d173448 100644 --- a/Projectiles/Summon/EnchantedBladeSummon.cs +++ b/Projectiles/Summon/EnchantedBladeSummon.cs @@ -78,7 +78,6 @@ namespace CalamityMod.Projectiles.Summon } CurrentState.Invoke(); - Projectile.MinionAntiClump(0.25f); if (!Main.dedServ) diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index 487ec89ec1..6f32dd23b5 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -137,7 +137,6 @@ namespace CalamityMod.Projectiles.Summon if (limbs.type != ModContent.ProjectileType() || !limbs.active) Projectile.Kill(); - Projectile.MinionAntiClump(); bool accelerate = false; if (Projectile.ai[0] == 2f) diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index d33f6bbb9f..4b2aba981a 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -156,7 +156,6 @@ namespace CalamityMod.Projectiles.Summon { Projectile.Center = returnPosition + Projectile.DirectionFrom(returnPosition) * 120f; } - Projectile.MinionAntiClump(0.15f); AdjustOldVelocityArray(); } diff --git a/Projectiles/Summon/EyeOfNightCell.cs b/Projectiles/Summon/EyeOfNightCell.cs index ffa1a756c0..a0b0e58b74 100644 --- a/Projectiles/Summon/EyeOfNightCell.cs +++ b/Projectiles/Summon/EyeOfNightCell.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Projectiles.Summon { if (!Main.dedServ && Projectile.velocity.Length() > 5f) Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulphurousSeaAcid).noGravity = true; - Projectile.StickyProjAI(3); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Summon/FieryDraconid.cs b/Projectiles/Summon/FieryDraconid.cs index 2574c58132..4b8ceba47b 100644 --- a/Projectiles/Summon/FieryDraconid.cs +++ b/Projectiles/Summon/FieryDraconid.cs @@ -146,7 +146,6 @@ namespace CalamityMod.Projectiles.Summon public void DoPlayerHoverMovement() { - // Move away from other minions of the same type. Projectile.MinionAntiClump(0.1f); Vector2 hoverDestination = Owner.Top - Vector2.UnitY * 50f; diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index adad872278..b4fc0edb9d 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -187,8 +187,6 @@ namespace CalamityMod.Projectiles.Summon // Clamp the center so that it does not go too far from the return position. if (Projectile.Distance(returnPosition) > 120f) Projectile.Center = returnPosition + Projectile.DirectionFrom(returnPosition) * 120f; - - // Disallow heads from getting too close to each other. Projectile.MinionAntiClump(0.15f); } diff --git a/Projectiles/Summon/GastricBelcher.cs b/Projectiles/Summon/GastricBelcher.cs index c4523cdeee..71a09c85ce 100644 --- a/Projectiles/Summon/GastricBelcher.cs +++ b/Projectiles/Summon/GastricBelcher.cs @@ -92,8 +92,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } - - //Anti sticky movement to prevent overlapping minions Projectile.MinionAntiClump(); //Find a target diff --git a/Projectiles/Summon/HerringAI.cs b/Projectiles/Summon/HerringAI.cs index 54ae7836db..21c5434bba 100644 --- a/Projectiles/Summon/HerringAI.cs +++ b/Projectiles/Summon/HerringAI.cs @@ -47,8 +47,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = (Projectile.spriteDirection == -1) ? Projectile.velocity.ToRotation() + MathHelper.Pi : Projectile.velocity.ToRotation(); Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); - // Although the sprite is invisible, we'll keep track of it's direction and rotation so we can later apply it to the decorative herrings. - Projectile.ChargingMinionAI(EnemyDistanceDetection, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 12f, 12f, CalamityPlayer.areThereAnyDamnBosses, true, 1); // The AI of the minion. Projectile.netUpdate = true; diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index d99434a91f..f068af577a 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Projectiles.Summon RamState(); break; } - Projectile.MinionAntiClump(0.5f); if (!Main.dedServ) diff --git a/Projectiles/Summon/MidnightSunUFO.cs b/Projectiles/Summon/MidnightSunUFO.cs index 502494bb28..38b5bb2507 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -131,7 +131,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.Center = player.Center; Projectile.netUpdate = true; } - Projectile.MinionAntiClump(0.35f); Projectile.rotation = Projectile.velocity.X * 0.03f; } diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index 53397e2946..53460bbd4c 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -82,7 +82,6 @@ namespace CalamityMod.Projectiles.Summon hasSetTimers = true; Projectile.netUpdate = true; } - Projectile.MinionAntiClump(); Player owner = Owner; diff --git a/Projectiles/Summon/PlaguebringerSummon.cs b/Projectiles/Summon/PlaguebringerSummon.cs index ffa626a95c..a50a6e83f4 100644 --- a/Projectiles/Summon/PlaguebringerSummon.cs +++ b/Projectiles/Summon/PlaguebringerSummon.cs @@ -60,7 +60,6 @@ namespace CalamityMod.Projectiles.Summon } if (!modPlayer.plaguebringerPatronSet) Projectile.Kill(); - Projectile.MinionAntiClump(); Projectile.ai[0]++; diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index 408e4982e2..2a12054087 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -97,7 +97,6 @@ namespace CalamityMod.Projectiles.Summon lightScalar *= Main.essScale; Lighting.AddLight(Projectile.Center, 0.7f * lightScalar, 0.6f * lightScalar, 0f * lightScalar); } - Projectile.MinionAntiClump(); if (Vector2.Distance(player.Center, Projectile.Center) > 400f) diff --git a/Projectiles/Summon/SlimePuppet.cs b/Projectiles/Summon/SlimePuppet.cs index 1e12d73113..d607367ab2 100644 --- a/Projectiles/Summon/SlimePuppet.cs +++ b/Projectiles/Summon/SlimePuppet.cs @@ -36,7 +36,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - // Prevent clumping of other slime puppets near this one. Projectile.MinionAntiClump(); NPC potentialTarget = Projectile.Center.MinionHoming(800f, Owner); diff --git a/Projectiles/Summon/TacticalPlagueJet.cs b/Projectiles/Summon/TacticalPlagueJet.cs index 854d66152b..4b8e1625c0 100644 --- a/Projectiles/Summon/TacticalPlagueJet.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -191,8 +191,6 @@ namespace CalamityMod.Projectiles.Summon Main.projectile[projIndex].minion = false; } } - - // Prevent minion clumping while firing. Projectile.MinionAntiClump(0.25f); } } diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index ddcf3733dc..74f8021533 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -73,7 +73,6 @@ namespace CalamityMod.Projectiles.Summon { Projectile.spriteDirection = -Projectile.direction; } - Projectile.ChargingMinionAI(700f, 800f, 1200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, true); //Give off some light diff --git a/Projectiles/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index 782a84cecd..b96d31acb4 100644 --- a/Projectiles/Typeless/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -95,8 +95,6 @@ namespace CalamityMod.Projectiles.Typeless { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueFairy, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f); } - - //Anti-sticky movement failsafe Projectile.MinionAntiClump(); //If too far from player, increase speed to chase after player diff --git a/Utilities/GenericAIUtils.cs b/Utilities/GenericAIUtils.cs deleted file mode 100644 index 49fbf5fa78..0000000000 --- a/Utilities/GenericAIUtils.cs +++ /dev/null @@ -1,626 +0,0 @@ -using System; -using CalamityMod.CalPlayer; -using CalamityMod.Enums; -using CalamityMod.Projectiles.Summon; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod -{ - public static partial class CalamityUtils - { - public static void ChargingMinionAI(this Projectile projectile, float range, float maxPlayerDist, float extraMaxPlayerDist, float safeDist, int initialUpdates, float chargeDelayTime, float goToSpeed, float goBackSpeed, Vector2 returnOffset, float chargeCounterMax, float chargeSpeed, bool tileVision, bool ignoreTilesWhenCharging, int updateDifference = 1) - { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - - //Anti sticky movement to prevent stacking - projectile.MinionAntiClump(); - - //Breather time between charges as like a reset - bool chargeDelay = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = initialUpdates + updateDifference; - if (projectile.ai[1] > chargeDelayTime) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = initialUpdates; - // CIT 2OCT2024: This line was breaking how the game counted minions, - // which resulted in minions being counted extra times and despawning other minions, most notoriously with Resurrection Butterfly. - // As such, I have commented it out. - // projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - chargeDelay = true; - } - } - if (chargeDelay) - { - return; - } - - //Find a target - float maxDist = range; - Vector2 targetVec = projectile.position; - bool foundTarget = false; - bool isButterfly = projectile.type == ProjectileType(); - //Prioritize the targeted enemy if possible - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - bool fishronCheck = npc.type == NPCID.DukeFishron && npc.active && isButterfly; - if (npc.CanBeChasedBy(projectile, false) || fishronCheck) - { - //Check the size of the target to make it easier to hit fat targets like Levi - float extraDist = (npc.width / 2) + (npc.height / 2); - - float targetDist = Vector2.Distance(npc.Center, projectile.Center); - //Some minions will ignore tiles when choosing a target like Ice Claspers, others will not - bool canHit = true; - if (extraDist < maxDist && !tileVision) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); - if (!foundTarget && targetDist < (maxDist + extraDist) && canHit) - { - maxDist = targetDist; - targetVec = npc.Center; - foundTarget = true; - } - } - } - //If no npc is specifically targetted or the selected enemy can't be found, check through the entire array - if (!foundTarget) - { - for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) - { - NPC npc = Main.npc[npcIndex]; - bool fishronCheck = npc.type == NPCID.DukeFishron && npc.active && isButterfly; - if (npc.CanBeChasedBy(projectile, false) || fishronCheck) - { - float extraDist = (npc.width / 2) + (npc.height / 2); - float targetDist = Vector2.Distance(npc.Center, projectile.Center); - bool canHit = true; - if (extraDist < maxDist && !tileVision) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); - if (!foundTarget && targetDist < (maxDist + extraDist) && canHit) - { - maxDist = targetDist; - targetVec = npc.Center; - foundTarget = true; - } - } - } - } - - //If the player is too far, return to the player. Range is increased while attacking something. - float distBeforeForcedReturn = maxPlayerDist; - if (foundTarget) - { - distBeforeForcedReturn = extraMaxPlayerDist; - } - if (Vector2.Distance(player.Center, projectile.Center) > distBeforeForcedReturn) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - - //Go to the target if you found one - if (foundTarget && projectile.ai[0] == 0f) - { - //Some minions don't ignore tiles while charging like brittle stars - projectile.tileCollide = !ignoreTilesWhenCharging; - Vector2 targetSpot = targetVec - projectile.Center; - float targetDist = targetSpot.Length(); - targetSpot.Normalize(); - //Tries to get the minion in the sweet spot of 200 pixels away but the minion also charges so idk what good it does - if (targetDist > 200f) - { - float speed = goToSpeed; //8 - targetSpot *= speed; - projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; - } - else - { - float speed = -goBackSpeed; //-4 - targetSpot *= speed; - projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; //41 - } - } - - //Movement for idle or returning to the player - else - { - //Ignore tiles so they don't get stuck everywhere like Optic Staff - projectile.tileCollide = false; - - bool returningToPlayer = false; - if (!returningToPlayer) - { - returningToPlayer = projectile.ai[0] == 1f; - } - - //Player distance calculations - Vector2 playerVec = player.Center - projectile.Center + returnOffset; - float playerDist = playerVec.Length(); - - //If the minion is actively returning, move faster - float playerHomeSpeed = 6f; - if (returningToPlayer) - { - playerHomeSpeed = 15f; - } - //Move somewhat faster if the player is kinda far~ish - if (playerDist > 200f && playerHomeSpeed < 8f) - { - playerHomeSpeed = 8f; - } - //Return to normal if close enough to the player - if (playerDist < safeDist && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - //Teleport to the player if abnormally far - if (playerDist > 2000f) - { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - //If more than 70 pixels away, move toward the player - if (playerDist > 70f) - { - playerVec.Normalize(); - playerVec *= playerHomeSpeed; - projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; - } - //Minions never stay still - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - - //Increment attack counter randomly - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - //If high enough, prepare to attack - if (projectile.ai[1] > chargeCounterMax) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - - //Charge at an enemy if not on cooldown - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && foundTarget && maxDist < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 targetPos = targetVec - projectile.Center; - targetPos.Normalize(); - projectile.velocity = targetPos * chargeSpeed; //8 - projectile.netUpdate = true; - } - } - } - } - - public static void MinionAntiClump(this Projectile projectile, float pushForce = 0.05f) - { - for (int k = 0; k < Main.maxProjectiles; k++) - { - Projectile otherProj = Main.projectile[k]; - // Short circuits to make the loop as fast as possible - if (!otherProj.active || otherProj.owner != projectile.owner || !otherProj.minion || k == projectile.whoAmI) - continue; - - // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. - bool sameProjType = otherProj.type == projectile.type; - float taxicabDist = Math.Abs(projectile.position.X - otherProj.position.X) + Math.Abs(projectile.position.Y - otherProj.position.Y); - if (sameProjType && taxicabDist < projectile.width) - { - if (projectile.position.X < otherProj.position.X) - projectile.velocity.X -= pushForce; - else - projectile.velocity.X += pushForce; - - if (projectile.position.Y < otherProj.position.Y) - projectile.velocity.Y -= pushForce; - else - projectile.velocity.Y += pushForce; - } - } - } - - public static void FloatingPetAI(this Projectile projectile, bool faceRight, float tiltFloat, bool lightPet = false) - { - Player player = Main.player[projectile.owner]; - - //anti sticking movement as a failsafe - float SAImovement = 0.05f; - for (int k = 0; k < Main.maxProjectiles; k++) - { - Projectile otherProj = Main.projectile[k]; - // Short circuits to make the loop as fast as possible - if (!otherProj.active || otherProj.owner != projectile.owner || !Main.projPet[otherProj.type] || k == projectile.whoAmI) - continue; - - // If the other projectile is indeed another pet owned by the same player and they're too close, nudge them away. - bool isPet = Main.projPet[otherProj.type]; - float taxicabDist = Math.Abs(projectile.position.X - otherProj.position.X) + Math.Abs(projectile.position.Y - otherProj.position.Y); - if (isPet && taxicabDist < projectile.width) - { - if (projectile.position.X < otherProj.position.X) - projectile.velocity.X -= SAImovement; - else - projectile.velocity.X += SAImovement; - - if (projectile.position.Y < otherProj.position.Y) - projectile.velocity.Y -= SAImovement; - else - projectile.velocity.Y += SAImovement; - } - } - - float passiveMvtFloat = 0.5f; - projectile.tileCollide = false; - float range = 100f; - Vector2 projPos = projectile.Center; - float xDist = player.Center.X - projPos.X; - float yDist = player.Center.Y - projPos.Y; - yDist += Main.rand.NextFloat(-10, 20); - xDist += Main.rand.NextFloat(-10, 20); - //Light pets lead the player, normal pets trail the player - xDist += 60f * (lightPet ? (float)player.direction : -(float)player.direction); - yDist -= 60f; - Vector2 playerVector = new Vector2(xDist, yDist); - float playerDist = playerVector.Length(); - float returnSpeed = 18f; - - //If player is close enough, resume normal - if (playerDist < range && player.velocity.Y == 0f && - projectile.Bottom.Y <= player.Bottom.Y && - !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - if (projectile.velocity.Y < -6f) - { - projectile.velocity.Y = -6f; - } - } - - //Teleport to player if too far - if (playerDist > 2000f) - { - projectile.position.X = player.Center.X - projectile.width / 2; - projectile.position.Y = player.Center.Y - projectile.height / 2; - projectile.netUpdate = true; - } - - if (playerDist < 50f) - { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.velocity *= 0.99f; - } - passiveMvtFloat = 0.01f; - } - else - { - if (playerDist < 100f) - { - passiveMvtFloat = 0.1f; - } - if (playerDist > 300f) - { - passiveMvtFloat = 1f; - } - playerDist = returnSpeed / playerDist; - playerVector.X *= playerDist; - playerVector.Y *= playerDist; - } - if (projectile.velocity.X < playerVector.X) - { - projectile.velocity.X += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.X < 0f) - { - projectile.velocity.X += passiveMvtFloat; - } - } - if (projectile.velocity.X > playerVector.X) - { - projectile.velocity.X -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.X > 0f) - { - projectile.velocity.X -= passiveMvtFloat; - } - } - if (projectile.velocity.Y < playerVector.Y) - { - projectile.velocity.Y += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.Y < 0f) - { - projectile.velocity.Y += passiveMvtFloat * 2f; - } - } - if (projectile.velocity.Y > playerVector.Y) - { - projectile.velocity.Y -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.Y > 0f) - { - projectile.velocity.Y -= passiveMvtFloat * 2f; - } - } - if (projectile.velocity.X >= 0.25f) - { - projectile.direction = faceRight ? 1 : -1; - } - else if (projectile.velocity.X < -0.25f) - { - projectile.direction = faceRight ? -1 : 1; - } - //Tilting and change directions - projectile.spriteDirection = projectile.direction; - projectile.rotation = projectile.velocity.X * tiltFloat; - } - - public static void HealingProjectile(this Projectile projectile, int healing, int playerToHeal, float homingVelocity, float inertia, bool autoHomes = true, int timeCheck = 120) - { - int target = playerToHeal; - Player player = Main.player[target]; - float homingSpeed = homingVelocity; - if (player.lifeMagnet) - homingSpeed *= 1.5f; - - Vector2 playerVector = player.Center - projectile.Center; - float playerDist = playerVector.Length(); - if (playerDist < 50f && projectile.position.X < player.position.X + player.width && projectile.position.X + projectile.width > player.position.X && projectile.position.Y < player.position.Y + player.height && projectile.position.Y + projectile.height > player.position.Y) - { - if (projectile.owner == Main.myPlayer && !Main.LocalPlayer.moonLeech) - { - int healAmt = healing; - player.HealPlayer(healAmt, HealTextType.Local); - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, healAmt, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - if (autoHomes) - { - playerDist = homingSpeed / playerDist; - playerVector.X *= playerDist; - playerVector.Y *= playerDist; - projectile.velocity.X = (projectile.velocity.X * inertia + playerVector.X) / (inertia + 1f); - projectile.velocity.Y = (projectile.velocity.Y * inertia + playerVector.Y) / (inertia + 1f); - } - else if (player.lifeMagnet && projectile.timeLeft < timeCheck) - { - playerDist = homingVelocity / playerDist; - playerVector.X *= playerDist; - playerVector.Y *= playerDist; - projectile.velocity.X = (projectile.velocity.X * inertia + playerVector.X) / (inertia + 1f); - projectile.velocity.Y = (projectile.velocity.Y * inertia + playerVector.Y) / (inertia + 1f); - } - } - - /// - /// Call this function in the ai of your projectile so it can stick to enemies, also requires ModifyHitNPCSticky to be called in ModifyHitNPC - /// - /// The projectile you're adding sticky behaviour to - /// Number of seconds you want a projectile to cling to an NPC - public static void StickyProjAI(this Projectile projectile, int timeLeft, bool findNewNPC = false) - { - if (projectile.ai[0] == 1f) - { - int seconds = timeLeft; - bool killProj = false; - bool spawnDust = false; - - //the projectile follows the NPC, even if it goes into blocks - projectile.tileCollide = false; - - //timer for triggering hit effects - projectile.localAI[0]++; - if (projectile.localAI[0] % 30f == 0f) - { - spawnDust = true; - } - - //So AI knows what NPC it is sticking to - int npcIndex = (int)projectile.ai[1]; - NPC npc = Main.npc[npcIndex]; - - //Kill projectile after so many seconds or if the NPC it is stuck to no longer exists - if (projectile.localAI[0] >= (float)(60 * seconds)) - { - killProj = true; - } - else if (!npcIndex.WithinBounds(Main.maxNPCs)) - { - killProj = true; - } - - else if (npc.active && !npc.dontTakeDamage) - { - //follow the NPC - projectile.Center = npc.Center - projectile.velocity * 2f; - projectile.gfxOffY = npc.gfxOffY; - - //if attached to npc, trigger npc hit effects every half a second - if (spawnDust) - { - npc.HitEffect(0, 1.0); - } - } - else - { - killProj = true; - } - - //Kill the projectile or reset stats if needed - if (killProj) - { - if (findNewNPC) - projectile.ai[0] = 0f; - else - projectile.Kill(); - } - } - } - - /// - /// Call this function in ModifyHitNPC to make your projectiles stick to enemies, needs StickyProjAI to be called in the AI of the projectile - /// - /// The projectile you're giving sticky behaviour to - /// How many projectiles of this type can stick to one enemy - public static void ModifyHitNPCSticky(this Projectile projectile, int maxStick) - { - Player player = Main.player[projectile.owner]; - Rectangle myRect = projectile.Hitbox; - - if (projectile.owner == Main.myPlayer) - { - for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) - { - NPC npc = Main.npc[npcIndex]; - //covers most edge cases like voodoo dolls - if (npc.active && !npc.dontTakeDamage && - ((projectile.friendly && (!npc.friendly || (npc.type == NPCID.Guide && projectile.owner < Main.maxPlayers && player.killGuide) || (npc.type == NPCID.Clothier && projectile.owner < Main.maxPlayers && player.killClothier))) || - (projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles)) && (projectile.owner < 0 || npc.immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) - { - if (npc.noTileCollide || !projectile.ownerHitCheck) - { - bool stickingToNPC; - //Solar Crawltipede tail has special collision - if (npc.type == NPCID.SolarCrawltipedeTail) - { - Rectangle rect = npc.Hitbox; - int crawltipedeHitboxMod = 8; - rect.X -= crawltipedeHitboxMod; - rect.Y -= crawltipedeHitboxMod; - rect.Width += crawltipedeHitboxMod * 2; - rect.Height += crawltipedeHitboxMod * 2; - stickingToNPC = projectile.Colliding(myRect, rect); - } - else - { - stickingToNPC = projectile.Colliding(myRect, npc.Hitbox); - } - if (stickingToNPC) - { - //reflect projectile if the npc can reflect it (like Selenians) - if (npc.reflectsProjectiles && projectile.CanBeReflected()) - { - npc.ReflectProjectile(projectile); - return; - } - - //let the projectile know it is sticking and the npc it is sticking too - projectile.ai[0] = 1f; - projectile.ai[1] = (float)npcIndex; - - //follow the NPC - projectile.velocity = (npc.Center - projectile.Center); - - projectile.netUpdate = true; - - //Count how many projectiles are attached, delete as necessary - Point[] array2 = new Point[maxStick]; - int projCount = 0; - for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) - { - Projectile proj = Main.projectile[projIndex]; - if (projIndex != projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == projectile.type && proj.ai[0] == 1f && proj.ai[1] == (float)npcIndex) - { - array2[projCount++] = new Point(projIndex, proj.timeLeft); - if (projCount >= array2.Length) - { - break; - } - } - } - if (projCount >= array2.Length) - { - int stuckProjAmt = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[stuckProjAmt].Y) - { - stuckProjAmt = m; - } - } - Main.projectile[array2[stuckProjAmt].X].Kill(); - } - } - } - } - } - } - } - - public static void StickToTiles(this Projectile projectile, bool ignorePlatforms, bool stickToEverything) - { - try - { - int xLeft = (int)(projectile.position.X / 16f) - 1; - int xRight = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int yBottom = (int)(projectile.position.Y / 16f) - 1; - int yTop = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; - if (xLeft < 0) - { - xLeft = 0; - } - if (xRight > Main.maxTilesX) - { - xRight = Main.maxTilesX; - } - if (yBottom < 0) - { - yBottom = 0; - } - if (yTop > Main.maxTilesY) - { - yTop = Main.maxTilesY; - } - for (int x = xLeft; x < xRight; x++) - { - for (int y = yBottom; y < yTop; y++) - { - Tile tile = Main.tile[x, y]; - bool platformCheck = true; - if (ignorePlatforms) - platformCheck = !TileID.Sets.Platforms[tile.TileType] && tile.TileType != TileID.PlanterBox; - bool tableCheck = false; - if (stickToEverything) - tableCheck = Main.tileSolidTop[tile.TileType] && tile.TileFrameY == 0; - if (tile != null && tile.HasUnactuatedTile && platformCheck && (Main.tileSolid[tile.TileType] || tableCheck)) - { - Vector2 tileSize; - tileSize.X = (float)(x * 16); - tileSize.Y = (float)(y * 16); - if (projectile.position.X + (float)projectile.width - 4f > tileSize.X && projectile.position.X + 4f < tileSize.X + 16f && projectile.position.Y + (float)projectile.height - 4f > tileSize.Y && projectile.position.Y + 4f < tileSize.Y + 16f) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; - } - } - } - } - } - catch - { - } - } - } -} From 0af3b4b3ea3d709e005f653ac18f96f44eea397c Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 8 Dec 2025 03:18:39 +0900 Subject: [PATCH 32/48] Adjusted Namespace for WaterStyleCommon --- Waters/WaterStyleCommon.cs | 127 ++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/Waters/WaterStyleCommon.cs b/Waters/WaterStyleCommon.cs index d0f8cebe45..2d074ffc70 100644 --- a/Waters/WaterStyleCommon.cs +++ b/Waters/WaterStyleCommon.cs @@ -5,81 +5,80 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Graphics; -namespace CalamityMod +namespace CalamityMod.Waters; + +internal static class WaterStyleCommon { - internal static class WaterStyleCommon + public static void ModifySulphuricWaterColor(int x, int y, ref VertexColors initialColor, bool isSlope) { - public static void ModifySulphuricWaterColor(int x, int y, ref VertexColors initialColor, bool isSlope) + if (SulphuricWaterSafeZoneSystem.NearbySafeTiles.Count >= 1) { - if (SulphuricWaterSafeZoneSystem.NearbySafeTiles.Count >= 1) + Color cleanWaterColor = new(10, 62, 193); + var closestSafeZone = SulphuricWaterSafeZoneSystem.NearbySafeTiles.OrderBy(t => t.Key.ToVector2().DistanceSQ(new(x, y))).First(); + Point closestSafeZonePoint = closestSafeZone.Key; + float closestSafeZoneAmt = closestSafeZone.Value; + float lerpAmt = (1f - closestSafeZoneAmt) * 21f; + + void ModifyColor(Vector2 point, ref Color vertexColor) { - Color cleanWaterColor = new(10, 62, 193); - var closestSafeZone = SulphuricWaterSafeZoneSystem.NearbySafeTiles.OrderBy(t => t.Key.ToVector2().DistanceSQ(new(x, y))).First(); - Point closestSafeZonePoint = closestSafeZone.Key; - float closestSafeZoneAmt = closestSafeZone.Value; - float lerpAmt = (1f - closestSafeZoneAmt) * 21f; - - void ModifyColor(Vector2 point, ref Color vertexColor) - { - float distanceToClosest = point.Distance(closestSafeZonePoint.ToVector2()); - float acidicWaterInterpolant = Utils.GetLerpValue(12f, 20.5f, distanceToClosest + lerpAmt, true); - vertexColor = Color.Lerp(cleanWaterColor, vertexColor, acidicWaterInterpolant); - } - - ModifyColor(new(x - 0.5f, y - 0.5f), ref initialColor.TopLeftColor); - ModifyColor(new(x + 0.5f, y - 0.5f), ref initialColor.TopRightColor); - ModifyColor(new(x - 0.5f, y + 0.5f), ref initialColor.BottomLeftColor); - ModifyColor(new(x + 0.5f, y + 0.5f), ref initialColor.BottomRightColor); + float distanceToClosest = point.Distance(closestSafeZonePoint.ToVector2()); + float acidicWaterInterpolant = Utils.GetLerpValue(12f, 20.5f, distanceToClosest + lerpAmt, true); + vertexColor = Color.Lerp(cleanWaterColor, vertexColor, acidicWaterInterpolant); } - ModifyTransparentWaterColor(x, y, ref initialColor, isSlope); + ModifyColor(new(x - 0.5f, y - 0.5f), ref initialColor.TopLeftColor); + ModifyColor(new(x + 0.5f, y - 0.5f), ref initialColor.TopRightColor); + ModifyColor(new(x - 0.5f, y + 0.5f), ref initialColor.BottomLeftColor); + ModifyColor(new(x + 0.5f, y + 0.5f), ref initialColor.BottomRightColor); } - public static void ModifyTransparentWaterColor(int x, int y, ref VertexColors initialColor, bool isSlope) + ModifyTransparentWaterColor(x, y, ref initialColor, isSlope); + } + + public static void ModifyTransparentWaterColor(int x, int y, ref VertexColors initialColor, bool isSlope) + { + if (isSlope) { - if (isSlope) - { - initialColor.TopLeftColor *= 1f / 3; - initialColor.TopRightColor *= 1f / 3; - initialColor.BottomLeftColor *= 1f / 3; - initialColor.BottomRightColor *= 1f / 3; - } - else - { - initialColor.TopLeftColor *= 0.4f; - initialColor.TopRightColor *= 0.4f; - initialColor.BottomLeftColor *= 0.4f; - initialColor.BottomRightColor *= 0.4f; - } + initialColor.TopLeftColor *= 1f / 3; + initialColor.TopRightColor *= 1f / 3; + initialColor.BottomLeftColor *= 1f / 3; + initialColor.BottomRightColor *= 1f / 3; } - - public static void ModifySunkenSeaWaterLight(int x, int y, Vector3 waterColor, ref float r, ref float g, ref float b) + else { - float tick = (float)Main.timeForVisualEffects; - float brightness = MathHelper.Clamp(0.07f, 0f, 0.07f); - float waveScale1 = tick * 0.028f; - float waveScale2 = tick * 0.1f; - int yScale = -y / 2; - int xScale = x / 15; - float wave1 = tick * 0.024f * -50 + ((-x / 30) + (y / 30)) * 25; - float wave2 = waveScale2 * -10 + ((-xScale) + yScale) * 45; - float wave3 = waveScale1 * -100 + ((x / 7) + (y / 50)) * 25; - float wave4 = tick * 0.15f * 10 + ((x / 3) + yScale) * 45; - float wave5 = waveScale1 * -70 + ((-x / 25) + (-y / 25)) * 20; - float wave6 = waveScale2 * -10 + (xScale + yScale) * 45; - float bigwave = tick * 0.01f * -70 + ((-x / 2) + (-y / 40)) * 5; - float wave1angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave1)); - float wave2angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave2)); - float wave3angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave3)); - float wave4angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave4)); - float wave5angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave5)); - float wave6angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave6)); - float bigwaveangle = 0.55f + 0.80f * MathF.Sin(MathHelper.ToRadians(bigwave)); - float sumofwave = 0.07f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle + wave6angle + bigwaveangle; - - r = MathHelper.Lerp(r, waterColor.X, sumofwave) * brightness; - g = MathHelper.Lerp(g, waterColor.Y, sumofwave) * brightness; - b = MathHelper.Lerp(b, waterColor.Z, sumofwave) * brightness; + initialColor.TopLeftColor *= 0.4f; + initialColor.TopRightColor *= 0.4f; + initialColor.BottomLeftColor *= 0.4f; + initialColor.BottomRightColor *= 0.4f; } } + + public static void ModifySunkenSeaWaterLight(int x, int y, Vector3 waterColor, ref float r, ref float g, ref float b) + { + float tick = (float)Main.timeForVisualEffects; + float brightness = MathHelper.Clamp(0.07f, 0f, 0.07f); + float waveScale1 = tick * 0.028f; + float waveScale2 = tick * 0.1f; + int yScale = -y / 2; + int xScale = x / 15; + float wave1 = tick * 0.024f * -50 + ((-x / 30) + (y / 30)) * 25; + float wave2 = waveScale2 * -10 + ((-xScale) + yScale) * 45; + float wave3 = waveScale1 * -100 + ((x / 7) + (y / 50)) * 25; + float wave4 = tick * 0.15f * 10 + ((x / 3) + yScale) * 45; + float wave5 = waveScale1 * -70 + ((-x / 25) + (-y / 25)) * 20; + float wave6 = waveScale2 * -10 + (xScale + yScale) * 45; + float bigwave = tick * 0.01f * -70 + ((-x / 2) + (-y / 40)) * 5; + float wave1angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave1)); + float wave2angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave2)); + float wave3angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave3)); + float wave4angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave4)); + float wave5angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave5)); + float wave6angle = 0.55f + 0.45f * MathF.Sin(MathHelper.ToRadians(wave6)); + float bigwaveangle = 0.55f + 0.80f * MathF.Sin(MathHelper.ToRadians(bigwave)); + float sumofwave = 0.07f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle + wave6angle + bigwaveangle; + + r = MathHelper.Lerp(r, waterColor.X, sumofwave) * brightness; + g = MathHelper.Lerp(g, waterColor.Y, sumofwave) * brightness; + b = MathHelper.Lerp(b, waterColor.Z, sumofwave) * brightness; + } } From d401cc70ba3923fabc88f489446a6295c71357bb Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 8 Dec 2025 03:31:41 +0900 Subject: [PATCH 33/48] Removed GlobalEntity Extension that used rarely --- Items/Accessories/ShieldoftheOcean.cs | 10 ++++++---- Projectiles/Melee/GrandDadHoldout.cs | 2 +- Projectiles/Ranged/AdamAcceleratorBeam.cs | 5 +++-- Utilities/GeneralExtensionUtils.cs | 3 --- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 7c19d0e2bb..02daf35a01 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -1,8 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -84,10 +85,11 @@ namespace CalamityMod.Items.Accessories npc.MoveNPC(Vector2.Normalize(shoveVelocity), shoveVelocity.Length(), true); int scaledFallDamage = CalamityUtils.ScaleWithDifficulty(ShoveFallBaseDamage); + var flungNPC = npc.GetGlobalNPC(); if (empowered) - npc.FlungNPC().ApplyCollisionDamage(npc, player, scaledFallDamage, shoveVelocity * 0.5f, 5f, true); + flungNPC.ApplyCollisionDamage(npc, player, scaledFallDamage, shoveVelocity * 0.5f, 5f, true); else - npc.FlungNPC().ApplyForcedVelocity(npc, player, shoveVelocity * 0.5f, true); + flungNPC.ApplyForcedVelocity(npc, player, shoveVelocity * 0.5f, true); for (int i = -1; i <= 1; i++) { diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 6365934fea..f1151eec3a 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -259,7 +259,7 @@ namespace CalamityMod.Projectiles.Melee // Apply tile collison damage (is boosted on GFB and even further if both final bosses are gone) float damageMults = ((DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs) ? 5 : 1) * (Main.zenithWorld ? 77 : 1) * (rightClicked ? 3 : 1); int damage = (int)(Projectile.damage * damageMults); - target.FlungNPC().ApplyCollisionDamage(target, Owner, damage, launchVel * launchPower, 5f, true); + target.GetGlobalNPC().ApplyCollisionDamage(target, Owner, damage, launchVel * launchPower, 5f, true); } if (Projectile.numHits < 3) diff --git a/Projectiles/Ranged/AdamAcceleratorBeam.cs b/Projectiles/Ranged/AdamAcceleratorBeam.cs index adbce76797..f8c1737c54 100644 --- a/Projectiles/Ranged/AdamAcceleratorBeam.cs +++ b/Projectiles/Ranged/AdamAcceleratorBeam.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -139,7 +140,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.PolarityNPC().applyPolarity(polarity, target); //applies a positive or negative polarity on the target for 120 frames + target.GetGlobalNPC().applyPolarity(polarity, target); //applies a positive or negative polarity on the target for 120 frames } @@ -147,7 +148,7 @@ namespace CalamityMod.Projectiles.Ranged { // Ensure that the hit direction is correct when hitting enemies. modifiers.HitDirectionOverride = (Projectile.Center.X < target.Center.X).ToDirectionInt(); - float targetPolarity = target.PolarityNPC().CurPolarity; + float targetPolarity = target.GetGlobalNPC().CurPolarity; //If a polarity beam hits the target with the opposite polarity, the damage dealt increases by 20% if (polarity * targetPolarity < 0) { diff --git a/Utilities/GeneralExtensionUtils.cs b/Utilities/GeneralExtensionUtils.cs index 412bbb784a..a4e5dee3ac 100644 --- a/Utilities/GeneralExtensionUtils.cs +++ b/Utilities/GeneralExtensionUtils.cs @@ -11,11 +11,8 @@ namespace CalamityMod { public static CalamityPlayer Calamity(this Player player) => player.GetModPlayer(); public static CalamityGlobalNPC Calamity(this NPC npc) => npc.GetGlobalNPC(); - public static CalamityTileCollisionHarmNPC FlungNPC(this NPC npc) => npc.GetGlobalNPC(); - public static CalamityPolarityNPC PolarityNPC(this NPC npc) => npc.GetGlobalNPC(); public static CalamityGlobalItem Calamity(this Item item) => item.GetGlobalItem(); public static CalamityGlobalProjectile Calamity(this Projectile proj) => proj.GetGlobalProjectile(); public static TransformationPlayer Transformation(this Player player) => player.GetModPlayer(); - } } From 806e3f77630e9533f70a84f0a76c4924322526ad Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 8 Dec 2025 21:49:45 +0900 Subject: [PATCH 34/48] Simplified Prefix pool as static array --- Prefixes/ReforgeChange.cs | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/Prefixes/ReforgeChange.cs b/Prefixes/ReforgeChange.cs index 6a56d6f0a1..4930d90c47 100644 --- a/Prefixes/ReforgeChange.cs +++ b/Prefixes/ReforgeChange.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using System.Linq; +using System.Linq; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Packets; using CalamityMod.World; @@ -72,7 +71,20 @@ namespace CalamityMod.Prefixes } } - #region Prefix Tier Definition + #region Prefix Definition + public static int[] SimplifiedAccessoryPrefixes = + [ + PrefixID.Warding, + PrefixID.Menacing, + PrefixID.Lucky, + PrefixID.Quick2, + PrefixID.Violent, + PrefixID.Arcane, + PrefixType(), + PrefixType(), + PrefixType() + ]; + public static int[][] AccessoryPrefixTiers = [ /* 0 */ [PrefixID.Hard, PrefixID.Jagged, PrefixID.Brisk, PrefixID.Wild], @@ -275,21 +287,8 @@ namespace CalamityMod.Prefixes #region Simplified Accessory Reforge internal static int GetSimplifiedAccessoryReforge(Item item, UnifiedRandom rand, int currentPrefix) { - var pool = new HashSet() - { - PrefixID.Warding, - PrefixID.Menacing, - PrefixID.Lucky, - PrefixID.Quick2, - PrefixID.Violent, - PrefixID.Arcane, - PrefixType(), - PrefixType(), - PrefixType() - }; - - pool.Remove(currentPrefix); - return pool.ElementAt(rand.Next(0, pool.Count)); + var pool = SimplifiedAccessoryPrefixes.Where(id => id != currentPrefix); + return pool.ElementAt(rand.Next(0, pool.Count())); } #endregion } From 9022d3c4c119828fb09b9dda5c193bafbd3a2530 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 8 Dec 2025 22:05:16 +0900 Subject: [PATCH 35/48] Moved FurnitureSetupUtils under Tiles Namespace --- Tiles/Abyss/AbyssTreasureChest.cs | 8 +- Tiles/Abyss/CausticTorch.cs | 2 +- Tiles/Abyss/KelpTorch.cs | 2 +- Tiles/Abyss/RustyChestTile.cs | 9 +- Tiles/Abyss/SulphurousTorch.cs | 2 +- Tiles/Abyss/ThermalTorch.cs | 2 +- Tiles/Abyss/VoidTorch.cs | 2 +- Tiles/Astral/AstralChestLocked.cs | 8 +- Tiles/Astral/AstralTorch.cs | 2 +- Tiles/Crags/GloomTorch.cs | 2 +- .../AgedSecurityChestTile.cs | 8 +- .../CagedLights/CagedBiolight.cs | 2 +- .../CagedLights/CagedBlacklight.cs | 2 +- .../CagedLights/CagedCinderlight.cs | 2 +- .../CagedLights/CagedFlamelight.cs | 2 +- .../CagedLights/CagedFloodlight.cs | 2 +- .../CagedLights/CagedFrostlight.cs | 2 +- .../CagedLights/CagedLablight.cs | 2 +- .../CagedLights/MiniCagedBiolight.cs | 2 +- .../CagedLights/MiniCagedBlacklight.cs | 2 +- .../CagedLights/MiniCagedCinderlight.cs | 2 +- .../CagedLights/MiniCagedFlamelight.cs | 2 +- .../CagedLights/MiniCagedFloodlight.cs | 2 +- .../CagedLights/MiniCagedFrostlight.cs | 2 +- .../CagedLights/MiniCagedLablight.cs | 2 +- Tiles/DraedonStructures/SecurityChestTile.cs | 8 +- Tiles/Furniture/ChaosCandle.cs | 4 +- .../CraftingStations/ProfanedCrucible.cs | 2 +- .../Furniture/Fountains/AbyssFountainTile.cs | 4 +- .../Furniture/Fountains/AstralFountainTile.cs | 4 +- .../Fountains/BrimstoneLavaFountainTile.cs | 4 +- .../Fountains/SulphurousFountainTile.cs | 4 +- .../Fountains/SunkenSeaFountainTile.cs | 4 +- Tiles/Furniture/ThaumaticChairTile.cs | 6 +- Tiles/Furniture/TranquilityCandle.cs | 4 +- Tiles/Furniture/ZenithThrone.cs | 4 +- Tiles/FurnitureAbyss/AbyssBed.cs | 4 +- Tiles/FurnitureAbyss/AbyssCandelabra.cs | 2 +- Tiles/FurnitureAbyss/AbyssCandle.cs | 4 +- Tiles/FurnitureAbyss/AbyssChair.cs | 6 +- Tiles/FurnitureAbyss/AbyssChandelier.cs | 2 +- Tiles/FurnitureAbyss/AbyssChest.cs | 8 +- Tiles/FurnitureAbyss/AbyssClock.cs | 4 +- Tiles/FurnitureAbyss/AbyssDresser.cs | 8 +- Tiles/FurnitureAbyss/AbyssLamp.cs | 2 +- Tiles/FurnitureAbyss/AbyssLantern.cs | 2 +- Tiles/FurnitureAbyss/AbyssSofa.cs | 6 +- Tiles/FurnitureAcidwood/AcidwoodBedTile.cs | 4 +- Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs | 6 +- .../AcidwoodCandelabraTile.cs | 2 +- Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs | 4 +- Tiles/FurnitureAcidwood/AcidwoodChairTile.cs | 6 +- .../AcidwoodChandelierTile.cs | 2 +- Tiles/FurnitureAcidwood/AcidwoodChestTile.cs | 8 +- Tiles/FurnitureAcidwood/AcidwoodClockTile.cs | 4 +- .../FurnitureAcidwood/AcidwoodDresserTile.cs | 8 +- Tiles/FurnitureAcidwood/AcidwoodLampTile.cs | 2 +- .../FurnitureAcidwood/AcidwoodLanternTile.cs | 2 +- Tiles/FurnitureAncient/AncientBasin.cs | 2 +- Tiles/FurnitureAncient/AncientBed.cs | 2 +- Tiles/FurnitureAncient/AncientChair.cs | 6 +- Tiles/FurnitureAncient/AncientChandelier.cs | 2 +- Tiles/FurnitureAncient/AncientDresser.cs | 8 +- Tiles/FurnitureAncient/AncientLamp.cs | 2 +- Tiles/FurnitureAncient/AncientLantern.cs | 2 +- Tiles/FurnitureAncient/AncientMonolith.cs | 4 +- Tiles/FurnitureAncient/AncientSofa.cs | 6 +- Tiles/FurnitureAshen/AshenBasin.cs | 2 +- Tiles/FurnitureAshen/AshenBed.cs | 4 +- Tiles/FurnitureAshen/AshenCandelabra.cs | 2 +- Tiles/FurnitureAshen/AshenCandle.cs | 4 +- Tiles/FurnitureAshen/AshenChair.cs | 6 +- Tiles/FurnitureAshen/AshenChandelier.cs | 2 +- Tiles/FurnitureAshen/AshenChest.cs | 8 +- Tiles/FurnitureAshen/AshenDresser.cs | 8 +- Tiles/FurnitureAshen/AshenLamp.cs | 2 +- Tiles/FurnitureAshen/AshenLantern.cs | 2 +- Tiles/FurnitureAshen/AshenMonolith.cs | 4 +- Tiles/FurnitureAshen/AshenSofa.cs | 6 +- Tiles/FurnitureBotanic/BotanicBed.cs | 4 +- Tiles/FurnitureBotanic/BotanicBench.cs | 6 +- Tiles/FurnitureBotanic/BotanicCandelabra.cs | 2 +- Tiles/FurnitureBotanic/BotanicCandle.cs | 4 +- Tiles/FurnitureBotanic/BotanicChair.cs | 6 +- Tiles/FurnitureBotanic/BotanicChandelier.cs | 2 +- Tiles/FurnitureBotanic/BotanicChest.cs | 8 +- Tiles/FurnitureBotanic/BotanicClock.cs | 4 +- Tiles/FurnitureBotanic/BotanicDresser.cs | 8 +- Tiles/FurnitureBotanic/BotanicLamp.cs | 2 +- Tiles/FurnitureBotanic/BotanicLantern.cs | 2 +- Tiles/FurnitureBotanic/BotanicPlanter.cs | 2 +- .../FurnitureCommon.cs | 558 ++++++++++-------- .../FurnitureCosmilite/CosmiliteBasinTile.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteBed.cs | 4 +- .../FurnitureCosmilite/CosmiliteCandelabra.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteCandle.cs | 4 +- Tiles/FurnitureCosmilite/CosmiliteChair.cs | 6 +- .../FurnitureCosmilite/CosmiliteChandelier.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteChest.cs | 8 +- Tiles/FurnitureCosmilite/CosmiliteClock.cs | 4 +- Tiles/FurnitureCosmilite/CosmiliteDresser.cs | 8 +- Tiles/FurnitureCosmilite/CosmiliteLamp.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteLantern.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteSconce.cs | 2 +- Tiles/FurnitureCosmilite/CosmiliteSofa.cs | 6 +- Tiles/FurnitureDriftwood/DriftwoodBed.cs | 4 +- .../FurnitureDriftwood/DriftwoodCandelabra.cs | 2 +- Tiles/FurnitureDriftwood/DriftwoodCandle.cs | 4 +- Tiles/FurnitureDriftwood/DriftwoodChair.cs | 6 +- .../FurnitureDriftwood/DriftwoodChandelier.cs | 2 +- Tiles/FurnitureDriftwood/DriftwoodChest.cs | 8 +- Tiles/FurnitureDriftwood/DriftwoodDresser.cs | 8 +- Tiles/FurnitureDriftwood/DriftwoodLamp.cs | 2 +- Tiles/FurnitureDriftwood/DriftwoodLantern.cs | 2 +- Tiles/FurnitureDriftwood/DriftwoodSofa.cs | 6 +- Tiles/FurnitureDriftwood/DriftwoodSundial.cs | 4 +- Tiles/FurnitureDriftwood/DriftwoodToilet.cs | 6 +- Tiles/FurnitureExo/ExoBedTile.cs | 4 +- Tiles/FurnitureExo/ExoCandelabraTile.cs | 2 +- Tiles/FurnitureExo/ExoCandleTile.cs | 4 +- Tiles/FurnitureExo/ExoChairTile.cs | 6 +- Tiles/FurnitureExo/ExoChandelierTile.cs | 2 +- Tiles/FurnitureExo/ExoChestTile.cs | 8 +- Tiles/FurnitureExo/ExoClockTile.cs | 4 +- Tiles/FurnitureExo/ExoDresserTile.cs | 8 +- Tiles/FurnitureExo/ExoLampTile.cs | 2 +- Tiles/FurnitureExo/ExoLanternTile.cs | 2 +- Tiles/FurnitureExo/ExoPrismPlatformTile.cs | 1 - Tiles/FurnitureExo/ExoSofaTile.cs | 6 +- Tiles/FurnitureExo/ExoToiletTile.cs | 6 +- Tiles/FurnitureMarnite/MarniteBed.cs | 4 +- Tiles/FurnitureMarnite/MarniteCandelabra.cs | 2 +- Tiles/FurnitureMarnite/MarniteCandle.cs | 4 +- Tiles/FurnitureMarnite/MarniteChair.cs | 6 +- Tiles/FurnitureMarnite/MarniteChandelier.cs | 2 +- Tiles/FurnitureMarnite/MarniteChest.cs | 8 +- Tiles/FurnitureMarnite/MarniteClock.cs | 4 +- Tiles/FurnitureMarnite/MarniteDresser.cs | 8 +- Tiles/FurnitureMarnite/MarniteLamp.cs | 2 +- Tiles/FurnitureMarnite/MarniteLantern.cs | 2 +- Tiles/FurnitureMarnite/MarniteLight.cs | 2 +- Tiles/FurnitureMarnite/MarniteSofa.cs | 6 +- Tiles/FurnitureMarnite/MarniteToilet.cs | 6 +- Tiles/FurnitureMonolith/MonolithBed.cs | 4 +- Tiles/FurnitureMonolith/MonolithBench.cs | 6 +- Tiles/FurnitureMonolith/MonolithCandelabra.cs | 2 +- Tiles/FurnitureMonolith/MonolithCandle.cs | 4 +- Tiles/FurnitureMonolith/MonolithChair.cs | 6 +- Tiles/FurnitureMonolith/MonolithChandelier.cs | 2 +- Tiles/FurnitureMonolith/MonolithChest.cs | 8 +- Tiles/FurnitureMonolith/MonolithClock.cs | 4 +- Tiles/FurnitureMonolith/MonolithDresser.cs | 8 +- Tiles/FurnitureMonolith/MonolithLamp.cs | 2 +- Tiles/FurnitureMonolith/MonolithLantern.cs | 2 +- .../AncientNavystoneBed.cs | 4 +- .../AncientNavystoneBench.cs | 6 +- .../AncientNavystoneCandelabra.cs | 2 +- .../AncientNavystoneCandle.cs | 4 +- .../AncientNavystoneChair.cs | 6 +- .../AncientNavystoneChandelier.cs | 2 +- .../AncientNavystoneChest.cs | 8 +- .../AncientNavystoneClock.cs | 4 +- .../AncientNavystoneDresser.cs | 8 +- .../AncientNavystoneLamp.cs | 2 +- .../AncientNavystoneLantern.cs | 2 +- Tiles/FurnitureNavystone/NavystoneBed.cs | 4 +- .../FurnitureNavystone/NavystoneCandelabra.cs | 2 +- Tiles/FurnitureNavystone/NavystoneCandle.cs | 4 +- Tiles/FurnitureNavystone/NavystoneChair.cs | 6 +- .../FurnitureNavystone/NavystoneChandelier.cs | 2 +- Tiles/FurnitureNavystone/NavystoneChest.cs | 8 +- Tiles/FurnitureNavystone/NavystoneClock.cs | 4 +- Tiles/FurnitureNavystone/NavystoneDresser.cs | 8 +- Tiles/FurnitureNavystone/NavystoneLamp.cs | 2 +- Tiles/FurnitureNavystone/NavystoneLantern.cs | 2 +- Tiles/FurnitureNavystone/NavystoneToilet.cs | 6 +- .../FurnitureNavystone/NavystoneTriclinium.cs | 6 +- .../FurnitureOtherworldly/OtherworldlyBed.cs | 4 +- .../OtherworldlyCandelabra.cs | 2 +- .../OtherworldlyCandle.cs | 4 +- .../OtherworldlyChair.cs | 6 +- .../OtherworldlyChandelier.cs | 2 +- .../OtherworldlyChest.cs | 8 +- .../OtherworldlyClock.cs | 4 +- .../OtherworldlyDresser.cs | 8 +- .../FurnitureOtherworldly/OtherworldlyLamp.cs | 2 +- .../OtherworldlyLantern.cs | 2 +- .../FurnitureOtherworldly/OtherworldlySofa.cs | 6 +- .../PlaguedPlateBasin.cs | 2 +- .../FurniturePlaguedPlate/PlaguedPlateBed.cs | 2 +- .../PlaguedPlateCandelabra.cs | 2 +- .../PlaguedPlateCandle.cs | 4 +- .../PlaguedPlateChair.cs | 6 +- .../PlaguedPlateChandelier.cs | 2 +- .../PlaguedPlateChest.cs | 8 +- .../PlaguedPlateClock.cs | 4 +- .../PlaguedPlateDresser.cs | 8 +- .../FurniturePlaguedPlate/PlaguedPlateLamp.cs | 2 +- .../PlaguedPlateLantern.cs | 2 +- .../FurniturePlaguedPlate/PlaguedPlateSofa.cs | 6 +- Tiles/FurnitureProfaned/ProfanedBed.cs | 4 +- Tiles/FurnitureProfaned/ProfanedBench.cs | 6 +- Tiles/FurnitureProfaned/ProfanedCandelabra.cs | 2 +- Tiles/FurnitureProfaned/ProfanedCandle.cs | 4 +- Tiles/FurnitureProfaned/ProfanedChair.cs | 6 +- Tiles/FurnitureProfaned/ProfanedChandelier.cs | 2 +- Tiles/FurnitureProfaned/ProfanedChest.cs | 8 +- Tiles/FurnitureProfaned/ProfanedClock.cs | 4 +- Tiles/FurnitureProfaned/ProfanedDresser.cs | 8 +- Tiles/FurnitureProfaned/ProfanedLamp.cs | 2 +- Tiles/FurnitureProfaned/ProfanedLantern.cs | 2 +- .../LargeRitualCandleTile.cs | 2 +- .../MonolithOfTheAccursedTile.cs | 2 +- .../FurnitureSacrilegious/RitualCandleTile.cs | 2 +- .../SacrilegiousBedTile.cs | 4 +- .../SacrilegiousBenchTile.cs | 6 +- .../SacrilegiousCandelabraTile.cs | 2 +- .../SacrilegiousCandleTile.cs | 4 +- .../SacrilegiousChairTile.cs | 6 +- .../SacrilegiousChandelierTile.cs | 2 +- .../SacrilegiousChestTile.cs | 8 +- .../SacrilegiousClockTile.cs | 5 +- .../SacrilegiousDresserTile.cs | 8 +- .../SacrilegiousLampTile.cs | 2 +- .../SacrilegiousLanternTile.cs | 2 +- Tiles/FurnitureSilva/SilvaBasin.cs | 2 +- Tiles/FurnitureSilva/SilvaBed.cs | 4 +- Tiles/FurnitureSilva/SilvaBench.cs | 6 +- Tiles/FurnitureSilva/SilvaCandelabra.cs | 2 +- Tiles/FurnitureSilva/SilvaCandle.cs | 4 +- Tiles/FurnitureSilva/SilvaChair.cs | 6 +- Tiles/FurnitureSilva/SilvaChandelier.cs | 2 +- Tiles/FurnitureSilva/SilvaChest.cs | 8 +- Tiles/FurnitureSilva/SilvaClock.cs | 4 +- Tiles/FurnitureSilva/SilvaDresser.cs | 8 +- Tiles/FurnitureSilva/SilvaLamp.cs | 2 +- Tiles/FurnitureSilva/SilvaLantern.cs | 2 +- Tiles/FurnitureStatigel/StatigelBed.cs | 4 +- Tiles/FurnitureStatigel/StatigelCandelabra.cs | 2 +- Tiles/FurnitureStatigel/StatigelCandle.cs | 4 +- Tiles/FurnitureStatigel/StatigelChair.cs | 6 +- Tiles/FurnitureStatigel/StatigelChandelier.cs | 2 +- Tiles/FurnitureStatigel/StatigelChest.cs | 8 +- Tiles/FurnitureStatigel/StatigelClock.cs | 4 +- Tiles/FurnitureStatigel/StatigelDresser.cs | 8 +- Tiles/FurnitureStatigel/StatigelLamp.cs | 2 +- Tiles/FurnitureStatigel/StatigelLantern.cs | 2 +- Tiles/FurnitureStatigel/StatigelSofa.cs | 6 +- Tiles/FurnitureStratus/StratusBed.cs | 4 +- Tiles/FurnitureStratus/StratusCandelabra.cs | 2 +- Tiles/FurnitureStratus/StratusCandle.cs | 4 +- Tiles/FurnitureStratus/StratusChair.cs | 6 +- Tiles/FurnitureStratus/StratusChandelier.cs | 2 +- Tiles/FurnitureStratus/StratusChest.cs | 8 +- Tiles/FurnitureStratus/StratusClock.cs | 4 +- Tiles/FurnitureStratus/StratusDresser.cs | 8 +- Tiles/FurnitureStratus/StratusLamp.cs | 2 +- Tiles/FurnitureStratus/StratusLantern.cs | 2 +- Tiles/FurnitureStratus/StratusSofa.cs | 6 +- Tiles/FurnitureVoid/VoidBed.cs | 4 +- Tiles/FurnitureVoid/VoidCandelabra.cs | 2 +- Tiles/FurnitureVoid/VoidCandle.cs | 4 +- Tiles/FurnitureVoid/VoidChair.cs | 6 +- Tiles/FurnitureVoid/VoidChandelier.cs | 2 +- Tiles/FurnitureVoid/VoidChest.cs | 8 +- Tiles/FurnitureVoid/VoidClock.cs | 4 +- Tiles/FurnitureVoid/VoidDresser.cs | 8 +- Tiles/FurnitureVoid/VoidLamp.cs | 2 +- Tiles/FurnitureVoid/VoidLantern.cs | 2 +- Tiles/FurnitureVoid/VoidSofa.cs | 6 +- .../AnodizedWulfrumPlatform.cs | 1 - .../ChargedWulfrumWallMountedBulb.cs | 2 +- .../AnodizedWulfrumChair.cs | 6 +- .../AnodizedWulfrumChandelier.cs | 2 +- .../AnodizedWulfrumChest.cs | 8 +- .../AnodizedWulfrumDeskLight.cs | 4 +- .../AnodizedWulfrumDresser.cs | 8 +- .../AnodizedWulfrumLamp.cs | 2 +- .../AnodizedWulfrumLantern.cs | 2 +- .../AnodizedWulfrumSleepingPod.cs | 4 +- .../AnodizedWulfrumSofa.cs | 6 +- .../AnodizedWulfrumToilet.cs | 6 +- .../AnodizedWulfrumWorkBench.cs | 2 +- Tiles/FurnitureWulfrum/WulfrumBed.cs | 4 +- Tiles/FurnitureWulfrum/WulfrumCandelabra.cs | 2 +- Tiles/FurnitureWulfrum/WulfrumCandle.cs | 4 +- Tiles/FurnitureWulfrum/WulfrumChair.cs | 6 +- Tiles/FurnitureWulfrum/WulfrumChandelier.cs | 2 +- Tiles/FurnitureWulfrum/WulfrumClock.cs | 4 +- Tiles/FurnitureWulfrum/WulfrumDresser.cs | 8 +- Tiles/FurnitureWulfrum/WulfrumLamp.cs | 2 +- Tiles/FurnitureWulfrum/WulfrumLantern.cs | 2 +- Tiles/FurnitureWulfrum/WulfrumPlatform.cs | 1 - Tiles/FurnitureWulfrum/WulfrumSofa.cs | 6 +- Tiles/FurnitureWulfrum/WulfrumToilet.cs | 6 +- .../WulfrumWallMountedBulb.cs | 2 +- Tiles/SunkenSea/AlgalPrismTorch.cs | 2 +- Tiles/SunkenSea/NavyPrismTorch.cs | 2 +- Tiles/SunkenSea/RefractivePrismTorch.cs | 2 +- Utilities/TileUtils.cs | 61 -- 300 files changed, 914 insertions(+), 926 deletions(-) rename Utilities/FurnitureSetupUtils.cs => Tiles/FurnitureCommon.cs (97%) diff --git a/Tiles/Abyss/AbyssTreasureChest.cs b/Tiles/Abyss/AbyssTreasureChest.cs index 5869ccb838..ff49ab2d56 100644 --- a/Tiles/Abyss/AbyssTreasureChest.cs +++ b/Tiles/Abyss/AbyssTreasureChest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Abyss public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType()); - AddMapEntry(new Color(71, 49, 41), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(71, 49, 41), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); DustType = DustID.Water; } @@ -20,8 +20,8 @@ namespace CalamityMod.Tiles.Abyss public override void NumDust(int i, int j, bool fail, ref int num) => num = 1; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); // Locked Chest stuff @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.Abyss if (tile.TileFrameY != 0) top--; - return CalamityUtils.LockedChestRightClick(IsLockedChest(left, top), left, top, i, j); + return FurnitureCommon.LockedChestRightClick(IsLockedChest(left, top), left, top, i, j); } } } diff --git a/Tiles/Abyss/CausticTorch.cs b/Tiles/Abyss/CausticTorch.cs index 7652b0aafe..6d865de48d 100644 --- a/Tiles/Abyss/CausticTorch.cs +++ b/Tiles/Abyss/CausticTorch.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.Abyss public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/Abyss/KelpTorch.cs b/Tiles/Abyss/KelpTorch.cs index d4cd8d673d..45a0591767 100644 --- a/Tiles/Abyss/KelpTorch.cs +++ b/Tiles/Abyss/KelpTorch.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.Abyss public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/Abyss/RustyChestTile.cs b/Tiles/Abyss/RustyChestTile.cs index 60a4fd1425..3aac877bf3 100644 --- a/Tiles/Abyss/RustyChestTile.cs +++ b/Tiles/Abyss/RustyChestTile.cs @@ -15,9 +15,8 @@ namespace CalamityMod.Tiles.Abyss public override void SetStaticDefaults() { TileType = (ushort)ModContent.TileType(); - this.SetUpChest(ModContent.ItemType()); - AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(113, 90, 71), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -29,9 +28,9 @@ namespace CalamityMod.Tiles.Abyss public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/Abyss/SulphurousTorch.cs b/Tiles/Abyss/SulphurousTorch.cs index 22f14ca8df..ccc2a335e7 100644 --- a/Tiles/Abyss/SulphurousTorch.cs +++ b/Tiles/Abyss/SulphurousTorch.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.Abyss public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/Abyss/ThermalTorch.cs b/Tiles/Abyss/ThermalTorch.cs index 9052396b33..cb85c60abf 100644 --- a/Tiles/Abyss/ThermalTorch.cs +++ b/Tiles/Abyss/ThermalTorch.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.Abyss public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/Abyss/VoidTorch.cs b/Tiles/Abyss/VoidTorch.cs index 49cb21b45c..d64e53ae73 100644 --- a/Tiles/Abyss/VoidTorch.cs +++ b/Tiles/Abyss/VoidTorch.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Tiles.Abyss public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/Astral/AstralChestLocked.cs b/Tiles/Astral/AstralChestLocked.cs index cb4ea46421..6342c7cac9 100644 --- a/Tiles/Astral/AstralChestLocked.cs +++ b/Tiles/Astral/AstralChestLocked.cs @@ -21,15 +21,15 @@ namespace CalamityMod.Tiles.Astral public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override void NumDust(int i, int j, bool fail, ref int num) => num = 1; - public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); + public string MapChestName(string name, int i, int j) => FurnitureCommon.GetMapChestName(name, i, j); public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].TileFrameX / 36); public override LocalizedText DefaultContainerName(int frameX, int frameY) { int option = frameX / 36; return this.GetLocalization("MapEntry" + option); } - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); // Locked Chest stuff @@ -57,7 +57,7 @@ namespace CalamityMod.Tiles.Astral { top--; } - return CalamityUtils.LockedChestRightClick(IsLockedChest(left, top), left, top, i, j); + return FurnitureCommon.LockedChestRightClick(IsLockedChest(left, top), left, top, i, j); } } } diff --git a/Tiles/Astral/AstralTorch.cs b/Tiles/Astral/AstralTorch.cs index 001d64cfbd..7baa96a23d 100644 --- a/Tiles/Astral/AstralTorch.cs +++ b/Tiles/Astral/AstralTorch.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Tiles.Astral public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/Crags/GloomTorch.cs b/Tiles/Crags/GloomTorch.cs index ef79994dfd..69804dc76b 100644 --- a/Tiles/Crags/GloomTorch.cs +++ b/Tiles/Crags/GloomTorch.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Tiles.Crags public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/DraedonStructures/AgedSecurityChestTile.cs b/Tiles/DraedonStructures/AgedSecurityChestTile.cs index 1b462f44d9..428063eef4 100644 --- a/Tiles/DraedonStructures/AgedSecurityChestTile.cs +++ b/Tiles/DraedonStructures/AgedSecurityChestTile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType()); - AddMapEntry(new Color(130, 119, 115), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(130, 119, 115), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CanExplode(int i, int j) => false; @@ -26,9 +26,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs b/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs index 904e594501..4df8d87028 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs index d8ffc484ac..7d0bcbc817 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights } public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs index c2884858e1..c69a3f6b30 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs index 935dbccfb2..4b54a29dea 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs index d0e67fdd15..ab4d4cbdd0 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs index 54955f8250..cee6c4998c 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/CagedLablight.cs b/Tiles/DraedonStructures/CagedLights/CagedLablight.cs index ee4fdc43c3..8d03228245 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedLablight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedLablight.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.cs index aa62e293bd..5b1b1e9ee1 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedBiolight.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights } public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.cs index c8865fe6aa..475f01cf32 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedBlacklight.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights } public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.cs index 24d14f7795..ed67676391 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedCinderlight.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights } public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.cs index f20d6bcfde..8d8863731b 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedFlamelight.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights } public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.cs index 9ce9426dd5..e3bb2773de 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedFloodlight.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights } public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.cs index bbe83dac01..bac9b21be1 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedFrostlight.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights } public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.cs b/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.cs index 01863a1516..8b8576b655 100644 --- a/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.cs +++ b/Tiles/DraedonStructures/CagedLights/MiniCagedLablight.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/DraedonStructures/SecurityChestTile.cs b/Tiles/DraedonStructures/SecurityChestTile.cs index c9c350c9f9..9ccf53dbb2 100644 --- a/Tiles/DraedonStructures/SecurityChestTile.cs +++ b/Tiles/DraedonStructures/SecurityChestTile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType()); - AddMapEntry(new Color(130, 119, 115), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(130, 119, 115), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CanExplode(int i, int j) => false; @@ -26,9 +26,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/Furniture/ChaosCandle.cs b/Tiles/Furniture/ChaosCandle.cs index e6a17f4ca1..518b0fd1da 100644 --- a/Tiles/Furniture/ChaosCandle.cs +++ b/Tiles/Furniture/ChaosCandle.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.Furniture public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.Furniture public override bool RightClick(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); return true; } } diff --git a/Tiles/Furniture/CraftingStations/ProfanedCrucible.cs b/Tiles/Furniture/CraftingStations/ProfanedCrucible.cs index ec5a7057d5..eda5725ade 100644 --- a/Tiles/Furniture/CraftingStations/ProfanedCrucible.cs +++ b/Tiles/Furniture/CraftingStations/ProfanedCrucible.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/Furniture/Fountains/AbyssFountainTile.cs b/Tiles/Furniture/Fountains/AbyssFountainTile.cs index 9bdc67d1b1..1467ee01d5 100644 --- a/Tiles/Furniture/Fountains/AbyssFountainTile.cs +++ b/Tiles/Furniture/Fountains/AbyssFountainTile.cs @@ -45,12 +45,12 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 4); + FurnitureCommon.LightHitWire(Type, i, j, 2, 4); } public override bool RightClick(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 4); + FurnitureCommon.LightHitWire(Type, i, j, 2, 4); SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); return true; } diff --git a/Tiles/Furniture/Fountains/AstralFountainTile.cs b/Tiles/Furniture/Fountains/AstralFountainTile.cs index b21b19bd74..f71ee899e1 100644 --- a/Tiles/Furniture/Fountains/AstralFountainTile.cs +++ b/Tiles/Furniture/Fountains/AstralFountainTile.cs @@ -46,12 +46,12 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 4); + FurnitureCommon.LightHitWire(Type, i, j, 2, 4); } public override bool RightClick(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 4); + FurnitureCommon.LightHitWire(Type, i, j, 2, 4); SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); return true; } diff --git a/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile.cs b/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile.cs index 6222f06535..d282831cc1 100644 --- a/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile.cs +++ b/Tiles/Furniture/Fountains/BrimstoneLavaFountainTile.cs @@ -48,12 +48,12 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 4); + FurnitureCommon.LightHitWire(Type, i, j, 2, 4); } public override bool RightClick(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 4); + FurnitureCommon.LightHitWire(Type, i, j, 2, 4); SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); return true; } diff --git a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs index 6b52380f3d..fee27f16d2 100644 --- a/Tiles/Furniture/Fountains/SulphurousFountainTile.cs +++ b/Tiles/Furniture/Fountains/SulphurousFountainTile.cs @@ -46,12 +46,12 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 4); + FurnitureCommon.LightHitWire(Type, i, j, 2, 4); } public override bool RightClick(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 4); + FurnitureCommon.LightHitWire(Type, i, j, 2, 4); SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); return true; } diff --git a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs index 52a33930ad..5f6def4b6b 100644 --- a/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs +++ b/Tiles/Furniture/Fountains/SunkenSeaFountainTile.cs @@ -45,12 +45,12 @@ namespace CalamityMod.Tiles.Furniture.Fountains public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 4); + FurnitureCommon.LightHitWire(Type, i, j, 2, 4); } public override bool RightClick(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 4); + FurnitureCommon.LightHitWire(Type, i, j, 2, 4); SoundEngine.PlaySound(SoundID.Mech, new Vector2(i * 16, j * 16)); return true; } diff --git a/Tiles/Furniture/ThaumaticChairTile.cs b/Tiles/Furniture/ThaumaticChairTile.cs index 859e31f8bf..3ef7caa652 100644 --- a/Tiles/Furniture/ThaumaticChairTile.cs +++ b/Tiles/Furniture/ThaumaticChairTile.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.Furniture num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/Furniture/TranquilityCandle.cs b/Tiles/Furniture/TranquilityCandle.cs index 3144661cd2..6854f6f549 100644 --- a/Tiles/Furniture/TranquilityCandle.cs +++ b/Tiles/Furniture/TranquilityCandle.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.Furniture public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.Furniture public override bool RightClick(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); return true; } } diff --git a/Tiles/Furniture/ZenithThrone.cs b/Tiles/Furniture/ZenithThrone.cs index 580f530341..05373db96d 100644 --- a/Tiles/Furniture/ZenithThrone.cs +++ b/Tiles/Furniture/ZenithThrone.cs @@ -74,9 +74,9 @@ namespace CalamityMod.Tiles.Furniture info.AnchorTilePosition.Y = j; } - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAbyss/AbyssBed.cs b/Tiles/FurnitureAbyss/AbyssBed.cs index 8d18164db5..416a691649 100644 --- a/Tiles/FurnitureAbyss/AbyssBed.cs +++ b/Tiles/FurnitureAbyss/AbyssBed.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAbyss/AbyssCandelabra.cs b/Tiles/FurnitureAbyss/AbyssCandelabra.cs index 29ed46a7d3..ad0e6892ad 100644 --- a/Tiles/FurnitureAbyss/AbyssCandelabra.cs +++ b/Tiles/FurnitureAbyss/AbyssCandelabra.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurnitureAbyss/AbyssCandle.cs b/Tiles/FurnitureAbyss/AbyssCandle.cs index 1bc70981e5..b97e63e6df 100644 --- a/Tiles/FurnitureAbyss/AbyssCandle.cs +++ b/Tiles/FurnitureAbyss/AbyssCandle.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurnitureAbyss/AbyssChair.cs b/Tiles/FurnitureAbyss/AbyssChair.cs index f85356db35..31f520f96b 100644 --- a/Tiles/FurnitureAbyss/AbyssChair.cs +++ b/Tiles/FurnitureAbyss/AbyssChair.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureAbyss num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAbyss/AbyssChandelier.cs b/Tiles/FurnitureAbyss/AbyssChandelier.cs index f766e03cc8..20b9da187a 100644 --- a/Tiles/FurnitureAbyss/AbyssChandelier.cs +++ b/Tiles/FurnitureAbyss/AbyssChandelier.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureAbyss/AbyssChest.cs b/Tiles/FurnitureAbyss/AbyssChest.cs index 13729c06d6..a6cac3319f 100644 --- a/Tiles/FurnitureAbyss/AbyssChest.cs +++ b/Tiles/FurnitureAbyss/AbyssChest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureAbyss/AbyssClock.cs b/Tiles/FurnitureAbyss/AbyssClock.cs index d7ee944ebc..da08ab3116 100644 --- a/Tiles/FurnitureAbyss/AbyssClock.cs +++ b/Tiles/FurnitureAbyss/AbyssClock.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -40,6 +40,6 @@ namespace CalamityMod.Tiles.FurnitureAbyss } } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAbyss/AbyssDresser.cs b/Tiles/FurnitureAbyss/AbyssDresser.cs index d4fad0f275..1c6e35f282 100644 --- a/Tiles/FurnitureAbyss/AbyssDresser.cs +++ b/Tiles/FurnitureAbyss/AbyssDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureAbyss/AbyssLamp.cs b/Tiles/FurnitureAbyss/AbyssLamp.cs index 9bda2175f1..a1664f0e83 100644 --- a/Tiles/FurnitureAbyss/AbyssLamp.cs +++ b/Tiles/FurnitureAbyss/AbyssLamp.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureAbyss/AbyssLantern.cs b/Tiles/FurnitureAbyss/AbyssLantern.cs index 870a1e2b71..ac8dce21c2 100644 --- a/Tiles/FurnitureAbyss/AbyssLantern.cs +++ b/Tiles/FurnitureAbyss/AbyssLantern.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureAbyss/AbyssSofa.cs b/Tiles/FurnitureAbyss/AbyssSofa.cs index e20eea99a0..f562280eb9 100644 --- a/Tiles/FurnitureAbyss/AbyssSofa.cs +++ b/Tiles/FurnitureAbyss/AbyssSofa.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureAbyss num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs index 73ffbbb9e3..bc76076032 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBedTile.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs b/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs index 9224924124..86654de6ea 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodBenchTile.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureAcidwood num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs b/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs index ff92654675..83ab2a086f 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodCandelabraTile.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs b/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs index 270b1fd0a2..f429d9ef9f 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodCandleTile.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -56,7 +56,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs index 65199dc73e..c6daf63ccd 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChairTile.cs @@ -56,11 +56,11 @@ namespace CalamityMod.Tiles.FurnitureAcidwood num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, 40, true, true); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info, 40, true, true); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType(), true); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType(), true); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs index de17471788..cd097f1381 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChandelierTile.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs b/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs index 357fc07498..6b5b82c943 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodChestTile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs b/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs index 0e8127a1bd..8895accf8d 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodClockTile.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood return false; } - public override bool RightClick(int x, int y) => CalamityUtils.ClockRightClick(); + public override bool RightClick(int x, int y) => FurnitureCommon.ClockRightClick(); public override void NearbyEffects(int i, int j, bool closer) { @@ -34,6 +34,6 @@ namespace CalamityMod.Tiles.FurnitureAcidwood num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs b/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs index 12bd55ff70..2cd3270541 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodDresserTile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs b/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs index 7986380a9d..6d45974a53 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodLampTile.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs index 2cc4005b2a..77113c9b71 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Tiles.FurnitureAcidwood public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } public override void GetTileFlameData(int i, int j, ref TileDrawing.TileFlameData tileFlameData) diff --git a/Tiles/FurnitureAncient/AncientBasin.cs b/Tiles/FurnitureAncient/AncientBasin.cs index 7a671af6c7..bff7737053 100644 --- a/Tiles/FurnitureAncient/AncientBasin.cs +++ b/Tiles/FurnitureAncient/AncientBasin.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureAncient/AncientBed.cs b/Tiles/FurnitureAncient/AncientBed.cs index 9008ee9dfb..00dd7dea10 100644 --- a/Tiles/FurnitureAncient/AncientBed.cs +++ b/Tiles/FurnitureAncient/AncientBed.cs @@ -64,6 +64,6 @@ namespace CalamityMod.Tiles.FurnitureAncient return true; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAncient/AncientChair.cs b/Tiles/FurnitureAncient/AncientChair.cs index 6d6bb19f2a..2042ef66c5 100644 --- a/Tiles/FurnitureAncient/AncientChair.cs +++ b/Tiles/FurnitureAncient/AncientChair.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureAncient num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAncient/AncientChandelier.cs b/Tiles/FurnitureAncient/AncientChandelier.cs index ae9b9659d3..9c6843dca6 100644 --- a/Tiles/FurnitureAncient/AncientChandelier.cs +++ b/Tiles/FurnitureAncient/AncientChandelier.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } public override void GetTileFlameData(int i, int j, ref TileDrawing.TileFlameData tileFlameData) diff --git a/Tiles/FurnitureAncient/AncientDresser.cs b/Tiles/FurnitureAncient/AncientDresser.cs index f6bf544ea9..d28157fbea 100644 --- a/Tiles/FurnitureAncient/AncientDresser.cs +++ b/Tiles/FurnitureAncient/AncientDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureAncient/AncientLamp.cs b/Tiles/FurnitureAncient/AncientLamp.cs index f36665e1fe..ff86dfbe45 100644 --- a/Tiles/FurnitureAncient/AncientLamp.cs +++ b/Tiles/FurnitureAncient/AncientLamp.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureAncient/AncientLantern.cs b/Tiles/FurnitureAncient/AncientLantern.cs index a570d64da5..fe31c5eb11 100644 --- a/Tiles/FurnitureAncient/AncientLantern.cs +++ b/Tiles/FurnitureAncient/AncientLantern.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) diff --git a/Tiles/FurnitureAncient/AncientMonolith.cs b/Tiles/FurnitureAncient/AncientMonolith.cs index 57280af8a5..6e6002dc3a 100644 --- a/Tiles/FurnitureAncient/AncientMonolith.cs +++ b/Tiles/FurnitureAncient/AncientMonolith.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.FurnitureAncient public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -67,6 +67,6 @@ namespace CalamityMod.Tiles.FurnitureAncient num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAncient/AncientSofa.cs b/Tiles/FurnitureAncient/AncientSofa.cs index 4bb38cc641..03580641e8 100644 --- a/Tiles/FurnitureAncient/AncientSofa.cs +++ b/Tiles/FurnitureAncient/AncientSofa.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureAncient num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAshen/AshenBasin.cs b/Tiles/FurnitureAshen/AshenBasin.cs index b73b5f27b0..b29e684679 100644 --- a/Tiles/FurnitureAshen/AshenBasin.cs +++ b/Tiles/FurnitureAshen/AshenBasin.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureAshen/AshenBed.cs b/Tiles/FurnitureAshen/AshenBed.cs index 9267651c2a..af16505aaa 100644 --- a/Tiles/FurnitureAshen/AshenBed.cs +++ b/Tiles/FurnitureAshen/AshenBed.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.FurnitureAshen num = fail ? 1 : 3; } - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureAshen/AshenCandelabra.cs b/Tiles/FurnitureAshen/AshenCandelabra.cs index f8f089c19c..4135ddd130 100644 --- a/Tiles/FurnitureAshen/AshenCandelabra.cs +++ b/Tiles/FurnitureAshen/AshenCandelabra.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureAshen/AshenCandle.cs b/Tiles/FurnitureAshen/AshenCandle.cs index b4e27ff6bf..0fd9cc2b22 100644 --- a/Tiles/FurnitureAshen/AshenCandle.cs +++ b/Tiles/FurnitureAshen/AshenCandle.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -57,7 +57,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/FurnitureAshen/AshenChair.cs b/Tiles/FurnitureAshen/AshenChair.cs index 86e2829b8e..0fbf0957f3 100644 --- a/Tiles/FurnitureAshen/AshenChair.cs +++ b/Tiles/FurnitureAshen/AshenChair.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureAshen num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureAshen/AshenChandelier.cs b/Tiles/FurnitureAshen/AshenChandelier.cs index 51b0668275..3a21a905dd 100644 --- a/Tiles/FurnitureAshen/AshenChandelier.cs +++ b/Tiles/FurnitureAshen/AshenChandelier.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) diff --git a/Tiles/FurnitureAshen/AshenChest.cs b/Tiles/FurnitureAshen/AshenChest.cs index af112776a2..c3dd81f497 100644 --- a/Tiles/FurnitureAshen/AshenChest.cs +++ b/Tiles/FurnitureAshen/AshenChest.cs @@ -25,15 +25,15 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override void NumDust(int i, int j, bool fail, ref int num) => num = 1; - public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); + public string MapChestName(string name, int i, int j) => FurnitureCommon.GetMapChestName(name, i, j); public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].TileFrameX / 36); public override LocalizedText DefaultContainerName(int frameX, int frameY) { int option = frameX / 36; return this.GetLocalization("MapEntry" + option); } - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); // Locked Chest stuff @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureAshen { top--; } - return CalamityUtils.LockedChestRightClick(IsLockedChest(left, top), left, top, i, j); + return FurnitureCommon.LockedChestRightClick(IsLockedChest(left, top), left, top, i, j); } } } diff --git a/Tiles/FurnitureAshen/AshenDresser.cs b/Tiles/FurnitureAshen/AshenDresser.cs index 77b3031780..3dd927ba3b 100644 --- a/Tiles/FurnitureAshen/AshenDresser.cs +++ b/Tiles/FurnitureAshen/AshenDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureAshen/AshenLamp.cs b/Tiles/FurnitureAshen/AshenLamp.cs index b2dd284c9b..06ee9f7365 100644 --- a/Tiles/FurnitureAshen/AshenLamp.cs +++ b/Tiles/FurnitureAshen/AshenLamp.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureAshen/AshenLantern.cs b/Tiles/FurnitureAshen/AshenLantern.cs index e671750d60..3855e118c0 100644 --- a/Tiles/FurnitureAshen/AshenLantern.cs +++ b/Tiles/FurnitureAshen/AshenLantern.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) diff --git a/Tiles/FurnitureAshen/AshenMonolith.cs b/Tiles/FurnitureAshen/AshenMonolith.cs index 47424313ce..7217d39a43 100644 --- a/Tiles/FurnitureAshen/AshenMonolith.cs +++ b/Tiles/FurnitureAshen/AshenMonolith.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.FurnitureAshen public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -50,7 +50,7 @@ namespace CalamityMod.Tiles.FurnitureAshen num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureAshen/AshenSofa.cs b/Tiles/FurnitureAshen/AshenSofa.cs index 6396af054e..41af8853bf 100644 --- a/Tiles/FurnitureAshen/AshenSofa.cs +++ b/Tiles/FurnitureAshen/AshenSofa.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureAshen num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureBotanic/BotanicBed.cs b/Tiles/FurnitureBotanic/BotanicBed.cs index f3e6053f5d..e50ce6d9bf 100644 --- a/Tiles/FurnitureBotanic/BotanicBed.cs +++ b/Tiles/FurnitureBotanic/BotanicBed.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureBotanic/BotanicBench.cs b/Tiles/FurnitureBotanic/BotanicBench.cs index 8456274e28..0e768fc998 100644 --- a/Tiles/FurnitureBotanic/BotanicBench.cs +++ b/Tiles/FurnitureBotanic/BotanicBench.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureBotanic num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureBotanic/BotanicCandelabra.cs b/Tiles/FurnitureBotanic/BotanicCandelabra.cs index 91a3dbab1e..8c22569e16 100644 --- a/Tiles/FurnitureBotanic/BotanicCandelabra.cs +++ b/Tiles/FurnitureBotanic/BotanicCandelabra.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurnitureBotanic/BotanicCandle.cs b/Tiles/FurnitureBotanic/BotanicCandle.cs index 358c8a4b3a..73b43c873e 100644 --- a/Tiles/FurnitureBotanic/BotanicCandle.cs +++ b/Tiles/FurnitureBotanic/BotanicCandle.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -52,7 +52,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurnitureBotanic/BotanicChair.cs b/Tiles/FurnitureBotanic/BotanicChair.cs index 0ee9e3e78b..149eccdc83 100644 --- a/Tiles/FurnitureBotanic/BotanicChair.cs +++ b/Tiles/FurnitureBotanic/BotanicChair.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureBotanic num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureBotanic/BotanicChandelier.cs b/Tiles/FurnitureBotanic/BotanicChandelier.cs index 5c09783ac6..93c8e970c2 100644 --- a/Tiles/FurnitureBotanic/BotanicChandelier.cs +++ b/Tiles/FurnitureBotanic/BotanicChandelier.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureBotanic/BotanicChest.cs b/Tiles/FurnitureBotanic/BotanicChest.cs index bbf30963f9..d73f222d55 100644 --- a/Tiles/FurnitureBotanic/BotanicChest.cs +++ b/Tiles/FurnitureBotanic/BotanicChest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureBotanic/BotanicClock.cs b/Tiles/FurnitureBotanic/BotanicClock.cs index dd33d37e42..6ae4b6189c 100644 --- a/Tiles/FurnitureBotanic/BotanicClock.cs +++ b/Tiles/FurnitureBotanic/BotanicClock.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -37,6 +37,6 @@ namespace CalamityMod.Tiles.FurnitureBotanic } } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureBotanic/BotanicDresser.cs b/Tiles/FurnitureBotanic/BotanicDresser.cs index a4f60cf62a..60132c3dea 100644 --- a/Tiles/FurnitureBotanic/BotanicDresser.cs +++ b/Tiles/FurnitureBotanic/BotanicDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureBotanic/BotanicLamp.cs b/Tiles/FurnitureBotanic/BotanicLamp.cs index dc7de3cb0e..bd0fc80cfb 100644 --- a/Tiles/FurnitureBotanic/BotanicLamp.cs +++ b/Tiles/FurnitureBotanic/BotanicLamp.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureBotanic/BotanicLantern.cs b/Tiles/FurnitureBotanic/BotanicLantern.cs index ff61750358..5a0d66f52e 100644 --- a/Tiles/FurnitureBotanic/BotanicLantern.cs +++ b/Tiles/FurnitureBotanic/BotanicLantern.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureBotanic/BotanicPlanter.cs b/Tiles/FurnitureBotanic/BotanicPlanter.cs index 26ecfcfe89..c22dd420e8 100644 --- a/Tiles/FurnitureBotanic/BotanicPlanter.cs +++ b/Tiles/FurnitureBotanic/BotanicPlanter.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Utilities/FurnitureSetupUtils.cs b/Tiles/FurnitureCommon.cs similarity index 97% rename from Utilities/FurnitureSetupUtils.cs rename to Tiles/FurnitureCommon.cs index f658cefe63..39f0474563 100644 --- a/Utilities/FurnitureSetupUtils.cs +++ b/Tiles/FurnitureCommon.cs @@ -12,22 +12,10 @@ using Terraria.ModLoader.Default; using Terraria.ObjectData; using static Terraria.ModLoader.ModContent; -namespace CalamityMod +namespace CalamityMod.Tiles { - public static partial class CalamityUtils + internal static class FurnitureCommon { - public static void RightClickBreak(int i, int j) - { - if (Main.tile[i, j] != null && Main.tile[i, j].HasTile) - { - WorldGen.KillTile(i, j, false, false, false); - if (!Main.tile[i, j].HasTile && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)i, (float)j, 0f, 0, 0, 0); - } - } - } - public static bool BedRightClick(int i, int j) { Player player = Main.LocalPlayer; @@ -66,7 +54,79 @@ namespace CalamityMod return true; } - #region Sitting in Chairs + public static void BenchMouseOver(int i, int j, int itemID) + { + Player player = Main.LocalPlayer; + + if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) + { + return; + } + + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = itemID; + } + + public static void BenchSitInfo(int i, int j, ref TileRestingInfo info, int nextStyleHeight = 40) + { + Tile tile = Framing.GetTileSafely(i, j); + Player player = Main.LocalPlayer; + + info.DirectionOffset = 0; + float offset = 0f; + if (tile.TileFrameX < 17 && player.direction == 1) + offset = 8f; + if (tile.TileFrameX < 17 && player.direction == -1) + offset = -8f; + if (tile.TileFrameX > 34 && player.direction == 1) + offset = -8f; + if (tile.TileFrameX > 34 && player.direction == -1) + offset = 8f; + info.VisualOffset = new Vector2(offset, 0f); + info.TargetDirection = player.direction; + + info.AnchorTilePosition.X = i; + info.AnchorTilePosition.Y = j; + + if (tile.TileFrameY % nextStyleHeight == 0) + { + info.AnchorTilePosition.Y++; + } + } + + public static void ChairMouseOver(int i, int j, int itemID, bool fat = false) + { + Player player = Main.LocalPlayer; + + if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) + { + return; + } + + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = itemID; + + bool frameCheck = fat ? Main.tile[i, j].TileFrameX <= 35 : Main.tile[i, j].TileFrameX / 18 < 0; + if (frameCheck) + { + player.cursorItemIconReversed = true; + } + } + + public static bool ChairRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + + if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) + { + player.GamepadEnableGrappleCooldown(); + player.sitting.SitDown(player, i, j); + } + return true; + } + // fat is for 2 tile chairs like Exo Chair and Exo Toilet public static void ChairSitInfo(int i, int j, ref TileRestingInfo info, int nextStyleHeight = 40, bool fat = false, bool hasOffset = false, bool shitter = false) { @@ -105,91 +165,51 @@ namespace CalamityMod info.AnchorTilePosition.Y++; } } - - public static bool ChairRightClick(int i, int j) + public static void ChestMouseFar(int i, int j) where T : ModItem { + ChestMouseOver(i, j); Player player = Main.LocalPlayer; - - if (player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) + if (player.cursorItemIconText == "") { - player.GamepadEnableGrappleCooldown(); - player.sitting.SitDown(player, i, j); + player.cursorItemIconEnabled = false; + player.cursorItemIconID = ItemID.None; } - return true; } - public static void ChairMouseOver(int i, int j, int itemID, bool fat = false) + public static void ChestMouseOver(int i, int j) where T : ModItem { Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) + Tile tile = Main.tile[i, j]; + string chestName = TileLoader.DefaultContainerName(tile.TileType, tile.TileFrameX, tile.TileFrameY); + int left = i; + int top = j; + if (tile.TileFrameX % 36 != 0) { - return; + left--; + } + if (tile.TileFrameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.cursorItemIconID = -1; + if (chest < 0) + { + player.cursorItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.cursorItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : chestName; + if (player.cursorItemIconText == chestName) + { + player.cursorItemIconID = ItemType(); + player.cursorItemIconText = ""; + } } - player.noThrow = 2; player.cursorItemIconEnabled = true; - player.cursorItemIconID = itemID; - - bool frameCheck = fat ? Main.tile[i, j].TileFrameX <= 35 : Main.tile[i, j].TileFrameX / 18 < 0; - if (frameCheck) - { - player.cursorItemIconReversed = true; - } } - public static void MouseOver(int i, int j, int itemID) - { - Player player = Main.LocalPlayer; - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = itemID; - } - #endregion - - #region Sitting in Sofas/Benches - public static void BenchSitInfo(int i, int j, ref TileRestingInfo info, int nextStyleHeight = 40) - { - Tile tile = Framing.GetTileSafely(i, j); - Player player = Main.LocalPlayer; - - info.DirectionOffset = 0; - float offset = 0f; - if (tile.TileFrameX < 17 && player.direction == 1) - offset = 8f; - if (tile.TileFrameX < 17 && player.direction == -1) - offset = -8f; - if (tile.TileFrameX > 34 && player.direction == 1) - offset = -8f; - if (tile.TileFrameX > 34 && player.direction == -1) - offset = 8f; - info.VisualOffset = new Vector2(offset, 0f); - info.TargetDirection = player.direction; - - info.AnchorTilePosition.X = i; - info.AnchorTilePosition.Y = j; - - if (tile.TileFrameY % nextStyleHeight == 0) - { - info.AnchorTilePosition.Y++; - } - } - - public static void BenchMouseOver(int i, int j, int itemID) - { - Player player = Main.LocalPlayer; - - if (!player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance)) - { - return; - } - - player.noThrow = 2; - player.cursorItemIconEnabled = true; - player.cursorItemIconID = itemID; - } - #endregion - public static bool ChestRightClick(int i, int j) { Player player = Main.LocalPlayer; @@ -264,51 +284,6 @@ namespace CalamityMod return true; } - public static void ChestMouseOver(int i, int j) where T : ModItem - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - string chestName = TileLoader.DefaultContainerName(tile.TileType, tile.TileFrameX, tile.TileFrameY); - int left = i; - int top = j; - if (tile.TileFrameX % 36 != 0) - { - left--; - } - if (tile.TileFrameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.cursorItemIconID = -1; - if (chest < 0) - { - player.cursorItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.cursorItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : chestName; - if (player.cursorItemIconText == chestName) - { - player.cursorItemIconID = ItemType(); - player.cursorItemIconText = ""; - } - } - player.noThrow = 2; - player.cursorItemIconEnabled = true; - } - - public static void ChestMouseFar(int i, int j) where T : ModItem - { - ChestMouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.cursorItemIconText == "") - { - player.cursorItemIconEnabled = false; - player.cursorItemIconID = ItemID.None; - } - } - public static bool ClockRightClick() { string text = "AM"; @@ -358,6 +333,91 @@ namespace CalamityMod return true; } + public static void DresserMouseFar() where T : ModItem + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + string chestName = TileLoader.DefaultContainerName(tile.TileType, tile.TileFrameX, tile.TileFrameY); + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.TileFrameX % 54 / 18); + if (tile.TileFrameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.cursorItemIconID = -1; + if (chestIndex < 0) + { + player.cursorItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.cursorItemIconText = Main.chest[chestIndex].name; + } + else + { + player.cursorItemIconText = chestName; + } + if (player.cursorItemIconText == chestName) + { + player.cursorItemIconID = ItemType(); + player.cursorItemIconText = ""; + } + } + player.noThrow = 2; + player.cursorItemIconEnabled = true; + if (player.cursorItemIconText == "") + { + player.cursorItemIconEnabled = false; + player.cursorItemIconID = ItemID.None; + } + } + + public static void DresserMouseOver() where T : ModItem + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + string chestName = TileLoader.DefaultContainerName(tile.TileType, tile.TileFrameX, tile.TileFrameY); + int left = Player.tileTargetX; + int top = Player.tileTargetY; + left -= (int)(tile.TileFrameX % 54 / 18); + if (tile.TileFrameY % 36 != 0) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.cursorItemIconID = -1; + if (chestIndex < 0) + { + player.cursorItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.cursorItemIconText = Main.chest[chestIndex].name; + } + else + { + player.cursorItemIconText = chestName; + } + if (player.cursorItemIconText == chestName) + { + player.cursorItemIconID = ItemType(); + player.cursorItemIconText = ""; + } + } + player.noThrow = 2; + player.cursorItemIconEnabled = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].TileFrameY > 0) + { + player.cursorItemIconID = ItemID.FamiliarShirt; + } + } + public static bool DresserRightClick() { Player player = Main.LocalPlayer; @@ -452,43 +512,109 @@ namespace CalamityMod return false; } + public static string GetMapChestName(string baseName, int x, int y) + { + // Bounds check. + if (!WorldGen.InWorld(x, y, 2)) + return baseName; - public static void DresserMouseFar() where T : ModItem + Tile tile = Main.tile[x, y]; + int left = x; + int top = y; + if (tile.TileFrameX % 36 != 0) + left--; + if (tile.TileFrameY != 0) + top--; + + int chest = Chest.FindChest(left, top); + + // Valid chest index check. + if (chest < 0) + return baseName; + + string name = baseName; + + // Concatenate the chest's custom name if it has one. + if (!string.IsNullOrEmpty(Main.chest[chest].name)) + name += $": {Main.chest[chest].name}"; + + return name; + } + + public static void LightHitWire(int type, int i, int j, int tileX, int tileY) + { + int x = i - Main.tile[i, j].TileFrameX / 18 % tileX; + int y = j - Main.tile[i, j].TileFrameY / 18 % tileY; + int tileXX18 = 18 * tileX; + for (int l = x; l < x + tileX; l++) + { + for (int m = y; m < y + tileY; m++) + { + if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == type) + { + if (Main.tile[l, m].TileFrameX < tileXX18) + Main.tile[l, m].TileFrameX += (short)(tileXX18); + else + Main.tile[l, m].TileFrameX -= (short)(tileXX18); + } + } + } + + if (Wiring.running) + { + for (int k = 0; k < tileX; k++) + { + for (int l = 0; l < tileY; l++) + Wiring.SkipWire(x + k, y + l); + } + } + + if (Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendTileSquare(-1, x, y, tileX, tileY); + } + + public static void LockedChestMouseOver(int i, int j) + where K : ModItem where C : ModItem { Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; + Tile tile = Main.tile[i, j]; string chestName = TileLoader.DefaultContainerName(tile.TileType, tile.TileFrameX, tile.TileFrameY); - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.TileFrameX % 54 / 18); - if (tile.TileFrameY % 36 != 0) + int left = i; + int top = j; + if (tile.TileFrameX % 36 != 0) + { + left--; + } + if (tile.TileFrameY != 0) { top--; } - int chestIndex = Chest.FindChest(left, top); + int chest = Chest.FindChest(left, top); player.cursorItemIconID = -1; - if (chestIndex < 0) + if (chest < 0) { - player.cursorItemIconText = Language.GetTextValue("LegacyDresserType.0"); + player.cursorItemIconText = Language.GetTextValue("LegacyChestType.0"); } else { - if (Main.chest[chestIndex].name != "") - { - player.cursorItemIconText = Main.chest[chestIndex].name; - } - else - { - player.cursorItemIconText = chestName; - } + player.cursorItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : chestName; if (player.cursorItemIconText == chestName) { - player.cursorItemIconID = ItemType(); + player.cursorItemIconID = ItemType(); + if (Main.tile[left, top].TileFrameX / 36 == 1) + player.cursorItemIconID = ItemType(); player.cursorItemIconText = ""; } } player.noThrow = 2; player.cursorItemIconEnabled = true; + } + + public static void LockedChestMouseOverFar(int i, int j) + where K : ModItem where C : ModItem + { + LockedChestMouseOver(i, j); + Player player = Main.LocalPlayer; if (player.cursorItemIconText == "") { player.cursorItemIconEnabled = false; @@ -496,48 +622,6 @@ namespace CalamityMod } } - public static void DresserMouseOver() where T : ModItem - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; - string chestName = TileLoader.DefaultContainerName(tile.TileType, tile.TileFrameX, tile.TileFrameY); - int left = Player.tileTargetX; - int top = Player.tileTargetY; - left -= (int)(tile.TileFrameX % 54 / 18); - if (tile.TileFrameY % 36 != 0) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.cursorItemIconID = -1; - if (chestIndex < 0) - { - player.cursorItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.cursorItemIconText = Main.chest[chestIndex].name; - } - else - { - player.cursorItemIconText = chestName; - } - if (player.cursorItemIconText == chestName) - { - player.cursorItemIconID = ItemType(); - player.cursorItemIconText = ""; - } - } - player.noThrow = 2; - player.cursorItemIconEnabled = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].TileFrameY > 0) - { - player.cursorItemIconID = ItemID.FamiliarShirt; - } - } - public static bool LockedChestRightClick(bool isLocked, int left, int top, int i, int j) { Player player = Main.LocalPlayer; @@ -633,53 +717,44 @@ namespace CalamityMod return false; } - public static void LockedChestMouseOver(int i, int j) - where K : ModItem where C : ModItem + public static void MouseOver(int i, int j, int itemID) { Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - string chestName = TileLoader.DefaultContainerName(tile.TileType, tile.TileFrameX, tile.TileFrameY); - int left = i; - int top = j; - if (tile.TileFrameX % 36 != 0) - { - left--; - } - if (tile.TileFrameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.cursorItemIconID = -1; - if (chest < 0) - { - player.cursorItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.cursorItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : chestName; - if (player.cursorItemIconText == chestName) - { - player.cursorItemIconID = ItemType(); - if (Main.tile[left, top].TileFrameX / 36 == 1) - player.cursorItemIconID = ItemType(); - player.cursorItemIconText = ""; - } - } player.noThrow = 2; player.cursorItemIconEnabled = true; + player.cursorItemIconID = itemID; + } + public static void RightClickBreak(int i, int j) + { + if (Main.tile[i, j] != null && Main.tile[i, j].HasTile) + { + WorldGen.KillTile(i, j, false, false, false); + if (!Main.tile[i, j].HasTile && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)i, (float)j, 0f, 0, 0, 0); + } + } } - public static void LockedChestMouseOverFar(int i, int j) - where K : ModItem where C : ModItem + /// + /// Extension which initializes a ModTile to be a 6x6 Painting. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUp6x6Painting(this ModTile mt, bool lavaImmune = false) { - LockedChestMouseOver(i, j); - Player player = Main.LocalPlayer; - if (player.cursorItemIconText == "") - { - player.cursorItemIconEnabled = false; - player.cursorItemIconID = ItemID.None; - } + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileSpelunker[mt.Type] = true; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + TileObjectData.newTile.Width = 6; + TileObjectData.newTile.Height = 6; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16 }; + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.newTile.LavaPlacement = lavaImmune ? LiquidPlacement.Allowed : LiquidPlacement.NotAllowed; + TileObjectData.addTile(mt.Type); } /// @@ -1560,26 +1635,5 @@ namespace CalamityMod mt.AddMapEntry(new Color(191, 142, 111), Language.GetText("ItemName.WorkBench")); mt.AdjTiles = new int[] { TileID.WorkBenches }; } - - /// - /// Extension which initializes a ModTile to be a 6x6 Painting. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUp6x6Painting(this ModTile mt, bool lavaImmune = false) - { - Main.tileFrameImportant[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileSpelunker[mt.Type] = true; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); - TileObjectData.newTile.Width = 6; - TileObjectData.newTile.Height = 6; - TileObjectData.newTile.Origin = new Point16(2, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16 }; - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.newTile.LavaPlacement = lavaImmune ? LiquidPlacement.Allowed : LiquidPlacement.NotAllowed; - TileObjectData.addTile(mt.Type); - } } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs index 5833e8a329..8c9c94fee3 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureCosmilite/CosmiliteBed.cs b/Tiles/FurnitureCosmilite/CosmiliteBed.cs index efc2614562..5c3ecf7d9a 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBed.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs b/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs index 924cb15c1f..a56ab05d59 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteCandle.cs b/Tiles/FurnitureCosmilite/CosmiliteCandle.cs index 51b7cd6d25..c5bdd4fbd5 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteCandle.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteCandle.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, 1, j, 1, 1); + FurnitureCommon.LightHitWire(Type, 1, j, 1, 1); } public override void MouseOver(int i, int j) @@ -52,7 +52,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteChair.cs b/Tiles/FurnitureCosmilite/CosmiliteChair.cs index 6bcbb2bbb7..7f18fffa23 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChair.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChair.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureCosmilite num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs index 01e4933808..175576c442 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteChest.cs b/Tiles/FurnitureCosmilite/CosmiliteChest.cs index 53f67928d7..deb14d4078 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChest.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteClock.cs b/Tiles/FurnitureCosmilite/CosmiliteClock.cs index 96c705f6a1..fe2bd70048 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteClock.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteClock.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -37,6 +37,6 @@ namespace CalamityMod.Tiles.FurnitureCosmilite num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs index 6b86705538..e8c8feaf1e 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDresser.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteLamp.cs b/Tiles/FurnitureCosmilite/CosmiliteLamp.cs index 1ee78c2f63..a1cb5fc085 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLamp.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLamp.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs index a220cc5230..96a9cac8a4 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs index 9c5a82bc23..13a1a60926 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs index 30f363ed8c..ef682ecacd 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureCosmilite num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureDriftwood/DriftwoodBed.cs b/Tiles/FurnitureDriftwood/DriftwoodBed.cs index af9d54a602..b0f9581b78 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodBed.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodBed.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureDriftwood/DriftwoodCandelabra.cs b/Tiles/FurnitureDriftwood/DriftwoodCandelabra.cs index c4e3f3d3fa..4d09f28b99 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodCandelabra.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodCandelabra.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurnitureDriftwood/DriftwoodCandle.cs b/Tiles/FurnitureDriftwood/DriftwoodCandle.cs index 5f3a4dc271..abf75b540b 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodCandle.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodCandle.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, 1, j, 1, 1); + FurnitureCommon.LightHitWire(Type, 1, j, 1, 1); } public override void MouseOver(int i, int j) @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurnitureDriftwood/DriftwoodChair.cs b/Tiles/FurnitureDriftwood/DriftwoodChair.cs index 8f730df91c..7b075c0b95 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodChair.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodChair.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureDriftwood num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureDriftwood/DriftwoodChandelier.cs b/Tiles/FurnitureDriftwood/DriftwoodChandelier.cs index ec52c56ac0..eca2b6e82a 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodChandelier.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodChandelier.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureDriftwood/DriftwoodChest.cs b/Tiles/FurnitureDriftwood/DriftwoodChest.cs index 81b111f0a8..1000feb2ab 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodChest.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodChest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureDriftwood/DriftwoodDresser.cs b/Tiles/FurnitureDriftwood/DriftwoodDresser.cs index 2c0d90f00d..aaa13a257e 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodDresser.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureDriftwood/DriftwoodLamp.cs b/Tiles/FurnitureDriftwood/DriftwoodLamp.cs index abbb1a08ff..0fbb784324 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodLamp.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodLamp.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureDriftwood/DriftwoodLantern.cs b/Tiles/FurnitureDriftwood/DriftwoodLantern.cs index b353d0a228..84dbb0ed96 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodLantern.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodLantern.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureDriftwood/DriftwoodSofa.cs b/Tiles/FurnitureDriftwood/DriftwoodSofa.cs index bf58fb71d9..63e41303bf 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodSofa.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodSofa.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureDriftwood num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureDriftwood/DriftwoodSundial.cs b/Tiles/FurnitureDriftwood/DriftwoodSundial.cs index 96b0860510..ffe24eae10 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodSundial.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodSundial.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Tiles.FurnitureDriftwood public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -36,6 +36,6 @@ namespace CalamityMod.Tiles.FurnitureDriftwood num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureDriftwood/DriftwoodToilet.cs b/Tiles/FurnitureDriftwood/DriftwoodToilet.cs index 157493bf51..ab4a9c6128 100644 --- a/Tiles/FurnitureDriftwood/DriftwoodToilet.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodToilet.cs @@ -48,11 +48,11 @@ namespace CalamityMod.Tiles.FurnitureDriftwood num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, shitter: true); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info, shitter: true); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureExo/ExoBedTile.cs b/Tiles/FurnitureExo/ExoBedTile.cs index c62c17366c..ccbfca3ccf 100644 --- a/Tiles/FurnitureExo/ExoBedTile.cs +++ b/Tiles/FurnitureExo/ExoBedTile.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureExo/ExoCandelabraTile.cs b/Tiles/FurnitureExo/ExoCandelabraTile.cs index 5801cc095b..05f5e2dd73 100644 --- a/Tiles/FurnitureExo/ExoCandelabraTile.cs +++ b/Tiles/FurnitureExo/ExoCandelabraTile.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureExo/ExoCandleTile.cs b/Tiles/FurnitureExo/ExoCandleTile.cs index 15d4b4f4af..7fcfd3fc9a 100644 --- a/Tiles/FurnitureExo/ExoCandleTile.cs +++ b/Tiles/FurnitureExo/ExoCandleTile.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/FurnitureExo/ExoChairTile.cs b/Tiles/FurnitureExo/ExoChairTile.cs index 25a66480a3..ad166b683a 100644 --- a/Tiles/FurnitureExo/ExoChairTile.cs +++ b/Tiles/FurnitureExo/ExoChairTile.cs @@ -83,11 +83,11 @@ namespace CalamityMod.Tiles.FurnitureExo spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, 40, true, true); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info, 40, true, true); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType(), true); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType(), true); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureExo/ExoChandelierTile.cs b/Tiles/FurnitureExo/ExoChandelierTile.cs index 650d9b4a10..209c87e34c 100644 --- a/Tiles/FurnitureExo/ExoChandelierTile.cs +++ b/Tiles/FurnitureExo/ExoChandelierTile.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureExo/ExoChestTile.cs b/Tiles/FurnitureExo/ExoChestTile.cs index 26f0fcae5c..5e1f1f5004 100644 --- a/Tiles/FurnitureExo/ExoChestTile.cs +++ b/Tiles/FurnitureExo/ExoChestTile.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true, 2); - AddMapEntry(new Color(71, 95, 114), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(71, 95, 114), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CanExplode(int i, int j) => false; @@ -31,10 +31,10 @@ namespace CalamityMod.Tiles.FurnitureExo public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureExo/ExoClockTile.cs b/Tiles/FurnitureExo/ExoClockTile.cs index 460d44667e..9958b49627 100644 --- a/Tiles/FurnitureExo/ExoClockTile.cs +++ b/Tiles/FurnitureExo/ExoClockTile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Tiles.FurnitureExo return false; } - public override bool RightClick(int x, int y) => CalamityUtils.ClockRightClick(); + public override bool RightClick(int x, int y) => FurnitureCommon.ClockRightClick(); public override void NearbyEffects(int i, int j, bool closer) { @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureExo num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureExo/ExoDresserTile.cs b/Tiles/FurnitureExo/ExoDresserTile.cs index 3030299d07..774d2d15ee 100644 --- a/Tiles/FurnitureExo/ExoDresserTile.cs +++ b/Tiles/FurnitureExo/ExoDresserTile.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CanExplode(int i, int j) => false; @@ -30,10 +30,10 @@ namespace CalamityMod.Tiles.FurnitureExo public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureExo/ExoLampTile.cs b/Tiles/FurnitureExo/ExoLampTile.cs index 94aedbc7e5..456497284a 100644 --- a/Tiles/FurnitureExo/ExoLampTile.cs +++ b/Tiles/FurnitureExo/ExoLampTile.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureExo/ExoLanternTile.cs b/Tiles/FurnitureExo/ExoLanternTile.cs index 8946144fcf..92e9806044 100644 --- a/Tiles/FurnitureExo/ExoLanternTile.cs +++ b/Tiles/FurnitureExo/ExoLanternTile.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.FurnitureExo public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureExo/ExoPrismPlatformTile.cs b/Tiles/FurnitureExo/ExoPrismPlatformTile.cs index aee4df9a8e..ac921a8589 100644 --- a/Tiles/FurnitureExo/ExoPrismPlatformTile.cs +++ b/Tiles/FurnitureExo/ExoPrismPlatformTile.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Tiles.FurnitureExo { GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoPrismPlatformTileGlow", AssetRequestMode.ImmediateLoad).Value; } - this.SetUpPlatform(ModContent.ItemType(), true); AnimationFrameHeight = 18; } diff --git a/Tiles/FurnitureExo/ExoSofaTile.cs b/Tiles/FurnitureExo/ExoSofaTile.cs index aa4f6aa825..2987be3783 100644 --- a/Tiles/FurnitureExo/ExoSofaTile.cs +++ b/Tiles/FurnitureExo/ExoSofaTile.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Tiles.FurnitureExo num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureExo/ExoToiletTile.cs b/Tiles/FurnitureExo/ExoToiletTile.cs index 9732706cb2..00b06bd737 100644 --- a/Tiles/FurnitureExo/ExoToiletTile.cs +++ b/Tiles/FurnitureExo/ExoToiletTile.cs @@ -84,11 +84,11 @@ namespace CalamityMod.Tiles.FurnitureExo spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, NextStyleHeight, true, shitter: true); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info, NextStyleHeight, true, shitter: true); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType(), true); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType(), true); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureMarnite/MarniteBed.cs b/Tiles/FurnitureMarnite/MarniteBed.cs index 39bbcd8dac..8cbde3bf2a 100644 --- a/Tiles/FurnitureMarnite/MarniteBed.cs +++ b/Tiles/FurnitureMarnite/MarniteBed.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureMarnite/MarniteCandelabra.cs b/Tiles/FurnitureMarnite/MarniteCandelabra.cs index 8a58e30836..1ffac23bd2 100644 --- a/Tiles/FurnitureMarnite/MarniteCandelabra.cs +++ b/Tiles/FurnitureMarnite/MarniteCandelabra.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurnitureMarnite/MarniteCandle.cs b/Tiles/FurnitureMarnite/MarniteCandle.cs index 59df314c56..2e2fd30759 100644 --- a/Tiles/FurnitureMarnite/MarniteCandle.cs +++ b/Tiles/FurnitureMarnite/MarniteCandle.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurnitureMarnite/MarniteChair.cs b/Tiles/FurnitureMarnite/MarniteChair.cs index c12256ef08..2e45ccfe4d 100644 --- a/Tiles/FurnitureMarnite/MarniteChair.cs +++ b/Tiles/FurnitureMarnite/MarniteChair.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureMarnite num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureMarnite/MarniteChandelier.cs b/Tiles/FurnitureMarnite/MarniteChandelier.cs index 1e979e48c4..94734007a7 100644 --- a/Tiles/FurnitureMarnite/MarniteChandelier.cs +++ b/Tiles/FurnitureMarnite/MarniteChandelier.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureMarnite/MarniteChest.cs b/Tiles/FurnitureMarnite/MarniteChest.cs index 195247b30f..bed7bffc67 100644 --- a/Tiles/FurnitureMarnite/MarniteChest.cs +++ b/Tiles/FurnitureMarnite/MarniteChest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureMarnite/MarniteClock.cs b/Tiles/FurnitureMarnite/MarniteClock.cs index 5411f92ebb..40eee6d636 100644 --- a/Tiles/FurnitureMarnite/MarniteClock.cs +++ b/Tiles/FurnitureMarnite/MarniteClock.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -40,6 +40,6 @@ namespace CalamityMod.Tiles.FurnitureMarnite } } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureMarnite/MarniteDresser.cs b/Tiles/FurnitureMarnite/MarniteDresser.cs index 1fb0e65101..d7267513ae 100644 --- a/Tiles/FurnitureMarnite/MarniteDresser.cs +++ b/Tiles/FurnitureMarnite/MarniteDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureMarnite/MarniteLamp.cs b/Tiles/FurnitureMarnite/MarniteLamp.cs index af684fc3d2..ebecc07f93 100644 --- a/Tiles/FurnitureMarnite/MarniteLamp.cs +++ b/Tiles/FurnitureMarnite/MarniteLamp.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureMarnite/MarniteLantern.cs b/Tiles/FurnitureMarnite/MarniteLantern.cs index 808673bd37..82b8d026b8 100644 --- a/Tiles/FurnitureMarnite/MarniteLantern.cs +++ b/Tiles/FurnitureMarnite/MarniteLantern.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureMarnite/MarniteLight.cs b/Tiles/FurnitureMarnite/MarniteLight.cs index 0b1ba87731..e335735117 100644 --- a/Tiles/FurnitureMarnite/MarniteLight.cs +++ b/Tiles/FurnitureMarnite/MarniteLight.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.FurnitureMarnite public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } //This should probably give torch luck in granite AND marble biomes, this was originally planned for Catalyst diff --git a/Tiles/FurnitureMarnite/MarniteSofa.cs b/Tiles/FurnitureMarnite/MarniteSofa.cs index d2f3eda4f5..e900bca641 100644 --- a/Tiles/FurnitureMarnite/MarniteSofa.cs +++ b/Tiles/FurnitureMarnite/MarniteSofa.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureMarnite num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureMarnite/MarniteToilet.cs b/Tiles/FurnitureMarnite/MarniteToilet.cs index e26345578f..ac1087cda1 100644 --- a/Tiles/FurnitureMarnite/MarniteToilet.cs +++ b/Tiles/FurnitureMarnite/MarniteToilet.cs @@ -48,11 +48,11 @@ namespace CalamityMod.Tiles.FurnitureMarnite num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, shitter: true); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info, shitter: true); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureMonolith/MonolithBed.cs b/Tiles/FurnitureMonolith/MonolithBed.cs index b6a52d4224..3cae0a4930 100644 --- a/Tiles/FurnitureMonolith/MonolithBed.cs +++ b/Tiles/FurnitureMonolith/MonolithBed.cs @@ -44,8 +44,8 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureMonolith/MonolithBench.cs b/Tiles/FurnitureMonolith/MonolithBench.cs index 556e9d3b3c..c9a7dc700e 100644 --- a/Tiles/FurnitureMonolith/MonolithBench.cs +++ b/Tiles/FurnitureMonolith/MonolithBench.cs @@ -43,11 +43,11 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureMonolith/MonolithCandelabra.cs b/Tiles/FurnitureMonolith/MonolithCandelabra.cs index 1e68e710f0..699c5427ae 100644 --- a/Tiles/FurnitureMonolith/MonolithCandelabra.cs +++ b/Tiles/FurnitureMonolith/MonolithCandelabra.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurnitureMonolith/MonolithCandle.cs b/Tiles/FurnitureMonolith/MonolithCandle.cs index 0907a00fb4..7f4d1b6a3b 100644 --- a/Tiles/FurnitureMonolith/MonolithCandle.cs +++ b/Tiles/FurnitureMonolith/MonolithCandle.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -74,7 +74,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurnitureMonolith/MonolithChair.cs b/Tiles/FurnitureMonolith/MonolithChair.cs index 44432bb977..b92a8f9bfe 100644 --- a/Tiles/FurnitureMonolith/MonolithChair.cs +++ b/Tiles/FurnitureMonolith/MonolithChair.cs @@ -41,11 +41,11 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(GlowTexture.Value, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureMonolith/MonolithChandelier.cs b/Tiles/FurnitureMonolith/MonolithChandelier.cs index 9dd32646e2..67d8b139a9 100644 --- a/Tiles/FurnitureMonolith/MonolithChandelier.cs +++ b/Tiles/FurnitureMonolith/MonolithChandelier.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureMonolith/MonolithChest.cs b/Tiles/FurnitureMonolith/MonolithChest.cs index 5d348c7b29..beee38d84e 100644 --- a/Tiles/FurnitureMonolith/MonolithChest.cs +++ b/Tiles/FurnitureMonolith/MonolithChest.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -31,8 +31,8 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); public override bool RightClick(int i, int j) { @@ -62,7 +62,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith } } - return CalamityUtils.ChestRightClick(i, j); + return FurnitureCommon.ChestRightClick(i, j); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureMonolith/MonolithClock.cs b/Tiles/FurnitureMonolith/MonolithClock.cs index dae2c336c6..0a253676cc 100644 --- a/Tiles/FurnitureMonolith/MonolithClock.cs +++ b/Tiles/FurnitureMonolith/MonolithClock.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -54,6 +54,6 @@ namespace CalamityMod.Tiles.FurnitureMonolith } } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureMonolith/MonolithDresser.cs b/Tiles/FurnitureMonolith/MonolithDresser.cs index ea61855729..159a0f18d4 100644 --- a/Tiles/FurnitureMonolith/MonolithDresser.cs +++ b/Tiles/FurnitureMonolith/MonolithDresser.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -28,10 +28,10 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureMonolith/MonolithLamp.cs b/Tiles/FurnitureMonolith/MonolithLamp.cs index b9e35ff19a..4b55adae89 100644 --- a/Tiles/FurnitureMonolith/MonolithLamp.cs +++ b/Tiles/FurnitureMonolith/MonolithLamp.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureMonolith/MonolithLantern.cs b/Tiles/FurnitureMonolith/MonolithLantern.cs index ab9b0e5a45..30c5856b3a 100644 --- a/Tiles/FurnitureMonolith/MonolithLantern.cs +++ b/Tiles/FurnitureMonolith/MonolithLantern.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.cs index a8d3e2b403..b70b2a4802 100644 --- a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.cs index 10e7e3fe2b..1c576e4a5a 100644 --- a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.cs index c98491aaa5..7bef64fa3c 100644 --- a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.cs index c5ec992870..7404840095 100644 --- a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -52,7 +52,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.cs index 7baefbb973..bdf8c22e61 100644 --- a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.cs index 4ca18e0ca4..5e68b51d3a 100644 --- a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.cs index 3677bff276..e2abdce520 100644 --- a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.cs index a4b73e2700..3e5181b917 100644 --- a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -53,6 +53,6 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone } } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.cs index be8cbe7258..5211b274cb 100644 --- a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.cs index ad6db914c5..6f85a8eb76 100644 --- a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.cs index 68c39d9298..ab63e76c43 100644 --- a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureNavystone/NavystoneBed.cs b/Tiles/FurnitureNavystone/NavystoneBed.cs index 31c8888783..0610cb397a 100644 --- a/Tiles/FurnitureNavystone/NavystoneBed.cs +++ b/Tiles/FurnitureNavystone/NavystoneBed.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureNavystone/NavystoneCandelabra.cs b/Tiles/FurnitureNavystone/NavystoneCandelabra.cs index 61b6bcc3d8..f51a0eb395 100644 --- a/Tiles/FurnitureNavystone/NavystoneCandelabra.cs +++ b/Tiles/FurnitureNavystone/NavystoneCandelabra.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurnitureNavystone/NavystoneCandle.cs b/Tiles/FurnitureNavystone/NavystoneCandle.cs index 895adafb2b..12a0b83b1b 100644 --- a/Tiles/FurnitureNavystone/NavystoneCandle.cs +++ b/Tiles/FurnitureNavystone/NavystoneCandle.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurnitureNavystone/NavystoneChair.cs b/Tiles/FurnitureNavystone/NavystoneChair.cs index d06a33c753..fb7a53f1f6 100644 --- a/Tiles/FurnitureNavystone/NavystoneChair.cs +++ b/Tiles/FurnitureNavystone/NavystoneChair.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureNavystone num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureNavystone/NavystoneChandelier.cs b/Tiles/FurnitureNavystone/NavystoneChandelier.cs index 0c681e1693..982a8ffaa8 100644 --- a/Tiles/FurnitureNavystone/NavystoneChandelier.cs +++ b/Tiles/FurnitureNavystone/NavystoneChandelier.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureNavystone/NavystoneChest.cs b/Tiles/FurnitureNavystone/NavystoneChest.cs index 232e559bea..24e9543744 100644 --- a/Tiles/FurnitureNavystone/NavystoneChest.cs +++ b/Tiles/FurnitureNavystone/NavystoneChest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureNavystone/NavystoneClock.cs b/Tiles/FurnitureNavystone/NavystoneClock.cs index 98806da830..237fecd83c 100644 --- a/Tiles/FurnitureNavystone/NavystoneClock.cs +++ b/Tiles/FurnitureNavystone/NavystoneClock.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -52,6 +52,6 @@ namespace CalamityMod.Tiles.FurnitureNavystone } } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureNavystone/NavystoneDresser.cs b/Tiles/FurnitureNavystone/NavystoneDresser.cs index 1084bee069..0c01b562bf 100644 --- a/Tiles/FurnitureNavystone/NavystoneDresser.cs +++ b/Tiles/FurnitureNavystone/NavystoneDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureNavystone/NavystoneLamp.cs b/Tiles/FurnitureNavystone/NavystoneLamp.cs index bd7f000af4..be16be5ca3 100644 --- a/Tiles/FurnitureNavystone/NavystoneLamp.cs +++ b/Tiles/FurnitureNavystone/NavystoneLamp.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureNavystone/NavystoneLantern.cs b/Tiles/FurnitureNavystone/NavystoneLantern.cs index b7ef1ce6cc..3d39c567bf 100644 --- a/Tiles/FurnitureNavystone/NavystoneLantern.cs +++ b/Tiles/FurnitureNavystone/NavystoneLantern.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureNavystone public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureNavystone/NavystoneToilet.cs b/Tiles/FurnitureNavystone/NavystoneToilet.cs index 6641f4eb4d..7e4c67f640 100644 --- a/Tiles/FurnitureNavystone/NavystoneToilet.cs +++ b/Tiles/FurnitureNavystone/NavystoneToilet.cs @@ -48,11 +48,11 @@ namespace CalamityMod.Tiles.FurnitureNavystone num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, shitter: true); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info, shitter: true); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureNavystone/NavystoneTriclinium.cs b/Tiles/FurnitureNavystone/NavystoneTriclinium.cs index 41251b0b2d..e2da163b54 100644 --- a/Tiles/FurnitureNavystone/NavystoneTriclinium.cs +++ b/Tiles/FurnitureNavystone/NavystoneTriclinium.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureNavystone num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs b/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs index 26d5307a60..1b8da8fbe1 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyBed.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyCandelabra.cs b/Tiles/FurnitureOtherworldly/OtherworldlyCandelabra.cs index b2b86dd2ef..abb59908c0 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyCandelabra.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyCandelabra.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyCandle.cs b/Tiles/FurnitureOtherworldly/OtherworldlyCandle.cs index b61dec5702..5860a8a4ff 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyCandle.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyCandle.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -54,7 +54,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs b/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs index 28791c6901..e48e61657e 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyChair.cs @@ -26,11 +26,11 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs b/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs index 7180331195..ff39bfad86 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyChandelier.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyChest.cs b/Tiles/FurnitureOtherworldly/OtherworldlyChest.cs index fb1a5c126a..a4f45939b1 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyChest.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyChest.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -27,9 +27,9 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs b/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs index ee87aee50c..e0162aca8c 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyClock.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -39,6 +39,6 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly } } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyDresser.cs b/Tiles/FurnitureOtherworldly/OtherworldlyDresser.cs index a090ae75ee..31f4a2100a 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyDresser.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyDresser.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -27,9 +27,9 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyLamp.cs b/Tiles/FurnitureOtherworldly/OtherworldlyLamp.cs index f80627967c..b8547b8e93 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyLamp.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyLamp.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs b/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs index 919c12d846..7e900083f4 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyLantern.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs b/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs index 76ed16933e..b82f0feac3 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlySofa.cs @@ -26,11 +26,11 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs index 56be9d5013..eca6b86c5c 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs index be6a72c5b6..9ec4004921 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -62,6 +62,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate return true; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs index 4dcfc0650d..1b6f6359e1 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs index b73eb77360..d1a2e57e4b 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs index fe7d8ca96d..c7d4e1a3cc 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index ff026cfb60..45570bc8ba 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs index 1c5b2bcdd5..e8ae5291dc 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs index 5893face2d..cfd86cb9ec 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override bool CreateDust(int i, int j, ref int type) @@ -36,6 +36,6 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate } } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs index 35a589cd5f..08eee6731a 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs index 9f3095a522..ec7a85d9c0 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs index 98a049ecd6..a173c77173 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs index a8687a9fa4..081e824170 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureProfaned/ProfanedBed.cs b/Tiles/FurnitureProfaned/ProfanedBed.cs index fde33ba98d..1e51734c29 100644 --- a/Tiles/FurnitureProfaned/ProfanedBed.cs +++ b/Tiles/FurnitureProfaned/ProfanedBed.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureProfaned/ProfanedBench.cs b/Tiles/FurnitureProfaned/ProfanedBench.cs index e3a6fb359e..06a5fe59ed 100644 --- a/Tiles/FurnitureProfaned/ProfanedBench.cs +++ b/Tiles/FurnitureProfaned/ProfanedBench.cs @@ -25,11 +25,11 @@ namespace CalamityMod.Tiles.FurnitureProfaned num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureProfaned/ProfanedCandelabra.cs b/Tiles/FurnitureProfaned/ProfanedCandelabra.cs index 3ec150bc28..e40c1bc4cd 100644 --- a/Tiles/FurnitureProfaned/ProfanedCandelabra.cs +++ b/Tiles/FurnitureProfaned/ProfanedCandelabra.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureProfaned/ProfanedCandle.cs b/Tiles/FurnitureProfaned/ProfanedCandle.cs index b94523682f..33786cbe96 100644 --- a/Tiles/FurnitureProfaned/ProfanedCandle.cs +++ b/Tiles/FurnitureProfaned/ProfanedCandle.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/FurnitureProfaned/ProfanedChair.cs b/Tiles/FurnitureProfaned/ProfanedChair.cs index 946987583d..f5185083b2 100644 --- a/Tiles/FurnitureProfaned/ProfanedChair.cs +++ b/Tiles/FurnitureProfaned/ProfanedChair.cs @@ -25,11 +25,11 @@ namespace CalamityMod.Tiles.FurnitureProfaned num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureProfaned/ProfanedChandelier.cs b/Tiles/FurnitureProfaned/ProfanedChandelier.cs index c832c859ce..10e48fb236 100644 --- a/Tiles/FurnitureProfaned/ProfanedChandelier.cs +++ b/Tiles/FurnitureProfaned/ProfanedChandelier.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureProfaned/ProfanedChest.cs b/Tiles/FurnitureProfaned/ProfanedChest.cs index cd9a2965eb..13e9075bf5 100644 --- a/Tiles/FurnitureProfaned/ProfanedChest.cs +++ b/Tiles/FurnitureProfaned/ProfanedChest.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -26,9 +26,9 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureProfaned/ProfanedClock.cs b/Tiles/FurnitureProfaned/ProfanedClock.cs index 2501ceee5f..c90c652fe9 100644 --- a/Tiles/FurnitureProfaned/ProfanedClock.cs +++ b/Tiles/FurnitureProfaned/ProfanedClock.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -38,6 +38,6 @@ namespace CalamityMod.Tiles.FurnitureProfaned } } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureProfaned/ProfanedDresser.cs b/Tiles/FurnitureProfaned/ProfanedDresser.cs index 0b9b45abab..fd906d85e6 100644 --- a/Tiles/FurnitureProfaned/ProfanedDresser.cs +++ b/Tiles/FurnitureProfaned/ProfanedDresser.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -26,9 +26,9 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureProfaned/ProfanedLamp.cs b/Tiles/FurnitureProfaned/ProfanedLamp.cs index 889148aa39..4ed44f8121 100644 --- a/Tiles/FurnitureProfaned/ProfanedLamp.cs +++ b/Tiles/FurnitureProfaned/ProfanedLamp.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureProfaned/ProfanedLantern.cs b/Tiles/FurnitureProfaned/ProfanedLantern.cs index 5d142f4db2..5ebce76107 100644 --- a/Tiles/FurnitureProfaned/ProfanedLantern.cs +++ b/Tiles/FurnitureProfaned/ProfanedLantern.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) diff --git a/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs index 4fba6f33d3..946accf5bb 100644 --- a/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs +++ b/Tiles/FurnitureSacrilegious/LargeRitualCandleTile.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 6); + FurnitureCommon.LightHitWire(Type, i, j, 2, 6); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs index 6ef6301f57..fd33d3371a 100644 --- a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs +++ b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); // For drawing the floating icon public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureSacrilegious/RitualCandleTile.cs b/Tiles/FurnitureSacrilegious/RitualCandleTile.cs index cf142b5b19..fc6ecdda97 100644 --- a/Tiles/FurnitureSacrilegious/RitualCandleTile.cs +++ b/Tiles/FurnitureSacrilegious/RitualCandleTile.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.cs index ba542aa035..fcaf0bbcf9 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousBedTile.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.cs index 61ee2f146f..1b1d2ee90a 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousBenchTile.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.cs index b3cf74959b..775db7e993 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousCandelabraTile.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.cs index fd9750c559..480c9f89f3 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousCandleTile.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -57,7 +57,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.cs index 08d0042ceb..ea4859a399 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChairTile.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs index 0740abdab5..1ac5de6fea 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChandelierTile.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs index 4a98fb9dab..f674577d5a 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(43, 19, 42), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(43, 19, 42), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -30,10 +30,10 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); // Make the chest brighter the more stuff it has public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs index 3c31bd81f7..21417acc1d 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious // This particular clock emits light Main.tileLighted[Type] = true; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - this.SetUpClock(ModContent.ItemType(), true); } @@ -39,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious b = 0.2f; } - public override bool RightClick(int x, int y) => CalamityUtils.ClockRightClick(); + public override bool RightClick(int x, int y) => FurnitureCommon.ClockRightClick(); public override void NearbyEffects(int i, int j, bool closer) { @@ -54,7 +53,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); // For drawing the floating clock icon public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.cs index de22f04c1a..3ab474bb18 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousDresserTile.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.cs index 8d4767c1b5..0e948c46b3 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousLampTile.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs index 456a13d127..70bc7bb261 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureSilva/SilvaBasin.cs b/Tiles/FurnitureSilva/SilvaBasin.cs index e8700ce23a..53df3ac099 100644 --- a/Tiles/FurnitureSilva/SilvaBasin.cs +++ b/Tiles/FurnitureSilva/SilvaBasin.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureSilva/SilvaBed.cs b/Tiles/FurnitureSilva/SilvaBed.cs index 4f1ef100c1..2c17c92d66 100644 --- a/Tiles/FurnitureSilva/SilvaBed.cs +++ b/Tiles/FurnitureSilva/SilvaBed.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureSilva/SilvaBench.cs b/Tiles/FurnitureSilva/SilvaBench.cs index a21558638e..e1dccc110f 100644 --- a/Tiles/FurnitureSilva/SilvaBench.cs +++ b/Tiles/FurnitureSilva/SilvaBench.cs @@ -25,11 +25,11 @@ namespace CalamityMod.Tiles.FurnitureSilva num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureSilva/SilvaCandelabra.cs b/Tiles/FurnitureSilva/SilvaCandelabra.cs index 747c08e45f..7c55130a30 100644 --- a/Tiles/FurnitureSilva/SilvaCandelabra.cs +++ b/Tiles/FurnitureSilva/SilvaCandelabra.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurnitureSilva/SilvaCandle.cs b/Tiles/FurnitureSilva/SilvaCandle.cs index ae1a7bca85..f7c936b130 100644 --- a/Tiles/FurnitureSilva/SilvaCandle.cs +++ b/Tiles/FurnitureSilva/SilvaCandle.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurnitureSilva/SilvaChair.cs b/Tiles/FurnitureSilva/SilvaChair.cs index 3fd04494d7..a8bacc1565 100644 --- a/Tiles/FurnitureSilva/SilvaChair.cs +++ b/Tiles/FurnitureSilva/SilvaChair.cs @@ -25,11 +25,11 @@ namespace CalamityMod.Tiles.FurnitureSilva num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureSilva/SilvaChandelier.cs b/Tiles/FurnitureSilva/SilvaChandelier.cs index effeefc0c4..b89067275d 100644 --- a/Tiles/FurnitureSilva/SilvaChandelier.cs +++ b/Tiles/FurnitureSilva/SilvaChandelier.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureSilva/SilvaChest.cs b/Tiles/FurnitureSilva/SilvaChest.cs index 3bf50fecd6..9f961a9e98 100644 --- a/Tiles/FurnitureSilva/SilvaChest.cs +++ b/Tiles/FurnitureSilva/SilvaChest.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -26,9 +26,9 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureSilva/SilvaClock.cs b/Tiles/FurnitureSilva/SilvaClock.cs index 22a2c2b55a..2d3545e4e8 100644 --- a/Tiles/FurnitureSilva/SilvaClock.cs +++ b/Tiles/FurnitureSilva/SilvaClock.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -38,6 +38,6 @@ namespace CalamityMod.Tiles.FurnitureSilva } } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureSilva/SilvaDresser.cs b/Tiles/FurnitureSilva/SilvaDresser.cs index 43c30508c9..9671aa24f0 100644 --- a/Tiles/FurnitureSilva/SilvaDresser.cs +++ b/Tiles/FurnitureSilva/SilvaDresser.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -26,9 +26,9 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureSilva/SilvaLamp.cs b/Tiles/FurnitureSilva/SilvaLamp.cs index 341872b778..7ade6e44d5 100644 --- a/Tiles/FurnitureSilva/SilvaLamp.cs +++ b/Tiles/FurnitureSilva/SilvaLamp.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureSilva/SilvaLantern.cs b/Tiles/FurnitureSilva/SilvaLantern.cs index 50b226b3fd..b902f268ea 100644 --- a/Tiles/FurnitureSilva/SilvaLantern.cs +++ b/Tiles/FurnitureSilva/SilvaLantern.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureStatigel/StatigelBed.cs b/Tiles/FurnitureStatigel/StatigelBed.cs index 791ea04221..f1b1aa22b7 100644 --- a/Tiles/FurnitureStatigel/StatigelBed.cs +++ b/Tiles/FurnitureStatigel/StatigelBed.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureStatigel/StatigelCandelabra.cs b/Tiles/FurnitureStatigel/StatigelCandelabra.cs index 7531ae8602..e5323a0c81 100644 --- a/Tiles/FurnitureStatigel/StatigelCandelabra.cs +++ b/Tiles/FurnitureStatigel/StatigelCandelabra.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureStatigel/StatigelCandle.cs b/Tiles/FurnitureStatigel/StatigelCandle.cs index 6a64a4c3d1..141090d016 100644 --- a/Tiles/FurnitureStatigel/StatigelCandle.cs +++ b/Tiles/FurnitureStatigel/StatigelCandle.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -55,7 +55,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/FurnitureStatigel/StatigelChair.cs b/Tiles/FurnitureStatigel/StatigelChair.cs index 9c9cd11fb9..734bc38e74 100644 --- a/Tiles/FurnitureStatigel/StatigelChair.cs +++ b/Tiles/FurnitureStatigel/StatigelChair.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureStatigel num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureStatigel/StatigelChandelier.cs b/Tiles/FurnitureStatigel/StatigelChandelier.cs index c5587ea2f3..5e5b4b66f8 100644 --- a/Tiles/FurnitureStatigel/StatigelChandelier.cs +++ b/Tiles/FurnitureStatigel/StatigelChandelier.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureStatigel/StatigelChest.cs b/Tiles/FurnitureStatigel/StatigelChest.cs index 4939e94c8e..78634cf395 100644 --- a/Tiles/FurnitureStatigel/StatigelChest.cs +++ b/Tiles/FurnitureStatigel/StatigelChest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureStatigel/StatigelClock.cs b/Tiles/FurnitureStatigel/StatigelClock.cs index b237d509b0..a0061da47b 100644 --- a/Tiles/FurnitureStatigel/StatigelClock.cs +++ b/Tiles/FurnitureStatigel/StatigelClock.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -36,6 +36,6 @@ namespace CalamityMod.Tiles.FurnitureStatigel num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureStatigel/StatigelDresser.cs b/Tiles/FurnitureStatigel/StatigelDresser.cs index 23eef161ea..35a407d8d2 100644 --- a/Tiles/FurnitureStatigel/StatigelDresser.cs +++ b/Tiles/FurnitureStatigel/StatigelDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureStatigel/StatigelLamp.cs b/Tiles/FurnitureStatigel/StatigelLamp.cs index a089e60702..49418ea1b4 100644 --- a/Tiles/FurnitureStatigel/StatigelLamp.cs +++ b/Tiles/FurnitureStatigel/StatigelLamp.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureStatigel/StatigelLantern.cs b/Tiles/FurnitureStatigel/StatigelLantern.cs index b31e99ef26..c6a6590c32 100644 --- a/Tiles/FurnitureStatigel/StatigelLantern.cs +++ b/Tiles/FurnitureStatigel/StatigelLantern.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureStatigel/StatigelSofa.cs b/Tiles/FurnitureStatigel/StatigelSofa.cs index a350b6c350..1fbc72a8b8 100644 --- a/Tiles/FurnitureStatigel/StatigelSofa.cs +++ b/Tiles/FurnitureStatigel/StatigelSofa.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureStatigel num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureStratus/StratusBed.cs b/Tiles/FurnitureStratus/StratusBed.cs index f24834a6a7..7c08941997 100644 --- a/Tiles/FurnitureStratus/StratusBed.cs +++ b/Tiles/FurnitureStratus/StratusBed.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Tiles.FurnitureStratus num = fail ? 1 : 3; } - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureStratus/StratusCandelabra.cs b/Tiles/FurnitureStratus/StratusCandelabra.cs index 2d913504d6..df636fdcac 100644 --- a/Tiles/FurnitureStratus/StratusCandelabra.cs +++ b/Tiles/FurnitureStratus/StratusCandelabra.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureStratus/StratusCandle.cs b/Tiles/FurnitureStratus/StratusCandle.cs index 46c40333c3..35b9dc7e73 100644 --- a/Tiles/FurnitureStratus/StratusCandle.cs +++ b/Tiles/FurnitureStratus/StratusCandle.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -56,7 +56,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/FurnitureStratus/StratusChair.cs b/Tiles/FurnitureStratus/StratusChair.cs index 9b4dccc784..d264e36714 100644 --- a/Tiles/FurnitureStratus/StratusChair.cs +++ b/Tiles/FurnitureStratus/StratusChair.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureStratus num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureStratus/StratusChandelier.cs b/Tiles/FurnitureStratus/StratusChandelier.cs index a173579ebb..d45e6bd62d 100644 --- a/Tiles/FurnitureStratus/StratusChandelier.cs +++ b/Tiles/FurnitureStratus/StratusChandelier.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) diff --git a/Tiles/FurnitureStratus/StratusChest.cs b/Tiles/FurnitureStratus/StratusChest.cs index 21caec6f74..36094c695a 100644 --- a/Tiles/FurnitureStratus/StratusChest.cs +++ b/Tiles/FurnitureStratus/StratusChest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureStratus/StratusClock.cs b/Tiles/FurnitureStratus/StratusClock.cs index c5a52534f3..1f02504a72 100644 --- a/Tiles/FurnitureStratus/StratusClock.cs +++ b/Tiles/FurnitureStratus/StratusClock.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -37,6 +37,6 @@ namespace CalamityMod.Tiles.FurnitureStratus num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureStratus/StratusDresser.cs b/Tiles/FurnitureStratus/StratusDresser.cs index da8e9ec690..b091420c43 100644 --- a/Tiles/FurnitureStratus/StratusDresser.cs +++ b/Tiles/FurnitureStratus/StratusDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -25,9 +25,9 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureStratus/StratusLamp.cs b/Tiles/FurnitureStratus/StratusLamp.cs index 1a269f713b..637e1ebc84 100644 --- a/Tiles/FurnitureStratus/StratusLamp.cs +++ b/Tiles/FurnitureStratus/StratusLamp.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureStratus/StratusLantern.cs b/Tiles/FurnitureStratus/StratusLantern.cs index be68e423d0..30cc31c27b 100644 --- a/Tiles/FurnitureStratus/StratusLantern.cs +++ b/Tiles/FurnitureStratus/StratusLantern.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureStratus/StratusSofa.cs b/Tiles/FurnitureStratus/StratusSofa.cs index a0d409ce33..56fabda8b7 100644 --- a/Tiles/FurnitureStratus/StratusSofa.cs +++ b/Tiles/FurnitureStratus/StratusSofa.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Tiles.FurnitureStratus num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureVoid/VoidBed.cs b/Tiles/FurnitureVoid/VoidBed.cs index bfffd91a3c..403567ae30 100644 --- a/Tiles/FurnitureVoid/VoidBed.cs +++ b/Tiles/FurnitureVoid/VoidBed.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Tiles.FurnitureVoid num = fail ? 1 : 3; } - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureVoid/VoidCandelabra.cs b/Tiles/FurnitureVoid/VoidCandelabra.cs index 9ba1e8ab86..a3d336228c 100644 --- a/Tiles/FurnitureVoid/VoidCandelabra.cs +++ b/Tiles/FurnitureVoid/VoidCandelabra.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } } } diff --git a/Tiles/FurnitureVoid/VoidCandle.cs b/Tiles/FurnitureVoid/VoidCandle.cs index c164925c38..5486ea3053 100644 --- a/Tiles/FurnitureVoid/VoidCandle.cs +++ b/Tiles/FurnitureVoid/VoidCandle.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -51,7 +51,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } } diff --git a/Tiles/FurnitureVoid/VoidChair.cs b/Tiles/FurnitureVoid/VoidChair.cs index 1385d0f42d..e146d6da90 100644 --- a/Tiles/FurnitureVoid/VoidChair.cs +++ b/Tiles/FurnitureVoid/VoidChair.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureVoid num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureVoid/VoidChandelier.cs b/Tiles/FurnitureVoid/VoidChandelier.cs index eb73bf5328..c860bd0d62 100644 --- a/Tiles/FurnitureVoid/VoidChandelier.cs +++ b/Tiles/FurnitureVoid/VoidChandelier.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureVoid/VoidChest.cs b/Tiles/FurnitureVoid/VoidChest.cs index 108abdaffa..f80c17bae3 100644 --- a/Tiles/FurnitureVoid/VoidChest.cs +++ b/Tiles/FurnitureVoid/VoidChest.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); } } diff --git a/Tiles/FurnitureVoid/VoidClock.cs b/Tiles/FurnitureVoid/VoidClock.cs index 77a32eda66..b1114183f3 100644 --- a/Tiles/FurnitureVoid/VoidClock.cs +++ b/Tiles/FurnitureVoid/VoidClock.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override bool RightClick(int x, int y) { - return CalamityUtils.ClockRightClick(); + return FurnitureCommon.ClockRightClick(); } public override void NearbyEffects(int i, int j, bool closer) @@ -50,6 +50,6 @@ namespace CalamityMod.Tiles.FurnitureVoid num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureVoid/VoidDresser.cs b/Tiles/FurnitureVoid/VoidDresser.cs index 594855f047..2b05b0fa31 100644 --- a/Tiles/FurnitureVoid/VoidDresser.cs +++ b/Tiles/FurnitureVoid/VoidDresser.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -24,9 +24,9 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); } } diff --git a/Tiles/FurnitureVoid/VoidLamp.cs b/Tiles/FurnitureVoid/VoidLamp.cs index b8ab225744..e62b64d34d 100644 --- a/Tiles/FurnitureVoid/VoidLamp.cs +++ b/Tiles/FurnitureVoid/VoidLamp.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureVoid/VoidLantern.cs b/Tiles/FurnitureVoid/VoidLantern.cs index 64c198cd39..91d445f3b5 100644 --- a/Tiles/FurnitureVoid/VoidLantern.cs +++ b/Tiles/FurnitureVoid/VoidLantern.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureVoid/VoidSofa.cs b/Tiles/FurnitureVoid/VoidSofa.cs index ab18c06775..85b94342db 100644 --- a/Tiles/FurnitureVoid/VoidSofa.cs +++ b/Tiles/FurnitureVoid/VoidSofa.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureVoid num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform.cs b/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform.cs index 2f66e19e8e..7985e16f76 100644 --- a/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform.cs +++ b/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureWulfrum { GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/AnodizedWulfrumPlatform_Glow", AssetRequestMode.ImmediateLoad).Value; } - this.SetUpPlatform(ModContent.ItemType(), true); } diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs index f7b59df3e3..12ee6a0b92 100644 --- a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs +++ b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.cs index 7ca49b489d..0d0e368359 100644 --- a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.cs +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.cs @@ -23,11 +23,11 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.cs index 3b2683d017..85c0c6f0d1 100644 --- a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.cs +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 3); + FurnitureCommon.LightHitWire(Type, i, j, 3, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.cs index a22d5ba13f..699d6a05ff 100644 --- a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.cs +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum public override void SetStaticDefaults() { this.SetUpChest(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -28,10 +28,10 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void MouseOver(int i, int j) => FurnitureCommon.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => FurnitureCommon.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChestRightClick(i, j); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { if (Main.tile[i, j].IsTileActuallyInvisible()) diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.cs index 539a5d71fc..3aca64232e 100644 --- a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.cs +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, 1, j, 1, 1); + FurnitureCommon.LightHitWire(Type, 1, j, 1, 1); } public override void MouseOver(int i, int j) @@ -55,7 +55,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.cs index b77d5d23f4..a3a29f2818 100644 --- a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.cs +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -28,10 +28,10 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.cs index ccebff4a05..542c67a6d3 100644 --- a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.cs +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.cs index 61bed4da27..408915c3eb 100644 --- a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.cs +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 2); + FurnitureCommon.LightHitWire(Type, i, j, 1, 2); } } } diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.cs index 137090e670..47dbbec043 100644 --- a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.cs +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.cs @@ -27,9 +27,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { if (Main.tile[i, j].IsTileActuallyInvisible()) diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.cs index 24116e52f6..3aa7304261 100644 --- a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.cs +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.cs index 55a2357606..34516a0843 100644 --- a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.cs +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.cs @@ -48,11 +48,11 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, shitter: true); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info, shitter: true); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.cs index 8281656683..2e86f9c0d3 100644 --- a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.cs +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum { public class AnodizedWulfrumWorkBench : ModTile { - public override void SetStaticDefaults() => this.SetUpWorkBench(ModContent.ItemType(), true); + public override void SetStaticDefaults() => this.SetUpWorkBench(ModContent.ItemType(), true); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureWulfrum/WulfrumBed.cs b/Tiles/FurnitureWulfrum/WulfrumBed.cs index 6c3b6608d0..3a6c6bfd8e 100644 --- a/Tiles/FurnitureWulfrum/WulfrumBed.cs +++ b/Tiles/FurnitureWulfrum/WulfrumBed.cs @@ -29,9 +29,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; - public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureWulfrum/WulfrumCandelabra.cs b/Tiles/FurnitureWulfrum/WulfrumCandelabra.cs index 06f9e0a57f..65f3eedb77 100644 --- a/Tiles/FurnitureWulfrum/WulfrumCandelabra.cs +++ b/Tiles/FurnitureWulfrum/WulfrumCandelabra.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureWulfrum/WulfrumCandle.cs b/Tiles/FurnitureWulfrum/WulfrumCandle.cs index 536deb64ce..0782afadcb 100644 --- a/Tiles/FurnitureWulfrum/WulfrumCandle.cs +++ b/Tiles/FurnitureWulfrum/WulfrumCandle.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 1); + FurnitureCommon.LightHitWire(Type, i, j, 1, 1); } public override void MouseOver(int i, int j) @@ -57,7 +57,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/FurnitureWulfrum/WulfrumChair.cs b/Tiles/FurnitureWulfrum/WulfrumChair.cs index 709ff20525..4a14e5bb39 100644 --- a/Tiles/FurnitureWulfrum/WulfrumChair.cs +++ b/Tiles/FurnitureWulfrum/WulfrumChair.cs @@ -82,11 +82,11 @@ namespace CalamityMod.Tiles.FurnitureWulfrum spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, 40, true, true); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info, 40, true, true); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType(), true); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType(), true); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureWulfrum/WulfrumChandelier.cs b/Tiles/FurnitureWulfrum/WulfrumChandelier.cs index a4b0ec1074..cdf847d7da 100644 --- a/Tiles/FurnitureWulfrum/WulfrumChandelier.cs +++ b/Tiles/FurnitureWulfrum/WulfrumChandelier.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 3, 2); + FurnitureCommon.LightHitWire(Type, i, j, 3, 2); } } } diff --git a/Tiles/FurnitureWulfrum/WulfrumClock.cs b/Tiles/FurnitureWulfrum/WulfrumClock.cs index 1b1abb4e36..30c1566b83 100644 --- a/Tiles/FurnitureWulfrum/WulfrumClock.cs +++ b/Tiles/FurnitureWulfrum/WulfrumClock.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum return false; } - public override bool RightClick(int x, int y) => CalamityUtils.ClockRightClick(); + public override bool RightClick(int x, int y) => FurnitureCommon.ClockRightClick(); public override void NearbyEffects(int i, int j, bool closer) { @@ -39,7 +39,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum num = fail ? 1 : 3; } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.MouseOver(i, j, ModContent.ItemType()); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureWulfrum/WulfrumDresser.cs b/Tiles/FurnitureWulfrum/WulfrumDresser.cs index 2b7e855ed7..4a1dd86821 100644 --- a/Tiles/FurnitureWulfrum/WulfrumDresser.cs +++ b/Tiles/FurnitureWulfrum/WulfrumDresser.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void SetStaticDefaults() { this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), FurnitureCommon.GetMapChestName); } public override bool CanExplode(int i, int j) => false; @@ -29,10 +29,10 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void MouseOver(int i, int j) => FurnitureCommon.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => FurnitureCommon.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); - public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + public override bool RightClick(int i, int j) => FurnitureCommon.DresserRightClick(); public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { diff --git a/Tiles/FurnitureWulfrum/WulfrumLamp.cs b/Tiles/FurnitureWulfrum/WulfrumLamp.cs index fb2c96c94f..099001dde0 100644 --- a/Tiles/FurnitureWulfrum/WulfrumLamp.cs +++ b/Tiles/FurnitureWulfrum/WulfrumLamp.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) diff --git a/Tiles/FurnitureWulfrum/WulfrumLantern.cs b/Tiles/FurnitureWulfrum/WulfrumLantern.cs index 6ba870244e..004670bc58 100644 --- a/Tiles/FurnitureWulfrum/WulfrumLantern.cs +++ b/Tiles/FurnitureWulfrum/WulfrumLantern.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 1, 3); + FurnitureCommon.LightHitWire(Type, i, j, 1, 3); } } } diff --git a/Tiles/FurnitureWulfrum/WulfrumPlatform.cs b/Tiles/FurnitureWulfrum/WulfrumPlatform.cs index 6db012f70f..b79dff51c8 100644 --- a/Tiles/FurnitureWulfrum/WulfrumPlatform.cs +++ b/Tiles/FurnitureWulfrum/WulfrumPlatform.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Tiles.FurnitureWulfrum { GlowTexture = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumPlatform_Glow", AssetRequestMode.ImmediateLoad).Value; } - this.SetUpPlatform(ModContent.ItemType(), true); } diff --git a/Tiles/FurnitureWulfrum/WulfrumSofa.cs b/Tiles/FurnitureWulfrum/WulfrumSofa.cs index b2b343882f..cec7d458bf 100644 --- a/Tiles/FurnitureWulfrum/WulfrumSofa.cs +++ b/Tiles/FurnitureWulfrum/WulfrumSofa.cs @@ -29,11 +29,11 @@ namespace CalamityMod.Tiles.FurnitureWulfrum num = fail ? 1 : 3; } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.BenchSitInfo(i, j, ref info); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => FurnitureCommon.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureWulfrum/WulfrumToilet.cs b/Tiles/FurnitureWulfrum/WulfrumToilet.cs index dc87614e7d..7f576a0e9f 100644 --- a/Tiles/FurnitureWulfrum/WulfrumToilet.cs +++ b/Tiles/FurnitureWulfrum/WulfrumToilet.cs @@ -84,11 +84,11 @@ namespace CalamityMod.Tiles.FurnitureWulfrum spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, NextStyleHeight, true, shitter: true); + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => FurnitureCommon.ChairSitInfo(i, j, ref info, NextStyleHeight, true, shitter: true); - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + public override bool RightClick(int i, int j) => FurnitureCommon.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType(), true); + public override void MouseOver(int i, int j) => FurnitureCommon.ChairMouseOver(i, j, ModContent.ItemType(), true); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs index 8f9d334165..20e3e3fdca 100644 --- a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs +++ b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void HitWire(int i, int j) { - CalamityUtils.LightHitWire(Type, i, j, 2, 2); + FurnitureCommon.LightHitWire(Type, i, j, 2, 2); } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) diff --git a/Tiles/SunkenSea/AlgalPrismTorch.cs b/Tiles/SunkenSea/AlgalPrismTorch.cs index 3cea4cbe62..aa76431b40 100644 --- a/Tiles/SunkenSea/AlgalPrismTorch.cs +++ b/Tiles/SunkenSea/AlgalPrismTorch.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.SunkenSea public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/SunkenSea/NavyPrismTorch.cs b/Tiles/SunkenSea/NavyPrismTorch.cs index d7dfeee6a7..38c06626f0 100644 --- a/Tiles/SunkenSea/NavyPrismTorch.cs +++ b/Tiles/SunkenSea/NavyPrismTorch.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.SunkenSea public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Tiles/SunkenSea/RefractivePrismTorch.cs b/Tiles/SunkenSea/RefractivePrismTorch.cs index 5d8bb11be7..e603ff325c 100644 --- a/Tiles/SunkenSea/RefractivePrismTorch.cs +++ b/Tiles/SunkenSea/RefractivePrismTorch.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.SunkenSea public override bool RightClick(int i, int j) { - CalamityUtils.RightClickBreak(i, j); + FurnitureCommon.RightClickBreak(i, j); return true; } diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index fcbb08d886..6830bc572b 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -34,35 +34,6 @@ namespace CalamityMod { public static partial class CalamityUtils { - public static string GetMapChestName(string baseName, int x, int y) - { - // Bounds check. - if (!WorldGen.InWorld(x, y, 2)) - return baseName; - - Tile tile = Main.tile[x, y]; - int left = x; - int top = y; - if (tile.TileFrameX % 36 != 0) - left--; - if (tile.TileFrameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - - // Valid chest index check. - if (chest < 0) - return baseName; - - string name = baseName; - - // Concatenate the chest's custom name if it has one. - if (!string.IsNullOrEmpty(Main.chest[chest].name)) - name += $": {Main.chest[chest].name}"; - - return name; - } - public static void SafeSquareTileFrame(int x, int y, bool resetFrame = true) { for (int xIter = x - 1; xIter <= x + 1; ++xIter) @@ -83,38 +54,6 @@ namespace CalamityMod } } - public static void LightHitWire(int type, int i, int j, int tileX, int tileY) - { - int x = i - Main.tile[i, j].TileFrameX / 18 % tileX; - int y = j - Main.tile[i, j].TileFrameY / 18 % tileY; - int tileXX18 = 18 * tileX; - for (int l = x; l < x + tileX; l++) - { - for (int m = y; m < y + tileY; m++) - { - if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == type) - { - if (Main.tile[l, m].TileFrameX < tileXX18) - Main.tile[l, m].TileFrameX += (short)(tileXX18); - else - Main.tile[l, m].TileFrameX -= (short)(tileXX18); - } - } - } - - if (Wiring.running) - { - for (int k = 0; k < tileX; k++) - { - for (int l = 0; l < tileY; l++) - Wiring.SkipWire(x + k, y + l); - } - } - - if (Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendTileSquare(-1, x, y, tileX, tileY); - } - public static bool DrawSwayingMultiTile(int i, int j) { Tile tile = Main.tile[i, j]; From 229f0ef51c56b29147b9dc30cd2c2cb1dee5e28d Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 11 Dec 2025 02:28:12 +0900 Subject: [PATCH 36/48] Fixed Compile Error --- Items/CalamityGlobalItem.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index a91ebf319d..14d74abe39 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1597,9 +1597,6 @@ namespace CalamityMod.Items private static int cachedForgeID = -1; public override void OnCreated(Item item, ItemCreationContext context) { - // ChoosePrefix also happens on craft so go reset it here too - storedPrefix = -1; - // 05JUL2024: Ozzatron: Register the usage of Draedon's Forge for the purposes of his dialogue. // This was moved out of an On edit in the DraedonsForge item for Magic Storage compatibility. Player p = Main.LocalPlayer; From c5cb31449915f92af5d03e23cfa9ab08776a4217 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 11 Dec 2025 02:31:15 +0900 Subject: [PATCH 37/48] Revert Comments changes from ProjAICommon --- Projectiles/DraedonsArsenal/StarSwallowerSummon.cs | 1 + Projectiles/Healing/BurntSiennaProj.cs | 1 + Projectiles/Healing/CactusHealOrb.cs | 1 + Projectiles/Healing/EssenceFlame.cs | 1 + Projectiles/Magic/HadalUrnLamprey.cs | 1 + Projectiles/Magic/WaterLeechProj.cs | 1 + Projectiles/Melee/BonebreakerProjectile.cs | 1 + Projectiles/Pets/PerforaMini.cs | 1 + Projectiles/Pets/RotomPet.cs | 1 + Projectiles/Ranged/HydraHead.cs | 2 ++ Projectiles/Rogue/DimensionTearingDiskProjectile.cs | 4 ++++ Projectiles/Rogue/EclipsesStealth.cs | 2 ++ Projectiles/Rogue/GodsParanoiaProj.cs | 1 + Projectiles/Rogue/JawsProjectile.cs | 1 + Projectiles/Rogue/KelvinCatalystBoomerang.cs | 1 + Projectiles/Rogue/LionfishProj.cs | 1 + Projectiles/Rogue/MetalShard.cs | 1 + Projectiles/Rogue/NastyChollaBol.cs | 1 + Projectiles/Rogue/SnapClamProj.cs | 1 + Projectiles/Rogue/SnapClamStealth.cs | 1 + Projectiles/Summon/AquaticStarMinion.cs | 2 ++ Projectiles/Summon/AureusBomber.cs | 2 ++ Projectiles/Summon/BelladonnaSpirit.cs | 1 + Projectiles/Summon/BlackHawkSummon.cs | 2 ++ Projectiles/Summon/Calamitamini.cs | 1 + Projectiles/Summon/Cataclymini.cs | 1 + Projectiles/Summon/Catastromini.cs | 1 + Projectiles/Summon/CausticStaffSummon.cs | 2 ++ Projectiles/Summon/CelestialAxeMinion.cs | 1 + Projectiles/Summon/CosmicViperSummon.cs | 1 + Projectiles/Summon/DormantBrimseekerBab.cs | 1 + Projectiles/Summon/EnchantedBladeSummon.cs | 1 + Projectiles/Summon/EndoCooperBody.cs | 1 + Projectiles/Summon/EndoHydraHead.cs | 1 + Projectiles/Summon/EyeOfNightCell.cs | 1 + Projectiles/Summon/FieryDraconid.cs | 1 + Projectiles/Summon/GammaHead.cs | 2 ++ Projectiles/Summon/GastricBelcher.cs | 2 ++ Projectiles/Summon/HerringAI.cs | 2 ++ Projectiles/Summon/IceClasperMinion.cs | 1 + Projectiles/Summon/MidnightSunUFO.cs | 1 + Projectiles/Summon/MiniGuardianHealer.cs | 1 + Projectiles/Summon/PlaguebringerSummon.cs | 1 + Projectiles/Summon/SandElementalHealer.cs | 1 + Projectiles/Summon/SlimePuppet.cs | 1 + Projectiles/Summon/TacticalPlagueJet.cs | 2 ++ Projectiles/Summon/Valkyrie.cs | 1 + Projectiles/Typeless/FungalClumpMinion.cs | 2 ++ 48 files changed, 62 insertions(+) diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs index 23defbd09c..e5c35b3a87 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -140,6 +140,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal PlayerSeparationAnxietyAI(player, ref minimumFrame, ref maximumFrame); FallThroughYPoint = player.Top.Y; } + Projectile.MinionAntiClump(); ManipulateFrames(minimumFrame, maximumFrame); } diff --git a/Projectiles/Healing/BurntSiennaProj.cs b/Projectiles/Healing/BurntSiennaProj.cs index 727296cc48..52efdc55f8 100644 --- a/Projectiles/Healing/BurntSiennaProj.cs +++ b/Projectiles/Healing/BurntSiennaProj.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.velocity *= 0.95f; + Projectile.HealingProjectile(3, (int)Projectile.ai[0], 6f, 15f, false); int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[dusty]; diff --git a/Projectiles/Healing/CactusHealOrb.cs b/Projectiles/Healing/CactusHealOrb.cs index 868b2601d6..23f54b162e 100644 --- a/Projectiles/Healing/CactusHealOrb.cs +++ b/Projectiles/Healing/CactusHealOrb.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { Projectile.velocity.Y *= 0.98f; + Projectile.HealingProjectile(15, Projectile.owner, 12f, 15f, false); int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 100, new Color(0, 200, 0), 1.5f); Dust dust = Main.dust[dusty]; diff --git a/Projectiles/Healing/EssenceFlame.cs b/Projectiles/Healing/EssenceFlame.cs index 610a4dd1e2..d06bdfd4c6 100644 --- a/Projectiles/Healing/EssenceFlame.cs +++ b/Projectiles/Healing/EssenceFlame.cs @@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Healing { Projectile.frame = 0; } + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 3.5f, 15f); return; } diff --git a/Projectiles/Magic/HadalUrnLamprey.cs b/Projectiles/Magic/HadalUrnLamprey.cs index 3e57137c2e..a8b5030619 100644 --- a/Projectiles/Magic/HadalUrnLamprey.cs +++ b/Projectiles/Magic/HadalUrnLamprey.cs @@ -48,6 +48,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.rotation = Projectile.velocity.ToRotation(); } + //Sticky Behaviour Projectile.StickyProjAI(15); Projectile.frameCounter++; diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index 6bb8d4bf4d..a85083f258 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -47,6 +47,7 @@ namespace CalamityMod.Projectiles.Magic { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi; } + //Sticky Behaviour Projectile.StickyProjAI(5); } diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index b2f5d2d035..41c5b560a3 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -46,6 +46,7 @@ namespace CalamityMod.Projectiles.Melee } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } + //Sticky Behaviour Projectile.StickyProjAI(15); } diff --git a/Projectiles/Pets/PerforaMini.cs b/Projectiles/Pets/PerforaMini.cs index 8ef9a80541..d11e8856f5 100644 --- a/Projectiles/Pets/PerforaMini.cs +++ b/Projectiles/Pets/PerforaMini.cs @@ -57,6 +57,7 @@ namespace CalamityMod.Projectiles.Pets { Projectile.timeLeft = 2; } + Projectile.FloatingPetAI(true, 0.1f); //Dust diff --git a/Projectiles/Pets/RotomPet.cs b/Projectiles/Pets/RotomPet.cs index 54291d3730..f9920c8963 100644 --- a/Projectiles/Pets/RotomPet.cs +++ b/Projectiles/Pets/RotomPet.cs @@ -69,6 +69,7 @@ namespace CalamityMod.Projectiles.Pets UpdateForm(player); UpdateFrames(); + Projectile.FloatingPetAI(true, 0.05f); } diff --git a/Projectiles/Ranged/HydraHead.cs b/Projectiles/Ranged/HydraHead.cs index 1a12887c45..ae90151da0 100644 --- a/Projectiles/Ranged/HydraHead.cs +++ b/Projectiles/Ranged/HydraHead.cs @@ -123,6 +123,8 @@ namespace CalamityMod.Projectiles.Ranged // Clamp the center so that it does not go too far from the return position. if (Projectile.Distance(returnPosition) > 120f) Projectile.Center = returnPosition + Projectile.DirectionFrom(returnPosition) * 120f; + + // Disallow heads from getting too close to each other. Projectile.MinionAntiClump(0.15f); } diff --git a/Projectiles/Rogue/DimensionTearingDiskProjectile.cs b/Projectiles/Rogue/DimensionTearingDiskProjectile.cs index cda9d5b223..bcb2876335 100644 --- a/Projectiles/Rogue/DimensionTearingDiskProjectile.cs +++ b/Projectiles/Rogue/DimensionTearingDiskProjectile.cs @@ -138,6 +138,8 @@ namespace CalamityMod.Projectiles.Rogue laser.DamageType = RogueDamageClass.Instance; } } + + // Stay stuck to the target. Projectile.StickyProjAI(6, true); // If still attached to a target, do nothing. @@ -207,6 +209,8 @@ namespace CalamityMod.Projectiles.Rogue // Provide a fixed amount of grind time so that DPS can't vary wildly. Projectile.timeLeft = 90; } + + // Apply sticky AI. Projectile.ModifyHitNPCSticky(3); } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 77e0bc3d4c..bdf017b9f2 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -87,6 +87,8 @@ namespace CalamityMod.Projectiles.Rogue } } } + + // Sticky behavior. Lets the projectile impale enemies and sticks to its impaled enemy automatically. Projectile.StickyProjAI(10); } diff --git a/Projectiles/Rogue/GodsParanoiaProj.cs b/Projectiles/Rogue/GodsParanoiaProj.cs index ba9ca80eed..5c2bc3d735 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Projectiles.Rogue flame.velocity = Vector2.Zero; flame.noGravity = true; } + Projectile.StickyProjAI(50); if (Projectile.ai[0] == 1f) diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index d06de31ee4..cf28eed5b5 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -51,6 +51,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[dust].noGravity = true; } } + //Sticky Behaviour Projectile.StickyProjAI(15); } diff --git a/Projectiles/Rogue/KelvinCatalystBoomerang.cs b/Projectiles/Rogue/KelvinCatalystBoomerang.cs index d9c564f0cc..fbf1f6df10 100644 --- a/Projectiles/Rogue/KelvinCatalystBoomerang.cs +++ b/Projectiles/Rogue/KelvinCatalystBoomerang.cs @@ -67,6 +67,7 @@ namespace CalamityMod.Projectiles.Rogue ReturnToPlayer(); break; case 2: + // Will target the targetted NPC that minions use btw Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 1, 40f, 12f, 6f, new Vector2(0f, -60f), 40f, 12f, true, true); Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= 180) diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index 023b266700..7d5cb2ecae 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -65,6 +65,7 @@ namespace CalamityMod.Projectiles.Rogue } } } + //Sticky Behaviour Projectile.StickyProjAI(15); } diff --git a/Projectiles/Rogue/MetalShard.cs b/Projectiles/Rogue/MetalShard.cs index 0622bbe146..83d25aece6 100644 --- a/Projectiles/Rogue/MetalShard.cs +++ b/Projectiles/Rogue/MetalShard.cs @@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.velocity.Y > 16f) Projectile.velocity.Y = 16f; } + //Sticky Behaviour Projectile.StickyProjAI(15); } diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index ddbf587f4c..82a59ad5dd 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } + //Sticky Behaviour Projectile.StickyProjAI(15); if (Projectile.ai[0] != 1f) { diff --git a/Projectiles/Rogue/SnapClamProj.cs b/Projectiles/Rogue/SnapClamProj.cs index 12675173a0..2aff8e2686 100644 --- a/Projectiles/Rogue/SnapClamProj.cs +++ b/Projectiles/Rogue/SnapClamProj.cs @@ -45,6 +45,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation += 0.4f * (float)Projectile.direction; Projectile.spriteDirection = Projectile.direction; } + //Sticky Behaviour Projectile.StickyProjAI(15); if (Projectile.ai[2] < 30f && Projectile.ai[0] != 1f) { diff --git a/Projectiles/Rogue/SnapClamStealth.cs b/Projectiles/Rogue/SnapClamStealth.cs index d4f4a2cd02..12ddd3ee4b 100644 --- a/Projectiles/Rogue/SnapClamStealth.cs +++ b/Projectiles/Rogue/SnapClamStealth.cs @@ -47,6 +47,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation += 0.4f * (float)Projectile.direction; Projectile.spriteDirection = Projectile.direction; } + //Sticky Behaviour Projectile.StickyProjAI(15); if (Projectile.ai[2] < 30f && Projectile.ai[0] != 1f) { diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 4a78c8a8fa..8267a409ae 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -66,6 +66,8 @@ namespace CalamityMod.Projectiles.Summon // Does a dust effect where the minion spawns. Projectile.rotation += Projectile.velocity.X * 0.04f; + // Make the minion spin depending on how fast it is. + Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 12f, 12f, false, false, 1); } diff --git a/Projectiles/Summon/AureusBomber.cs b/Projectiles/Summon/AureusBomber.cs index b8f427ad7e..52d7dd22ef 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -62,6 +62,8 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } + + //anti sticking movement Projectile.MinionAntiClump(); //get in a line diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index feea46e3ca..34f577a36c 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Summon FollowPlayer(); if (Target != null) AttackTarget(); + Projectile.MinionAntiClump(); Projectile.spriteDirection = Target == null ? MathF.Sign(Projectile.velocity.X) : MathF.Sign(Target.Center.X - Projectile.Center.X); diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index b1ae973b7d..93d42c501c 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -114,6 +114,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } + + //Anti sticky movement to prevent overlapping minions Projectile.MinionAntiClump(); float maxDistance = 700f; diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index bdaafb3318..f1c755a738 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -73,6 +73,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } + Projectile.MinionAntiClump(); Projectile.frameCounter++; diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index 820f09e23f..b67690cdcc 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -66,6 +66,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } + Projectile.MinionAntiClump(); Projectile.frameCounter++; diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 9666b486ca..956f049214 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -79,6 +79,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = 0; } + Projectile.ChargingMinionAI(Calamitamini.Range, Calamitamini.SeparationAnxietyMin, Calamitamini.SeparationAnxietyMax, Calamitamini.SafeDist, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, true); } diff --git a/Projectiles/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs index 654f6293a7..501472f410 100644 --- a/Projectiles/Summon/CausticStaffSummon.cs +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -71,6 +71,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } + + //Anti sticky movement to prevent minions from stacking Projectile.MinionAntiClump(); //Set tile collision for only when trying to return to the player diff --git a/Projectiles/Summon/CelestialAxeMinion.cs b/Projectiles/Summon/CelestialAxeMinion.cs index 7db74490e4..932f8ec4fb 100644 --- a/Projectiles/Summon/CelestialAxeMinion.cs +++ b/Projectiles/Summon/CelestialAxeMinion.cs @@ -58,6 +58,7 @@ namespace CalamityMod.Projectiles.Summon } } Projectile.rotation += 0.075f; + Projectile.ChargingMinionAI(1600f, 1800f, 2500f, 400f, 1, 30f, 24f, 12f, new Vector2(0f, -60f), 30f, 16f, true, true); // Destroy trees in GFB, because it's an axe, and axes should do that diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index f9548599a1..0dffeca8d7 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -111,6 +111,7 @@ namespace CalamityMod.Projectiles.Summon float colorScale = (float)Projectile.alpha / 255f; Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 1f * colorScale, 0.1f * colorScale, 1f * colorScale); + Projectile.MinionAntiClump(); float detectRange = 2200f; diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index a2079fd6b0..183b6108fc 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -97,6 +97,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.frame = (Projectile.localAI[1] == 1f).ToInt() * 4; } + Projectile.MinionAntiClump(0.1f); if (Projectile.Distance(player.Center) > 2700f) { diff --git a/Projectiles/Summon/EnchantedBladeSummon.cs b/Projectiles/Summon/EnchantedBladeSummon.cs index 827d173448..12f42ec889 100644 --- a/Projectiles/Summon/EnchantedBladeSummon.cs +++ b/Projectiles/Summon/EnchantedBladeSummon.cs @@ -78,6 +78,7 @@ namespace CalamityMod.Projectiles.Summon } CurrentState.Invoke(); + Projectile.MinionAntiClump(0.25f); if (!Main.dedServ) diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index 6f32dd23b5..487ec89ec1 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -137,6 +137,7 @@ namespace CalamityMod.Projectiles.Summon if (limbs.type != ModContent.ProjectileType() || !limbs.active) Projectile.Kill(); + Projectile.MinionAntiClump(); bool accelerate = false; if (Projectile.ai[0] == 2f) diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index 4b2aba981a..d33f6bbb9f 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -156,6 +156,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.Center = returnPosition + Projectile.DirectionFrom(returnPosition) * 120f; } + Projectile.MinionAntiClump(0.15f); AdjustOldVelocityArray(); } diff --git a/Projectiles/Summon/EyeOfNightCell.cs b/Projectiles/Summon/EyeOfNightCell.cs index a0b0e58b74..ffa1a756c0 100644 --- a/Projectiles/Summon/EyeOfNightCell.cs +++ b/Projectiles/Summon/EyeOfNightCell.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Projectiles.Summon { if (!Main.dedServ && Projectile.velocity.Length() > 5f) Dust.NewDustPerfect(Projectile.Center, (int)CalamityDusts.SulphurousSeaAcid).noGravity = true; + Projectile.StickyProjAI(3); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Summon/FieryDraconid.cs b/Projectiles/Summon/FieryDraconid.cs index 4b8ceba47b..2574c58132 100644 --- a/Projectiles/Summon/FieryDraconid.cs +++ b/Projectiles/Summon/FieryDraconid.cs @@ -146,6 +146,7 @@ namespace CalamityMod.Projectiles.Summon public void DoPlayerHoverMovement() { + // Move away from other minions of the same type. Projectile.MinionAntiClump(0.1f); Vector2 hoverDestination = Owner.Top - Vector2.UnitY * 50f; diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index b4fc0edb9d..adad872278 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -187,6 +187,8 @@ namespace CalamityMod.Projectiles.Summon // Clamp the center so that it does not go too far from the return position. if (Projectile.Distance(returnPosition) > 120f) Projectile.Center = returnPosition + Projectile.DirectionFrom(returnPosition) * 120f; + + // Disallow heads from getting too close to each other. Projectile.MinionAntiClump(0.15f); } diff --git a/Projectiles/Summon/GastricBelcher.cs b/Projectiles/Summon/GastricBelcher.cs index 71a09c85ce..c4523cdeee 100644 --- a/Projectiles/Summon/GastricBelcher.cs +++ b/Projectiles/Summon/GastricBelcher.cs @@ -92,6 +92,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } + + //Anti sticky movement to prevent overlapping minions Projectile.MinionAntiClump(); //Find a target diff --git a/Projectiles/Summon/HerringAI.cs b/Projectiles/Summon/HerringAI.cs index 21c5434bba..54ae7836db 100644 --- a/Projectiles/Summon/HerringAI.cs +++ b/Projectiles/Summon/HerringAI.cs @@ -47,6 +47,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = (Projectile.spriteDirection == -1) ? Projectile.velocity.ToRotation() + MathHelper.Pi : Projectile.velocity.ToRotation(); Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); + // Although the sprite is invisible, we'll keep track of it's direction and rotation so we can later apply it to the decorative herrings. + Projectile.ChargingMinionAI(EnemyDistanceDetection, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 12f, 12f, CalamityPlayer.areThereAnyDamnBosses, true, 1); // The AI of the minion. Projectile.netUpdate = true; diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index f068af577a..d99434a91f 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -56,6 +56,7 @@ namespace CalamityMod.Projectiles.Summon RamState(); break; } + Projectile.MinionAntiClump(0.5f); if (!Main.dedServ) diff --git a/Projectiles/Summon/MidnightSunUFO.cs b/Projectiles/Summon/MidnightSunUFO.cs index 38b5bb2507..502494bb28 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -131,6 +131,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.Center = player.Center; Projectile.netUpdate = true; } + Projectile.MinionAntiClump(0.35f); Projectile.rotation = Projectile.velocity.X * 0.03f; } diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index 53460bbd4c..53397e2946 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -82,6 +82,7 @@ namespace CalamityMod.Projectiles.Summon hasSetTimers = true; Projectile.netUpdate = true; } + Projectile.MinionAntiClump(); Player owner = Owner; diff --git a/Projectiles/Summon/PlaguebringerSummon.cs b/Projectiles/Summon/PlaguebringerSummon.cs index a50a6e83f4..ffa626a95c 100644 --- a/Projectiles/Summon/PlaguebringerSummon.cs +++ b/Projectiles/Summon/PlaguebringerSummon.cs @@ -60,6 +60,7 @@ namespace CalamityMod.Projectiles.Summon } if (!modPlayer.plaguebringerPatronSet) Projectile.Kill(); + Projectile.MinionAntiClump(); Projectile.ai[0]++; diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index 2a12054087..408e4982e2 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -97,6 +97,7 @@ namespace CalamityMod.Projectiles.Summon lightScalar *= Main.essScale; Lighting.AddLight(Projectile.Center, 0.7f * lightScalar, 0.6f * lightScalar, 0f * lightScalar); } + Projectile.MinionAntiClump(); if (Vector2.Distance(player.Center, Projectile.Center) > 400f) diff --git a/Projectiles/Summon/SlimePuppet.cs b/Projectiles/Summon/SlimePuppet.cs index d607367ab2..1e12d73113 100644 --- a/Projectiles/Summon/SlimePuppet.cs +++ b/Projectiles/Summon/SlimePuppet.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + // Prevent clumping of other slime puppets near this one. Projectile.MinionAntiClump(); NPC potentialTarget = Projectile.Center.MinionHoming(800f, Owner); diff --git a/Projectiles/Summon/TacticalPlagueJet.cs b/Projectiles/Summon/TacticalPlagueJet.cs index 4b8e1625c0..854d66152b 100644 --- a/Projectiles/Summon/TacticalPlagueJet.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -191,6 +191,8 @@ namespace CalamityMod.Projectiles.Summon Main.projectile[projIndex].minion = false; } } + + // Prevent minion clumping while firing. Projectile.MinionAntiClump(0.25f); } } diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 74f8021533..ddcf3733dc 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -73,6 +73,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.spriteDirection = -Projectile.direction; } + Projectile.ChargingMinionAI(700f, 800f, 1200f, 150f, 0, 40f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, false, true); //Give off some light diff --git a/Projectiles/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index b96d31acb4..782a84cecd 100644 --- a/Projectiles/Typeless/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -95,6 +95,8 @@ namespace CalamityMod.Projectiles.Typeless { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BlueFairy, Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f); } + + //Anti-sticky movement failsafe Projectile.MinionAntiClump(); //If too far from player, increase speed to chase after player From 104ced20da6a998494e0f97f49ce23086f8d3689 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Mon, 15 Dec 2025 15:44:30 +0900 Subject: [PATCH 38/48] Added GeneralDrawLayerSystem --- Backgrounds/SunkenSeaBurrowsBG.cs | 23 +-- Graphics/Metaballs/MetaballManager.cs | 10 +- .../Primitives/PrimitivePixelationSystem.cs | 21 ++- Graphics/Renderers/RendererManager.cs | 10 +- ILEditing/ILChangesLoading.cs | 9 -- ILEditing/MechanicILChanges.cs | 70 ---------- Particles/GeneralParticleHandler.cs | 5 +- Systems/Graphic/GeneralDrawLayerSystem.cs | 131 ++++++++++++++++++ .../PixelationSystem/PixelationManager.cs | 26 ++-- 9 files changed, 182 insertions(+), 123 deletions(-) create mode 100644 Systems/Graphic/GeneralDrawLayerSystem.cs diff --git a/Backgrounds/SunkenSeaBurrowsBG.cs b/Backgrounds/SunkenSeaBurrowsBG.cs index c7bf587001..4c80584980 100644 --- a/Backgrounds/SunkenSeaBurrowsBG.cs +++ b/Backgrounds/SunkenSeaBurrowsBG.cs @@ -1,11 +1,12 @@ -using Terraria; -using Terraria.ModLoader; +using CalamityMod.Graphics; +using CalamityMod.Systems.Graphic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using Terraria.ID; -using CalamityMod.Graphics; +using Terraria; using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Backgrounds { @@ -22,12 +23,17 @@ namespace CalamityMod.Backgrounds return; } - On_Main.CheckMonoliths += DrawToTarget; + GeneralDrawLayerSystem.OnPrepareDraw += DrawToTarget; On_Main.DrawBackgroundBlackFill += On_Main_DrawBackgroundBlackFill; Main.QueueMainThreadAction(() => WaterDistortionTarget = new(true, ManagedRenderTarget.CreateScreenSizedTarget)); } + public override void Unload() + { + GeneralDrawLayerSystem.OnPrepareDraw -= DrawToTarget; + } + /// /// This code runs because there is a system in vanilla that causes backgrounds to not draw if lighting is too low. /// That would be fine, the problem arises because sloped tiles still block light the same way normal tiles do. @@ -119,17 +125,16 @@ namespace CalamityMod.Backgrounds if (!Main.tile[pos.X, pos.Y].HasTile && Main.tile[pos.X, pos.Y].WallType == WallID.None) Lighting.AddLight(pos.X, pos.Y, TorchID.Red, 0.6f); - } + } } } } } - private void DrawToTarget(On_Main.orig_CheckMonoliths orig) + private void DrawToTarget() { if (Main.gameMenu) { - orig(); return; } @@ -147,8 +152,6 @@ namespace CalamityMod.Backgrounds Main.graphics.GraphicsDevice.SetRenderTarget(null); CurrentlyRendering = false; - - orig(); } private void On_Main_DrawBackgroundBlackFill(On_Main.orig_DrawBackgroundBlackFill orig, Main self) diff --git a/Graphics/Metaballs/MetaballManager.cs b/Graphics/Metaballs/MetaballManager.cs index 123e007766..aa1bf3ab10 100644 --- a/Graphics/Metaballs/MetaballManager.cs +++ b/Graphics/Metaballs/MetaballManager.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Enums; +using CalamityMod.Systems.Graphic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,9 +13,10 @@ namespace CalamityMod.Graphics.Metaballs { internal static readonly List metaballs = new(); - public override void OnModLoad() + public override void Load() { // Prepare event subscribers. + GeneralDrawLayerSystem.OnDrawLayer += DrawMetaballs; RenderTargetManager.RenderTargetUpdateLoopEvent += PrepareMetaballTargets; } @@ -96,8 +98,10 @@ namespace CalamityMod.Graphics.Metaballs /// Draws all metaballs of a given . Used for layer ordering reasons. /// /// The layer type to draw with. - internal static void DrawMetaballs(GeneralDrawLayer layerType) + private static void DrawMetaballs(GeneralDrawLayer layerType) { + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + foreach (Metaball metaball in metaballs.Where(m => m.DrawLayer == layerType && m.AnythingToDraw)) { for (int i = 0; i < metaball.LayerTargets.Count; i++) @@ -109,6 +113,8 @@ namespace CalamityMod.Graphics.Metaballs Main.spriteBatch.Draw(metaball.LayerTargets[i], Main.screenLastPosition - Main.screenPosition, Color.White); } } + + Main.spriteBatch.End(); } } } diff --git a/Graphics/Primitives/PrimitivePixelationSystem.cs b/Graphics/Primitives/PrimitivePixelationSystem.cs index 36a0e186b8..3fa1d49fbc 100644 --- a/Graphics/Primitives/PrimitivePixelationSystem.cs +++ b/Graphics/Primitives/PrimitivePixelationSystem.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Enums; +using CalamityMod.Systems.Graphic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -60,7 +61,8 @@ namespace CalamityMod.Graphics.Primitives PixelationTarget_AfterEverything = new(true, CreatePixelTarget); }); - On_Main.CheckMonoliths += DrawToTargets; + GeneralDrawLayerSystem.OnDrawLayer += DrawTargetScaled; + GeneralDrawLayerSystem.OnPrepareDraw += DrawToTargets; //On_Main.DrawBackgroundBlackFill += DrawTarget_BeforeAllTiles; //On_Main.DoDraw_Tiles_Solid += DrawTarget_BeforeSolidTiles; //On_Main.DoDraw_DrawNPCsOverTiles += DrawTarget_NPCs; @@ -75,16 +77,16 @@ namespace CalamityMod.Graphics.Primitives if (Main.dedServ) return; - On_Main.CheckMonoliths -= DrawToTargets; + GeneralDrawLayerSystem.OnDrawLayer -= DrawTargetScaled; + GeneralDrawLayerSystem.OnPrepareDraw -= DrawToTargets; } #endregion #region Drawing To Targets - private void DrawToTargets(On_Main.orig_CheckMonoliths orig) + private void DrawToTargets() { if (Main.gameMenu) { - orig(); return; } @@ -167,7 +169,6 @@ namespace CalamityMod.Graphics.Primitives Main.instance.GraphicsDevice.SetRenderTarget(null); CurrentlyRendering = false; - orig(); } private static void DrawPrimsToRenderTarget(RenderTarget2D renderTarget, GeneralDrawLayer layer, List pixelPrimitives) @@ -188,15 +189,11 @@ namespace CalamityMod.Graphics.Primitives #endregion #region Target Drawing - internal static void DrawTargetScaled(GeneralDrawLayer drawLayer, bool startSpritebatch = true) + private static void DrawTargetScaled(GeneralDrawLayer drawLayer) { - if (startSpritebatch) - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); Main.spriteBatch.Draw(ReturnAssociatedRenderTarget(drawLayer), Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); - - if (startSpritebatch) - Main.spriteBatch.End(); + Main.spriteBatch.End(); } private static RenderTarget2D ReturnAssociatedRenderTarget(GeneralDrawLayer drawLayer) diff --git a/Graphics/Renderers/RendererManager.cs b/Graphics/Renderers/RendererManager.cs index 642ccce355..9665bab61b 100644 --- a/Graphics/Renderers/RendererManager.cs +++ b/Graphics/Renderers/RendererManager.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Enums; +using CalamityMod.Systems.Graphic; using CalamityMod.Utilities.Daybreak; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -26,7 +27,8 @@ namespace CalamityMod.Graphics.Renderers return; // This hooks here, because doing it any sooner causes the screen position to be a frame behind. - On_Main.CheckMonoliths += DrawToTargets; + GeneralDrawLayerSystem.OnDrawLayer += DrawRendererAtLayer; + GeneralDrawLayerSystem.OnPrepareDraw += DrawToTargets; } public override void Unload() @@ -60,7 +62,7 @@ namespace CalamityMod.Graphics.Renderers #endregion #region Drawing - internal static void DrawRendererAtLayer(GeneralDrawLayer drawLayer) + private static void DrawRendererAtLayer(GeneralDrawLayer drawLayer) { var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer == drawLayer); if (renderers.Any()) @@ -74,10 +76,8 @@ namespace CalamityMod.Graphics.Renderers } } - private void DrawToTargets(On_Main.orig_CheckMonoliths orig) + private void DrawToTargets() { - orig(); - if (Main.gameMenu || Main.dedServ) return; diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 31726b8ae8..ffed28fb41 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -55,15 +55,6 @@ namespace CalamityMod.ILEditing IL_TileDrawing.DrawTrees += DrawTreeGlowMask; On_TileDrawing.DrawBasicTile += DrawTreeTrunkAndCactusGlowMask; - // Graphics (GeneralDrawLayer detours) - On_Main.DrawBackgroundBlackFill += GeneralDrawLayer_DrawToLayer_BeforeAllTiles; - On_Main.DoDraw_Tiles_Solid += GeneralDrawLayer_DrawToLayer_BeforeSolidTiles; - On_Main.DoDraw_DrawNPCsOverTiles += GeneralDrawLayer_DrawToLayer_NPCs; - On_Main.DrawProjectiles += GeneralDrawLayer_DrawToLayer_Projectiles; - On_Main.DrawPlayers_AfterProjectiles += GeneralDrawLayer_DrawToLayer_AfterPlayers; - On_Main.DrawDust += GeneralDrawLayer_DrawToLayer_AfterDusts; - On_Main.DrawInfernoRings += GeneralDrawLayer_DrawToLayer_AfterEverything; - // NPC behavior IL_Main.UpdateTime += PermitNighttimeTownNPCSpawning; On_Main.UpdateTime_SpawnTownNPCs += AlterTownNPCSpawnRate; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 31b485055c..bf5539ae51 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -7,9 +7,6 @@ using CalamityMod.DataStructures; using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.FluidSimulation; -using CalamityMod.Graphics.Metaballs; -using CalamityMod.Graphics.Primitives; -using CalamityMod.Graphics.Renderers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Critters; @@ -27,7 +24,6 @@ using CalamityMod.Projectiles; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; -using CalamityMod.Systems.Graphic.PixelationSystem; using CalamityMod.Systems.Mechanic; using CalamityMod.Tiles; using CalamityMod.Utilities.Daybreak; @@ -863,72 +859,6 @@ namespace CalamityMod.ILEditing } #endregion - #region GeneralDrawLayer Systems Drawing - private static void GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer drawLayer) - { - GeneralParticleHandler.DrawParticleCollectionsAtSpecificLayer(drawLayer); - - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - MetaballManager.DrawMetaballs(drawLayer); - Main.spriteBatch.End(); - - PrimitivePixelationSystem.DrawTargetScaled(drawLayer); - - PixelationManager.DrawPixelatedTargets(drawLayer); - - RendererManager.DrawRendererAtLayer(drawLayer); - - } - - private static void GeneralDrawLayer_DrawToLayer_BeforeAllTiles(On_Main.orig_DrawBackgroundBlackFill orig, Main self) - { - Main.spriteBatch.End(out var ss); - GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeAllTiles); - Main.spriteBatch.Begin(ss); - orig(self); - } - - private static void GeneralDrawLayer_DrawToLayer_BeforeSolidTiles(On_Main.orig_DoDraw_Tiles_Solid orig, Main self) - { - GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeSolidTiles); - orig(self); - } - - private static void GeneralDrawLayer_DrawToLayer_NPCs(On_Main.orig_DoDraw_DrawNPCsOverTiles orig, Main self) - { - GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeNPCs); - orig(self); - GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterNPCs); - } - - private static void GeneralDrawLayer_DrawToLayer_Projectiles(On_Main.orig_DrawProjectiles orig, Main self) - { - GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeProjectiles); - orig(self); - GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterProjectiles); - } - - private static void GeneralDrawLayer_DrawToLayer_AfterPlayers(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self) - { - orig(self); - GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterPlayers); - } - - private static void GeneralDrawLayer_DrawToLayer_AfterDusts(On_Main.orig_DrawDust orig, Main self) - { - orig(self); - GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterDusts); - } - - private static void GeneralDrawLayer_DrawToLayer_AfterEverything(On_Main.orig_DrawInfernoRings orig, Main self) - { - orig(self); - Main.spriteBatch.End(out var ss); - GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterEverything); - Main.spriteBatch.Begin(ss); - } - #endregion - #region General Particle Rendering private static void DrawFusableParticles(On_Main.orig_SortDrawCacheWorms orig, Main self) { diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index 88bf2c043c..1a10ce3df1 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; using CalamityMod.Enums; +using CalamityMod.Systems.Graphic; using CalamityMod.Systems.Graphic.PixelationSystem; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -100,6 +101,8 @@ namespace CalamityMod.Particles particlesToDraw = []; particlesToDraw_Pixelated = []; particlesToDraw_CustomShader = []; + + GeneralDrawLayerSystem.OnDrawLayer += DrawParticleCollectionsAtSpecificLayer; } public override void Unload() @@ -289,7 +292,7 @@ namespace CalamityMod.Particles particlesToKill.Clear(); } - internal static void DrawParticleCollectionsAtSpecificLayer(GeneralDrawLayer drawLayer) + private static void DrawParticleCollectionsAtSpecificLayer(GeneralDrawLayer drawLayer) { if (Main.dedServ) return; diff --git a/Systems/Graphic/GeneralDrawLayerSystem.cs b/Systems/Graphic/GeneralDrawLayerSystem.cs new file mode 100644 index 0000000000..e96ef60311 --- /dev/null +++ b/Systems/Graphic/GeneralDrawLayerSystem.cs @@ -0,0 +1,131 @@ +using System; +using CalamityMod.Enums; +using CalamityMod.Utilities.Daybreak; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Graphic +{ + internal sealed class GeneralDrawLayerSystem : ModSystem + { + public static event Action OnPrepareDraw; + public static event Action OnDrawLayer; + public static event Action OnDrawLayerLate; + + public static event Action OnBeforeAllTiles; + public static event Action OnBeforeSolidTiles; + public static event Action OnBeforeNPCs; + public static event Action OnAfterNPCs; + public static event Action OnBeforeProjectiles; + public static event Action OnAfterProjectiles; + public static event Action OnAfterPlayers; + public static event Action OnAfterDusts; + public static event Action OnAfterEverything; + + public override void OnModLoad() + { + On_Main.CheckMonoliths += CheckMonoliths; + On_Main.DrawBackgroundBlackFill += GeneralDrawLayer_DrawToLayer_BeforeAllTiles; + On_Main.DoDraw_Tiles_Solid += GeneralDrawLayer_DrawToLayer_BeforeSolidTiles; + On_Main.DoDraw_DrawNPCsOverTiles += GeneralDrawLayer_DrawToLayer_NPCs; + On_Main.DrawProjectiles += GeneralDrawLayer_DrawToLayer_Projectiles; + On_Main.DrawPlayers_AfterProjectiles += GeneralDrawLayer_DrawToLayer_AfterPlayers; + On_Main.DrawDust += GeneralDrawLayer_DrawToLayer_AfterDusts; + On_Main.DrawInfernoRings += GeneralDrawLayer_DrawToLayer_AfterEverything; + } + + public override void Unload() + { + OnPrepareDraw = null; + OnDrawLayer = null; + OnDrawLayerLate = null; + + OnBeforeAllTiles = null; + OnBeforeSolidTiles = null; + OnBeforeNPCs = null; + OnAfterNPCs = null; + OnBeforeProjectiles = null; + OnAfterProjectiles = null; + OnAfterPlayers = null; + OnAfterDusts = null; + OnAfterEverything = null; + } + + private static void CheckMonoliths(On_Main.orig_CheckMonoliths orig) + { + orig(); + OnPrepareDraw?.Invoke(); + } + + #region GeneralDrawLayer Systems Drawing + private static void GeneralDrawLayer_DrawForLayer(GeneralDrawLayer drawLayer) + { + OnDrawLayer?.Invoke(drawLayer); + OnDrawLayerLate?.Invoke(drawLayer); + + var callback = drawLayer switch + { + GeneralDrawLayer.BeforeAllTiles => OnBeforeAllTiles, + GeneralDrawLayer.BeforeSolidTiles => OnBeforeSolidTiles, + GeneralDrawLayer.BeforeNPCs => OnBeforeNPCs, + GeneralDrawLayer.AfterNPCs => OnAfterNPCs, + GeneralDrawLayer.BeforeProjectiles => OnBeforeProjectiles, + GeneralDrawLayer.AfterProjectiles => OnAfterProjectiles, + GeneralDrawLayer.AfterPlayers => OnAfterPlayers, + GeneralDrawLayer.AfterDusts => OnAfterDusts, + GeneralDrawLayer.AfterEverything => OnAfterEverything, + _ => null + }; + callback?.Invoke(); + } + + private static void GeneralDrawLayer_DrawToLayer_BeforeAllTiles(On_Main.orig_DrawBackgroundBlackFill orig, Main self) + { + Main.spriteBatch.End(out var ss); + GeneralDrawLayer_DrawForLayer(GeneralDrawLayer.BeforeAllTiles); + Main.spriteBatch.Begin(ss); + orig(self); + } + + private static void GeneralDrawLayer_DrawToLayer_BeforeSolidTiles(On_Main.orig_DoDraw_Tiles_Solid orig, Main self) + { + GeneralDrawLayer_DrawForLayer(GeneralDrawLayer.BeforeSolidTiles); + orig(self); + } + + private static void GeneralDrawLayer_DrawToLayer_NPCs(On_Main.orig_DoDraw_DrawNPCsOverTiles orig, Main self) + { + GeneralDrawLayer_DrawForLayer(GeneralDrawLayer.BeforeNPCs); + orig(self); + GeneralDrawLayer_DrawForLayer(GeneralDrawLayer.AfterNPCs); + } + + private static void GeneralDrawLayer_DrawToLayer_Projectiles(On_Main.orig_DrawProjectiles orig, Main self) + { + GeneralDrawLayer_DrawForLayer(GeneralDrawLayer.BeforeProjectiles); + orig(self); + GeneralDrawLayer_DrawForLayer(GeneralDrawLayer.AfterProjectiles); + } + + private static void GeneralDrawLayer_DrawToLayer_AfterPlayers(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self) + { + orig(self); + GeneralDrawLayer_DrawForLayer(GeneralDrawLayer.AfterPlayers); + } + + private static void GeneralDrawLayer_DrawToLayer_AfterDusts(On_Main.orig_DrawDust orig, Main self) + { + orig(self); + GeneralDrawLayer_DrawForLayer(GeneralDrawLayer.AfterDusts); + } + + private static void GeneralDrawLayer_DrawToLayer_AfterEverything(On_Main.orig_DrawInfernoRings orig, Main self) + { + orig(self); + Main.spriteBatch.End(out var ss); + GeneralDrawLayer_DrawForLayer(GeneralDrawLayer.AfterEverything); + Main.spriteBatch.Begin(ss); + } + #endregion + } +} diff --git a/Systems/Graphic/PixelationSystem/PixelationManager.cs b/Systems/Graphic/PixelationSystem/PixelationManager.cs index bfef86b676..151add53f1 100644 --- a/Systems/Graphic/PixelationSystem/PixelationManager.cs +++ b/Systems/Graphic/PixelationSystem/PixelationManager.cs @@ -81,7 +81,8 @@ namespace CalamityMod.Systems.Graphic.PixelationSystem ActivePixelatedDrawers_AfterDusts = []; ActivePixelatedDrawers_AfterEverything = []; - On_Main.CheckMonoliths += PrepareTargets; + GeneralDrawLayerSystem.OnDrawLayerLate += DrawPixelatedTargets; + GeneralDrawLayerSystem.OnPrepareDraw += PrepareTargets; } public override void Unload() @@ -148,7 +149,7 @@ namespace CalamityMod.Systems.Graphic.PixelationSystem ReturnAssociatedDrawerCollection(drawLayer).Add(drawer); } - private static void PrepareTargets(On_Main.orig_CheckMonoliths orig) + private static void PrepareTargets() { if (!Main.gameMenu && !Main.dedServ) { @@ -165,11 +166,8 @@ namespace CalamityMod.Systems.Graphic.PixelationSystem Main.graphics.GraphicsDevice.SetRenderTarget(null); } - - orig(); - } - + private static void DrawCollectionsToTarget(Dictionary targetCollection, Matrix pixelationMatrix, List drawerCollection) { foreach (var blendStateTargetPair in targetCollection) @@ -192,17 +190,17 @@ namespace CalamityMod.Systems.Graphic.PixelationSystem drawerCollection.Clear(); } - internal static void DrawPixelatedTargets(GeneralDrawLayer drawLayer) + private static void DrawPixelatedTargets(GeneralDrawLayer drawLayer) { var targetCollection = ReturnAssociatedTargetCollection(drawLayer); - foreach (var keyValuePair in targetCollection) - { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(default, keyValuePair.Key, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + foreach (var keyValuePair in targetCollection) + { + Main.spriteBatch.Begin(default, keyValuePair.Key, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - float targetScale = 1f / PixelationResolution; - Main.spriteBatch.Draw(keyValuePair.Value, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, targetScale, SpriteEffects.None, 0f); - } + float targetScale = 1f / PixelationResolution; + Main.spriteBatch.Draw(keyValuePair.Value, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, targetScale, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + } } private static List ReturnAssociatedDrawerCollection(GeneralDrawLayer drawLayer) From ee4054d82e64ada3b69bef7132847f7f9f64eb17 Mon Sep 17 00:00:00 2001 From: sunny-raindrops <140109281+sunny-raindrops@users.noreply.github.com> Date: Tue, 16 Dec 2025 14:51:39 -0800 Subject: [PATCH 39/48] SQUASH: The Blunderbass and Shardshocker (#1016) Enormous number of unneeded merge commits all squashed out of existence intentionally --------- Co-authored-by: Altixal <73398287+Altixal@users.noreply.github.com> --- Items/Weapons/Ranged/AquashardShotgun.cs | 68 ----- Items/Weapons/Ranged/AquashardShotgun.png | Bin 999 -> 0 bytes Items/Weapons/Ranged/Shardshocker.cs | 99 +++++++ Items/Weapons/Ranged/Shardshocker.png | Bin 0 -> 1342 bytes Items/Weapons/Ranged/TheBlunderbass.cs | 101 +++++++ Items/Weapons/Ranged/TheBlunderbass.png | Bin 0 -> 829 bytes ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 26 +- .../Mods.CalamityMod.Projectiles.Ranged.hjson | 3 +- Projectiles/Ranged/Aquashard.cs | 117 +++++++- Projectiles/Ranged/Aquashard.png | Bin 259 -> 826 bytes Projectiles/Ranged/AquashardSplit.cs | 16 +- Projectiles/Ranged/AquashardSplit.png | Bin 0 -> 351 bytes Projectiles/Ranged/ShardshockerCrystal.cs | 259 ++++++++++++++++++ 13 files changed, 597 insertions(+), 92 deletions(-) delete mode 100644 Items/Weapons/Ranged/AquashardShotgun.cs delete mode 100644 Items/Weapons/Ranged/AquashardShotgun.png create mode 100644 Items/Weapons/Ranged/Shardshocker.cs create mode 100644 Items/Weapons/Ranged/Shardshocker.png create mode 100644 Items/Weapons/Ranged/TheBlunderbass.cs create mode 100644 Items/Weapons/Ranged/TheBlunderbass.png create mode 100644 Projectiles/Ranged/AquashardSplit.png create mode 100644 Projectiles/Ranged/ShardshockerCrystal.cs diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs deleted file mode 100644 index e2a590fafb..0000000000 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ /dev/null @@ -1,68 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class AquashardShotgun : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.width = 62; - Item.height = 26; - Item.damage = 12; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 30; - Item.useAnimation = 30; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 5.5f; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item61; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 30f; - Item.useAmmo = AmmoID.Bullet; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; - - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - for (int index = 0; index < 2; ++index) - { - float SpeedX = velocity.X + Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-40, 41) * 0.05f; - - if (type == ProjectileID.Bullet) - { - int projectile = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - Main.projectile[projectile].timeLeft = 200; - } - else - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - } - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.Boomstick). - AddIngredient(2). - AddIngredient(10). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/AquashardShotgun.png b/Items/Weapons/Ranged/AquashardShotgun.png deleted file mode 100644 index 516b1fa7cc75d73cde0477191372990d28cfe904..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 999 zcmVX)@mN$S`R=b{_{?!T2>9a+S~s~ zjl0l?K`ftL1)#fk5P;72&jRqyhfx52`r?WU9?8BTu?Jp%835<{Jr`gx6$hYof4?O? zi-+wN`I;qe?X=-@G429;80-`)7;d%z>Fdi28;8P95z*kAa& z>b#Q0``em-?GmrFJ6Dp%n6`@?e+7W}?{^IHdrqG=+C83}1h#s@(IZCz=pA*8di4NR z>e`P0v>a%&0P+vh#@^CAU|Rs|%LM?OoKy9G)GqOkJtqNhT0?HN4_murMFVaK@OEX@ z{sVgfSa_Il!P~9JKKTgni28N)t4l^Xdg`K4j{SDtC?~(01t9$KkYUeEE&-68&sO^z zo2p&n;ou<`AlnxK;Jwc;7#~cG%Zj%bMgdryjR9b{=H*0KkrfUGWetmolnXHO)F@98rqw!CQC`-Vyz<2M-fqbEv6JFQm@H%dOS^ynV|rmxDWP$&Mz zr*8t@%0$k7X?*C9wfKYpw-+VDviofS_P!*Dl=Q(diS^-;eMbA4X&L9Q2c5vy^IH{o zG7fC@04=MwOa70qe+BBqJ>q`-IX7pNE5%~OYBKD-1439yE8*BLHvn(<)xBk4Bd2$+ z-vc}k&~sj;=f8fp)_kk%yoxijCk2P4UOjYQyK6z6xVH-{DZeU_cW$m4c8zJ3pRnB% zvH;R~NgMJVVIzO=lUKdS1D?jl4ZEH~s!Ubnf~+VP;)CKw~F**u2^& z9&7}E!IIoMl>?yktW-5atQ7Mq%_CH8hs^G}q8}J#z1_8ShAn`^)VDyLxJO*&C;#O3 zQ={B)Msnq2gM(!|*7LI5nB|P?Es_TWhDHF$t)#ydvjkdgitT)Mhxim5B0>t{|Rup}EtkM`|32%8RDauc1EnKx- zv5@swSA9kDlUCI%@y!^oq)=GS-ApoL*qhoVQ?t9;07%WPRO-iq?Z1WnSE^a!{{pfS VWT1Z^Wb*(3002ovPDHLkV1l$z>16-_ diff --git a/Items/Weapons/Ranged/Shardshocker.cs b/Items/Weapons/Ranged/Shardshocker.cs new file mode 100644 index 0000000000..1223124a57 --- /dev/null +++ b/Items/Weapons/Ranged/Shardshocker.cs @@ -0,0 +1,99 @@ +using System; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class Shardshocker : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.25f }; + public override void SetDefaults() + { + Item.width = 86; + Item.height = 44; + Item.damage = 131; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 60; + Item.useAnimation = 60; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.UseSound = null; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 50f; + } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; + + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + SoundEngine.PlaySound(ShootAndReloadSound with { PitchVariance = 0.3f }, position); + SoundEngine.PlaySound(GiantClam.SlamSound with { Pitch = 0.2f }, position); + Projectile.NewProjectile(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); + return false; + } + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 41f; + Vector2 itemSize = new Vector2(Item.width, Item.height); + Vector2 itemOrigin = new Vector2(4, 1); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + base.UseStyle(player, heldItemFrame); + } + + // Recoil + Not having the gun aim downwards + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.5) + rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((0.5f - animProgress) / 0.5f, 2) * player.direction; + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate + + + //Reloads the gun + if (animProgress > 0.5f) + { + float backArmRotation = rotation + 0.52f * player.direction; + + Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); + player.SetCompositeArmBack(true, stretch, backArmRotation); + } + + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(5). + AddIngredient(15). + AddIngredient(2). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/Shardshocker.png b/Items/Weapons/Ranged/Shardshocker.png new file mode 100644 index 0000000000000000000000000000000000000000..dc5fde0017f68f09e019b97d5bd434dafcc4dcaf GIT binary patch literal 1342 zcmV-E1;P4>P)Px#1ZP1_K>z@;j|==^1poj9=t)FDRA@u(nr~>8RT#j38_^#~CD$sqJ9lSmGlv8% zVr!uew_>7#xro&v?&y@4M@^dxqxueS6M(&O7#=-+kWaocE+)iHCOY8}Y`cswz{w@&BDv zv%!%ZtXU++9$B*lfCYQMg`3D+XRIZx*%PYWJ_7LSwpX7~ znl+}ek#oNQkQcrWZUS?iv6irIit z`z8x#tR<|^rWjQD@#_GzG#v$C-O>uJUw!qPS{xhrM~j8j;%opqYF-3j<nw^d(N4cGzNRRwRpU_{aSIxTEb`S<~{EMuw(5On1s2esU~8sX{?DDys!Nm0MfE^ z0C?f~Rp2qzWJOsa0P8MaHZK8C`|CyUb@F;hPmP zu44PAT6>VW(qAa8s(~aJY9hwAO&1HC0SB_ZWh9<4nxzqu}ii!5M3h6fyO+ zM)lU0m5j`gX|B*0ISW8$-dwF+NM!h>?x+?Q&r~a<`a>!gzr3LcfcHOY*J2?&Yo->r zw(3dfe!@mD@iKdR?Y)4WZ!>iogZI&~glqBMM=s)^>aKLgO+*JbpW z99Q!m)?%~1cg9-6SI5qIplAf(r8UdIW8jzHAJY0=xuOZq+Q**+kGX=G>&{2j+uX$L zXJU?%Tr4CqGS+*{_rKc28EXmOESkpd`sx4xooCv7eZ9yyVJQ0%Z#bH>g|AEIYq6~L zpNstkam>Fbq*oaiVydbTb32FPzYBz0(&Df5CW@I;O`Nfo2z=^dVAoIWfqlk8#+&9! z{U{{br4oY$G1)X&=s2dn+U`C-2tZc&4gf-#KlA2jact53 z0Bp!m@muAaU<`Aev6hJYw3CTxuDKUsegTjjd|4r-Mos{blc^h2I#(GaB&t`3)0DZ% z=EBLQxX;iTYl*l|+XiCpv@PmffSmM}9evp)DqsHwcy^y8Cl7Ah!B|Xnotg+|tR<#w zmc`iN)#^NeoV^mn)czLrg@9*PXxI5{KU{}q2H}jg#FWpzoNE6<$}I>wiESe0-e{%@&R9$Q3)#Hjm{llq`v3p{07*qoM6N<$f@77F Ac>n+a literal 0 HcmV?d00001 diff --git a/Items/Weapons/Ranged/TheBlunderbass.cs b/Items/Weapons/Ranged/TheBlunderbass.cs new file mode 100644 index 0000000000..d29689df96 --- /dev/null +++ b/Items/Weapons/Ranged/TheBlunderbass.cs @@ -0,0 +1,101 @@ +using System; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.FurnitureDriftwood; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + [LegacyName("AquashardShotgun")] + public class TheBlunderbass : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.25f }; + public override void SetDefaults() + { + Item.width = 56; + Item.height = 26; + Item.damage = 35; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 55; + Item.useAnimation = 55; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 5.5f; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.UseSound = null; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 25f; + } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; + + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + SoundEngine.PlaySound(ShootAndReloadSound with { PitchVariance = 0.3f }, position); + SoundEngine.PlaySound(GiantClam.SlamSound with { Pitch = 0.2f }, position); + Projectile.NewProjectile(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI); + return false; + } + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 41f; + Vector2 itemSize = new Vector2(Item.width, Item.height); + Vector2 itemOrigin = new Vector2(4, 1); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + base.UseStyle(player, heldItemFrame); + } + + // Recoil + Not having the gun aim downwards + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.5) + rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((0.5f - animProgress) / 0.5f, 2) * player.direction; + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate + + + //Reloads the gun + if (animProgress > 0.5f) + { + float backArmRotation = rotation + 0.52f * player.direction; + + Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount(); + player.SetCompositeArmBack(true, stretch, backArmRotation); + } + + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(15). + AddIngredient(3). + AddIngredient(7). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/Ranged/TheBlunderbass.png b/Items/Weapons/Ranged/TheBlunderbass.png new file mode 100644 index 0000000000000000000000000000000000000000..255af4609df3528f1d6f07fbb4882094c33a7ea3 GIT binary patch literal 829 zcmV-D1H$}?P)Px#1ZP1_K>z@;j|==^1poj7=Sf6CR9Hvtm|aLzK@@;LqwuH5(ljWxSTWreLQM(N z1kuQ%%pgIeh+Zs$ut!7aNs{&@C?lvS%7_pQGKj7 zU}m~&8cDG0_q6BS*}Kbp_sq<>@Q-koR0NzQ6#+Bh;WcP|65%~J;p24^5P)fE7UbLD|D<6|E`>jMpB zoUp8{41kHwc2Eq7xq|(>l+p0?&O>dS{GRJzJ^)$iTeNZEW3Z<1Kmg!W>#Z5BW;@&g zfZmvC09<*+pv>g*;v#kUZ+vZj1d7QWRYyRXaY4*oJ$6pZZ>%~Dz_*45Eidq(VlKtuR?~RhP5{QdZviN-KMO!(#c2SlA6u)LZ}`=7nPX6P*!WH!MLJy0Q@ha02pq$2+BSg`Ub^J^`5=jh1&b~ zw0L()1^{U()(kgx4}guqpZS{sh+l8z{cna)S@OyUHs;LLR1lNqDjUq) z%%Ewg+h@&`#De7ee@trmwuF^hJXh9i-K53upTE{(F}|uY8-Qu=1OT12*TBY{5c&q? z!=ao~>r5FPsSOasm~XU4%gcWFCn96knklg976h|KWuKL9LJ)I8_! "Projectiles.Ranged"; + public int time = 0; public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 20; + Projectile.height = 20; Projectile.friendly = true; + Projectile.tileCollide = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; Projectile.timeLeft = 300; - Projectile.aiStyle = ProjAIStyleID.Arrow; } public override void AI() { - Projectile.velocity.X *= 0.9995f; - Projectile.velocity.Y += 0.01f; + //Rotation + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (time == 1) + { + Vector2 smokeVel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5; + int smokeAmount = Main.rand.Next(8, 12 + 1); + for (int i = 0; i < smokeAmount; i++) + { + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(1.2f, 2f), Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + } + for (int i = 0; i < 5; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 0.4f), false, 12, 0.009f, Color.DarkTurquoise, new Vector2(1.5f, 0.7f), true, false, 1.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + if (time >= 2) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 135 : 279, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.05f, 0.2f) - new Vector2(0, 1)); + dust.scale = Main.rand.NextFloat(0.6f, 0.8f); + dust.noGravity = false; + } + if (time == 14) + { + Projectile.Kill(); + } + time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int projAmt = Main.rand.Next(1, 3); - if (Projectile.owner == Main.myPlayer) + int projAmt = 3; + for (int i = 0; i < projAmt; i++) { - for (int i = 0; i < projAmt; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0f, Projectile.owner); - } + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 35f, 50f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 0f, Projectile.owner); } + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 4; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2() * 0.5f;; + Particle cross = new SparkParticle(Projectile.Center + velocity * 15f, velocity, false, 15, 1.5f, Color.DarkTurquoise, true); + GeneralParticleHandler.SpawnParticle(cross); + } + for (int k = 0; k < 3; k++) + { + Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkSlateBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.25f, 25); + GeneralParticleHandler.SpawnParticle(outerGlow); + Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkTurquoise, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.15f, 25); + GeneralParticleHandler.SpawnParticle(innerGlow); + } + Player Owner = Main.player[Projectile.owner]; + if (Owner.Calamity().GeneralScreenShakePower < 1.2f) + Owner.Calamity().GeneralScreenShakePower = 1.2f; + target.AddBuff(ModContent.BuffType(), 30); } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath with { Volume = 0.8f }, Projectile.Center); + int projAmt = 3; + if (Projectile.owner == Main.myPlayer) + { + for (int i = 0; i < projAmt; i++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 35f, 50f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0f, Projectile.owner); + } + } + // Create Blast + float blastSize = 80; + float minMultiplier = 0.25f; + int hitsToMinMult = 8; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.DamageType = DamageClass.Ranged; + blast.ArmorPenetration = 5; for (int k = 0; k < 5; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkTurquoise, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.08f, 22); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DeepSkyBlue * 0.8f, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.06f, 22, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DeepSkyBlue * 0.8f, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 22, true); + GeneralParticleHandler.SpawnParticle(blastRing3); + for (int i = 0; i < (int)(15); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(1f, 1.3f)); + dust.noGravity = !Main.rand.NextBool(); + dust.color = Main.rand.NextBool(5) ? Color.DeepSkyBlue : Color.DarkTurquoise; + } + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + { + return false; + } + return base.PreDraw(ref lightColor); } } } diff --git a/Projectiles/Ranged/Aquashard.png b/Projectiles/Ranged/Aquashard.png index 0e32025173488e1c6680c9524dbb5273b3bb75ac..54457ff6b4845dd0e906170d21b3c9754bf65837 100644 GIT binary patch literal 826 zcmV-A1I7G_P)Px#1ZP1_K>z@;j|==^1poj7%1J~)R7gw3md{HRVHn3huc-ru>yOHZ$uK}n`XY-ng8{mclYk^GM zFf(z(lrb$9`&cwYEE;l}_j8f^kF>j>z@vaiaoV|_d;Z4!(i-ziYfdv&P4!eY)t6s^ z2t)@>fQob3Dk@ez5@!`TceGb+1t9U}6S$Lu5*gAr7}7WBkA~=vhDaJZNkeDTSh2h> zM9B;ME0yv?#?Hx*z5%wJoXMRB%G4|Xf!w@xE!%}7ecb>|xRnE|iu{+(JIBE0kwo^K zfS$;+O9dT0y#OqXzJ&jxV634HfZ?s>yos_>oSsY4kuU&0RRcE_SPMAod90z$Qd0^( zRl}!hEKX0dI6Z0ET~Odr1Rh1~%^2*>7z}SMABaD;e(xk530v{EBZ7581nWfE6e3xdi~$V^6_V1(NWUTLA3( z8v!_y_+n+a literal 259 zcmV+e0sQ`nP)6e+|aWh&PYTt^xqkevie8D<4mDa67~Ei6QsLM$}| zEyCCsa1_bRDerq6?t>SqQP($_A4JCo0iJIjz>h$&MS19S}Z4Zcu6Of%hcN${AlC?=v{<55Vhq3|jjwkcvxooL{$j zGy_+ccRAyn!p1*~X%b75c=6(Yglg2yeNFSE9pLHuHkTJRegS2BEI);ysZ9U?002ov JPDHLkV1kE@W9t9_ diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index a9555374d0..82ce78b9f9 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -2,13 +2,15 @@ using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Ranged { public class AquashardSplit : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/Ranged/Aquashard"; public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() @@ -36,10 +38,16 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item27, Projectile.position); - for (int k = 0; k < 5; k++) + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.5f, PitchVariance = 0.3f }, Projectile.Center); + Particle Star = new CritSpark(Projectile.Center, Vector2.Zero, Color.SkyBlue, Color.DarkTurquoise, Main.rand.NextFloat(1f, 1.1f), 30, 0.1f, 3f); + GeneralParticleHandler.SpawnParticle(Star); + int num190 = Main.rand.Next(5, 9); + for (int i = 0; i < num190; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Rain, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + int bubbly = Dust.NewDust(Projectile.Center, 0, 0, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1.4f); + Main.dust[bubbly].velocity *= 0.8f; + Main.dust[bubbly].position = Vector2.Lerp(Main.dust[bubbly].position, Projectile.Center, 0.5f); + Main.dust[bubbly].noGravity = true; } } } diff --git a/Projectiles/Ranged/AquashardSplit.png b/Projectiles/Ranged/AquashardSplit.png new file mode 100644 index 0000000000000000000000000000000000000000..55f7bbe5a677d9229e7091407aa72c1b78a4d31f GIT binary patch literal 351 zcmeAS@N?(olHy`uVBq!ia0vp^JU}eO!3HGrSK5O(jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCilyd%8G=SoklUyg%zufJpoPY!-ISNAoijlX_TWjXb|MJzy?*_lVizE90(P z2c4Gjxz@1UKXBA^Gyj4ng%?+vqIbp?IVXwu{&{e~_W8Wxx(|=z0_)|OKLlK4{9*e> z)#2tAj^xNTh7&HU%qN7hZ{7L%4s*i2dZq`b_s{o9pJc){bI+9%-ntqV+ZvOl9qqn2 zPmEc(;oiwZRqCggi55ST=@ey}F7o!7vddjYh3y|6=&^3U!Svwl{ff>bTpJm;-{?A` zxv??3&u`8WOD#92wV!D45B<;{an^LB{Ts593zQ} literal 0 HcmV?d00001 diff --git a/Projectiles/Ranged/ShardshockerCrystal.cs b/Projectiles/Ranged/ShardshockerCrystal.cs new file mode 100644 index 0000000000..75ceacb4f8 --- /dev/null +++ b/Projectiles/Ranged/ShardshockerCrystal.cs @@ -0,0 +1,259 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using CalamityMod.Tiles.Abyss; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.GameContent.Animations.Actions.Sprites; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework.Graphics; +using Terraria.GameContent; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Melee; +using System; +using System.Data; +using CalamityMod.Items.Ammo; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ShardshockerCrystal : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/Aquashard"; + public static readonly SoundStyle Collision = new("CalamityMod/Sounds/Item/ArcNovaDiffuserChargeImpact") { Volume = 0.5f }; + public int time = 0; + + public override void SetDefaults() + { + Projectile.width = 33; + Projectile.height = 33; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + } + + //The crystal can only damage enemies if it's not hanging in the air + public override bool? CanDamage() => time <= 30 ? null : false; + public override void AI() + { + //Set the projectile as traveling and only update rotation while traveling + if (time < 30) + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.ai[1] = 1f; + } + + // Make it lose velocity as it travels + Projectile.velocity *= 0.94f; + #region Traveling Visuals + //Firing effects on frame one + if (time == 1) + { + Vector2 smokeVel = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 5; + int smokeAmount = Main.rand.Next(8, 12 + 1); + for (int i = 0; i < smokeAmount; i++) + { + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVel.RotatedByRandom(0.4f) * Main.rand.NextFloat(1.2f, 2f), Color.White, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.3f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + + } + for (int i = 0; i < 5; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity.RotatedByRandom(0.8f) * Main.rand.NextFloat(0.2f, 0.4f), false, 12, 0.009f, Color.DarkTurquoise, new Vector2(1.5f, 0.7f), true, false, 1.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + //Only spawn dust trails while traveling + if (time >= 2 && time <= 30) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 135 : 279, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.05f, 0.2f) - new Vector2(0, 1)); + dust.scale = Main.rand.NextFloat(0.6f, 0.8f); + dust.noGravity = false; + } + #endregion + //After traveling for 30 frames, come to a stop in the air + if (time >= 30) + { + //Set AI as stopped so traveling crystals can collide with it + Projectile.ai[1] = 0f; + Projectile.velocity = Vector2.Zero; + Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(8f, 10f)); + Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity); + spark.noGravity = true; + spark.color = Main.rand.NextBool() ? Color.Aquamarine : Color.LightSkyBlue; + if (Main.rand.NextBool(13)) + { + // Create a lightning bolt-like particle in the direction of the shot and 3 random hue-shifted ones by the side + Particle bolt = new CrackParticle(Projectile.Center, velocity * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.4f, 0.5f), 12); + GeneralParticleHandler.SpawnParticle(bolt); + + for (int i = 1; i < 4; i++) + { + Particle bolt2 = new CrackParticle(Projectile.Center, velocity.RotatedBy(MathHelper.PiOver2 * i + MathHelper.ToRadians(Main.rand.NextFloat(-40f, 40f))) * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.2f, 0.3f), 12); + GeneralParticleHandler.SpawnParticle(bolt2); + } + } + //Create a lightning AoE every second + if (time % 60 == 0) + { + SoundEngine.PlaySound(SoundID.Item93, Projectile.Center); + // Create Blast + float blastSize = 120; + float minMultiplier = 0.25f; + int hitsToMinMult = 8; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.DamageType = DamageClass.Ranged; + Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.MediumTurquoise : Color.SkyBlue, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.12f, 30); + GeneralParticleHandler.SpawnParticle(blastRing3); + } + //Set up colliding behavior + foreach (Projectile proj in Main.ActiveProjectiles) + { + // Only allow other large crystals to collide + if (proj.type != Type) + continue; + + // Check if the colliding crystal is traveling + if (proj.ai[1] > 0f && Projectile.Hitbox.Intersects(proj.Hitbox)) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/LightningAura"), Projectile.Center); + //Set on kill effects and kill the stopped crystal + Projectile.ai[1] = 2f; + Projectile.Kill(); + //Kill the traveling crystal + proj.timeLeft = 0; + } + } + } + time++; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Create a smaller AoE on direct hits + float blastSize = 130; + float minMultiplier = 0.25f; + int hitsToMinMult = 4; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.DamageType = DamageClass.Ranged; + + target.AddBuff(ModContent.BuffType(), 60); + + #region Visuals and Sound + SoundEngine.PlaySound(Collision, Projectile.Center); + + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.MediumAquamarine : Color.DarkSeaGreen, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.1f, 22, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.18f, 22, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.12f, 22); + GeneralParticleHandler.SpawnParticle(blastRing3); + + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 4; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2() * 0.5f; ; + Particle cross = new SparkParticle(Projectile.Center + velocity * 15f, velocity, false, 15, 1.5f, Color.MediumAquamarine, true); + GeneralParticleHandler.SpawnParticle(cross); + } + for (int k = 0; k < 3; k++) + { + Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkSlateBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.25f, 25); + GeneralParticleHandler.SpawnParticle(outerGlow); + Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.15f, 25); + GeneralParticleHandler.SpawnParticle(innerGlow); + } + + for (int i = 1; i < 8; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(9f, 11f)); + Dust spark = Dust.NewDustPerfect(Projectile.Center, 278, velocity); + spark.color = Main.rand.NextBool() ? Color.Aquamarine : Color.SkyBlue; + } + + for (int i = 1; i < 6; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(8f, 10f)); + Particle bolt2 = new CrackParticle(Projectile.Center, velocity.RotatedBy(MathHelper.PiOver2 * i + MathHelper.ToRadians(Main.rand.NextFloat(-40f, 40f))) * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.8f, 1.1f), 17); + GeneralParticleHandler.SpawnParticle(bolt2); + } + #endregion + } + + public override void OnKill(int timeLeft) + { + //These effects only occur if another crystal collides with a stopped one + if (Projectile.ai[1] == 2f) + { + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/LightningAura"), Projectile.Center); + Player Owner = Main.player[Projectile.owner]; + if (Owner.Calamity().GeneralScreenShakePower < 1.2f) + Owner.Calamity().GeneralScreenShakePower = 1.2f; + int projAmt = 15; + for (int i = 0; i < projAmt; i++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 35f, 50f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2f), 0f, Projectile.owner); + } + float blastSize = 185; + float minMultiplier = 0.25f; + int hitsToMinMult = 8; + int debuff1 = BuffID.Electrified; + int debuffTime = 240; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 4f), 0f, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[1] = debuffTime; + blast.DamageType = DamageClass.Ranged; + for (int i = 1; i < 9; i++) + { + Vector2 velocity = Main.rand.NextVector2Unit() * (Main.rand.NextFloat(8f, 10f)); + Particle bolt2 = new CrackParticle(Projectile.Center, velocity.RotatedBy(MathHelper.PiOver2 * i + MathHelper.ToRadians(Main.rand.NextFloat(-40f, 40f))) * 0.5f, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, Vector2.One, 0, 0, Main.rand.NextFloat(0.9f, 1.5f), 20); + GeneralParticleHandler.SpawnParticle(bolt2); + } + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-12, 12), 0f, 0.25f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.MediumAquamarine : Color.DarkSeaGreen, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.13f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.DarkTurquoise : Color.SkyBlue, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.16f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing3); + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 4; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 4f + offset).ToRotationVector2() * 0.5f; ; + Particle cross = new SparkParticle(Projectile.Center + velocity * 15f, velocity, false, 15, 2.5f, Color.MediumAquamarine, true); + GeneralParticleHandler.SpawnParticle(cross); + } + for (int k = 0; k < 3; k++) + { + Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.DarkSlateBlue, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.25f, 25); + GeneralParticleHandler.SpawnParticle(outerGlow); + Particle innerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.MediumAquamarine, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.4f, 0.15f, 25); + GeneralParticleHandler.SpawnParticle(innerGlow); + } + } + //These effects always occur + SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath with { Volume = 0.8f }, Projectile.Center); + for (int i = 0; i < (int)(15); i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(1f, 1.3f)); + dust.noGravity = !Main.rand.NextBool(); + dust.color = Main.rand.NextBool(5) ? Color.DeepSkyBlue : Color.DarkTurquoise; + } + } + public override bool PreDraw(ref Color lightColor) + { + //Don't draw the projectile for the first two frames, to prevent it from coming out of the player + if (time < 2) + { + return false; + } + return base.PreDraw(ref lightColor); + } + } +} From 8d48230045d991730d3eb9e0a0e11910146cd96a Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Mon, 8 Dec 2025 23:11:44 -0800 Subject: [PATCH 40/48] create sets for rogue subclasses --- Systems/Collections/CalamityItemSets.cs | 50 +++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/Systems/Collections/CalamityItemSets.cs b/Systems/Collections/CalamityItemSets.cs index 64c8493afb..0c61657b64 100644 --- a/Systems/Collections/CalamityItemSets.cs +++ b/Systems/Collections/CalamityItemSets.cs @@ -82,5 +82,55 @@ namespace CalamityMod.Systems.Collections ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + + /// + /// If for an item type, this item is considered to be a rogue bomb.
+ /// Currently unused, and exists as an objective classification for the sake of the Wiki.
+ /// Defaults to . + ///
+ public static bool[] RogueBomb = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType()); + + /// + /// If for an item type, this item is considered to be a rogue boomerang.
+ /// Currently unused, and exists as an objective classification for the sake of the Wiki.
+ /// Defaults to . + ///
+ public static bool[] RogueBoomerang = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType()); + + /// + /// If for an item type, this item is considered to be a rogue dagger.
+ /// Currently unused, and exists as an objective classification for the sake of the Wiki.
+ /// Defaults to . + ///
+ public static bool[] RogueDagger = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType()); + + /// + /// If for an item type, this item is considered to be a rogue javelin.
+ /// Currently unused, and exists as an objective classification for the sake of the Wiki.
+ /// Defaults to . + ///
+ public static bool[] RogueJavelin = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + + /// + /// If for an item type, this item is considered to be a rogue spiky ball.
+ /// Currently unused, and exists as an objective classification for the sake of the Wiki.
+ /// Defaults to . + ///
+ public static bool[] RogueSpikyBall = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType()); } } From ede2f4f1ae9baad5a59671aa5df49b56aa3a2473 Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Mon, 8 Dec 2025 23:20:25 -0800 Subject: [PATCH 41/48] glaive and bstar are no longer boomerangs --- Systems/Collections/CalamityItemSets.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Systems/Collections/CalamityItemSets.cs b/Systems/Collections/CalamityItemSets.cs index 0c61657b64..dec0d62792 100644 --- a/Systems/Collections/CalamityItemSets.cs +++ b/Systems/Collections/CalamityItemSets.cs @@ -98,11 +98,10 @@ namespace CalamityMod.Systems.Collections /// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueBoomerang = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType()); + public static bool[] RogueBoomerang = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); /// /// If for an item type, this item is considered to be a rogue dagger.
From 06ec9677debdc99aad159b2e742b015f700b062c Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 9 Dec 2025 10:46:04 -0500 Subject: [PATCH 42/48] Set changes: - Bomb list: Added Leonid Progenitor and Pumpkaboom, removed Doomsday Device - Removed Sand Dollar from boomerang list - Added Terror Talons to dagger list - Added Antlion Skewer to javelin list --- Systems/Collections/CalamityItemSets.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Systems/Collections/CalamityItemSets.cs b/Systems/Collections/CalamityItemSets.cs index dec0d62792..24d659a83a 100644 --- a/Systems/Collections/CalamityItemSets.cs +++ b/Systems/Collections/CalamityItemSets.cs @@ -89,19 +89,19 @@ namespace CalamityMod.Systems.Collections /// Defaults to . ///
public static bool[] RogueBomb = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType()); + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); /// /// If for an item type, this item is considered to be a rogue boomerang.
/// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueBoomerang = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + public static bool[] RogueBoomerang = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); /// /// If for an item type, this item is considered to be a rogue dagger.
@@ -111,7 +111,7 @@ namespace CalamityMod.Systems.Collections public static bool[] RogueDagger = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); @@ -120,8 +120,8 @@ namespace CalamityMod.Systems.Collections /// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueJavelin = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + public static bool[] RogueJavelin = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); /// From 6904f51ee48ec6986e0ebfc821e00884b90a99a8 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Sat, 13 Dec 2025 09:48:17 +0900 Subject: [PATCH 43/48] Split grabRangeMultiplier from CalamityGlobalItem --- Items/CalamityGlobalItem.cs | 10 ++------ Items/GrabRangeGlobalItem.cs | 37 ++++++++++++++++++++++++++++++ Projectiles/Ranged/RicoshotCoin.cs | 4 +++- 3 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 Items/GrabRangeGlobalItem.cs diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 14d74abe39..05afd9a0bc 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -125,11 +125,6 @@ namespace CalamityMod.Items /// Adds "- Dev Item -" to the bottom of the item's tooltip. /// public bool devItem = false; - /// - /// If set to a value greater than 1, applies a multiplier to the item's grab range.
- /// Used by coin items spawned from hitting ricoshot coins. - ///
- public float grabRangeMultiplier = 1f; public static readonly Color ExhumedTooltipColor = new Color(198, 27, 64); @@ -168,7 +163,6 @@ namespace CalamityMod.Items myClone.revengeanceItem = revengeanceItem; myClone.donorItem = donorItem; myClone.devItem = devItem; - myClone.grabRangeMultiplier = grabRangeMultiplier; return myClone; } @@ -1448,8 +1442,8 @@ namespace CalamityMod.Items public override void GrabRange(Item item, Player player, ref int grabRange) { // First, apply the grab range multiplier. - if (grabRangeMultiplier > 1f) - grabRange = (int)(grabRangeMultiplier * grabRange); + if (item.TryGetGlobalItem(out var grabRangeItem) && grabRangeItem.grabRangeMultiplier > 1f) + grabRange = (int)(grabRangeItem.grabRangeMultiplier * grabRange); // Then, apply flat grab range boosts. if (player.Calamity().reaverExplore) diff --git a/Items/GrabRangeGlobalItem.cs b/Items/GrabRangeGlobalItem.cs new file mode 100644 index 0000000000..8236179656 --- /dev/null +++ b/Items/GrabRangeGlobalItem.cs @@ -0,0 +1,37 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items; + +internal sealed class GrabRangeGlobalItem : GlobalItem +{ + /// + /// If set to a value greater than 1, applies a multiplier to the item's grab range.
+ /// Used by coin items spawned from hitting ricoshot coins. + ///
+ public float grabRangeMultiplier = 1f; + + public override bool InstancePerEntity => true; + + public override bool AppliesToEntity(Item entity, bool lateInstantiation) + { + return entity.type switch + { + ItemID.CopperCoin + or ItemID.SilverCoin + or ItemID.GoldCoin + or ItemID.PlatinumCoin => true, + _ => false, + }; + } + + public override GlobalItem Clone(Item item, Item itemClone) + { + GrabRangeGlobalItem myClone = (GrabRangeGlobalItem)base.Clone(item, itemClone); + myClone.grabRangeMultiplier = grabRangeMultiplier; + return myClone; + } + + // GrabRange hook is Placed in CalamityGlobalItem for sake of ordering +} diff --git a/Projectiles/Ranged/RicoshotCoin.cs b/Projectiles/Ranged/RicoshotCoin.cs index b8090108e7..f8f2a35d1e 100644 --- a/Projectiles/Ranged/RicoshotCoin.cs +++ b/Projectiles/Ranged/RicoshotCoin.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Items; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -243,7 +244,8 @@ namespace CalamityMod.Projectiles.Ranged _ => ItemID.CopperCoin, }; int coin = Item.NewItem(Projectile.GetSource_DropAsItem(), Projectile.Center, Vector2.One, itemID, noBroadcast: false); - Main.item[coin].Calamity().grabRangeMultiplier = UsedCoinGrabRangeMultiplier; + if (Main.item[coin].TryGetGlobalItem(out var grabRangeItem)) + grabRangeItem.grabRangeMultiplier = UsedCoinGrabRangeMultiplier; // Sync this dropped coin in multiplayer. if (Main.netMode == NetmodeID.MultiplayerClient) From eab66bfe48fdeec644d369e13f3a35daac20fb61 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Sat, 13 Dec 2025 09:53:46 +0900 Subject: [PATCH 44/48] Applied BitPacking for Miscellaneous fields --- Items/CalamityGlobalItem.cs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 05afd9a0bc..692845b85d 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -110,21 +110,34 @@ namespace CalamityMod.Items #endregion // Miscellaneous stuff + private byte miscellaneousFlag0 = 0; /// /// Set to true if this item can only be obtained in Revengeance Mode.
/// Adds "Revengeance" to the bottom of the item's tooltip. ///
- public bool revengeanceItem = false; + public bool revengeanceItem + { + get => TileDataPacking.GetBit(miscellaneousFlag0, 0); + set => miscellaneousFlag0 = (byte)TileDataPacking.SetBit(value, miscellaneousFlag0, 0); + } /// /// Set to true if this item is dedicated to a Patreon donator.
/// Adds "- Donor Item -" to the bottom of the item's tooltip. ///
- public bool donorItem = false; + public bool donorItem + { + get => TileDataPacking.GetBit(miscellaneousFlag0, 1); + set => miscellaneousFlag0 = (byte)TileDataPacking.SetBit(value, miscellaneousFlag0, 1); + } /// /// Set to true if this item is dedicated to a Calamity developer.
/// Adds "- Dev Item -" to the bottom of the item's tooltip. ///
- public bool devItem = false; + public bool devItem + { + get => TileDataPacking.GetBit(miscellaneousFlag0, 2); + set => miscellaneousFlag0 = (byte)TileDataPacking.SetBit(value, miscellaneousFlag0, 2); + } public static readonly Color ExhumedTooltipColor = new Color(198, 27, 64); @@ -160,9 +173,7 @@ namespace CalamityMod.Items myClone.DischargeEnchantExhaustion = DischargeEnchantExhaustion; // Miscellaneous - myClone.revengeanceItem = revengeanceItem; - myClone.donorItem = donorItem; - myClone.devItem = devItem; + myClone.miscellaneousFlag0 = miscellaneousFlag0; return myClone; } From 3747397cc2ff06e99f52f31bc2e67accd695ab31 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Sat, 13 Dec 2025 10:01:04 +0900 Subject: [PATCH 45/48] Include CannotBeEnchanted to Bit Packing --- Items/CalamityGlobalItem.cs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 692845b85d..b0abfe1d5a 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -56,6 +56,8 @@ namespace CalamityMod.Items /// Tracks the stealth strike damage modifier for this item, derived from its prefix. internal float StealthStrikePrefixBonus; + private byte flag0 = 0; + #region Chargeable Item Variables /// /// If set to true, this item will consume on use.
@@ -85,7 +87,11 @@ namespace CalamityMod.Items #region Enchantment Variables /// If set to true, this item cannot receive enchantments from the Brimstone Witch. - public bool CannotBeEnchanted = false; + public bool CannotBeEnchanted + { + get => TileDataPacking.GetBit(flag0, 0); + set => flag0 = (byte)TileDataPacking.SetBit(value, flag0, 0); + } /// Stores the current enchantment placed on this item. If set to null, this item has no enchantment. public Enchantment? AppliedEnchantment = null; /// @@ -110,15 +116,14 @@ namespace CalamityMod.Items #endregion // Miscellaneous stuff - private byte miscellaneousFlag0 = 0; /// /// Set to true if this item can only be obtained in Revengeance Mode.
/// Adds "Revengeance" to the bottom of the item's tooltip. ///
public bool revengeanceItem { - get => TileDataPacking.GetBit(miscellaneousFlag0, 0); - set => miscellaneousFlag0 = (byte)TileDataPacking.SetBit(value, miscellaneousFlag0, 0); + get => TileDataPacking.GetBit(flag0, 1); + set => flag0 = (byte)TileDataPacking.SetBit(value, flag0, 1); } /// /// Set to true if this item is dedicated to a Patreon donator.
@@ -126,8 +131,8 @@ namespace CalamityMod.Items ///
public bool donorItem { - get => TileDataPacking.GetBit(miscellaneousFlag0, 1); - set => miscellaneousFlag0 = (byte)TileDataPacking.SetBit(value, miscellaneousFlag0, 1); + get => TileDataPacking.GetBit(flag0, 2); + set => flag0 = (byte)TileDataPacking.SetBit(value, flag0, 2); } /// /// Set to true if this item is dedicated to a Calamity developer.
@@ -135,8 +140,8 @@ namespace CalamityMod.Items ///
public bool devItem { - get => TileDataPacking.GetBit(miscellaneousFlag0, 2); - set => miscellaneousFlag0 = (byte)TileDataPacking.SetBit(value, miscellaneousFlag0, 2); + get => TileDataPacking.GetBit(flag0, 3); + set => flag0 = (byte)TileDataPacking.SetBit(value, flag0, 3); } public static readonly Color ExhumedTooltipColor = new Color(198, 27, 64); @@ -157,6 +162,9 @@ namespace CalamityMod.Items { CalamityGlobalItem myClone = (CalamityGlobalItem)base.Clone(item, itemClone); + // BitFlags + myClone.flag0 = flag0; + // Rogue myClone.StealthStrikePrefixBonus = StealthStrikePrefixBonus; @@ -168,13 +176,9 @@ namespace CalamityMod.Items myClone.ChargePerAltUse = ChargePerAltUse; // Enchantments - myClone.CannotBeEnchanted = CannotBeEnchanted; myClone.AppliedEnchantment = AppliedEnchantment.HasValue ? AppliedEnchantment.Value : null; myClone.DischargeEnchantExhaustion = DischargeEnchantExhaustion; - // Miscellaneous - myClone.miscellaneousFlag0 = miscellaneousFlag0; - return myClone; } From e731168f58c9286fae5e24e2b75b1db9a3c63fff Mon Sep 17 00:00:00 2001 From: Flowaria Date: Tue, 16 Dec 2025 12:11:38 +0900 Subject: [PATCH 46/48] Use BitsByte instead of DataPacking --- Items/CalamityGlobalItem.cs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index b0abfe1d5a..93bbdc5796 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -56,14 +56,18 @@ namespace CalamityMod.Items /// Tracks the stealth strike damage modifier for this item, derived from its prefix. internal float StealthStrikePrefixBonus; - private byte flag0 = 0; + private BitsByte flag0 = 0; #region Chargeable Item Variables /// /// If set to true, this item will consume on use.
/// Be sure to also set and . ///
- public bool UsesCharge = false; + public bool UsesCharge + { + get => flag0[0]; + set => flag0[0] = value; + } /// The current charge value of this item. public float Charge = 0f; /// The maximum charge value of this item. Should only be set if is set to true. @@ -89,8 +93,8 @@ namespace CalamityMod.Items /// If set to true, this item cannot receive enchantments from the Brimstone Witch. public bool CannotBeEnchanted { - get => TileDataPacking.GetBit(flag0, 0); - set => flag0 = (byte)TileDataPacking.SetBit(value, flag0, 0); + get => flag0[1]; + set => flag0[1] = value; } /// Stores the current enchantment placed on this item. If set to null, this item has no enchantment. public Enchantment? AppliedEnchantment = null; @@ -122,8 +126,8 @@ namespace CalamityMod.Items ///
public bool revengeanceItem { - get => TileDataPacking.GetBit(flag0, 1); - set => flag0 = (byte)TileDataPacking.SetBit(value, flag0, 1); + get => flag0[2]; + set => flag0[2] = value; } /// /// Set to true if this item is dedicated to a Patreon donator.
@@ -131,8 +135,8 @@ namespace CalamityMod.Items ///
public bool donorItem { - get => TileDataPacking.GetBit(flag0, 2); - set => flag0 = (byte)TileDataPacking.SetBit(value, flag0, 2); + get => flag0[3]; + set => flag0[3] = value; } /// /// Set to true if this item is dedicated to a Calamity developer.
@@ -140,8 +144,8 @@ namespace CalamityMod.Items ///
public bool devItem { - get => TileDataPacking.GetBit(flag0, 3); - set => flag0 = (byte)TileDataPacking.SetBit(value, flag0, 3); + get => flag0[4]; + set => flag0[4] = value; } public static readonly Color ExhumedTooltipColor = new Color(198, 27, 64); From 304f5910419294cfe42439afc737931f8f151a47 Mon Sep 17 00:00:00 2001 From: doze-zoze Date: Tue, 16 Dec 2025 17:03:21 -0600 Subject: [PATCH 47/48] merge resolutions --- NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index a39aa460fe..ad778bbd19 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -136,12 +136,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NPC.ai[1] = Main.npc[(int)NPC.ai[3]].ai[1]; dontTakeDamage = true; - if (npc.ai[0] == 5f && npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual) + if (NPC.ai[0] == 5f && NPC.ai[1] >= 120f && NPC.ai[1] < timeToFinishRitual) { dontTakeDamage = false; - if (npc.justHit) + if (NPC.justHit) { - var mainCultist = Main.npc[(int)npc.ai[3]]; + var mainCultist = Main.npc[(int)NPC.ai[3]]; mainCultist.ai[1] = timeToFinishRitual; } } @@ -927,7 +927,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { NPC.localAI[2] = 13f; - if ((NPC.ai[1] >= 4f & isCultist) && (int)(NPC.ai[1] - 4f) % 20f == 0f && npc.ai[1] <= 64) + if ((NPC.ai[1] >= 4f & isCultist) && (int)(NPC.ai[1] - 4f) % 20f == 0f && NPC.ai[1] <= 64) { List list8 = new List(); for (int k = 0; k < Main.maxNPCs; k++) From e9230a19a816bef33ad5c6d945270efe17a0e0bb Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Tue, 16 Dec 2025 15:39:01 -0800 Subject: [PATCH 48/48] alphabetically sort rogue sets --- Systems/Collections/CalamityItemSets.cs | 27 +++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Systems/Collections/CalamityItemSets.cs b/Systems/Collections/CalamityItemSets.cs index 24d659a83a..8d28499100 100644 --- a/Systems/Collections/CalamityItemSets.cs +++ b/Systems/Collections/CalamityItemSets.cs @@ -88,20 +88,20 @@ namespace CalamityMod.Systems.Collections /// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueBomb = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + public static bool[] RogueBomb = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); /// /// If for an item type, this item is considered to be a rogue boomerang.
/// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueBoomerang = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + public static bool[] RogueBoomerang = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); /// /// If for an item type, this item is considered to be a rogue dagger.
@@ -120,16 +120,17 @@ namespace CalamityMod.Systems.Collections /// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueJavelin = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + public static bool[] RogueJavelin = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType()); /// /// If for an item type, this item is considered to be a rogue spiky ball.
/// Currently unused, and exists as an objective classification for the sake of the Wiki.
/// Defaults to . ///
- public static bool[] RogueSpikyBall = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), - ItemType()); + public static bool[] RogueSpikyBall = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType()); } }