diff --git a/Backgrounds/FloralParadiseBGStyle.cs b/Backgrounds/FloralParadiseBGStyle.cs index ad87604643..9f987956f8 100644 --- a/Backgrounds/FloralParadiseBGStyle.cs +++ b/Backgrounds/FloralParadiseBGStyle.cs @@ -1,12 +1,9 @@ -using Terraria; -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod.Backgrounds { - public class FloralParadiseBGStyle : ModUgBgStyle + public class FloralParadiseBGStyle : ModUndergroundBackgroundStyle { - public override bool ChooseBgStyle() => Main.LocalPlayer.InFloralParadise(); - public override void FillTextureArray(int[] textureSlots) { // Corresponds to underground jungle backgrounds. Something custom could probably be made, but for what it is it works sufficiently for the minibiome. diff --git a/BiomeManagers/FloralParadiseBiome.cs b/BiomeManagers/FloralParadiseBiome.cs new file mode 100644 index 0000000000..b93f61190c --- /dev/null +++ b/BiomeManagers/FloralParadiseBiome.cs @@ -0,0 +1,23 @@ +using CalamityMod.Systems; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.BiomeManagers +{ + public class FloralParadiseBiome : ModBiome + { + public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/FloralParadiseWater"); + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/FloralParadiseBGStyle"); + public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Floral Paradise"); + } + + public override bool IsBiomeActive(Player player) + { + return BiomeTileCounterSystem.FloralParadiseTiles >= 300; + } + } +} diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 3002acbc10..930614d818 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1021,7 +1021,8 @@ namespace CalamityMod.CalPlayer public bool ZoneAbyssLayer2 => Player.InModBiome(ModContent.GetInstance()); public bool ZoneAbyssLayer3 => Player.InModBiome(ModContent.GetInstance()); public bool ZoneAbyssLayer4 => Player.InModBiome(ModContent.GetInstance()); - public bool ZoneFloralParadise = false; + public bool ZoneFloralParadise => Player.InModBiome(ModContent.GetInstance()); + public bool abyssDeath = false; public int abyssBreathCD; public float caveDarkness = 0f; diff --git a/Effects/ScreenShaders/Fog.fx b/Effects/ScreenShaders/Fog.fx index f8cf2b475c..d913889fa7 100644 --- a/Effects/ScreenShaders/Fog.fx +++ b/Effects/ScreenShaders/Fog.fx @@ -12,6 +12,7 @@ float uDirection; float3 uLightSource; float2 uImageSize0; float2 uImageSize1; +float4 uShaderSpecificData; float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 { diff --git a/Effects/ScreenShaders/Fog.xnb b/Effects/ScreenShaders/Fog.xnb index b4c6bdd3b1..76ec25afa7 100644 Binary files a/Effects/ScreenShaders/Fog.xnb and b/Effects/ScreenShaders/Fog.xnb differ diff --git a/Effects/WaterfallShader.fx b/Effects/WaterfallShader.fx index de07ec82ee..f7fab820fe 100644 --- a/Effects/WaterfallShader.fx +++ b/Effects/WaterfallShader.fx @@ -14,6 +14,7 @@ float3 uLightSource; float2 uImageSize0; float2 uImageSize1; matrix uWorldViewProjection; +float4 uShaderSpecificData; struct VertexShaderInput { diff --git a/Effects/WaterfallShader.xnb b/Effects/WaterfallShader.xnb index 7c180ce061..718ba268ef 100644 Binary files a/Effects/WaterfallShader.xnb and b/Effects/WaterfallShader.xnb differ diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index c8848df22e..9a1fe3c693 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -700,8 +700,8 @@ namespace CalamityMod.ILEditing cursor.GotoNext(MoveType.Before, i => i.MatchCallOrCallvirt
("DrawInfernoRings")); cursor.EmitDelegate(() => { - if (Main.netMode != NetmodeID.Server && CalamityWorld.FloralParadiseTiles > 0) - DrawFog(Utils.InverseLerp(0f, 250f, CalamityWorld.FloralParadiseTiles, true)); + if (Main.netMode != NetmodeID.Server && BiomeTileCounterSystem.FloralParadiseTiles > 0) + DrawFog(Utils.GetLerpValue(0f, 250f, BiomeTileCounterSystem.FloralParadiseTiles, true)); }); } @@ -710,11 +710,11 @@ namespace CalamityMod.ILEditing Main.spriteBatch.EnterShaderRegion(); WaterfallRenderer.DrawWaterfalls(); - Texture2D fogTexture = ModContent.GetTexture("Terraria/Misc/Perlin"); + Texture2D fogTexture = ModContent.Request("Terraria/Images/Misc/Perlin").Value; Vector2 scale = new Vector2(Main.screenWidth, Main.screenHeight) / fogTexture.Size(); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); GameShaders.Misc["CalamityMod:Fog"].UseOpacity(intensity * 0.67f); GameShaders.Misc["CalamityMod:Fog"].UseColor(Color.Lerp(Color.Lime, Color.Black, 0.85f)); GameShaders.Misc["CalamityMod:Fog"].Apply(); diff --git a/Particles/WaterFoamParticle.cs b/Particles/WaterFoamParticle.cs index 3173719bb1..3b873bed48 100644 --- a/Particles/WaterFoamParticle.cs +++ b/Particles/WaterFoamParticle.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Particles // Spawning the particle directly will result in the particle list collection being modified prematurely within the update loop. // Doing it the next frame results in a single-frame buffer, but that shouldn't really be a problem and it ensures that the loop is // not interrupted in unanticipated ways. - GeneralParticleHandler.QueueParticleForNextFrame(new MediumMistParticle(Position, foamVelocity, Color.LightCyan, Color.White, 0.2f, 255f, 0.03f)); + GeneralParticleHandler.QueueParticleForNextFrame(new MediumMistParticle(Position, foamVelocity, Color.LightCyan * 0.6f, Color.White * 0.6f, 0.2f, 255f, 0.03f)); HasCreatedFoam = true; } @@ -55,7 +55,7 @@ namespace CalamityMod.Particles public override void CustomDraw(SpriteBatch spriteBatch) { float brightness = (float)Math.Pow(Lighting.Brightness((int)(Position.X / 16f), (int)(Position.Y / 16f)), 0.15); - Texture2D texture = ModContent.GetTexture(Texture); + Texture2D texture = ModContent.Request(Texture).Value; spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color * brightness, Rotation, texture.Size() * 0.5f, Scale, 0, 0f); } } diff --git a/Projectiles/Environment/WaterAlgae.cs b/Projectiles/Environment/WaterAlgae.cs index 7991100246..9e80e0d57c 100644 --- a/Projectiles/Environment/WaterAlgae.cs +++ b/Projectiles/Environment/WaterAlgae.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,57 +7,57 @@ namespace CalamityMod.Projectiles.Environment { public class WaterAlgae : ModProjectile { - public ref float Direction => ref projectile.ai[0]; + public ref float Direction => ref Projectile.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Algae"); - Main.projFrames[projectile.type] = 3; - ProjectileID.Sets.CanDistortWater[projectile.type] = false; + Main.projFrames[Projectile.type] = 3; + ProjectileID.Sets.CanDistortWater[Projectile.type] = false; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; - projectile.ignoreWater = true; - projectile.timeLeft = 720; - projectile.penetrate = 1; - projectile.scale = Main.rand?.NextFloat(0.4f, 0.75f) ?? 1f; - projectile.hide = true; + Projectile.width = 12; + Projectile.height = 12; + Projectile.ignoreWater = true; + Projectile.timeLeft = 720; + Projectile.penetrate = 1; + Projectile.scale = Main.rand?.NextFloat(0.4f, 0.75f) ?? 1f; + Projectile.hide = true; } public override void AI() { - projectile.Opacity = Utils.InverseLerp(0f, 120f, projectile.timeLeft, true) * Utils.InverseLerp(720f, 660f, projectile.timeLeft, true); - projectile.hide = projectile.Opacity < 0.2f; - if (projectile.localAI[0] == 0f) + Projectile.Opacity = Utils.GetLerpValue(0f, 120f, Projectile.timeLeft, true) * Utils.GetLerpValue(720f, 660f, Projectile.timeLeft, true); + Projectile.hide = Projectile.Opacity < 0.2f; + if (Projectile.localAI[0] == 0f) { - projectile.frame = Main.rand.Next(Main.projFrames[projectile.type]); - projectile.localAI[0] = 1f; + Projectile.frame = Main.rand.Next(Main.projFrames[Projectile.type]); + Projectile.localAI[0] = 1f; } - if (Collision.WetCollision(projectile.position, projectile.width, projectile.height)) + if (Collision.WetCollision(Projectile.position, Projectile.width, Projectile.height)) { if (Direction == 0f) - Direction = projectile.identity % 2; - if (Collision.SolidCollision(projectile.Center + Vector2.UnitX * Direction * 100f, 1, 1)) + Direction = Projectile.identity % 2; + if (Collision.SolidCollision(Projectile.Center + Vector2.UnitX * Direction * 100f, 1, 1)) Direction *= -1f; - projectile.velocity.X = MathHelper.Lerp(projectile.velocity.X, Direction * MathHelper.Lerp(0.3f, 0.7f, projectile.identity % 9f / 9f), 0.025f); - projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y - 0.008f, -0.4f, 0.4f); + Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, Direction * MathHelper.Lerp(0.3f, 0.7f, Projectile.identity % 9f / 9f), 0.025f); + Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y - 0.008f, -0.4f, 0.4f); } else { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.1f, -1f, 5f); + Projectile.velocity.X *= 0.985f; + Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.1f, -1f, 5f); } } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.velocity.X *= 0.5f; - if (projectile.timeLeft > 210) - projectile.timeLeft = 210; + Projectile.velocity.X *= 0.5f; + if (Projectile.timeLeft > 210) + Projectile.timeLeft = 210; return false; } diff --git a/Systems/BiomeTileCounterSystem.cs b/Systems/BiomeTileCounterSystem.cs index 887c86e5d2..145aaf667a 100644 --- a/Systems/BiomeTileCounterSystem.cs +++ b/Systems/BiomeTileCounterSystem.cs @@ -4,6 +4,7 @@ using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.FloralParadise; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; @@ -16,10 +17,11 @@ namespace CalamityMod.Systems { public static int BrimstoneCragTiles = 0; public static int SulphurTiles = 0; - public static int AbyssTiles = 0; public static int AstralTiles = 0; public static int SunkenSeaTiles = 0; public static int ArsenalLabTiles = 0; + public static int AbyssTiles = 0; + public static int FloralParadiseTiles = 0; public static int Layer1Tiles = 0; public static int Layer2Tiles = 0; @@ -29,9 +31,9 @@ namespace CalamityMod.Systems public override void ResetNearbyTileEffects() { BrimstoneCragTiles = 0; + SulphurTiles = 0; AstralTiles = 0; SunkenSeaTiles = 0; - SulphurTiles = 0; AbyssTiles = 0; ArsenalLabTiles = 0; @@ -39,6 +41,7 @@ namespace CalamityMod.Systems Layer2Tiles = 0; Layer3Tiles = 0; Layer4Tiles = 0; + FloralParadiseTiles = 0; } public override void TileCountsAvailable(ReadOnlySpan tileCounts) @@ -48,6 +51,7 @@ namespace CalamityMod.Systems AbyssTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SulphurTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; ArsenalLabTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + FloralParadiseTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; Layer1Tiles = tileCounts[ModContent.TileType()]; Layer2Tiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 1568cf476a..58767c3803 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using CalamityMod.World; +using CalamityMod.World.Minibiomes; using CalamityMod.World.Planets; using Microsoft.Xna.Framework; using Terraria; @@ -55,7 +56,12 @@ namespace CalamityMod.Systems CustomTemple.NewJungleTemple(); }); - //Improved Golem arena + tasks.Insert(JungleTempleIndex + 1, new PassLegacy("FloralParadise", (progress, config) => + { + progress.Message = "Growing a floral paradise underground"; + FloralParadiseMinibiome.GenerateInstances(); + })); + int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); tasks[JungleTempleIndex2] = new PassLegacy("Temple", (progress, config) => { @@ -74,12 +80,7 @@ namespace CalamityMod.Systems CustomTemple.NewJungleTempleLihzahrdAltar(); }); - // Floral Paradise - tasks.Insert(JungleTempleIndex + 1, new PassLegacy("FloralParadise", progress => - { - progress.Message = "Growing a floral paradise underground"; - FloralParadiseMinibiome.GenerateInstances(); - })); + // TODO -- Most of the below worldgen should be spaced out at better points of generation instead of all crammed at the end //Giant beehive int giantHiveIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Hives")); diff --git a/Tiles/FloralParadise/BloodOrangePlant.cs b/Tiles/FloralParadise/BloodOrangePlant.cs index e88b26817d..667236043e 100644 --- a/Tiles/FloralParadise/BloodOrangePlant.cs +++ b/Tiles/FloralParadise/BloodOrangePlant.cs @@ -1,6 +1,7 @@ -using CalamityMod.Items.PermanentBoosters; +using CalamityMod.Items.PermanentBoosters; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ModLoader; using Terraria.ObjectData; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FloralParadise { public class BloodOrangePlant : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; @@ -17,19 +18,17 @@ namespace CalamityMod.Tiles.FloralParadise TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.addTile(Type); - dustType = 6; + DustType = 6; AddMapEntry(new Color(250, 142, 4)); - - base.SetDefaults(); } public override void KillMultiTile(int i, int j, int frameX, int frameY) { - Item.NewItem(i * 16, j * 16, 16, 16, ModContent.ItemType()); + Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 16, 16, ModContent.ItemType()); } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height) + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) { offsetY = 2; } diff --git a/Tiles/FloralParadise/FloralGrass.cs b/Tiles/FloralParadise/FloralGrass.cs index 98173efbb4..cb41e4b811 100644 --- a/Tiles/FloralParadise/FloralGrass.cs +++ b/Tiles/FloralParadise/FloralGrass.cs @@ -1,6 +1,7 @@ -using CalamityMod.Projectiles.Environment; +using CalamityMod.Projectiles.Environment; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Tiles.FloralParadise { public class FloralGrass : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -23,11 +24,10 @@ namespace CalamityMod.Tiles.FloralParadise CalamityUtils.SetMerge(Type, TileID.Grass); CalamityUtils.SetMerge(Type, TileID.CorruptGrass); CalamityUtils.SetMerge(Type, TileID.HallowedGrass); - CalamityUtils.SetMerge(Type, TileID.FleshGrass); + CalamityUtils.SetMerge(Type, TileID.CrimsonGrass); CalamityUtils.MergeWithFloralParadise(Type); - dustType = 39; - drop = ItemID.DirtBlock; + DustType = 39; AddMapEntry(new Color(65, 142, 101)); } @@ -40,15 +40,15 @@ namespace CalamityMod.Tiles.FloralParadise public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { if (fail && !effectOnly) - Main.tile[i, j].type = (ushort)ModContent.TileType(); + Main.tile[i, j].TileType = (ushort)ModContent.TileType(); } public override void NearbyEffects(int i, int j, bool closer) { - if (WorldGen.genRand.NextBool(60) && !Main.gamePaused && CalamityUtils.ParanoidTileRetrieval(i, j - 1).liquid >= 200) + if (WorldGen.genRand.NextBool(60) && !Main.gamePaused && CalamityUtils.ParanoidTileRetrieval(i, j - 1).LiquidAmount >= 200) { Vector2 algaeVelocity = -Vector2.UnitY.RotatedByRandom(0.91f) * Main.rand.NextFloat(0.85f, 1.6f); - Projectile.NewProjectile(new Vector2(i + 0.5f, j - 0.5f) * 16f, algaeVelocity, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(new EntitySource_WorldEvent(), new Vector2(i + 0.5f, j - 0.5f) * 16f, algaeVelocity, ModContent.ProjectileType(), 0, 0f); } } @@ -62,8 +62,8 @@ namespace CalamityMod.Tiles.FloralParadise { if (WorldGen.InWorld(x, y)) { - if (CalamityUtils.ParanoidTileRetrieval(x, y).active() && - CalamityUtils.ParanoidTileRetrieval(x, y).type == (ushort)ModContent.TileType()) + if (CalamityUtils.ParanoidTileRetrieval(x, y).HasTile && + CalamityUtils.ParanoidTileRetrieval(x, y).TileType == (ushort)ModContent.TileType()) { nearbyVineCount++; } @@ -72,20 +72,20 @@ namespace CalamityMod.Tiles.FloralParadise } if (Main.tile[i, j + 1] != null && nearbyVineCount < 5) { - if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + if (!Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) { - if (Main.tile[i, j + 1].liquid == 255 && - !Main.tile[i, j + 1].lava()) + if (Main.tile[i, j + 1].LiquidAmount == 255 && + Main.tile[i, j + 1].LiquidType == LiquidID.Water) { bool flag13 = false; for (int y = num8; y > num8 - 10; y--) { - if (Main.tile[i, y].bottomSlope()) + if (Main.tile[i, y].BottomSlope) { flag13 = false; break; } - if (Main.tile[i, y].active() && !Main.tile[i, y].bottomSlope()) + if (Main.tile[i, y].HasTile && !Main.tile[i, y].BottomSlope) { flag13 = true; break; @@ -95,16 +95,16 @@ namespace CalamityMod.Tiles.FloralParadise { int num53 = i; int num54 = j + 1; - Main.tile[num53, num54].type = (ushort)ModContent.TileType(); - Main.tile[num53, num54].active(true); + Main.tile[num53, num54].TileType = (ushort)ModContent.TileType(); + Main.tile[num53, num54].Get().HasTile = true; WorldGen.SquareTileFrame(num53, num54, true); if (Main.netMode == NetmodeID.Server) { NetMessage.SendTileSquare(-1, num53, num54, 3, TileChangeType.None); } } - Main.tile[i, j].slope(0); - Main.tile[i, j].halfBrick(false); + Main.tile[i, j].Get().Slope = SlopeType.Solid; + Main.tile[i, j].Get().IsHalfBlock = false; } } } diff --git a/Tiles/FloralParadise/FloralPlants.cs b/Tiles/FloralParadise/FloralPlants.cs index 753e5e1af6..b61b96fa6e 100644 --- a/Tiles/FloralParadise/FloralPlants.cs +++ b/Tiles/FloralParadise/FloralPlants.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FloralParadise { public class FloralPlants : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoFail[Type] = true; @@ -17,14 +17,12 @@ namespace CalamityMod.Tiles.FloralParadise TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); TileObjectData.addTile(Type); - soundType = SoundID.Grass; - dustType = 2; + SoundType = SoundID.Grass; + DustType = 2; AddMapEntry(new Color(28, 216, 94)); - - base.SetDefaults(); } - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height) + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) { offsetY = 2; } @@ -36,7 +34,7 @@ namespace CalamityMod.Tiles.FloralParadise public override void NearbyEffects(int i, int j, bool closer) { - if (CalamityUtils.ParanoidTileRetrieval(i, j).liquid > 64) + if (CalamityUtils.ParanoidTileRetrieval(i, j).LiquidAmount > 64) WorldGen.KillTile(i, j); } } diff --git a/Tiles/FloralParadise/FloralStone.cs b/Tiles/FloralParadise/FloralStone.cs index 0884aa7a0a..a49fb3b129 100644 --- a/Tiles/FloralParadise/FloralStone.cs +++ b/Tiles/FloralParadise/FloralStone.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FloralParadise { public class FloralStone : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -20,10 +20,10 @@ namespace CalamityMod.Tiles.FloralParadise CalamityUtils.MergeWithOres(Type); CalamityUtils.MergeWithFloralParadise(Type); - dustType = 78; + DustType = 78; // drop = ModContent.ItemType(); - soundType = SoundID.Tink; + SoundType = SoundID.Tink; AddMapEntry(new Color(33, 56, 27)); } diff --git a/Tiles/FloralParadise/PeatMoss.cs b/Tiles/FloralParadise/PeatMoss.cs index 43f825ce3a..2446679e2f 100644 --- a/Tiles/FloralParadise/PeatMoss.cs +++ b/Tiles/FloralParadise/PeatMoss.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FloralParadise { public class PeatMoss : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; @@ -20,10 +20,10 @@ namespace CalamityMod.Tiles.FloralParadise CalamityUtils.MergeWithOres(Type); CalamityUtils.MergeWithFloralParadise(Type); - dustType = 78; + DustType = 78; // drop = ModContent.ItemType(); - soundType = SoundID.Tink; + SoundType = SoundID.Tink; AddMapEntry(new Color(72, 91, 47)); } diff --git a/Tiles/FloralParadise/SmallVines.cs b/Tiles/FloralParadise/SmallVines.cs index 0ce54459ea..debea1b30a 100644 --- a/Tiles/FloralParadise/SmallVines.cs +++ b/Tiles/FloralParadise/SmallVines.cs @@ -1,5 +1,6 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -7,7 +8,7 @@ namespace CalamityMod.Tiles.FloralParadise { public class SmallVines : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileCut[Type] = true; Main.tileBlockLight[Type] = true; @@ -16,8 +17,8 @@ namespace CalamityMod.Tiles.FloralParadise ModTranslation name = CreateMapEntryName(); name.SetDefault("Vines"); AddMapEntry(new Color(100, 151, 31), name); - soundType = SoundID.Grass; - dustType = 2; + SoundType = SoundID.Grass; + DustType = 2; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -28,18 +29,18 @@ namespace CalamityMod.Tiles.FloralParadise public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { if (WorldGen.genRand.NextBool(2) && Main.player[(int)Player.FindClosest(new Vector2((float)(i * 16), (float)(j * 16)), 16, 16)].cordage) - Item.NewItem(new Vector2(i * 16 + 8f, j * 16 + 8f), ItemID.VineRope); + Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i * 16 + 8f, j * 16 + 8f), ItemID.VineRope); if (Main.tile[i, j + 1] != null) { - if (Main.tile[i, j + 1].active()) + if (Main.tile[i, j + 1].HasTile) { - if (Main.tile[i, j + 1].type == ModContent.TileType()) + if (Main.tile[i, j + 1].TileType == ModContent.TileType()) { WorldGen.KillTile(i, j + 1, false, false, false); - if (!Main.tile[i, j + 1].active() && Main.netMode != NetmodeID.SinglePlayer) + if (!Main.tile[i, j + 1].HasTile && Main.netMode != NetmodeID.SinglePlayer) { - NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0); } } } @@ -50,19 +51,19 @@ namespace CalamityMod.Tiles.FloralParadise { if (Main.tile[i, j + 1] != null) { - if (!Main.tile[i, j + 1].active() && Main.tile[i, j + 1].type != (ushort)ModContent.TileType()) + if (!Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType()) { - if (Main.tile[i, j + 1].liquid >= 128 && !Main.tile[i, j + 1].lava()) + if (Main.tile[i, j + 1].LiquidAmount >= 128 && Main.tile[i, j + 1].LiquidType == LiquidID.Water) { bool flag13 = false; for (int num52 = j; num52 > j - 10; j--) { - if (Main.tile[i, num52].bottomSlope()) + if (Main.tile[i, num52].BottomSlope) { flag13 = false; break; } - if (Main.tile[i, num52].active() && !Main.tile[i, num52].bottomSlope()) + if (Main.tile[i, num52].HasTile && !Main.tile[i, num52].BottomSlope) { flag13 = true; break; @@ -72,12 +73,12 @@ namespace CalamityMod.Tiles.FloralParadise { int num53 = i; int num54 = j + 1; - Main.tile[num53, num54].type = (ushort)ModContent.TileType(); - Main.tile[num53, num54].frameX = (short)(WorldGen.genRand.Next(8) * 18); - Main.tile[num53, num54].frameY = (short)(4 * 18); - Main.tile[num53, num54 - 1].frameX = (short)(WorldGen.genRand.Next(12) * 18); - Main.tile[num53, num54 - 1].frameY = (short)(WorldGen.genRand.Next(4) * 18); - Main.tile[num53, num54].active(true); + Main.tile[num53, num54].TileType = (ushort)ModContent.TileType(); + Main.tile[num53, num54].TileFrameX = (short)(WorldGen.genRand.Next(8) * 18); + Main.tile[num53, num54].TileFrameY = (short)(4 * 18); + Main.tile[num53, num54 - 1].TileFrameX = (short)(WorldGen.genRand.Next(12) * 18); + Main.tile[num53, num54 - 1].TileFrameY = (short)(WorldGen.genRand.Next(4) * 18); + Main.tile[num53, num54].Get().HasTile = true; WorldGen.SquareTileFrame(num53, num54, true); WorldGen.SquareTileFrame(num53, num54 - 1, true); if (Main.netMode == NetmodeID.Server) diff --git a/Tiles/FloralParadise/VigorousVines.cs b/Tiles/FloralParadise/VigorousVines.cs index 68a69ce177..e2ef61b09f 100644 --- a/Tiles/FloralParadise/VigorousVines.cs +++ b/Tiles/FloralParadise/VigorousVines.cs @@ -1,8 +1,9 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -11,7 +12,7 @@ namespace CalamityMod.Tiles.FloralParadise { public class VigorousVines : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileCut[Type] = true; Main.tileLavaDeath[Type] = true; @@ -35,8 +36,8 @@ namespace CalamityMod.Tiles.FloralParadise TileObjectData.newTile.RandomStyleRange = 2; TileObjectData.addTile(Type); - soundType = SoundID.Grass; - dustType = 2; + SoundType = SoundID.Grass; + DustType = 2; } public override void NumDust(int i, int j, bool fail, ref int num) @@ -47,33 +48,33 @@ namespace CalamityMod.Tiles.FloralParadise public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) { Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); - if (tile.frameX % 36 != 0 || tile.frameY % 36 != 0) + if (tile.TileFrameX % 36 != 0 || tile.TileFrameY % 36 != 0) { - WorldGen.KillTile(i - tile.frameX % 36 / 18, j - tile.frameY % 36 / 18); + WorldGen.KillTile(i - tile.TileFrameX % 36 / 18, j - tile.TileFrameY % 36 / 18); - if (CalamityUtils.ParanoidTileRetrieval(i - tile.frameX % 36 / 18, j - tile.frameY % 36 / 18 - 1).type == Type) - WorldGen.KillTile(i - tile.frameX % 36 / 18, j - tile.frameY % 36 / 18 - 1); + if (CalamityUtils.ParanoidTileRetrieval(i - tile.TileFrameX % 36 / 18, j - tile.TileFrameY % 36 / 18 - 1).TileType == Type) + WorldGen.KillTile(i - tile.TileFrameX % 36 / 18, j - tile.TileFrameY % 36 / 18 - 1); return; } else if (WorldGen.genRand.NextBool(2) && Main.player[Player.FindClosest(new Vector2(i, j) * 16f, 16, 16)].cordage) { - Item.NewItem(new Vector2(i * 16 + 24f, j * 16 + 24f), ItemID.VineRope); + Item.NewItem(new EntitySource_TileBreak(i, j), new Vector2(i * 16 + 24f, j * 16 + 24f), ItemID.VineRope); } } public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - int frameX = t.frameX; - int frameY = t.frameY; - Texture2D tex = Main.tileTexture[Type]; + int frameX = t.TileFrameX; + int frameY = t.TileFrameY; + Texture2D tex = TextureAssets.Tile[Type].Value; Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset; Color drawColor = Lighting.GetColor(i, j); - if (!t.halfBrick() && t.slope() == 0) + if (!t.IsHalfBlock && t.Slope == SlopeType.Solid) spriteBatch.Draw(tex, drawPosition, new Rectangle(frameX, frameY, 18, 18), drawColor, 0f, Vector2.Zero, 1f, 0, 0f); - else if (t.halfBrick()) + else if (t.IsHalfBlock) spriteBatch.Draw(tex, drawPosition + new Vector2(0f, 8f), new Rectangle(frameX, frameY, 18, 8), drawColor, 0f, Vector2.Zero, 1f, 0, 0f); return false; diff --git a/Tiles/FloralParadise/WaterfallCreator.cs b/Tiles/FloralParadise/WaterfallCreator.cs index ed58656720..730ff11d41 100644 --- a/Tiles/FloralParadise/WaterfallCreator.cs +++ b/Tiles/FloralParadise/WaterfallCreator.cs @@ -1,4 +1,4 @@ -using CalamityMod.Particles; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FloralParadise { public class WaterfallCreator : ModTile { - public override void SetDefaults() + public override void SetStaticDefaults() { Main.tileSolid[Type] = false; Main.tileBlockLight[Type] = true; @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.FloralParadise CalamityUtils.MergeWithOres(Type); CalamityUtils.MergeWithFloralParadise(Type); - soundType = SoundID.Tink; + SoundType = SoundID.Tink; AddMapEntry(new Color(33, 56, 27)); } diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 7105068aeb..460ec3d254 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -461,15 +461,15 @@ namespace CalamityMod }); /// - /// Makes the tile merge with all the tile types that generate within various types of floral paradise tiles. - /// - /// The tile whose merging properties will be set. - public static void MergeWithFloralParadise(int type) => MergeWithSet(type, new int[] { - TileType(), - TileType(), - TileType(), - TileType(), - }); + /// Makes the tile merge with all the tile types that generate within various types of floral paradise tiles. + /// + /// The tile whose merging properties will be set. + public static void MergeWithFloralParadise(int type) => MergeWithSet(type, new int[] { + TileType(), + TileType(), + TileType(), + TileType(), + }); /// /// Makes the tile merge with all the tile types that generate within various types of astral tiles diff --git a/Waterfalls/WaterfallRenderer.cs b/Waterfalls/WaterfallRenderer.cs index 15f666b4c0..0fcba3b694 100644 --- a/Waterfalls/WaterfallRenderer.cs +++ b/Waterfalls/WaterfallRenderer.cs @@ -1,5 +1,6 @@ -using CalamityMod.Tiles.FloralParadise; +using CalamityMod.Tiles.FloralParadise; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using Terraria; @@ -30,19 +31,19 @@ namespace CalamityMod.Waterfalls internal static float PrimitiveWidthFunction(float completionRatio) { - float baseWidth = MathHelper.Lerp(16f, 6f, Utils.InverseLerp(36f, 216f, currentWaterfallHeight, true)); + float baseWidth = MathHelper.Lerp(16f, 6f, Utils.GetLerpValue(36f, 216f, currentWaterfallHeight, true)); float positionOffset = currentWaterfallPosition.X * 0.17f % 300f + currentWaterfallPosition.Y * 0.33f % 300f; - float x1Offset = (float)(Math.Sin(-Main.GlobalTime * 3f + completionRatio * 9f + positionOffset) * 0.5f + 0.5f) * baseWidth * 0.2f; - float x2Offset = (float)(Math.Sin(-Main.GlobalTime * 6f + completionRatio * 6f + positionOffset) * 0.5f + 0.5f) * baseWidth * 0.25f; + float x1Offset = (float)(Math.Sin(-Main.GlobalTimeWrappedHourly * 3f + completionRatio * 9f + positionOffset) * 0.5f + 0.5f) * baseWidth * 0.2f; + float x2Offset = (float)(Math.Sin(-Main.GlobalTimeWrappedHourly * 6f + completionRatio * 6f + positionOffset) * 0.5f + 0.5f) * baseWidth * 0.25f; if (completionRatio < 0.2f) - return MathHelper.SmoothStep(1f, baseWidth + x2Offset - x1Offset, Utils.InverseLerp(0f, 0.2f, completionRatio, true)); - return baseWidth + x2Offset + MathHelper.SmoothStep(0f, baseWidth * 0.85f, Utils.InverseLerp(0.84f, 0.96f, completionRatio, true)) - x1Offset; + return MathHelper.SmoothStep(1f, baseWidth + x2Offset - x1Offset, Utils.GetLerpValue(0f, 0.2f, completionRatio, true)); + return baseWidth + x2Offset + MathHelper.SmoothStep(0f, baseWidth * 0.85f, Utils.GetLerpValue(0.84f, 0.96f, completionRatio, true)) - x1Offset; } internal static Color PrimitiveColorFunction(float completionRatio) { - Color c = Color.Lerp(Color.Cyan, new Color(1f, 1f, 1f, 0f), (float)Math.Pow(Utils.InverseLerp(0.75f, 1f, completionRatio, true), 0.68)); + Color c = Color.Lerp(Color.Cyan, new Color(1f, 1f, 1f, 0f), (float)Math.Pow(Utils.GetLerpValue(0.75f, 1f, completionRatio, true), 0.68)); return c; } @@ -55,7 +56,7 @@ namespace CalamityMod.Waterfalls for (int j = -Main.screenHeight / 16 - 10; j < Main.screenHeight / 16 + 10; j++) { Tile tile = CalamityUtils.ParanoidTileRetrieval(center.X + i, center.Y + j); - if (tile.type != waterfallGeneratorID || !tile.active()) + if (tile.TileType != waterfallGeneratorID || !tile.HasTile) continue; yield return new Vector2(center.X + i, center.Y + j); @@ -71,13 +72,14 @@ namespace CalamityMod.Waterfalls Vector2 bottom = drawPosition; for (int i = 0; i < 16; i++) { - if (CalamityUtils.ParanoidTileRetrieval((int)drawTilePosition.X, (int)drawTilePosition.Y + i).liquid > 0) + if (CalamityUtils.ParanoidTileRetrieval((int)drawTilePosition.X, (int)drawTilePosition.Y + i).LiquidAmount > 0) { bottom.Y += i * 16f; break; } } + bottom.Y += 4f; currentWaterfallHeight = MathHelper.Distance(bottom.Y, drawPosition.Y); currentWaterfallBrightness = Lighting.Brightness((int)(drawPosition.X / 16f), (int)(drawPosition.Y / 16f)); currentWaterfallPosition = drawPosition + Vector2.One * 8f; @@ -99,10 +101,10 @@ namespace CalamityMod.Waterfalls { Main.ambientWaterfallX = drawPosition.X + 8f; Main.ambientWaterfallY = drawPosition.Y + 8f; - Main.ambientWaterfallStrength = MathHelper.Max(Main.ambientWaterfallStrength, Utils.InverseLerp(740f, 300f, distanceFromWaterfall, true)); + Main.ambientWaterfallStrength = MathHelper.Max(Main.ambientWaterfallStrength, Utils.GetLerpValue(740f, 300f, distanceFromWaterfall, true)); } - GameShaders.Misc["CalamityMod:Waterfall"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/WorleyNoise")); + GameShaders.Misc["CalamityMod:Waterfall"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/WorleyNoise")); GameShaders.Misc["CalamityMod:Waterfall"].UseOpacity((float)Math.Pow(currentWaterfallBrightness, 0.62)); Renderer.Draw(drawPoints, Vector2.One * 8f - Main.screenPosition, 80); } diff --git a/Waters/FloralParadiseWater.cs b/Waters/FloralParadiseWater.cs index 3d1484d7b6..9d67d11a46 100644 --- a/Waters/FloralParadiseWater.cs +++ b/Waters/FloralParadiseWater.cs @@ -1,21 +1,13 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; +using Microsoft.Xna.Framework; using Terraria.ModLoader; namespace CalamityMod.Waters { public class FloralParadiseWater : ModWaterStyle { - public override bool ChooseWaterStyle() - { - CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - return modPlayer.ZoneFloralParadise; - } - public override int ChooseWaterfallStyle() { - return mod.GetWaterfallStyleSlot("FloralParadiseWaterflow"); + return ModContent.Find("CalamityMod/FloralParadiseWaterflow").Slot; } public override int GetSplashDust() diff --git a/World/Minibiomes/FloralParadiseMinibiome.cs b/World/Minibiomes/FloralParadiseMinibiome.cs index 59b359d0b8..7b647168bd 100644 --- a/World/Minibiomes/FloralParadiseMinibiome.cs +++ b/World/Minibiomes/FloralParadiseMinibiome.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.DraedonStructures; +using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.FloralParadise; using CalamityMod.Tiles.SunkenSea; using Microsoft.Xna.Framework; @@ -102,7 +102,7 @@ namespace CalamityMod.World.Minibiomes if (!needsToTryAgain) { Tile tile = CalamityUtils.ParanoidTileRetrieval(x + dx, y + dy); - needsToTryAgain = tile.active() && BlacklistedNearbyTiles.Contains(tile.type); + needsToTryAgain = tile.HasTile && BlacklistedNearbyTiles.Contains(tile.TileType); } else break; @@ -146,7 +146,7 @@ namespace CalamityMod.World.Minibiomes int x = placementArea.X + WorldGen.genRand.Next(24, placementArea.Width - 24); int y = placementArea.Y + WorldGen.genRand.Next(18, placementArea.Height - 18); Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (!WorldGen.SolidTile(x, y + 1) || !WorldGen.SolidTile(x + 1, y + 1) || tile.active() || tile.liquid > 0) + if (!WorldGen.SolidTile(x, y + 1) || !WorldGen.SolidTile(x + 1, y + 1) || tile.HasTile || tile.LiquidAmount > 0) { i--; continue; @@ -156,10 +156,10 @@ namespace CalamityMod.World.Minibiomes { for (int dy = 0; dy < 3; dy++) { - Main.tile[x + dx, y + dy].type = (ushort)ModContent.TileType(); - Main.tile[x + dx, y + dy].frameX = (short)(dx * 18); - Main.tile[x + dx, y + dy].frameY = (short)(dy * 18); - Main.tile[x + dx, y + dy].active(true); + Main.tile[x + dx, y + dy].TileType = (ushort)ModContent.TileType(); + Main.tile[x + dx, y + dy].TileFrameX = (short)(dx * 18); + Main.tile[x + dx, y + dy].TileFrameY = (short)(dy * 18); + Main.tile[x + dx, y + dy].Get().HasTile = true; } } } @@ -205,18 +205,18 @@ namespace CalamityMod.World.Minibiomes if (distanceFromCenter > 1f) distanceFromCenter = 1f; - float ditherChance = Utils.InverseLerp(0.97f, 0.72f, distanceFromCenter, true); + float ditherChance = Utils.GetLerpValue(0.97f, 0.72f, distanceFromCenter, true); - Main.tile[x, y].wall = WallID.None; + Main.tile[x, y].WallType = WallID.None; if (WorldGen.genRand.NextFloat() < ditherChance) { if (!caveState[arrayRelativeX, arrayRelativeY] && distanceFromCenter < 0.7f) - Main.tile[x, y] = new Tile(); + Main.tile[x, y].ClearEverything(); else { bool useGrass = CalamityUtils.CountCellsAtPosition(caveState, arrayRelativeX, arrayRelativeY, false) >= 1 && distanceFromCenter < 0.72f; grassDirtMap[arrayRelativeX, arrayRelativeY] = useGrass; - Main.tile[x, y] = new Tile(); + Main.tile[x, y].ClearEverything(); Main.tile[x, y].ResetToType(useGrass ? grassID : stoneID); WorldGen.SquareTileFrame(x, y); } @@ -255,8 +255,8 @@ namespace CalamityMod.World.Minibiomes // This makes the dirt feel more natural and connected to the underlying rock. bool canPerformPlacement = i == 0 || WorldGen.genRand.NextFloat() < SecondaryPassDirtCreationChance; Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (canPerformPlacement && tile.active() && tile.type == stoneID && nearbyGrassOrDirt) - Main.tile[x, y].type = dirtID; + if (canPerformPlacement && tile.HasTile && tile.TileType == stoneID && nearbyGrassOrDirt) + Main.tile[x, y].TileType = dirtID; } } @@ -272,7 +272,7 @@ namespace CalamityMod.World.Minibiomes Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); int arrayRelativeX = x - placementArea.X; int arrayRelativeY = y - placementArea.Y; - grassDirtMap[arrayRelativeX, arrayRelativeY] = tile.type == grassID || tile.type == dirtID; + grassDirtMap[arrayRelativeX, arrayRelativeY] = tile.TileType == grassID || tile.TileType == dirtID; } } } @@ -286,7 +286,7 @@ namespace CalamityMod.World.Minibiomes { float noise = CalamityUtils.PerlinNoise2D(x / 160f, y / 160f, 3, seed) * 0.5f + 0.5f; if (MathHelper.Distance(noise, 0.555f) < WallOpennessFactor) - Main.tile[x, y].wall = WorldGen.genRand.NextBool(4) ? WallID.GrassUnsafe : WallID.FlowerUnsafe; + Main.tile[x, y].WallType = WorldGen.genRand.NextBool(4) ? WallID.GrassUnsafe : WallID.FlowerUnsafe; } } } @@ -319,7 +319,7 @@ namespace CalamityMod.World.Minibiomes // Ensure that the initial tile is empty and that there's a solid tile above for the vine to hang from. // If these conditions are not met, try again. - if (CalamityUtils.ParanoidTileRetrieval(x, y).active() || !WorldGen.SolidTile(x, y - 1)) + if (CalamityUtils.ParanoidTileRetrieval(x, y).HasTile || !WorldGen.SolidTile(x, y - 1)) { i--; continue; @@ -331,7 +331,7 @@ namespace CalamityMod.World.Minibiomes bool neeedsToTryAgain = false; for (int dy = 0; dy < vineLength; dy++) { - if (CalamityUtils.ParanoidTileRetrieval(x, y + dy).active()) + if (CalamityUtils.ParanoidTileRetrieval(x, y + dy).HasTile) { neeedsToTryAgain = true; break; @@ -347,18 +347,18 @@ namespace CalamityMod.World.Minibiomes // Perform placement. for (int dy = 0; dy < vineLength; dy++) { - Main.tile[x, y + dy].type = (ushort)ModContent.TileType(); + Main.tile[x, y + dy].TileType = (ushort)ModContent.TileType(); if (dy == vineLength - 1) { - Main.tile[x, y + dy].frameX = (short)(WorldGen.genRand.Next(8) * 18); - Main.tile[x, y + dy].frameY = 72; + Main.tile[x, y + dy].TileFrameX = (short)(WorldGen.genRand.Next(8) * 18); + Main.tile[x, y + dy].TileFrameY = 72; } else { - Main.tile[x, y + dy].frameX = (short)(WorldGen.genRand.Next(12) * 18); - Main.tile[x, y + dy].frameY = (short)(WorldGen.genRand.Next(4) * 18); + Main.tile[x, y + dy].TileFrameX = (short)(WorldGen.genRand.Next(12) * 18); + Main.tile[x, y + dy].TileFrameY = (short)(WorldGen.genRand.Next(4) * 18); } - Main.tile[x, y + dy].active(true); + Main.tile[x, y + dy].Get().HasTile = true; WorldGen.SquareTileFrame(x, y, true); } } @@ -371,7 +371,7 @@ namespace CalamityMod.World.Minibiomes int x = placementArea.X + WorldGen.genRand.Next(24, placementArea.Width - 24); int y = placementArea.Y + WorldGen.genRand.Next(24, placementArea.Height - 24); Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.active() || tile.liquid > 0) + if (tile.HasTile || tile.LiquidAmount > 0) { i--; continue; @@ -381,7 +381,7 @@ namespace CalamityMod.World.Minibiomes Point waterSpawnPoint = new Point(x, y); for (int dy = 0; dy < 100; dy++) { - if (CalamityUtils.ParanoidTileRetrieval(x, y - dy).active()) + if (CalamityUtils.ParanoidTileRetrieval(x, y - dy).HasTile) { waterSpawnPoint.Y -= dy - 1; break; @@ -404,10 +404,10 @@ namespace CalamityMod.World.Minibiomes for (int dy = 0; dy < 50; dy++) { - if (CalamityUtils.ParanoidTileRetrieval(x, y + dy).liquid > 0) + if (CalamityUtils.ParanoidTileRetrieval(x, y + dy).LiquidAmount > 0) { - Main.tile[x, y + dy - 8].active(true); - Main.tile[x, y + dy - 8].type = (ushort)ModContent.TileType(); + Main.tile[x, y + dy - 8].Get().HasTile = true; + Main.tile[x, y + dy - 8].TileType = (ushort)ModContent.TileType(); break; } } @@ -421,17 +421,17 @@ namespace CalamityMod.World.Minibiomes int x = placementArea.X + WorldGen.genRand.Next(16, placementArea.Width - 16); int y = placementArea.Y + WorldGen.genRand.Next(12, placementArea.Height - 12); Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.active() || tile.liquid > 0 || !WorldGen.SolidTile(x, y + 1)) + if (tile.HasTile || tile.LiquidAmount > 0 || !WorldGen.SolidTile(x, y + 1)) { i--; continue; } - Main.tile[x, y].type = (ushort)ModContent.TileType(); - Main.tile[x, y].frameX = (short)(Utils.SelectRandom(WorldGen.genRand, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 27, 28, 29, + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); + Main.tile[x, y].TileFrameX = (short)(Utils.SelectRandom(WorldGen.genRand, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44) * 18); - Main.tile[x, y].frameY = 0; - Main.tile[x, y].active(true); + Main.tile[x, y].TileFrameY = 0; + Main.tile[x, y].Get().HasTile = true; } } @@ -448,7 +448,7 @@ namespace CalamityMod.World.Minibiomes { for (int dy = 0; dy < length * 2; dy++) { - if (CalamityUtils.ParanoidTileRetrieval(x + dx, y + dy).active()) + if (CalamityUtils.ParanoidTileRetrieval(x + dx, y + dy).HasTile) return false; } } @@ -463,10 +463,10 @@ namespace CalamityMod.World.Minibiomes if (dx == 0 && dy % 2 == 0) xFrame = WorldGen.genRand.NextBool(yFrame > 0 ? 2 : 5) ? 36 : 0; - Main.tile[x + dx, y + dy].active(true); - Main.tile[x + dx, y + dy].frameX = (short)(xFrame + dx * 18); - Main.tile[x + dx, y + dy].frameY = (short)(yFrame + dy % 2 * 18); - Main.tile[x + dx, y + dy].type = vineID; + Main.tile[x + dx, y + dy].Get().HasTile = true; + Main.tile[x + dx, y + dy].TileFrameX = (short)(xFrame + dx * 18); + Main.tile[x + dx, y + dy].TileFrameY = (short)(yFrame + dy % 2 * 18); + Main.tile[x + dx, y + dy].TileType = vineID; } } return true; @@ -475,14 +475,14 @@ namespace CalamityMod.World.Minibiomes public static void RecursivelyFillAreaWithWater(int x, int y, int limit, ref int increment) { Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.active() || tile.liquid > 127) + if (tile.HasTile || tile.LiquidAmount > 127) return; increment++; if (increment >= limit) return; - Main.tile[x, y].liquid = 255; + Main.tile[x, y].LiquidAmount = 255; RecursivelyFillAreaWithWater(x + 1, y, limit, ref increment); RecursivelyFillAreaWithWater(x - 1, y, limit, ref increment); RecursivelyFillAreaWithWater(x, y + 1, limit, ref increment);