Merge of Dylan's worldgen stuff
No files matched your search
@@ -1,29 +0,0 @@
|
||||
using CalamityMod.Projectiles.Pets;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Buffs.Pets
|
||||
{
|
||||
public class SeaSlugBuff : ModBuff
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Sea Slug");
|
||||
Description.SetDefault("The bioluminscent sea slug is following you");
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.vanityPet[Type] = true;
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
player.buffTime[buffIndex] = 18000;
|
||||
player.Calamity().seaSlugPet = true;
|
||||
bool petProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType<SeaSlug>()] <= 0;
|
||||
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(player.GetSource_Buff(buffIndex), player.Center, Vector2.Zero, ModContent.ProjectileType<SeaSlug>(), 0, 0f, player.whoAmI, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 588 B |
@@ -327,7 +327,6 @@ namespace CalamityMod.CalPlayer
|
||||
public bool bendyPet = false;
|
||||
public bool littleLightPet = false;
|
||||
public bool pineapplePet = false;
|
||||
public bool seaSlugPet = false;
|
||||
#endregion
|
||||
|
||||
#region Rage
|
||||
@@ -1478,7 +1477,6 @@ namespace CalamityMod.CalPlayer
|
||||
bendyPet = false;
|
||||
littleLightPet = false;
|
||||
pineapplePet = false;
|
||||
seaSlugPet = false;
|
||||
|
||||
onyxExcavator = false;
|
||||
rimehound = false;
|
||||
|
||||
|
After Width: | Height: | Size: 277 B |
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 256 B |
|
After Width: | Height: | Size: 388 B |
|
After Width: | Height: | Size: 427 B |
|
After Width: | Height: | Size: 493 B |
|
After Width: | Height: | Size: 392 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 276 B |
|
After Width: | Height: | Size: 305 B |
|
After Width: | Height: | Size: 314 B |
@@ -174,11 +174,11 @@ namespace CalamityMod.Items
|
||||
if (item.type == ModContent.ItemType<Earth>())
|
||||
{
|
||||
List<Color> earthColors = new List<Color>()
|
||||
{
|
||||
new Color(255, 99, 146),
|
||||
new Color(255, 228, 94),
|
||||
new Color(127, 200, 248)
|
||||
};
|
||||
{
|
||||
new Color(255, 99, 146),
|
||||
new Color(255, 228, 94),
|
||||
new Color(127, 200, 248)
|
||||
};
|
||||
if (nameLine != null)
|
||||
{
|
||||
int colorIndex = (int)(Main.GlobalTimeWrappedHourly / 2 % earthColors.Count);
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
using CalamityMod.Buffs.Pets;
|
||||
using CalamityMod.Projectiles.Pets;
|
||||
using CalamityMod.Rarities;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Pets
|
||||
{
|
||||
public class SeaSlugCerata : ModItem
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
SacrificeTotal = 1;
|
||||
DisplayName.SetDefault("Sea Slug Cerata");
|
||||
Tooltip.SetDefault("Summons a bioluminescent sea slug to follow you"
|
||||
+ "\nThe sea slug will change colors in different environments");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 0;
|
||||
Item.useStyle = ItemUseStyleID.Swing;
|
||||
Item.useAnimation = 20;
|
||||
Item.useTime = 20;
|
||||
Item.noMelee = true;
|
||||
Item.width = 26;
|
||||
Item.height = 28;
|
||||
|
||||
Item.value = Item.sellPrice(gold: 20);
|
||||
Item.rare = ModContent.RarityType<Turquoise>();
|
||||
Item.Calamity().devItem = true;
|
||||
|
||||
Item.shoot = ModContent.ProjectileType<SeaSlug>();
|
||||
Item.buffType = ModContent.BuffType<SeaSlugBuff>();
|
||||
Item.UseSound = SoundID.Item2;
|
||||
}
|
||||
|
||||
public override void UseStyle(Player player, Rectangle heldItemFrame)
|
||||
{
|
||||
if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
|
||||
{
|
||||
player.AddBuff(Item.buffType, 15, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 537 B |
@@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
||||
{
|
||||
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
|
||||
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns,
|
||||
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky,
|
||||
|
||||
// Will move to localization whenever that is cleaned up.
|
||||
new FlavorTextBestiaryInfoElement("Slimes take on the qualities of their environments and after feasting on aerialite ore, this slime has grown wings.")
|
||||
|
||||
@@ -369,8 +369,6 @@ namespace CalamityMod.NPCs.TownNPCs
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<PolypLauncher>());
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ModContent.ItemType<SeaSlugCerata>());
|
||||
nextSlot++;
|
||||
if (CalamityConfig.Instance.PotionSelling)
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemID.GillsPotion);
|
||||
|
||||
@@ -1,419 +0,0 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using System;
|
||||
|
||||
namespace CalamityMod.Projectiles.Pets
|
||||
{
|
||||
public class SeaSlug : ModProjectile
|
||||
{
|
||||
private int playerStill = 0;
|
||||
private bool fly = false;
|
||||
private int idleTimer = 0;
|
||||
|
||||
private Form SeaSlugColor = Form.Normal;
|
||||
private enum Form
|
||||
{
|
||||
Normal, Sulphur, Abyss, Sunken, Astral, Hell, Snow, Desert, Jungle, Mushroom
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Sea Slug");
|
||||
Main.projFrames[Projectile.type] = 6;
|
||||
Main.projPet[Projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.netImportant = true;
|
||||
Projectile.width = 54;
|
||||
Projectile.height = 38;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft *= 5;
|
||||
Projectile.tileCollide = true;
|
||||
Projectile.ignoreWater = true;
|
||||
}
|
||||
|
||||
private void UpdateColor(Player player)
|
||||
{
|
||||
if (player.InSulphur())
|
||||
{
|
||||
SeaSlugColor = Form.Sulphur;
|
||||
}
|
||||
else if (player.InAbyss())
|
||||
{
|
||||
SeaSlugColor = Form.Abyss;
|
||||
}
|
||||
else if (player.InSunkenSea())
|
||||
{
|
||||
SeaSlugColor = Form.Sunken;
|
||||
}
|
||||
else if (player.InAstral())
|
||||
{
|
||||
SeaSlugColor = Form.Astral;
|
||||
}
|
||||
else if (player.ZoneUnderworldHeight)
|
||||
{
|
||||
SeaSlugColor = Form.Hell;
|
||||
}
|
||||
else if (player.ZoneSnow)
|
||||
{
|
||||
SeaSlugColor = Form.Snow;
|
||||
}
|
||||
else if (player.ZoneDesert)
|
||||
{
|
||||
SeaSlugColor = Form.Desert;
|
||||
}
|
||||
else if (player.ZoneJungle)
|
||||
{
|
||||
SeaSlugColor = Form.Jungle;
|
||||
}
|
||||
else if (player.ZoneGlowshroom)
|
||||
{
|
||||
SeaSlugColor = Form.Mushroom;
|
||||
}
|
||||
else
|
||||
{
|
||||
SeaSlugColor = Form.Normal;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Draw(lightColor, ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlug").Value);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PostDraw(Color lightColor)
|
||||
{
|
||||
DrawGlowmask(Color.White, ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlug_Glow").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugSulphur_Glow").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugAbyss_Glow").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugSunken_Glow").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugAstral_Glow").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugHell_Glow").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugSnow_Glow").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugDesert_Glow").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugJungle_Glow").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugMushroom_Glow").Value);
|
||||
}
|
||||
|
||||
private void Draw(Color color, Texture2D texture)
|
||||
{
|
||||
int height = texture.Height / Main.projFrames[Projectile.type];
|
||||
int frameHeight = height * Projectile.frame;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (Projectile.spriteDirection == -1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), color, Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, spriteEffects, 0);
|
||||
}
|
||||
|
||||
private void DrawGlowmask(Color color, Texture2D normal, Texture2D sulphur, Texture2D abyss, Texture2D sunken, Texture2D astral, Texture2D hell, Texture2D snow, Texture2D desert, Texture2D jungle, Texture2D mushroom)
|
||||
{
|
||||
Texture2D texture = normal;
|
||||
switch (SeaSlugColor)
|
||||
{
|
||||
case Form.Normal:
|
||||
texture = normal;
|
||||
break;
|
||||
case Form.Sulphur:
|
||||
texture = sulphur;
|
||||
break;
|
||||
case Form.Abyss:
|
||||
texture = abyss;
|
||||
break;
|
||||
case Form.Sunken:
|
||||
texture = sunken;
|
||||
break;
|
||||
case Form.Astral:
|
||||
texture = astral;
|
||||
break;
|
||||
case Form.Hell:
|
||||
texture = hell;
|
||||
break;
|
||||
case Form.Snow:
|
||||
texture = snow;
|
||||
break;
|
||||
case Form.Desert:
|
||||
texture = desert;
|
||||
break;
|
||||
case Form.Jungle:
|
||||
texture = jungle;
|
||||
break;
|
||||
case Form.Mushroom:
|
||||
texture = mushroom;
|
||||
break;
|
||||
}
|
||||
|
||||
int height = texture.Height / Main.projFrames[Projectile.type];
|
||||
int frameHeight = height * Projectile.frame;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (Projectile.spriteDirection == -1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), color, Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, spriteEffects, 0);
|
||||
}
|
||||
|
||||
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
Vector2 center2 = Projectile.Center;
|
||||
Vector2 vector48 = player.Center - center2;
|
||||
float playerDistance = vector48.Length();
|
||||
fallThrough = playerDistance > 200f;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[Projectile.owner];
|
||||
if (!player.active)
|
||||
{
|
||||
Projectile.active = false;
|
||||
return;
|
||||
}
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
if (player.dead)
|
||||
{
|
||||
modPlayer.seaSlugPet = false;
|
||||
}
|
||||
if (modPlayer.seaSlugPet)
|
||||
{
|
||||
Projectile.timeLeft = 2;
|
||||
}
|
||||
|
||||
UpdateColor(player);
|
||||
|
||||
Vector2 vector46 = Projectile.position;
|
||||
if (!fly)
|
||||
{
|
||||
Projectile.rotation = 0;
|
||||
Vector2 center2 = Projectile.Center;
|
||||
Vector2 vector48 = player.Center - center2;
|
||||
float playerDistance = vector48.Length();
|
||||
if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X)))
|
||||
{
|
||||
Projectile.velocity.Y = -8f;
|
||||
}
|
||||
Projectile.velocity.Y += 0.35f;
|
||||
if (Projectile.velocity.Y > 15f)
|
||||
{
|
||||
Projectile.velocity.Y = 15f;
|
||||
}
|
||||
if (playerDistance > 600f)
|
||||
{
|
||||
fly = true;
|
||||
Projectile.velocity.X = 0f;
|
||||
Projectile.velocity.Y = 0f;
|
||||
}
|
||||
if (playerDistance > 100f)
|
||||
{
|
||||
if (player.position.X - Projectile.position.X > 0f)
|
||||
{
|
||||
Projectile.velocity.X += 0.10f;
|
||||
if (Projectile.velocity.X > 5f)
|
||||
{
|
||||
Projectile.velocity.X = 5f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.velocity.X -= 0.10f;
|
||||
if (Projectile.velocity.X < -5f)
|
||||
{
|
||||
Projectile.velocity.X = -5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (playerDistance < 100f)
|
||||
{
|
||||
if (Projectile.velocity.X != 0f)
|
||||
{
|
||||
if (Projectile.velocity.X > 0.8f)
|
||||
{
|
||||
Projectile.velocity.X -= 0.25f;
|
||||
}
|
||||
else if (Projectile.velocity.X < -0.8f)
|
||||
{
|
||||
Projectile.velocity.X += 0.25f;
|
||||
}
|
||||
else if (Projectile.velocity.X < 0.8f && Projectile.velocity.X > -0.8f)
|
||||
{
|
||||
Projectile.velocity.X = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (playerDistance < 70f)
|
||||
{
|
||||
Projectile.velocity.X *= 0.5f;
|
||||
}
|
||||
if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0)
|
||||
{
|
||||
Projectile.frame = 0;
|
||||
Projectile.frameCounter = 0;
|
||||
}
|
||||
if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y)
|
||||
{
|
||||
Projectile.frame = 4;
|
||||
Projectile.frameCounter = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter > 3)
|
||||
{
|
||||
Projectile.frame++;
|
||||
Projectile.frameCounter = 0;
|
||||
}
|
||||
if (Projectile.frame > 4)
|
||||
{
|
||||
Projectile.frame = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (Projectile.velocity.X > 0.8f)
|
||||
{
|
||||
Projectile.spriteDirection = 1;
|
||||
}
|
||||
else if (Projectile.velocity.X < -0.8f)
|
||||
{
|
||||
Projectile.spriteDirection = -1;
|
||||
}
|
||||
}
|
||||
else if (fly)
|
||||
{
|
||||
float num16 = 0.5f;
|
||||
Projectile.tileCollide = false;
|
||||
Vector2 vector3 = new Vector2(Projectile.position.X + (float)Projectile.width * 0.5f, Projectile.position.Y + (float)Projectile.height * 0.5f);
|
||||
float horiPos = Main.player[Projectile.owner].position.X + (float)(Main.player[Projectile.owner].width / 2) - vector3.X;
|
||||
float vertiPos = Main.player[Projectile.owner].position.Y + (float)(Main.player[Projectile.owner].height / 2) - vector3.Y;
|
||||
vertiPos += (float)Main.rand.Next(-10, 21);
|
||||
horiPos += (float)Main.rand.Next(-10, 21);
|
||||
horiPos += (float)(60 * -(float)player.direction);
|
||||
vertiPos -= 60f;
|
||||
float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
|
||||
float num21 = 18f;
|
||||
float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos));
|
||||
if (playerDistance > 1200f)
|
||||
{
|
||||
Projectile.position.X = player.Center.X - (float)(Projectile.width / 2);
|
||||
Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2);
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
if (playerDistance < 100f)
|
||||
{
|
||||
num16 = 0.5f;
|
||||
if (player.velocity.Y == 0f)
|
||||
{
|
||||
++playerStill;
|
||||
}
|
||||
else
|
||||
{
|
||||
playerStill = 0;
|
||||
}
|
||||
if (playerStill > 10 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height))
|
||||
{
|
||||
fly = false;
|
||||
Projectile.velocity *= 0.2f;
|
||||
Projectile.tileCollide = true;
|
||||
}
|
||||
}
|
||||
if (playerDistance < 50f)
|
||||
{
|
||||
if (Math.Abs(Projectile.velocity.X) > 2f || Math.Abs(Projectile.velocity.Y) > 2f)
|
||||
{
|
||||
Projectile.velocity *= 0.90f;
|
||||
}
|
||||
num16 = 0.02f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (playerDistance < 100f)
|
||||
{
|
||||
num16 = 0.35f;
|
||||
}
|
||||
if (playerDistance > 300f)
|
||||
{
|
||||
num16 = 1f;
|
||||
}
|
||||
playerDistance = num21 / playerDistance;
|
||||
horiPos *= playerDistance;
|
||||
vertiPos *= playerDistance;
|
||||
}
|
||||
if (Projectile.velocity.X <= horiPos)
|
||||
{
|
||||
Projectile.velocity.X = Projectile.velocity.X + num16;
|
||||
if (num16 > 0.05f && Projectile.velocity.X < 0f)
|
||||
{
|
||||
Projectile.velocity.X = Projectile.velocity.X + num16;
|
||||
}
|
||||
}
|
||||
if (Projectile.velocity.X > horiPos)
|
||||
{
|
||||
Projectile.velocity.X = Projectile.velocity.X - num16;
|
||||
if (num16 > 0.05f && Projectile.velocity.X > 0f)
|
||||
{
|
||||
Projectile.velocity.X = Projectile.velocity.X - num16;
|
||||
}
|
||||
}
|
||||
if (Projectile.velocity.Y <= vertiPos)
|
||||
{
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + num16;
|
||||
if (num16 > 0.05f && Projectile.velocity.Y < 0f)
|
||||
{
|
||||
Projectile.velocity.Y = Projectile.velocity.Y + num16 * 2f;
|
||||
}
|
||||
}
|
||||
if (Projectile.velocity.Y > vertiPos)
|
||||
{
|
||||
Projectile.velocity.Y = Projectile.velocity.Y - num16;
|
||||
if (num16 > 0.05f && Projectile.velocity.Y > 0f)
|
||||
{
|
||||
Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f;
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction;
|
||||
|
||||
if (Projectile.Center.X < Main.player[Projectile.owner].Center.X)
|
||||
{
|
||||
Projectile.spriteDirection = 1;
|
||||
}
|
||||
else if (Projectile.Center.X > Main.player[Projectile.owner].Center.X)
|
||||
{
|
||||
Projectile.spriteDirection = -1;
|
||||
}
|
||||
|
||||
Projectile.frame = 5;
|
||||
idleTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private bool HoleBelow()
|
||||
{
|
||||
int tileWidth = 4;
|
||||
int tileX = (int)(Projectile.Center.X / 16f) - tileWidth;
|
||||
if (Projectile.velocity.X > 0)
|
||||
{
|
||||
tileX += tileWidth;
|
||||
}
|
||||
int tileY = (int)((Projectile.position.Y + Projectile.height) / 16f);
|
||||
for (int y = tileY; y < tileY + 2; y++)
|
||||
{
|
||||
for (int x = tileX; x < tileX + tileWidth; x++)
|
||||
{
|
||||
if (Main.tile[x, y].HasTile)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -86,7 +86,7 @@ namespace CalamityMod.Systems
|
||||
{
|
||||
attempts++;
|
||||
Point origin = WorldGen.RandomWorldPoint((int)Main.worldSurface + 25, 20, Main.maxTilesY - (int)Main.worldSurface - 125, 20);
|
||||
if (MiscWorldgenRoutines.CanPlaceGiantHive(origin, WorldGen.structures))
|
||||
if (GiantHive.CanPlaceGiantHive(origin, WorldGen.structures))
|
||||
break;
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace CalamityMod.Tiles.Crags
|
||||
|
||||
if (WorldGen.genRand.Next(3) == 0 && (left.TileType == ModContent.TileType<ScorchedRemainsGrass>() || right.TileType == ModContent.TileType<ScorchedRemainsGrass>()))
|
||||
{
|
||||
WorldGen.SpreadGrass(i, j, Type, ModContent.TileType<ScorchedRemainsGrass>(), false);
|
||||
Main.tile[i, j].TileType = (ushort)ModContent.TileType<ScorchedRemainsGrass>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,11 @@ namespace CalamityMod.Tiles.Crags.Tree
|
||||
X frame 0 (orange) = bottom segment
|
||||
X frame 18 (dark purple) = main body segment, each of the three y-frame variants draws a different tree segment variant
|
||||
X frame 36 (light purple) = top of the tree
|
||||
X frame 54 (teal) = rib branch segments, each of the three y-frame variants has a different pattern where:
|
||||
X frame 54 (teal) = small rib branch segments
|
||||
X frame 72 (lime) = medium rib branch segments
|
||||
X frame 90 (yellow) = large rib branch segments
|
||||
|
||||
for the branch segments:
|
||||
each of the branch frames have a pattern where
|
||||
y-frame 1 = left branch
|
||||
y-frame 2 = right branch
|
||||
y-frame 3 = both left and right branch
|
||||
@@ -136,6 +138,7 @@ namespace CalamityMod.Tiles.Crags.Tree
|
||||
}
|
||||
|
||||
int branchSegmentDelay = 0;
|
||||
int numSegments = 0;
|
||||
|
||||
for (int k = 1; k < height; k++)
|
||||
{
|
||||
@@ -148,10 +151,25 @@ namespace CalamityMod.Tiles.Crags.Tree
|
||||
|
||||
//chance to place a branch segment
|
||||
//also dont place branches below a certain threshold
|
||||
if (Main.rand.Next(3) == 0 && branchSegmentDelay == 0 && k > 5)
|
||||
if (Main.rand.Next(2) == 0 && branchSegmentDelay == 0 && k > 5)
|
||||
{
|
||||
Framing.GetTileSafely(i, j - k).TileFrameX = 3 * 18;
|
||||
float divide = 1.65f;
|
||||
|
||||
if (numSegments < 2)
|
||||
{
|
||||
Framing.GetTileSafely(i, j - k).TileFrameX = 3 * 18;
|
||||
}
|
||||
else if (numSegments < 5)
|
||||
{
|
||||
Framing.GetTileSafely(i, j - k).TileFrameX = 4 * 18;
|
||||
}
|
||||
else if (numSegments > 5)
|
||||
{
|
||||
Framing.GetTileSafely(i, j - k).TileFrameX = 5 * 18;
|
||||
}
|
||||
|
||||
Framing.GetTileSafely(i, j - k).TileFrameY = (short)(Main.rand.Next(3) * 18);
|
||||
numSegments++;
|
||||
branchSegmentDelay = 3;
|
||||
}
|
||||
//otherwise place a normal segment
|
||||
@@ -300,25 +318,26 @@ namespace CalamityMod.Tiles.Crags.Tree
|
||||
Vector2 treeSegmentOffset = new Vector2((xOff * 2) - (frameOff / 2) + 25, 14);
|
||||
Vector2 topSegmentOffset = new Vector2((xOff * 2) - (frameOff / 2) + 20, 16);
|
||||
|
||||
Texture2D baseTex = ModContent.Request<Texture2D>("CalamityMod/Tiles/Crags/Tree/SpineBottom").Value;
|
||||
Texture2D segmentTex = ModContent.Request<Texture2D>("CalamityMod/Tiles/Crags/Tree/SpineSegments").Value;
|
||||
|
||||
//draw the base of the tree
|
||||
if (Framing.GetTileSafely(i, j).TileFrameX == 0)
|
||||
{
|
||||
Texture2D segmentTex = ModContent.Request<Texture2D>("CalamityMod/Tiles/Crags/Tree/SpineBottom").Value;
|
||||
int frame = tile.TileFrameY / 18;
|
||||
|
||||
DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false);
|
||||
DrawTreeSegments(i, j, baseTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false);
|
||||
}
|
||||
|
||||
//draw the different segments of the tree
|
||||
if (Framing.GetTileSafely(i, j).TileFrameX == 18)
|
||||
{
|
||||
Texture2D segmentTex = ModContent.Request<Texture2D>("CalamityMod/Tiles/Crags/Tree/SpineSegments").Value;
|
||||
int frame = tile.TileFrameY / 18;
|
||||
|
||||
DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false);
|
||||
}
|
||||
|
||||
//draw branch segments
|
||||
//draw small branch segments
|
||||
if (Framing.GetTileSafely(i, j).TileFrameX == 54)
|
||||
{
|
||||
int frame = tile.TileFrameY / 18;
|
||||
@@ -337,8 +356,44 @@ namespace CalamityMod.Tiles.Crags.Tree
|
||||
DrawTreeSegments(i, j, rightBranchTex, new Rectangle(38 * frame, 0, 38, 40), TileOffset.ToWorldCoordinates(), rightBranchOffset, false);
|
||||
|
||||
//draw segments
|
||||
Texture2D segmentTex = ModContent.Request<Texture2D>("CalamityMod/Tiles/Crags/Tree/SpineSegments").Value;
|
||||
DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false);
|
||||
}
|
||||
|
||||
//draw medium branch segments
|
||||
if (Framing.GetTileSafely(i, j).TileFrameX == 72)
|
||||
{
|
||||
int frame = tile.TileFrameY / 18;
|
||||
|
||||
//branch drawing stuff
|
||||
Texture2D leftBranchTex = ModContent.Request<Texture2D>("CalamityMod/Tiles/Crags/Tree/SpineRib2Left").Value;
|
||||
Texture2D rightBranchTex = ModContent.Request<Texture2D>("CalamityMod/Tiles/Crags/Tree/SpineRib2Right").Value;
|
||||
|
||||
Vector2 leftBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 60, 14);
|
||||
Vector2 rightBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 4, 14);
|
||||
|
||||
DrawTreeSegments(i, j, leftBranchTex, new Rectangle(50 * frame, 0, 48, 52), TileOffset.ToWorldCoordinates(), leftBranchOffset, false);
|
||||
DrawTreeSegments(i, j, rightBranchTex, new Rectangle(50 * frame, 0, 48, 52), TileOffset.ToWorldCoordinates(), rightBranchOffset, false);
|
||||
|
||||
//draw segments
|
||||
DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false);
|
||||
}
|
||||
|
||||
//draw large branch segments
|
||||
if (Framing.GetTileSafely(i, j).TileFrameX == 90)
|
||||
{
|
||||
int frame = tile.TileFrameY / 18;
|
||||
|
||||
//branch drawing stuff
|
||||
Texture2D leftBranchTex = ModContent.Request<Texture2D>("CalamityMod/Tiles/Crags/Tree/SpineRib3Left").Value;
|
||||
Texture2D rightBranchTex = ModContent.Request<Texture2D>("CalamityMod/Tiles/Crags/Tree/SpineRib3Right").Value;
|
||||
|
||||
Vector2 leftBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 80, 14);
|
||||
Vector2 rightBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 4, 14);
|
||||
|
||||
DrawTreeSegments(i, j, leftBranchTex, new Rectangle(62 * frame, 0, 60, 58), TileOffset.ToWorldCoordinates(), leftBranchOffset, false);
|
||||
DrawTreeSegments(i, j, rightBranchTex, new Rectangle(62 * frame, 0, 60, 58), TileOffset.ToWorldCoordinates(), rightBranchOffset, false);
|
||||
|
||||
//draw segments
|
||||
DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false);
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 456 B |
@@ -340,9 +340,9 @@ namespace CalamityMod.World
|
||||
if (abyssHouse != 20)
|
||||
{
|
||||
AbyssIslandHouse(AbyssIslandPositions[abyssHouse].X,
|
||||
AbyssIslandPositions[abyssHouse].Y,
|
||||
AbyssItemArray[abyssHouse > 9 ? (abyssHouse - 10) : abyssHouse], //10 choices 0 to 9
|
||||
AbyssIslandPositions[abyssHouse].Y > (rockLayer + y * 0.143));
|
||||
AbyssIslandPositions[abyssHouse].Y,
|
||||
AbyssItemArray[abyssHouse > 9 ? (abyssHouse - 10) : abyssHouse], //10 choices 0 to 9
|
||||
AbyssIslandPositions[abyssHouse].Y > (rockLayer + y * 0.143));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -367,7 +367,7 @@ namespace CalamityMod.World
|
||||
if (structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y)))
|
||||
{
|
||||
bool hasPlacedLogAndSchematic = false;
|
||||
PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.Center, ref hasPlacedLogAndSchematic, new Action<Chest, int, bool>(FillSunkenSeaLaboratoryChest));
|
||||
PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action<Chest, int, bool>(FillSunkenSeaLaboratoryChest));
|
||||
structures.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)), 4);
|
||||
//this is center-anchored so it should be correct already
|
||||
CalamityWorld.SunkenSeaLabCenter = placementPoint.ToWorldCoordinates();
|
||||
|
||||
@@ -28,18 +28,20 @@ namespace CalamityMod.World
|
||||
bool foundValidPosition = false;
|
||||
int dungeonArchiveColor = 0; //0 = blue, 1 = green, 2 = pink
|
||||
|
||||
for (int x = 20; x <= Main.maxTilesX - 20; x++)
|
||||
int heightLimit = (Main.maxTilesY / 2) + (Main.maxTilesY / 7);
|
||||
|
||||
for (int x = 5; x <= Main.maxTilesX - 5; x++)
|
||||
{
|
||||
for (int y = Main.maxTilesY - 200; y > (Main.maxTilesY / 2) + 100; y--)
|
||||
for (int y = Main.maxTilesY - 5; y >= heightLimit; y--)
|
||||
{
|
||||
Tile tile = Main.tile[x, y];
|
||||
Tile tileUp = Main.tile[x, y - 1];
|
||||
Tile tileDown = Main.tile[x, y + 1];
|
||||
|
||||
if (!tile.HasTile && !tileUp.HasTile && (tileDown.TileType == 41 || tileDown.TileType == 43 || tileDown.TileType == 44))
|
||||
if ((tile.TileType == 41 || tile.TileType == 43 || tile.TileType == 44 || tile.TileType == 48) && !tileUp.HasTile)
|
||||
{
|
||||
//blue brick walls
|
||||
if (tile.WallType == 7 || tile.WallType == 94 || tile.WallType == 95)
|
||||
if (tileUp.WallType == 7 || tileUp.WallType == 94 || tileUp.WallType == 95)
|
||||
{
|
||||
dungeonArchiveColor = 0;
|
||||
archiveX = x;
|
||||
@@ -48,7 +50,7 @@ namespace CalamityMod.World
|
||||
foundValidPosition = true;
|
||||
}
|
||||
//green brick walls
|
||||
if (tile.WallType == 8 || tile.WallType == 98 || tile.WallType == 99)
|
||||
if (tileUp.WallType == 8 || tileUp.WallType == 98 || tileUp.WallType == 99)
|
||||
{
|
||||
dungeonArchiveColor = 1;
|
||||
archiveX = x;
|
||||
@@ -57,7 +59,7 @@ namespace CalamityMod.World
|
||||
foundValidPosition = true;
|
||||
}
|
||||
//pink brick walls
|
||||
if (tile.WallType == 9 || tile.WallType == 96 || tile.WallType == 97)
|
||||
if (tileUp.WallType == 9 || tileUp.WallType == 96 || tileUp.WallType == 97)
|
||||
{
|
||||
dungeonArchiveColor = 2;
|
||||
archiveX = x;
|
||||
@@ -66,6 +68,17 @@ namespace CalamityMod.World
|
||||
foundValidPosition = true;
|
||||
}
|
||||
}
|
||||
|
||||
//in order to make sure the archive places at the very bottom of the dungeon:
|
||||
//loop upward a certain amount, and if it doesnt place reset everything and increase the check height before the loop ends
|
||||
//this way it will keep checking upward so it places nicely and doesnt destroy other parts of the dungeon (or at least not as much)
|
||||
if (x >= Main.maxTilesX - 5 && y <= heightLimit + 5 && !foundValidPosition)
|
||||
{
|
||||
x = 5;
|
||||
y = Main.maxTilesY - 5;
|
||||
|
||||
heightLimit = heightLimit - 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,662 @@
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Items.Potions;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Tiles;
|
||||
using CalamityMod.Tiles.Abyss;
|
||||
using CalamityMod.Tiles.Astral;
|
||||
using CalamityMod.Tiles.Crags;
|
||||
using CalamityMod.Tiles.FurnitureAncient;
|
||||
using CalamityMod.Tiles.Ores;
|
||||
using CalamityMod.Walls;
|
||||
using CalamityMod.DataStructures;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.IO;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Utilities;
|
||||
using Terraria.WorldBuilding;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent.Generation;
|
||||
|
||||
namespace CalamityMod.World
|
||||
{
|
||||
public class GiantHive
|
||||
{
|
||||
public static bool GrowLivingJungleTree(Point origin)
|
||||
{
|
||||
if (!WorldGen.drunkWorldGen || WorldGen.genRand.Next(50) > 0)
|
||||
{
|
||||
Dictionary<ushort, int> dictionary = new Dictionary<ushort, int>();
|
||||
WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(0, 59, 60, 147, 1).Output(dictionary));
|
||||
int num = dictionary[0] + dictionary[1];
|
||||
int num2 = dictionary[59] + dictionary[60];
|
||||
if (dictionary[147] > num2 || num > num2 || num2 < 50)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int treeHeight = (int)Main.worldSurface - (Main.maxTilesY / 10); //start here to not touch floating islands
|
||||
bool validheightFound = false;
|
||||
int attempts = 0;
|
||||
|
||||
while (!validheightFound && attempts++ < 100000)
|
||||
{
|
||||
|
||||
while (!WorldGen.SolidTile(origin.X, treeHeight))
|
||||
{
|
||||
treeHeight++;
|
||||
}
|
||||
|
||||
if (Main.tile[origin.X, treeHeight].HasTile || Main.tile[origin.X, treeHeight].WallType > 0)
|
||||
{
|
||||
validheightFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
int extraWidth = 0;
|
||||
|
||||
while (validheightFound)
|
||||
{
|
||||
//place the roots first so the bottom of the hole doesnt look strange
|
||||
for (int k = 0; k < 6; k++)
|
||||
{
|
||||
double angle = (double)k / 3.0 * 2.0 + 0.57075;
|
||||
WorldUtils.Gen(new Point(origin.X + 2, origin.Y - 30), new ShapeRoot((int)angle, WorldGen.genRand.Next(80, 120)),
|
||||
Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87),
|
||||
new Actions.SetTile(TileID.LivingMahogany, setSelfFrames: true)));
|
||||
}
|
||||
|
||||
for (int y = treeHeight - 50; y <= origin.Y - 30; y++)
|
||||
{
|
||||
if (y % 35 == 0)
|
||||
{
|
||||
extraWidth++;
|
||||
}
|
||||
|
||||
//place branches at the top of the tree
|
||||
if (y <= treeHeight - 45)
|
||||
{
|
||||
//create a list of points for the ends of each branch
|
||||
List<Point> list = new List<Point>();
|
||||
|
||||
WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-3, 3), y), new ShapeBranch(-0.6853981852531433,
|
||||
WorldGen.genRand.Next(5, 25)).OutputEndpoints(list), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237),
|
||||
new Modifiers.SkipWalls(87), new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames(frameNeighbors: true)));
|
||||
|
||||
WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-3, 3), y), new ShapeBranch(-2.45619455575943,
|
||||
WorldGen.genRand.Next(5, 25)).OutputEndpoints(list), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237),
|
||||
new Modifiers.SkipWalls(87), new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames(frameNeighbors: true)));
|
||||
|
||||
//place living mahogany leaves at the end of each branch
|
||||
foreach (Point item in list)
|
||||
{
|
||||
WorldUtils.Gen(item, new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches(WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)),
|
||||
new Modifiers.SkipTiles(383, 21, 467, 226, 237), new Modifiers.SkipWalls(78, 87), new Actions.SetTile(TileID.LivingMahoganyLeaves), new Actions.SetFrames(frameNeighbors: true)));
|
||||
}
|
||||
}
|
||||
|
||||
//place the tree itself
|
||||
WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-1 - extraWidth, 1), y), new Shapes.Rectangle(6 + extraWidth, 3 + extraWidth),
|
||||
Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), new Actions.RemoveWall(),
|
||||
new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames()));
|
||||
|
||||
WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-1, 1), y), new Shapes.Rectangle(6 + extraWidth, 3 + extraWidth),
|
||||
Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), new Actions.RemoveWall(),
|
||||
new Actions.SetTile(TileID.LivingMahogany), new Actions.SetFrames()));
|
||||
|
||||
//dig hole in tree
|
||||
ShapeData circle = new ShapeData();
|
||||
ShapeData biggerCircle = new ShapeData();
|
||||
GenAction blotchMod = new Modifiers.Blotches(2, 0.4);
|
||||
|
||||
int radius = extraWidth - 1;
|
||||
|
||||
WorldUtils.Gen(new Point(origin.X + 2, y), new Shapes.Circle(radius), Actions.Chain(new GenAction[]
|
||||
{
|
||||
blotchMod.Output(circle)
|
||||
}));
|
||||
WorldUtils.Gen(new Point(origin.X + 2, y), new Shapes.Circle(radius), Actions.Chain(new GenAction[]
|
||||
{
|
||||
blotchMod.Output(circle)
|
||||
}));
|
||||
WorldUtils.Gen(new Point(origin.X + 2, y), new Shapes.Circle(radius + 1), Actions.Chain(new GenAction[]
|
||||
{
|
||||
blotchMod.Output(biggerCircle)
|
||||
}));
|
||||
|
||||
//main circle of walls, also dig out hole in the tree
|
||||
WorldUtils.Gen(new Point(origin.X + 2, y), new ModShapes.All(circle), Actions.Chain(new GenAction[]
|
||||
{
|
||||
new Actions.ClearTile(),
|
||||
new Actions.PlaceWall(WallID.LivingWood)
|
||||
}));
|
||||
|
||||
//chance to place blocks inside the tree for randomness
|
||||
if (WorldGen.genRand.Next(20) == 0)
|
||||
{
|
||||
WorldUtils.Gen(new Point(origin.X + WorldGen.genRand.Next(-2, 2), y), new ModShapes.All(tinyCircle), Actions.Chain(new GenAction[]
|
||||
{
|
||||
new Actions.ClearTile(),
|
||||
new Actions.PlaceWall(WallID.LivingWood)
|
||||
}));
|
||||
}
|
||||
|
||||
//bigger circle so that walls can place behind blocks (basically makes it not look ugly in game)
|
||||
WorldUtils.Gen(new Point(origin.X + 2, y), new ModShapes.All(biggerCircle), Actions.Chain(new GenAction[]
|
||||
{
|
||||
new Actions.PlaceWall(WallID.LivingWood)
|
||||
}));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool CanPlaceGiantHive(Point origin, StructureMap structures)
|
||||
{
|
||||
if (!structures.CanPlace(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100)))
|
||||
return false;
|
||||
|
||||
if (TooCloseToImportantLocations(origin))
|
||||
return false;
|
||||
|
||||
Ref<int> ref1 = new Ref<int>(0);
|
||||
Ref<int> ref2 = new Ref<int>(0);
|
||||
Ref<int> ref3 = new Ref<int>(0);
|
||||
WorldUtils.Gen(origin, new Shapes.Circle(15), Actions.Chain(new Modifiers.IsSolid(), new Actions.Scanner(ref1), new Modifiers.OnlyTiles(TileID.JungleGrass, TileID.Mud), new Actions.Scanner(ref2), new Modifiers.OnlyTiles(TileID.JungleGrass), new Actions.Scanner(ref3)));
|
||||
if (ref2.Value / (float)ref1.Value < 0.75f || ref3.Value < 2)
|
||||
return false;
|
||||
|
||||
int num = 0;
|
||||
int[] array = new int[1000];
|
||||
int[] array2 = new int[1000];
|
||||
Vector2 larvaLocation = origin.ToVector2();
|
||||
int numHiveTunnels = WorldGen.genRand.Next(10, 13);
|
||||
|
||||
for (int i = 0; i < numHiveTunnels; i++)
|
||||
{
|
||||
Vector2 vector2 = larvaLocation;
|
||||
int num3 = WorldGen.genRand.Next(2, 5);
|
||||
for (int j = 0; j < num3; j++)
|
||||
vector2 = CreateHiveTunnel((int)larvaLocation.X, (int)larvaLocation.Y, WorldGen.genRand);
|
||||
|
||||
larvaLocation = vector2;
|
||||
array[num] = (int)larvaLocation.X;
|
||||
array2[num] = (int)larvaLocation.Y;
|
||||
num++;
|
||||
}
|
||||
|
||||
FrameOutAllHiveContents(origin, 50);
|
||||
|
||||
GrowLivingJungleTree(new Point(origin.X, origin.Y));
|
||||
|
||||
for (int k = 0; k < num; k++)
|
||||
{
|
||||
int num4 = array[k];
|
||||
int y = array2[k];
|
||||
int num5 = 1;
|
||||
if (WorldGen.genRand.NextBool())
|
||||
num5 = -1;
|
||||
|
||||
bool flag = false;
|
||||
while (WorldGen.InWorld(num4, y, 10) && BadSpotForHoneyFall(num4, y))
|
||||
{
|
||||
num4 += num5;
|
||||
if (Math.Abs(num4 - array[k]) > 50)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
num4 += num5;
|
||||
if (!SpotActuallyNotInHive(num4, y))
|
||||
{
|
||||
CreateBlockedHoneyCube(num4, y);
|
||||
CreateDentForHoneyFall(num4, y, num5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CreateStandForLarva(larvaLocation);
|
||||
|
||||
// Generate a second larva stand
|
||||
Vector2 secondLarvaLocation = default;
|
||||
int maxAttempts = 1000;
|
||||
for (int l = 0; l < maxAttempts; l++)
|
||||
{
|
||||
Vector2 vector3 = larvaLocation;
|
||||
vector3.X += WorldGen.genRand.Next(-50, 51);
|
||||
vector3.Y += WorldGen.genRand.Next(-50, 51);
|
||||
if (WorldGen.InWorld((int)vector3.X, (int)vector3.Y) && Vector2.Distance(larvaLocation, vector3) > 10f && !Main.tile[(int)vector3.X, (int)vector3.Y].HasTile && Main.tile[(int)vector3.X, (int)vector3.Y].WallType == WallID.HiveUnsafe)
|
||||
{
|
||||
secondLarvaLocation = vector3;
|
||||
CreateStandForLarva(vector3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Honey chests
|
||||
Vector2 honeyChestLocation = default;
|
||||
for (int l = 0; l < maxAttempts; l++)
|
||||
{
|
||||
Vector2 vector3 = larvaLocation;
|
||||
vector3.X += WorldGen.genRand.Next(-100, 101);
|
||||
vector3.Y += WorldGen.genRand.Next(-100, 101);
|
||||
if (WorldGen.InWorld((int)vector3.X, (int)vector3.Y) && Vector2.Distance(larvaLocation, vector3) > 10f && Vector2.Distance(secondLarvaLocation, vector3) > 10f && !Main.tile[(int)vector3.X, (int)vector3.Y].HasTile && Main.tile[(int)vector3.X, (int)vector3.Y].WallType == WallID.HiveUnsafe)
|
||||
{
|
||||
honeyChestLocation = vector3;
|
||||
CreateStandAndPlaceHoneyChest(vector3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int l = 0; l < maxAttempts; l++)
|
||||
{
|
||||
Vector2 vector3 = larvaLocation;
|
||||
vector3.X += WorldGen.genRand.Next(-100, 101);
|
||||
vector3.Y += WorldGen.genRand.Next(-100, 101);
|
||||
if (WorldGen.InWorld((int)vector3.X, (int)vector3.Y) && Vector2.Distance(larvaLocation, vector3) > 10f && Vector2.Distance(secondLarvaLocation, vector3) > 10f && Vector2.Distance(honeyChestLocation, vector3) > 10f && !Main.tile[(int)vector3.X, (int)vector3.Y].HasTile && Main.tile[(int)vector3.X, (int)vector3.Y].WallType == WallID.HiveUnsafe)
|
||||
{
|
||||
CreateStandAndPlaceHoneyChest(vector3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
structures.AddProtectedStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void FrameOutAllHiveContents(Point origin, int squareHalfWidth)
|
||||
{
|
||||
int num = Math.Max(10, origin.X - squareHalfWidth);
|
||||
int num2 = Math.Min(Main.maxTilesX - 10, origin.X + squareHalfWidth);
|
||||
int num3 = Math.Max(10, origin.Y - squareHalfWidth);
|
||||
int num4 = Math.Min(Main.maxTilesY - 10, origin.Y + squareHalfWidth);
|
||||
for (int i = num; i < num2; i++)
|
||||
{
|
||||
for (int j = num3; j < num4; j++)
|
||||
{
|
||||
Tile tile = Main.tile[i, j];
|
||||
if (tile.HasTile && tile.TileType == TileID.Hive)
|
||||
WorldGen.SquareTileFrame(i, j);
|
||||
|
||||
if (tile.WallType == WallID.HiveUnsafe)
|
||||
WorldGen.SquareWallFrame(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Vector2 CreateHiveTunnel(int i, int j, UnifiedRandom random)
|
||||
{
|
||||
double num = random.Next(20, 26);
|
||||
float num2 = random.Next(30, 41);
|
||||
float num3 = Main.maxTilesX / 4200;
|
||||
num3 = (num3 + 1f) / 2f;
|
||||
num *= (double)num3;
|
||||
num2 *= num3;
|
||||
|
||||
double num4 = num;
|
||||
Vector2 result = default;
|
||||
result.X = i;
|
||||
result.Y = j;
|
||||
Vector2 vector = default;
|
||||
vector.X = random.Next(-10, 11) * 0.2f;
|
||||
vector.Y = random.Next(-10, 11) * 0.2f;
|
||||
while (num > 0.0 && num2 > 0f)
|
||||
{
|
||||
if (result.Y > (Main.maxTilesY - 250))
|
||||
num2 = 0f;
|
||||
|
||||
num = num4 * (double)(1f + random.Next(-20, 20) * 0.01f);
|
||||
num2 -= 1f;
|
||||
int num5 = (int)(result.X - num);
|
||||
int num6 = (int)(result.X + num);
|
||||
int num7 = (int)(result.Y - num);
|
||||
int num8 = (int)(result.Y + num);
|
||||
if (num5 < 1)
|
||||
num5 = 1;
|
||||
|
||||
if (num6 > Main.maxTilesX - 1)
|
||||
num6 = Main.maxTilesX - 1;
|
||||
|
||||
if (num7 < 1)
|
||||
num7 = 1;
|
||||
|
||||
if (num8 > Main.maxTilesY - 1)
|
||||
num8 = Main.maxTilesY - 1;
|
||||
|
||||
for (int k = num5; k < num6; k++)
|
||||
{
|
||||
for (int l = num7; l < num8; l++)
|
||||
{
|
||||
if (!WorldGen.InWorld(k, l, 50))
|
||||
{
|
||||
num2 = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Main.tile[k - 10, l].WallType == WallID.LihzahrdBrickUnsafe)
|
||||
num2 = 0f;
|
||||
|
||||
if (Main.tile[k + 10, l].WallType == WallID.LihzahrdBrickUnsafe)
|
||||
num2 = 0f;
|
||||
|
||||
if (Main.tile[k, l - 10].WallType == WallID.LihzahrdBrickUnsafe)
|
||||
num2 = 0f;
|
||||
|
||||
if (Main.tile[k, l + 10].WallType == WallID.LihzahrdBrickUnsafe)
|
||||
num2 = 0f;
|
||||
}
|
||||
|
||||
if (l < Main.worldSurface && Main.tile[k, l - 5].WallType == WallID.None)
|
||||
num2 = 0f;
|
||||
|
||||
float num9 = Math.Abs(k - result.X);
|
||||
float num10 = Math.Abs(l - result.Y);
|
||||
double num11 = Math.Sqrt(num9 * num9 + num10 * num10);
|
||||
if (num11 < num4 * 0.4 * (1.0 + random.Next(-10, 11) * 0.005))
|
||||
{
|
||||
Main.tile[k, l].LiquidAmount = byte.MaxValue;
|
||||
Main.tile[k, l].Get<LiquidData>().LiquidType = LiquidID.Honey;
|
||||
Main.tile[k, l].WallType = WallID.HiveUnsafe;
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().HasTile = false;
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().IsHalfBlock = false;
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().Slope = SlopeType.Solid;
|
||||
}
|
||||
else if (num11 < num4 * 0.75 * (1.0 + random.Next(-10, 11) * 0.005))
|
||||
{
|
||||
Main.tile[k, l].LiquidAmount = 0;
|
||||
if (Main.tile[k, l].WallType != WallID.HiveUnsafe)
|
||||
{
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().IsHalfBlock = false;
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().Slope = SlopeType.Solid;
|
||||
Main.tile[k, l].TileType = TileID.Hive;
|
||||
}
|
||||
}
|
||||
|
||||
if (num11 < num4 * 0.6 * (1.0 + random.Next(-10, 11) * 0.005))
|
||||
{
|
||||
Main.tile[k, l].WallType = WallID.HiveUnsafe;
|
||||
if (random.NextBool())
|
||||
{
|
||||
Main.tile[k, l].LiquidAmount = byte.MaxValue;
|
||||
Main.tile[k, l].Get<LiquidData>().LiquidType = LiquidID.Honey;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result += vector;
|
||||
num2 -= 1f;
|
||||
vector.Y += random.Next(-10, 11) * 0.05f;
|
||||
vector.X += random.Next(-10, 11) * 0.05f;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static bool TooCloseToImportantLocations(Point origin)
|
||||
{
|
||||
int x = origin.X;
|
||||
int y = origin.Y;
|
||||
int num = 150;
|
||||
for (int i = x - num; i < x + num; i += 10)
|
||||
{
|
||||
if (i <= 0 || i > Main.maxTilesX - 1)
|
||||
continue;
|
||||
|
||||
for (int j = y - num; j < y + num; j += 10)
|
||||
{
|
||||
if (j > 0 && j <= Main.maxTilesY - 1)
|
||||
{
|
||||
if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == TileID.LihzahrdBrick)
|
||||
return true;
|
||||
|
||||
if (Main.tile[i, j].WallType == WallID.CrimstoneUnsafe || Main.tile[i, j].WallType == WallID.EbonstoneUnsafe || Main.tile[i, j].WallType == WallID.LihzahrdBrickUnsafe)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void CreateDentForHoneyFall(int x, int y, int dir)
|
||||
{
|
||||
dir *= -1;
|
||||
y++;
|
||||
int num = 0;
|
||||
while ((num < 4 || WorldGen.SolidTile(x, y)) && x > 10 && x < Main.maxTilesX - 10)
|
||||
{
|
||||
num++;
|
||||
x += dir;
|
||||
if (WorldGen.SolidTile(x, y))
|
||||
{
|
||||
WorldGen.PoundTile(x, y);
|
||||
if (!Main.tile[x, y + 1].HasTile)
|
||||
{
|
||||
Main.tile[x, y + 1].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[x, y + 1].TileType = TileID.Hive;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateBlockedHoneyCube(int x, int y)
|
||||
{
|
||||
for (int i = x - 1; i <= x + 2; i++)
|
||||
{
|
||||
for (int j = y - 1; j <= y + 2; j++)
|
||||
{
|
||||
if (i >= x && i <= x + 1 && j >= y && j <= y + 1)
|
||||
{
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = false;
|
||||
Main.tile[i, j].LiquidAmount = byte.MaxValue;
|
||||
Main.tile[i, j].Get<LiquidData>().LiquidType = LiquidID.Honey;
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[i, j].TileType = TileID.Hive;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool SpotActuallyNotInHive(int x, int y)
|
||||
{
|
||||
for (int i = x - 1; i <= x + 2; i++)
|
||||
{
|
||||
for (int j = y - 1; j <= y + 2; j++)
|
||||
{
|
||||
if (i < 10 || i > Main.maxTilesX - 10)
|
||||
return true;
|
||||
|
||||
if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType != TileID.Hive)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool BadSpotForHoneyFall(int x, int y)
|
||||
{
|
||||
if (Main.tile[x, y].HasTile && Main.tile[x, y + 1].HasTile && Main.tile[x + 1, y].HasTile)
|
||||
return !Main.tile[x + 1, y + 1].HasTile;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void CreateStandForLarva(Vector2 position)
|
||||
{
|
||||
WorldGen.larvaX[WorldGen.numLarva] = Utils.Clamp((int)position.X, 5, Main.maxTilesX - 5);
|
||||
WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp((int)position.Y, 5, Main.maxTilesY - 5);
|
||||
WorldGen.numLarva++;
|
||||
if (WorldGen.numLarva >= WorldGen.larvaX.Length)
|
||||
WorldGen.numLarva = WorldGen.larvaX.Length - 1;
|
||||
|
||||
int num = (int)position.X;
|
||||
int num2 = (int)position.Y;
|
||||
for (int i = num - 1; i <= num + 1 && i > 0 && i < Main.maxTilesX; i++)
|
||||
{
|
||||
for (int j = num2 - 2; j <= num2 + 1 && j > 0 && j < Main.maxTilesY; j++)
|
||||
{
|
||||
if (j != num2 + 1)
|
||||
{
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[i, j].TileType = TileID.Hive;
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().Slope = SlopeType.Solid;
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().IsHalfBlock = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateStandAndPlaceHoneyChest(Vector2 position)
|
||||
{
|
||||
int chestPlacementX = Utils.Clamp((int)position.X, 5, Main.maxTilesX - 5);
|
||||
int chestPlacementY = Utils.Clamp((int)position.Y, 5, Main.maxTilesY - 5);
|
||||
|
||||
int num = (int)position.X;
|
||||
int num2 = (int)position.Y;
|
||||
for (int i = num; i <= num + 1 && i > 0 && i < Main.maxTilesX; i++)
|
||||
{
|
||||
for (int j = num2 - 1; j <= num2 + 1 && j > 0 && j < Main.maxTilesY; j++)
|
||||
{
|
||||
if (j != num2 + 1)
|
||||
{
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[i, j].TileType = TileID.Hive;
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().Slope = SlopeType.Solid;
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().IsHalfBlock = false;
|
||||
}
|
||||
}
|
||||
|
||||
int num144 = chestPlacementX;
|
||||
int num145 = chestPlacementY;
|
||||
for (int num146 = num144; num146 <= num144 + 1; num146++)
|
||||
{
|
||||
for (int num147 = num145 - 1; num147 <= num145 + 1; num147++)
|
||||
{
|
||||
if (num147 != num145 + 1)
|
||||
{
|
||||
Main.tile[num146, num147].Get<TileWallWireStateData>().HasTile = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.tile[num146, num147].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[num146, num147].TileType = TileID.Hive;
|
||||
Main.tile[num146, num147].Get<TileWallWireStateData>().Slope = SlopeType.Solid;
|
||||
Main.tile[num146, num147].Get<TileWallWireStateData>().IsHalfBlock = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int chestID = WorldGen.PlaceChest(num144, num145, 21, false, 29);
|
||||
FillHoneyChest(chestID, WorldGen.genRand);
|
||||
}
|
||||
|
||||
// Honey chest stuff, this is also used by the Hive Planetoid
|
||||
private static int[] FocusLootHoney = new int[]
|
||||
{
|
||||
ItemID.NaturesGift,
|
||||
ItemID.Bezoar,
|
||||
ItemID.FlowerBoots,
|
||||
ItemID.BeeMinecart
|
||||
};
|
||||
|
||||
private static int[] PotionLootHoney = new int[]
|
||||
{
|
||||
ItemID.LifeforcePotion,
|
||||
ItemID.RegenerationPotion,
|
||||
ItemID.ManaRegenerationPotion,
|
||||
ItemID.HeartreachPotion,
|
||||
ModContent.ItemType<PhotosynthesisPotion>()
|
||||
};
|
||||
|
||||
private static int[] BarLootHoney = new int[]
|
||||
{
|
||||
WorldGen.silverBar == TileID.Silver ? ItemID.SilverBar : ItemID.TungstenBar,
|
||||
WorldGen.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar
|
||||
};
|
||||
|
||||
public static void FillHoneyChest(int id, UnifiedRandom random)
|
||||
{
|
||||
if (id < 0)
|
||||
return;
|
||||
|
||||
Chest chest = Main.chest[id];
|
||||
if (chest == null)
|
||||
return;
|
||||
|
||||
int index = 0;
|
||||
|
||||
chest.item[index++].SetDefaults(random.Next(FocusLootHoney));
|
||||
|
||||
if (random.Next(3) <= 1)
|
||||
{
|
||||
chest.item[index].SetDefaults(random.Next(BarLootHoney));
|
||||
chest.item[index].SetDefaults(random.Next(7, 15));
|
||||
}
|
||||
else
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.GoldCoin);
|
||||
chest.item[index++].stack = random.Next(3, 5);
|
||||
}
|
||||
|
||||
if (random.NextBool())
|
||||
{
|
||||
chest.item[index].SetDefaults(random.Next(PotionLootHoney));
|
||||
chest.item[index++].stack = random.Next(1, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.BottledHoney);
|
||||
chest.item[index++].stack = random.Next(3, 7);
|
||||
}
|
||||
|
||||
if (random.NextBool())
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.Stinger);
|
||||
chest.item[index++].stack = random.Next(4, 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.JungleSpores);
|
||||
chest.item[index++].stack = random.Next(3, 5);
|
||||
}
|
||||
|
||||
if (random.NextBool())
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.RecallPotion);
|
||||
chest.item[index++].stack = random.Next(1, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.JungleTorch);
|
||||
chest.item[index++].stack = random.Next(18, 36);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,14 @@ using CalamityMod.Walls;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.IO;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Utilities;
|
||||
using Terraria.WorldBuilding;
|
||||
using Terraria.GameContent.Generation;
|
||||
|
||||
namespace CalamityMod.World
|
||||
{
|
||||
@@ -177,547 +179,6 @@ namespace CalamityMod.World
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Giant Hive
|
||||
/*public static void GrowLivingMahoganyTree(Point origin)
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
public static bool CanPlaceGiantHive(Point origin, StructureMap structures)
|
||||
{
|
||||
if (!structures.CanPlace(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100)))
|
||||
return false;
|
||||
|
||||
if (TooCloseToImportantLocations(origin))
|
||||
return false;
|
||||
|
||||
Ref<int> ref1 = new Ref<int>(0);
|
||||
Ref<int> ref2 = new Ref<int>(0);
|
||||
Ref<int> ref3 = new Ref<int>(0);
|
||||
WorldUtils.Gen(origin, new Shapes.Circle(15), Actions.Chain(new Modifiers.IsSolid(), new Actions.Scanner(ref1), new Modifiers.OnlyTiles(TileID.JungleGrass, TileID.Mud), new Actions.Scanner(ref2), new Modifiers.OnlyTiles(TileID.JungleGrass), new Actions.Scanner(ref3)));
|
||||
if (ref2.Value / (float)ref1.Value < 0.75f || ref3.Value < 2)
|
||||
return false;
|
||||
|
||||
// Detects where to play the living mahogany tree
|
||||
/*int treeGenMaxAttempts = 100;
|
||||
int treeGenAttempts = 0;
|
||||
Point result;
|
||||
do
|
||||
{
|
||||
bool canGenerateLivingTree = WorldUtils.Find(origin, Searches.Chain(new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result);
|
||||
if (!canGenerateLivingTree)
|
||||
{
|
||||
treeGenAttempts++;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Y += origin.Y - (int)WorldGen.worldSurface;
|
||||
|
||||
bool[] tileArray = new bool[TileID.Sets.GeneralPlacementTiles.Length];
|
||||
for (int i = 0; i < tileArray.Length; i++)
|
||||
tileArray[i] = TileID.Sets.GeneralPlacementTiles[i];
|
||||
|
||||
tileArray[TileID.Containers] = false;
|
||||
tileArray[TileID.Containers2] = false;
|
||||
|
||||
if (!structures.CanPlace(new Rectangle(origin.X - 8, result.Y + 10, 16, origin.Y - result.Y - 9), tileArray, 2))
|
||||
{
|
||||
treeGenAttempts++;
|
||||
}
|
||||
else
|
||||
{
|
||||
GrowLivingMahoganyTree(new Point(origin.X, origin.Y - result.Y - 9));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (treeGenAttempts == treeGenMaxAttempts)
|
||||
return false;
|
||||
}
|
||||
while (treeGenAttempts < treeGenMaxAttempts);*/
|
||||
|
||||
int num = 0;
|
||||
int[] array = new int[1000];
|
||||
int[] array2 = new int[1000];
|
||||
Vector2 larvaLocation = origin.ToVector2();
|
||||
int numHiveTunnels = WorldGen.genRand.Next(10, 13);
|
||||
|
||||
for (int i = 0; i < numHiveTunnels; i++)
|
||||
{
|
||||
Vector2 vector2 = larvaLocation;
|
||||
int num3 = WorldGen.genRand.Next(2, 5);
|
||||
for (int j = 0; j < num3; j++)
|
||||
vector2 = CreateHiveTunnel((int)larvaLocation.X, (int)larvaLocation.Y, WorldGen.genRand);
|
||||
|
||||
larvaLocation = vector2;
|
||||
array[num] = (int)larvaLocation.X;
|
||||
array2[num] = (int)larvaLocation.Y;
|
||||
num++;
|
||||
}
|
||||
|
||||
FrameOutAllHiveContents(origin, 50);
|
||||
|
||||
for (int k = 0; k < num; k++)
|
||||
{
|
||||
int num4 = array[k];
|
||||
int y = array2[k];
|
||||
int num5 = 1;
|
||||
if (WorldGen.genRand.NextBool())
|
||||
num5 = -1;
|
||||
|
||||
bool flag = false;
|
||||
while (WorldGen.InWorld(num4, y, 10) && BadSpotForHoneyFall(num4, y))
|
||||
{
|
||||
num4 += num5;
|
||||
if (Math.Abs(num4 - array[k]) > 50)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
num4 += num5;
|
||||
if (!SpotActuallyNotInHive(num4, y))
|
||||
{
|
||||
CreateBlockedHoneyCube(num4, y);
|
||||
CreateDentForHoneyFall(num4, y, num5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CreateStandForLarva(larvaLocation);
|
||||
|
||||
// Generate a second larva stand
|
||||
Vector2 secondLarvaLocation = default;
|
||||
int maxAttempts = 1000;
|
||||
for (int l = 0; l < maxAttempts; l++)
|
||||
{
|
||||
Vector2 vector3 = larvaLocation;
|
||||
vector3.X += WorldGen.genRand.Next(-50, 51);
|
||||
vector3.Y += WorldGen.genRand.Next(-50, 51);
|
||||
if (WorldGen.InWorld((int)vector3.X, (int)vector3.Y) && Vector2.Distance(larvaLocation, vector3) > 10f && !Main.tile[(int)vector3.X, (int)vector3.Y].HasTile && Main.tile[(int)vector3.X, (int)vector3.Y].WallType == WallID.HiveUnsafe)
|
||||
{
|
||||
secondLarvaLocation = vector3;
|
||||
CreateStandForLarva(vector3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Honey chests
|
||||
Vector2 honeyChestLocation = default;
|
||||
for (int l = 0; l < maxAttempts; l++)
|
||||
{
|
||||
Vector2 vector3 = larvaLocation;
|
||||
vector3.X += WorldGen.genRand.Next(-100, 101);
|
||||
vector3.Y += WorldGen.genRand.Next(-100, 101);
|
||||
if (WorldGen.InWorld((int)vector3.X, (int)vector3.Y) && Vector2.Distance(larvaLocation, vector3) > 10f && Vector2.Distance(secondLarvaLocation, vector3) > 10f && !Main.tile[(int)vector3.X, (int)vector3.Y].HasTile && Main.tile[(int)vector3.X, (int)vector3.Y].WallType == WallID.HiveUnsafe)
|
||||
{
|
||||
honeyChestLocation = vector3;
|
||||
CreateStandAndPlaceHoneyChest(vector3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int l = 0; l < maxAttempts; l++)
|
||||
{
|
||||
Vector2 vector3 = larvaLocation;
|
||||
vector3.X += WorldGen.genRand.Next(-100, 101);
|
||||
vector3.Y += WorldGen.genRand.Next(-100, 101);
|
||||
if (WorldGen.InWorld((int)vector3.X, (int)vector3.Y) && Vector2.Distance(larvaLocation, vector3) > 10f && Vector2.Distance(secondLarvaLocation, vector3) > 10f && Vector2.Distance(honeyChestLocation, vector3) > 10f && !Main.tile[(int)vector3.X, (int)vector3.Y].HasTile && Main.tile[(int)vector3.X, (int)vector3.Y].WallType == WallID.HiveUnsafe)
|
||||
{
|
||||
CreateStandAndPlaceHoneyChest(vector3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
structures.AddProtectedStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void FrameOutAllHiveContents(Point origin, int squareHalfWidth)
|
||||
{
|
||||
int num = Math.Max(10, origin.X - squareHalfWidth);
|
||||
int num2 = Math.Min(Main.maxTilesX - 10, origin.X + squareHalfWidth);
|
||||
int num3 = Math.Max(10, origin.Y - squareHalfWidth);
|
||||
int num4 = Math.Min(Main.maxTilesY - 10, origin.Y + squareHalfWidth);
|
||||
for (int i = num; i < num2; i++)
|
||||
{
|
||||
for (int j = num3; j < num4; j++)
|
||||
{
|
||||
Tile tile = Main.tile[i, j];
|
||||
if (tile.HasTile && tile.TileType == TileID.Hive)
|
||||
WorldGen.SquareTileFrame(i, j);
|
||||
|
||||
if (tile.WallType == WallID.HiveUnsafe)
|
||||
WorldGen.SquareWallFrame(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Vector2 CreateHiveTunnel(int i, int j, UnifiedRandom random)
|
||||
{
|
||||
double num = random.Next(20, 26);
|
||||
float num2 = random.Next(30, 41);
|
||||
float num3 = Main.maxTilesX / 4200;
|
||||
num3 = (num3 + 1f) / 2f;
|
||||
num *= (double)num3;
|
||||
num2 *= num3;
|
||||
|
||||
double num4 = num;
|
||||
Vector2 result = default;
|
||||
result.X = i;
|
||||
result.Y = j;
|
||||
Vector2 vector = default;
|
||||
vector.X = random.Next(-10, 11) * 0.2f;
|
||||
vector.Y = random.Next(-10, 11) * 0.2f;
|
||||
while (num > 0.0 && num2 > 0f)
|
||||
{
|
||||
if (result.Y > (Main.maxTilesY - 250))
|
||||
num2 = 0f;
|
||||
|
||||
num = num4 * (double)(1f + random.Next(-20, 20) * 0.01f);
|
||||
num2 -= 1f;
|
||||
int num5 = (int)(result.X - num);
|
||||
int num6 = (int)(result.X + num);
|
||||
int num7 = (int)(result.Y - num);
|
||||
int num8 = (int)(result.Y + num);
|
||||
if (num5 < 1)
|
||||
num5 = 1;
|
||||
|
||||
if (num6 > Main.maxTilesX - 1)
|
||||
num6 = Main.maxTilesX - 1;
|
||||
|
||||
if (num7 < 1)
|
||||
num7 = 1;
|
||||
|
||||
if (num8 > Main.maxTilesY - 1)
|
||||
num8 = Main.maxTilesY - 1;
|
||||
|
||||
for (int k = num5; k < num6; k++)
|
||||
{
|
||||
for (int l = num7; l < num8; l++)
|
||||
{
|
||||
if (!WorldGen.InWorld(k, l, 50))
|
||||
{
|
||||
num2 = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Main.tile[k - 10, l].WallType == WallID.LihzahrdBrickUnsafe)
|
||||
num2 = 0f;
|
||||
|
||||
if (Main.tile[k + 10, l].WallType == WallID.LihzahrdBrickUnsafe)
|
||||
num2 = 0f;
|
||||
|
||||
if (Main.tile[k, l - 10].WallType == WallID.LihzahrdBrickUnsafe)
|
||||
num2 = 0f;
|
||||
|
||||
if (Main.tile[k, l + 10].WallType == WallID.LihzahrdBrickUnsafe)
|
||||
num2 = 0f;
|
||||
}
|
||||
|
||||
if (l < Main.worldSurface && Main.tile[k, l - 5].WallType == WallID.None)
|
||||
num2 = 0f;
|
||||
|
||||
float num9 = Math.Abs(k - result.X);
|
||||
float num10 = Math.Abs(l - result.Y);
|
||||
double num11 = Math.Sqrt(num9 * num9 + num10 * num10);
|
||||
if (num11 < num4 * 0.4 * (1.0 + random.Next(-10, 11) * 0.005))
|
||||
{
|
||||
Main.tile[k, l].LiquidAmount = byte.MaxValue;
|
||||
Main.tile[k, l].Get<LiquidData>().LiquidType = LiquidID.Honey;
|
||||
Main.tile[k, l].WallType = WallID.HiveUnsafe;
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().HasTile = false;
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().IsHalfBlock = false;
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().Slope = SlopeType.Solid;
|
||||
}
|
||||
else if (num11 < num4 * 0.75 * (1.0 + random.Next(-10, 11) * 0.005))
|
||||
{
|
||||
Main.tile[k, l].LiquidAmount = 0;
|
||||
if (Main.tile[k, l].WallType != WallID.HiveUnsafe)
|
||||
{
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().IsHalfBlock = false;
|
||||
Main.tile[k, l].Get<TileWallWireStateData>().Slope = SlopeType.Solid;
|
||||
Main.tile[k, l].TileType = TileID.Hive;
|
||||
}
|
||||
}
|
||||
|
||||
if (num11 < num4 * 0.6 * (1.0 + random.Next(-10, 11) * 0.005))
|
||||
{
|
||||
Main.tile[k, l].WallType = WallID.HiveUnsafe;
|
||||
if (random.NextBool())
|
||||
{
|
||||
Main.tile[k, l].LiquidAmount = byte.MaxValue;
|
||||
Main.tile[k, l].Get<LiquidData>().LiquidType = LiquidID.Honey;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result += vector;
|
||||
num2 -= 1f;
|
||||
vector.Y += random.Next(-10, 11) * 0.05f;
|
||||
vector.X += random.Next(-10, 11) * 0.05f;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static bool TooCloseToImportantLocations(Point origin)
|
||||
{
|
||||
int x = origin.X;
|
||||
int y = origin.Y;
|
||||
int num = 150;
|
||||
for (int i = x - num; i < x + num; i += 10)
|
||||
{
|
||||
if (i <= 0 || i > Main.maxTilesX - 1)
|
||||
continue;
|
||||
|
||||
for (int j = y - num; j < y + num; j += 10)
|
||||
{
|
||||
if (j > 0 && j <= Main.maxTilesY - 1)
|
||||
{
|
||||
if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == TileID.LihzahrdBrick)
|
||||
return true;
|
||||
|
||||
if (Main.tile[i, j].WallType == WallID.CrimstoneUnsafe || Main.tile[i, j].WallType == WallID.EbonstoneUnsafe || Main.tile[i, j].WallType == WallID.LihzahrdBrickUnsafe)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void CreateDentForHoneyFall(int x, int y, int dir)
|
||||
{
|
||||
dir *= -1;
|
||||
y++;
|
||||
int num = 0;
|
||||
while ((num < 4 || WorldGen.SolidTile(x, y)) && x > 10 && x < Main.maxTilesX - 10)
|
||||
{
|
||||
num++;
|
||||
x += dir;
|
||||
if (WorldGen.SolidTile(x, y))
|
||||
{
|
||||
WorldGen.PoundTile(x, y);
|
||||
if (!Main.tile[x, y + 1].HasTile)
|
||||
{
|
||||
Main.tile[x, y + 1].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[x, y + 1].TileType = TileID.Hive;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateBlockedHoneyCube(int x, int y)
|
||||
{
|
||||
for (int i = x - 1; i <= x + 2; i++)
|
||||
{
|
||||
for (int j = y - 1; j <= y + 2; j++)
|
||||
{
|
||||
if (i >= x && i <= x + 1 && j >= y && j <= y + 1)
|
||||
{
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = false;
|
||||
Main.tile[i, j].LiquidAmount = byte.MaxValue;
|
||||
Main.tile[i, j].Get<LiquidData>().LiquidType = LiquidID.Honey;
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[i, j].TileType = TileID.Hive;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool SpotActuallyNotInHive(int x, int y)
|
||||
{
|
||||
for (int i = x - 1; i <= x + 2; i++)
|
||||
{
|
||||
for (int j = y - 1; j <= y + 2; j++)
|
||||
{
|
||||
if (i < 10 || i > Main.maxTilesX - 10)
|
||||
return true;
|
||||
|
||||
if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType != TileID.Hive)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool BadSpotForHoneyFall(int x, int y)
|
||||
{
|
||||
if (Main.tile[x, y].HasTile && Main.tile[x, y + 1].HasTile && Main.tile[x + 1, y].HasTile)
|
||||
return !Main.tile[x + 1, y + 1].HasTile;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void CreateStandForLarva(Vector2 position)
|
||||
{
|
||||
WorldGen.larvaX[WorldGen.numLarva] = Utils.Clamp((int)position.X, 5, Main.maxTilesX - 5);
|
||||
WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp((int)position.Y, 5, Main.maxTilesY - 5);
|
||||
WorldGen.numLarva++;
|
||||
if (WorldGen.numLarva >= WorldGen.larvaX.Length)
|
||||
WorldGen.numLarva = WorldGen.larvaX.Length - 1;
|
||||
|
||||
int num = (int)position.X;
|
||||
int num2 = (int)position.Y;
|
||||
for (int i = num - 1; i <= num + 1 && i > 0 && i < Main.maxTilesX; i++)
|
||||
{
|
||||
for (int j = num2 - 2; j <= num2 + 1 && j > 0 && j < Main.maxTilesY; j++)
|
||||
{
|
||||
if (j != num2 + 1)
|
||||
{
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[i, j].TileType = TileID.Hive;
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().Slope = SlopeType.Solid;
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().IsHalfBlock = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateStandAndPlaceHoneyChest(Vector2 position)
|
||||
{
|
||||
int chestPlacementX = Utils.Clamp((int)position.X, 5, Main.maxTilesX - 5);
|
||||
int chestPlacementY = Utils.Clamp((int)position.Y, 5, Main.maxTilesY - 5);
|
||||
|
||||
int num = (int)position.X;
|
||||
int num2 = (int)position.Y;
|
||||
for (int i = num; i <= num + 1 && i > 0 && i < Main.maxTilesX; i++)
|
||||
{
|
||||
for (int j = num2 - 1; j <= num2 + 1 && j > 0 && j < Main.maxTilesY; j++)
|
||||
{
|
||||
if (j != num2 + 1)
|
||||
{
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[i, j].TileType = TileID.Hive;
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().Slope = SlopeType.Solid;
|
||||
Main.tile[i, j].Get<TileWallWireStateData>().IsHalfBlock = false;
|
||||
}
|
||||
}
|
||||
|
||||
int num144 = chestPlacementX;
|
||||
int num145 = chestPlacementY;
|
||||
for (int num146 = num144; num146 <= num144 + 1; num146++)
|
||||
{
|
||||
for (int num147 = num145 - 1; num147 <= num145 + 1; num147++)
|
||||
{
|
||||
if (num147 != num145 + 1)
|
||||
{
|
||||
Main.tile[num146, num147].Get<TileWallWireStateData>().HasTile = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Main.tile[num146, num147].Get<TileWallWireStateData>().HasTile = true;
|
||||
Main.tile[num146, num147].TileType = TileID.Hive;
|
||||
Main.tile[num146, num147].Get<TileWallWireStateData>().Slope = SlopeType.Solid;
|
||||
Main.tile[num146, num147].Get<TileWallWireStateData>().IsHalfBlock = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int chestID = WorldGen.PlaceChest(num144, num145, 21, false, 29);
|
||||
FillHoneyChest(chestID, WorldGen.genRand);
|
||||
}
|
||||
|
||||
// Honey chest stuff, this is also used by the Hive Planetoid
|
||||
private static int[] FocusLootHoney = new int[]
|
||||
{
|
||||
ItemID.NaturesGift,
|
||||
ItemID.Bezoar,
|
||||
ItemID.FlowerBoots,
|
||||
ItemID.BeeMinecart
|
||||
};
|
||||
|
||||
private static int[] PotionLootHoney = new int[]
|
||||
{
|
||||
ItemID.LifeforcePotion,
|
||||
ItemID.RegenerationPotion,
|
||||
ItemID.ManaRegenerationPotion,
|
||||
ItemID.HeartreachPotion,
|
||||
ModContent.ItemType<PhotosynthesisPotion>()
|
||||
};
|
||||
|
||||
private static int[] BarLootHoney = new int[]
|
||||
{
|
||||
WorldGen.silverBar == TileID.Silver ? ItemID.SilverBar : ItemID.TungstenBar,
|
||||
WorldGen.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar
|
||||
};
|
||||
|
||||
public static void FillHoneyChest(int id, UnifiedRandom random)
|
||||
{
|
||||
if (id < 0)
|
||||
return;
|
||||
|
||||
Chest chest = Main.chest[id];
|
||||
if (chest == null)
|
||||
return;
|
||||
|
||||
int index = 0;
|
||||
|
||||
chest.item[index++].SetDefaults(random.Next(FocusLootHoney));
|
||||
|
||||
if (random.Next(3) <= 1)
|
||||
{
|
||||
chest.item[index].SetDefaults(random.Next(BarLootHoney));
|
||||
chest.item[index].SetDefaults(random.Next(7, 15));
|
||||
}
|
||||
else
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.GoldCoin);
|
||||
chest.item[index++].stack = random.Next(3, 5);
|
||||
}
|
||||
|
||||
if (random.NextBool())
|
||||
{
|
||||
chest.item[index].SetDefaults(random.Next(PotionLootHoney));
|
||||
chest.item[index++].stack = random.Next(1, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.BottledHoney);
|
||||
chest.item[index++].stack = random.Next(3, 7);
|
||||
}
|
||||
|
||||
if (random.NextBool())
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.Stinger);
|
||||
chest.item[index++].stack = random.Next(4, 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.JungleSpores);
|
||||
chest.item[index++].stack = random.Next(3, 5);
|
||||
}
|
||||
|
||||
if (random.NextBool())
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.RecallPotion);
|
||||
chest.item[index++].stack = random.Next(1, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
chest.item[index].SetDefaults(ItemID.JungleTorch);
|
||||
chest.item[index++].stack = random.Next(18, 36);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Place Rox Shrine
|
||||
public static void PlaceRoxShrine()
|
||||
{
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace CalamityMod.World.Planets
|
||||
}
|
||||
//Place chest
|
||||
int chestID = WorldGen.PlaceChest(testX, testY + 1, 21, false, 29);
|
||||
MiscWorldgenRoutines.FillHoneyChest(chestID, WorldGen.genRand);
|
||||
GiantHive.FillHoneyChest(chestID, WorldGen.genRand);
|
||||
placedChest = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -696,7 +696,9 @@ namespace CalamityMod.World
|
||||
else if (tileAtPosition.HasTile && ValidBeachCovertTiles.Contains(tileAtPosition.TileType) && WorldGen.genRand.NextFloat() >= ditherChance)
|
||||
Main.tile[x, y].TileType = sandID;
|
||||
|
||||
if (tileAtPosition.WallType > WallID.None)
|
||||
//do not replace dungeon walls ever
|
||||
int[] DungeonWalls = { 7, 94, 95, 8, 98, 99, 9, 96, 97 };
|
||||
if (tileAtPosition.WallType > WallID.None && !DungeonWalls.Contains(tileAtPosition.WallType))
|
||||
Main.tile[x, y].WallType = wallID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Mounts;
|
||||
using CalamityMod.Items.Placeables.Furniture;
|
||||
using CalamityMod.Items.SummonItems;
|
||||
@@ -488,14 +488,16 @@ namespace CalamityMod.World
|
||||
int yExtraArea = 40;
|
||||
bool canGenerateInLocation = true;
|
||||
|
||||
float requiredShrooms = 80;
|
||||
float requiredShrooms = 20; //for now lower this, will look through the gen later
|
||||
for (int x = placementPoint.X - extraArea; x < placementPoint.X + schematicSize.X + extraArea; x++)
|
||||
{
|
||||
for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y + yExtraArea; y++)
|
||||
{
|
||||
Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y);
|
||||
|
||||
//For some reason, mushroom biomes are very wet
|
||||
//It gets way too difficult to generate if it doesn't ignore water
|
||||
|
||||
if (ShouldAvoidLocation(new Point(x, y), false))
|
||||
canGenerateInLocation = false;
|
||||
|
||||
@@ -505,7 +507,9 @@ namespace CalamityMod.World
|
||||
}
|
||||
}
|
||||
if (!canGenerateInLocation || realMushroomsInArea < requiredShrooms || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y)))
|
||||
{
|
||||
tries++;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool _ = true;
|
||||
@@ -546,8 +550,10 @@ namespace CalamityMod.World
|
||||
do
|
||||
{
|
||||
int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2f), (int)(Main.maxTilesX * 0.8f));
|
||||
int numTilesBelowSurface = WorldGen.genRand.Next(50, 100);
|
||||
int placementPositionY = (int)WorldGen.worldSurface + numTilesBelowSurface;
|
||||
int numTilesBelowSurface = WorldGen.genRand.Next(25, 50);
|
||||
|
||||
//use Main.worldSurface and not WorldGen.WorldSurface, i believe that is why it was genning on the surface so much
|
||||
int placementPositionY = (int)Main.worldSurface + numTilesBelowSurface;
|
||||
Point placementPoint = new Point(placementPositionX, placementPositionY);
|
||||
|
||||
Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1));
|
||||
|
||||