WIP sunken sea backgrounds

This commit is contained in:
Mortis3 committed 2023-12-26 16:15:20 -05:00
1 parent bb7f1ed8fa
commit c0d9dcee1a
36 files changed
+349 -178

No files matched your search

+6 -2
View File
@@ -1,4 +1,5 @@
using Terraria.ModLoader;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Backgrounds
{
@@ -7,7 +8,10 @@ namespace CalamityMod.Backgrounds
public override void FillTextureArray(int[] textureSlots)
{
for (int i = 0; i <= 3; i++)
textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG" + i.ToString());
{
textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel");
//textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG" + i.ToString());
}
}
}
}
+128
View File
@@ -0,0 +1,128 @@
using Terraria;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
namespace CalamityMod.Backgrounds
{
internal static class SunkenSeaBurrowsBG
{
public static void Load()
{
if (Main.dedServ)
{
return;
}
On_Main.DrawBackgroundBlackFill += DrawBurrowsBG;
}
public static float Transparency;
public static float TransitionSpeed => 0.02f;
private static void DrawBurrowsBG(On_Main.orig_DrawBackgroundBlackFill orig, Main self)
{
if (Main.gameMenu || Main.screenPosition.Y + Main.screenHeight < ((int)Main.worldSurface) * 16f)
{
orig(self);
return;
}
orig(self);
if (Main.LocalPlayer.InModBiome(ModContent.GetInstance<BiomeManagers.SunkenSeaBurrowsBiome>()))
{
Transparency += TransitionSpeed;
if (Transparency > 1f)
{
Transparency = 1f;
}
}
else
{
//make transparency immediately go down so it doesnt look weird, since vanilla underground backgrounds dont have the fade-in effect this background has
Transparency -= 1f;
if (Transparency < 0f)
{
Transparency = 0f;
}
}
//dont bother running any of the background drawing if the transparency is zero (meaning the background isnt actually active)
//also do not run any of the background drawing if you have the vanilla background config option turned off
if (Transparency > 0f && Main.BackgroundEnabled)
{
Vector2 vector = Main.screenPosition + new Vector2((Main.screenWidth >> 1), (Main.screenHeight >> 1));
float num = (Main.GameViewMatrix.Zoom.Y - 1f) * 0.5f * 200f;
float Scale = 1.5f;
for (int Layers = 4; Layers >= 0; Layers--)
{
//get each background texture
Texture2D BGTexture = ModContent.Request<Texture2D>("CalamityMod/Backgrounds/SunkenSeaBurrowsBG" + Layers).Value;
Vector2 vector2 = new Vector2(BGTexture.Width, BGTexture.Height) * 0.5f;
float num2 = (Layers * 2 + 3f);
Vector2 vector3 = new Vector2(1f / num2);
Rectangle rectangle = new Rectangle(0, 0, BGTexture.Width, BGTexture.Height);
Vector2 zero = Vector2.Zero;
switch (Layers)
{
case 0:
{
zero.Y += 800f;
break;
}
case 1:
{
zero.Y += 200f;
break;
}
case 2:
{
zero.Y += 450f;
break;
}
case 3:
{
zero.Y += 45f;
break;
}
case 4:
{
zero.Y += 45f;
break;
}
}
vector2 *= Scale;
zero.Y -= num;
float LoopWidth = Scale * rectangle.Width;
//float LoopHeight = Scale * rectangle.Height;
int LoopX = (int)((vector.X * vector3.X - vector2.X + zero.X - (Main.screenWidth >> 1)) / LoopWidth);
//int LoopY = (int)((vector.Y * vector3.Y - vector2.Y + zero.Y - (Main.screenWidth >> 1)) / LoopWidth);
//for (int i = LoopY - 2; i < LoopY + 4 + (int)(Main.screenWidth / LoopHeight); i++)
//{
for (int j = LoopX - 2; j < LoopX + 4 + (int)(Main.screenWidth / LoopWidth); j++)
{
Vector2 drawPosition = (new Vector2(j * Scale * (rectangle.Width / vector3.X), ((Main.LocalPlayer.Center.Y / 16f) - 90) * 16f) + vector2 - vector) * vector3 + vector - Main.screenPosition - vector2 + zero;
var frame = rectangle;
var color = Color.MediumTurquoise * Transparency;
Main.spriteBatch.Draw(BGTexture, drawPosition, frame, color, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f);
}
//}
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

+56 -5
View File
@@ -1,15 +1,65 @@
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Systems;
using Terraria;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Graphics.Light;
using Microsoft.Xna.Framework;
using System;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using CalamityMod.Items.Placeables.Furniture;
using CalamityMod.Systems;
namespace CalamityMod.BiomeManagers
{
//this is just a global sunken sea biome to check if you are in any of the existing biomes
public class SunkenSeaBiome : ModBiome
{
//this is just a global sunken sea biome to check if you are in any of the existing biomes
public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh;
public override void Load()
{
//apply the drawblack edits here since all sunken sea biomes will have custom backgrounds
IL_Main.DrawBlack += ChangeBlackThreshold;
On_Main.DrawBlack += ForceDrawBlack;
}
private void ForceDrawBlack(On_Main.orig_DrawBlack orig, Main self, bool force)
{
if (Main.LocalPlayer.InModBiome(ModContent.GetInstance<BiomeManagers.SunkenSeaBiome>()) && Main.BackgroundEnabled)
{
orig(self, true);
}
else
{
orig(self, force);
}
}
private float NewThreshold(float orig)
{
if (Main.LocalPlayer.InModBiome(ModContent.GetInstance<BiomeManagers.SunkenSeaBiome>()) && Main.BackgroundEnabled)
{
return 0.1f;
}
else
{
return orig;
}
}
private void ChangeBlackThreshold(ILContext il)
{
if (Main.BackgroundEnabled)
{
var c = new ILCursor(il);
c.TryGotoNext(n => n.MatchLdloc(6), n => n.MatchStloc(13)); //beginning of the loop, local 11 is a looping variable
c.Index++; //this is kinda goofy since I dont think you could actually ever write c# to compile to the resulting IL from emitting here.
c.Emit(OpCodes.Ldloc, 3); //pass the original value so we can set that instead if we dont want to change the threshold
c.EmitDelegate<Func<float, float>>(NewThreshold); //check if were in the biome to set, else set the original value
c.Emit(OpCodes.Stloc, 3); //num2 in vanilla, controls minimum threshold to turn a tile black
}
}
public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon";
// Placeholder until we get a dedicated Sunken Sea background
public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AbyssBGLayer1";
@@ -17,7 +67,8 @@ namespace CalamityMod.BiomeManagers
public override bool IsBiomeActive(Player player)
{
return BiomeTileCounterSystem.SunkenSeaTiles > 150;
return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 500 || BiomeTileCounterSystem.SunkenSeaPolypTiles > 500 ||
BiomeTileCounterSystem.SunkenSeaReefsTiles > 500 || BiomeTileCounterSystem.SunkenSeaShoresTiles > 500;
}
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.BiomeManagers
bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles;
bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles;
return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 150 && MoreThanReefs && MoreThanPolyp;
return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 500 && MoreThanReefs && MoreThanPolyp;
}
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.BiomeManagers
bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaPolypTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles;
bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaPolypTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles;
return BiomeTileCounterSystem.SunkenSeaPolypTiles > 150 && MoreThanReefs && MoreThanBurrows;
return BiomeTileCounterSystem.SunkenSeaPolypTiles > 500 && MoreThanReefs && MoreThanBurrows;
}
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.BiomeManagers
bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles;
bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles;
return BiomeTileCounterSystem.SunkenSeaReefsTiles > 150 && MoreThanBurrows && MoreThanPolyp;
return BiomeTileCounterSystem.SunkenSeaReefsTiles > 500 && MoreThanBurrows && MoreThanPolyp;
}
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ namespace CalamityMod.BiomeManagers
public override bool IsBiomeActive(Player player)
{
return BiomeTileCounterSystem.SunkenSeaShoresTiles > 150;
return BiomeTileCounterSystem.SunkenSeaShoresTiles > 500;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 591 B

+2 -1
View File
@@ -218,11 +218,12 @@ namespace CalamityMod
BaseIdleHoldoutProjectile.LoadAll();
PlayerDashManager.Load();
//load all the detours for the custom surface backgrounds
//load all the detours for the custom backgrounds
Backgrounds.AstralSurfaceBG.Load();
Backgrounds.AstralDesertBG.Load();
Backgrounds.AstralSnowBG.Load();
Backgrounds.SulphurSeaBG.Load();
Backgrounds.SunkenSeaBurrowsBG.Load();
}
private void LoadClient()
+2 -2
View File
@@ -1014,7 +1014,7 @@ namespace CalamityMod.ILEditing
}
if (Main.waterStyle == SunkenSeaBurrowsWater.Type)
{
waterGlowColor = new Color(76, 211, 231);
waterGlowColor = new Color(44, 123, 135);
}
if (Main.waterStyle == BasaltGullyWater.Type)
{
@@ -1040,7 +1040,7 @@ namespace CalamityMod.ILEditing
float wave5angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave5));
float wave6angle = 0.55f + 0.45f * (float)Math.Sin(MathHelper.ToRadians(wave6));
float bigwaveangle = 0.55f + 0.80f * (float)Math.Sin(MathHelper.ToRadians(bigwave));
outputColor = Vector3.Lerp(outputColor, waterGlowColor.ToVector3(), 0.07f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle + wave6angle + bigwaveangle);
outputColor = Vector3.Lerp(outputColor, Color.DarkSlateGray.ToVector3(), 0.07f + wave1angle + wave2angle + wave3angle + wave4angle + wave5angle + wave6angle + bigwaveangle);
outputColor *= brightness;
}
}
-42
View File
@@ -1,42 +0,0 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Items.Placeables;
using CalamityMod.Items.Materials;
namespace CalamityMod.Items.Armor.Vanity
{
[AutoloadEquip(EquipType.Head)]
public class AbyssHood : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Armor.Vanity";
public override void SetStaticDefaults()
{
if (Main.netMode != NetmodeID.Server)
{
ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false;
}
}
public override void SetDefaults()
{
Item.width = 32;
Item.height = 22;
Item.rare = ItemRarityID.Cyan;
Item.vanity = true;
Item.Calamity().devItem = true;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<AbyssGravel>(10).
AddIngredient<Lumenyl>(18).
AddIngredient(ItemID.Silk, 20).
AddTile(TileID.Loom).
Register();
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

-48
View File
@@ -1,48 +0,0 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Items.Placeables;
using CalamityMod.Items.Materials;
namespace CalamityMod.Items.Armor.Vanity
{
[AutoloadEquip(EquipType.Body)]
public class AbyssRobe : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Armor.Vanity";
public override void Load()
{
if (Main.netMode != NetmodeID.Server)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Vanity/AbyssRobe_Legs", EquipType.Legs, this);
}
}
public override void SetDefaults()
{
Item.width = 38;
Item.height = 30;
Item.vanity = true;
Item.Calamity().devItem = true;
Item.rare = ItemRarityID.Cyan;
}
public override void SetMatch(bool male, ref int equipSlot, ref bool robes)
{
robes = true;
equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<AbyssGravel>(22).
AddIngredient<Lumenyl>(25).
AddIngredient(ItemID.Silk, 25).
AddTile(TileID.Loom).
Register();
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

+2 -1
View File
@@ -20,8 +20,9 @@ namespace CalamityMod.Items.Pets
Item.useTime = 20;
Item.useStyle = ItemUseStyleID.Swing;
Item.noMelee = true;
Item.Calamity().devItem = true;
Item.value = Item.sellPrice(platinum: 1);
Item.rare = ItemRarityID.Cyan;
Item.Calamity().devItem = true;
Item.shoot = ModContent.ProjectileType<EidolonSnail>();
Item.buffType = ModContent.BuffType<EidolonSnailBuff>();
Item.UseSound = SoundID.Item2;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 558 B

@@ -354,7 +354,7 @@ Dreamfog: {
}
EidolonSnailBuff: {
DisplayName: Escargidolon Snail
DisplayName: Eidolon Snail
Description: What a silly little snail
}
@@ -242,13 +242,3 @@ YharonMask: {
DisplayName: Yharon Mask
Tooltip: ""
}
AbyssHood: {
DisplayName: Abyss Cultist Hood
Tooltip: Turns your face into tentacles
}
AbyssRobe: {
DisplayName: Abyss Cultist Robe
Tooltip: It feels cold, but very cozy
}
@@ -1,9 +1,9 @@
AbyssShellFossil: {
DisplayName: Abyssal Shell Fossil
DisplayName: Abyss Shell Fossil
Tooltip:
'''
Summons an escargidolon snail to follow you
Slightly reduces creatures' ability to detect you in the abyss
Summons a pet Eidolon Snail to follow you
Slightly reduces creatures' ability to detect you in the abyss while equipped
'''
}
+46 -13
View File
@@ -1,9 +1,10 @@
using CalamityMod.CalPlayer;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using System;
using CalamityMod.CalPlayer;
namespace CalamityMod.Projectiles.Pets
{
@@ -11,12 +12,16 @@ namespace CalamityMod.Projectiles.Pets
{
public new string LocalizationCategory => "Projectiles.Pets";
private int playerStill = 0;
private bool idleAnimation = false;
private bool fly = false;
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 8;
Main.projFrames[Projectile.type] = 12;
Main.projPet[Projectile.type] = true;
ProjectileID.Sets.CharacterPreviewAnimations[Projectile.type] = ProjectileID.Sets.SimpleLoop(0, 4, 5)
.WithOffset(-18f, 0f).WithSpriteDirection(1).WhenNotSelected(0, 0);
}
public override void SetDefaults()
@@ -77,6 +82,7 @@ namespace CalamityMod.Projectiles.Pets
Projectile.active = false;
return;
}
CalamityPlayer modPlayer = player.Calamity();
if (player.dead)
{
@@ -154,27 +160,54 @@ namespace CalamityMod.Projectiles.Pets
//set frames when idle
if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0)
{
Projectile.frame = 0;
Projectile.frameCounter = 0;
if (Main.rand.NextBool(200) && !idleAnimation)
{
idleAnimation = true;
}
if (idleAnimation)
{
Projectile.frameCounter++;
if (Projectile.frameCounter > 8)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 4)
{
Projectile.frame = 0;
idleAnimation = false;
}
}
else
{
Projectile.frame = 0;
Projectile.frameCounter = 0;
}
}
//falling frame
else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y)
{
Projectile.frame = 4;
Projectile.frame = 3;
Projectile.frameCounter = 0;
}
else if (Projectile.velocity.X != 0)
{
if (Projectile.frame < 4)
{
Projectile.frame = 4;
}
//moving animation
Projectile.frameCounter++;
if (Projectile.frameCounter > 2)
if (Projectile.frameCounter > 7 - (Projectile.velocity.X > 0 ? Projectile.velocity.X : -Projectile.velocity.X))
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 4)
if (Projectile.frame > 8)
{
Projectile.frame = 1;
Projectile.frame = 4;
}
}
@@ -291,14 +324,14 @@ namespace CalamityMod.Projectiles.Pets
//funny flying animation
Projectile.frameCounter++;
if (Projectile.frameCounter > 3)
if (Projectile.frameCounter > 4)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 7)
if (Projectile.frame > 11)
{
Projectile.frame = 5;
Projectile.frame = 9;
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

+1 -1
View File
@@ -52,7 +52,7 @@ namespace CalamityMod.Systems
public override void TileCountsAvailable(ReadOnlySpan<int> tileCounts)
{
BrimstoneCragTiles = tileCounts[ModContent.TileType<InfernalSuevite>()] + tileCounts[ModContent.TileType<BrimstoneSlag>()];
SunkenSeaTiles = tileCounts[ModContent.TileType<EutrophicSand>()] + tileCounts[ModContent.TileType<HardenedEutrophicSand>()] + tileCounts[ModContent.TileType<Navystone>()] + tileCounts[ModContent.TileType<Limestone>()] + tileCounts[ModContent.TileType<PolypSand>()] + tileCounts[ModContent.TileType<RuneSand>()] + + tileCounts[ModContent.TileType<Runestone>()];
SunkenSeaTiles = tileCounts[ModContent.TileType<EutrophicSand>()] + tileCounts[ModContent.TileType<HardenedEutrophicSand>()] + tileCounts[ModContent.TileType<Navystone>()] + tileCounts[ModContent.TileType<Limestone>()] + tileCounts[ModContent.TileType<PolypSand>()] + tileCounts[ModContent.TileType<RuneSand>()] + tileCounts[ModContent.TileType<Runestone>()];
SunkenSeaShoresTiles = tileCounts[ModContent.TileType<Runestone>()] + + tileCounts[ModContent.TileType<RuneSand>()];
SunkenSeaPolypTiles = tileCounts[ModContent.TileType<Limestone>()] + tileCounts[ModContent.TileType<PolypSand>()];
SunkenSeaReefsTiles = tileCounts[ModContent.TileType<Shellstone>()] + tileCounts[ModContent.TileType<EutrophicSand>()];
+1 -1
View File
@@ -24,7 +24,7 @@ namespace CalamityMod.Tiles.Abyss
TileID.Sets.ChecksForMerge[Type] = true;
HitSound = SoundID.Dig;
DustType = 119;
AddMapEntry(new Color(139, 206, 56));
AddMapEntry(new Color(70, 115, 144));
Main.tileShine2[Type] = true;
TileID.Sets.CanBeDugByShovel[Type] = true;
+2 -2
View File
@@ -19,9 +19,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient
TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3);
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0);
TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile);
TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile, 3, 0);
TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0);
TileObjectData.addAlternate(1);
TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 3, 0);
TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0);
TileObjectData.addTile(Type);
DustType = 253;
AddMapEntry(new Color(54, 69, 72));
+2
View File
@@ -32,6 +32,8 @@ namespace CalamityMod.Tiles.SunkenSea
AddMapEntry(new Color(58, 55, 70));
MinPick = 100;
TileFraming.SetUpUniversalMerge(Type, ModContent.TileType<RuneSand>(), out tileAdjacency);
TileFraming.SetUpUniversalMerge(Type, TileID.Sandstone, out secondTileAdjacency);
TileFraming.SetUpUniversalMerge(Type, TileID.Sand, out thirdTileAdjacency);
+3 -1
View File
@@ -214,7 +214,7 @@ namespace CalamityMod.World
CreateBeach();
ClearOutStrayTiles();
ClearAloneTiles();
PlaceSulphurReef();
//PlaceSulphurReef();
var scrapPilePositions = PlaceScrapPiles();
GenerateColumnsInCaverns();
GenerateHardenedSandstone();
@@ -671,6 +671,7 @@ namespace CalamityMod.World
}
}
/*
public static void PlaceSulphurReef()
{
int beachWidth = WorldGen.genRand.Next(150, 190 + 1);
@@ -810,6 +811,7 @@ namespace CalamityMod.World
return distance <= distanceConstant;
}
*/
public static void CreateBeach()
{
+90 -41
View File
@@ -26,6 +26,38 @@ namespace CalamityMod.World
-Make sunken sea walls produce water
*/
public static void PlaceTimelessShores(int startPosX, int startPosY)
{
int biomeSize = 180 + (Main.maxTilesX / 180);
for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X++)
{
for (int Y = startPosY - 50; Y <= startPosY + 50; Y++)
{
if ((X == startPosX - biomeSize || X == startPosX + biomeSize) && (Y == startPosY - 50 || Y == startPosY + 50))
{
ShapeData circle = new ShapeData();
GenAction blotchMod = new Modifiers.Blotches(2, 0.4);
WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[]
{
blotchMod.Output(circle)
}));
WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[]
{
new Actions.Clear(),
new Actions.PlaceTile((ushort)ModContent.TileType<Runestone>())
}));
}
else
{
Main.tile[X, Y].ClearEverything();
WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType<Runestone>());
}
}
}
}
//sides of the sunken sea (radiant reefs)
public static void PlaceRadiantReefs(int startPosX, int startPosY, bool LeftSideBarrier)
{
@@ -65,16 +97,16 @@ namespace CalamityMod.World
{
if (LeftSideBarrier)
{
if (X <= origin.X && Main.tile[X, Y].TileType != ModContent.TileType<Basalt>())
if (X <= origin.X && Main.tile[X - 40, Y].TileType != ModContent.TileType<Basalt>())
{
ShapeData circle = new ShapeData();
GenAction blotchMod = new Modifiers.Blotches(2, 0.4);
WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[]
WorldUtils.Gen(new Point(X - 40, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[]
{
blotchMod.Output(circle)
}));
WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[]
WorldUtils.Gen(new Point(X - 40, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[]
{
new Actions.Clear(),
new Actions.PlaceTile((ushort)ModContent.TileType<Basalt>())
@@ -83,16 +115,16 @@ namespace CalamityMod.World
}
else
{
if (X >= origin.X && Main.tile[X, Y].TileType != ModContent.TileType<Basalt>())
if (X >= origin.X && Main.tile[X + 40, Y].TileType != ModContent.TileType<Basalt>())
{
ShapeData circle = new ShapeData();
GenAction blotchMod = new Modifiers.Blotches(2, 0.4);
WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[]
WorldUtils.Gen(new Point(X + 40, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[]
{
blotchMod.Output(circle)
}));
WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[]
WorldUtils.Gen(new Point(X + 40, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[]
{
new Actions.Clear(),
new Actions.PlaceTile((ushort)ModContent.TileType<Basalt>())
@@ -549,7 +581,7 @@ namespace CalamityMod.World
float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls;
float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f;
float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f;
float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.235f;
float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f;
if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls)
{
@@ -657,50 +689,67 @@ namespace CalamityMod.World
}
//basalt biome underneath the sunken sea
//TODO: this generation is horribly optimized, redo this to place a rectangle of basalt with side dithering that goes down to hell instead of a loop of circles
public static void PlaceBasaltGully(int startPosX, int startPosY)
{
int biomeSize = 230 + (Main.maxTilesX / 180);
//place area of basalt all the way down to hell
for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X += 20)
int XLeft = GenVars.UndergroundDesertLocation.Left;
int XRight = GenVars.UndergroundDesertLocation.Right;
for (int Y = startPosY - 30; Y <= Main.maxTilesY - 230; Y += 20)
{
for (int Y = startPosY + 20; Y <= Main.maxTilesY - 250; Y += 20)
if (Main.tile[XLeft, Y].TileType != ModContent.TileType<Basalt>())
{
if (Main.tile[X, Y].TileType != ModContent.TileType<Basalt>())
ShapeData circle = new ShapeData();
GenAction blotchMod = new Modifiers.Blotches(2, 0.4);
int radius = WorldGen.genRand.Next(30, 45);
int RandomX = Main.rand.Next(-25, 25);
WorldUtils.Gen(new Point(XLeft, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[]
{
ShapeData circle = new ShapeData();
GenAction blotchMod = new Modifiers.Blotches(2, 0.4);
WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[]
{
blotchMod.Output(circle)
}));
WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[]
{
new Actions.Clear(),
new Actions.PlaceTile((ushort)ModContent.TileType<Basalt>())
}));
blotchMod.Output(circle)
}));
//place a giant area of basalt below the sunken sea
for (int j = Y; j <= Main.maxTilesY - 250; j += 15)
{
int radius = WorldGen.genRand.Next(30, 45);
int RandomX = Main.rand.Next(-25, 25);
WorldUtils.Gen(new Point(XLeft, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[]
{
new Actions.Clear(),
new Actions.PlaceTile((ushort)ModContent.TileType<Basalt>()),
new Actions.PlaceWall(WallID.LavaUnsafe1)
}));
}
WorldUtils.Gen(new Point(X + RandomX, j), new Shapes.Circle(radius), Actions.Chain(new GenAction[]
{
blotchMod.Output(circle)
}));
if (Main.tile[XRight, Y].TileType != ModContent.TileType<Basalt>())
{
ShapeData circle = new ShapeData();
GenAction blotchMod = new Modifiers.Blotches(2, 0.4);
//place blocks
WorldUtils.Gen(new Point(X + RandomX, j), new ModShapes.All(circle), Actions.Chain(new GenAction[]
{
new Actions.Clear(),
new Actions.PlaceTile((ushort)ModContent.TileType<Basalt>()),
new Actions.PlaceWall(WallID.LavaUnsafe1)
}));
}
}
int radius = WorldGen.genRand.Next(30, 45);
int RandomX = Main.rand.Next(-25, 25);
WorldUtils.Gen(new Point(XRight, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[]
{
blotchMod.Output(circle)
}));
WorldUtils.Gen(new Point(XRight, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[]
{
new Actions.Clear(),
new Actions.PlaceTile((ushort)ModContent.TileType<Basalt>()),
new Actions.PlaceWall(WallID.LavaUnsafe1)
}));
}
}
//place area of basalt all the way down to hell
for (int X = startPosX - biomeSize - 25; X <= startPosX + biomeSize + 25; X++)
{
for (int Y = startPosY - 30; Y <= Main.maxTilesY - 210; Y++)
{
Main.tile[X, Y].ClearEverything();
WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType<Basalt>());
WorldGen.PlaceWall(X, Y, WallID.LavaUnsafe1);
}
}