From 52ffc8cb19c022e3453837d17c0d6e9faa1459ea Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Sat, 30 May 2020 20:00:16 -0500 Subject: [PATCH 1/2] Couple of sulph sea adjustments (see description) - Made the acid rain depend on whether the rain is active. - Made the acid rain go away after 4 minutes if no enemies are killed in that time period. - Prevented natural tiles from forming a clump above the sulph sea during worldgen - Cut a good amount of of lag from the sulph sea generation process. - Changed the 98% completion to 99% when Old Duke appears. --- CalamityMod.cs | 1 + Events/AcidRainEvent.cs | 12 +++-- Items/Tools/ClimateChange/TorrentialTear.cs | 14 +---- NPCs/CalamityGlobalNPCLoot.cs | 7 ++- World/Abyss.cs | 45 +++++++++++++--- World/CalamityWorld.cs | 60 ++++++++++++++++----- 6 files changed, 97 insertions(+), 42 deletions(-) diff --git a/CalamityMod.cs b/CalamityMod.cs index 5ef3fbafb4..f93d0441d5 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -3743,6 +3743,7 @@ namespace CalamityMod case CalamityModMessageType.AcidRainSync: CalamityWorld.rainingAcid = reader.ReadBoolean(); CalamityWorld.acidRainPoints = reader.ReadInt32(); + CalamityWorld.timeSinceAcidRainKill = reader.ReadInt32(); break; case CalamityModMessageType.AcidRainUIDrawFadeSync: CalamityWorld.acidRainExtraDrawTime = reader.ReadInt32(); diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 0b32c27cb6..58bdc882ab 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -35,6 +35,8 @@ namespace CalamityMod.Events // A partially bright pale-ish cyan with a hint of yellow. public static readonly Color TextColor = new Color(115, 194, 147); + public const int InvasionNoKillPersistTime = 14400; // How long the invasion persists, in frames, if nothing is killed. + public const float BloodwormSpawnRate = 0.1f; // Not a readonly collection so that if anyone else wants to add stuff in here with their own mod, they can. @@ -168,17 +170,16 @@ namespace CalamityMod.Events Main.numClouds = Main.numCloudsTemp; Main.windSpeedTemp = 0.72f; Main.windSpeedSet = Main.windSpeedTemp; - Main.weatherCounter = 600; + Main.weatherCounter = 60 * 60 * 10; // 10 minutes of rain. Remember, once the rain goes away, so does the invasion. + Main.rainTime = Main.weatherCounter; Main.maxRaining = 0.89f; CalamityWorld.forcedDownpourWithTear = true; CalamityMod.UpdateServerBoolean(); } - if (CalamityWorld.startAcidicDownpour) - { - Main.raining = true; - } CalamityWorld.triedToSummonOldDuke = false; + CalamityWorld.timeSinceAcidRainKill = 0; // Reset the kill cooldown, just in case. } + UpdateInvasion(); BroadcastEventText("Mods.CalamityMod.AcidRainStart"); // A toxic downpour falls over the wasteland seas! } @@ -223,6 +224,7 @@ namespace CalamityMod.Events netMessage.Write((byte)CalamityModMessageType.AcidRainSync); netMessage.Write(CalamityWorld.rainingAcid); netMessage.Write(CalamityWorld.acidRainPoints); + netMessage.Write(CalamityWorld.timeSinceAcidRainKill); netMessage.Send(); } if (Main.netMode == NetmodeID.Server) diff --git a/Items/Tools/ClimateChange/TorrentialTear.cs b/Items/Tools/ClimateChange/TorrentialTear.cs index 3f664889a9..8342d2ba68 100644 --- a/Items/Tools/ClimateChange/TorrentialTear.cs +++ b/Items/Tools/ClimateChange/TorrentialTear.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool CanUseItem(Player player) { - return !Main.slimeRain && (Main.rainTime > 3600 || !CalamityWorld.death || !Main.raining); + return !Main.slimeRain && (Main.rainTime > 3600 || !CalamityWorld.death || !Main.raining || CalamityWorld.rainingAcid); } public override bool UseItem(Player player) @@ -48,22 +48,10 @@ namespace CalamityMod.Items.Tools.ClimateChange Main.rainTime = 3600; AdjustRainSeverity(true); } - if (CalamityWorld.rainingAcid) - { - CalamityWorld.acidRainPoints = 0; - CalamityWorld.triedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - } } else { Main.raining = false; - if (CalamityWorld.rainingAcid) - { - CalamityWorld.acidRainPoints = 0; - CalamityWorld.triedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - } } CalamityMod.UpdateServerBoolean(); diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 3b773eccd8..a44ade281f 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1623,16 +1623,18 @@ namespace CalamityMod.NPCs private void AcidRainProgression(NPC npc) { Dictionary possibleEnemies = AcidRainEvent.PossibleEnemiesPreHM; + if (CalamityWorld.downedAquaticScourge) possibleEnemies = AcidRainEvent.PossibleEnemiesAS; if (CalamityWorld.downedPolterghast) possibleEnemies = AcidRainEvent.PossibleEnemiesPolter; + if (possibleEnemies.Select(enemy => enemy.Key).Contains(npc.type) && CalamityWorld.rainingAcid) { CalamityWorld.acidRainPoints -= possibleEnemies[npc.type].InvasionContributionPoints; if (CalamityWorld.downedPolterghast) { - CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke. + CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. } } Dictionary possibleMinibosses = CalamityWorld.downedPolterghast ? AcidRainEvent.PossibleMinibossesPolter : AcidRainEvent.PossibleMinibossesAS; @@ -1641,7 +1643,7 @@ namespace CalamityMod.NPCs CalamityWorld.acidRainPoints -= possibleMinibosses[npc.type].InvasionContributionPoints; if (CalamityWorld.downedPolterghast) { - CalamityWorld.acidRainPoints = (int)MathHelper.Max(2, CalamityWorld.acidRainPoints); // Cap at 2. The last points are for Old Duke. + CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. } } @@ -1654,6 +1656,7 @@ namespace CalamityMod.NPCs CalamityWorld.triedToSummonOldDuke = false; CalamityWorld.acidRainPoints = 0; } + CalamityWorld.timeSinceAcidRainKill = 0; AcidRainEvent.UpdateInvasion(); } #endregion diff --git a/World/Abyss.cs b/World/Abyss.cs index e63c4a6171..ba826d1a67 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -72,6 +72,7 @@ namespace CalamityMod.World GenerateUpperSea(); CreateWater(); GenerateHardenedSandstone(); + RemoveStupidTilesAboveSea(); SettleWater(); // The island Y spawn position calculations are relative to water. Settling the water before doing these calculations is ideal. GenerateIslands(); GenerateVentsAndFossils(); @@ -326,13 +327,6 @@ namespace CalamityMod.World } } } - else if (WorldGen.genRand.NextBool(10)) - { - for (int i = 0; i < 20; i++) - { - TileLoader.RandomUpdate(trueX, y, Main.tile[trueX, y].type); - } - } } } } @@ -758,9 +752,30 @@ namespace CalamityMod.World } #endregion + #region Removal of stupid Tiles above the Sea + public static void RemoveStupidTilesAboveSea() + { + for (int x = 0; x < BiomeWidth; x++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + for (int y = YStart - 100; y < YStart + 60; y++) + { + if (YStartWhitelist.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y).type)) + { + if (Main.tile[trueX, y] == null) + Main.tile[trueX, y] = new Tile(); + Main.tile[trueX, y].active(false); + } + } + } + } + #endregion + #region Misc Functions public static List YStartWhitelist = new List() { + TileID.Stone, + TileID.Dirt, TileID.Sand, TileID.Ebonsand, TileID.Crimsand, @@ -777,12 +792,26 @@ namespace CalamityMod.World TileID.Tungsten, TileID.Crimstone, TileID.Ebonstone, + TileID.HardenedSand, + TileID.CorruptHardenedSand, + TileID.CrimsonHardenedSand, + TileID.Coral, + TileID.BeachPiles, + TileID.Plants, + TileID.Plants2, + TileID.SmallPiles, + TileID.LargePiles, + TileID.LargePiles2, + TileID.Trees, + TileID.Vines, + TileID.CrimsonVines, + TileID.Containers, TileID.JungleGrass // Yes, this can happen on rare occasion }; public static void DetermineYStart() { int maxHeight = 0; - for (int i = 0; i < BiomeWidth; i++) + for (int i = 0; i < BiomeWidth - 18; i++) { int xCheck = CalamityWorld.abyssSide ? BiomeWidth - i : diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 0241a79a34..73ad082a3e 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -111,6 +111,8 @@ namespace CalamityMod.World public static bool forcedRainAlready = false; public static bool forcedDownpourWithTear = false; public static int forceRainTimer = 0; + public static int timeSinceAcidRainKill = 0; + public static int timeSinceAcidStarted = 0; public static float AcidRainCompletionRatio { get @@ -967,6 +969,17 @@ namespace CalamityMod.World if (rainingAcid) { + timeSinceAcidRainKill++; + timeSinceAcidStarted++; + + // If enough time has passed, and no enemy has been killed, end the invasion early. + // The player almost certainly does not want to deal with it. + if (timeSinceAcidRainKill >= AcidRainEvent.InvasionNoKillPersistTime) + { + acidRainPoints = 0; + triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } if (!startAcidicDownpour) { int sulphSeaWidth = Abyss.BiomeWidth; @@ -984,6 +997,8 @@ namespace CalamityMod.World (player2.Center.X >= (Main.maxTilesX - (sulphSeaWidth + 60f)) * 16f && !abyssSide)) && player2.Calamity().ZoneSulphur) { + // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) + // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! startAcidicDownpour = true; CalamityMod.UpdateServerBoolean(); break; @@ -992,22 +1007,37 @@ namespace CalamityMod.World } } - // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) - // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! - if ((startAcidicDownpour || forcedDownpourWithTear) && !NPC.AnyNPCs(ModContent.NPCType())) + // Stop the rain if the Old Duke is present for visibility during the fight. + if (Main.raining && NPC.AnyNPCs(ModContent.NPCType())) { - Main.raining = true; - Main.cloudBGActive = 1f; - Main.numCloudsTemp = Main.cloudLimit; - Main.numClouds = Main.numCloudsTemp; - Main.windSpeedTemp = 0.72f; - Main.windSpeedSet = Main.windSpeedTemp; - Main.weatherCounter = 600; - Main.maxRaining = 0.89f; - } + Main.raining = false; + CalamityMod.UpdateServerBoolean(); + } + + // If the rain stops for whatever reason, end the invasion. + // This is primarily done for compatibility, so that if another mod wants to manipulate the weather, + // they can without having to deal with endless rain. + if (!Main.raining && !NPC.AnyNPCs(ModContent.NPCType()) && timeSinceAcidStarted > 20) + { + acidRainPoints = 0; + triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } + else if (timeSinceAcidStarted < 20) + { + Main.raining = true; + Main.cloudBGActive = 1f; + Main.numCloudsTemp = Main.cloudLimit; + Main.numClouds = Main.numCloudsTemp; + Main.windSpeedTemp = 0.72f; + Main.windSpeedSet = Main.windSpeedTemp; + Main.weatherCounter = 60 * 60 * 10; // 10 minutes of rain. Remember, once the rain goes away, so does the invasion. + Main.rainTime = Main.weatherCounter; + Main.maxRaining = 0.89f; + } // Summon Old Duke tornado post-Polter as needed - if (downedPolterghast && acidRainPoints == 2) + if (downedPolterghast && acidRainPoints == 1) { if (!NPC.AnyNPCs(ModContent.NPCType()) && CalamityUtils.CountProjectiles(ModContent.ProjectileType()) <= 0) @@ -1033,7 +1063,9 @@ namespace CalamityMod.World } else { - startAcidicDownpour = false; + if (timeSinceAcidStarted != 0) + timeSinceAcidStarted = 0; + startAcidicDownpour = false; } // Lumenyl crystal, tenebris spread and sea prism crystal spawn rates From 3826395b25aba254c2ef12ec9970bf2b58bf30a9 Mon Sep 17 00:00:00 2001 From: DominicKarma42 <51094361+DominicKarma@users.noreply.github.com> Date: Sun, 31 May 2020 02:34:54 -0500 Subject: [PATCH 2/2] Removed locked rusty chest variants and lockpicks --- Items/Accessories/BrokenWaterFilter.cs | 1 - Items/Accessories/RustyMedallion.cs | 1 - Items/Placeables/Furniture/EffigyOfDecay.cs | 1 - Items/Placeables/Furniture/RustyChest.cs | 2 +- Items/RustyLockpick.cs | 30 ----- Items/RustyLockpick.png | Bin 383 -> 0 bytes Items/Weapons/Summon/RustyBeaconPrototype.cs | 3 +- Projectiles/Summon/RustyDrone.cs | 7 +- Tiles/Abyss/RustyChestLocked.cs | 124 ------------------- Tiles/Abyss/RustyChestLocked.png | Bin 1539 -> 0 bytes Tiles/Abyss/RustyChestLocked_Highlight.png | Bin 845 -> 0 bytes Tiles/Abyss/RustyChestTile.cs | 81 ++++++++++++ Tiles/Abyss/RustyChestTile.png | Bin 0 -> 995 bytes Tiles/Abyss/RustyChestTile_Highlight.png | Bin 0 -> 632 bytes World/Abyss.cs | 2 +- World/WorldGenerationMethods.cs | 2 +- 16 files changed, 88 insertions(+), 166 deletions(-) delete mode 100644 Items/RustyLockpick.cs delete mode 100644 Items/RustyLockpick.png delete mode 100644 Tiles/Abyss/RustyChestLocked.cs delete mode 100644 Tiles/Abyss/RustyChestLocked.png delete mode 100644 Tiles/Abyss/RustyChestLocked_Highlight.png create mode 100644 Tiles/Abyss/RustyChestTile.cs create mode 100644 Tiles/Abyss/RustyChestTile.png create mode 100644 Tiles/Abyss/RustyChestTile_Highlight.png diff --git a/Items/Accessories/BrokenWaterFilter.cs b/Items/Accessories/BrokenWaterFilter.cs index 83401f1c0f..6778deaeec 100644 --- a/Items/Accessories/BrokenWaterFilter.cs +++ b/Items/Accessories/BrokenWaterFilter.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index 9d29b47034..df33a26427 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index 50eb4a6b11..1121f4a65e 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Placeables.Furniture public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/Items/Placeables/Furniture/RustyChest.cs b/Items/Placeables/Furniture/RustyChest.cs index 0230fb4cbc..4a01ba73f0 100644 --- a/Items/Placeables/Furniture/RustyChest.cs +++ b/Items/Placeables/Furniture/RustyChest.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture item.useStyle = 1; item.consumable = true; item.value = 500; - item.createTile = ModContent.TileType(); + item.createTile = ModContent.TileType(); } public override void AddRecipes() { diff --git a/Items/RustyLockpick.cs b/Items/RustyLockpick.cs deleted file mode 100644 index 3598f8959a..0000000000 --- a/Items/RustyLockpick.cs +++ /dev/null @@ -1,30 +0,0 @@ -using CalamityMod.Items.Materials; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Items -{ - public class RustyLockpick : ModItem - { - public override void SetStaticDefaults() - { - Tooltip.SetDefault("Opens locked rusty chests"); - } - - public override void SetDefaults() - { - item.width = 14; - item.height = 28; - item.maxStack = 99; - item.rare = 1; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/RustyLockpick.png b/Items/RustyLockpick.png deleted file mode 100644 index 428130670976701b49c3a639a8fe24008b57ef8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 383 zcmV-_0f7FAP)Px$IY~r8R5*>ble6%&HNxFnJti_NUen&4$Oe>Zc^&&Rn5CTM+S2Y{aMsd4elB;!vK@sE17 z27sKM2Ov;Y1#o;Y0O0)MCK)js|0v`o0A4Gs?P#w8!0A~NfYrJy(jkgm830T904%s$ zqsW_KxV>+ah!}NM69ENqvbzaD=^)h{g1JUnxqD=$%sO4 zO5U;n@P|WVHy@rmQEn>4s76iNU#=MmjW431e-pnM9ckl8`|rlzDw`3ZH&6ip&ATE1 z8i4S@Fh;)r|+fGiaSfY%MLB)vImxz3aEj+3;~o8#1tQCH)VmGI)d dj(LZPiJ!JkSw?dqqYVH6002ovPDHLkV1kjZpB(@I diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index c71acf5653..6391d1fcfa 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -44,8 +44,7 @@ namespace CalamityMod.Items.Weapons.Summon } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 1); + ModRecipe recipe = new ModRecipe(mod);; recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddRecipeGroup("IronBar", 10); recipe.AddTile(TileID.Anvils); diff --git a/Projectiles/Summon/RustyDrone.cs b/Projectiles/Summon/RustyDrone.cs index 20ee399b79..49615484ba 100644 --- a/Projectiles/Summon/RustyDrone.cs +++ b/Projectiles/Summon/RustyDrone.cs @@ -1,5 +1,4 @@ using CalamityMod.Buffs.Summon; -using CalamityMod.Buffs.Cooldowns; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; @@ -16,9 +15,9 @@ namespace CalamityMod.Projectiles.Summon public const float NPCHomingInertia = 20f; public const float NPCHomingSpeed = 14f; - public const float AttackRate = 110f; + public const float AttackRate = 140f; - public const float DistanceToCheck = 750f; + public const float DistanceToCheck = 585f; public const int ExplosionShrapnelBaseDamage = 16; // Uses player.MinionDamage @@ -139,7 +138,7 @@ namespace CalamityMod.Projectiles.Summon Utils.PoofOfSmoke(projectile.Center); for (int i = 0; i < 4; i++) { - Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType(), + Projectile.NewProjectile(projectile.Center, Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType(), (int)(ExplosionShrapnelBaseDamage * player.MinionDamage()), 2f, projectile.owner); } projectile.Kill(); diff --git a/Tiles/Abyss/RustyChestLocked.cs b/Tiles/Abyss/RustyChestLocked.cs deleted file mode 100644 index 9391ea2eb8..0000000000 --- a/Tiles/Abyss/RustyChestLocked.cs +++ /dev/null @@ -1,124 +0,0 @@ -using CalamityMod.Dusts; -using CalamityMod.Items; -using CalamityMod.Items.Placeables.Furniture; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles.Abyss -{ - public class RustyChestLocked : ModTile - { - public override void SetDefaults() - { - this.SetUpChest(); - ModTranslation name = CreateMapEntryName("chestRusty"); - name.SetDefault("Rusty Chest"); - AddMapEntry(new Color(57, 48, 83), name, MapChestName); - dustType = ModContent.DustType(); - disableSmartCursor = true; - adjTiles = new int[] { TileID.Containers }; - chest = "Rusty Chest"; - chestDrop = ModContent.ItemType(); - } - - public override bool HasSmartInteract() => true; - - public override bool IsLockedChest(int i, int j) => Main.tile[i, j].frameX / 36 == 1; - - public override bool UnlockChest(int i, int j, ref short frameXAdjustment, ref int dustType, ref bool manual) - { - Player closest = Main.player[Player.FindClosest(new Vector2(i, j) * 16f, 1, 1)]; - if (!closest.InventoryHas(ModContent.ItemType())) - return false; - - for (int k = 0; k < closest.inventory.Length; k++) - { - if (closest.inventory[k].type == ModContent.ItemType()) - { - if (ItemLoader.ConsumeItem(closest.inventory[k], closest)) - { - closest.inventory[k].stack--; - } - if (closest.inventory[k].stack <= 0) - { - closest.inventory[k] = new Item(); - } - break; - } - } - - dustType = this.dustType; - - return true; - } - - public string MapChestName(string name, int i, int j) - { - // Bounds check - if (i < 0 || i >= Main.maxTilesX || j < 0 || j >= Main.maxTilesY) - return name; - - // Tile null check - Tile tile = Main.tile[i, j]; - if (tile is null) - return name; - - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - return name + (Main.chest[chest].name != "" ? ": " + Main.chest[chest].name : ""); - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = 1; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); - Chest.DestroyChest(i, j); - } - - public override bool NewRightClick(int i, int j) - { - Tile tile = Main.tile[i, j]; - - int left = i; - int top = j; - - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - return CalamityUtils.LockedChestRightClick(IsLockedChest(left, top), left, top, i, j); - } - - public override void MouseOver(int i, int j) - { - if (IsLockedChest(i, j)) - CalamityUtils.ChestMouseOver("Rusty Chest", i, j); - else - CalamityUtils.ChestMouseOver("Rusty Chest", i, j); - } - - public override void MouseOverFar(int i, int j) - { - if (IsLockedChest(i, j)) - CalamityUtils.ChestMouseFar("Rusty Chest", i, j); - else - CalamityUtils.ChestMouseFar("Rusty Chest", i, j); - } - } -} diff --git a/Tiles/Abyss/RustyChestLocked.png b/Tiles/Abyss/RustyChestLocked.png deleted file mode 100644 index e88cc3af08cae44425ffbcd12207ba60254c3e63..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1539 zcmZ8hdpOf;9RCe-m~2Ql<eYjLJ_ z*-RkTa%w)@l51_DAuVUknQoMchs_liN%)AGZ3ecL1T99K0Mm0sTG!*)vqZF&I6arQ zc00xwkD=*xMV}?rKfPL5Sg2Aw92O{YH2GY1nKgQ~o6qD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3Trz!Xk9A|s@sBe%SD$+( zFi*ba=KgfP_umW4jCMc%Sz{M;^H@?yBO@a-6B`Q;N6+%hFFX4;o=h={yYuF1j@j?$ zdzK#m9X9JaAJcK!kW~sVU)7fE54-+6nZ41CeXVrqgH9xhKXl!;MXIOe z$~8b{KQhg@>gBq1YIgL))T`%!0>{cfM}|-BDr#M1BX4`(bk=!3rgxsq)*Lr9V)4rrrJuc|%JpOXlTSW-{5jL6=8JZ(D!aY?(vP1XUN@=x{a3m7cJ%d272kjQ zNwpv2V_Li3@%MMRWgic|tCLD*x3#??{dRB7q`dj8Wda$p7oJ|6{^k3}->bh&fBM_~ z{9IL_;F=}x@7(g#K5;$&erW8R3|5)D`wETs{yW?LT|F+|$}e8~#R`-4vMf^n&pucA zy(-40?(N^G*uDDqw>LX{omUdSqWRiczO0iC4Un+76Ub5~@F9GiX+^}p7MEPbHo0kSPk1e5&{Qipu^+fHCyyF7Jl{ijDJ0A-A%^@8z;qu zrzRhtYV~o;`Qv;{&HsCo*60A^_UArX7PkA2uhZDKrhp<8+#;>lBa&&a6AydQ*VkK(9a*Gwqz|`bnDdCwI4QRJ>S^u z@ObynHLJZ`cRB^m>!0^t>TEhYgTe~DWM4f DO(J%R diff --git a/Tiles/Abyss/RustyChestTile.cs b/Tiles/Abyss/RustyChestTile.cs new file mode 100644 index 0000000000..4111461e82 --- /dev/null +++ b/Tiles/Abyss/RustyChestTile.cs @@ -0,0 +1,81 @@ +using CalamityMod.Items.Placeables.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class RustyChestTile : ModTile + { + public override void SetDefaults() + { + this.SetUpChest(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Rusty Chest"); + AddMapEntry(new Color(191, 142, 111), name, MapChestName); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Containers }; + chest = "Rusty Chest"; + chestDrop = ModContent.ItemType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 180, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool HasSmartInteract() => true; + + public string MapChestName(string name, int i, int j) + { + // Bounds check + if (i < 0 || i >= Main.maxTilesX || j < 0 || j >= Main.maxTilesY) + return name; + + // Tile null check + Tile tile = Main.tile[i, j]; + if (tile is null) + return name; + + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + left--; + if (tile.frameY != 0) + top--; + + int chest = Chest.FindChest(left, top); + if (chest == -1) + return name; + return name + (Main.chest[chest].name != "" ? ": " + Main.chest[chest].name : ""); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 32, 32, chestDrop); + Chest.DestroyChest(i, j); + } + + public override bool NewRightClick(int i, int j) + { + return CalamityUtils.ChestRightClick(i, j); + } + + public override void MouseOver(int i, int j) + { + CalamityUtils.ChestMouseOver("Rusty Chest", i, j); + } + + public override void MouseOverFar(int i, int j) + { + CalamityUtils.ChestMouseFar("Rusty Chest", i, j); + } + } +} diff --git a/Tiles/Abyss/RustyChestTile.png b/Tiles/Abyss/RustyChestTile.png new file mode 100644 index 0000000000000000000000000000000000000000..56fa385bc1f723d7c1d8d4f89b636349e9b9cc09 GIT binary patch literal 995 zcmV<9104K`P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!2kdb!2!6DYwZ9419(Y9K~#8N?V8(5 zR8bVhXCyCpK~qb?EG;S+>LKev=!OsxL`4wzQ2hlVg!vHu0n&p>4@LigK~Mw{LWB_A zzz6fCkS>IgbTQHlOROMce=}>)HM3g#l)^f(f3W#Zr|p@&zq9t7eLf~RKR=(aL_tQ) z5C)_X2BeW(-`KQhnZ0^5mdqS3D;w4}=lxu}4jtLO87FQ&cnD z+IQ&GiLE$sss9O-X3$Vv2<5aLt%bICT*J)zx)0+zckfL(5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^ZnV0F#(Z{qeBoX2=aM=0?KfIkf$|CBVh3$a zo0MKdVPFDrC2@RO|QA(t=l5p?}oj~ckDd0zerutM1Hz0SY?5FhqW8a z?hPDVP5}a7k%rg^)sVBM{CD{mR$85#@BHQv6VN`O`48s(Dqr+MnCVPyZ&h7XA~3Zu Nc)I$ztaD0e0sx9`5b*#2 literal 0 HcmV?d00001 diff --git a/World/Abyss.cs b/World/Abyss.cs index ba826d1a67..31232fee81 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -737,7 +737,7 @@ namespace CalamityMod.World SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(x, y + 1).type) && CalamityUtils.ParanoidTileRetrieval(x, y + 1).active()) { - chest = WorldGenerationMethods.AddChestWithLoot(x, y, (ushort)ModContent.TileType(), tileStyle: 1); + chest = WorldGenerationMethods.AddChestWithLoot(x, y, (ushort)ModContent.TileType()); } } } diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs index 6cf3b5a228..d641ea220f 100644 --- a/World/WorldGenerationMethods.cs +++ b/World/WorldGenerationMethods.cs @@ -139,7 +139,7 @@ namespace CalamityMod.World } PutItemInChest(ref chest, ItemID.GoldCoin, goldCoins); } - else if (type == ModContent.TileType()) + else if (type == ModContent.TileType()) { // 15-29 torches (in accordence with vanilla) PutItemInChest(ref chest, ItemID.Torch, 15, 29);