Complete eradication of the Floral Paradise
No files matched your search
@@ -1,19 +0,0 @@
|
||||
using CalamityMod.Systems;
|
||||
using CalamityMod.Waters;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.BiomeManagers
|
||||
{
|
||||
public class FloralParadiseBiome : ModBiome
|
||||
{
|
||||
public override ModWaterStyle WaterStyle => FloralParadiseWater.Instance;
|
||||
public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find<ModUndergroundBackgroundStyle>("CalamityMod/FloralParadiseBGStyle");
|
||||
public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh;
|
||||
|
||||
public override bool IsBiomeActive(Player player)
|
||||
{
|
||||
return BiomeTileCounterSystem.FloralParadiseTiles >= 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1574,13 +1574,11 @@ namespace CalamityMod.CalPlayer
|
||||
public bool ZoneAbyssLayer3 => Player.InModBiome<AbyssLayer3Biome>();
|
||||
public bool ZoneAbyssLayer4 => Player.InModBiome<AbyssLayer4Biome>();
|
||||
|
||||
public bool ZoneFloralParadise => Player.InModBiome<FloralParadiseBiome>();
|
||||
|
||||
public bool ZoneCalamity => Player.InModBiome<BrimstoneCragsBiome>();
|
||||
|
||||
public bool ZoneAstral => Player.InModBiome<AstralInfectionBiome>() && !ZoneAbyss;
|
||||
|
||||
public bool InAnyCalamityBiome => ZoneAbyss || ZoneCalamity || ZoneFloralParadise || ZoneSulphur || ZoneSunkenSea || ZoneAstral;
|
||||
public bool InAnyCalamityBiome => ZoneAbyss || ZoneCalamity || ZoneSulphur || ZoneSunkenSea || ZoneAstral;
|
||||
|
||||
public bool abyssDeath = false;
|
||||
public int abyssBreathCD;
|
||||
|
||||
@@ -142,9 +142,6 @@ namespace CalamityMod.CalPlayer
|
||||
// Check if schematics are present on the mouse, for the sake of registering their recipes.
|
||||
CheckIfMouseItemIsSchematic();
|
||||
|
||||
// Do environmental effects.
|
||||
DoEnvironmentalEffects();
|
||||
|
||||
// Handle Androomba's Right Click function
|
||||
AndroombaRightClick();
|
||||
|
||||
@@ -2997,31 +2994,6 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Biome Effects
|
||||
public void DrawPollenInFloralParadise()
|
||||
{
|
||||
if (!ZoneFloralParadise || !Main.rand.NextBool(7) || Main.dedServ)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
Vector2 dustSpawnPosition = Player.Center + Main.rand.NextVector2Square(-360f, 360f);
|
||||
dustSpawnPosition.Y += 200f;
|
||||
Tile tile = CalamityUtils.ParanoidTileRetrieval((int)(dustSpawnPosition.X / 16f), (int)(dustSpawnPosition.Y / 16f));
|
||||
if (WorldGen.SolidTile(tile) || tile.LiquidAmount > 0)
|
||||
continue;
|
||||
|
||||
Dust pollen = Dust.NewDustPerfect(dustSpawnPosition, DustID.AncientLight);
|
||||
pollen.velocity = Main.rand.NextVector2Circular(0.4f, 0.4f);
|
||||
pollen.scale = Main.rand.NextFloat(0.8f, 1f);
|
||||
pollen.fadeIn = 2f;
|
||||
pollen.color = Color.YellowGreen;
|
||||
pollen.noGravity = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endregion Biome Effects
|
||||
|
||||
#region Abyss Effects
|
||||
private void AbyssEffects()
|
||||
{
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
using CalamityMod.Projectiles.Environment;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.CalPlayer
|
||||
{
|
||||
public partial class CalamityPlayer : ModPlayer
|
||||
{
|
||||
public void DoEnvironmentalEffects()
|
||||
{
|
||||
CreateLilyglowInFloralParadise();
|
||||
}
|
||||
|
||||
public void CreateLilyglowInFloralParadise()
|
||||
{
|
||||
// Don't do anything if the player is not in the floral paradise of if this code is called by anyone other than the player.
|
||||
if (!ZoneFloralParadise || Main.myPlayer != Player.whoAmI)
|
||||
return;
|
||||
|
||||
if (!Main.rand.NextBool(12))
|
||||
return;
|
||||
|
||||
for (int tries = 0; tries < 50; tries++)
|
||||
{
|
||||
Vector2 potentialSpawnPosition = Player.Center + new Vector2(Main.rand.NextFloat(-1000f, 1000f), Main.rand.NextFloat(-300f, 300f));
|
||||
if (Collision.SolidCollision(potentialSpawnPosition, 1, 1))
|
||||
continue;
|
||||
|
||||
Vector2 spawnVelocity = -Vector2.UnitY.RotatedByRandom(0.82f) * Main.rand.NextFloat(0.5f, 1.35f);
|
||||
Projectile.NewProjectile(new EntitySource_WorldEvent(), potentialSpawnPosition, spawnVelocity, ModContent.ProjectileType<Lilyglow>(), 0, 0f, Player.whoAmI);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@ using CalamityMod.Tiles;
|
||||
using CalamityMod.Utilities.Daybreak;
|
||||
using CalamityMod.Walls;
|
||||
using CalamityMod.Walls.UnsafeWalls;
|
||||
using CalamityMod.Waterfalls;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Mono.Cecil.Cil;
|
||||
@@ -795,22 +794,12 @@ namespace CalamityMod.ILEditing
|
||||
#region Custom DoDraw Changes
|
||||
private static void CustomDoDrawChanges(ILContext il)
|
||||
{
|
||||
// This IL edit accomplishes two things:
|
||||
// 1. Calls a helper function for drawing the fog in the Floral Paradise.
|
||||
// 2. Allows for drawing additive blend projectiles using IAdditiveDrawer.
|
||||
// Allows for drawing additive blend projectiles using IAdditiveDrawer.
|
||||
ILCursor cursor = new ILCursor(il);
|
||||
|
||||
// First, Floral Paradise fog.
|
||||
// Move before the place we want to inject code.
|
||||
if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCallOrCallvirt<Main>("DrawInfernoRings")))
|
||||
return;
|
||||
|
||||
cursor.EmitDelegate<Action>(() =>
|
||||
{
|
||||
if (!Main.dedServ && BiomeTileCounterSystem.FloralParadiseTiles > 0)
|
||||
DrawFog(Utils.GetLerpValue(0f, 250f, BiomeTileCounterSystem.FloralParadiseTiles, true));
|
||||
});
|
||||
|
||||
// Then, additive drawing.
|
||||
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall<ScreenObstruction>("Draw")))
|
||||
return;
|
||||
|
||||
@@ -835,28 +824,6 @@ namespace CalamityMod.ILEditing
|
||||
Main.spriteBatch.SetBlendState(BlendState.AlphaBlend);
|
||||
});
|
||||
}
|
||||
|
||||
private static void DrawFog(float intensity)
|
||||
{
|
||||
Main.spriteBatch.EnterShaderRegion();
|
||||
WaterfallRenderer.DrawWaterfalls();
|
||||
|
||||
Texture2D fogTexture = ModContent.Request<Texture2D>("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.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
GameShaders.Misc["CalamityMod:Fog"].UseOpacity(intensity * 0.74f);
|
||||
GameShaders.Misc["CalamityMod:Fog"].UseColor(Color.Lerp(Color.Lime, Color.Black, 0.85f));
|
||||
GameShaders.Misc["CalamityMod:Fog"].UseSaturation(1.67f);
|
||||
GameShaders.Misc["CalamityMod:Fog"].Shader.Parameters["fogMovementSpeed"].SetValue(1.75f);
|
||||
GameShaders.Misc["CalamityMod:Fog"].Apply();
|
||||
|
||||
Main.spriteBatch.Draw(fogTexture, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f);
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region General Particle Rendering
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
using CalamityMod.Tiles.FloralParadise;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Placeables.FloralParadise
|
||||
{
|
||||
public class AlgalSlateItem : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Placeables";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 100;
|
||||
}
|
||||
|
||||
public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType<AlgalSlate>());
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 270 B |
@@ -1,17 +0,0 @@
|
||||
using CalamityMod.Tiles.FloralParadise;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Placeables.FloralParadise
|
||||
{
|
||||
public class PeatItem : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Placeables";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 100;
|
||||
}
|
||||
|
||||
public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType<Peat>());
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 320 B |
@@ -1,17 +0,0 @@
|
||||
using CalamityMod.Tiles.FloralParadise;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Placeables.FloralParadise
|
||||
{
|
||||
public class PeatMossItem : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Placeables";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 100;
|
||||
}
|
||||
|
||||
public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType<PeatMoss>());
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 380 B |
@@ -1,17 +0,0 @@
|
||||
using CalamityMod.Tiles.FloralParadise;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Placeables.FloralParadise
|
||||
{
|
||||
public class ScintillatingBloom : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Placeables";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 10;
|
||||
}
|
||||
|
||||
public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType<PinkFlower>());
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 560 B |
@@ -4,7 +4,6 @@ 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;
|
||||
@@ -27,7 +26,6 @@ namespace CalamityMod.Systems
|
||||
public static int SunkenSeaBasaltTiles = 0;
|
||||
public static int ArsenalLabTiles = 0;
|
||||
public static int AbyssTiles = 0;
|
||||
public static int FloralParadiseTiles = 0;
|
||||
public static int UndergroundTiles = 0;
|
||||
public static int Layer1Tiles = 0;
|
||||
public static int Layer2Tiles = 0;
|
||||
@@ -53,7 +51,6 @@ namespace CalamityMod.Systems
|
||||
Layer2Tiles = 0;
|
||||
Layer3Tiles = 0;
|
||||
Layer4Tiles = 0;
|
||||
FloralParadiseTiles = 0;
|
||||
}
|
||||
|
||||
public override void TileCountsAvailable(ReadOnlySpan<int> tileCounts)
|
||||
@@ -67,7 +64,6 @@ namespace CalamityMod.Systems
|
||||
SunkenSeaBasaltTiles = tileCounts[ModContent.TileType<Basalt>()] + tileCounts[ModContent.TileType<VolcanicSand>()];
|
||||
AbyssTiles = tileCounts[ModContent.TileType<AbyssGravel>()] + tileCounts[ModContent.TileType<Voidstone>()];
|
||||
SulphurTiles = tileCounts[ModContent.TileType<SulphurousSand>()] + tileCounts[ModContent.TileType<SulphurousSandstone>()] + tileCounts[ModContent.TileType<HardenedSulphurousSandstone>()];
|
||||
FloralParadiseTiles = tileCounts[ModContent.TileType<AlgalSlate>()] + tileCounts[ModContent.TileType<PeatMoss>()] + tileCounts[ModContent.TileType<Peat>()];
|
||||
ArsenalLabTiles = tileCounts[ModContent.TileType<LaboratoryPanels>()] + tileCounts[ModContent.TileType<LaboratoryPlating>()] + tileCounts[ModContent.TileType<HazardChevronPanels>()];
|
||||
UndergroundTiles = tileCounts[TileID.Stone];
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ using CalamityMod.Items.SummonItems;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.World;
|
||||
using CalamityMod.World.Minibiomes;
|
||||
using CalamityMod.World.Planets;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -130,14 +129,6 @@ namespace CalamityMod.Systems
|
||||
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value;
|
||||
CustomTemple.NewJungleTemple();
|
||||
});
|
||||
|
||||
// Floral Paradise Biome
|
||||
tasks.Insert(jungleTempleIndex + 1, new PassLegacy("FloralParadise", (progress, config) =>
|
||||
{
|
||||
progress.Message = "Growing a floral paradise underground";
|
||||
if (FloralParadiseMinibiome.SHOULD_GENERATE)
|
||||
FloralParadiseMinibiome.GenerateInstances();
|
||||
}));
|
||||
}
|
||||
|
||||
// Improved Golem Arena
|
||||
|
||||
@@ -6,7 +6,7 @@ using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
namespace CalamityMod.Tiles
|
||||
{
|
||||
public class BloodOrangePlant : ModTile
|
||||
{
|
||||
|
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 578 B |
@@ -1,42 +0,0 @@
|
||||
using CalamityMod.Systems;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class AlgalSlate : ModTile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileSolid[Type] = true;
|
||||
Main.tileBlockLight[Type] = true;
|
||||
Main.tileBrick[Type] = true;
|
||||
TileID.Sets.Stone[Type] = true;
|
||||
TileID.Sets.Conversion.Stone[Type] = true;
|
||||
TileID.Sets.CanBeClearedDuringOreRunner[Type] = false;
|
||||
|
||||
CalamityUtils.MergeWithGeneral(Type);
|
||||
CalamityUtils.MergeWithOres(Type);
|
||||
CalamityUtils.MergeWithFloralParadise(Type);
|
||||
|
||||
DustType = DustID.t_LivingWood;
|
||||
|
||||
HitSound = SoundID.Tink;
|
||||
|
||||
AddMapEntry(new Color(33, 56, 27));
|
||||
}
|
||||
|
||||
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
|
||||
{
|
||||
TileFramingSystem.CustomMergeFrame(i, j, Type, TileID.Dirt, false, false, false, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.1 KiB |
@@ -1,50 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class LargeLogPiles : ModTile
|
||||
{
|
||||
public const int Variants = 2;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 3;
|
||||
TileObjectData.newTile.Height = 3;
|
||||
TileObjectData.newTile.Origin = new Point16(1, 2);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16,
|
||||
16,
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
DustType = DustID.Mud;
|
||||
|
||||
AddMapEntry(new Color(114, 72, 49));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 826 B |
@@ -1,49 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class LargeMossPiles : ModTile
|
||||
{
|
||||
public const int Variants = 4;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 3;
|
||||
TileObjectData.newTile.Height = 2;
|
||||
TileObjectData.newTile.Origin = new Point16(1, 1);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16,
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
DustType = DustID.Mud;
|
||||
|
||||
AddMapEntry(new Color(56, 56, 56));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1,49 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class LargeSubterraneanGrass : ModTile
|
||||
{
|
||||
public const int Variants = 5;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 3;
|
||||
TileObjectData.newTile.Height = 2;
|
||||
TileObjectData.newTile.Origin = new Point16(1, 1);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16,
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
DustType = DustID.JungleGrass;
|
||||
|
||||
AddMapEntry(new Color(106, 163, 74));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,44 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class LargeWallFungi : ModTile
|
||||
{
|
||||
public const int Variants = 3;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoAttach[Type] = true;
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 2;
|
||||
TileObjectData.newTile.Height = 2;
|
||||
TileObjectData.newTile.Origin = new Point16(1, 1);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16,
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.AnchorBottom = AnchorData.Empty;
|
||||
TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0);
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
DustType = DustID.Dirt;
|
||||
|
||||
AddMapEntry(new Color(165, 126, 84));
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 516 B |
@@ -1,44 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class LargeWallFungiLeft : ModTile
|
||||
{
|
||||
public const int Variants = 3;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoAttach[Type] = true;
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 2;
|
||||
TileObjectData.newTile.Height = 2;
|
||||
TileObjectData.newTile.Origin = new Point16(1, 1);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16,
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.AnchorBottom = AnchorData.Empty;
|
||||
TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0);
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
DustType = DustID.Dirt;
|
||||
|
||||
AddMapEntry(new Color(165, 126, 84));
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 526 B |
@@ -1,95 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class LushVines : ModTile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileCut[Type] = true;
|
||||
Main.tileBlockLight[Type] = true;
|
||||
Main.tileLavaDeath[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
AddMapEntry(new Color(47, 75, 32));
|
||||
HitSound = SoundID.Grass;
|
||||
DustType = DustID.Grass;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
|
||||
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 EntitySource_TileBreak(i, j), new Vector2(i * 16 + 8f, j * 16 + 8f), ItemID.VineRope);
|
||||
|
||||
if (Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType == Type)
|
||||
{
|
||||
WorldGen.KillTile(i, j + 1, false, false, false);
|
||||
if (!Main.tile[i, j + 1].HasTile && Main.netMode != NetmodeID.SinglePlayer)
|
||||
{
|
||||
NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (Main.tile[i, j - 1].HasTile && Main.tile[i, j - 1].TileType == Type)
|
||||
{
|
||||
Main.tile[i, j - 1].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18);
|
||||
Main.tile[i, j - 1].TileFrameY = 54;
|
||||
if (Main.netMode != NetmodeID.SinglePlayer)
|
||||
NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void RandomUpdate(int i, int j)
|
||||
{
|
||||
if (Main.tile[i, j + 1] != null)
|
||||
{
|
||||
if (!Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType != Type)
|
||||
{
|
||||
if (Main.tile[i, j + 1].LiquidAmount >= 128 && Main.tile[i, j + 1].LiquidType == LiquidID.Water)
|
||||
{
|
||||
bool canGrow = false;
|
||||
for (int y = j; y > j - 10; j--)
|
||||
{
|
||||
if (Main.tile[i, y].BottomSlope)
|
||||
{
|
||||
canGrow = false;
|
||||
break;
|
||||
}
|
||||
if (Main.tile[i, y].HasTile && !Main.tile[i, y].BottomSlope)
|
||||
{
|
||||
canGrow = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (canGrow)
|
||||
{
|
||||
int below = j + 1;
|
||||
Main.tile[i, below].TileType = Type;
|
||||
Main.tile[i, below].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18);
|
||||
Main.tile[i, below].TileFrameY = 54;
|
||||
Main.tile[i, below - 1].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18);
|
||||
Main.tile[i, below - 1].TileFrameY = (short)(WorldGen.genRand.Next(3) * 18);
|
||||
Main.tile[i, below].Get<TileWallWireStateData>().HasTile = true;
|
||||
WorldGen.SquareTileFrame(i, below, true);
|
||||
WorldGen.SquareTileFrame(i, below - 1, true);
|
||||
if (Main.dedServ)
|
||||
{
|
||||
NetMessage.SendTileSquare(-1, i, below, 3, TileChangeType.None);
|
||||
NetMessage.SendTileSquare(-1, i, below - 1, 3, TileChangeType.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 638 B |
@@ -1,56 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class MediumFloralPlants : ModTile
|
||||
{
|
||||
public const int Variants = 8;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileCut[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 2;
|
||||
TileObjectData.newTile.Height = 2;
|
||||
TileObjectData.newTile.Origin = new Point16(1, 1);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16,
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
HitSound = SoundID.Grass;
|
||||
DustType = DustID.Grass;
|
||||
AddMapEntry(new Color(106, 135, 69));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 4;
|
||||
}
|
||||
|
||||
public override void NearbyEffects(int i, int j, bool closer)
|
||||
{
|
||||
if (CalamityUtils.ParanoidTileRetrieval(i, j).LiquidAmount > 64)
|
||||
WorldGen.KillTile(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 5.2 KiB |
@@ -1,50 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class MediumLargeMossPiles : ModTile
|
||||
{
|
||||
public const int Variants = 4;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 2;
|
||||
TileObjectData.newTile.Height = 2;
|
||||
TileObjectData.newTile.Origin = new Point16(1, 1);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16,
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
DustType = DustID.Mud;
|
||||
|
||||
AddMapEntry(new Color(56, 56, 56));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.7 KiB |
@@ -1,38 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class MediumMossPiles : ModTile
|
||||
{
|
||||
public const int Variants = 4;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
DustType = DustID.Mud;
|
||||
|
||||
AddMapEntry(new Color(56, 56, 56));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.6 KiB |
@@ -1,40 +0,0 @@
|
||||
using CalamityMod.Systems;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class Peat : ModTile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileSolid[Type] = true;
|
||||
Main.tileBlockLight[Type] = true;
|
||||
Main.tileBrick[Type] = true;
|
||||
TileID.Sets.Stone[Type] = true;
|
||||
TileID.Sets.Conversion.Stone[Type] = true;
|
||||
TileID.Sets.CanBeClearedDuringOreRunner[Type] = false;
|
||||
|
||||
CalamityUtils.MergeWithGeneral(Type);
|
||||
CalamityUtils.MergeWithOres(Type);
|
||||
CalamityUtils.MergeWithFloralParadise(Type);
|
||||
|
||||
DustType = DustID.t_LivingWood;
|
||||
|
||||
AddMapEntry(new Color(72, 91, 47));
|
||||
}
|
||||
|
||||
public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
|
||||
{
|
||||
TileFramingSystem.CustomMergeFrame(i, j, Type, TileID.Dirt, false, false, false, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.5 KiB |
@@ -1,116 +0,0 @@
|
||||
using CalamityMod.Projectiles.Environment;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class PeatMoss : ModTile
|
||||
{
|
||||
public static readonly SoundStyle MineSound = new("CalamityMod/Sounds/Custom/MossMine");
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileSolid[Type] = true;
|
||||
Main.tileBlockLight[Type] = true;
|
||||
Main.tileBrick[Type] = true;
|
||||
|
||||
TileID.Sets.Grass[Type] = true;
|
||||
TileID.Sets.NeedsGrassFraming[Type] = true;
|
||||
TileID.Sets.NeedsGrassFramingDirt[Type] = ModContent.TileType<Peat>();
|
||||
TileID.Sets.Conversion.Grass[Type] = true;
|
||||
|
||||
CalamityUtils.SetMerge(Type, TileID.Dirt);
|
||||
CalamityUtils.SetMerge(Type, TileID.Grass);
|
||||
CalamityUtils.SetMerge(Type, TileID.CorruptGrass);
|
||||
CalamityUtils.SetMerge(Type, TileID.HallowedGrass);
|
||||
CalamityUtils.SetMerge(Type, TileID.CrimsonGrass);
|
||||
CalamityUtils.MergeWithFloralParadise(Type);
|
||||
|
||||
DustType = DustID.JungleGrass;
|
||||
HitSound = MineSound;
|
||||
|
||||
AddMapEntry(new Color(65, 142, 101));
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int Type)
|
||||
{
|
||||
Type = fail ? 1 : 3;
|
||||
}
|
||||
|
||||
public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem)
|
||||
{
|
||||
if (fail && !effectOnly)
|
||||
Main.tile[i, j].TileType = (ushort)ModContent.TileType<Peat>();
|
||||
}
|
||||
|
||||
public override void NearbyEffects(int i, int j, bool closer)
|
||||
{
|
||||
if (WorldGen.genRand.NextBool(180) && !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 EntitySource_WorldEvent(), new Vector2(i + 0.5f, j - 0.5f) * 16f, algaeVelocity, ModContent.ProjectileType<WaterAlgae>(), 0, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public override void RandomUpdate(int i, int j)
|
||||
{
|
||||
int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + Main.maxTilesY * 0.143));
|
||||
int nearbyVineCount = 0;
|
||||
for (int x = i - 15; x <= i + 15; x++)
|
||||
{
|
||||
for (int y = j - 15; y <= j + 15; y++)
|
||||
{
|
||||
if (WorldGen.InWorld(x, y))
|
||||
{
|
||||
if (CalamityUtils.ParanoidTileRetrieval(x, y).HasTile &&
|
||||
CalamityUtils.ParanoidTileRetrieval(x, y).TileType == (ushort)ModContent.TileType<SmallVines>())
|
||||
{
|
||||
nearbyVineCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Main.tile[i, j + 1] != null && nearbyVineCount < 5)
|
||||
{
|
||||
if (!Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType != (ushort)ModContent.TileType<SmallVines>())
|
||||
{
|
||||
if (Main.tile[i, j + 1].LiquidAmount == 255 &&
|
||||
Main.tile[i, j + 1].LiquidType == LiquidID.Water)
|
||||
{
|
||||
bool growMoss = false;
|
||||
for (int y = num8; y > num8 - 10; y--)
|
||||
{
|
||||
if (Main.tile[i, y].BottomSlope)
|
||||
{
|
||||
growMoss = false;
|
||||
break;
|
||||
}
|
||||
if (Main.tile[i, y].HasTile && !Main.tile[i, y].BottomSlope)
|
||||
{
|
||||
growMoss = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (growMoss)
|
||||
{
|
||||
int belowY = j + 1;
|
||||
Main.tile[i, belowY].TileType = (ushort)ModContent.TileType<SmallVines>();
|
||||
Main.tile[i, belowY].Get<TileWallWireStateData>().HasTile = true;
|
||||
WorldGen.SquareTileFrame(i, belowY, true);
|
||||
if (Main.dedServ)
|
||||
{
|
||||
NetMessage.SendTileSquare(-1, i, belowY, 3, TileChangeType.None);
|
||||
}
|
||||
}
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().Slope = SlopeType.Solid;
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().IsHalfBlock = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 11 KiB |
@@ -1,117 +0,0 @@
|
||||
using System;
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Tiles.BaseTiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class PerennialTree : DynamicallyGrownTree
|
||||
{
|
||||
// The max amount that branches can travel. Once the distance of the branches reaches or exceeds this threshold, the tree is done growing.
|
||||
public override float MaxDistanceBeforeCutoff => 2100f;
|
||||
|
||||
public override float DistanceUsedForTrunk => 140f;
|
||||
|
||||
public override float BranchMaxBendFactor => 0.7f;
|
||||
|
||||
public override float BranchTurnAngleVariance => 0.4f;
|
||||
|
||||
public override float MinBranchLength => 30f;
|
||||
|
||||
public override float TrunkWidth => 16f;
|
||||
|
||||
public override float ChanceToCreateNewBranches => 0.8f;
|
||||
|
||||
public override float VerticalStretchFactor => 12f;
|
||||
|
||||
public override float DownwardBiasFactor => 0.4f;
|
||||
|
||||
public override float BranchGrowthWidthDecay => 0.61f;
|
||||
|
||||
public override int MaxCutoffBranchesPerBranch => 5;
|
||||
|
||||
public Asset<Texture2D> VineTexture;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileAxe[Type] = true;
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
DustType = DustID.WoodFurniture;
|
||||
ItemDrop = ItemID.Wood;
|
||||
UseDefaultSize();
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
AddMapEntry(Color.SaddleBrown);
|
||||
}
|
||||
|
||||
public void DrawVine(Vector2 vineTop, Vector2 downwardBottom, int totalVinesToDraw, float swayFactor)
|
||||
{
|
||||
VineTexture ??= ModContent.Request<Texture2D>("CalamityMod/Tiles/FloralParadise/PerennialTreeVines");
|
||||
Texture2D vineTexture = VineTexture.Value;
|
||||
|
||||
// Determine the initial points for the vines.
|
||||
Vector2[] controlPoints = new Vector2[8];
|
||||
Vector2 lightOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(-Main.offScreenRange);
|
||||
for (int i = 0; i < controlPoints.Length; i++)
|
||||
{
|
||||
float swayOffset = swayFactor;
|
||||
controlPoints[i] = Vector2.Lerp(vineTop, downwardBottom, i / (float)(controlPoints.Length - 1f));
|
||||
|
||||
Point p = (controlPoints[i] + lightOffset + BranchDrawer.PreviousPoint.ToWorldCoordinates()).ToTileCoordinates();
|
||||
|
||||
// 02JUN2024: Ozzatron: directionY did not exist at the time of the creation of the Perennial Tree. As such, it is ignored here.
|
||||
Main.instance.TilesRenderer.Wind.GetWindTime(p.X, p.Y, 40, out int windTimeLeft, out int direction, out _);
|
||||
|
||||
float windInterpolant = windTimeLeft / 40f;
|
||||
swayOffset += Utils.GetLerpValue(0f, 0.45f, windInterpolant, true) * Utils.GetLerpValue(1f, 0.55f, windInterpolant, true) * direction * 28f;
|
||||
controlPoints[i].X += swayOffset * Utils.GetLerpValue(0f, controlPoints.Length - 1f, i, true);
|
||||
controlPoints[i].Y -= 4f;
|
||||
}
|
||||
BezierCurve vineCurve = new(controlPoints);
|
||||
|
||||
int drawCount = (int)(totalVinesToDraw * 2.4f);
|
||||
for (int i = 0; i < drawCount - 1; i++)
|
||||
{
|
||||
Vector2 vineCenter = vineCurve.Evaluate(i / (float)(drawCount - 1f));
|
||||
Vector2 ahead = vineCurve.Evaluate((i + 1f) / (float)(drawCount - 1f));
|
||||
float rotation = (ahead - vineCenter).ToRotation() - MathHelper.PiOver2;
|
||||
vineCenter += BranchDrawer.PreviousPoint.ToWorldCoordinates() - Main.screenPosition;
|
||||
|
||||
// Calculate light values.
|
||||
Vector2 lightPosition = vineCenter + lightOffset + Main.screenPosition;
|
||||
|
||||
int frameX = 0;
|
||||
int frameY = 0;
|
||||
if (i > 0)
|
||||
frameY = RNG.Next(1, 3);
|
||||
if (i >= drawCount - 3)
|
||||
{
|
||||
frameY = 3;
|
||||
frameX = RNG.Next(3);
|
||||
}
|
||||
if (i == drawCount - 2)
|
||||
frameY = 4;
|
||||
|
||||
Rectangle frame = vineTexture.Frame(3, 5, frameX, frameY, -2, -2);
|
||||
Color color = Lighting.GetColor(lightPosition.ToTileCoordinates());
|
||||
|
||||
Main.spriteBatch.Draw(vineTexture, vineCenter, frame, color, rotation, frame.Size() * 0.5f, 1f, 0f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawThingAtEndOfBranch(BranchDrawer.Branch branch)
|
||||
{
|
||||
int totalVinesToDraw = RNG.Next(4, 7);
|
||||
float swayFactor = Main.windSpeedCurrent + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.87f + RNG.NextFloat(0.94f)) * 0.4f;
|
||||
Vector2 top = branch.EndOfCurve + Vector2.UnitY * 12f;
|
||||
Vector2 bottom = top + Vector2.UnitY * totalVinesToDraw * 30f;
|
||||
DrawVine(top, bottom, totalVinesToDraw, swayFactor * 35f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 198 B |
|
Before Width: | Height: | Size: 607 B |
@@ -1,92 +0,0 @@
|
||||
using CalamityMod.Items.Placeables.FloralParadise;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class PinkFlower : ModTile
|
||||
{
|
||||
public const int Variants = 2;
|
||||
|
||||
public const int WindPushLifetime = 45;
|
||||
|
||||
public Asset<Texture2D> StamenTexture;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
StamenTexture = ModContent.Request<Texture2D>("CalamityMod/Tiles/FloralParadise/PinkFlowerStamen");
|
||||
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 2;
|
||||
TileObjectData.newTile.Height = 2;
|
||||
TileObjectData.newTile.Origin = new Point16(1, 1);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16,
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
HitSound = SoundID.Grass;
|
||||
DustType = DustID.JungleSpore;
|
||||
AddMapEntry(new Color(255, 155, 202));
|
||||
RegisterItemDrop(ModContent.ItemType<ScintillatingBloom>());
|
||||
}
|
||||
|
||||
public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
|
||||
{
|
||||
if (drawData.tileFrameX % 36 == 0 && drawData.tileFrameY == 0)
|
||||
Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
|
||||
}
|
||||
|
||||
public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch)
|
||||
{
|
||||
if (Main.tile[i, j].IsTileActuallyInvisible())
|
||||
return;
|
||||
|
||||
// 02JUN2024: Ozzatron: directionY did not exist at the time of the creation of this content. As such, it is ignored here.
|
||||
Main.instance.TilesRenderer.Wind.GetWindTime(i, j, WindPushLifetime, out int windTimeLeft, out int direction, out _);
|
||||
|
||||
float windInterpolant = windTimeLeft / (float)WindPushLifetime;
|
||||
float windRotation = Utils.GetLerpValue(0f, 0.5f, windInterpolant, true) * Utils.GetLerpValue(1f, 0.5f, windInterpolant, true) * direction * 0.34f;
|
||||
|
||||
int frameX = Main.tile[i, j].TileFrameX;
|
||||
Color drawColor = Lighting.GetColor(i, j);
|
||||
Texture2D stamenTexture = StamenTexture.Value;
|
||||
Rectangle stamenFrame = stamenTexture.Frame(2, 1, frameX > 36 ? 1 : 0, 0);
|
||||
Vector2 stamenOrigin = stamenFrame.Size() * new Vector2(0.5f, 1f);
|
||||
Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
|
||||
Vector2 drawPos = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset + new Vector2(17f, 24f);
|
||||
|
||||
// Create some pollen dust.
|
||||
if (!Main.gamePaused && windTimeLeft >= 2 && Main.rand.NextBool(6))
|
||||
{
|
||||
Vector2 pollenVelocity = -Vector2.UnitY.RotatedByRandom(windRotation * 2.3f) * 3f;
|
||||
Dust pollen = Dust.NewDustPerfect(drawPos + Main.screenPosition - drawOffset - Vector2.UnitY * 16f, DustID.JungleSpore);
|
||||
pollen.velocity = pollenVelocity;
|
||||
pollen.scale = 1.4f;
|
||||
}
|
||||
|
||||
Main.spriteBatch.Draw(stamenTexture, drawPos, stamenFrame, drawColor, windRotation, stamenOrigin, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 411 B |
@@ -1,103 +0,0 @@
|
||||
using CalamityMod.Items.Placeables.FloralParadise;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class PinkFlowerBig : ModTile
|
||||
{
|
||||
public const int Variants = 2;
|
||||
|
||||
public const int WindPushLifetime = 48;
|
||||
|
||||
public Asset<Texture2D> StamenTexture;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
StamenTexture = ModContent.Request<Texture2D>("CalamityMod/Tiles/FloralParadise/PinkFlowerBigStamen");
|
||||
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
Main.tileLighted[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 4;
|
||||
TileObjectData.newTile.Height = 3;
|
||||
TileObjectData.newTile.Origin = new Point16(2, 2);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16,
|
||||
16,
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
|
||||
HitSound = SoundID.Grass;
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
DustType = DustID.JungleSpore;
|
||||
AddMapEntry(new Color(255, 155, 202));
|
||||
RegisterItemDrop(ModContent.ItemType<ScintillatingBloom>());
|
||||
}
|
||||
|
||||
public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
|
||||
{
|
||||
r = 0.5f;
|
||||
g = 0.4f;
|
||||
b = 0.16f;
|
||||
}
|
||||
|
||||
public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData)
|
||||
{
|
||||
if (drawData.tileFrameX % 72 == 0 && drawData.tileFrameY == 0)
|
||||
Main.instance.TilesRenderer.AddSpecialLegacyPoint(i, j);
|
||||
}
|
||||
|
||||
public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch)
|
||||
{
|
||||
if (Main.tile[i, j].IsTileActuallyInvisible())
|
||||
return;
|
||||
|
||||
// 02JUN2024: Ozzatron: directionY did not exist at the time of the creation of this content. As such, it is ignored here.
|
||||
Main.instance.TilesRenderer.Wind.GetWindTime(i, j, WindPushLifetime, out int windTimeLeft, out int direction, out _);
|
||||
|
||||
float windInterpolant = windTimeLeft / (float)WindPushLifetime;
|
||||
float windRotation = Utils.GetLerpValue(0f, 0.5f, windInterpolant, true) * Utils.GetLerpValue(1f, 0.5f, windInterpolant, true) * direction * 0.34f;
|
||||
|
||||
int frameX = Main.tile[i, j].TileFrameX;
|
||||
Color drawColor = Lighting.GetColor(i, j);
|
||||
Texture2D stamenTexture = StamenTexture.Value;
|
||||
Rectangle stamenFrame = stamenTexture.Frame(2, 1, frameX > 72 ? 1 : 0, 0);
|
||||
Vector2 stamenOrigin = stamenFrame.Size() * new Vector2(0.5f, 1f);
|
||||
Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange);
|
||||
Vector2 drawPos = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffset + new Vector2(31f, 38f);
|
||||
if (frameX < 72)
|
||||
drawPos.X += 4f;
|
||||
|
||||
// Create some pollen dust.
|
||||
if (!Main.gamePaused && windTimeLeft >= 2 && Main.rand.NextBool(4))
|
||||
{
|
||||
Vector2 pollenVelocity = -Vector2.UnitY.RotatedByRandom(windRotation * 2.3f) * 3f;
|
||||
Dust pollen = Dust.NewDustPerfect(drawPos + Main.screenPosition - drawOffset - Vector2.UnitY * 16f, DustID.JungleSpore);
|
||||
pollen.velocity = pollenVelocity;
|
||||
pollen.scale = 1.6f;
|
||||
}
|
||||
|
||||
Main.spriteBatch.Draw(stamenTexture, drawPos, stamenFrame, drawColor, windRotation, stamenOrigin, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 620 B |
|
Before Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 289 B |
@@ -1,45 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class SmallFloralPlants : ModTile
|
||||
{
|
||||
public const int Variants = 8;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileCut[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1);
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
HitSound = SoundID.Grass;
|
||||
DustType = DustID.Grass;
|
||||
AddMapEntry(new Color(28, 216, 94));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 4;
|
||||
}
|
||||
|
||||
public override void NearbyEffects(int i, int j, bool closer)
|
||||
{
|
||||
if (CalamityUtils.ParanoidTileRetrieval(i, j).LiquidAmount > 64)
|
||||
WorldGen.KillTile(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 563 B |
@@ -1,49 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class SmallMossPiles : ModTile
|
||||
{
|
||||
public const int Variants = 4;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 1;
|
||||
TileObjectData.newTile.Height = 1;
|
||||
TileObjectData.newTile.Origin = new Point16(0, 0);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
DustType = DustID.Mud;
|
||||
|
||||
AddMapEntry(new Color(56, 56, 56));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 885 B |
@@ -1,95 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class SmallVines : ModTile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileCut[Type] = true;
|
||||
Main.tileBlockLight[Type] = true;
|
||||
Main.tileLavaDeath[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
AddMapEntry(new Color(100, 151, 31));
|
||||
HitSound = SoundID.Grass;
|
||||
DustType = DustID.Grass;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
|
||||
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 EntitySource_TileBreak(i, j), new Vector2(i * 16 + 8f, j * 16 + 8f), ItemID.VineRope);
|
||||
|
||||
if (Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType == Type)
|
||||
{
|
||||
WorldGen.KillTile(i, j + 1, false, false, false);
|
||||
if (!Main.tile[i, j + 1].HasTile && Main.netMode != NetmodeID.SinglePlayer)
|
||||
{
|
||||
NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (Main.tile[i, j - 1].HasTile && Main.tile[i, j - 1].TileType == Type)
|
||||
{
|
||||
Main.tile[i, j - 1].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18);
|
||||
Main.tile[i, j - 1].TileFrameY = 54;
|
||||
if (Main.netMode != NetmodeID.SinglePlayer)
|
||||
NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)i, (float)j + 1, 0f, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void RandomUpdate(int i, int j)
|
||||
{
|
||||
if (Main.tile[i, j + 1] != null)
|
||||
{
|
||||
if (!Main.tile[i, j + 1].HasTile && Main.tile[i, j + 1].TileType != Type)
|
||||
{
|
||||
if (Main.tile[i, j + 1].LiquidAmount >= 128 && Main.tile[i, j + 1].LiquidType == LiquidID.Water)
|
||||
{
|
||||
bool canGrow = false;
|
||||
for (int y = j; y > j - 10; j--)
|
||||
{
|
||||
if (Main.tile[i, y].BottomSlope)
|
||||
{
|
||||
canGrow = false;
|
||||
break;
|
||||
}
|
||||
if (Main.tile[i, y].HasTile && !Main.tile[i, y].BottomSlope)
|
||||
{
|
||||
canGrow = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (canGrow)
|
||||
{
|
||||
int below = j + 1;
|
||||
Main.tile[i, below].TileType = Type;
|
||||
Main.tile[i, below].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18);
|
||||
Main.tile[i, below].TileFrameY = 54;
|
||||
Main.tile[i, below - 1].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18);
|
||||
Main.tile[i, below - 1].TileFrameY = (short)(WorldGen.genRand.Next(3) * 18);
|
||||
Main.tile[i, below].Get<TileWallWireStateData>().HasTile = true;
|
||||
WorldGen.SquareTileFrame(i, below, true);
|
||||
WorldGen.SquareTileFrame(i, below - 1, true);
|
||||
if (Main.dedServ)
|
||||
{
|
||||
NetMessage.SendTileSquare(-1, i, below, 3, TileChangeType.None);
|
||||
NetMessage.SendTileSquare(-1, i, below - 1, 3, TileChangeType.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 548 B |
@@ -1,43 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class SmallWallFungi : ModTile
|
||||
{
|
||||
public const int Variants = 3;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoAttach[Type] = true;
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 1;
|
||||
TileObjectData.newTile.Height = 1;
|
||||
TileObjectData.newTile.Origin = new Point16(0, 0);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.AnchorBottom = AnchorData.Empty;
|
||||
TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 1, 0);
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
DustType = DustID.Dirt;
|
||||
|
||||
AddMapEntry(new Color(165, 126, 84));
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 619 B |
@@ -1,43 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class SmallWallFungiLeft : ModTile
|
||||
{
|
||||
public const int Variants = 3;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoAttach[Type] = true;
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 1;
|
||||
TileObjectData.newTile.Height = 1;
|
||||
TileObjectData.newTile.Origin = new Point16(0, 0);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.AnchorBottom = AnchorData.Empty;
|
||||
TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.SolidTile, 1, 0);
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
DustType = DustID.Dirt;
|
||||
|
||||
AddMapEntry(new Color(165, 126, 84));
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 296 B |
@@ -1,55 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class TallFloralPlants : ModTile
|
||||
{
|
||||
public const int Variants = 12;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileCut[Type] = true;
|
||||
Main.tileObsidianKill[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.Width = 2;
|
||||
TileObjectData.newTile.Height = 1;
|
||||
TileObjectData.newTile.Origin = new Point16(1, 0);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[]
|
||||
{
|
||||
16
|
||||
};
|
||||
TileObjectData.newTile.CoordinateWidth = 16;
|
||||
TileObjectData.newTile.CoordinatePadding = 2;
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
HitSound = SoundID.Grass;
|
||||
DustType = DustID.Grass;
|
||||
AddMapEntry(new Color(106, 135, 69));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 4;
|
||||
}
|
||||
|
||||
public override void NearbyEffects(int i, int j, bool closer)
|
||||
{
|
||||
if (CalamityUtils.ParanoidTileRetrieval(i, j).LiquidAmount > 64)
|
||||
WorldGen.KillTile(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 3.9 KiB |
@@ -1,39 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class VineLoops : ModTile
|
||||
{
|
||||
public const int Variants = 3;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileCut[Type] = true;
|
||||
Main.tileBlockLight[Type] = true;
|
||||
Main.tileLavaDeath[Type] = true;
|
||||
Main.tileNoFail[Type] = true;
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2);
|
||||
TileObjectData.newTile.AnchorBottom = AnchorData.Empty;
|
||||
TileObjectData.newTile.AnchorTop = new(AnchorType.SolidTile, 2, 0);
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
AddMapEntry(new Color(47, 75, 32));
|
||||
HitSound = SoundID.Grass;
|
||||
DustType = DustID.Grass;
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,36 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class WallLeaves : ModTile
|
||||
{
|
||||
public const int Variants = 3;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoAttach[Type] = true;
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.AnchorBottom = AnchorData.Empty;
|
||||
TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0);
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
HitSound = SoundID.Grass;
|
||||
DustType = DustID.Dirt;
|
||||
|
||||
AddMapEntry(new Color(145, 170, 61));
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,36 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.Enums;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class WallLeavesLeft : ModTile
|
||||
{
|
||||
public const int Variants = 3;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoAttach[Type] = true;
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1);
|
||||
TileObjectData.newTile.AnchorBottom = AnchorData.Empty;
|
||||
TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0);
|
||||
TileObjectData.newTile.RandomStyleRange = Variants;
|
||||
TileObjectData.addTile(Type);
|
||||
|
||||
HitSound = SoundID.Grass;
|
||||
DustType = DustID.Dirt;
|
||||
|
||||
AddMapEntry(new Color(145, 170, 61));
|
||||
}
|
||||
|
||||
public override void NumDust(int i, int j, bool fail, ref int num)
|
||||
{
|
||||
num = fail ? 1 : 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 410 B |
@@ -1,42 +0,0 @@
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Tiles.FloralParadise
|
||||
{
|
||||
public class WaterfallCreator : ModTile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileSolid[Type] = false;
|
||||
Main.tileBlockLight[Type] = true;
|
||||
Main.tileBrick[Type] = true;
|
||||
|
||||
CalamityUtils.MergeWithGeneral(Type);
|
||||
CalamityUtils.MergeWithOres(Type);
|
||||
CalamityUtils.MergeWithFloralParadise(Type);
|
||||
|
||||
HitSound = SoundID.Tink;
|
||||
|
||||
AddMapEntry(new Color(33, 56, 27));
|
||||
}
|
||||
|
||||
public override void NearbyEffects(int i, int j, bool closer)
|
||||
{
|
||||
Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j);
|
||||
if (Main.dedServ || !Main.rand.NextBool() || Main.gamePaused || tile.LiquidAmount > 0)
|
||||
return;
|
||||
|
||||
for (int k = 0; k < 16; k++)
|
||||
{
|
||||
Vector2 waterVelocity = -Vector2.UnitY.RotatedByRandom(0.29f) * Main.rand.NextFloat(1f, 2.4f);
|
||||
float waterScale = Main.rand.NextFloat(0.08f, 0.12f);
|
||||
Color waterColor = Color.Lerp(Color.Cyan, Color.SkyBlue, Main.rand.NextFloat());
|
||||
Vector2 particlePosition = new Vector2(i + 0.5f, j + 0.5f) * 16f + Vector2.UnitY * Main.rand.NextFloat(24f);
|
||||
GeneralParticleHandler.SpawnParticle(new WaterFoamParticle(particlePosition, waterVelocity, 150, waterScale, waterColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 182 B |
@@ -25,7 +25,6 @@ namespace CalamityMod.Tiles.Ores
|
||||
Main.tileShine2[Type] = true;
|
||||
|
||||
CalamityUtils.MergeWithGeneral(Type);
|
||||
CalamityUtils.MergeWithFloralParadise(Type);
|
||||
|
||||
TileID.Sets.Ore[Type] = true;
|
||||
TileID.Sets.OreMergesWithMud[Type] = true;
|
||||
|
||||
@@ -348,8 +348,6 @@ namespace CalamityMod
|
||||
|
||||
public static bool InSulphur(this Player player) => player.Calamity().ZoneSulphur;
|
||||
|
||||
public static bool InFloralParadise(this Player player) => player.Calamity().ZoneFloralParadise;
|
||||
|
||||
public static bool InAstral(this Player player, int biome = 0) //1 is above ground, 2 is underground, 3 is desert
|
||||
{
|
||||
switch (biome)
|
||||
|
||||
@@ -8,7 +8,6 @@ using CalamityMod.Tiles.Astral;
|
||||
using CalamityMod.Tiles.AstralDesert;
|
||||
using CalamityMod.Tiles.AstralSnow;
|
||||
using CalamityMod.Tiles.Crags;
|
||||
using CalamityMod.Tiles.FloralParadise;
|
||||
using CalamityMod.Tiles.FurnitureAbyss;
|
||||
using CalamityMod.Tiles.FurnitureAshen;
|
||||
using CalamityMod.Tiles.FurnitureDriftwood;
|
||||
@@ -533,17 +532,6 @@ namespace CalamityMod
|
||||
TileType<ScoriaOre>(),
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Makes the tile merge with all the tile types that generate within various types of floral paradise tiles.
|
||||
/// </summary>
|
||||
/// <param name="type">The tile whose merging properties will be set.</param>
|
||||
public static void MergeWithFloralParadise(int type) => MergeWithSet(type, new int[] {
|
||||
TileType<PeatMoss>(),
|
||||
TileType<Peat>(),
|
||||
TileType<AlgalSlate>(),
|
||||
TileType<PerennialOre>(),
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Makes the tile merge with all the tile types that generate within various types of astral tiles
|
||||
/// </summary>
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Tiles.FloralParadise;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Waterfalls
|
||||
{
|
||||
public static class WaterfallRenderer
|
||||
{
|
||||
private static Vector2 currentWaterfallPosition;
|
||||
|
||||
private static float currentWaterfallBrightness;
|
||||
|
||||
private static float currentWaterfallHeight;
|
||||
|
||||
internal static float PrimitiveWidthFunction(float completionRatio, Vector2 vertexPos)
|
||||
{
|
||||
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.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.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, Vector2 vertexPos)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
public static IEnumerable<Vector2> FindNearbyWaterfallRenderers()
|
||||
{
|
||||
int waterfallGeneratorID = ModContent.TileType<WaterfallCreator>();
|
||||
Point center = Main.LocalPlayer.Center.ToTileCoordinates();
|
||||
for (int i = -Main.screenWidth / 16 - 10; i < Main.screenWidth / 16 + 10; i++)
|
||||
{
|
||||
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.TileType != waterfallGeneratorID || !tile.HasTile)
|
||||
continue;
|
||||
|
||||
yield return new Vector2(center.X + i, center.Y + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawWaterfalls()
|
||||
{
|
||||
foreach (Vector2 drawTilePosition in FindNearbyWaterfallRenderers())
|
||||
{
|
||||
Vector2 drawPosition = drawTilePosition * 16f;
|
||||
Vector2 bottom = drawPosition;
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
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);
|
||||
if (currentWaterfallHeight <= 20f)
|
||||
continue;
|
||||
|
||||
currentWaterfallBrightness = Lighting.Brightness((int)(drawPosition.X / 16f), (int)(drawPosition.Y / 16f));
|
||||
currentWaterfallPosition = drawPosition + Vector2.One * 8f;
|
||||
|
||||
Vector2[] drawPoints = new Vector2[]
|
||||
{
|
||||
drawPosition,
|
||||
Vector2.Lerp(drawPosition, bottom, 0.5f),
|
||||
bottom
|
||||
};
|
||||
|
||||
// Determine the position of the waterfall's ambience sound.
|
||||
float distanceFromWaterfall = Main.LocalPlayer.Distance(drawPosition + Vector2.One * 8f);
|
||||
float distanceFromOldWaterfall = 100000f;
|
||||
if (Main.ambientWaterfallX != -1f && Main.ambientWaterfallY != -1f)
|
||||
distanceFromOldWaterfall = Main.LocalPlayer.Distance(new Vector2(Main.ambientWaterfallX, Main.ambientWaterfallY));
|
||||
|
||||
if (distanceFromOldWaterfall > distanceFromWaterfall)
|
||||
{
|
||||
Main.ambientWaterfallX = drawPosition.X + 8f;
|
||||
Main.ambientWaterfallY = drawPosition.Y + 8f;
|
||||
Main.ambientWaterfallStrength = MathHelper.Max(Main.ambientWaterfallStrength, Utils.GetLerpValue(740f, 300f, distanceFromWaterfall, true));
|
||||
}
|
||||
|
||||
GameShaders.Misc["CalamityMod:Waterfall"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/WorleyNoise"));
|
||||
GameShaders.Misc["CalamityMod:Waterfall"].UseOpacity((float)Math.Pow(currentWaterfallBrightness, 0.62));
|
||||
PrimitiveRenderer.RenderTrail(drawPoints, new(PrimitiveWidthFunction, PrimitiveColorFunction, shader: GameShaders.Misc["CalamityMod:Waterfall"]), 80);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,535 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CalamityMod.Tiles.DraedonStructures;
|
||||
using CalamityMod.Tiles.FloralParadise;
|
||||
using CalamityMod.Tiles.SunkenSea;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ObjectData;
|
||||
using Terraria.Utilities;
|
||||
using Terraria.WorldBuilding;
|
||||
|
||||
namespace CalamityMod.World.Minibiomes
|
||||
{
|
||||
public class FloralParadiseMinibiome
|
||||
{
|
||||
// 02JUN2024: Ozzatron: Disable generation of the Floral Paradise biome on the assumption that it will break horribly until tested.
|
||||
internal static readonly bool SHOULD_GENERATE = false;
|
||||
|
||||
// Constants pertaining to the more important details of the world-gen, to allow for ease-of-change.
|
||||
// Certain numbers are hardcoded and not present here, but they tend to be in regards to things that either really shouldn't need changing or
|
||||
// are extremely subtle details.
|
||||
public const int TotalCavesInMediumWorld = 3;
|
||||
|
||||
public const int MaxHorizontalDistanceFromWorldCenter = 1250;
|
||||
|
||||
public const int MinSurfaceDepth = 250;
|
||||
|
||||
public const int MaxSurfaceDepth = 420;
|
||||
|
||||
public const int BlacklistedTileCheckArea = 50;
|
||||
|
||||
public const float CaveOpennessFactor = 0.08f;
|
||||
|
||||
public const float WallOpennessFactor = 0.135f;
|
||||
|
||||
public const int TotalSecondaryDirtCreationPasses = 1;
|
||||
|
||||
public const float SecondaryPassDirtCreationChance = 0.5f;
|
||||
|
||||
public const int MinVigorousVineLength = 6;
|
||||
|
||||
public const int MaxVigorousVineLength = 16;
|
||||
|
||||
public const int MinSmallVineLength = 9;
|
||||
|
||||
public const int MaxSmallVineLength = 17;
|
||||
|
||||
public const int MinSmallVineCount = 45;
|
||||
|
||||
public const int MaxSmallVineCount = 64;
|
||||
|
||||
public const int MinPondWaterTileCount = 180;
|
||||
|
||||
public const int MaxPondWaterTileCount = 210;
|
||||
|
||||
public static int[] BlacklistedNearbyTiles => new int[]
|
||||
{
|
||||
TileID.Sand,
|
||||
TileID.Sandstone,
|
||||
TileID.HardenedSand,
|
||||
TileID.DesertFossil,
|
||||
TileID.SnowBlock,
|
||||
TileID.IceBlock,
|
||||
ModContent.TileType<LaboratoryPanels>(),
|
||||
ModContent.TileType<LaboratoryPipePlating>(),
|
||||
ModContent.TileType<LaboratoryPlating>(),
|
||||
ModContent.TileType<HazardChevronPanels>(),
|
||||
ModContent.TileType<RustedPlating>(),
|
||||
ModContent.TileType<RustedPipes>(),
|
||||
ModContent.TileType<Navystone>(),
|
||||
ModContent.TileType<EutrophicSand>(),
|
||||
};
|
||||
|
||||
public static void GenerateInstances()
|
||||
{
|
||||
float worldSize = Main.maxTilesX / 4200f;
|
||||
int totalCaves = (int)(worldSize * TotalCavesInMediumWorld);
|
||||
int infiniteLoopPreventerIncrement = 0;
|
||||
List<Rectangle> existingCaveAreas = new List<Rectangle>();
|
||||
for (int i = 0; i < totalCaves - 1; i++)
|
||||
{
|
||||
// Use an emergency infinite loop increment.
|
||||
// The placement loop is left if it exceeds an extremely large quantity.
|
||||
// This exists primarily due to potential issues in small worlds.
|
||||
// This will likely never be hit in typical circumstances, but it's better to be safe than sorry.
|
||||
infiniteLoopPreventerIncrement++;
|
||||
if (infiniteLoopPreventerIncrement >= 3000)
|
||||
break;
|
||||
|
||||
int x = Main.maxTilesX / 2 + WorldGen.genRand.Next(-MaxHorizontalDistanceFromWorldCenter, MaxHorizontalDistanceFromWorldCenter);
|
||||
int y = (int)Main.worldSurface + WorldGen.genRand.Next(MinSurfaceDepth, MaxSurfaceDepth);
|
||||
int width = (int)(WorldGen.genRand.Next(127, 140) * worldSize);
|
||||
int height = (int)(WorldGen.genRand.Next(80, 104) * worldSize);
|
||||
Rectangle caveArea = Utils.CenteredRectangle(new Vector2(x, y), new Vector2(width, height));
|
||||
|
||||
// Try again if this selected location is near blacklisted tiles.
|
||||
// This is done to prevent logical consistencies/intrusion on unrelated biomes.
|
||||
bool needsToTryAgain = false;
|
||||
for (int dx = -BlacklistedTileCheckArea; dx < BlacklistedTileCheckArea; dx++)
|
||||
{
|
||||
for (int dy = -BlacklistedTileCheckArea; dy < BlacklistedTileCheckArea; dy++)
|
||||
{
|
||||
if (!needsToTryAgain)
|
||||
{
|
||||
Tile tile = CalamityUtils.ParanoidTileRetrieval(x + dx, y + dy);
|
||||
needsToTryAgain = tile.HasTile && BlacklistedNearbyTiles.Contains(tile.TileType);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the blacklisted tile check was passed, check to see if the potential spot is near.
|
||||
if (!needsToTryAgain)
|
||||
needsToTryAgain = existingCaveAreas.Any(c => caveArea.Intersects(c));
|
||||
|
||||
if (needsToTryAgain)
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
Place(caveArea);
|
||||
existingCaveAreas.Add(caveArea);
|
||||
}
|
||||
|
||||
// Generate a single, special living tree on the surface with a floral paradise biome underneath.
|
||||
for (int i = 0; i < 2000; i++)
|
||||
{
|
||||
int x = Main.maxTilesX / 2 + WorldGen.genRand.Next(330, MaxHorizontalDistanceFromWorldCenter) * WorldGen.genRand.NextBool().ToDirectionInt();
|
||||
int y = (int)Main.worldSurface - 120;
|
||||
if (!FloralParadiseTree.Create(new(x, y)))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Place(Rectangle placementArea)
|
||||
{
|
||||
int seed = WorldGen.genRand.Next();
|
||||
int pondCount = WorldGen.genRand.Next(3);
|
||||
int smallVineCount = WorldGen.genRand.Next(MinSmallVineCount, MaxSmallVineCount);
|
||||
int waterTileCount = WorldGen.genRand.Next(MinPondWaterTileCount, MaxPondWaterTileCount);
|
||||
int smallFlowerCount = WorldGen.genRand.Next(150, 200);
|
||||
int bigTreeCount = WorldGen.genRand.Next(2, 5);
|
||||
|
||||
CutOutCave(placementArea, seed, out bool[,] grassDirtMap);
|
||||
GenerateDirtBehindGrass(placementArea, grassDirtMap);
|
||||
GenerateWalls(placementArea, unchecked(seed - 8));
|
||||
GenerateVines(placementArea, smallVineCount);
|
||||
GeneratePonds(placementArea, waterTileCount, pondCount);
|
||||
CreateScenicPlants(placementArea, smallFlowerCount);
|
||||
CreateTrees(placementArea, bigTreeCount);
|
||||
|
||||
// Place a blood orange. THIS IS FOR TESTING PURPOSES.
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
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.HasTile || tile.LiquidAmount > 0)
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
x--;
|
||||
|
||||
for (int dx = 0; dx < 3; dx++)
|
||||
{
|
||||
for (int dy = 0; dy < 3; dy++)
|
||||
{
|
||||
Main.tile[x + dx, y + dy].TileType = (ushort)ModContent.TileType<BloodOrangePlant>();
|
||||
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<TileWallWireStateData>().HasTile = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CutOutCave(Rectangle placementArea, int seed, out bool[,] grassDirtMap)
|
||||
{
|
||||
// Calculate the initial cell states with perlin noise.
|
||||
// To be specific, it uses values near the midpoint of 0.5 as open caves.
|
||||
// This helps solve the problem of having disconnected areas that using min/max threshold values causes.
|
||||
bool[,] caveState = new bool[placementArea.Width, placementArea.Height];
|
||||
for (int i = 0; i < placementArea.Width; i++)
|
||||
{
|
||||
for (int j = 0; j < placementArea.Height; j++)
|
||||
{
|
||||
float noise = CalamityUtils.PerlinNoise2D(i / 240f, j / 180f, 3, seed) * 0.5f + 0.5f;
|
||||
caveState[i, j] = MathHelper.Distance(noise, 0.56f) < CaveOpennessFactor;
|
||||
if (WorldGen.genRand.NextBool(3))
|
||||
caveState[i, j] = WorldGen.genRand.NextBool();
|
||||
}
|
||||
}
|
||||
|
||||
// Repeatedly smoothen out the cave state with celluar automata.
|
||||
for (int i = 0; i < 8; i++)
|
||||
caveState = CalamityUtils.SimulateCelluarAutomata(caveState);
|
||||
|
||||
// Reset tile states based on the above results.
|
||||
ushort grassID = (ushort)ModContent.TileType<PeatMoss>();
|
||||
ushort stoneID = (ushort)ModContent.TileType<AlgalSlate>();
|
||||
grassDirtMap = new bool[placementArea.Width, placementArea.Height];
|
||||
for (int x = placementArea.X; x < placementArea.X + placementArea.Width; x++)
|
||||
{
|
||||
for (int y = placementArea.Y; y < placementArea.Y + placementArea.Height; y++)
|
||||
{
|
||||
// Don't attempt to change tile data if a tile is outside of the world for some reason.
|
||||
if (!WorldGen.InWorld(x, y, 1))
|
||||
continue;
|
||||
|
||||
int arrayRelativeX = x - placementArea.X;
|
||||
int arrayRelativeY = y - placementArea.Y;
|
||||
Vector2 normalizedPosition = new Vector2(arrayRelativeX / (float)placementArea.Width, arrayRelativeY / (float)placementArea.Height);
|
||||
float distanceFromCenter = Vector2.Distance(normalizedPosition, Vector2.One * 0.5f) * 1.75f;
|
||||
if (distanceFromCenter > 1f)
|
||||
distanceFromCenter = 1f;
|
||||
|
||||
float ditherChance = Utils.GetLerpValue(0.97f, 0.72f, distanceFromCenter, true);
|
||||
|
||||
Main.tile[x, y].WallType = WallID.None;
|
||||
if (WorldGen.genRand.NextFloat() < ditherChance)
|
||||
{
|
||||
if (!caveState[arrayRelativeX, arrayRelativeY] && distanceFromCenter < 0.7f)
|
||||
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].ClearEverything();
|
||||
Main.tile[x, y].ResetToType(useGrass ? grassID : stoneID);
|
||||
WorldGen.SquareTileFrame(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateDirtBehindGrass(Rectangle placementArea, bool[,] grassDirtMap)
|
||||
{
|
||||
ushort dirtID = (ushort)ModContent.TileType<Peat>();
|
||||
ushort stoneID = (ushort)ModContent.TileType<AlgalSlate>();
|
||||
ushort grassID = (ushort)ModContent.TileType<PeatMoss>();
|
||||
|
||||
// Perform secondary passes that overlay dirt behind grass.
|
||||
for (int i = 0; i < TotalSecondaryDirtCreationPasses + 1; i++)
|
||||
{
|
||||
for (int x = placementArea.X; x < placementArea.X + placementArea.Width; x++)
|
||||
{
|
||||
for (int y = placementArea.Y; y < placementArea.Y + placementArea.Height; y++)
|
||||
{
|
||||
int arrayRelativeX = x - placementArea.X;
|
||||
int arrayRelativeY = y - placementArea.Y;
|
||||
bool nearbyGrassOrDirt = false;
|
||||
if (arrayRelativeX - 1 >= 0 && grassDirtMap[arrayRelativeX - 1, arrayRelativeY])
|
||||
nearbyGrassOrDirt = true;
|
||||
else if (arrayRelativeX + 1 < placementArea.Width && grassDirtMap[arrayRelativeX + 1, arrayRelativeY])
|
||||
nearbyGrassOrDirt = true;
|
||||
else if (arrayRelativeY - 1 >= 0 && grassDirtMap[arrayRelativeX, arrayRelativeY - 1])
|
||||
nearbyGrassOrDirt = true;
|
||||
else if (arrayRelativeY + 1 < placementArea.Height && grassDirtMap[arrayRelativeX, arrayRelativeY + 1])
|
||||
nearbyGrassOrDirt = true;
|
||||
|
||||
// The first pass always generates dirt behind grass.
|
||||
// However, successive passes only generate dirt with a specific probability.
|
||||
// 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.HasTile && tile.TileType == stoneID && nearbyGrassOrDirt)
|
||||
Main.tile[x, y].TileType = dirtID;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the dirt/grass map for the next pass.
|
||||
// This is skipped on the last pass for performance reasons, since the map won't be used after that point.
|
||||
if (i >= TotalSecondaryDirtCreationPasses)
|
||||
continue;
|
||||
|
||||
for (int x = placementArea.X; x < placementArea.X + placementArea.Width; x++)
|
||||
{
|
||||
for (int y = placementArea.Y; y < placementArea.Y + placementArea.Height; y++)
|
||||
{
|
||||
Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y);
|
||||
int arrayRelativeX = x - placementArea.X;
|
||||
int arrayRelativeY = y - placementArea.Y;
|
||||
grassDirtMap[arrayRelativeX, arrayRelativeY] = tile.TileType == grassID || tile.TileType == dirtID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateWalls(Rectangle placementArea, int seed)
|
||||
{
|
||||
for (int x = placementArea.X; x < placementArea.X + placementArea.Width; x++)
|
||||
{
|
||||
for (int y = placementArea.Y; y < placementArea.Y + placementArea.Height; y++)
|
||||
{
|
||||
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].WallType = WorldGen.genRand.NextBool(4) ? WallID.GrassUnsafe : WallID.FlowerUnsafe;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateVines(Rectangle placementArea, int smallVineCount)
|
||||
{
|
||||
ushort[] vineIDs = new ushort[]
|
||||
{
|
||||
(ushort)ModContent.TileType<SmallVines>(),
|
||||
(ushort)ModContent.TileType<LushVines>(),
|
||||
};
|
||||
|
||||
// Place small vines.
|
||||
for (int i = 0; i < smallVineCount; i++)
|
||||
{
|
||||
int x = placementArea.X + WorldGen.genRand.Next(24, placementArea.Width - 24);
|
||||
int y = placementArea.Y + WorldGen.genRand.Next(18, placementArea.Height - 18);
|
||||
|
||||
// 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).HasTile || !WorldGen.SolidTile(x, y - 1))
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Search to ensure that nothing is in the way of the vine's potential positions.
|
||||
// If something is, try again.
|
||||
int vineLength = WorldGen.genRand.Next(MinSmallVineLength, MaxSmallVineLength + 1);
|
||||
bool neeedsToTryAgain = false;
|
||||
for (int dy = 0; dy < vineLength; dy++)
|
||||
{
|
||||
if (CalamityUtils.ParanoidTileRetrieval(x, y + dy).HasTile)
|
||||
{
|
||||
neeedsToTryAgain = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (neeedsToTryAgain)
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Perform placement.
|
||||
ushort vineID = WorldGen.genRand.Next(vineIDs);
|
||||
for (int dy = 0; dy < vineLength; dy++)
|
||||
{
|
||||
Main.tile[x, y + dy].TileType = vineID;
|
||||
if (dy == vineLength - 1)
|
||||
{
|
||||
Main.tile[x, y + dy].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18);
|
||||
Main.tile[x, y + dy].TileFrameY = 54;
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.tile[x, y + dy].TileFrameX = (short)(WorldGen.genRand.Next(3) * 18);
|
||||
Main.tile[x, y + dy].TileFrameY = (short)(WorldGen.genRand.Next(3) * 18);
|
||||
}
|
||||
Main.tile[x, y + dy].Get<TileWallWireStateData>().HasTile = true;
|
||||
WorldGen.SquareTileFrame(x, y, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GeneratePonds(Rectangle placementArea, int waterTileCount, int pondCount)
|
||||
{
|
||||
for (int i = 0; i < pondCount; i++)
|
||||
{
|
||||
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.HasTile || tile.LiquidAmount > 0)
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Go upward once an open area is found. This is where water will be created.
|
||||
Point waterSpawnPoint = new Point(x, y);
|
||||
for (int dy = 0; dy < 100; dy++)
|
||||
{
|
||||
if (CalamityUtils.ParanoidTileRetrieval(x, y - dy).HasTile)
|
||||
{
|
||||
waterSpawnPoint.Y -= dy - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a predetermined quantity of water via recursion.
|
||||
// This starts at the initial water spawn point and the expands outward in all four cardinal directions repeatedly until either no more locations
|
||||
// are valid or the water limit has been reached.
|
||||
int increment = 0;
|
||||
RecursivelyFillAreaWithWater(x, y, waterTileCount, ref increment);
|
||||
|
||||
// Settle water and create waterfalls.
|
||||
Liquid.QuickWater(3);
|
||||
WorldGen.WaterCheck();
|
||||
Liquid.quickSettle = true;
|
||||
Liquid.UpdateLiquid();
|
||||
WorldGen.WaterCheck();
|
||||
Liquid.quickSettle = false;
|
||||
|
||||
for (int dy = 0; dy < 50; dy++)
|
||||
{
|
||||
if (CalamityUtils.ParanoidTileRetrieval(x, y + dy).LiquidAmount > 0)
|
||||
{
|
||||
Main.tile[x, y + dy - 8].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[x, y + dy - 8].TileType = (ushort)ModContent.TileType<WaterfallCreator>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateScenicPlants(Rectangle placementArea, int smallFlowerCount)
|
||||
{
|
||||
for (int i = 0; i < smallFlowerCount; i++)
|
||||
{
|
||||
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.HasTile || tile.LiquidAmount > 0 || !WorldGen.SolidTile(x, y + 1))
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
Main.tile[x, y].TileType = (ushort)ModContent.TileType<SmallFloralPlants>();
|
||||
Main.tile[x, y].TileFrameX = (short)(WorldGen.genRand.Next(8) * 18);
|
||||
Main.tile[x, y].TileFrameY = 0;
|
||||
Main.tile[x, y].Get<TileWallWireStateData>().HasTile = true;
|
||||
}
|
||||
|
||||
// TODO -- Move this to another method.
|
||||
int tries = 0;
|
||||
WeightedRandom<int> tileSelector = new(WorldGen.genRand);
|
||||
tileSelector.Add(ModContent.TileType<LargeLogPiles>(), 0.66D);
|
||||
tileSelector.Add(ModContent.TileType<LargeMossPiles>(), 0.66D);
|
||||
tileSelector.Add(ModContent.TileType<LargeSubterraneanGrass>(), 0.66D);
|
||||
tileSelector.Add(ModContent.TileType<LargeWallFungi>(), 0.66D);
|
||||
tileSelector.Add(ModContent.TileType<LargeWallFungiLeft>(), 0.66D);
|
||||
tileSelector.Add(ModContent.TileType<MediumFloralPlants>(), 1D);
|
||||
tileSelector.Add(ModContent.TileType<MediumLargeMossPiles>(), 1D);
|
||||
tileSelector.Add(ModContent.TileType<MediumMossPiles>(), 1D);
|
||||
tileSelector.Add(ModContent.TileType<PinkFlower>(), 1D);
|
||||
tileSelector.Add(ModContent.TileType<PinkFlowerBig>(), 0.5D);
|
||||
tileSelector.Add(ModContent.TileType<SmallMossPiles>(), 1D);
|
||||
tileSelector.Add(ModContent.TileType<SmallWallFungi>(), 1D);
|
||||
tileSelector.Add(ModContent.TileType<SmallWallFungiLeft>(), 1D);
|
||||
tileSelector.Add(ModContent.TileType<TallFloralPlants>(), 1D);
|
||||
tileSelector.Add(ModContent.TileType<VineLoops>(), 1D);
|
||||
tileSelector.Add(ModContent.TileType<WallLeaves>(), 1D);
|
||||
tileSelector.Add(ModContent.TileType<WallLeavesLeft>(), 1D);
|
||||
|
||||
for (int i = 0; i < 2400; i++)
|
||||
{
|
||||
tries++;
|
||||
if (tries >= 16000)
|
||||
break;
|
||||
|
||||
int x = placementArea.X + WorldGen.genRand.Next(16, placementArea.Width - 16);
|
||||
int y = placementArea.Y + WorldGen.genRand.Next(12, placementArea.Height - 12);
|
||||
if (WorldGen.genRand.NextBool() && WorldUtils.Find(new(x, y), Searches.Chain(new Searches.Down(400), new Conditions.IsSolid()), out Point result))
|
||||
y = result.Y - 1;
|
||||
|
||||
Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y);
|
||||
if (tile.HasTile || tile.LiquidAmount > 0)
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
int tileID = tileSelector.Get();
|
||||
WorldGen.PlaceTile(x, y, tileID, style: WorldGen.genRand.Next(TileObjectData.GetTileData(tileID, 0).RandomStyleRange));
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateTrees(Rectangle placementArea, int treeCount)
|
||||
{
|
||||
int tries = 0;
|
||||
int treeID = ModContent.TileType<PerennialTree>();
|
||||
|
||||
for (int i = 0; i < treeCount; i++)
|
||||
{
|
||||
tries++;
|
||||
|
||||
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);
|
||||
Vector2 checkTopLeft = new Vector2(x, y).ToWorldCoordinates() - new Vector2(120f, 300f);
|
||||
Vector2 checkArea = new Vector2(240f, 200f);
|
||||
|
||||
if (tries >= 2500)
|
||||
break;
|
||||
|
||||
if (tile.HasTile || tile.LiquidAmount > 0 || !WorldGen.SolidTile(x, y + 1) ||
|
||||
!TileObject.CanPlace(x, y, treeID, 0, 0, out _, true, checkStay: true) ||
|
||||
Collision.SolidCollision(checkTopLeft, (int)checkArea.X, (int)checkArea.Y))
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
WorldGen.PlaceTile(x, y, treeID);
|
||||
}
|
||||
}
|
||||
|
||||
#region Biome-Specific Utilities
|
||||
|
||||
public static void RecursivelyFillAreaWithWater(int x, int y, int limit, ref int increment)
|
||||
{
|
||||
Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y);
|
||||
if (tile.HasTile || tile.LiquidAmount > 127)
|
||||
return;
|
||||
|
||||
increment++;
|
||||
if (increment >= limit)
|
||||
return;
|
||||
|
||||
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);
|
||||
RecursivelyFillAreaWithWater(x, y - 1, limit, ref increment);
|
||||
}
|
||||
|
||||
#endregion Biome-Specific Utilities
|
||||
}
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.GameContent.Generation;
|
||||
using Terraria.ID;
|
||||
using Terraria.WorldBuilding;
|
||||
|
||||
namespace CalamityMod.World.Minibiomes
|
||||
{
|
||||
public class FloralParadiseTree
|
||||
{
|
||||
public const int TrunkHeight = 220;
|
||||
|
||||
public const int TrunkWidth = 10;
|
||||
|
||||
public const int TrunkHollowSpace = 4;
|
||||
|
||||
public const int RootCount = 5;
|
||||
|
||||
public static bool Create(Point placementPosition)
|
||||
{
|
||||
float worldSize = Main.maxTilesX / 4200f;
|
||||
if (!WorldUtils.Find(new Point(placementPosition.X - 3, placementPosition.Y), Searches.Chain(new Searches.Down(400), new GenCondition[]
|
||||
{
|
||||
new Conditions.IsSolid().AreaAnd(6, 1)
|
||||
}), out Point ground))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ground.Y += (int)(TrunkHeight * 0.645f);
|
||||
|
||||
// Get all tiles in a specific area.
|
||||
Dictionary<ushort, int> tileCounts = new Dictionary<ushort, int>();
|
||||
WorldUtils.Gen(new Point(ground.X - TrunkHeight / 2, ground.Y - TrunkHeight / 2), new Shapes.Rectangle(TrunkHeight, TrunkHeight), new Actions.TileScanner(new ushort[]
|
||||
{
|
||||
TileID.Dirt,
|
||||
TileID.Stone,
|
||||
TileID.Mud,
|
||||
TileID.JungleGrass,
|
||||
TileID.SnowBlock,
|
||||
TileID.Sand,
|
||||
}).Output(tileCounts));
|
||||
|
||||
int overworldTileCount = tileCounts[TileID.Dirt] + tileCounts[TileID.Stone];
|
||||
int jungleTileCount = tileCounts[TileID.Mud] + tileCounts[TileID.JungleGrass];
|
||||
|
||||
// Avoid jungles, deserts, and snow biomes.
|
||||
if (tileCounts[TileID.SnowBlock] > jungleTileCount || jungleTileCount > overworldTileCount || overworldTileCount < 50 || tileCounts[TileID.Sand] >= 50)
|
||||
return false;
|
||||
|
||||
float trunkRotation = WorldGen.genRand.NextFloatDirection() * 0.116f;
|
||||
for (int i = 0; i < TrunkHeight; i += 2)
|
||||
{
|
||||
Point currentPoint = (ground.ToVector2() - Vector2.UnitY.RotatedBy(trunkRotation) * i).ToPoint();
|
||||
|
||||
// Create the trunk.
|
||||
WorldUtils.Gen(currentPoint, new Shapes.Rectangle(TrunkWidth, TrunkWidth), Actions.Chain(new GenAction[]
|
||||
{
|
||||
new Actions.ClearTile(),
|
||||
new Actions.PlaceWall(WallID.LivingWood, true),
|
||||
new Actions.PlaceTile(TileID.LivingMahogany)
|
||||
}));
|
||||
}
|
||||
|
||||
// Generate roots.
|
||||
for (int i = 0; i < RootCount; i++)
|
||||
{
|
||||
int rootLength = (int)(TrunkHeight * WorldGen.genRand.NextFloat(0.425f, 0.7f));
|
||||
float rootAngle = MathHelper.Lerp(-0.89f, 0.89f, i / (float)(RootCount - 1f)) + WorldGen.genRand.NextFloatDirection() * 0.074f + trunkRotation + MathHelper.PiOver2;
|
||||
WorldUtils.Gen(ground, new ShapeRoot(rootAngle, rootLength, TrunkWidth - 1), Actions.Chain(new GenAction[]
|
||||
{
|
||||
new Actions.SetTile(TileID.LivingMahogany),
|
||||
}));
|
||||
}
|
||||
|
||||
List<Point> branchEnds = new();
|
||||
Point topOfTrunk = (ground.ToVector2() - Vector2.UnitY.RotatedBy(trunkRotation) * (TrunkHeight - 4f)).ToPoint();
|
||||
|
||||
// Create side branches.
|
||||
for (int i = 0; i < RootCount - 1; i++)
|
||||
{
|
||||
int branchLength = WorldGen.genRand.Next(26, 49);
|
||||
float branchDirectionX = -WorldGen.genRand.NextFloat(1.25f, 4.5f) * WorldGen.genRand.NextBool().ToDirectionInt();
|
||||
float branchDirectionY = -2f;
|
||||
Vector2 branchDirection = new Vector2(branchDirectionX, branchDirectionY).SafeNormalize(Vector2.UnitX);
|
||||
Point branchStart = (ground.ToVector2() - Vector2.UnitY.RotatedBy(trunkRotation) * Main.rand.NextFloat(0.45f, 0.84f) * TrunkHeight).ToPoint();
|
||||
WorldUtils.Gen(branchStart, new ShapeBranch(branchDirection.ToRotation(), branchLength).OutputEndpoints(branchEnds), Actions.Chain(new GenAction[]
|
||||
{
|
||||
new Actions.SetTile(TileID.LivingMahogany),
|
||||
}));
|
||||
}
|
||||
|
||||
// Create branch leaves.
|
||||
using (List<Point>.Enumerator enumerator = branchEnds.GetEnumerator())
|
||||
{
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
WorldUtils.Gen(enumerator.Current, new Shapes.Circle(4), Actions.Chain(new GenAction[]
|
||||
{
|
||||
new Modifiers.Blotches(4, 2, 0.3),
|
||||
new Actions.SetTile(TileID.LivingMahoganyLeaves),
|
||||
new Actions.SetFrames(true)
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
// Create leaves at the top of the trunk.
|
||||
WorldUtils.Gen(topOfTrunk, new Shapes.Circle(TrunkWidth * 2), Actions.Chain(new GenAction[]
|
||||
{
|
||||
new Modifiers.Blotches(3, 2, 0.1),
|
||||
new Actions.SetTile(TileID.LivingMahoganyLeaves),
|
||||
new Actions.SetFrames(true)
|
||||
}));
|
||||
|
||||
// Generate a cave in the roots of the biome.
|
||||
int width = (int)(WorldGen.genRand.Next(104, 120) * worldSize);
|
||||
int height = (int)(WorldGen.genRand.Next(88, 110) * worldSize);
|
||||
Vector2 cavePosition = ground.ToVector2() + Vector2.UnitY * height * 0.44f;
|
||||
Rectangle caveArea = Utils.CenteredRectangle(cavePosition, new Vector2(width, height));
|
||||
FloralParadiseMinibiome.Place(caveArea);
|
||||
|
||||
// Clear out the inner part of the tiles to create an open space in the tree.
|
||||
for (int i = 0; i < TrunkHeight * 0.9f; i += 2)
|
||||
{
|
||||
Point currentPoint = (ground.ToVector2() - Vector2.UnitY.RotatedBy(trunkRotation) * i).ToPoint();
|
||||
Point center = (currentPoint.ToVector2() + Vector2.One * TrunkHollowSpace - Vector2.UnitX * 2f).ToPoint();
|
||||
WorldUtils.Gen(center, new Shapes.Rectangle(TrunkHollowSpace, TrunkHollowSpace), Actions.Chain(new GenAction[]
|
||||
{
|
||||
new Actions.ClearTile(true),
|
||||
new Actions.PlaceWall(WallID.LivingWood, true)
|
||||
}));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||