progress on everything so far
No files matched your search
@@ -9,8 +9,8 @@ namespace CalamityMod.Buffs.Pets
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Sea Slug");
|
||||
Description.SetDefault("The bioluminscent sea slug is following you");
|
||||
DisplayName.SetDefault("Nudibranch");
|
||||
Description.SetDefault("The cutest and most colorful sea creature");
|
||||
Main.buffNoTimeDisplay[Type] = true;
|
||||
Main.vanityPet[Type] = true;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 588 B After Width: | Height: | Size: 537 B |
|
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 |
@@ -13,9 +13,9 @@ namespace CalamityMod.Items.Pets
|
||||
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");
|
||||
DisplayName.SetDefault("Colorful Cerata");
|
||||
Tooltip.SetDefault("Summons a Bioluminescent Nudibranch to follow you"
|
||||
+ "\nThe Nudibranch will change colors and patterns in different environments");
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -25,11 +25,11 @@ namespace CalamityMod.Items.Pets
|
||||
Item.useAnimation = 20;
|
||||
Item.useTime = 20;
|
||||
Item.noMelee = true;
|
||||
Item.width = 26;
|
||||
Item.height = 28;
|
||||
Item.width = 28;
|
||||
Item.height = 22;
|
||||
|
||||
Item.value = Item.sellPrice(gold: 20);
|
||||
Item.rare = ModContent.RarityType<Turquoise>();
|
||||
Item.rare = ItemRarityID.Orange;
|
||||
Item.Calamity().devItem = true;
|
||||
|
||||
Item.shoot = ModContent.ProjectileType<SeaSlug>();
|
||||
|
||||
|
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 510 B |
@@ -16,12 +16,12 @@ namespace CalamityMod.Projectiles.Pets
|
||||
private Form SeaSlugColor = Form.Normal;
|
||||
private enum Form
|
||||
{
|
||||
Normal, Sulphur, Abyss, Sunken, Astral, Hell, Snow, Desert, Jungle, Mushroom
|
||||
Normal, Sulphur, Abyss, Sunken, Astral, Crags, Hell, Snow, Desert, Jungle, Mushroom, Dungeon, Hallow, Corrupt, Crimson
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Sea Slug");
|
||||
DisplayName.SetDefault("Nudibranch");
|
||||
Main.projFrames[Projectile.type] = 6;
|
||||
Main.projPet[Projectile.type] = true;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Pets
|
||||
{
|
||||
Projectile.netImportant = true;
|
||||
Projectile.width = 54;
|
||||
Projectile.height = 38;
|
||||
Projectile.height = 20;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft *= 5;
|
||||
@@ -40,66 +40,131 @@ namespace CalamityMod.Projectiles.Pets
|
||||
|
||||
private void UpdateColor(Player player)
|
||||
{
|
||||
//note to self: the higher it is in this else if chain, the higher the priority
|
||||
|
||||
//sulphur
|
||||
if (player.InSulphur())
|
||||
{
|
||||
SeaSlugColor = Form.Sulphur;
|
||||
}
|
||||
//abyss
|
||||
else if (player.InAbyss())
|
||||
{
|
||||
SeaSlugColor = Form.Abyss;
|
||||
}
|
||||
//sunken sea
|
||||
else if (player.InSunkenSea())
|
||||
{
|
||||
SeaSlugColor = Form.Sunken;
|
||||
}
|
||||
//astral
|
||||
else if (player.InAstral())
|
||||
{
|
||||
SeaSlugColor = Form.Astral;
|
||||
}
|
||||
//brimstone crag
|
||||
else if (player.InCalamity())
|
||||
SeaSlugColor = Form.Crags;
|
||||
//underworld
|
||||
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;
|
||||
}
|
||||
//dungeon
|
||||
else if (player.ZoneDungeon)
|
||||
SeaSlugColor = Form.Dungeon;
|
||||
//mushroom
|
||||
else if (player.ZoneGlowshroom)
|
||||
{
|
||||
SeaSlugColor = Form.Mushroom;
|
||||
}
|
||||
//hallow
|
||||
else if (player.ZoneHallow)
|
||||
SeaSlugColor = Form.Hallow;
|
||||
//corruption
|
||||
else if (player.ZoneCorrupt)
|
||||
SeaSlugColor = Form.Corrupt;
|
||||
//crimson
|
||||
else if (player.ZoneCrimson)
|
||||
SeaSlugColor = Form.Crimson;
|
||||
//jungle
|
||||
else if (player.ZoneJungle)
|
||||
SeaSlugColor = Form.Jungle;
|
||||
//snow
|
||||
else if (player.ZoneSnow)
|
||||
SeaSlugColor = Form.Snow;
|
||||
//desert
|
||||
else if (player.ZoneDesert)
|
||||
SeaSlugColor = Form.Desert;
|
||||
//normal
|
||||
else
|
||||
{
|
||||
SeaSlugColor = Form.Normal;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Draw(lightColor, ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlug").Value);
|
||||
Color newColor = new Color(0, 0, 0, 0);
|
||||
|
||||
//set the body colors of each sea slug variant
|
||||
switch (SeaSlugColor)
|
||||
{
|
||||
case Form.Normal:
|
||||
newColor = new Color(255, 255, 255, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Sulphur:
|
||||
newColor = new Color(36, 166, 125, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Abyss:
|
||||
newColor = new Color(49, 59, 79, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Sunken:
|
||||
newColor = new Color(60, 135, 145, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Astral:
|
||||
newColor = new Color(100, 100, 133, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Crags:
|
||||
newColor = new Color(85, 65, 75, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Hell:
|
||||
newColor = new Color(240, 25, 25, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Snow:
|
||||
newColor = new Color(255, 255, 255, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Desert:
|
||||
newColor = new Color(212, 190, 87, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Jungle:
|
||||
newColor = new Color(105, 80, 85, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Mushroom:
|
||||
newColor = new Color(175, 189, 142, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Dungeon:
|
||||
newColor = new Color(130, 229, 255, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Hallow:
|
||||
newColor = new Color(255, 255, 255, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Corrupt:
|
||||
newColor = new Color(156, 105, 105, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
case Form.Crimson:
|
||||
newColor = new Color(204, 53, 53, 0).MultiplyRGB(lightColor);
|
||||
break;
|
||||
}
|
||||
|
||||
Draw(Projectile.GetAlpha(newColor), 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);
|
||||
DrawGlowmask(Color.White,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugDefault").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugSulphur").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugAbyss").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugSunken").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugAstral").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugCrags").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugHell").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugSnow").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugDesert").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugJungle").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugMushroom").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugDungeon").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugHallow").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugCorrupt").Value,
|
||||
ModContent.Request<Texture2D>("CalamityMod/Projectiles/Pets/SeaSlugCrimson").Value);
|
||||
}
|
||||
|
||||
private void Draw(Color color, Texture2D texture)
|
||||
@@ -113,7 +178,8 @@ namespace CalamityMod.Projectiles.Pets
|
||||
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)
|
||||
private void DrawGlowmask(Color color, Texture2D normal, Texture2D sulphur, Texture2D abyss, Texture2D sunken, Texture2D astral, Texture2D crags,
|
||||
Texture2D hell, Texture2D snow, Texture2D desert, Texture2D jungle, Texture2D mushroom, Texture2D dungeon, Texture2D hallow, Texture2D corrupt, Texture2D crimson)
|
||||
{
|
||||
Texture2D texture = normal;
|
||||
switch (SeaSlugColor)
|
||||
@@ -133,6 +199,9 @@ namespace CalamityMod.Projectiles.Pets
|
||||
case Form.Astral:
|
||||
texture = astral;
|
||||
break;
|
||||
case Form.Crags:
|
||||
texture = crags;
|
||||
break;
|
||||
case Form.Hell:
|
||||
texture = hell;
|
||||
break;
|
||||
@@ -148,6 +217,18 @@ namespace CalamityMod.Projectiles.Pets
|
||||
case Form.Mushroom:
|
||||
texture = mushroom;
|
||||
break;
|
||||
case Form.Dungeon:
|
||||
texture = dungeon;
|
||||
break;
|
||||
case Form.Hallow:
|
||||
texture = hallow;
|
||||
break;
|
||||
case Form.Corrupt:
|
||||
texture = corrupt;
|
||||
break;
|
||||
case Form.Crimson:
|
||||
texture = crimson;
|
||||
break;
|
||||
}
|
||||
|
||||
int height = texture.Height / Main.projFrames[Projectile.type];
|
||||
|
||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.6 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;
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -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
|
||||
@@ -148,9 +150,23 @@ 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.5f;
|
||||
|
||||
if (k < height / 2)
|
||||
{
|
||||
Framing.GetTileSafely(i, j - k).TileFrameX = 3 * 18;
|
||||
}
|
||||
else if (k > height / 2 && k < height / (int)divide)
|
||||
{
|
||||
Framing.GetTileSafely(i, j - k).TileFrameX = 4 * 18;
|
||||
}
|
||||
else if (k > height / (int)divide && k < height)
|
||||
{
|
||||
Framing.GetTileSafely(i, j - k).TileFrameX = 5 * 18;
|
||||
}
|
||||
|
||||
Framing.GetTileSafely(i, j - k).TileFrameY = (short)(Main.rand.Next(3) * 18);
|
||||
branchSegmentDelay = 3;
|
||||
}
|
||||
@@ -300,25 +316,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 +354,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 |
@@ -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) + 200;
|
||||
|
||||
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,657 @@
|
||||
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 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
|
||||
{
|
||||
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 / 6); //start here to not touch floating islands
|
||||
bool validheightFound = false;
|
||||
int attempts = 0;
|
||||
while (!validheightFound && attempts++ < 100000)
|
||||
{
|
||||
|
||||
while (!WorldGen.SolidTile(origin.X, treeHeight) && treeHeight <= Main.worldSurface)
|
||||
{
|
||||
treeHeight++;
|
||||
}
|
||||
|
||||
if (Main.tile[origin.X, treeHeight].HasTile || Main.tile[origin.X, treeHeight].WallType > 0)
|
||||
{
|
||||
validheightFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
while (validheightFound)
|
||||
{
|
||||
int num3 = (origin.Y + treeHeight) / 20; //the height of the tree
|
||||
int num4 = num3 * 5;
|
||||
int num5 = 0;
|
||||
double num6 = WorldGen.genRand.NextDouble() + 1.0;
|
||||
double num7 = WorldGen.genRand.NextDouble() + 2.0;
|
||||
|
||||
if (WorldGen.genRand.Next(2) == 0)
|
||||
{
|
||||
num7 = 0.0 - num7;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num3; i++)
|
||||
{
|
||||
int num8 = (int)(Math.Sin((double)(i + 1) / 12.0 * num6 * 3.1415927410125732) * num7);
|
||||
int num9 = ((num8 < num5) ? (num8 - num5) : 0);
|
||||
|
||||
//places the actual log of the tree
|
||||
WorldUtils.Gen(new Point(origin.X + num5 + num9, origin.Y - (i + 1) * 5), new Shapes.Rectangle(6, 6),
|
||||
Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87), new Actions.RemoveWall(),
|
||||
new Actions.SetTile(383), new Actions.SetFrames()));
|
||||
|
||||
//digs out the hole on the middle of the tree
|
||||
WorldUtils.Gen(new Point(origin.X + num5 + num9 + 2, origin.Y - (i + 1) * 5), new Shapes.Rectangle(2 + Math.Abs(num8 - num5), 5),
|
||||
Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87),
|
||||
new Actions.ClearTile(frameNeighbors: true), new Actions.PlaceWall(78)));
|
||||
|
||||
//place wood walls on the inside of the tree
|
||||
WorldUtils.Gen(new Point(origin.X + num5 + 2, origin.Y - i * 5), new Shapes.Rectangle(6, 6),
|
||||
Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237), new Modifiers.SkipWalls(87),
|
||||
new Actions.ClearTile(frameNeighbors: true), new Actions.PlaceWall(78)));
|
||||
|
||||
num5 = num8;
|
||||
}
|
||||
|
||||
int num10 = 6;
|
||||
if (num7 < 0.0)
|
||||
{
|
||||
num10 = 0;
|
||||
}
|
||||
|
||||
List<Point> list = new List<Point>();
|
||||
|
||||
//loop to place extra branches on the top of the tree
|
||||
for (int j = 0; j < 6; j++)
|
||||
{
|
||||
double num11 = ((double)j + 1.0) / 3.0;
|
||||
int num12 = num10 + (int)(Math.Sin((double)num3 * num11 / 12.0 * num6 * 3.1415927410125732) * num7);
|
||||
double num13 = WorldGen.genRand.NextDouble() * 0.7853981852531433 - 0.7853981852531433 - 0.2;
|
||||
|
||||
if (num10 == 0)
|
||||
{
|
||||
num13 -= 1.5707963705062866;
|
||||
}
|
||||
|
||||
//branches
|
||||
WorldUtils.Gen(new Point(origin.X + num12, origin.Y - (int)((double)(num3 * 5))),
|
||||
new ShapeBranch(num13, WorldGen.genRand.Next(12, 22)).OutputEndpoints(list), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237),
|
||||
new Modifiers.SkipWalls(87), new Actions.SetTile(383), new Actions.SetFrames(frameNeighbors: true)));
|
||||
|
||||
num10 = 6 - num10;
|
||||
}
|
||||
|
||||
int num14 = (int)(Math.Sin((double)num3 / 12.0 * num6 * 3.1415927410125732) * num7);
|
||||
|
||||
//places branches for the leaves to grow on
|
||||
WorldUtils.Gen(new Point(origin.X + 6 + num14, origin.Y - num4), new ShapeBranch(-0.6853981852531433,
|
||||
WorldGen.genRand.Next(16, 22)).OutputEndpoints(list), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237),
|
||||
new Modifiers.SkipWalls(87), new Actions.SetTile(383), new Actions.SetFrames(frameNeighbors: true)));
|
||||
|
||||
WorldUtils.Gen(new Point(origin.X + num14, origin.Y - num4), new ShapeBranch(-2.45619455575943,
|
||||
WorldGen.genRand.Next(16, 22)).OutputEndpoints(list), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237),
|
||||
new Modifiers.SkipWalls(87), new Actions.SetTile(383), new Actions.SetFrames(frameNeighbors: true)));
|
||||
|
||||
foreach (Point item in list)
|
||||
{
|
||||
//place living mahogany leaves
|
||||
WorldUtils.Gen(item, new Shapes.Circle(4), Actions.Chain(new Modifiers.Blotches(WorldGen.genRand.Next(5, 8), WorldGen.genRand.Next(3, 6)),
|
||||
new Modifiers.SkipTiles(383, 21, 467, 226, 237), new Modifiers.SkipWalls(78, 87), new Actions.SetTile(384), new Actions.SetFrames(frameNeighbors: true)));
|
||||
}
|
||||
|
||||
for (int k = 0; k < 5; k++)
|
||||
{
|
||||
double angle = (double)k / 3.0 * 2.0 + 0.57075;
|
||||
WorldUtils.Gen(origin, new ShapeRoot((float)angle, WorldGen.genRand.Next(40, 60)), Actions.Chain(new Modifiers.SkipTiles(21, 467, 226, 237),
|
||||
new Modifiers.SkipWalls(87), new Actions.SetTile(383, setSelfFrames: true)));
|
||||
}
|
||||
|
||||
WorldGen.AddBuriedChest(origin.X + 3, origin.Y - 1, (WorldGen.genRand.Next(4) != 0) ? WorldGen.GetNextJungleChestItem() : 0, notNearOtherChests: false, 10, trySlope: false, 0);
|
||||
|
||||
//i dunno how to use this properly, so disabled it stays
|
||||
//though i guess theres not really any other structures in the surface jungle anyways
|
||||
//structures.AddProtectedStructure(new Rectangle(origin.X - 30, origin.Y - 30, 60, 60));
|
||||
|
||||
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);
|
||||
|
||||
GrowLivingJungleTree(new Point(origin.X, origin.Y));
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.TileType))
|
||||
Main.tile[x, y].WallType = wallID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,7 +500,7 @@ namespace CalamityMod.World
|
||||
canGenerateInLocation = false;
|
||||
|
||||
//Only generated within the area of mushroom plants
|
||||
if (tile.TileType == TileID.MushroomPlants || tile.TileType == TileID.MushroomVines || tile.TileType == TileID.MushroomTrees)
|
||||
if (tile.TileType == TileID.MushroomGrass || tile.TileType == TileID.MushroomPlants || tile.TileType == TileID.MushroomVines || tile.TileType == TileID.MushroomTrees)
|
||||
realMushroomsInArea++;
|
||||
}
|
||||
}
|
||||
|
||||